@iobroker/json-config 8.1.2 → 8.1.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 CHANGED
@@ -384,7 +384,7 @@ show checkbox
384
384
  show slider (only Admin6)
385
385
 
386
386
  | Property | Description |
387
- | -------- | ----------------------------- |
387
+ |----------|-------------------------------|
388
388
  | `min` | (default 0) |
389
389
  | `max` | (default 100) |
390
390
  | `step` | (default `(max - min) / 100`) |
@@ -395,7 +395,7 @@ show slider (only Admin6)
395
395
  show data in a QR Code (admin >= 7.0.18)
396
396
 
397
397
  | Property | Description |
398
- | --------- | ------------------------------------- |
398
+ |-----------|---------------------------------------|
399
399
  | `data` | the data to be encoded in the QR Code |
400
400
  | `size` | size of the QR code |
401
401
  | `fgColor` | Foreground color |
@@ -1599,8 +1599,8 @@ For that you must define in `io-package.json` in `common` part following:
1599
1599
  // all following parameters are optional
1600
1600
  "icon": "AABBCC", // base64 icon. If not provided, the adapter icon will be taken
1601
1601
  "name": "TabName", // String or multi-language object for menu label
1602
- "singleton": true, // Tab will not have an instance number and for all instances will exist only one menu item.
1603
- "order": 10, // Order in admin tab (0 is disabled, 1 - first after static menu items, 200 is last)
1602
+ "singleton": true, // Tab will not have an instance number, and for all instances will exist only one menu item.
1603
+ "order": 10, // Order in the admin tab (0 is disabled, 1 - first after static menu items, 200 is last)
1604
1604
  },
1605
1605
  // ....
1606
1606
  }
@@ -1675,7 +1675,10 @@ The schema is used here: https://github.com/SchemaStore/schemastore/blob/6da29cd
1675
1675
  ### **WORK IN PROGRESS**
1676
1676
  -->
1677
1677
  ## Changelog
1678
- ### 8.1.2 (2026-02-08)
1678
+ ### 8.1.4 (2026-02-09)
1679
+ - (@GermanBluefox) Hiding the whole line in the table if shown as card and the line is empty
1680
+
1681
+ ### 8.1.3 (2026-02-09)
1679
1682
  - (@GermanBluefox) Added component `yamlEditor` for editing yaml files in admin
1680
1683
 
1681
1684
  ### 8.1.1 (2026-02-06)
@@ -86,7 +86,7 @@ class ConfigAccordion extends ConfigGeneric {
86
86
  const newObj = JSON.parse(JSON.stringify(value));
87
87
  newObj[idx][attr] = valueChange;
88
88
  this.setState({ value: newObj }, () => this.onChangeWrapper(newObj));
89
- }, onError: this.onAccordionError(idx), table: this.props.table }));
89
+ }, onError: this.onAccordionError(idx), onHiddenChanged: this.props.onHiddenChanged, table: this.props.table }));
90
90
  }
91
91
  onDelete = (index) => () => {
92
92
  const newValue = JSON.parse(JSON.stringify(this.state.value));
@@ -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,EACV,GAAG,GACN,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,EAC5B,KAAK,IAAI,SAAS,EAClB,YAAY,IAAI,gBAAgB,EAChC,UAAU,IAAI,cAAc,EAC5B,SAAS,IAAI,aAAa,GAC7B,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,C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AS,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,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 Box,\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 Error as ErrorIcon,\n FileDownload as FileDownloadIcon,\n FileUpload as FileUploadIcon,\n AddCircle as AddCircleIcon,\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 accordionErrors: Record<number, Record<string, string>>; // accordion index -> attr -> error\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 accordionErrors: {},\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 onAccordionError =\n (accordionIndex: number) =>\n (attr: string, error?: string): void => {\n const newAccordionErrors = { ...this.state.accordionErrors };\n\n if (!newAccordionErrors[accordionIndex]) {\n newAccordionErrors[accordionIndex] = {};\n }\n\n if (!error) {\n delete newAccordionErrors[accordionIndex][attr];\n // Clean up empty accordion error objects\n if (Object.keys(newAccordionErrors[accordionIndex]).length === 0) {\n delete newAccordionErrors[accordionIndex];\n }\n } else {\n newAccordionErrors[accordionIndex][attr] = error;\n }\n\n this.setState({ accordionErrors: newAccordionErrors });\n\n // Also forward to parent\n this.props.onError(attr, error);\n };\n\n hasAccordionErrors = (accordionIndex: number): boolean => {\n return !!(\n this.state.accordionErrors[accordionIndex] &&\n Object.keys(this.state.accordionErrors[accordionIndex]).length > 0\n );\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={this.onAccordionError(idx)}\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 onExport = (): void => {\n const { value } = this.state;\n const dataStr = JSON.stringify(value, null, 2);\n const dataUri = `data:application/json;charset=utf-8,${encodeURIComponent(dataStr)}`;\n\n const exportFileDefaultName = `config_section_${new Date().toISOString().slice(0, 19).replace(/:/g, '-')}.json`;\n\n const linkElement = document.createElement('a');\n linkElement.setAttribute('href', dataUri);\n linkElement.setAttribute('download', exportFileDefaultName);\n linkElement.click();\n };\n\n onImport = (replace: boolean): void => {\n const input = document.createElement('input');\n input.type = 'file';\n input.accept = '.json';\n input.onchange = (event: Event) => {\n const file = (event.target as HTMLInputElement).files?.[0];\n if (!file) {\n return;\n }\n\n const reader = new FileReader();\n reader.onload = e => {\n try {\n const jsonData = JSON.parse(e.target?.result as string);\n\n if (!Array.isArray(jsonData)) {\n alert(I18n.t('ra_Invalid JSON format. Expected an array.'));\n return;\n }\n\n let newValue: Record<string, any>[];\n if (replace) {\n newValue = jsonData;\n } else {\n newValue = [...this.state.value, ...jsonData];\n }\n\n this.setState({ value: newValue, activeIndex: -1 }, () => this.onChangeWrapper(newValue));\n } catch {\n alert(I18n.t('ra_Invalid JSON file.'));\n }\n };\n reader.readAsText(file);\n };\n input.click();\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 <>\n <Tooltip title={I18n.t('ra_Export configuration section')}>\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={this.onExport}\n >\n <FileDownloadIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title={I18n.t('ra_Import and replace configuration section')}>\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={() => this.onImport(true)}\n >\n <FileUploadIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title={I18n.t('ra_Import and add configuration section')}>\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={() => this.onImport(false)}\n >\n <AddCircleIcon />\n </IconButton>\n </Tooltip>\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={this.onAdd}\n >\n <AddIcon />\n </IconButton>\n </>\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 <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, width: '100%' }}>\n <Typography style={styles.accordionTitle}>{idx[schema.titleAttr]}</Typography>\n {this.hasAccordionErrors(i) && <ErrorIcon sx={{ fontSize: 20, color: 'error.main' }} />}\n </Box>\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":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,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 Box,\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 Error as ErrorIcon,\n FileDownload as FileDownloadIcon,\n FileUpload as FileUploadIcon,\n AddCircle as AddCircleIcon,\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 accordionErrors: Record<number, Record<string, string>>; // accordion index -> attr -> error\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 accordionErrors: {},\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 onAccordionError =\n (accordionIndex: number) =>\n (attr: string, error?: string): void => {\n const newAccordionErrors = { ...this.state.accordionErrors };\n\n if (!newAccordionErrors[accordionIndex]) {\n newAccordionErrors[accordionIndex] = {};\n }\n\n if (!error) {\n delete newAccordionErrors[accordionIndex][attr];\n // Clean up empty accordion error objects\n if (Object.keys(newAccordionErrors[accordionIndex]).length === 0) {\n delete newAccordionErrors[accordionIndex];\n }\n } else {\n newAccordionErrors[accordionIndex][attr] = error;\n }\n\n this.setState({ accordionErrors: newAccordionErrors });\n\n // Also forward to parent\n this.props.onError(attr, error);\n };\n\n hasAccordionErrors = (accordionIndex: number): boolean => {\n return !!(\n this.state.accordionErrors[accordionIndex] &&\n Object.keys(this.state.accordionErrors[accordionIndex]).length > 0\n );\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={this.onAccordionError(idx)}\n onHiddenChanged={this.props.onHiddenChanged}\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 onExport = (): void => {\n const { value } = this.state;\n const dataStr = JSON.stringify(value, null, 2);\n const dataUri = `data:application/json;charset=utf-8,${encodeURIComponent(dataStr)}`;\n\n const exportFileDefaultName = `config_section_${new Date().toISOString().slice(0, 19).replace(/:/g, '-')}.json`;\n\n const linkElement = document.createElement('a');\n linkElement.setAttribute('href', dataUri);\n linkElement.setAttribute('download', exportFileDefaultName);\n linkElement.click();\n };\n\n onImport = (replace: boolean): void => {\n const input = document.createElement('input');\n input.type = 'file';\n input.accept = '.json';\n input.onchange = (event: Event) => {\n const file = (event.target as HTMLInputElement).files?.[0];\n if (!file) {\n return;\n }\n\n const reader = new FileReader();\n reader.onload = e => {\n try {\n const jsonData = JSON.parse(e.target?.result as string);\n\n if (!Array.isArray(jsonData)) {\n alert(I18n.t('ra_Invalid JSON format. Expected an array.'));\n return;\n }\n\n let newValue: Record<string, any>[];\n if (replace) {\n newValue = jsonData;\n } else {\n newValue = [...this.state.value, ...jsonData];\n }\n\n this.setState({ value: newValue, activeIndex: -1 }, () => this.onChangeWrapper(newValue));\n } catch {\n alert(I18n.t('ra_Invalid JSON file.'));\n }\n };\n reader.readAsText(file);\n };\n input.click();\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 <>\n <Tooltip title={I18n.t('ra_Export configuration section')}>\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={this.onExport}\n >\n <FileDownloadIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title={I18n.t('ra_Import and replace configuration section')}>\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={() => this.onImport(true)}\n >\n <FileUploadIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title={I18n.t('ra_Import and add configuration section')}>\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={() => this.onImport(false)}\n >\n <AddCircleIcon />\n </IconButton>\n </Tooltip>\n <IconButton\n size=\"small\"\n color=\"primary\"\n onClick={this.onAdd}\n >\n <AddIcon />\n </IconButton>\n </>\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 <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, width: '100%' }}>\n <Typography style={styles.accordionTitle}>{idx[schema.titleAttr]}</Typography>\n {this.hasAccordionErrors(i) && <ErrorIcon sx={{ fontSize: 20, color: 'error.main' }} />}\n </Box>\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"]}
@@ -43,6 +43,7 @@ export interface ConfigGenericProps {
43
43
  isParentTab?: boolean;
44
44
  onChange: (attrOrData: string | Record<string, any>, val?: any, cb?: () => void, saveConfig?: boolean) => void;
45
45
  onError: (attr: string, error?: string) => void;
46
+ onHiddenChanged?: (attr: string, hidden?: boolean) => void;
46
47
  originalData: Record<string, any>;
47
48
  /** This indicates that the component is the very firsts one - root */
48
49
  root?: boolean;
@@ -74,6 +75,7 @@ export default class ConfigGeneric<Props extends ConfigGenericProps = ConfigGene
74
75
  private defaultSendToDone?;
75
76
  private sendToTimeout?;
76
77
  private noPlaceRequired;
78
+ private reportedHidden;
77
79
  constructor(props: Props);
78
80
  componentDidMount(): void;
79
81
  sendTo(): void;
@@ -23,6 +23,7 @@ export default class ConfigGeneric extends Component {
23
23
  defaultSendToDone;
24
24
  sendToTimeout;
25
25
  noPlaceRequired;
26
+ reportedHidden = false;
26
27
  constructor(props) {
27
28
  super(props);
28
29
  // @ts-expect-error of course, as we just
@@ -705,8 +706,17 @@ export default class ConfigGeneric extends Component {
705
706
  }
706
707
  return item;
707
708
  }
709
+ // Used in table to not render hidden elements at all, so we need to inform about it
710
+ if (this.props.onHiddenChanged && !this.reportedHidden) {
711
+ this.reportedHidden = true;
712
+ setTimeout(() => this.props.onHiddenChanged(this.props.attr, true), 10);
713
+ }
708
714
  return null;
709
715
  }
716
+ if (this.props.onHiddenChanged && this.reportedHidden) {
717
+ this.reportedHidden = false;
718
+ setTimeout(() => this.props.onHiddenChanged(this.props.attr, false), 10);
719
+ }
710
720
  // Add error
711
721
  if (schema.validatorNoSaveOnError) {
712
722
  if (error && !Object.keys(this.isError).length) {