@iobroker/json-config 7.6.2 → 7.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -29
- package/build/JsonConfigComponent/ConfigAccordion.js +1 -1
- package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/build/JsonConfigComponent/ConfigColor.js +1 -1
- package/build/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.d.ts +2 -1
- package/build/JsonConfigComponent/ConfigGeneric.js +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPanel.d.ts +1 -0
- package/build/JsonConfigComponent/ConfigPanel.js +10 -3
- package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelect.js +3 -3
- package/build/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.js +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigState.js +32 -19
- package/build/JsonConfigComponent/ConfigState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTable.js +2 -2
- package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTabs.d.ts +1 -0
- package/build/JsonConfigComponent/ConfigTabs.js +8 -1
- package/build/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/build/JsonConfigComponent/ConfigText.js +1 -1
- package/build/JsonConfigComponent/ConfigText.js.map +1 -1
- package/build/JsonConfigComponent/index.d.ts +1 -0
- package/build/JsonConfigComponent/index.js +3 -4
- package/build/JsonConfigComponent/index.js.map +1 -1
- package/build/types.d.ts +6 -5
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ To enable the validation of the jsonConfig in VS code, the following section mus
|
|
|
115
115
|
"json.schemas": [
|
|
116
116
|
{
|
|
117
117
|
"fileMatch": ["admin/jsonConfig.json", "admin/jsonCustom.json", "admin/jsonTab.json"],
|
|
118
|
-
"url": "https://raw.githubusercontent.com/ioBroker/
|
|
118
|
+
"url": "https://raw.githubusercontent.com/ioBroker/ioBroker.admin/master/packages/jsonConfig/schemas/jsonConfig.json"
|
|
119
119
|
}
|
|
120
120
|
]
|
|
121
121
|
```
|
|
@@ -1091,32 +1091,34 @@ Special input for ports. It checks automatically if port is used by other instan
|
|
|
1091
1091
|
|
|
1092
1092
|
(admin >= 7.1.0) Show control or information from the state
|
|
1093
1093
|
|
|
1094
|
-
| Property
|
|
1095
|
-
|
|
1096
|
-
| `oid`
|
|
1097
|
-
| `system`
|
|
1098
|
-
| `foreign`
|
|
1099
|
-
| `control`
|
|
1100
|
-
| `controlled`
|
|
1101
|
-
| `unit`
|
|
1102
|
-
| `trueText`
|
|
1103
|
-
| `trueTextStyle`
|
|
1104
|
-
| `falseText`
|
|
1105
|
-
| `falseTextStyle`
|
|
1106
|
-
| `trueImage`
|
|
1107
|
-
| `falseImage`
|
|
1108
|
-
| `min`
|
|
1109
|
-
| `max`
|
|
1110
|
-
| `step`
|
|
1111
|
-
| `controlDelay`
|
|
1112
|
-
| `variant`
|
|
1113
|
-
| `readOnly`
|
|
1114
|
-
| `narrow`
|
|
1115
|
-
| `blinkOnUpdate`
|
|
1116
|
-
| `size`
|
|
1117
|
-
| `addColon`
|
|
1118
|
-
| `labelIcon`
|
|
1119
|
-
| `buttonValue`
|
|
1094
|
+
| Property | Description |
|
|
1095
|
+
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
1096
|
+
| `oid` | Which object ID should be taken for the controlling. The ID is without `adapter.X.` prefix |
|
|
1097
|
+
| `system` | If true, the state will be taken from `system.adapter.X.` and not from `adapter.X` |
|
|
1098
|
+
| `foreign` | The `oid` is absolute and no need to add `adapter.X` or `system.adapter.X.` to oid |
|
|
1099
|
+
| `control` | How the value of the state should be shown: `text`, `html`, `input`, `slider`, `select`, `button`, `switch`, `number` |
|
|
1100
|
+
| `controlled` | If true, the state will be shown as switch, select, button, slider or text input. Used only if no control property is defined |
|
|
1101
|
+
| `unit` | Add unit to the value |
|
|
1102
|
+
| `trueText` | this text will be shown if the value is true |
|
|
1103
|
+
| `trueTextStyle` | Style of the text if the value is true |
|
|
1104
|
+
| `falseText` | this text will be shown if the value is false or if the control is a "button" |
|
|
1105
|
+
| `falseTextStyle` | Style of the text if the value is false or if the control is a "button" |
|
|
1106
|
+
| `trueImage` | This image will be shown if the value is true |
|
|
1107
|
+
| `falseImage` | This image will be shown if the value is false or if the control is a "button" |
|
|
1108
|
+
| `min` | Minimum value for control type slider or number |
|
|
1109
|
+
| `max` | Maximum value for control type slider or number |
|
|
1110
|
+
| `step` | Step value for control type slider or number |
|
|
1111
|
+
| `controlDelay` | delay in ms for slider or number |
|
|
1112
|
+
| `variant` | Variant of button: `contained`, `outlined`, `text` |
|
|
1113
|
+
| `readOnly` | Defines if the control is read-only |
|
|
1114
|
+
| `narrow` | Normally the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label |
|
|
1115
|
+
| `blinkOnUpdate` | Value should blink when updated (true or color) |
|
|
1116
|
+
| `size` | Font size: small, normal, large or number |
|
|
1117
|
+
| `addColon` | Add to label the colon at the end if not exist in label |
|
|
1118
|
+
| `labelIcon` | Base64 icon for label |
|
|
1119
|
+
| `buttonValue` | Optional value, that will be sent for button |
|
|
1120
|
+
| `showEnterButton` | Show SET button. The value in this case will be sent only when the button is pressed. You can define the text of the button. Default text is "Set" (Only for "input", "number" or "slider") |
|
|
1121
|
+
| `setOnEnterKey` | The value in this case will be sent only when the "Enter" button is pressed. It can be combined with `showEnterButton` |
|
|
1120
1122
|
|
|
1121
1123
|
### `staticInfo`
|
|
1122
1124
|
|
|
@@ -1516,7 +1518,7 @@ onMessage = (obj: ioBroker.Message): void => {
|
|
|
1516
1518
|
```
|
|
1517
1519
|
|
|
1518
1520
|
## Report a schema error
|
|
1519
|
-
Create an issue here: https://github.com/ioBroker/
|
|
1521
|
+
Create an issue here: https://github.com/ioBroker/ioBroker.admin/issues
|
|
1520
1522
|
|
|
1521
1523
|
## For maintainer
|
|
1522
|
-
To update the location of JsonConfig schema, create pull request to this file: https://github.com/
|
|
1524
|
+
To update the location of JsonConfig schema, create pull request to this file: https://github.com/ioBroker/ioBroker.admin/blob/master/packages/jsonConfig/schemas/jsonConfig.json
|
|
@@ -58,7 +58,7 @@ class ConfigAccordion extends ConfigGeneric {
|
|
|
58
58
|
}, {}),
|
|
59
59
|
style: { marginLeft: '-8px', marginTop: '10px', marginBottom: '10px' },
|
|
60
60
|
};
|
|
61
|
-
return (React.createElement(ConfigPanel, { oContext: this.props.oContext, index: idx + this.state.iteration, arrayIndex: idx, changed: this.props.changed, globalData: this.props.data, common: this.props.common, alive: this.props.alive, themeName: this.props.themeName, data: data, custom: true, schema: schemaItem, originalData: this.props.originalData, onChange: (attr, valueChange) => {
|
|
61
|
+
return (React.createElement(ConfigPanel, { oContext: this.props.oContext, index: idx + this.state.iteration, arrayIndex: idx, changed: this.props.changed, expertMode: this.props.expertMode, globalData: this.props.data, common: this.props.common, alive: this.props.alive, themeName: this.props.themeName, data: data, custom: true, schema: schemaItem, originalData: this.props.originalData, onChange: (attr, valueChange) => {
|
|
62
62
|
const newObj = JSON.parse(JSON.stringify(value));
|
|
63
63
|
newObj[idx][attr] = valueChange;
|
|
64
64
|
this.setState({ value: newObj }, () => this.onChangeWrapper(newObj));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigAccordion.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,KAAK,EACL,OAAO,EACP,OAAO,EACP,UAAU,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,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M,CAAC,OAAO,EAAE,EAAE;4BAE7C,oBAAC,UAAU,IACP,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;gCAExB,oBAAC,eAAe,OAAG,CACV,CACP,CACb,CAAC,CAAC,CAAC,IAAI,CACF,CACK,CACX,CACf,CAAC;YACD,CAAC,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACpC,oBAAC,OAAO,IACJ,OAAO,EAAC,OAAO,EACf,EAAE,EAAE,MAAM,CAAC,QAAQ;gBAEnB,oBAAC,UAAU,IACP,IAAI,EAAC,OAAO,EACZ,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,IAAI,CAAC,KAAK;oBAEnB,oBAAC,OAAO,OAAG,CACF,CACP,CACb,CAAC,CAAC,CAAC,IAAI;YACP,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACX,oBAAC,cAAc,QACV,IAAI,CAAC,UAAU,CACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACY,CACpB,CAAC,CAAC,CAAC,IAAI,CACJ,CACX,CAAC;IACN,CAAC;CACJ;AAED,eAAe,eAAe,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n FormHelperText,\n Accordion,\n AccordionSummary,\n AccordionDetails,\n IconButton,\n Paper,\n Toolbar,\n Tooltip,\n Typography,\n} from '@mui/material';\n\nimport {\n Add as AddIcon,\n Delete as DeleteIcon,\n ArrowUpward as UpIcon,\n ArrowDownward as DownIcon,\n ContentCopy as CopyContentIcon,\n ExpandMore as ExpandMoreIcon,\n} from '@mui/icons-material';\n\nimport { I18n, type IobTheme, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemAccordion, ConfigItemAny, ConfigItemIndexed, ConfigItemPanel } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nimport ConfigPanel from './ConfigPanel';\n\nconst styles: Record<string, any> = {\n fullWidth: {\n width: '100%',\n },\n accordionSummary: (theme: IobTheme): React.CSSProperties => ({\n backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.08)' : 'rgba(0, 0, 0, 0.08)',\n }),\n accordionTitle: {\n // fontWeight: 'bold',\n },\n toolbar: (theme: IobTheme): React.CSSProperties => ({\n backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.08)' : 'rgba(0, 0, 0, 0.08)',\n borderRadius: '3px',\n }),\n tooltip: {\n pointerEvents: 'none',\n },\n};\n\ninterface ConfigAccordionProps extends ConfigGenericProps {\n schema: ConfigItemAccordion;\n}\n\ninterface ConfigAccordionState extends ConfigGenericState {\n value: Record<string, any>[];\n activeIndex: number;\n iteration: number;\n}\n\nclass ConfigAccordion extends ConfigGeneric<ConfigAccordionProps, ConfigAccordionState> {\n private typingTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor(props: ConfigAccordionProps) {\n super(props);\n this.props.schema.items = this.props.schema.items || [];\n }\n\n componentDidMount(): void {\n super.componentDidMount();\n\n let value = ConfigGeneric.getValue(this.props.data, this.props.attr) || [];\n\n if (!Array.isArray(value)) {\n value = [];\n }\n\n this.setState({\n value,\n activeIndex: -1,\n iteration: 0,\n });\n }\n\n componentWillUnmount(): void {\n if (this.typingTimer) {\n clearTimeout(this.typingTimer);\n this.typingTimer = null;\n }\n super.componentWillUnmount();\n }\n\n itemAccordion(data: Record<string, any>, idx: number): JSX.Element {\n const { value } = this.state;\n const { schema } = this.props;\n\n const schemaItem: ConfigItemPanel = {\n type: 'panel',\n items: schema.items.reduce(\n (accumulator: Record<string, ConfigItemIndexed>, currentValue: ConfigItemIndexed) => {\n accumulator[currentValue.attr] = currentValue;\n return accumulator;\n },\n {},\n ) as Record<string, ConfigItemAny>,\n style: { marginLeft: '-8px', marginTop: '10px', marginBottom: '10px' },\n };\n\n return (\n <ConfigPanel\n oContext={this.props.oContext}\n index={idx + this.state.iteration}\n arrayIndex={idx}\n changed={this.props.changed}\n globalData={this.props.data}\n common={this.props.common}\n alive={this.props.alive}\n themeName={this.props.themeName}\n data={data}\n custom\n schema={schemaItem}\n originalData={this.props.originalData}\n onChange={(attr: string, valueChange: any): void => {\n const newObj: Record<string, any> = JSON.parse(JSON.stringify(value));\n newObj[idx][attr] = valueChange;\n this.setState({ value: newObj } as ConfigAccordionState, () => this.onChangeWrapper(newObj));\n }}\n onError={(error, attr) => this.onError(error, attr)}\n table={this.props.table}\n />\n );\n }\n\n onDelete = (index: number) => (): void => {\n const newValue = JSON.parse(JSON.stringify(this.state.value));\n newValue.splice(index, 1);\n\n this.setState({ value: newValue, iteration: this.state.iteration + 10000 }, () =>\n this.onChangeWrapper(newValue),\n );\n };\n\n onClone = (index: number) => (): void => {\n const newValue = JSON.parse(JSON.stringify(this.state.value)) as Record<string, any>[];\n const cloned = JSON.parse(JSON.stringify(newValue[index]));\n if (typeof this.props.schema.clone === 'string' && typeof cloned[this.props.schema.clone] === 'string') {\n let i = 1;\n let text = cloned[this.props.schema.clone];\n const pattern = text.match(/(\\d+)$/);\n if (pattern) {\n text = text.replace(pattern[0], '');\n i = parseInt(pattern[0], 10) + 1;\n } else {\n text += '_';\n }\n while (newValue.find(it => it[this.props.schema.clone as string] === text + i.toString())) {\n i++;\n }\n cloned[this.props.schema.clone] = `${cloned[this.props.schema.clone]}_${i}`;\n }\n\n newValue.splice(index, 0, cloned);\n\n this.setState(\n {\n value: newValue,\n activeIndex: -1,\n iteration: this.state.iteration + 10000,\n },\n () => this.onChangeWrapper(newValue),\n );\n };\n\n onChangeWrapper = (newValue: any): void => {\n if (this.typingTimer) {\n clearTimeout(this.typingTimer);\n }\n\n this.typingTimer = setTimeout(\n value => {\n this.typingTimer = null;\n\n const mayByPromise = this.onChange(this.props.attr, value);\n if (mayByPromise instanceof Promise) {\n void mayByPromise.catch(e => this.onError(e));\n }\n },\n 300,\n newValue,\n );\n };\n\n onAdd = (): void => {\n const { schema } = this.props;\n const newValue = JSON.parse(JSON.stringify(this.state.value));\n const newItem: Record<string, any> =\n schema.items &&\n schema.items.reduce((accumulator: Record<string, any>, currentValue: ConfigItemIndexed) => {\n let defaultValue;\n if (currentValue.defaultFunc) {\n if (this.props.custom) {\n defaultValue = currentValue.defaultFunc\n ? this.executeCustom(\n currentValue.defaultFunc,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n newValue.length,\n this.props.data,\n )\n : this.props.schema.default;\n } else {\n defaultValue = currentValue.defaultFunc\n ? this.execute(\n currentValue.defaultFunc,\n this.props.schema.default,\n this.props.data,\n newValue.length,\n this.props.data,\n )\n : this.props.schema.default;\n }\n } else {\n defaultValue = currentValue.default === undefined ? null : currentValue.default;\n }\n\n accumulator[currentValue.attr] = defaultValue;\n return accumulator;\n }, {});\n\n newValue.push(newItem);\n\n this.setState({ value: newValue, activeIndex: newValue.length - 1 }, () => this.onChangeWrapper(newValue));\n };\n\n onMoveUp(idx: number): void {\n const newValue = JSON.parse(JSON.stringify(this.state.value));\n const item = newValue[idx];\n newValue.splice(idx, 1);\n newValue.splice(idx - 1, 0, item);\n\n const newIndex = this.state.activeIndex - 1;\n this.setState({ value: newValue, activeIndex: newIndex, iteration: this.state.iteration + 10000 }, () =>\n this.onChangeWrapper(newValue),\n );\n }\n\n onMoveDown(idx: number): void {\n const newValue = JSON.parse(JSON.stringify(this.state.value));\n const item = newValue[idx];\n newValue.splice(idx, 1);\n newValue.splice(idx + 1, 0, item);\n\n const newIndex = this.state.activeIndex + 1;\n this.setState({ value: newValue, activeIndex: newIndex, iteration: this.state.iteration + 10000 }, () =>\n this.onChangeWrapper(newValue),\n );\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element | null {\n const { schema } = this.props;\n const { value } = this.state;\n\n if (!value) {\n return null;\n }\n\n return (\n <Paper>\n {schema.label || !schema.noDelete ? (\n <Toolbar variant=\"dense\">\n {schema.label ? (\n <Typography\n variant=\"h6\"\n id=\"tableTitle\"\n component=\"div\"\n >\n {this.getText(schema.label)}\n </Typography>\n ) : null}\n {!schema.noDelete ? (\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={this.onAdd}\n >\n <AddIcon />\n </IconButton>\n ) : null}\n </Toolbar>\n ) : null}\n {value.map((idx, i) => (\n <Accordion\n key={`${idx as unknown as string}_${i}`}\n expanded={this.state.activeIndex === i}\n onChange={(_e, expanded) => this.setState({ activeIndex: expanded ? i : -1 })}\n >\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n sx={Utils.getStyle(this.props.oContext.theme, styles.fullWidth, styles.accordionSummary)}\n >\n <Typography style={styles.accordionTitle}>{idx[schema.titleAttr]}</Typography>\n </AccordionSummary>\n <AccordionDetails\n style={{\n ...schema.style,\n ...(this.props.oContext.themeType ? schema.darkStyle : undefined),\n }}\n >\n {this.itemAccordion(value[i], i)}\n <Toolbar sx={styles.toolbar}>\n {i ? (\n <Tooltip\n title={I18n.t('ra_Move up')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <IconButton\n size=\"small\"\n onClick={() => this.onMoveUp(i)}\n >\n <UpIcon />\n </IconButton>\n </Tooltip>\n ) : (\n <div style={styles.buttonEmpty} />\n )}\n {i < value.length - 1 ? (\n <Tooltip\n title={I18n.t('ra_Move down')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <IconButton\n size=\"small\"\n onClick={() => this.onMoveDown(i)}\n >\n <DownIcon />\n </IconButton>\n </Tooltip>\n ) : (\n <div style={styles.buttonEmpty} />\n )}\n {!schema.noDelete ? (\n <Tooltip\n title={I18n.t('ra_Delete current row')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <IconButton\n size=\"small\"\n onClick={this.onDelete(i)}\n >\n <DeleteIcon />\n </IconButton>\n </Tooltip>\n ) : null}\n {schema.clone ? (\n <Tooltip\n title={I18n.t('ra_Clone current row')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <IconButton\n size=\"small\"\n onClick={this.onClone(i)}\n >\n <CopyContentIcon />\n </IconButton>\n </Tooltip>\n ) : null}\n </Toolbar>\n </AccordionDetails>\n </Accordion>\n ))}\n {!schema.noDelete && value.length > 0 ? (\n <Toolbar\n variant=\"dense\"\n sx={styles.rootTool}\n >\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={this.onAdd}\n >\n <AddIcon />\n </IconButton>\n </Toolbar>\n ) : null}\n {schema.help ? (\n <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText>\n ) : null}\n </Paper>\n );\n }\n}\n\nexport default ConfigAccordion;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigAccordion.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,KAAK,EACL,OAAO,EACP,OAAO,EACP,UAAU,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,GAAG,IAAI,OAAO,EACd,MAAM,IAAI,UAAU,EACpB,WAAW,IAAI,MAAM,EACrB,aAAa,IAAI,QAAQ,EACzB,WAAW,IAAI,eAAe,EAC9B,UAAU,IAAI,cAAc,GAC/B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAiB,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGxE,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,GAAwB;IAChC,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;IACD,gBAAgB,EAAE,CAAC,KAAe,EAAuB,EAAE,CAAC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EnB,oBAAC,UAAU,IACP,IAAI,EAAC,OAAO,EACZ,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,IAAI,CAAC,KAAK;oBAEnB,oBAAC,OAAO,OAAG,CACF,CACP,CACb,CAAC,CAAC,CAAC,IAAI;YACP,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACX,oBAAC,cAAc,QACV,IAAI,CAAC,UAAU,CACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACY,CACpB,CAAC,CAAC,CAAC,IAAI,CACJ,CACX,CAAC;IACN,CAAC;CACJ;AAED,eAAe,eAAe,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n FormHelperText,\n Accordion,\n AccordionSummary,\n AccordionDetails,\n IconButton,\n Paper,\n Toolbar,\n Tooltip,\n Typography,\n} from '@mui/material';\n\nimport {\n Add as AddIcon,\n Delete as DeleteIcon,\n ArrowUpward as UpIcon,\n ArrowDownward as DownIcon,\n ContentCopy as CopyContentIcon,\n ExpandMore as ExpandMoreIcon,\n} from '@mui/icons-material';\n\nimport { I18n, type IobTheme, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemAccordion, ConfigItemAny, ConfigItemIndexed, ConfigItemPanel } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nimport ConfigPanel from './ConfigPanel';\n\nconst styles: Record<string, any> = {\n fullWidth: {\n width: '100%',\n },\n accordionSummary: (theme: IobTheme): React.CSSProperties => ({\n backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.08)' : 'rgba(0, 0, 0, 0.08)',\n }),\n accordionTitle: {\n // fontWeight: 'bold',\n },\n toolbar: (theme: IobTheme): React.CSSProperties => ({\n backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.08)' : 'rgba(0, 0, 0, 0.08)',\n borderRadius: '3px',\n }),\n tooltip: {\n pointerEvents: 'none',\n },\n};\n\ninterface ConfigAccordionProps extends ConfigGenericProps {\n schema: ConfigItemAccordion;\n}\n\ninterface ConfigAccordionState extends ConfigGenericState {\n value: Record<string, any>[];\n activeIndex: number;\n iteration: number;\n}\n\nclass ConfigAccordion extends ConfigGeneric<ConfigAccordionProps, ConfigAccordionState> {\n private typingTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor(props: ConfigAccordionProps) {\n super(props);\n this.props.schema.items = this.props.schema.items || [];\n }\n\n componentDidMount(): void {\n super.componentDidMount();\n\n let value = ConfigGeneric.getValue(this.props.data, this.props.attr) || [];\n\n if (!Array.isArray(value)) {\n value = [];\n }\n\n this.setState({\n value,\n activeIndex: -1,\n iteration: 0,\n });\n }\n\n componentWillUnmount(): void {\n if (this.typingTimer) {\n clearTimeout(this.typingTimer);\n this.typingTimer = null;\n }\n super.componentWillUnmount();\n }\n\n itemAccordion(data: Record<string, any>, idx: number): JSX.Element {\n const { value } = this.state;\n const { schema } = this.props;\n\n const schemaItem: ConfigItemPanel = {\n type: 'panel',\n items: schema.items.reduce(\n (accumulator: Record<string, ConfigItemIndexed>, currentValue: ConfigItemIndexed) => {\n accumulator[currentValue.attr] = currentValue;\n return accumulator;\n },\n {},\n ) as Record<string, ConfigItemAny>,\n style: { marginLeft: '-8px', marginTop: '10px', marginBottom: '10px' },\n };\n\n return (\n <ConfigPanel\n oContext={this.props.oContext}\n index={idx + this.state.iteration}\n arrayIndex={idx}\n changed={this.props.changed}\n expertMode={this.props.expertMode}\n globalData={this.props.data}\n common={this.props.common}\n alive={this.props.alive}\n themeName={this.props.themeName}\n data={data}\n custom\n schema={schemaItem}\n originalData={this.props.originalData}\n onChange={(attr: string, valueChange: any): void => {\n const newObj: Record<string, any> = JSON.parse(JSON.stringify(value));\n newObj[idx][attr] = valueChange;\n this.setState({ value: newObj } as ConfigAccordionState, () => this.onChangeWrapper(newObj));\n }}\n onError={(error, attr) => this.onError(error, attr)}\n table={this.props.table}\n />\n );\n }\n\n onDelete = (index: number) => (): void => {\n const newValue = JSON.parse(JSON.stringify(this.state.value));\n newValue.splice(index, 1);\n\n this.setState({ value: newValue, iteration: this.state.iteration + 10000 }, () =>\n this.onChangeWrapper(newValue),\n );\n };\n\n onClone = (index: number) => (): void => {\n const newValue = JSON.parse(JSON.stringify(this.state.value)) as Record<string, any>[];\n const cloned = JSON.parse(JSON.stringify(newValue[index]));\n if (typeof this.props.schema.clone === 'string' && typeof cloned[this.props.schema.clone] === 'string') {\n let i = 1;\n let text = cloned[this.props.schema.clone];\n const pattern = text.match(/(\\d+)$/);\n if (pattern) {\n text = text.replace(pattern[0], '');\n i = parseInt(pattern[0], 10) + 1;\n } else {\n text += '_';\n }\n while (newValue.find(it => it[this.props.schema.clone as string] === text + i.toString())) {\n i++;\n }\n cloned[this.props.schema.clone] = `${cloned[this.props.schema.clone]}_${i}`;\n }\n\n newValue.splice(index, 0, cloned);\n\n this.setState(\n {\n value: newValue,\n activeIndex: -1,\n iteration: this.state.iteration + 10000,\n },\n () => this.onChangeWrapper(newValue),\n );\n };\n\n onChangeWrapper = (newValue: any): void => {\n if (this.typingTimer) {\n clearTimeout(this.typingTimer);\n }\n\n this.typingTimer = setTimeout(\n value => {\n this.typingTimer = null;\n\n const mayByPromise = this.onChange(this.props.attr, value);\n if (mayByPromise instanceof Promise) {\n void mayByPromise.catch(e => this.onError(e));\n }\n },\n 300,\n newValue,\n );\n };\n\n onAdd = (): void => {\n const { schema } = this.props;\n const newValue = JSON.parse(JSON.stringify(this.state.value));\n const newItem: Record<string, any> =\n schema.items &&\n schema.items.reduce((accumulator: Record<string, any>, currentValue: ConfigItemIndexed) => {\n let defaultValue;\n if (currentValue.defaultFunc) {\n if (this.props.custom) {\n defaultValue = currentValue.defaultFunc\n ? this.executeCustom(\n currentValue.defaultFunc,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n newValue.length,\n this.props.data,\n )\n : this.props.schema.default;\n } else {\n defaultValue = currentValue.defaultFunc\n ? this.execute(\n currentValue.defaultFunc,\n this.props.schema.default,\n this.props.data,\n newValue.length,\n this.props.data,\n )\n : this.props.schema.default;\n }\n } else {\n defaultValue = currentValue.default === undefined ? null : currentValue.default;\n }\n\n accumulator[currentValue.attr] = defaultValue;\n return accumulator;\n }, {});\n\n newValue.push(newItem);\n\n this.setState({ value: newValue, activeIndex: newValue.length - 1 }, () => this.onChangeWrapper(newValue));\n };\n\n onMoveUp(idx: number): void {\n const newValue = JSON.parse(JSON.stringify(this.state.value));\n const item = newValue[idx];\n newValue.splice(idx, 1);\n newValue.splice(idx - 1, 0, item);\n\n const newIndex = this.state.activeIndex - 1;\n this.setState({ value: newValue, activeIndex: newIndex, iteration: this.state.iteration + 10000 }, () =>\n this.onChangeWrapper(newValue),\n );\n }\n\n onMoveDown(idx: number): void {\n const newValue = JSON.parse(JSON.stringify(this.state.value));\n const item = newValue[idx];\n newValue.splice(idx, 1);\n newValue.splice(idx + 1, 0, item);\n\n const newIndex = this.state.activeIndex + 1;\n this.setState({ value: newValue, activeIndex: newIndex, iteration: this.state.iteration + 10000 }, () =>\n this.onChangeWrapper(newValue),\n );\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element | null {\n const { schema } = this.props;\n const { value } = this.state;\n\n if (!value) {\n return null;\n }\n\n return (\n <Paper>\n {schema.label || !schema.noDelete ? (\n <Toolbar variant=\"dense\">\n {schema.label ? (\n <Typography\n variant=\"h6\"\n id=\"tableTitle\"\n component=\"div\"\n >\n {this.getText(schema.label)}\n </Typography>\n ) : null}\n {!schema.noDelete ? (\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={this.onAdd}\n >\n <AddIcon />\n </IconButton>\n ) : null}\n </Toolbar>\n ) : null}\n {value.map((idx, i) => (\n <Accordion\n key={`${idx as unknown as string}_${i}`}\n expanded={this.state.activeIndex === i}\n onChange={(_e, expanded) => this.setState({ activeIndex: expanded ? i : -1 })}\n >\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n sx={Utils.getStyle(this.props.oContext.theme, styles.fullWidth, styles.accordionSummary)}\n >\n <Typography style={styles.accordionTitle}>{idx[schema.titleAttr]}</Typography>\n </AccordionSummary>\n <AccordionDetails\n style={{\n ...schema.style,\n ...(this.props.oContext.themeType ? schema.darkStyle : undefined),\n }}\n >\n {this.itemAccordion(value[i], i)}\n <Toolbar sx={styles.toolbar}>\n {i ? (\n <Tooltip\n title={I18n.t('ra_Move up')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <IconButton\n size=\"small\"\n onClick={() => this.onMoveUp(i)}\n >\n <UpIcon />\n </IconButton>\n </Tooltip>\n ) : (\n <div style={styles.buttonEmpty} />\n )}\n {i < value.length - 1 ? (\n <Tooltip\n title={I18n.t('ra_Move down')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <IconButton\n size=\"small\"\n onClick={() => this.onMoveDown(i)}\n >\n <DownIcon />\n </IconButton>\n </Tooltip>\n ) : (\n <div style={styles.buttonEmpty} />\n )}\n {!schema.noDelete ? (\n <Tooltip\n title={I18n.t('ra_Delete current row')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <IconButton\n size=\"small\"\n onClick={this.onDelete(i)}\n >\n <DeleteIcon />\n </IconButton>\n </Tooltip>\n ) : null}\n {schema.clone ? (\n <Tooltip\n title={I18n.t('ra_Clone current row')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <IconButton\n size=\"small\"\n onClick={this.onClone(i)}\n >\n <CopyContentIcon />\n </IconButton>\n </Tooltip>\n ) : null}\n </Toolbar>\n </AccordionDetails>\n </Accordion>\n ))}\n {!schema.noDelete && value.length > 0 ? (\n <Toolbar\n variant=\"dense\"\n sx={styles.rootTool}\n >\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={this.onAdd}\n >\n <AddIcon />\n </IconButton>\n </Toolbar>\n ) : null}\n {schema.help ? (\n <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText>\n ) : null}\n </Paper>\n );\n }\n}\n\nexport default ConfigAccordion;\n"]}
|
|
@@ -34,7 +34,7 @@ class ConfigColor extends ConfigGeneric {
|
|
|
34
34
|
readOnly: this.props.schema.readOnly || false,
|
|
35
35
|
},
|
|
36
36
|
input: {
|
|
37
|
-
endAdornment: !this.props.schema.readOnly && value && !this.props.schema.noClearButton ? (React.createElement(IconButton, { size: "small", onClick: e => {
|
|
37
|
+
endAdornment: !this.props.schema.readOnly && value && !this.props.schema.noClearButton ? (React.createElement(IconButton, { tabIndex: -1, size: "small", onClick: e => {
|
|
38
38
|
e.stopPropagation();
|
|
39
39
|
const mayBePromise = this.onChange(this.props.attr, '');
|
|
40
40
|
if (mayBePromise instanceof Promise) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigColor.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigColor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,YAAY,EAAoB,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGnD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAWlG,MAAM,WAAY,SAAQ,aAAiD;IACvE,iBAAiB;QACb,OAAO,CACH,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,IAAI,CAC5B,oBAAC,MAAM,IACH,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,EACxD,IAAI,EAAE,IAAI,CAA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1E,CAAC;4BACL,CAAC;4BAED,oBAAC,SAAS,OAAG,CACJ,CAChB,CAAC,CAAC,CAAC,SAAS;qBACpB;oBACD,UAAU,EAAE;wBACR,MAAM,EAAE,IAAI;qBACf;iBACJ,GACH,CACH,CACN,CAAC;IACN,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\nimport { ChromePicker, type ColorResult } from 'react-color';\n\nimport { IconButton, TextField, Dialog } from '@mui/material';\n\nimport { Close as ClearIcon } from '@mui/icons-material';\n\nimport { Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemText } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigColorProps extends ConfigGenericProps {\n schema: ConfigItemText;\n}\n\ninterface ConfigColorState extends ConfigGenericState {\n showColorDialog?: boolean;\n colorDialogValue?: string;\n}\n\nclass ConfigColor extends ConfigGeneric<ConfigColorProps, ConfigColorState> {\n renderColorDialog(): JSX.Element | null {\n return (\n !!this.state.showColorDialog && (\n <Dialog\n onClose={() => this.setState({ showColorDialog: false })}\n open={this.state.showColorDialog}\n >\n <ChromePicker\n color={this.state.colorDialogValue}\n onChange={(color: ColorResult) =>\n this.setState({ colorDialogValue: color.hex }, () =>\n this.onChange(this.props.attr, this.state.colorDialogValue),\n )\n }\n />\n </Dialog>\n )\n );\n }\n\n renderItem(_error: unknown, disabled: boolean /* , defaultValue */): JSX.Element {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n let textColor = Utils.isUseBright(value, null);\n if (textColor === null) {\n textColor = undefined;\n }\n return (\n <>\n {this.renderColorDialog()}\n <TextField\n variant=\"standard\"\n disabled={!!disabled}\n style={{ minWidth: 100, width: 'calc(100% - 8px)' }}\n label={this.getText(this.props.schema.label)}\n value={value || ''}\n onClick={() =>\n !this.props.schema.readOnly &&\n this.setState({ showColorDialog: true, colorDialogValue: value || '' })\n }\n onChange={e => {\n const color = e.target.value;\n const mayBePromise = this.onChange(this.props.attr, color);\n if (mayBePromise instanceof Promise) {\n void mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n slotProps={{\n htmlInput: {\n style: {\n // paddingLeft: noPadding ? 0 : 8,\n backgroundColor: value,\n color: textColor ? '#FFF' : '#000',\n },\n readOnly: this.props.schema.readOnly || false,\n },\n input: {\n endAdornment:\n !this.props.schema.readOnly && value && !this.props.schema.noClearButton ? (\n <IconButton\n size=\"small\"\n onClick={e => {\n e.stopPropagation();\n const mayBePromise = this.onChange(this.props.attr, '');\n if (mayBePromise instanceof Promise) {\n void mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n >\n <ClearIcon />\n </IconButton>\n ) : undefined,\n },\n inputLabel: {\n shrink: true,\n },\n }}\n />\n </>\n );\n }\n}\n\nexport default ConfigColor;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigColor.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigColor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,YAAY,EAAoB,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGnD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAWlG,MAAM,WAAY,SAAQ,aAAiD;IACvE,iBAAiB;QACb,OAAO,CACH,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,IAAI,CAC5B,oBAAC,MAAM,IACH,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,EACxD,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe;YAEhC,oB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C1E,CAAC;4BACL,CAAC;4BAED,oBAAC,SAAS,OAAG,CACJ,CAChB,CAAC,CAAC,CAAC,SAAS;qBACpB;oBACD,UAAU,EAAE;wBACR,MAAM,EAAE,IAAI;qBACf;iBACJ,GACH,CACH,CACN,CAAC;IACN,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\nimport { ChromePicker, type ColorResult } from 'react-color';\n\nimport { IconButton, TextField, Dialog } from '@mui/material';\n\nimport { Close as ClearIcon } from '@mui/icons-material';\n\nimport { Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemText } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigColorProps extends ConfigGenericProps {\n schema: ConfigItemText;\n}\n\ninterface ConfigColorState extends ConfigGenericState {\n showColorDialog?: boolean;\n colorDialogValue?: string;\n}\n\nclass ConfigColor extends ConfigGeneric<ConfigColorProps, ConfigColorState> {\n renderColorDialog(): JSX.Element | null {\n return (\n !!this.state.showColorDialog && (\n <Dialog\n onClose={() => this.setState({ showColorDialog: false })}\n open={this.state.showColorDialog}\n >\n <ChromePicker\n color={this.state.colorDialogValue}\n onChange={(color: ColorResult) =>\n this.setState({ colorDialogValue: color.hex }, () =>\n this.onChange(this.props.attr, this.state.colorDialogValue),\n )\n }\n />\n </Dialog>\n )\n );\n }\n\n renderItem(_error: unknown, disabled: boolean /* , defaultValue */): JSX.Element {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n let textColor = Utils.isUseBright(value, null);\n if (textColor === null) {\n textColor = undefined;\n }\n return (\n <>\n {this.renderColorDialog()}\n <TextField\n variant=\"standard\"\n disabled={!!disabled}\n style={{ minWidth: 100, width: 'calc(100% - 8px)' }}\n label={this.getText(this.props.schema.label)}\n value={value || ''}\n onClick={() =>\n !this.props.schema.readOnly &&\n this.setState({ showColorDialog: true, colorDialogValue: value || '' })\n }\n onChange={e => {\n const color = e.target.value;\n const mayBePromise = this.onChange(this.props.attr, color);\n if (mayBePromise instanceof Promise) {\n void mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n slotProps={{\n htmlInput: {\n style: {\n // paddingLeft: noPadding ? 0 : 8,\n backgroundColor: value,\n color: textColor ? '#FFF' : '#000',\n },\n readOnly: this.props.schema.readOnly || false,\n },\n input: {\n endAdornment:\n !this.props.schema.readOnly && value && !this.props.schema.noClearButton ? (\n <IconButton\n tabIndex={-1}\n size=\"small\"\n onClick={e => {\n e.stopPropagation();\n const mayBePromise = this.onChange(this.props.attr, '');\n if (mayBePromise instanceof Promise) {\n void mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n >\n <ClearIcon />\n </IconButton>\n ) : undefined,\n },\n inputLabel: {\n shrink: true,\n },\n }}\n />\n </>\n );\n }\n}\n\nexport default ConfigColor;\n"]}
|
|
@@ -31,7 +31,7 @@ export interface ConfigGenericProps {
|
|
|
31
31
|
attr?: string;
|
|
32
32
|
changed: boolean;
|
|
33
33
|
className?: string;
|
|
34
|
-
|
|
34
|
+
expertMode?: boolean;
|
|
35
35
|
commandRunning?: boolean;
|
|
36
36
|
common: Record<string, any>;
|
|
37
37
|
custom?: boolean;
|
|
@@ -48,6 +48,7 @@ export interface ConfigGenericProps {
|
|
|
48
48
|
root?: boolean;
|
|
49
49
|
/** Provided props by the specific component */
|
|
50
50
|
schema: ConfigItemAny;
|
|
51
|
+
style?: Record<string, any>;
|
|
51
52
|
/** This item is in the table. Maybe some layouts must be changed */
|
|
52
53
|
table?: boolean;
|
|
53
54
|
themeName: ThemeName;
|
|
@@ -666,7 +666,7 @@ export default class ConfigGeneric extends Component {
|
|
|
666
666
|
return null;
|
|
667
667
|
}
|
|
668
668
|
// Do not show this component if expert mode is false
|
|
669
|
-
if (this.props.
|
|
669
|
+
if (this.props.expertMode === false && schema.expertMode) {
|
|
670
670
|
return null;
|
|
671
671
|
}
|
|
672
672
|
if (this.props.alive && this.defaultSendToDone === false) {
|