@iobroker/json-config 7.6.1 → 7.6.3

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.
Files changed (31) hide show
  1. package/README.md +4 -4
  2. package/build/JsonConfigComponent/ConfigAccordion.js +1 -1
  3. package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -1
  4. package/build/JsonConfigComponent/ConfigColor.js +1 -1
  5. package/build/JsonConfigComponent/ConfigColor.js.map +1 -1
  6. package/build/JsonConfigComponent/ConfigCustom.js +3 -6
  7. package/build/JsonConfigComponent/ConfigCustom.js.map +1 -1
  8. package/build/JsonConfigComponent/ConfigGeneric.d.ts +2 -1
  9. package/build/JsonConfigComponent/ConfigGeneric.js +1 -1
  10. package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
  11. package/build/JsonConfigComponent/ConfigPanel.d.ts +1 -0
  12. package/build/JsonConfigComponent/ConfigPanel.js +10 -3
  13. package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
  14. package/build/JsonConfigComponent/ConfigSelect.js +3 -3
  15. package/build/JsonConfigComponent/ConfigSelect.js.map +1 -1
  16. package/build/JsonConfigComponent/ConfigSelectSendTo.js +1 -1
  17. package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
  18. package/build/JsonConfigComponent/ConfigState.js +16 -6
  19. package/build/JsonConfigComponent/ConfigState.js.map +1 -1
  20. package/build/JsonConfigComponent/ConfigTable.js +2 -2
  21. package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
  22. package/build/JsonConfigComponent/ConfigTabs.d.ts +1 -0
  23. package/build/JsonConfigComponent/ConfigTabs.js +8 -1
  24. package/build/JsonConfigComponent/ConfigTabs.js.map +1 -1
  25. package/build/JsonConfigComponent/ConfigText.js +1 -1
  26. package/build/JsonConfigComponent/ConfigText.js.map +1 -1
  27. package/build/JsonConfigComponent/index.d.ts +1 -0
  28. package/build/JsonConfigComponent/index.js +3 -4
  29. package/build/JsonConfigComponent/index.js.map +1 -1
  30. package/build/types.d.ts +4 -1
  31. package/package.json +3 -3
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/adapter-react-v5/main/schemas/jsonConfig.json"
118
+ "url": "https://raw.githubusercontent.com/ioBroker/ioBroker.admin/master/packages/jsonConfig/schemas/jsonConfig.json"
119
119
  }
120
120
  ]
121
121
  ```
@@ -1451,7 +1451,6 @@ For that you must define in `io-package.json` in `common` part following:
1451
1451
  "adminTab": {
1452
1452
  "link": "jsonTab.json", // the name could be any, but only ends with `.json` or `.json5`
1453
1453
  // all following parameters are optional
1454
- "sendTo": true, // If defined, the tab will send a message by initializing to backend with command "tab" or string contained in "sendTo". Only if `singleton` is false
1455
1454
  "icon": "AABBCC", // base64 icon. If not provided, the adapter icon will be taken
1456
1455
  "name": "TabName", // String or multi-language object for menu label
1457
1456
  "singleton": true, // Tab will not have an instance number and for all instances will exist only one menu item.
@@ -1466,6 +1465,7 @@ The file `jsonTab.json5` could look like:
1466
1465
  ```json5
1467
1466
  {
1468
1467
  "i18n": "tabI18n", // folder name in admin, where the translations are stored (relative to "admin" folder)
1468
+ "command": "tab", // If defined, the tab will send a message by initializing to backend with command "tab" (string contained in "sendTo")
1469
1469
  "items": {
1470
1470
  "memHeapTotal": {
1471
1471
  // This will show "system.adapter.admin.0.memHeapTotal" value
@@ -1516,7 +1516,7 @@ onMessage = (obj: ioBroker.Message): void => {
1516
1516
  ```
1517
1517
 
1518
1518
  ## Report a schema error
1519
- Create an issue here: https://github.com/ioBroker/adapter-react-v5/issues
1519
+ Create an issue here: https://github.com/ioBroker/ioBroker.admin/issues
1520
1520
 
1521
1521
  ## For maintainer
1522
- To update the location of JsonConfig schema, create pull request to this file: https://github.com/SchemaStore/schemastore/blob/master/src/api/json/catalog.json
1522
+ 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,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;AA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AC,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,CAAC;QACzD,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,qBAAqB;KACvG,CAAC;IACF,cAAc,EAAE;IACZ,sBAAsB;KACzB;IACD,OAAO,EAAE,CAAC,KAAe,EAAuB,EAAE,CAAC,CAAC;QAChD,eAAe,EAAE,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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,CAAC,KAAK,CAAC,eAAe;YAEhC,oBAAC,YAAY,IACT,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAClC,QAAQ,EAAE,CAAC,KAAkB,EAAE,EAAE,CAC7B,IAAI,CAAC,QAAQ,CAAC,EAAE,gBAAgB,EAAE,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAChD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,C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EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC1E,CAAC;gBACL,CAAC,EACD,SAAS,EAAE;oBACP,SAAS,EAAE;wBACP,KAAK,EAAE;4BACH,kCAAkC;4BAClC,eAAe,EAAE,KAAK;4BACtB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;yBACrC;wBACD,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,KAAK;qBAChD;oBACD,KAAK,EAAE;wBACH,YAAY,EACR,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CACvE,oBAAC,UAAU,IACP,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,CAAC,CAAC,EAAE;gCACT,CAAC,CAAC,eAAe,EAAE,CAAC;gCACpB,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gCACxD,IAAI,YAAY,YAAY,OAAO,EAAE,CAAC;oCAClC,KAAK,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,CAAC;gCAC1E,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,oBAAC,YAAY,IACT,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAClC,QAAQ,EAAE,CAAC,KAAkB,EAAE,EAAE,CAC7B,IAAI,CAAC,QAAQ,CAAC,EAAE,gBAAgB,EAAE,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAChD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAC9D,GAEP,CACG,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BAAqB,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC1E,CAAC;gBACL,CAAC,EACD,SAAS,EAAE;oBACP,SAAS,EAAE;wBACP,KAAK,EAAE;4BACH,kCAAkC;4BAClC,eAAe,EAAE,KAAK;4BACtB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;yBACrC;wBACD,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,KAAK;qBAChD;oBACD,KAAK,EAAE;wBACH,YAAY,EACR,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CACvE,oBAAC,UAAU,IACP,QAAQ,EAAE,CAAC,CAAC,EACZ,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,CAAC,CAAC,EAAE;gCACT,CAAC,CAAC,eAAe,EAAE,CAAC;gCACpB,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gCACxD,IAAI,YAAY,YAAY,OAAO,EAAE,CAAC;oCAClC,KAAK,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,CAAC;gCAC1E,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"]}
@@ -44,12 +44,10 @@ export default class ConfigCustom extends ConfigGeneric {
44
44
  return;
45
45
  }
46
46
  let url;
47
- /*
48
47
  if (this.props.schema.url.startsWith('http:') || this.props.schema.url.startsWith('https:')) {
49
48
  url = this.props.schema.url;
50
- } else
51
- */
52
- if (this.props.schema.url.startsWith('./')) {
49
+ }
50
+ else if (this.props.schema.url.startsWith('./')) {
53
51
  url = `${window.location.protocol}//${window.location.host}${this.props.schema.url.replace(/^\./, '')}`;
54
52
  }
55
53
  else {
@@ -134,8 +132,7 @@ export default class ConfigCustom extends ConfigGeneric {
134
132
  });
135
133
  }
136
134
  else {
137
- const _Component = component[componentName];
138
- setTimeout(() => this.setState({ Component: _Component }), 2000);
135
+ this.setState({ Component: component[componentName] });
139
136
  }
140
137
  }
141
138
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigCustom.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigCustom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,KAAK,UAAU,MAAM,KAAK,CAAC;AAYlC,IAAI,CAAC;IAC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,CAAC,QAAQ,EACtC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,EAC5C,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,EAC9C,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,GAC9C,CACL,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CACnB,iCAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAO,CAChC,CAAC,CAAC,CAAC,CACA,oBAAC,cAAc,OAAG,CACrB,CAAC;QAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CACH;gBACI,6BAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAI;gBAC/C,IAAI,CACN,CACN,CAAC;QACN,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\nimport { LinearProgress } from '@mui/material';\nimport { registerRemotes, loadRemote, init } from '@module-federation/runtime';\n\nimport * as IconsMaterial from '@mui/icons-material';\n\nimport * as AdapterReact from '@iobroker/adapter-react-v5';\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport * as JsonConfig from '../';\nimport type { ConfigItemCustom } from '../types';\n\ninterface ConfigCustomProps extends ConfigGenericProps {\n schema: ConfigItemCustom;\n}\n\ninterface ConfigCustomState extends ConfigGenericState {\n Component: React.FC<ConfigGenericProps> | null;\n error: string;\n}\n\ninit({\n name: 'iobroker_admin',\n shared: {\n '@iobroker/adapter-react-v5': {\n lib: () => AdapterReact,\n version: '*',\n },\n '@mui/icons-material': {\n lib: () => IconsMaterial,\n version: '*',\n },\n '@iobroker/json-config': {\n lib: () => JsonConfig,\n version: '*',\n },\n },\n remotes: [],\n})\n\nexport default class ConfigCustom extends ConfigGeneric<ConfigCustomProps, ConfigCustomState> {\n static runningLoads: Record<string, Promise<{ default: Record<string, React.FC<ConfigGenericProps>> }>> = {};\n\n constructor(props: ConfigCustomProps) {\n super(props);\n // schema.url - location of Widget\n // schema.name - Component name\n // schema.i18n - i18n\n\n Object.assign(this.state, {\n Component: null,\n error: '',\n });\n }\n\n // load component dynamically\n async componentDidMount(): Promise<void> {\n if (!this.props.schema.url) {\n console.error('URL is empty. Cannot load custom component!');\n this.setState({ error: 'URL is empty. Cannot load custom component!' });\n return;\n }\n\n let url;\n /*\n if (this.props.schema.url.startsWith('http:') || this.props.schema.url.startsWith('https:')) {\n url = this.props.schema.url;\n } else\n */\n if (this.props.schema.url.startsWith('./')) {\n url = `${window.location.protocol}//${window.location.host}${this.props.schema.url.replace(/^\\./, '')}`;\n } else {\n url = `${window.location.protocol}//${window.location.host}/adapter/${this.props.oContext.adapterName}/${this.props.schema.url}`;\n }\n const [uniqueName, fileToLoad, ...componentNameParts] = this.props.schema.name.split('/');\n const componentName = componentNameParts.join('/');\n if (!url) {\n console.error(\n 'Cannot find URL for custom component! Please define \"url\" as \"custom/customComponents.js\" in the schema',\n );\n return;\n }\n if (!uniqueName || !fileToLoad || !componentName) {\n console.error(\n 'Invalid format of \"name\"! Please define \"name\" as \"ConfigCustomBackItUpSet/Components/AdapterExist\" in the schema',\n );\n return;\n }\n let setPromise: Promise<{ default: Record<string, React.FC<ConfigGenericProps>> }> | undefined =\n ConfigCustom.runningLoads[`${url}!${fileToLoad}`];\n\n if (!(setPromise instanceof Promise)) {\n let i18nPromise: Promise<void> | undefined;\n if (this.props.schema.i18n === true) {\n // load i18n from files\n const pos = url.lastIndexOf('/');\n let i18nURL: string;\n if (pos !== -1) {\n i18nURL = url.substring(0, pos);\n } else {\n i18nURL = url;\n }\n const lang = I18n.getLanguage();\n const file = `${i18nURL}/i18n/${lang}.json`;\n\n i18nPromise = fetch(file)\n .then(data => data.json())\n .then(json => I18n.extendTranslations(json, lang))\n .catch(error => {\n if (lang !== 'en') {\n // try to load English\n fetch(`${i18nURL}/i18n/en.json`)\n .then(data => data.json())\n .then(json => I18n.extendTranslations(json, lang))\n .catch(err => console.log(`Cannot load i18n \"${file}\": ${err}`));\n return;\n }\n console.log(`Cannot load i18n \"${file}\": ${error}`);\n });\n } else if (this.props.schema.i18n && typeof this.props.schema.i18n === 'object') {\n try {\n I18n.extendTranslations(this.props.schema.i18n);\n } catch (error) {\n console.error(`Cannot import i18n: ${error}`);\n }\n }\n try {\n console.log(url, uniqueName, fileToLoad, componentName);\n\n registerRemotes(\n [\n {\n name: uniqueName,\n entry: url,\n type: this.props.schema.bundlerType || undefined,\n },\n ],\n // force: true // may be needed to side-load remotes after the fact.\n );\n setPromise = loadRemote(`${uniqueName}/${fileToLoad}`);\n if (i18nPromise instanceof Promise) {\n setPromise = Promise.all([setPromise, i18nPromise]).then(result => result[0]);\n }\n // remember promise\n ConfigCustom.runningLoads[`${url}!${fileToLoad}`] = setPromise;\n } catch (error) {\n console.error(error);\n this.setState({ error: `Cannot import from ${this.props.schema.url}: ${error}` });\n }\n }\n\n try {\n const component: Record<string, React.FC<ConfigGenericProps>> = (await setPromise).default;\n\n if (!component?.[componentName]) {\n const keys = Object.keys(component || {});\n console.error('URL is empty. Cannot load custom component!');\n this.setState({\n error: `Component ${this.props.schema.name} not found in ${this.props.schema.url}. Found: ${keys.join(', ')}`,\n });\n } else {\n const _Component = component[componentName];\n setTimeout(() => this.setState({ Component: _Component }), 2000);\n }\n } catch (error) {\n console.error(error);\n this.setState({ error: `Cannot import from ${this.props.schema.url}: ${error}` });\n }\n }\n\n render(): JSX.Element {\n const CustomComponent: React.FC<ConfigGenericProps> = this.state.Component;\n const schema = this.props.schema || ({} as ConfigItemCustom);\n\n let item = CustomComponent ? (\n <CustomComponent\n {...this.props}\n // @ts-expect-error BF (2024-12-18) Remove after the 7.4 will be mainstream. All following lines\n socket={this.props.oContext.socket}\n theme={this.props.oContext.theme}\n themeType={this.props.oContext.themeType}\n instance={this.props.oContext.instance}\n adapterName={this.props.oContext.adapterName}\n systemConfig={this.props.oContext.systemConfig}\n forceUpdate={this.props.oContext.forceUpdate}\n />\n ) : this.state.error ? (\n <div>{this.state.error}</div>\n ) : (\n <LinearProgress />\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n\n return item;\n }\n}\n"]}
1
+ {"version":3,"file":"ConfigCustom.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigCustom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,KAAK,UAAU,MAAM,KAAK,CAAC;AAYlC,IAAI,CAAC;IACD,IAAI,EAAE,gBAAgB;IACtB,MAAM,EAAE;QACJ,4BAA4B,EAAE;YAC1B,GAAG,EAAE,GAAG,EAAE,CAAC,YAAY;YACvB,OAAO,EAAE,GAAG;SACf;QACD,qBAAqB,EAAE;YACnB,GAAG,EAAE,GAAG,EAAE,CAAC,aAAa;YACxB,OAAO,EAAE,GAAG;SACf;QACD,uBAAuB,EAAE;YACrB,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU;YACrB,OAAO,EAAE,GAAG;SACf;KACJ;IACD,OAAO,EAAE,EAAE;CACd,CAAC,CAAA;AAEF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,aAAmD;IACzF,MAAM,CAAC,YAAY,GAAuF,EAAE,CAAC;IAE7G,YAAY,KAA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C,KAAK,CAAO,CAChC,CAAC,CAAC,CAAC,CACA,oBAAC,cAAc,OAAG,CACrB,CAAC;QAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CACH;gBACI,6BAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAI;gBAC/C,IAAI,CACN,CACN,CAAC;QACN,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\nimport { LinearProgress } from '@mui/material';\nimport { registerRemotes, loadRemote, init } from '@module-federation/runtime';\n\nimport * as IconsMaterial from '@mui/icons-material';\n\nimport * as AdapterReact from '@iobroker/adapter-react-v5';\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport * as JsonConfig from '../';\nimport type { ConfigItemCustom } from '../types';\n\ninterface ConfigCustomProps extends ConfigGenericProps {\n schema: ConfigItemCustom;\n}\n\ninterface ConfigCustomState extends ConfigGenericState {\n Component: React.FC<ConfigGenericProps> | null;\n error: string;\n}\n\ninit({\n name: 'iobroker_admin',\n shared: {\n '@iobroker/adapter-react-v5': {\n lib: () => AdapterReact,\n version: '*',\n },\n '@mui/icons-material': {\n lib: () => IconsMaterial,\n version: '*',\n },\n '@iobroker/json-config': {\n lib: () => JsonConfig,\n version: '*',\n },\n },\n remotes: [],\n})\n\nexport default class ConfigCustom extends ConfigGeneric<ConfigCustomProps, ConfigCustomState> {\n static runningLoads: Record<string, Promise<{ default: Record<string, React.FC<ConfigGenericProps>> }>> = {};\n\n constructor(props: ConfigCustomProps) {\n super(props);\n // schema.url - location of Widget\n // schema.name - Component name\n // schema.i18n - i18n\n\n Object.assign(this.state, {\n Component: null,\n error: '',\n });\n }\n\n // load component dynamically\n async componentDidMount(): Promise<void> {\n if (!this.props.schema.url) {\n console.error('URL is empty. Cannot load custom component!');\n this.setState({ error: 'URL is empty. Cannot load custom component!' });\n return;\n }\n\n let url;\n if (this.props.schema.url.startsWith('http:') || this.props.schema.url.startsWith('https:')) {\n url = this.props.schema.url;\n } else if (this.props.schema.url.startsWith('./')) {\n url = `${window.location.protocol}//${window.location.host}${this.props.schema.url.replace(/^\\./, '')}`;\n } else {\n url = `${window.location.protocol}//${window.location.host}/adapter/${this.props.oContext.adapterName}/${this.props.schema.url}`;\n }\n const [uniqueName, fileToLoad, ...componentNameParts] = this.props.schema.name.split('/');\n const componentName = componentNameParts.join('/');\n if (!url) {\n console.error(\n 'Cannot find URL for custom component! Please define \"url\" as \"custom/customComponents.js\" in the schema',\n );\n return;\n }\n if (!uniqueName || !fileToLoad || !componentName) {\n console.error(\n 'Invalid format of \"name\"! Please define \"name\" as \"ConfigCustomBackItUpSet/Components/AdapterExist\" in the schema',\n );\n return;\n }\n let setPromise: Promise<{ default: Record<string, React.FC<ConfigGenericProps>> }> | undefined =\n ConfigCustom.runningLoads[`${url}!${fileToLoad}`];\n\n if (!(setPromise instanceof Promise)) {\n let i18nPromise: Promise<void> | undefined;\n if (this.props.schema.i18n === true) {\n // load i18n from files\n const pos = url.lastIndexOf('/');\n let i18nURL: string;\n if (pos !== -1) {\n i18nURL = url.substring(0, pos);\n } else {\n i18nURL = url;\n }\n const lang = I18n.getLanguage();\n const file = `${i18nURL}/i18n/${lang}.json`;\n\n i18nPromise = fetch(file)\n .then(data => data.json())\n .then(json => I18n.extendTranslations(json, lang))\n .catch(error => {\n if (lang !== 'en') {\n // try to load English\n fetch(`${i18nURL}/i18n/en.json`)\n .then(data => data.json())\n .then(json => I18n.extendTranslations(json, lang))\n .catch(err => console.log(`Cannot load i18n \"${file}\": ${err}`));\n return;\n }\n console.log(`Cannot load i18n \"${file}\": ${error}`);\n });\n } else if (this.props.schema.i18n && typeof this.props.schema.i18n === 'object') {\n try {\n I18n.extendTranslations(this.props.schema.i18n);\n } catch (error) {\n console.error(`Cannot import i18n: ${error}`);\n }\n }\n try {\n console.log(url, uniqueName, fileToLoad, componentName);\n\n registerRemotes(\n [\n {\n name: uniqueName,\n entry: url,\n type: this.props.schema.bundlerType || undefined,\n },\n ],\n // force: true // may be needed to side-load remotes after the fact.\n );\n setPromise = loadRemote(`${uniqueName}/${fileToLoad}`);\n if (i18nPromise instanceof Promise) {\n setPromise = Promise.all([setPromise, i18nPromise]).then(result => result[0]);\n }\n // remember promise\n ConfigCustom.runningLoads[`${url}!${fileToLoad}`] = setPromise;\n } catch (error) {\n console.error(error);\n this.setState({ error: `Cannot import from ${this.props.schema.url}: ${error}` });\n }\n }\n\n try {\n const component: Record<string, React.FC<ConfigGenericProps>> = (await setPromise).default;\n\n if (!component?.[componentName]) {\n const keys = Object.keys(component || {});\n console.error('URL is empty. Cannot load custom component!');\n this.setState({\n error: `Component ${this.props.schema.name} not found in ${this.props.schema.url}. Found: ${keys.join(', ')}`,\n });\n } else {\n this.setState({ Component: component[componentName] });\n }\n } catch (error) {\n console.error(error);\n this.setState({ error: `Cannot import from ${this.props.schema.url}: ${error}` });\n }\n }\n\n render(): JSX.Element {\n const CustomComponent: React.FC<ConfigGenericProps> = this.state.Component;\n const schema = this.props.schema || ({} as ConfigItemCustom);\n\n let item = CustomComponent ? (\n <CustomComponent\n {...this.props}\n // @ts-expect-error BF (2024-12-18) Remove after the 7.4 will be mainstream. All following lines\n socket={this.props.oContext.socket}\n theme={this.props.oContext.theme}\n themeType={this.props.oContext.themeType}\n instance={this.props.oContext.instance}\n adapterName={this.props.oContext.adapterName}\n systemConfig={this.props.oContext.systemConfig}\n forceUpdate={this.props.oContext.forceUpdate}\n />\n ) : this.state.error ? (\n <div>{this.state.error}</div>\n ) : (\n <LinearProgress />\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n\n return item;\n }\n}\n"]}
@@ -31,7 +31,7 @@ export interface ConfigGenericProps {
31
31
  attr?: string;
32
32
  changed: boolean;
33
33
  className?: string;
34
- style?: Record<string, any>;
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.oContext.expertMode === false && schema.expertMode) {
669
+ if (this.props.expertMode === false && schema.expertMode) {
670
670
  return null;
671
671
  }
672
672
  if (this.props.alive && this.defaultSendToDone === false) {