@iobroker/json-config 7.6.16 → 7.6.18

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigSetState.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSetState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,KAAK,IAAI,SAAS,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEnG,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;IACD,IAAI,EAAE;QACF,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,CAAC;KACjB;CACJ,CAAC;AAMF,MAAM,cAAe,SAAQ,aAA4D;IACrF,KAAK,CAAC,QAAQ;QACV,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;QAChC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAChD,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YACvC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC7E,IAAI,GAAG,EAAE,MAAM,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACjC,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arning, Error as IconError, Info as IconInfo } from '@mui/icons-material';\n\nimport { DialogConfirm, Icon, I18n } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemSetState } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n },\n icon: {\n width: 24,\n height: 24,\n marginRight: 4,\n },\n};\n\ninterface ConfigInstanceSelectProps extends ConfigGenericProps {\n schema: ConfigItemSetState;\n}\n\nclass ConfigSetState extends ConfigGeneric<ConfigInstanceSelectProps, ConfigGenericState> {\n async _onClick(): Promise<void> {\n let val = this.props.schema.val;\n if (typeof val === 'string' && val.includes('${')) {\n val = this.getPattern(val, null, true);\n const obj = await this.props.oContext.socket.getObject(this.props.schema.id);\n if (obj?.common?.type === 'number') {\n val = parseFloat(val);\n } else if (obj?.common?.type === 'boolean') {\n // @ts-expect-error val could be anything\n val = val === 'true' || val === true || val === '1' || val === 1;\n }\n }\n\n const id = (this.props.schema.id || '').replace(/%INSTANCE%/g, (this.props.oContext.instance || 0).toString());\n\n try {\n await this.props.oContext.socket.setState(id, { val, ack: !!this.props.schema.ack });\n if (this.props.schema.okText) {\n window.alert(this.getText(this.props.schema.okText));\n }\n } catch (e) {\n if (this.props.schema.error && this.props.schema.error[e.toString()]) {\n window.alert(this.getText(this.props.schema.error[e.toString()]));\n } else {\n window.alert(I18n.t(e.toString()) || I18n.t('ra_Error'));\n }\n }\n }\n\n renderDialogConfirm(): JSX.Element | null {\n if (!this.state.confirmDialog) {\n return null;\n }\n const confirm = this.state.confirmData || this.props.schema.confirm;\n let icon = null;\n if (confirm.type === 'warning') {\n icon = <IconWarning />;\n } else if (confirm.type === 'error') {\n icon = <IconError />;\n } else if (confirm.type === 'info') {\n icon = <IconInfo />;\n }\n\n return (\n <DialogConfirm\n title={this.getText(confirm.title) || I18n.t('ra_Please confirm')}\n text={this.getText(confirm.text)}\n ok={this.getText(confirm.ok) || I18n.t('ra_Ok')}\n cancel={this.getText(confirm.cancel) || I18n.t('ra_Cancel')}\n icon={icon}\n onClose={isOk => this.setState({ confirmDialog: false }, () => isOk && this._onClick())}\n />\n );\n }\n\n renderItem(_error: string, disabled: boolean /* , defaultValue */): JSX.Element | null {\n return (\n <Button\n variant={this.props.schema.variant || undefined}\n color={this.props.schema.color || 'grey'}\n style={styles.fullWidth}\n disabled={disabled}\n onClick={async () => {\n if (this.props.schema.confirm) {\n this.setState({ confirmDialog: true });\n } else {\n await this._onClick();\n }\n }}\n >\n {this.props.schema.icon ? (\n <Icon\n src={this.props.schema.icon}\n style={styles.icon}\n />\n ) : null}\n {this.getText(this.props.schema.label, this.props.schema.noTranslation)}\n </Button>\n );\n }\n}\n\nexport default ConfigSetState;\n"]}
1
+ {"version":3,"file":"ConfigSetState.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSetState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,KAAK,IAAI,SAAS,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEnG,OAAO,EAAE,aAAa,EAAQ,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;CACJ,CAAC;AAMF,MAAM,cAAe,SAAQ,aAA4D;IACrF,KAAK,CAAC,QAAQ;QACV,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;QAChC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAChD,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,E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Aa,CAAC,CAClE,CACZ,CAAC;IACN,CAAC;CACJ;AAED,eAAe,cAAc,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Button } from '@mui/material';\n\nimport { Warning as IconWarning, Error as IconError, Info as IconInfo } from '@mui/icons-material';\n\nimport { DialogConfirm, Icon, I18n } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemSetState } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n },\n};\n\ninterface ConfigInstanceSelectProps extends ConfigGenericProps {\n schema: ConfigItemSetState;\n}\n\nclass ConfigSetState extends ConfigGeneric<ConfigInstanceSelectProps, ConfigGenericState> {\n async _onClick(): Promise<void> {\n let val = this.props.schema.val;\n if (typeof val === 'string' && val.includes('${')) {\n val = this.getPattern(val, null, true);\n const obj = await this.props.oContext.socket.getObject(this.props.schema.id);\n if (obj?.common?.type === 'number') {\n val = parseFloat(val);\n } else if (obj?.common?.type === 'boolean') {\n // @ts-expect-error val could be anything\n val = val === 'true' || val === true || val === '1' || val === 1;\n }\n }\n\n const id = (this.props.schema.id || '').replace(/%INSTANCE%/g, (this.props.oContext.instance || 0).toString());\n\n try {\n await this.props.oContext.socket.setState(id, { val, ack: !!this.props.schema.ack });\n if (this.props.schema.okText) {\n window.alert(this.getText(this.props.schema.okText));\n }\n } catch (e) {\n if (this.props.schema.error && this.props.schema.error[e.toString()]) {\n window.alert(this.getText(this.props.schema.error[e.toString()]));\n } else {\n window.alert(I18n.t(e.toString()) || I18n.t('ra_Error'));\n }\n }\n }\n\n renderDialogConfirm(): JSX.Element | null {\n if (!this.state.confirmDialog) {\n return null;\n }\n const confirm = this.state.confirmData || this.props.schema.confirm;\n let icon = null;\n if (confirm.type === 'warning') {\n icon = <IconWarning />;\n } else if (confirm.type === 'error') {\n icon = <IconError />;\n } else if (confirm.type === 'info') {\n icon = <IconInfo />;\n }\n\n return (\n <DialogConfirm\n title={this.getText(confirm.title) || I18n.t('ra_Please confirm')}\n text={this.getText(confirm.text)}\n ok={this.getText(confirm.ok) || I18n.t('ra_Ok')}\n cancel={this.getText(confirm.cancel) || I18n.t('ra_Cancel')}\n icon={icon}\n onClose={isOk => this.setState({ confirmDialog: false }, () => isOk && this._onClick())}\n />\n );\n }\n\n renderItem(_error: string, disabled: boolean /* , defaultValue */): JSX.Element | null {\n const icon = this.getIcon();\n return (\n <Button\n variant={this.props.schema.variant || undefined}\n color={this.props.schema.color || 'grey'}\n style={styles.fullWidth}\n disabled={disabled}\n onClick={async () => {\n if (this.props.schema.confirm) {\n this.setState({ confirmDialog: true });\n } else {\n await this._onClick();\n }\n }}\n startIcon={icon || undefined}\n >\n {this.getText(this.props.schema.label, this.props.schema.noTranslation)}\n </Button>\n );\n }\n}\n\nexport default ConfigSetState;\n"]}
@@ -739,35 +739,40 @@ class ConfigTable extends ConfigGeneric {
739
739
  if (this.props.schema.compact) {
740
740
  tdStyle = { paddingTop: 1, paddingBottom: 1 };
741
741
  }
742
- return (React.createElement(Grid2, { size: {
743
- xs: schema.xs || 12, // if xs is not defined, take the full width
744
- sm: schema.sm || undefined,
745
- md: schema.md || undefined,
746
- lg: schema.lg || undefined,
747
- xl: schema.xl || undefined,
748
- } },
749
- React.createElement(Card, null,
750
- React.createElement(Paper, { style: styles.paper },
751
- React.createElement(Accordion, { style: styles.paper },
752
- React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, null) },
753
- React.createElement(Typography, null, I18n.t('ra_Filter and Data Actions'))),
754
- React.createElement(AccordionDetails, null,
755
- React.createElement(Table, null,
756
- React.createElement(TableBody, null,
757
- schema.items?.map((headCell, i) => (React.createElement(TableRow, { key: `${headCell.attr}_${i}` }, this.renderOneFilter({
758
- schema,
759
- style: tdStyle,
760
- showAddButton: false,
761
- headCell,
762
- order,
763
- orderBy,
764
- index: i,
765
- doAnyFilterSet: false,
766
- })))),
767
- React.createElement(TableRow, null,
768
- React.createElement(TableCell, { align: "left", style: tdStyle },
769
- React.createElement("span", { style: styles.headerText }, I18n.t('ra_Actions'))),
770
- React.createElement(TableCell, { style: tdStyle }, this.renderImportExportButtons(schema)))))))))));
742
+ const importExportVisible = (!schema.noDelete && schema.import) || schema.export;
743
+ if (importExportVisible || schema.items.find(item => item.sort || item.filter)) {
744
+ return (React.createElement(Grid2, { size: {
745
+ xs: schema.xs || 12, // if xs is not defined, take the full width
746
+ sm: schema.sm || undefined,
747
+ md: schema.md || undefined,
748
+ lg: schema.lg || undefined,
749
+ xl: schema.xl || undefined,
750
+ } },
751
+ React.createElement(Card, null,
752
+ React.createElement(Paper, { style: styles.paper },
753
+ React.createElement(Accordion, { style: styles.paper },
754
+ React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, null) },
755
+ React.createElement(Typography, null, I18n.t('ra_Filter and Data Actions'))),
756
+ React.createElement(AccordionDetails, null,
757
+ React.createElement(Table, null,
758
+ React.createElement(TableBody, null,
759
+ schema.items?.find(item => item.sort || item.filter) &&
760
+ schema.items.map((headCell, i) => (React.createElement(TableRow, { key: `${headCell.attr}_${i}` }, this.renderOneFilter({
761
+ schema,
762
+ style: tdStyle,
763
+ showAddButton: false,
764
+ headCell,
765
+ order,
766
+ orderBy,
767
+ index: i,
768
+ doAnyFilterSet: false,
769
+ })))),
770
+ importExportVisible ? (React.createElement(TableRow, null,
771
+ React.createElement(TableCell, { align: "left", style: tdStyle },
772
+ React.createElement("span", { style: styles.headerText }, I18n.t('ra_Actions'))),
773
+ React.createElement(TableCell, { style: tdStyle }, this.renderImportExportButtons(schema)))) : null))))))));
774
+ }
775
+ return null;
771
776
  }
772
777
  enhancedBottomCard() {
773
778
  const { schema } = this.props;
@@ -797,7 +802,7 @@ class ConfigTable extends ConfigGeneric {
797
802
  if (this.props.schema.compact) {
798
803
  tdStyle = { paddingTop: 1, paddingBottom: 1 };
799
804
  }
800
- visibleValue = visibleValue || this.state.value.map((_, i) => i);
805
+ visibleValue ||= this.state.value.map((_, i) => i);
801
806
  const doAnyFilterSet = this.isAnyFilterSet();
802
807
  return (React.createElement(Grid2, { container: true },
803
808
  this.showImportDialog(),