Completely rework how icons work in mqtt control map
This commit is contained in:
parent
8a37cf2c95
commit
ed0f22645e
14 changed files with 216 additions and 111 deletions
|
|
@ -185,7 +185,7 @@ export class DropDown extends UiControl<UIDropDown> {
|
|||
}
|
||||
|
||||
export class Slider extends UiControl<UISlider> {
|
||||
runPrimaryAction = (_e: ?any, v: ?number) => {
|
||||
runPrimaryAction = (e: ?Event, v: ?number) => {
|
||||
if (v != null) {
|
||||
this.changeState(v);
|
||||
}
|
||||
|
|
@ -197,8 +197,9 @@ export class Slider extends UiControl<UISlider> {
|
|||
<SliderComponent key="slidercomponent"
|
||||
value={this.getValue().internal || this.getValue().actual}
|
||||
min={this.props.item.min || 0} max={this.props.item.max || 0}
|
||||
step={this.props.item.step || 0}
|
||||
onChange={() => this.props.item.delayedApply || this.runPrimaryAction()}
|
||||
step={this.props.item.step || 1}
|
||||
onChange={(e, v) =>
|
||||
this.props.item.delayedApply || this.runPrimaryAction(e, v)}
|
||||
onDragEnd={this.runPrimaryAction}
|
||||
disabled={!this.isEnabled()} />
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import React from "react";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
||||
import { renderIcon } from "utils/parseIconName";
|
||||
import { renderIcon } from "config/icon";
|
||||
|
||||
import type { ControlUI } from "config/flowtypes";
|
||||
|
||||
|
|
@ -33,7 +33,9 @@ export default class UiItemList extends React.PureComponent<UiItemListProps> {
|
|||
return (
|
||||
<ListItem key={key}>
|
||||
{control.icon == null ||
|
||||
<ListItemIcon>{renderIcon(control.icon, "mdi-24px")}</ListItemIcon>}
|
||||
<ListItemIcon>
|
||||
{renderIcon(control.icon, this.props.state, "mdi-24px")}
|
||||
</ListItemIcon>}
|
||||
{this.renderControl(control)}
|
||||
</ListItem>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue