@iobroker/json-config 7.4.12 → 7.4.13

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.
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { FormHelperText, FormControl } from '@mui/material';
3
3
  import ConfigGeneric from './ConfigGeneric';
4
4
  import ChipInput from './ChipInput';
5
+ import { I18n } from '@iobroker/adapter-react-v5';
5
6
  class ConfigChip extends ConfigGeneric {
6
7
  componentDidMount() {
7
8
  super.componentDidMount();
@@ -53,6 +54,7 @@ class ConfigChip extends ConfigGeneric {
53
54
  }
54
55
  });
55
56
  } }),
57
+ React.createElement(FormHelperText, null, I18n.t('ra_Press ENTER Key to add new item')),
56
58
  this.props.schema.help ? (React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation))) : null));
57
59
  }
58
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigChip.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5D,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,SAAS,MAAM,aAAa,CAAC;AAMpC,MAAM,UAAW,SAAQ,aAAkD;IACvE,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAClC,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjD,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC1D,MAAM,KAAK,GAAG,KAAK;iBACd,KAAK,CAAC,IAAI,CAAC,KAAK,C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,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACtB,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,CACE,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { FormHelperText, FormControl } from '@mui/material';\n\nimport type { ConfigItemChip } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport ChipInput from './ChipInput';\n\ninterface ConfigChipProps extends ConfigGenericProps {\n schema: ConfigItemChip;\n}\n\nclass ConfigChip extends ConfigGeneric<ConfigChipProps, ConfigGenericState> {\n componentDidMount(): void {\n super.componentDidMount();\n const { data, attr } = this.props;\n const value = ConfigGeneric.getValue(data, attr);\n if (this.props.schema.delimiter && typeof value === 'string') {\n const parts = value\n .split(this.props.schema.delimiter)\n .map(a => a.trim())\n .filter(a => a);\n this.setState({ value: parts });\n } else {\n this.setState({ value: value || [] });\n }\n }\n\n renderItem(error: string, disabled: boolean): JSX.Element | null {\n const { attr, schema } = this.props;\n const { value } = this.state;\n return (\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n <ChipInput\n value={value}\n disabled={!!disabled}\n label={this.getText(schema.label)}\n error={!!error}\n onAdd={chip => {\n const newValue = JSON.parse(JSON.stringify(value));\n newValue.push(chip);\n this.setState({ value: newValue }, () => {\n let mayBePromise: void | Promise<void>;\n if (this.props.schema.delimiter) {\n mayBePromise = this.onChange(attr, newValue.join(`${this.props.schema.delimiter} `));\n } else {\n mayBePromise = this.onChange(attr, newValue);\n }\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n theme={this.props.oContext.theme}\n onDelete={(_chip, index) => {\n const newValue = JSON.parse(JSON.stringify(value));\n newValue.splice(index, 1);\n this.setState({ value: newValue }, () => {\n let mayBePromise: void | Promise<void>;\n if (this.props.schema.delimiter) {\n mayBePromise = this.onChange(attr, newValue.join(`${this.props.schema.delimiter} `));\n } else {\n mayBePromise = this.onChange(attr, newValue);\n }\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n />\n {this.props.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 </FormControl>\n );\n }\n}\n\nexport default ConfigChip;\n"]}
1
+ {"version":3,"file":"ConfigChip.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5D,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAMlD,MAAM,UAAW,SAAQ,aAAkD;IACvE,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAClC,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjD,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC1D,MAAM,KAAK,GAAG,KAAK;iBACd,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;iBAClC,GAAG,CAAC,CAAC,CAAC,EAAE,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,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACtB,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,CACE,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { FormHelperText, FormControl } from '@mui/material';\n\nimport type { ConfigItemChip } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport ChipInput from './ChipInput';\nimport { I18n } from '@iobroker/adapter-react-v5';\n\ninterface ConfigChipProps extends ConfigGenericProps {\n schema: ConfigItemChip;\n}\n\nclass ConfigChip extends ConfigGeneric<ConfigChipProps, ConfigGenericState> {\n componentDidMount(): void {\n super.componentDidMount();\n const { data, attr } = this.props;\n const value = ConfigGeneric.getValue(data, attr);\n if (this.props.schema.delimiter && typeof value === 'string') {\n const parts = value\n .split(this.props.schema.delimiter)\n .map(a => a.trim())\n .filter(a => a);\n this.setState({ value: parts });\n } else {\n this.setState({ value: value || [] });\n }\n }\n\n renderItem(error: string, disabled: boolean): JSX.Element | null {\n const { attr, schema } = this.props;\n const { value } = this.state;\n return (\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n <ChipInput\n value={value}\n disabled={!!disabled}\n label={this.getText(schema.label)}\n error={!!error}\n onAdd={chip => {\n const newValue = JSON.parse(JSON.stringify(value));\n newValue.push(chip);\n this.setState({ value: newValue }, () => {\n let mayBePromise: void | Promise<void>;\n if (this.props.schema.delimiter) {\n mayBePromise = this.onChange(attr, newValue.join(`${this.props.schema.delimiter} `));\n } else {\n mayBePromise = this.onChange(attr, newValue);\n }\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n theme={this.props.oContext.theme}\n onDelete={(_chip, index) => {\n const newValue = JSON.parse(JSON.stringify(value));\n newValue.splice(index, 1);\n this.setState({ value: newValue }, () => {\n let mayBePromise: void | Promise<void>;\n if (this.props.schema.delimiter) {\n mayBePromise = this.onChange(attr, newValue.join(`${this.props.schema.delimiter} `));\n } else {\n mayBePromise = this.onChange(attr, newValue);\n }\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n />\n <FormHelperText>{I18n.t('ra_Press ENTER Key to add new item')}</FormHelperText>\n {this.props.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 </FormControl>\n );\n }\n}\n\nexport default ConfigChip;\n"]}
@@ -184,32 +184,31 @@ export default class ConfigCustom extends ConfigGeneric {
184
184
  }
185
185
  render() {
186
186
  const CustomComponent = this.state.Component;
187
- // render temporary placeholder
188
- if (!CustomComponent) {
189
- const schema = this.props.schema || {};
190
- const item = (React.createElement(Grid2, { size: {
191
- xs: schema.xs || undefined,
187
+ const schema = this.props.schema || {};
188
+ let item = CustomComponent ? (React.createElement(CustomComponent, { ...this.props,
189
+ // @ts-expect-error BF (2024-12-18) Remove after the 7.4 will be mainstream. All following lines
190
+ socket: this.props.oContext.socket, theme: this.props.oContext.theme, themeType: this.props.oContext.themeType, instance: this.props.oContext.instance, adapterName: this.props.oContext.adapterName, systemConfig: this.props.oContext.systemConfig, forceUpdate: this.props.oContext.forceUpdate })) : this.state.error ? (React.createElement("div", null, this.state.error)) : (React.createElement(LinearProgress, null));
191
+ // If any widths are defined
192
+ if (schema.xs || schema.sm || schema.md || schema.lg || schema.xl) {
193
+ item = (React.createElement(Grid2, { size: {
194
+ xs: schema.xs || 12,
192
195
  sm: schema.sm || undefined,
193
196
  md: schema.md || undefined,
194
197
  lg: schema.lg || undefined,
195
198
  xl: schema.xl || undefined,
196
199
  }, style: {
197
200
  marginBottom: 0,
198
- // marginRight: 8,
199
201
  textAlign: 'left',
200
202
  ...schema.style,
201
203
  ...(this.props.oContext.themeType === 'dark' ? schema.darkStyle : {}),
202
- } }, this.state.error ? React.createElement("div", null, this.state.error) : React.createElement(LinearProgress, null)));
203
- if (schema.newLine) {
204
- return (React.createElement(React.Fragment, null,
205
- React.createElement("div", { style: { flexBasis: '100%', height: 0 } }),
206
- item));
207
- }
208
- return item;
204
+ } }, item));
209
205
  }
210
- return (React.createElement(CustomComponent, { ...this.props,
211
- // @ts-expect-error BF (2024-12-18) Remove after the 7.4 will be mainstream. All following lines
212
- socket: this.props.oContext.socket, theme: this.props.oContext.theme, themeType: this.props.oContext.themeType, instance: this.props.oContext.instance, adapterName: this.props.oContext.adapterName, systemConfig: this.props.oContext.systemConfig, forceUpdate: this.props.oContext.forceUpdate }));
206
+ if (schema.newLine) {
207
+ return (React.createElement(React.Fragment, null,
208
+ React.createElement("div", { style: { flexBasis: '100%', height: 0 } }),
209
+ item));
210
+ }
211
+ return item;
213
212
  }
214
213
  }
215
214
  //# sourceMappingURL=ConfigCustom.js.map
@@ -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,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,aAAmE,MAAM,uCAAuC,CAAC;AAExH,MAAM,eAAe,GAAG,CACpB,MAAc,EACd,UAAkB,EAClB,iBAA0B,EACoF,EAAE,CAChH,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC5B,sDAAsD;IACtD,IAAI,CAAE,MAAc,CAAC,MAAM,CAAC,EAAE;QAC1B,6EAA6E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import { I18n } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemCustom } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from '#JC/JsonConfigComponent/ConfigGeneric';\n\nconst getOrLoadRemote = (\n remote: string,\n shareScope: string,\n remoteFallbackUrl?: string,\n): Promise<{ get: (module: string) => () => Promise<{ default: Record<string, React.FC<ConfigGenericProps>> }> }> =>\n new Promise((resolve, reject) => {\n // check if remote exists on the global `window`object\n if (!(window as any)[remote]) {\n // search dom to see if remote tag exists, but might still be loading (async)\n const existingRemote: HTMLScriptElement = document.querySelector(`script[data-webpack=\"${remote}\"]`);\n // when remote is loaded.\n const onload = async (): Promise<void> => {\n // check if it was initialized\n if ((window as any)[remote]) {\n if (!(window as any)[remote].__initialized) {\n // if share scope doesn't exist (like in webpack 4) then expect shareScope to be a manual object\n // @ts-expect-error it is a trick and must be so\n if (typeof __webpack_share_scopes__ === 'undefined') {\n // use a default share scope object passed in manually\n await (window as any)[remote].init(shareScope);\n } else {\n // otherwise, init share scope as usual\n // @ts-expect-error it is a trick and must be so\n await (window as any)[remote].init((__webpack_share_scopes__ as any)[shareScope]);\n }\n // mark remote as initialized\n (window as any)[remote].__initialized = true;\n }\n } else {\n console.error(`Cannot load ${remote}`);\n reject(new Error(`Cannot load ${remote}`));\n return;\n }\n // resolve promise so marking remote as loaded\n resolve((window as any)[remote]);\n };\n\n if (existingRemote) {\n // if existing remote but not loaded, hook into its onload and wait for it to be ready\n existingRemote.onload = onload;\n existingRemote.onerror = reject;\n // check if remote fallback exists as param passed to function\n // TODO: should scan public config for a matching key if no override exists\n } else if (remoteFallbackUrl) {\n // inject remote if a fallback exists and call the same onload function\n const d = document;\n const script = d.createElement('script');\n script.type = 'text/javascript';\n // mark as data-webpack so runtime can track it internally\n script.setAttribute('data-webpack', `${remote}`);\n script.async = true;\n script.onerror = reject;\n script.onload = onload;\n script.src = remoteFallbackUrl;\n d.getElementsByTagName('head')[0].appendChild(script);\n } else {\n // no remote and no fallback exist, reject\n reject(new Error(`Cannot Find Remote ${remote} to inject`));\n }\n } else {\n // remote already instantiated, resolve\n resolve((window as any)[remote]);\n }\n });\n\nfunction loadComponent(\n remote: string,\n sharedScope: string,\n module: string,\n url: string,\n): () => Promise<{ default: Record<string, React.FC<ConfigGenericProps>> }> {\n return async (): Promise<{ default: Record<string, React.FC<ConfigGenericProps>> }> => {\n const container = await getOrLoadRemote(remote, sharedScope, url);\n // eslint-disable-next-line @typescript-eslint/await-thenable\n const factory = await container.get(module);\n return factory();\n };\n}\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\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(uniqueName, fileToLoad, componentName);\n setPromise = loadComponent(uniqueName, 'default', `./${fileToLoad}`, url)();\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 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 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\n // render temporary placeholder\n if (!CustomComponent) {\n const schema = this.props.schema || ({} as ConfigItemCustom);\n\n const item = (\n <Grid2\n size={{\n xs: schema.xs || undefined,\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n style={{\n marginBottom: 0,\n // marginRight: 8,\n textAlign: 'left',\n ...schema.style,\n ...(this.props.oContext.themeType === 'dark' ? schema.darkStyle : {}),\n }}\n >\n {this.state.error ? <div>{this.state.error}</div> : <LinearProgress />}\n </Grid2>\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n return item;\n }\n\n return (\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 );\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,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,aAAmE,MAAM,uCAAuC,CAAC;AAExH,MAAM,eAAe,GAAG,CACpB,MAAc,EACd,UAAkB,EAClB,iBAA0B,EACoF,EAAE,CAChH,IAAI,OAAO,CAAC,CAAC,OAAO,EA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IAAI,MAAM,CAAC,OAAO,EAAE;YAChB,OAAO,CACH;gBACI,6BAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAI;gBAC/C,IAAI,CACN,CACN,CAAC;SACL;QAED,OAAO,IAAI,CAAC;IAChB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\nimport { Grid2, LinearProgress } from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemCustom } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from '#JC/JsonConfigComponent/ConfigGeneric';\n\nconst getOrLoadRemote = (\n remote: string,\n shareScope: string,\n remoteFallbackUrl?: string,\n): Promise<{ get: (module: string) => () => Promise<{ default: Record<string, React.FC<ConfigGenericProps>> }> }> =>\n new Promise((resolve, reject) => {\n // check if remote exists on the global `window`object\n if (!(window as any)[remote]) {\n // search dom to see if remote tag exists, but might still be loading (async)\n const existingRemote: HTMLScriptElement = document.querySelector(`script[data-webpack=\"${remote}\"]`);\n // when remote is loaded.\n const onload = async (): Promise<void> => {\n // check if it was initialized\n if ((window as any)[remote]) {\n if (!(window as any)[remote].__initialized) {\n // if share scope doesn't exist (like in webpack 4) then expect shareScope to be a manual object\n // @ts-expect-error it is a trick and must be so\n if (typeof __webpack_share_scopes__ === 'undefined') {\n // use a default share scope object passed in manually\n await (window as any)[remote].init(shareScope);\n } else {\n // otherwise, init share scope as usual\n // @ts-expect-error it is a trick and must be so\n await (window as any)[remote].init((__webpack_share_scopes__ as any)[shareScope]);\n }\n // mark remote as initialized\n (window as any)[remote].__initialized = true;\n }\n } else {\n console.error(`Cannot load ${remote}`);\n reject(new Error(`Cannot load ${remote}`));\n return;\n }\n // resolve promise so marking remote as loaded\n resolve((window as any)[remote]);\n };\n\n if (existingRemote) {\n // if existing remote but not loaded, hook into its onload and wait for it to be ready\n existingRemote.onload = onload;\n existingRemote.onerror = reject;\n // check if remote fallback exists as param passed to function\n // TODO: should scan public config for a matching key if no override exists\n } else if (remoteFallbackUrl) {\n // inject remote if a fallback exists and call the same onload function\n const d = document;\n const script = d.createElement('script');\n script.type = 'text/javascript';\n // mark as data-webpack so runtime can track it internally\n script.setAttribute('data-webpack', `${remote}`);\n script.async = true;\n script.onerror = reject;\n script.onload = onload;\n script.src = remoteFallbackUrl;\n d.getElementsByTagName('head')[0].appendChild(script);\n } else {\n // no remote and no fallback exist, reject\n reject(new Error(`Cannot Find Remote ${remote} to inject`));\n }\n } else {\n // remote already instantiated, resolve\n resolve((window as any)[remote]);\n }\n });\n\nfunction loadComponent(\n remote: string,\n sharedScope: string,\n module: string,\n url: string,\n): () => Promise<{ default: Record<string, React.FC<ConfigGenericProps>> }> {\n return async (): Promise<{ default: Record<string, React.FC<ConfigGenericProps>> }> => {\n const container = await getOrLoadRemote(remote, sharedScope, url);\n // eslint-disable-next-line @typescript-eslint/await-thenable\n const factory = await container.get(module);\n return factory();\n };\n}\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\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(uniqueName, fileToLoad, componentName);\n setPromise = loadComponent(uniqueName, 'default', `./${fileToLoad}`, url)();\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 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 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 any widths are defined\n if (schema.xs || schema.sm || schema.md || schema.lg || schema.xl) {\n item = (\n <Grid2\n size={{\n xs: schema.xs || 12,\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n style={{\n marginBottom: 0,\n textAlign: 'left',\n ...schema.style,\n ...(this.props.oContext.themeType === 'dark' ? schema.darkStyle : {}),\n }}\n >\n {item}\n </Grid2>\n );\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"]}
@@ -677,7 +677,7 @@ export default class ConfigGeneric extends Component {
677
677
  }
678
678
  const { error, disabled, hidden, defaultValue } = this.calculate(schema);
679
679
  if (hidden) {
680
- // Remove all errors if element is hidden
680
+ // Remove all errors if an element is hidden
681
681
  if (Object.keys(this.isError).length) {
682
682
  setTimeout(isError => Object.keys(isError).forEach(attr => this.props.onError(attr)), 100, JSON.parse(JSON.stringify(this.isError)));
683
683
  this.isError = {};
@@ -729,7 +729,6 @@ export default class ConfigGeneric extends Component {
729
729
  xl: schema.xl || undefined,
730
730
  }, style: {
731
731
  marginBottom: 0,
732
- // marginRight: 8,
733
732
  textAlign: 'left',
734
733
  width: schema.type === 'divider' || schema.type === 'header' ? schema.width || '100%' : undefined,
735
734
  ...schema.style,
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigGeneric.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigGeneric.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EACH,IAAI,IAAI,QAAQ,EAChB,OAAO,IAAI,WAAW,EACtB,KAAK,IAAI,SAAS,EAClB,GAAG,IAAI,QAAQ,EACf,IAAI,IAAI,QAAQ,EAChB,MAAM,IAAI,OAAO,EACjB,MAAM,IAAI,UAAU,EACpB,QAAQ,IAAI,YAAY,EACxB,IAAI,IAAI,QAAQ,EAChB,UAAU,IAAI,cAAc,EAC5B,IAAI,IAAI,QAAQ,EAChB,MAAM,IAAI,UAAU,EACpB,KAAK,IAAI,SAAS,EAClB,MAAM,IAAI,UAAU,EACpB,OAAO,IAAI,WAAW,EACtB,GAAG,IAAI,OAAO,EACd,OAAO,IAAI,WAAW,EACtB,IAAI,IAAI,QAAQ,EAChB,IAAI,EACJ,SAAS,GACZ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACH,aAAa,EACb,IAAI,EACJ,KAAK,EACL,IAAI,GAIP,MAAM,4BAA4B,CAAC;AAGpC,MAAM,eAAe,GAAG,MAAM,CAAC,UAA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C,IAAI,CAAC,OAAO,CACR,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,EAC/B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,0BAA0B,CAC/C;wBACH,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,6BAA6B,CAAC,IAG9C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAqC,CAAC,CACjE,CACL,CACJ,CACX,CAAC,CAAC,CAAC,CACA,YAAY,CACf,CACG,CACX,CAAC;QAEF,IAAI,MAAM,CAAC,OAAO,EAAE;YAChB,OAAO,CACH;gBACI,6BAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAI;gBAC/C,IAAI,CAAC,mBAAmB,EAAE;gBAC1B,IAAI,CACN,CACN,CAAC;SACL;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;YAC1B,OAAO,CACH;gBACK,IAAI,CAAC,mBAAmB,EAAE;gBAC1B,IAAI,CACN,CACN,CAAC;SACL;QACD,OAAO,IAAI,CAAC;IAChB,CAAC","sourcesContent":["import React, { Component, type JSX } from 'react';\n\nimport { Grid2, Button } from '@mui/material';\n\nimport {\n Info as IconInfo,\n Warning as IconWarning,\n Error as IconError,\n Key as IconAuth,\n Send as IconSend,\n Public as IconWeb,\n Search as IconSearch,\n MenuBook as IconMenuBook,\n Help as IconHelp,\n UploadFile as IconUploadFile,\n Edit as IconEdit,\n Person as IconPerson,\n Group as IconGroup,\n Delete as IconDelete,\n Refresh as IconRefresh,\n Add as IconAdd,\n LinkOff as IconLinkOff,\n Link as LinkIcon,\n Save,\n OpenInNew,\n} from '@mui/icons-material';\n\nimport {\n DialogConfirm,\n Icon,\n Utils,\n I18n,\n type Connection,\n type ThemeType,\n type ThemeName,\n} from '@iobroker/adapter-react-v5';\nimport type { ConfigIconType, ConfigItemAny, ConfigItemConfirmData, JsonConfigContext } from '#JC/types';\n\nconst DEFAULT_SM_SIZE = window.innerWidth <= 600 ? 12 : undefined;\n\n// because this class is used in react-components, do not include here any foreign files like from '../../helpers/utils.ts'\nexport function isObject(it: any): it is Record<string, any> {\n // This is necessary because:\n // typeof null === 'object'\n // typeof [] === 'object'\n // [] instanceof Object === true\n return Object.prototype.toString.call(it) === '[object Object]'; // this code is 25% faster than below one\n // return it && typeof it === 'object' && !(it instanceof Array);\n}\n\nexport interface DeviceManagerPropsProps {\n /* socket object */\n socket: Connection;\n /* Instance to communicate with device-manager backend, like `adapterName.X` */\n selectedInstance: string; // adapterName.X\n registerHandler?: (handler: null | ((command: string) => void)) => void;\n themeName: ThemeName;\n themeType: ThemeType;\n isFloatComma: boolean;\n dateFormat: string;\n /** Instance to upload images to, like `adapterName.X` */\n uploadImagesToInstance?: string;\n /** Filter devices with this string */\n filter?: string;\n /** If this component is used in GUI with own toolbar. `false` if this list is used with multiple instances and true if only with one (in this case, it will monitor alive itself */\n embedded?: boolean;\n /** If embedded, this text is shown in the toolbar */\n title?: string;\n /** Style of a component that displays all devices */\n style?: React.CSSProperties;\n /** Use small cards for devices */\n smallCards?: boolean;\n}\n\nexport interface ConfigGenericProps {\n oContext: JsonConfigContext;\n alive: boolean;\n arrayIndex?: number;\n attr?: string;\n changed: boolean;\n className?: string;\n style?: Record<string, any>;\n commandRunning?: boolean;\n common: Record<string, any>;\n custom?: boolean;\n customObj?: Record<string, any>;\n data: Record<string, any>;\n disabled?: boolean;\n // filled only by table and represents the obj.native or obj.common.custom['adapter.X'] object\n globalData?: Record<string, any>;\n // filled only by table\n index?: number;\n isParentTab?: boolean;\n onChange: (attrOrData: string | Record<string, any>, val?: any, cb?: () => void, saveConfig?: boolean) => void;\n onError: (attr: string, error?: string) => void;\n originalData: Record<string, any>;\n /** This indicates that the component is the very firsts one - root */\n root?: boolean;\n /** Provided props by the specific component */\n schema: ConfigItemAny;\n /** This item is in the table. Maybe some layouts must be changed */\n table?: boolean;\n themeName: ThemeName;\n}\n\nexport interface ConfigGenericState {\n confirmDialog: boolean;\n confirmNewValue: any;\n confirmAttr: any;\n confirmData: ConfigItemConfirmData | null;\n value?: any;\n confirmDepAttr?: any;\n confirmDepNewValue?: any;\n confirmCallback: null | ((result: boolean) => void);\n}\n\nexport default class ConfigGeneric<\n Props extends ConfigGenericProps = ConfigGenericProps,\n State extends ConfigGenericState = ConfigGenericState,\n> extends Component<Props, State> {\n static DIFFERENT_VALUE = '__different__';\n\n static DIFFERENT_LABEL = 'ra___different__';\n\n static NONE_VALUE = '';\n\n static NONE_LABEL = 'ra_none';\n\n private readonly defaultValue: any;\n\n private isError: any;\n\n private readonly lang: ioBroker.Languages;\n\n private defaultSendToDone?: boolean;\n\n private sendToTimeout?: any;\n\n private noPlaceRequired: any;\n\n constructor(props: Props) {\n super(props);\n\n // @ts-expect-error of course, as we just\n this.state = {\n confirmDialog: false,\n confirmNewValue: null,\n confirmAttr: null,\n confirmData: null,\n confirmCallback: null,\n } satisfies ConfigGenericState;\n\n this.isError = {};\n\n if (props.schema) {\n if (props.custom) {\n this.defaultValue = props.schema.defaultFunc\n ? this.executeCustom(\n props.schema.defaultFunc,\n props.data,\n props.customObj,\n props.oContext.instanceObj,\n props.arrayIndex,\n props.globalData,\n )\n : props.schema.default;\n } else if (props.schema.type !== 'state') {\n this.defaultValue = props.schema.defaultFunc\n ? this.execute(\n props.schema.defaultFunc,\n props.schema.default,\n props.data,\n props.arrayIndex,\n props.globalData,\n )\n : props.schema.default;\n }\n }\n\n this.lang = I18n.getLanguage();\n }\n\n componentDidMount(): void {\n if (this.props.oContext.registerOnForceUpdate) {\n this.props.oContext.registerOnForceUpdate(this.props.attr, this.onUpdate);\n }\n const LIKE_SELECT = ['select', 'autocomplete', 'autocompleteSendTo'];\n // init default value\n if (this.defaultValue !== undefined) {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n if (\n value === undefined ||\n (LIKE_SELECT.includes(this.props.schema.type) && (value === '' || value === null))\n ) {\n setTimeout(() => {\n if (this.props.custom) {\n this.props.onChange(this.props.attr, this.defaultValue, () =>\n setTimeout(() => this.props.oContext.forceUpdate([this.props.attr], this.props.data), 100),\n );\n } else {\n ConfigGeneric.setValue(this.props.data, this.props.attr, this.defaultValue);\n this.props.onChange(this.props.data, undefined, () =>\n this.props.oContext.forceUpdate([this.props.attr], this.props.data),\n );\n }\n }, 100);\n }\n } else if (this.props.schema.defaultSendTo) {\n this.sendTo();\n }\n }\n\n sendTo(): void {\n if (this.props.alive) {\n this.defaultSendToDone = true;\n let data: any = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr = this.getPattern(this.props.schema.jsonData, null, true);\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${dataStr}`);\n }\n } else {\n data = {\n attr: this.props.attr,\n value: ConfigGeneric.getValue(this.props.data, this.props.attr),\n };\n }\n\n if (data === undefined) {\n data = null;\n }\n\n void this.props.oContext.socket\n .sendTo(\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.defaultSendTo,\n data,\n )\n .then((value: any) => {\n if (value !== null && value !== undefined) {\n if (this.props.custom) {\n this.props.onChange(this.props.attr, value, () =>\n this.props.oContext.forceUpdate([this.props.attr], this.props.data),\n );\n } else {\n ConfigGeneric.setValue(this.props.data, this.props.attr, value);\n this.props.onChange(this.props.data, undefined, () =>\n this.props.oContext.forceUpdate([this.props.attr], this.props.data),\n );\n }\n }\n });\n } else {\n this.defaultSendToDone = false;\n if (!this.props.schema.allowSaveWithError) {\n // show error, that instance did not start\n this.onError(\n this.props.attr,\n I18n.t('ra_Instance %s is not alive', this.props.oContext.instance.toString()),\n );\n }\n }\n }\n\n componentWillUnmount(): void {\n if (this.props.oContext.registerOnForceUpdate) {\n this.props.oContext.registerOnForceUpdate(this.props.attr);\n }\n if (this.sendToTimeout) {\n clearTimeout(this.sendToTimeout);\n this.sendToTimeout = null;\n }\n }\n\n onUpdate = (data: Record<string, any>): void => {\n const value = ConfigGeneric.getValue(data || this.props.data, this.props.attr) || '';\n if (this.state.value !== value) {\n this.setState({ value });\n } else {\n this.forceUpdate();\n }\n };\n\n /**\n * Extract attribute out of data\n */\n static getValue(data: Record<string, any>, attr: string | string[]): any {\n if (typeof attr === 'string') {\n return ConfigGeneric.getValue(data, attr.split('.'));\n }\n if (attr.length === 1) {\n return data[attr[0]];\n }\n const part = attr.shift();\n\n if (typeof part === 'string' && typeof data[part] === 'object') {\n return ConfigGeneric.getValue(data[part], attr);\n }\n return undefined;\n }\n\n static setValue(data: Record<string, any>, attr: string | string[], value: any): void {\n if (typeof attr === 'string') {\n ConfigGeneric.setValue(data, attr.split('.'), value);\n return;\n }\n if (attr.length === 1) {\n if (value === null) {\n delete data[attr[0]];\n } else {\n data[attr[0]] = value;\n }\n } else {\n const part = attr.shift();\n\n if (typeof part !== 'string') {\n return;\n }\n\n if (!data[part] || typeof data[part] === 'object') {\n data[part] = data[part] || {};\n }\n ConfigGeneric.setValue(data[part], attr, value);\n }\n }\n\n getText(text: ioBroker.StringOrTranslated, noTranslation?: boolean): string {\n if (!text) {\n return '';\n }\n\n if (typeof text === 'string') {\n const strText = noTranslation ? text : I18n.t(text);\n if (strText.includes('${')) {\n return this.getPattern(strText, null, noTranslation);\n }\n return strText;\n }\n\n if (isObject(text)) {\n // todo\n if ((text as any).func) {\n // calculate pattern\n if (typeof (text as any).func === 'object') {\n return this.getPattern((text as any).func[this.lang] || (text as any).func.en || '', null, true);\n }\n return this.getPattern((text as any).func, null, noTranslation);\n }\n\n return text[this.lang] || text.en || '';\n }\n\n return (text as any).toString();\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 | JSX.Element = 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 || undefined}\n onClose={isOk =>\n this.setState({ confirmDialog: false }, () => {\n if (isOk) {\n if (this.state.confirmCallback) {\n const callback = this.state.confirmCallback;\n this.setState({ confirmCallback: null }, () => callback(true));\n return;\n }\n\n const data = JSON.parse(JSON.stringify(this.props.data));\n if (this.state.confirmDepAttr) {\n ConfigGeneric.setValue(data, this.state.confirmDepAttr, this.state.confirmDepNewValue);\n }\n\n ConfigGeneric.setValue(data, this.state.confirmAttr, this.state.confirmNewValue);\n this.setState(\n {\n confirmDialog: false,\n confirmDepAttr: null,\n confirmDepNewValue: null,\n confirmNewValue: null,\n confirmAttr: null,\n confirmData: null,\n },\n () => this.props.onChange(data),\n );\n } else {\n const callback = this.state.confirmCallback;\n this.setState(\n {\n confirmDialog: false,\n confirmDepAttr: null,\n confirmDepNewValue: null,\n confirmNewValue: null,\n confirmAttr: null,\n confirmData: null,\n confirmCallback: null,\n },\n () => {\n if (callback) {\n callback(false);\n }\n },\n );\n }\n })\n }\n />\n );\n }\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n getIcon(iconSettings?: ConfigIconType | null): JSX.Element | null {\n iconSettings = iconSettings || this.props.schema.icon;\n let icon = null;\n if (iconSettings === 'auth') {\n icon = <IconAuth />;\n } else if (iconSettings === 'send') {\n icon = <IconSend />;\n } else if (iconSettings === 'web') {\n icon = <IconWeb />;\n } else if (iconSettings === 'warning') {\n icon = <IconWarning />;\n } else if (iconSettings === 'error') {\n icon = <IconError />;\n } else if (iconSettings === 'info') {\n icon = <IconInfo />;\n } else if (iconSettings === 'search') {\n icon = <IconSearch />;\n } else if (iconSettings === 'book') {\n icon = <IconMenuBook />;\n } else if (iconSettings === 'help') {\n icon = <IconHelp />;\n } else if (iconSettings === 'upload') {\n icon = <IconUploadFile />;\n } else if (iconSettings === 'edit') {\n icon = <IconEdit />;\n } else if (iconSettings === 'user') {\n icon = <IconPerson />;\n } else if (iconSettings === 'group') {\n icon = <IconGroup />;\n } else if (iconSettings === 'delete') {\n icon = <IconDelete />;\n } else if (iconSettings === 'refresh') {\n icon = <IconRefresh />;\n } else if (iconSettings === 'add') {\n icon = <IconAdd />;\n } else if (iconSettings === 'unpair') {\n icon = <IconLinkOff />;\n } else if (iconSettings === 'pair') {\n icon = <LinkIcon />;\n } else if (iconSettings === 'save') {\n icon = <Save />;\n } else if (iconSettings === 'open') {\n icon = <OpenInNew />;\n } else if (iconSettings) {\n if (iconSettings.endsWith('.png') || iconSettings.endsWith('.svg') || iconSettings.endsWith('.jpg')) {\n // this path is relative to ./adapter/NAME\n if (!iconSettings.startsWith('http://') && !iconSettings.startsWith('https://')) {\n iconSettings = `./adapter/${this.props.oContext.adapterName}/${iconSettings}`;\n }\n }\n\n icon = (\n <Icon\n src={iconSettings}\n style={{ width: 22, height: 22 }}\n />\n );\n }\n\n return icon;\n }\n\n /**\n * Trigger onChange, to activate save button on change\n *\n * @param attr the changed attribute\n * @param newValue new value of the attribute\n */\n // eslint-disable-next-line react/no-unused-class-component-methods\n onChangeAsync(attr: string, newValue: unknown): Promise<void> {\n return new Promise(resolve => {\n const mayBePromise = this.onChange(attr, newValue, resolve);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n });\n }\n\n /**\n * Trigger onChange, to activate save button on change\n *\n * @param attr the changed attribute\n * @param newValue new value of the attribute\n * @param cb optional callback function, else returns a Promise\n */\n onChange(attr: string, newValue: unknown, cb?: () => void): Promise<void> {\n // Do not use here deep copy, as it is not JsonConfig\n const data = JSON.parse(JSON.stringify(this.props.data));\n ConfigGeneric.setValue(data, attr, newValue);\n\n if (\n this.props.schema.confirm &&\n this.execute(this.props.schema.confirm.condition, false, data, this.props.arrayIndex, this.props.globalData)\n ) {\n return new Promise<void>(resolve => {\n this.setState(\n {\n confirmDialog: true,\n confirmNewValue: newValue,\n confirmAttr: attr,\n confirmData: null,\n },\n () => {\n if (typeof cb === 'function') {\n cb();\n } else {\n resolve();\n }\n },\n );\n });\n }\n // find any inputs with confirmation\n if (this.props.schema.confirmDependsOn) {\n for (let z = 0; z < this.props.schema.confirmDependsOn.length; z++) {\n const dep = this.props.schema.confirmDependsOn[z];\n if (dep.confirm) {\n const val = ConfigGeneric.getValue(data, dep.attr);\n\n if (\n this.execute(dep.confirm.condition, false, data, this.props.arrayIndex, this.props.globalData)\n ) {\n return new Promise<void>(resolve => {\n this.setState(\n {\n confirmDialog: true,\n confirmNewValue: newValue,\n confirmAttr: attr,\n confirmDepNewValue: val,\n confirmDepAttr: dep.attr,\n confirmData: dep.confirm,\n },\n () => {\n if (typeof cb === 'function') {\n cb();\n } else {\n resolve();\n }\n },\n );\n });\n }\n }\n }\n }\n\n const changed: string[] = [];\n if (this.props.schema.onChangeDependsOn) {\n for (let z = 0; z < this.props.schema.onChangeDependsOn.length; z++) {\n const dep = this.props.schema.onChangeDependsOn[z];\n if (dep.onChange) {\n const val = ConfigGeneric.getValue(data, dep.attr);\n\n let _newValue;\n if (this.props.custom) {\n _newValue = this.executeCustom(\n dep.onChange.calculateFunc,\n data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n );\n } else {\n _newValue = this.execute(\n dep.onChange.calculateFunc,\n val,\n data,\n this.props.arrayIndex,\n this.props.globalData,\n );\n }\n\n if (_newValue !== val) {\n ConfigGeneric.setValue(data, dep.attr, _newValue);\n changed.push(dep.attr);\n }\n }\n }\n }\n\n if (this.props.schema.hiddenDependsOn) {\n for (let z = 0; z < this.props.schema.hiddenDependsOn.length; z++) {\n const dep = this.props.schema.hiddenDependsOn[z];\n if (dep.hidden) {\n changed.push(dep.attr);\n }\n }\n }\n\n if (this.props.schema.labelDependsOn) {\n for (let z = 0; z < this.props.schema.labelDependsOn.length; z++) {\n const dep = this.props.schema.labelDependsOn[z];\n if (dep.hidden) {\n changed.push(dep.attr);\n }\n }\n }\n\n if (this.props.schema.helpDependsOn) {\n for (let z = 0; z < this.props.schema.helpDependsOn.length; z++) {\n const dep = this.props.schema.helpDependsOn[z];\n if (dep.hidden) {\n changed.push(dep.attr);\n }\n }\n }\n\n if (this.props.schema.onChange && !this.props.schema.onChange.ignoreOwnChanges) {\n const val = ConfigGeneric.getValue(data, this.props.attr);\n\n const newValue_ = this.props.custom\n ? this.executeCustom(\n this.props.schema.onChange.calculateFunc,\n data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n )\n : this.execute(\n this.props.schema.onChange.calculateFunc,\n val,\n data,\n this.props.arrayIndex,\n this.props.globalData,\n );\n if (newValue_ !== val) {\n ConfigGeneric.setValue(data, this.props.attr, newValue_);\n }\n }\n\n if (this.props.custom) {\n this.props.onChange(attr, newValue, () => cb && cb());\n\n if (changed?.length) {\n changed.forEach((_attr, i) =>\n setTimeout(() => this.props.onChange(_attr, ConfigGeneric.getValue(data, _attr)), i * 50),\n );\n }\n } else {\n this.props.onChange(data, undefined, () => {\n if (changed.length) {\n this.props.oContext.forceUpdate(changed, data);\n }\n if (cb) {\n cb();\n }\n });\n }\n\n return Promise.resolve();\n }\n\n execute(\n func: string | boolean | Record<string, string>,\n defaultValue: string | number | boolean,\n data: Record<string, any>,\n arrayIndex: number,\n globalData: Record<string, any>,\n ): string | number | boolean {\n let fun: string;\n\n if (isObject(func)) {\n fun = func.func;\n } else if (typeof func === 'string') {\n fun = func;\n } else {\n return func;\n }\n\n if (!fun) {\n return defaultValue;\n }\n try {\n const f = new Function(\n 'data',\n 'originalData',\n '_system',\n '_alive',\n '_common',\n '_socket',\n '_instance',\n 'arrayIndex',\n 'globalData',\n '_changed',\n fun.includes('return') ? fun : `return ${fun}`,\n );\n return f(\n data || this.props.data,\n this.props.originalData,\n this.props.oContext.systemConfig,\n this.props.alive,\n this.props.common,\n this.props.oContext.socket,\n this.props.oContext.instance,\n arrayIndex,\n globalData,\n this.props.changed,\n );\n } catch (e) {\n console.error(`Cannot execute ${JSON.stringify(func)}: ${e}`);\n return defaultValue;\n }\n }\n\n executeCustom(\n func: string | boolean | Record<string, string>,\n data: Record<string, any>,\n customObj: Record<string, any>,\n instanceObj: ioBroker.InstanceObject,\n arrayIndex: number,\n globalData: Record<string, any>,\n ): string | boolean | number | null {\n let fun: string;\n\n if (isObject(func)) {\n fun = func.func;\n } else if (typeof func === 'string') {\n fun = func;\n } else {\n return func;\n }\n\n if (!fun) {\n return null;\n }\n try {\n const f = new Function(\n 'data',\n 'originalData',\n '_system',\n 'instanceObj',\n 'customObj',\n '_socket',\n 'arrayIndex',\n 'globalData',\n '_changed',\n fun.includes('return') ? fun : `return ${fun}`,\n );\n return f(\n data || this.props.data,\n this.props.originalData,\n this.props.oContext.systemConfig,\n instanceObj,\n customObj,\n this.props.oContext.socket,\n arrayIndex,\n globalData,\n this.props.changed,\n );\n } catch (e) {\n console.error(`Cannot execute ${fun}: ${e}`);\n return null;\n }\n }\n\n calculate(schema: Record<string, any>): {\n error: boolean;\n disabled: boolean;\n hidden: boolean;\n defaultValue: null | string | number | boolean;\n } {\n let error: boolean;\n let disabled: boolean;\n let hidden: boolean;\n let defaultValue: null | string | number | boolean;\n\n if (this.props.custom) {\n error = schema.validator\n ? !this.executeCustom(\n schema.validator,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n )\n : false;\n if (schema.disabled === true) {\n disabled = true;\n } else {\n disabled = schema.disabled\n ? (this.executeCustom(\n schema.disabled,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n ) as boolean)\n : false;\n }\n if (schema.hidden === true) {\n hidden = true;\n } else {\n hidden = schema.hidden\n ? (this.executeCustom(\n schema.hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n ) as boolean)\n : false;\n }\n defaultValue = schema.defaultFunc\n ? this.executeCustom(\n schema.defaultFunc,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n )\n : schema.default;\n } else {\n error = schema.validator\n ? !this.execute(schema.validator, false, this.props.data, this.props.arrayIndex, this.props.globalData)\n : false;\n if (schema.disabled === true) {\n disabled = true;\n } else {\n disabled = schema.disabled\n ? (this.execute(\n schema.disabled,\n false,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n ) as boolean)\n : false;\n }\n if (schema.hidden === true) {\n hidden = true;\n } else {\n hidden = schema.hidden\n ? (this.execute(\n schema.hidden,\n false,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n ) as boolean)\n : false;\n }\n defaultValue = schema.defaultFunc\n ? this.execute(\n schema.defaultFunc,\n schema.default,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n )\n : schema.default;\n }\n\n return {\n error,\n disabled,\n hidden,\n defaultValue,\n };\n }\n\n onError(attr: string, error?: string): void {\n if (!error) {\n delete this.isError[attr];\n } else {\n this.isError[attr] = error;\n }\n\n if (this.props.onError) {\n this.props.onError(attr, error);\n }\n }\n\n renderItem(_error: unknown, _disabled: boolean, _defaultValue?: unknown): JSX.Element | string | null {\n return this.getText(this.props.schema.label) || this.getText(this.props.schema.text);\n }\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n renderHelp(\n text: ioBroker.StringOrTranslated,\n link: string,\n noTranslation: boolean,\n ): JSX.Element | JSX.Element[] | string {\n if (!link) {\n text = this.getText(text, noTranslation) || '';\n if (\n text &&\n (text.includes('<a ') || text.includes('<br') || text.includes('<b>') || text.includes('<i>'))\n ) {\n return Utils.renderTextWithA(text);\n }\n return text;\n }\n return (\n <a\n href={link}\n target=\"_blank\"\n rel=\"noreferrer\"\n style={{\n color: this.props.oContext.themeType === 'dark' ? '#a147ff' : '#5b238f',\n textDecoration: 'underline',\n }}\n >\n {this.getText(text, noTranslation)}\n </a>\n );\n }\n\n // we have a problem that a string '{\"password\": \"${password}\"}' cannot contain a double quota inside the string\n // escape it with \\\"\n static escapeString(str: string, data: Record<string, any>): string {\n if (typeof str !== 'string') {\n return '';\n }\n str = str.replace(/`/g, '\\\\`');\n // extract all tokes with ${data.token}\n str = str.replace(/\\${([^}]+)}/g, (_match: string, p1: any) => {\n if (p1 && typeof p1 === 'string' && p1.startsWith('data.')) {\n const value = ConfigGeneric.getValue(data, p1.replace(/^data\\./, ''));\n\n if (typeof value === 'string' && value.includes('\"')) {\n return `\\${${p1}.replace(/\"/g, '\\\\\\\\\"')}`;\n }\n }\n return _match;\n });\n\n return str;\n }\n\n getPattern(pattern: string | { func: string }, data?: Record<string, any>, noTranslation?: boolean): string {\n data = data || this.props.data;\n if (!pattern) {\n return '';\n }\n let patternStr: string;\n if (typeof pattern === 'object') {\n if (pattern.func) {\n patternStr = (pattern as { func: string }).func;\n } else {\n console.log(`Object must be stringified: ${JSON.stringify(pattern)}`);\n patternStr = JSON.stringify(pattern);\n }\n } else {\n patternStr = pattern;\n }\n\n try {\n if (this.props.custom) {\n const f = new Function(\n 'data',\n 'originalData',\n 'arrayIndex',\n 'globalData',\n '_system',\n 'instanceObj',\n 'customObj',\n '_socket',\n '_changed',\n `return \\`${ConfigGeneric.escapeString(patternStr, data)}\\``,\n );\n return f(\n data,\n this.props.originalData,\n this.props.arrayIndex,\n this.props.globalData,\n this.props.oContext.systemConfig,\n this.props.oContext.instanceObj,\n this.props.customObj,\n this.props.oContext.socket,\n this.props.changed,\n );\n }\n\n const f = new Function(\n 'data',\n 'originalData',\n 'arrayIndex',\n 'globalData',\n '_system',\n '_alive',\n '_common',\n '_socket',\n '_changed',\n `return \\`${ConfigGeneric.escapeString(patternStr, data)}\\``,\n );\n const text = f(\n data,\n this.props.originalData,\n this.props.arrayIndex,\n this.props.globalData,\n this.props.oContext.systemConfig,\n this.props.alive,\n this.props.common,\n this.props.oContext.socket,\n this.props.changed,\n );\n if (noTranslation) {\n return text;\n }\n return I18n.t(text);\n } catch (e) {\n console.error(`Cannot execute ${patternStr}: ${e}`);\n return patternStr;\n }\n }\n\n render(): string | JSX.Element | null {\n const schema = this.props.schema;\n\n if (!schema) {\n return null;\n }\n\n // Do not show this component if expert mode is false\n if (this.props.oContext.expertMode === false && schema.expertMode) {\n return null;\n }\n\n if (this.props.alive && this.defaultSendToDone === false) {\n this.sendToTimeout = setTimeout(() => {\n this.sendToTimeout = null;\n this.sendTo();\n }, 200);\n }\n\n const { error, disabled, hidden, defaultValue } = this.calculate(schema);\n\n if (hidden) {\n // Remove all errors if element is hidden\n if (Object.keys(this.isError).length) {\n setTimeout(\n isError => Object.keys(isError).forEach(attr => this.props.onError(attr)),\n 100,\n JSON.parse(JSON.stringify(this.isError)),\n );\n this.isError = {};\n }\n\n if (schema.hideOnlyControl) {\n const item = (\n <Grid2\n size={{\n xs: schema.xs || DEFAULT_SM_SIZE, // if xs is not defined, take the full width\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n style={{\n marginBottom: 0 /* marginRight: 8, */,\n textAlign: 'left',\n ...schema.style,\n ...(this.props.oContext.themeType === 'dark' ? schema.darkStyle : {}),\n }}\n />\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n return item;\n }\n return null;\n }\n // Add error\n if (schema.validatorNoSaveOnError) {\n if (error && !Object.keys(this.isError).length) {\n this.isError = {\n [this.props.attr]: schema.validatorErrorText ? I18n.t(schema.validatorErrorText) : true,\n };\n setTimeout(\n isError => Object.keys(isError).forEach(attr => this.props.onError(attr, isError[attr])),\n 100,\n JSON.parse(JSON.stringify(this.isError)),\n );\n } else if (!error && Object.keys(this.isError).length) {\n setTimeout(\n isError => Object.keys(isError).forEach(attr => this.props.onError(attr)),\n 100,\n JSON.parse(JSON.stringify(this.isError)),\n );\n this.isError = {};\n }\n }\n\n const renderedItem = this.renderItem(\n error,\n disabled || this.props.commandRunning || this.props.disabled,\n defaultValue,\n );\n\n if (this.noPlaceRequired) {\n return renderedItem;\n }\n\n const item = (\n <Grid2\n title={this.getText(schema.tooltip)}\n size={{\n xs: schema.xs || 12, // if xs is not defined, take the full width\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n style={{\n marginBottom: 0,\n // marginRight: 8,\n textAlign: 'left',\n width: schema.type === 'divider' || schema.type === 'header' ? schema.width || '100%' : undefined,\n ...schema.style,\n ...(this.props.oContext.themeType === 'dark' ? schema.darkStyle : {}),\n }}\n >\n {this.props.schema.defaultSendTo && this.props.schema.button ? (\n <Grid2\n container\n style={{ width: '100%' }}\n >\n <Grid2 flex={1}>{renderedItem}</Grid2>\n <Grid2>\n <Button\n disabled={disabled}\n variant=\"outlined\"\n onClick={() => this.sendTo()}\n title={\n this.props.schema.buttonTooltip\n ? this.getText(\n this.props.schema.buttonTooltip,\n this.props.schema.buttonTooltipNoTranslation,\n )\n : I18n.t('ra_Request data by instance')\n }\n >\n {this.getText(this.props.schema.button as ioBroker.StringOrTranslated)}\n </Button>\n </Grid2>\n </Grid2>\n ) : (\n renderedItem\n )}\n </Grid2>\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {this.renderDialogConfirm()}\n {item}\n </>\n );\n }\n if (this.state.confirmDialog) {\n return (\n <>\n {this.renderDialogConfirm()}\n {item}\n </>\n );\n }\n return item;\n }\n}\n"]}
1
+ {"version":3,"file":"ConfigGeneric.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigGeneric.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EACH,IAAI,IAAI,QAAQ,EAChB,O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,CAAC;SACL;QACD,OAAO,IAAI,CAAC;IAChB,CAAC","sourcesContent":["import React, { Component, type JSX } from 'react';\n\nimport { Grid2, Button } from '@mui/material';\n\nimport {\n Info as IconInfo,\n Warning as IconWarning,\n Error as IconError,\n Key as IconAuth,\n Send as IconSend,\n Public as IconWeb,\n Search as IconSearch,\n MenuBook as IconMenuBook,\n Help as IconHelp,\n UploadFile as IconUploadFile,\n Edit as IconEdit,\n Person as IconPerson,\n Group as IconGroup,\n Delete as IconDelete,\n Refresh as IconRefresh,\n Add as IconAdd,\n LinkOff as IconLinkOff,\n Link as LinkIcon,\n Save,\n OpenInNew,\n} from '@mui/icons-material';\n\nimport {\n DialogConfirm,\n Icon,\n Utils,\n I18n,\n type Connection,\n type ThemeType,\n type ThemeName,\n} from '@iobroker/adapter-react-v5';\nimport type { ConfigIconType, ConfigItemAny, ConfigItemConfirmData, JsonConfigContext } from '#JC/types';\n\nconst DEFAULT_SM_SIZE = window.innerWidth <= 600 ? 12 : undefined;\n\n// because this class is used in react-components, do not include here any foreign files like from '../../helpers/utils.ts'\nexport function isObject(it: any): it is Record<string, any> {\n // This is necessary because:\n // typeof null === 'object'\n // typeof [] === 'object'\n // [] instanceof Object === true\n return Object.prototype.toString.call(it) === '[object Object]'; // this code is 25% faster than below one\n // return it && typeof it === 'object' && !(it instanceof Array);\n}\n\nexport interface DeviceManagerPropsProps {\n /* socket object */\n socket: Connection;\n /* Instance to communicate with device-manager backend, like `adapterName.X` */\n selectedInstance: string; // adapterName.X\n registerHandler?: (handler: null | ((command: string) => void)) => void;\n themeName: ThemeName;\n themeType: ThemeType;\n isFloatComma: boolean;\n dateFormat: string;\n /** Instance to upload images to, like `adapterName.X` */\n uploadImagesToInstance?: string;\n /** Filter devices with this string */\n filter?: string;\n /** If this component is used in GUI with own toolbar. `false` if this list is used with multiple instances and true if only with one (in this case, it will monitor alive itself */\n embedded?: boolean;\n /** If embedded, this text is shown in the toolbar */\n title?: string;\n /** Style of a component that displays all devices */\n style?: React.CSSProperties;\n /** Use small cards for devices */\n smallCards?: boolean;\n}\n\nexport interface ConfigGenericProps {\n oContext: JsonConfigContext;\n alive: boolean;\n arrayIndex?: number;\n attr?: string;\n changed: boolean;\n className?: string;\n style?: Record<string, any>;\n commandRunning?: boolean;\n common: Record<string, any>;\n custom?: boolean;\n customObj?: Record<string, any>;\n data: Record<string, any>;\n disabled?: boolean;\n // filled only by table and represents the obj.native or obj.common.custom['adapter.X'] object\n globalData?: Record<string, any>;\n // filled only by table\n index?: number;\n isParentTab?: boolean;\n onChange: (attrOrData: string | Record<string, any>, val?: any, cb?: () => void, saveConfig?: boolean) => void;\n onError: (attr: string, error?: string) => void;\n originalData: Record<string, any>;\n /** This indicates that the component is the very firsts one - root */\n root?: boolean;\n /** Provided props by the specific component */\n schema: ConfigItemAny;\n /** This item is in the table. Maybe some layouts must be changed */\n table?: boolean;\n themeName: ThemeName;\n}\n\nexport interface ConfigGenericState {\n confirmDialog: boolean;\n confirmNewValue: any;\n confirmAttr: any;\n confirmData: ConfigItemConfirmData | null;\n value?: any;\n confirmDepAttr?: any;\n confirmDepNewValue?: any;\n confirmCallback: null | ((result: boolean) => void);\n}\n\nexport default class ConfigGeneric<\n Props extends ConfigGenericProps = ConfigGenericProps,\n State extends ConfigGenericState = ConfigGenericState,\n> extends Component<Props, State> {\n static DIFFERENT_VALUE = '__different__';\n\n static DIFFERENT_LABEL = 'ra___different__';\n\n static NONE_VALUE = '';\n\n static NONE_LABEL = 'ra_none';\n\n private readonly defaultValue: any;\n\n private isError: any;\n\n private readonly lang: ioBroker.Languages;\n\n private defaultSendToDone?: boolean;\n\n private sendToTimeout?: any;\n\n private noPlaceRequired: any;\n\n constructor(props: Props) {\n super(props);\n\n // @ts-expect-error of course, as we just\n this.state = {\n confirmDialog: false,\n confirmNewValue: null,\n confirmAttr: null,\n confirmData: null,\n confirmCallback: null,\n } satisfies ConfigGenericState;\n\n this.isError = {};\n\n if (props.schema) {\n if (props.custom) {\n this.defaultValue = props.schema.defaultFunc\n ? this.executeCustom(\n props.schema.defaultFunc,\n props.data,\n props.customObj,\n props.oContext.instanceObj,\n props.arrayIndex,\n props.globalData,\n )\n : props.schema.default;\n } else if (props.schema.type !== 'state') {\n this.defaultValue = props.schema.defaultFunc\n ? this.execute(\n props.schema.defaultFunc,\n props.schema.default,\n props.data,\n props.arrayIndex,\n props.globalData,\n )\n : props.schema.default;\n }\n }\n\n this.lang = I18n.getLanguage();\n }\n\n componentDidMount(): void {\n if (this.props.oContext.registerOnForceUpdate) {\n this.props.oContext.registerOnForceUpdate(this.props.attr, this.onUpdate);\n }\n const LIKE_SELECT = ['select', 'autocomplete', 'autocompleteSendTo'];\n // init default value\n if (this.defaultValue !== undefined) {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n if (\n value === undefined ||\n (LIKE_SELECT.includes(this.props.schema.type) && (value === '' || value === null))\n ) {\n setTimeout(() => {\n if (this.props.custom) {\n this.props.onChange(this.props.attr, this.defaultValue, () =>\n setTimeout(() => this.props.oContext.forceUpdate([this.props.attr], this.props.data), 100),\n );\n } else {\n ConfigGeneric.setValue(this.props.data, this.props.attr, this.defaultValue);\n this.props.onChange(this.props.data, undefined, () =>\n this.props.oContext.forceUpdate([this.props.attr], this.props.data),\n );\n }\n }, 100);\n }\n } else if (this.props.schema.defaultSendTo) {\n this.sendTo();\n }\n }\n\n sendTo(): void {\n if (this.props.alive) {\n this.defaultSendToDone = true;\n let data: any = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr = this.getPattern(this.props.schema.jsonData, null, true);\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${dataStr}`);\n }\n } else {\n data = {\n attr: this.props.attr,\n value: ConfigGeneric.getValue(this.props.data, this.props.attr),\n };\n }\n\n if (data === undefined) {\n data = null;\n }\n\n void this.props.oContext.socket\n .sendTo(\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.defaultSendTo,\n data,\n )\n .then((value: any) => {\n if (value !== null && value !== undefined) {\n if (this.props.custom) {\n this.props.onChange(this.props.attr, value, () =>\n this.props.oContext.forceUpdate([this.props.attr], this.props.data),\n );\n } else {\n ConfigGeneric.setValue(this.props.data, this.props.attr, value);\n this.props.onChange(this.props.data, undefined, () =>\n this.props.oContext.forceUpdate([this.props.attr], this.props.data),\n );\n }\n }\n });\n } else {\n this.defaultSendToDone = false;\n if (!this.props.schema.allowSaveWithError) {\n // show error, that instance did not start\n this.onError(\n this.props.attr,\n I18n.t('ra_Instance %s is not alive', this.props.oContext.instance.toString()),\n );\n }\n }\n }\n\n componentWillUnmount(): void {\n if (this.props.oContext.registerOnForceUpdate) {\n this.props.oContext.registerOnForceUpdate(this.props.attr);\n }\n if (this.sendToTimeout) {\n clearTimeout(this.sendToTimeout);\n this.sendToTimeout = null;\n }\n }\n\n onUpdate = (data: Record<string, any>): void => {\n const value = ConfigGeneric.getValue(data || this.props.data, this.props.attr) || '';\n if (this.state.value !== value) {\n this.setState({ value });\n } else {\n this.forceUpdate();\n }\n };\n\n /**\n * Extract attribute out of data\n */\n static getValue(data: Record<string, any>, attr: string | string[]): any {\n if (typeof attr === 'string') {\n return ConfigGeneric.getValue(data, attr.split('.'));\n }\n if (attr.length === 1) {\n return data[attr[0]];\n }\n const part = attr.shift();\n\n if (typeof part === 'string' && typeof data[part] === 'object') {\n return ConfigGeneric.getValue(data[part], attr);\n }\n return undefined;\n }\n\n static setValue(data: Record<string, any>, attr: string | string[], value: any): void {\n if (typeof attr === 'string') {\n ConfigGeneric.setValue(data, attr.split('.'), value);\n return;\n }\n if (attr.length === 1) {\n if (value === null) {\n delete data[attr[0]];\n } else {\n data[attr[0]] = value;\n }\n } else {\n const part = attr.shift();\n\n if (typeof part !== 'string') {\n return;\n }\n\n if (!data[part] || typeof data[part] === 'object') {\n data[part] = data[part] || {};\n }\n ConfigGeneric.setValue(data[part], attr, value);\n }\n }\n\n getText(text: ioBroker.StringOrTranslated, noTranslation?: boolean): string {\n if (!text) {\n return '';\n }\n\n if (typeof text === 'string') {\n const strText = noTranslation ? text : I18n.t(text);\n if (strText.includes('${')) {\n return this.getPattern(strText, null, noTranslation);\n }\n return strText;\n }\n\n if (isObject(text)) {\n // todo\n if ((text as any).func) {\n // calculate pattern\n if (typeof (text as any).func === 'object') {\n return this.getPattern((text as any).func[this.lang] || (text as any).func.en || '', null, true);\n }\n return this.getPattern((text as any).func, null, noTranslation);\n }\n\n return text[this.lang] || text.en || '';\n }\n\n return (text as any).toString();\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 | JSX.Element = 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 || undefined}\n onClose={isOk =>\n this.setState({ confirmDialog: false }, () => {\n if (isOk) {\n if (this.state.confirmCallback) {\n const callback = this.state.confirmCallback;\n this.setState({ confirmCallback: null }, () => callback(true));\n return;\n }\n\n const data = JSON.parse(JSON.stringify(this.props.data));\n if (this.state.confirmDepAttr) {\n ConfigGeneric.setValue(data, this.state.confirmDepAttr, this.state.confirmDepNewValue);\n }\n\n ConfigGeneric.setValue(data, this.state.confirmAttr, this.state.confirmNewValue);\n this.setState(\n {\n confirmDialog: false,\n confirmDepAttr: null,\n confirmDepNewValue: null,\n confirmNewValue: null,\n confirmAttr: null,\n confirmData: null,\n },\n () => this.props.onChange(data),\n );\n } else {\n const callback = this.state.confirmCallback;\n this.setState(\n {\n confirmDialog: false,\n confirmDepAttr: null,\n confirmDepNewValue: null,\n confirmNewValue: null,\n confirmAttr: null,\n confirmData: null,\n confirmCallback: null,\n },\n () => {\n if (callback) {\n callback(false);\n }\n },\n );\n }\n })\n }\n />\n );\n }\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n getIcon(iconSettings?: ConfigIconType | null): JSX.Element | null {\n iconSettings = iconSettings || this.props.schema.icon;\n let icon = null;\n if (iconSettings === 'auth') {\n icon = <IconAuth />;\n } else if (iconSettings === 'send') {\n icon = <IconSend />;\n } else if (iconSettings === 'web') {\n icon = <IconWeb />;\n } else if (iconSettings === 'warning') {\n icon = <IconWarning />;\n } else if (iconSettings === 'error') {\n icon = <IconError />;\n } else if (iconSettings === 'info') {\n icon = <IconInfo />;\n } else if (iconSettings === 'search') {\n icon = <IconSearch />;\n } else if (iconSettings === 'book') {\n icon = <IconMenuBook />;\n } else if (iconSettings === 'help') {\n icon = <IconHelp />;\n } else if (iconSettings === 'upload') {\n icon = <IconUploadFile />;\n } else if (iconSettings === 'edit') {\n icon = <IconEdit />;\n } else if (iconSettings === 'user') {\n icon = <IconPerson />;\n } else if (iconSettings === 'group') {\n icon = <IconGroup />;\n } else if (iconSettings === 'delete') {\n icon = <IconDelete />;\n } else if (iconSettings === 'refresh') {\n icon = <IconRefresh />;\n } else if (iconSettings === 'add') {\n icon = <IconAdd />;\n } else if (iconSettings === 'unpair') {\n icon = <IconLinkOff />;\n } else if (iconSettings === 'pair') {\n icon = <LinkIcon />;\n } else if (iconSettings === 'save') {\n icon = <Save />;\n } else if (iconSettings === 'open') {\n icon = <OpenInNew />;\n } else if (iconSettings) {\n if (iconSettings.endsWith('.png') || iconSettings.endsWith('.svg') || iconSettings.endsWith('.jpg')) {\n // this path is relative to ./adapter/NAME\n if (!iconSettings.startsWith('http://') && !iconSettings.startsWith('https://')) {\n iconSettings = `./adapter/${this.props.oContext.adapterName}/${iconSettings}`;\n }\n }\n\n icon = (\n <Icon\n src={iconSettings}\n style={{ width: 22, height: 22 }}\n />\n );\n }\n\n return icon;\n }\n\n /**\n * Trigger onChange, to activate save button on change\n *\n * @param attr the changed attribute\n * @param newValue new value of the attribute\n */\n // eslint-disable-next-line react/no-unused-class-component-methods\n onChangeAsync(attr: string, newValue: unknown): Promise<void> {\n return new Promise(resolve => {\n const mayBePromise = this.onChange(attr, newValue, resolve);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n });\n }\n\n /**\n * Trigger onChange, to activate save button on change\n *\n * @param attr the changed attribute\n * @param newValue new value of the attribute\n * @param cb optional callback function, else returns a Promise\n */\n onChange(attr: string, newValue: unknown, cb?: () => void): Promise<void> {\n // Do not use here deep copy, as it is not JsonConfig\n const data = JSON.parse(JSON.stringify(this.props.data));\n ConfigGeneric.setValue(data, attr, newValue);\n\n if (\n this.props.schema.confirm &&\n this.execute(this.props.schema.confirm.condition, false, data, this.props.arrayIndex, this.props.globalData)\n ) {\n return new Promise<void>(resolve => {\n this.setState(\n {\n confirmDialog: true,\n confirmNewValue: newValue,\n confirmAttr: attr,\n confirmData: null,\n },\n () => {\n if (typeof cb === 'function') {\n cb();\n } else {\n resolve();\n }\n },\n );\n });\n }\n // find any inputs with confirmation\n if (this.props.schema.confirmDependsOn) {\n for (let z = 0; z < this.props.schema.confirmDependsOn.length; z++) {\n const dep = this.props.schema.confirmDependsOn[z];\n if (dep.confirm) {\n const val = ConfigGeneric.getValue(data, dep.attr);\n\n if (\n this.execute(dep.confirm.condition, false, data, this.props.arrayIndex, this.props.globalData)\n ) {\n return new Promise<void>(resolve => {\n this.setState(\n {\n confirmDialog: true,\n confirmNewValue: newValue,\n confirmAttr: attr,\n confirmDepNewValue: val,\n confirmDepAttr: dep.attr,\n confirmData: dep.confirm,\n },\n () => {\n if (typeof cb === 'function') {\n cb();\n } else {\n resolve();\n }\n },\n );\n });\n }\n }\n }\n }\n\n const changed: string[] = [];\n if (this.props.schema.onChangeDependsOn) {\n for (let z = 0; z < this.props.schema.onChangeDependsOn.length; z++) {\n const dep = this.props.schema.onChangeDependsOn[z];\n if (dep.onChange) {\n const val = ConfigGeneric.getValue(data, dep.attr);\n\n let _newValue;\n if (this.props.custom) {\n _newValue = this.executeCustom(\n dep.onChange.calculateFunc,\n data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n );\n } else {\n _newValue = this.execute(\n dep.onChange.calculateFunc,\n val,\n data,\n this.props.arrayIndex,\n this.props.globalData,\n );\n }\n\n if (_newValue !== val) {\n ConfigGeneric.setValue(data, dep.attr, _newValue);\n changed.push(dep.attr);\n }\n }\n }\n }\n\n if (this.props.schema.hiddenDependsOn) {\n for (let z = 0; z < this.props.schema.hiddenDependsOn.length; z++) {\n const dep = this.props.schema.hiddenDependsOn[z];\n if (dep.hidden) {\n changed.push(dep.attr);\n }\n }\n }\n\n if (this.props.schema.labelDependsOn) {\n for (let z = 0; z < this.props.schema.labelDependsOn.length; z++) {\n const dep = this.props.schema.labelDependsOn[z];\n if (dep.hidden) {\n changed.push(dep.attr);\n }\n }\n }\n\n if (this.props.schema.helpDependsOn) {\n for (let z = 0; z < this.props.schema.helpDependsOn.length; z++) {\n const dep = this.props.schema.helpDependsOn[z];\n if (dep.hidden) {\n changed.push(dep.attr);\n }\n }\n }\n\n if (this.props.schema.onChange && !this.props.schema.onChange.ignoreOwnChanges) {\n const val = ConfigGeneric.getValue(data, this.props.attr);\n\n const newValue_ = this.props.custom\n ? this.executeCustom(\n this.props.schema.onChange.calculateFunc,\n data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n )\n : this.execute(\n this.props.schema.onChange.calculateFunc,\n val,\n data,\n this.props.arrayIndex,\n this.props.globalData,\n );\n if (newValue_ !== val) {\n ConfigGeneric.setValue(data, this.props.attr, newValue_);\n }\n }\n\n if (this.props.custom) {\n this.props.onChange(attr, newValue, () => cb && cb());\n\n if (changed?.length) {\n changed.forEach((_attr, i) =>\n setTimeout(() => this.props.onChange(_attr, ConfigGeneric.getValue(data, _attr)), i * 50),\n );\n }\n } else {\n this.props.onChange(data, undefined, () => {\n if (changed.length) {\n this.props.oContext.forceUpdate(changed, data);\n }\n if (cb) {\n cb();\n }\n });\n }\n\n return Promise.resolve();\n }\n\n execute(\n func: string | boolean | Record<string, string>,\n defaultValue: string | number | boolean,\n data: Record<string, any>,\n arrayIndex: number,\n globalData: Record<string, any>,\n ): string | number | boolean {\n let fun: string;\n\n if (isObject(func)) {\n fun = func.func;\n } else if (typeof func === 'string') {\n fun = func;\n } else {\n return func;\n }\n\n if (!fun) {\n return defaultValue;\n }\n try {\n const f = new Function(\n 'data',\n 'originalData',\n '_system',\n '_alive',\n '_common',\n '_socket',\n '_instance',\n 'arrayIndex',\n 'globalData',\n '_changed',\n fun.includes('return') ? fun : `return ${fun}`,\n );\n return f(\n data || this.props.data,\n this.props.originalData,\n this.props.oContext.systemConfig,\n this.props.alive,\n this.props.common,\n this.props.oContext.socket,\n this.props.oContext.instance,\n arrayIndex,\n globalData,\n this.props.changed,\n );\n } catch (e) {\n console.error(`Cannot execute ${JSON.stringify(func)}: ${e}`);\n return defaultValue;\n }\n }\n\n executeCustom(\n func: string | boolean | Record<string, string>,\n data: Record<string, any>,\n customObj: Record<string, any>,\n instanceObj: ioBroker.InstanceObject,\n arrayIndex: number,\n globalData: Record<string, any>,\n ): string | boolean | number | null {\n let fun: string;\n\n if (isObject(func)) {\n fun = func.func;\n } else if (typeof func === 'string') {\n fun = func;\n } else {\n return func;\n }\n\n if (!fun) {\n return null;\n }\n try {\n const f = new Function(\n 'data',\n 'originalData',\n '_system',\n 'instanceObj',\n 'customObj',\n '_socket',\n 'arrayIndex',\n 'globalData',\n '_changed',\n fun.includes('return') ? fun : `return ${fun}`,\n );\n return f(\n data || this.props.data,\n this.props.originalData,\n this.props.oContext.systemConfig,\n instanceObj,\n customObj,\n this.props.oContext.socket,\n arrayIndex,\n globalData,\n this.props.changed,\n );\n } catch (e) {\n console.error(`Cannot execute ${fun}: ${e}`);\n return null;\n }\n }\n\n calculate(schema: Record<string, any>): {\n error: boolean;\n disabled: boolean;\n hidden: boolean;\n defaultValue: null | string | number | boolean;\n } {\n let error: boolean;\n let disabled: boolean;\n let hidden: boolean;\n let defaultValue: null | string | number | boolean;\n\n if (this.props.custom) {\n error = schema.validator\n ? !this.executeCustom(\n schema.validator,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n )\n : false;\n if (schema.disabled === true) {\n disabled = true;\n } else {\n disabled = schema.disabled\n ? (this.executeCustom(\n schema.disabled,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n ) as boolean)\n : false;\n }\n if (schema.hidden === true) {\n hidden = true;\n } else {\n hidden = schema.hidden\n ? (this.executeCustom(\n schema.hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n ) as boolean)\n : false;\n }\n defaultValue = schema.defaultFunc\n ? this.executeCustom(\n schema.defaultFunc,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n )\n : schema.default;\n } else {\n error = schema.validator\n ? !this.execute(schema.validator, false, this.props.data, this.props.arrayIndex, this.props.globalData)\n : false;\n if (schema.disabled === true) {\n disabled = true;\n } else {\n disabled = schema.disabled\n ? (this.execute(\n schema.disabled,\n false,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n ) as boolean)\n : false;\n }\n if (schema.hidden === true) {\n hidden = true;\n } else {\n hidden = schema.hidden\n ? (this.execute(\n schema.hidden,\n false,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n ) as boolean)\n : false;\n }\n defaultValue = schema.defaultFunc\n ? this.execute(\n schema.defaultFunc,\n schema.default,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n )\n : schema.default;\n }\n\n return {\n error,\n disabled,\n hidden,\n defaultValue,\n };\n }\n\n onError(attr: string, error?: string): void {\n if (!error) {\n delete this.isError[attr];\n } else {\n this.isError[attr] = error;\n }\n\n if (this.props.onError) {\n this.props.onError(attr, error);\n }\n }\n\n renderItem(_error: unknown, _disabled: boolean, _defaultValue?: unknown): JSX.Element | string | null {\n return this.getText(this.props.schema.label) || this.getText(this.props.schema.text);\n }\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n renderHelp(\n text: ioBroker.StringOrTranslated,\n link: string,\n noTranslation: boolean,\n ): JSX.Element | JSX.Element[] | string {\n if (!link) {\n text = this.getText(text, noTranslation) || '';\n if (\n text &&\n (text.includes('<a ') || text.includes('<br') || text.includes('<b>') || text.includes('<i>'))\n ) {\n return Utils.renderTextWithA(text);\n }\n return text;\n }\n return (\n <a\n href={link}\n target=\"_blank\"\n rel=\"noreferrer\"\n style={{\n color: this.props.oContext.themeType === 'dark' ? '#a147ff' : '#5b238f',\n textDecoration: 'underline',\n }}\n >\n {this.getText(text, noTranslation)}\n </a>\n );\n }\n\n // we have a problem that a string '{\"password\": \"${password}\"}' cannot contain a double quota inside the string\n // escape it with \\\"\n static escapeString(str: string, data: Record<string, any>): string {\n if (typeof str !== 'string') {\n return '';\n }\n str = str.replace(/`/g, '\\\\`');\n // extract all tokes with ${data.token}\n str = str.replace(/\\${([^}]+)}/g, (_match: string, p1: any) => {\n if (p1 && typeof p1 === 'string' && p1.startsWith('data.')) {\n const value = ConfigGeneric.getValue(data, p1.replace(/^data\\./, ''));\n\n if (typeof value === 'string' && value.includes('\"')) {\n return `\\${${p1}.replace(/\"/g, '\\\\\\\\\"')}`;\n }\n }\n return _match;\n });\n\n return str;\n }\n\n getPattern(pattern: string | { func: string }, data?: Record<string, any>, noTranslation?: boolean): string {\n data = data || this.props.data;\n if (!pattern) {\n return '';\n }\n let patternStr: string;\n if (typeof pattern === 'object') {\n if (pattern.func) {\n patternStr = (pattern as { func: string }).func;\n } else {\n console.log(`Object must be stringified: ${JSON.stringify(pattern)}`);\n patternStr = JSON.stringify(pattern);\n }\n } else {\n patternStr = pattern;\n }\n\n try {\n if (this.props.custom) {\n const f = new Function(\n 'data',\n 'originalData',\n 'arrayIndex',\n 'globalData',\n '_system',\n 'instanceObj',\n 'customObj',\n '_socket',\n '_changed',\n `return \\`${ConfigGeneric.escapeString(patternStr, data)}\\``,\n );\n return f(\n data,\n this.props.originalData,\n this.props.arrayIndex,\n this.props.globalData,\n this.props.oContext.systemConfig,\n this.props.oContext.instanceObj,\n this.props.customObj,\n this.props.oContext.socket,\n this.props.changed,\n );\n }\n\n const f = new Function(\n 'data',\n 'originalData',\n 'arrayIndex',\n 'globalData',\n '_system',\n '_alive',\n '_common',\n '_socket',\n '_changed',\n `return \\`${ConfigGeneric.escapeString(patternStr, data)}\\``,\n );\n const text = f(\n data,\n this.props.originalData,\n this.props.arrayIndex,\n this.props.globalData,\n this.props.oContext.systemConfig,\n this.props.alive,\n this.props.common,\n this.props.oContext.socket,\n this.props.changed,\n );\n if (noTranslation) {\n return text;\n }\n return I18n.t(text);\n } catch (e) {\n console.error(`Cannot execute ${patternStr}: ${e}`);\n return patternStr;\n }\n }\n\n render(): string | JSX.Element | null {\n const schema = this.props.schema;\n\n if (!schema) {\n return null;\n }\n\n // Do not show this component if expert mode is false\n if (this.props.oContext.expertMode === false && schema.expertMode) {\n return null;\n }\n\n if (this.props.alive && this.defaultSendToDone === false) {\n this.sendToTimeout = setTimeout(() => {\n this.sendToTimeout = null;\n this.sendTo();\n }, 200);\n }\n\n const { error, disabled, hidden, defaultValue } = this.calculate(schema);\n\n if (hidden) {\n // Remove all errors if an element is hidden\n if (Object.keys(this.isError).length) {\n setTimeout(\n isError => Object.keys(isError).forEach(attr => this.props.onError(attr)),\n 100,\n JSON.parse(JSON.stringify(this.isError)),\n );\n this.isError = {};\n }\n\n if (schema.hideOnlyControl) {\n const item = (\n <Grid2\n size={{\n xs: schema.xs || DEFAULT_SM_SIZE, // if xs is not defined, take the full width\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n style={{\n marginBottom: 0 /* marginRight: 8, */,\n textAlign: 'left',\n ...schema.style,\n ...(this.props.oContext.themeType === 'dark' ? schema.darkStyle : {}),\n }}\n />\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n return item;\n }\n return null;\n }\n // Add error\n if (schema.validatorNoSaveOnError) {\n if (error && !Object.keys(this.isError).length) {\n this.isError = {\n [this.props.attr]: schema.validatorErrorText ? I18n.t(schema.validatorErrorText) : true,\n };\n setTimeout(\n isError => Object.keys(isError).forEach(attr => this.props.onError(attr, isError[attr])),\n 100,\n JSON.parse(JSON.stringify(this.isError)),\n );\n } else if (!error && Object.keys(this.isError).length) {\n setTimeout(\n isError => Object.keys(isError).forEach(attr => this.props.onError(attr)),\n 100,\n JSON.parse(JSON.stringify(this.isError)),\n );\n this.isError = {};\n }\n }\n\n const renderedItem = this.renderItem(\n error,\n disabled || this.props.commandRunning || this.props.disabled,\n defaultValue,\n );\n\n if (this.noPlaceRequired) {\n return renderedItem;\n }\n\n const item = (\n <Grid2\n title={this.getText(schema.tooltip)}\n size={{\n xs: schema.xs || 12, // if xs is not defined, take the full width\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n style={{\n marginBottom: 0,\n textAlign: 'left',\n width: schema.type === 'divider' || schema.type === 'header' ? schema.width || '100%' : undefined,\n ...schema.style,\n ...(this.props.oContext.themeType === 'dark' ? schema.darkStyle : {}),\n }}\n >\n {this.props.schema.defaultSendTo && this.props.schema.button ? (\n <Grid2\n container\n style={{ width: '100%' }}\n >\n <Grid2 flex={1}>{renderedItem}</Grid2>\n <Grid2>\n <Button\n disabled={disabled}\n variant=\"outlined\"\n onClick={() => this.sendTo()}\n title={\n this.props.schema.buttonTooltip\n ? this.getText(\n this.props.schema.buttonTooltip,\n this.props.schema.buttonTooltipNoTranslation,\n )\n : I18n.t('ra_Request data by instance')\n }\n >\n {this.getText(this.props.schema.button as ioBroker.StringOrTranslated)}\n </Button>\n </Grid2>\n </Grid2>\n ) : (\n renderedItem\n )}\n </Grid2>\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {this.renderDialogConfirm()}\n {item}\n </>\n );\n }\n if (this.state.confirmDialog) {\n return (\n <>\n {this.renderDialogConfirm()}\n {item}\n </>\n );\n }\n return item;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iobroker/json-config",
3
3
  "description": "This package contains the ioBroker JSON config UI components",
4
- "version": "7.4.12",
4
+ "version": "7.4.13",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
7
7
  "scripts": {
@@ -18,7 +18,7 @@
18
18
  "access": "public"
19
19
  },
20
20
  "dependencies": {
21
- "@iobroker/adapter-react-v5": "7.4.12",
21
+ "@iobroker/adapter-react-v5": "7.4.13",
22
22
  "@mui/x-date-pickers": "^7.23.0",
23
23
  "crypto-js": "^4.2.0",
24
24
  "react-ace": "^13.0.0",
@@ -34,5 +34,5 @@
34
34
  "build/",
35
35
  "LICENSE"
36
36
  ],
37
- "gitHead": "2bfed452651ed920c75b4fa6792632acc99aa8af"
37
+ "gitHead": "15a253034892cbc6eea2ed8884b7d6ad02b7d162"
38
38
  }