@iobroker/json-config 7.7.2 → 7.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +15 -3
  2. package/build/JsonConfigComponent/ChipInput.d.ts +2 -2
  3. package/build/JsonConfigComponent/ChipInput.js +5 -8
  4. package/build/JsonConfigComponent/ChipInput.js.map +1 -1
  5. package/build/JsonConfigComponent/ConfigAccordion.d.ts +5 -0
  6. package/build/JsonConfigComponent/ConfigAccordion.js +86 -6
  7. package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -1
  8. package/build/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +4 -1
  9. package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +25 -9
  10. package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
  11. package/build/JsonConfigComponent/ConfigCheckDocker.d.ts +16 -0
  12. package/build/JsonConfigComponent/ConfigCheckDocker.js +52 -0
  13. package/build/JsonConfigComponent/ConfigCheckDocker.js.map +1 -0
  14. package/build/JsonConfigComponent/ConfigGeneric.js +5 -2
  15. package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
  16. package/build/JsonConfigComponent/ConfigJsonEditor.js +10 -2
  17. package/build/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
  18. package/build/JsonConfigComponent/ConfigNumber.js +20 -3
  19. package/build/JsonConfigComponent/ConfigNumber.js.map +1 -1
  20. package/build/JsonConfigComponent/ConfigPanel.js +2 -0
  21. package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
  22. package/build/JsonConfigComponent/ConfigPort.js +47 -8
  23. package/build/JsonConfigComponent/ConfigPort.js.map +1 -1
  24. package/build/JsonConfigComponent/ConfigSelectSendTo.js +1 -1
  25. package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
  26. package/build/JsonConfigComponent/ConfigState.js +1 -1
  27. package/build/JsonConfigComponent/ConfigState.js.map +1 -1
  28. package/build/JsonConfigComponent/ConfigTable.d.ts +5 -0
  29. package/build/JsonConfigComponent/ConfigTable.js +71 -7
  30. package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
  31. package/build/JsonConfigComponent/ConfigTabs.d.ts +3 -0
  32. package/build/JsonConfigComponent/ConfigTabs.js +42 -7
  33. package/build/JsonConfigComponent/ConfigTabs.js.map +1 -1
  34. package/build/JsonConfigComponent/wrapper/Components/CustomModal.js +4 -2
  35. package/build/JsonConfigComponent/wrapper/Components/CustomModal.js.map +1 -1
  36. package/build/JsonConfigComponent/wrapper/Components/Editor.d.ts +1 -1
  37. package/build/JsonConfigComponent/wrapper/Components/Editor.js +1 -1
  38. package/build/JsonConfigComponent/wrapper/Components/Editor.js.map +1 -1
  39. package/build/types.d.ts +15 -5
  40. package/package.json +3 -3
@@ -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,CAA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EAAE,GAAI;gBAC/C,IAAI,CAAC,mBAAmB,EAAE;gBAC1B,IAAI,CACN,CACN,CAAC;QACN,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;YAC3B,OAAO,CACH;gBACK,IAAI,CAAC,mBAAmB,EAAE;gBAC1B,IAAI,CACN,CACN,CAAC;QACN,CAAC;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 type IobTheme,\n} from '@iobroker/adapter-react-v5';\nimport type { ConfigIconType, ConfigItemAny, ConfigItemConfirmData, JsonConfigContext } from '../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 theme: IobTheme;\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 expertMode?: boolean;\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 style?: Record<string, any>;\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.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"]}
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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AAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CACH;gBACI,6BAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAI;gBAC/C,IAAI,CAAC,mBAAmB,EAAE;gBAC1B,IAAI,CACN,CACN,CAAC;QACN,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;YAC3B,OAAO,CACH;gBACK,IAAI,CAAC,mBAAmB,EAAE;gBAC1B,IAAI,CACN,CACN,CAAC;QACN,CAAC;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 type IobTheme,\n} from '@iobroker/adapter-react-v5';\nimport type { ConfigIconType, ConfigItemAny, ConfigItemConfirmData, JsonConfigContext } from '../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 theme: IobTheme;\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 expertMode?: boolean;\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 style?: Record<string, any>;\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') {\n // Handle both backslashes and quotes to ensure valid JSON\n if (value.includes('\\\\') || value.includes('\"')) {\n return `\\${${p1}.replace(/\\\\\\\\/g, '\\\\\\\\\\\\\\\\').replace(/\"/g, '\\\\\\\\\"')}`;\n }\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.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"]}
@@ -55,15 +55,23 @@ class ConfigJsonEditor extends ConfigGeneric {
55
55
  }
56
56
  const { schema, data, attr } = this.props;
57
57
  const { value, showSelectId } = this.state;
58
+ const isReadOnly = schema.readOnly === true;
58
59
  return (React.createElement(FormControl, { fullWidth: true, variant: "standard" },
59
60
  React.createElement("div", { style: styles.flex },
60
61
  React.createElement(Button, { color: "grey", disabled: disabled, style: styles.button, size: "small", variant: "outlined", onClick: () => this.setState({ showSelectId: true }) }, I18n.t('ra_JSON editor'))),
61
- showSelectId ? (React.createElement(CustomModal, { title: this.getText(schema.label), overflowHidden: true, applyDisabled: this.state.jsonError && this.props.schema.doNotApplyWithError, onClose: () => this.setState({ showSelectId: false, value: ConfigGeneric.getValue(data, attr) || {} }), onApply: () => this.setState({ showSelectId: false }, () => this.onChange(attr, value)) },
62
+ showSelectId ? (React.createElement(CustomModal, { title: this.getText(schema.label), overflowHidden: true, applyDisabled: (this.state.jsonError && this.props.schema.doNotApplyWithError) || isReadOnly, onClose: () => this.setState({ showSelectId: false, value: ConfigGeneric.getValue(data, attr) || {} }), onApply: isReadOnly
63
+ ? undefined
64
+ : () => this.setState({ showSelectId: false }, () => this.onChange(attr, value)) },
62
65
  React.createElement("div", { style: {
63
66
  ...styles.wrapper,
64
67
  border: this.state.jsonError ? '2px solid red' : '2px solid transparent',
65
68
  } },
66
- React.createElement(Editor, { mode: this.props.schema.json5 ? 'json5' : 'json', value: typeof value === 'object' ? JSON.stringify(value) : value, onChange: newValue => this.setState({ value: newValue, jsonError: this.validateJson(newValue) }), name: "ConfigJsonEditor", themeType: this.props.oContext.themeType })))) : null,
69
+ React.createElement(Editor, { mode: this.props.schema.json5 ? 'json5' : 'json', value: typeof value === 'object' ? JSON.stringify(value) : value, onChange: isReadOnly
70
+ ? undefined
71
+ : newValue => this.setState({
72
+ value: newValue,
73
+ jsonError: this.validateJson(newValue),
74
+ }), name: "ConfigJsonEditor", themeType: this.props.oContext.themeType })))) : null,
67
75
  schema.help || this.state.jsonError ? (React.createElement(FormHelperText, null, this.state.jsonError
68
76
  ? I18n.t('ra_Invalid JSON')
69
77
  : this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation))) : null));
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigJsonEditor.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigJsonEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,aAAmE,MAAM,iBAAiB,C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M,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACM,CACpB,CAAC,CAAC,CAAC,IAAI,CACE,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\nimport JSON5 from 'json5';\n\nimport { FormHelperText, FormControl, Button } from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemJsonEditor } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport CustomModal from './wrapper/Components/CustomModal';\nimport Editor from './wrapper/Components/Editor';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n },\n flex: {\n display: 'flex',\n },\n button: {\n height: 48,\n // marginLeft: 4,\n minWidth: 48,\n },\n wrapper: {\n width: 'calc(100vw - 40px)',\n height: 'calc(100vh - 188px)',\n },\n};\n\ninterface ConfigJsonEditorProps extends ConfigGenericProps {\n schema: ConfigItemJsonEditor;\n}\n\ninterface ConfigJsonEditorState extends ConfigGenericState {\n initialized?: boolean;\n showSelectId?: boolean;\n jsonError?: boolean;\n}\n\nclass ConfigJsonEditor extends ConfigGeneric<ConfigJsonEditorProps, ConfigJsonEditorState> {\n componentDidMount(): void {\n super.componentDidMount();\n const { data, attr } = this.props;\n const value: string = ConfigGeneric.getValue(data, attr) || '{}';\n this.setState({ value, initialized: true, jsonError: this.validateJson(value) });\n }\n\n validateJson(value: string | null | undefined): boolean {\n let jsonError = false;\n if (this.props.schema.validateJson !== false) {\n if (value || !this.props.schema.allowEmpty) {\n try {\n if (this.props.schema.json5) {\n JSON5.parse(value);\n } else {\n JSON.parse(value);\n }\n } catch (err: unknown) {\n console.log('Error in JSON', err);\n jsonError = true;\n }\n }\n }\n\n return jsonError;\n }\n\n renderItem(_error: string, disabled: boolean /* , defaultValue */): JSX.Element | null {\n if (!this.state.initialized) {\n return null;\n }\n\n const { schema, data, attr } = this.props;\n const { value, showSelectId } = this.state;\n\n return (\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n <div style={styles.flex}>\n <Button\n color=\"grey\"\n disabled={disabled}\n style={styles.button}\n size=\"small\"\n variant=\"outlined\"\n onClick={() => this.setState({ showSelectId: true })}\n >\n {I18n.t('ra_JSON editor')}\n </Button>\n </div>\n {showSelectId ? (\n <CustomModal\n title={this.getText(schema.label)}\n overflowHidden\n applyDisabled={this.state.jsonError && this.props.schema.doNotApplyWithError}\n onClose={() =>\n this.setState({ showSelectId: false, value: ConfigGeneric.getValue(data, attr) || {} })\n }\n onApply={() => this.setState({ showSelectId: false }, () => this.onChange(attr, value))}\n >\n <div\n style={{\n ...styles.wrapper,\n border: this.state.jsonError ? '2px solid red' : '2px solid transparent',\n }}\n >\n <Editor\n mode={this.props.schema.json5 ? 'json5' : 'json'}\n value={typeof value === 'object' ? JSON.stringify(value) : value}\n onChange={newValue =>\n this.setState({ value: newValue, jsonError: this.validateJson(newValue) })\n }\n name=\"ConfigJsonEditor\"\n themeType={this.props.oContext.themeType}\n />\n </div>\n </CustomModal>\n ) : null}\n {schema.help || this.state.jsonError ? (\n <FormHelperText>\n {this.state.jsonError\n ? I18n.t('ra_Invalid JSON')\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 ConfigJsonEditor;\n"]}
1
+ {"version":3,"file":"ConfigJsonEditor.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigJsonEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,IAAI,EAAE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,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CACnC,oBAAC,cAAc,QACV,IAAI,CAAC,KAAK,CAAC,SAAS;gBACjB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC;gBAC3B,CAAC,CAAC,IAAI,CAAC,UAAU,CACX,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACM,CACpB,CAAC,CAAC,CAAC,IAAI,CACE,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\nimport JSON5 from 'json5';\n\nimport { FormHelperText, FormControl, Button } from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemJsonEditor } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport CustomModal from './wrapper/Components/CustomModal';\nimport Editor from './wrapper/Components/Editor';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n },\n flex: {\n display: 'flex',\n },\n button: {\n height: 48,\n // marginLeft: 4,\n minWidth: 48,\n },\n wrapper: {\n width: 'calc(100vw - 40px)',\n height: 'calc(100vh - 188px)',\n },\n};\n\ninterface ConfigJsonEditorProps extends ConfigGenericProps {\n schema: ConfigItemJsonEditor;\n}\n\ninterface ConfigJsonEditorState extends ConfigGenericState {\n initialized?: boolean;\n showSelectId?: boolean;\n jsonError?: boolean;\n}\n\nclass ConfigJsonEditor extends ConfigGeneric<ConfigJsonEditorProps, ConfigJsonEditorState> {\n componentDidMount(): void {\n super.componentDidMount();\n const { data, attr } = this.props;\n const value: string = ConfigGeneric.getValue(data, attr) || '{}';\n this.setState({ value, initialized: true, jsonError: this.validateJson(value) });\n }\n\n validateJson(value: string | null | undefined): boolean {\n let jsonError = false;\n if (this.props.schema.validateJson !== false) {\n if (value || !this.props.schema.allowEmpty) {\n try {\n if (this.props.schema.json5) {\n JSON5.parse(value);\n } else {\n JSON.parse(value);\n }\n } catch (err: unknown) {\n console.log('Error in JSON', err);\n jsonError = true;\n }\n }\n }\n\n return jsonError;\n }\n\n renderItem(_error: string, disabled: boolean /* , defaultValue */): JSX.Element | null {\n if (!this.state.initialized) {\n return null;\n }\n\n const { schema, data, attr } = this.props;\n const { value, showSelectId } = this.state;\n const isReadOnly = schema.readOnly === true;\n\n return (\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n <div style={styles.flex}>\n <Button\n color=\"grey\"\n disabled={disabled}\n style={styles.button}\n size=\"small\"\n variant=\"outlined\"\n onClick={() => this.setState({ showSelectId: true })}\n >\n {I18n.t('ra_JSON editor')}\n </Button>\n </div>\n {showSelectId ? (\n <CustomModal\n title={this.getText(schema.label)}\n overflowHidden\n applyDisabled={(this.state.jsonError && this.props.schema.doNotApplyWithError) || isReadOnly}\n onClose={() =>\n this.setState({ showSelectId: false, value: ConfigGeneric.getValue(data, attr) || {} })\n }\n onApply={\n isReadOnly\n ? undefined\n : () => this.setState({ showSelectId: false }, () => this.onChange(attr, value))\n }\n >\n <div\n style={{\n ...styles.wrapper,\n border: this.state.jsonError ? '2px solid red' : '2px solid transparent',\n }}\n >\n <Editor\n mode={this.props.schema.json5 ? 'json5' : 'json'}\n value={typeof value === 'object' ? JSON.stringify(value) : value}\n onChange={\n isReadOnly\n ? undefined\n : newValue =>\n this.setState({\n value: newValue,\n jsonError: this.validateJson(newValue),\n })\n }\n name=\"ConfigJsonEditor\"\n themeType={this.props.oContext.themeType}\n />\n </div>\n </CustomModal>\n ) : null}\n {schema.help || this.state.jsonError ? (\n <FormHelperText>\n {this.state.jsonError\n ? I18n.t('ra_Invalid JSON')\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 ConfigJsonEditor;\n"]}
@@ -50,6 +50,10 @@ class ConfigNumber extends ConfigGeneric {
50
50
  return null;
51
51
  }
52
52
  value = value.toString().trim().replace(',', '.');
53
+ if (value === '-') {
54
+ // User wants to enter a negative number
55
+ return null;
56
+ }
53
57
  const f = value === '' ? 0 : parseFloat(value);
54
58
  if (value !== '' && Number.isNaN(f)) {
55
59
  return 'ra_Not a number';
@@ -116,6 +120,7 @@ class ConfigNumber extends ConfigGeneric {
116
120
  error = I18n.t(error);
117
121
  }
118
122
  }
123
+ const parsed = parseFloat(this.state._value?.toString().replace(',', '.') || '');
119
124
  return (React.createElement(FormControl, { variant: "standard", style: styles.control },
120
125
  React.createElement(TextField, { sx: {
121
126
  '& .up-down': {
@@ -124,9 +129,13 @@ class ConfigNumber extends ConfigGeneric {
124
129
  '&:hover .up-down': {
125
130
  display: 'block',
126
131
  },
127
- }, variant: "standard",
132
+ }, variant: "standard", type:
128
133
  // because some users want to enter "-" first
129
- type: this.props.schema.min !== undefined && this.props.schema.min >= 0 ? 'number' : 'text', fullWidth: true, slotProps: {
134
+ Number.isNaN(parsed)
135
+ ? 'text'
136
+ : this.props.schema.min !== undefined && this.props.schema.min >= 0
137
+ ? 'number'
138
+ : 'text', fullWidth: true, slotProps: {
130
139
  htmlInput: {
131
140
  min: this.props.schema.min,
132
141
  max: this.props.schema.max,
@@ -147,7 +156,15 @@ class ConfigNumber extends ConfigGeneric {
147
156
  else {
148
157
  this.onError(this.props.attr); // clear error
149
158
  }
150
- this.setState({ _value, oldValue: this.state._value }, () => this.onChange(this.props.attr, parseFloat(_value.replace(',', '.'))));
159
+ this.setState({ _value, oldValue: this.state._value }, () => {
160
+ const parsed = parseFloat(_value.toString().replace(',', '.'));
161
+ if (!Number.isNaN(parsed)) {
162
+ void this.onChange(this.props.attr, parsed);
163
+ }
164
+ else {
165
+ void this.onChange(this.props.attr, _value.toString().replace(',', '.'));
166
+ }
167
+ });
151
168
  }, placeholder: this.getText(this.props.schema.placeholder), label: this.getText(this.props.schema.label), helperText: error && typeof error === 'string'
152
169
  ? error
153
170
  : this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation) })));
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigNumber.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigNumber.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,aAAa,EAAE;QACX,OAAO,EAAE,GAAG;KACf;IACD,OAAO,EAAE;QACL,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,MAAM;KAChB;CACJ,CAAC;AAWF,MAAM,YAAa,SAAQ,aAAmD;IAClE,aAAa,CAAiC;IAEtD,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEtE,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1C,MAAM,GAAG,EAAE,CAAC;QAChB,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YACzD,MAAM,GAAG,aAAa,CAAC,eAAe,CAAC;YACvC,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;YAC5C,OAAO;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,E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C,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;oBAClD,CAAC;yBAAM,CAAC;wBACJ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;oBACjD,CAAC;oBAED,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CACxD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CACvE,CAAC;gBACN,CAAC,EACD,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EACxD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,UAAU,EACN,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;oBAC9B,CAAC,CAAC,KAAK;oBACP,CAAC,CAAC,IAAI,CAAC,UAAU,CACX,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,GAEb,CACQ,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,YAAY,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Autocomplete, TextField, FormControl } from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemNumber } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n indeterminate: {\n opacity: 0.5,\n },\n control: {\n flexDirection: 'row',\n width: '100%',\n },\n};\n\ninterface ConfigNumberProps extends ConfigGenericProps {\n schema: ConfigItemNumber;\n}\n\ninterface ConfigNumberState extends ConfigGenericState {\n _value: string;\n oldValue: string | null;\n}\n\nclass ConfigNumber extends ConfigGeneric<ConfigNumberProps, ConfigNumberState> {\n private updateTimeout?: ReturnType<typeof setTimeout>;\n\n componentDidMount(): void {\n super.componentDidMount();\n let _value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n if (_value === null || _value === undefined) {\n _value = '';\n }\n\n if (Array.isArray(_value) && this.props.oContext.multiEdit) {\n _value = ConfigGeneric.DIFFERENT_VALUE;\n this.setState({ _value, oldValue: _value });\n return;\n }\n\n this.setState({ _value: _value.toString(), oldValue: _value.toString() });\n }\n\n static getDerivedStateFromProps(\n props: ConfigNumberProps,\n state: ConfigNumberState,\n ): Partial<ConfigNumberState> | null {\n if (\n (props.schema.min !== undefined && props.schema.min < 0) ||\n (props.schema.max !== undefined && props.schema.max < 0)\n ) {\n return null;\n }\n const _value = ConfigGeneric.getValue(props.data, props.attr);\n\n if (props.oContext.multiEdit && state._value === ConfigGeneric.DIFFERENT_VALUE) {\n return { _value: ConfigGeneric.DIFFERENT_VALUE };\n }\n\n if (\n _value === null ||\n _value === undefined ||\n state.oldValue === null ||\n state.oldValue === undefined ||\n (_value.toString() !== parseFloat(state._value).toString() &&\n _value.toString() !== state.oldValue.toString())\n ) {\n return { _value };\n }\n\n return null;\n }\n\n checkValue(value: string): string | null {\n if (value === null || value === undefined) {\n return null;\n }\n value = value.toString().trim().replace(',', '.');\n const f = value === '' ? 0 : parseFloat(value);\n\n if (value !== '' && Number.isNaN(f)) {\n return 'ra_Not a number';\n }\n\n if (value !== '' && window.isFinite(f)) {\n if (this.props.schema.min !== undefined && f < this.props.schema.min) {\n return 'ra_Too small';\n }\n if (this.props.schema.max !== undefined && f > this.props.schema.max) {\n return 'ra_Too big';\n }\n if (value === '' || value === '-' || Number.isNaN(f)) {\n return 'ra_Not a number';\n }\n\n return null;\n }\n\n return 'ra_Not a number';\n }\n\n renderItem(error: unknown, disabled: boolean): JSX.Element | null {\n const isIndeterminate = Array.isArray(this.state._value) || this.state._value === ConfigGeneric.DIFFERENT_VALUE;\n\n if (this.state.oldValue !== null && this.state.oldValue !== undefined) {\n if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n }\n this.updateTimeout = setTimeout(() => {\n this.updateTimeout = undefined;\n this.setState({ oldValue: null });\n }, 30);\n } else if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n this.updateTimeout = undefined;\n }\n\n if (isIndeterminate) {\n const autoCompleteOptions = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const arr =\n autoCompleteOptions\n ?.filter((a: number | null | undefined) => a || a === 0)\n .map((item: number) => ({ label: item.toString(), value: item })) || [];\n\n arr.unshift({ label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE });\n\n return (\n <Autocomplete\n style={styles.indeterminate}\n fullWidth\n freeSolo\n value={arr[0]}\n // @ts-expect-error needs investigation if this really has no effect\n getOptionSelected={(option, value) => option.label === value.label}\n onChange={(_, value: (typeof arr)[number]) => {\n const mayBePromise = this.onChange(this.props.attr, value?.value, () => {\n this.setState({ _value: value?.value, oldValue: this.state._value });\n });\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n }}\n options={arr}\n getOptionLabel={(option: (typeof arr)[number]) => option.label}\n renderInput={params => (\n <TextField\n {...params}\n label={this.getText(this.props.schema.label)}\n variant=\"standard\"\n slotProps={{\n htmlInput: {\n ...params.inputProps,\n readOnly: this.props.schema.readOnly || false,\n },\n input: {\n endAdornment: this.props.schema.unit\n ? this.getText(this.props.schema.unit, this.props.schema.noTranslation)\n : undefined,\n },\n }}\n error={!!error}\n placeholder={this.getText(this.props.schema.placeholder)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n disabled={!!disabled}\n />\n )}\n />\n );\n }\n if (!error && this.state._value !== null && this.state._value !== undefined && this.state._value) {\n error = this.checkValue(this.state._value);\n if (error) {\n error = I18n.t(error as string);\n }\n }\n\n return (\n <FormControl\n variant=\"standard\"\n style={styles.control}\n >\n <TextField\n sx={{\n '& .up-down': {\n display: 'none',\n },\n '&:hover .up-down': {\n display: 'block',\n },\n }}\n variant=\"standard\"\n // because some users want to enter \"-\" first\n type={this.props.schema.min !== undefined && this.props.schema.min >= 0 ? 'number' : 'text'}\n fullWidth\n slotProps={{\n htmlInput: {\n min: this.props.schema.min,\n max: this.props.schema.max,\n step: this.props.schema.step,\n readOnly: this.props.schema.readOnly || false,\n },\n input: {\n endAdornment: this.props.schema.unit\n ? this.getText(this.props.schema.unit, this.props.schema.noTranslation)\n : null,\n },\n }}\n value={this.state._value === null || this.state._value === undefined ? '' : this.state._value}\n error={!!error}\n disabled={!!disabled}\n onChange={e => {\n const _value = e.target.value; // value is always a string and it is validly formatted\n const _error = this.checkValue(_value);\n if (_error) {\n this.onError(this.props.attr, I18n.t(_error));\n } else {\n this.onError(this.props.attr); // clear error\n }\n\n this.setState({ _value, oldValue: this.state._value }, () =>\n this.onChange(this.props.attr, parseFloat(_value.replace(',', '.'))),\n );\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={\n error && typeof error === 'string'\n ? error\n : this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )\n }\n />\n </FormControl>\n );\n }\n}\n\nexport default ConfigNumber;\n"]}
1
+ {"version":3,"file":"ConfigNumber.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigNumber.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBA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plete, TextField, FormControl } from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemNumber } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n indeterminate: {\n opacity: 0.5,\n },\n control: {\n flexDirection: 'row',\n width: '100%',\n },\n};\n\ninterface ConfigNumberProps extends ConfigGenericProps {\n schema: ConfigItemNumber;\n}\n\ninterface ConfigNumberState extends ConfigGenericState {\n _value: string;\n oldValue: string | null;\n}\n\nclass ConfigNumber extends ConfigGeneric<ConfigNumberProps, ConfigNumberState> {\n private updateTimeout?: ReturnType<typeof setTimeout>;\n\n componentDidMount(): void {\n super.componentDidMount();\n let _value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n if (_value === null || _value === undefined) {\n _value = '';\n }\n\n if (Array.isArray(_value) && this.props.oContext.multiEdit) {\n _value = ConfigGeneric.DIFFERENT_VALUE;\n this.setState({ _value, oldValue: _value });\n return;\n }\n\n this.setState({ _value: _value.toString(), oldValue: _value.toString() });\n }\n\n static getDerivedStateFromProps(\n props: ConfigNumberProps,\n state: ConfigNumberState,\n ): Partial<ConfigNumberState> | null {\n if (\n (props.schema.min !== undefined && props.schema.min < 0) ||\n (props.schema.max !== undefined && props.schema.max < 0)\n ) {\n return null;\n }\n const _value = ConfigGeneric.getValue(props.data, props.attr);\n\n if (props.oContext.multiEdit && state._value === ConfigGeneric.DIFFERENT_VALUE) {\n return { _value: ConfigGeneric.DIFFERENT_VALUE };\n }\n\n if (\n _value === null ||\n _value === undefined ||\n state.oldValue === null ||\n state.oldValue === undefined ||\n (_value.toString() !== parseFloat(state._value).toString() &&\n _value.toString() !== state.oldValue.toString())\n ) {\n return { _value };\n }\n\n return null;\n }\n\n checkValue(value: string): string | null {\n if (value === null || value === undefined) {\n return null;\n }\n value = value.toString().trim().replace(',', '.');\n if (value === '-') {\n // User wants to enter a negative number\n return null;\n }\n\n const f = value === '' ? 0 : parseFloat(value);\n\n if (value !== '' && Number.isNaN(f)) {\n return 'ra_Not a number';\n }\n\n if (value !== '' && window.isFinite(f)) {\n if (this.props.schema.min !== undefined && f < this.props.schema.min) {\n return 'ra_Too small';\n }\n if (this.props.schema.max !== undefined && f > this.props.schema.max) {\n return 'ra_Too big';\n }\n if (value === '' || value === '-' || Number.isNaN(f)) {\n return 'ra_Not a number';\n }\n\n return null;\n }\n\n return 'ra_Not a number';\n }\n\n renderItem(error: unknown, disabled: boolean): JSX.Element | null {\n const isIndeterminate = Array.isArray(this.state._value) || this.state._value === ConfigGeneric.DIFFERENT_VALUE;\n\n if (this.state.oldValue !== null && this.state.oldValue !== undefined) {\n if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n }\n this.updateTimeout = setTimeout(() => {\n this.updateTimeout = undefined;\n this.setState({ oldValue: null });\n }, 30);\n } else if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n this.updateTimeout = undefined;\n }\n\n if (isIndeterminate) {\n const autoCompleteOptions = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const arr =\n autoCompleteOptions\n ?.filter((a: number | null | undefined) => a || a === 0)\n .map((item: number) => ({ label: item.toString(), value: item })) || [];\n\n arr.unshift({ label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE });\n\n return (\n <Autocomplete\n style={styles.indeterminate}\n fullWidth\n freeSolo\n value={arr[0]}\n // @ts-expect-error needs investigation if this really has no effect\n getOptionSelected={(option, value) => option.label === value.label}\n onChange={(_, value: (typeof arr)[number]) => {\n const mayBePromise = this.onChange(this.props.attr, value?.value, () => {\n this.setState({ _value: value?.value, oldValue: this.state._value });\n });\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n }}\n options={arr}\n getOptionLabel={(option: (typeof arr)[number]) => option.label}\n renderInput={params => (\n <TextField\n {...params}\n label={this.getText(this.props.schema.label)}\n variant=\"standard\"\n slotProps={{\n htmlInput: {\n ...params.inputProps,\n readOnly: this.props.schema.readOnly || false,\n },\n input: {\n endAdornment: this.props.schema.unit\n ? this.getText(this.props.schema.unit, this.props.schema.noTranslation)\n : undefined,\n },\n }}\n error={!!error}\n placeholder={this.getText(this.props.schema.placeholder)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n disabled={!!disabled}\n />\n )}\n />\n );\n }\n if (!error && this.state._value !== null && this.state._value !== undefined && this.state._value) {\n error = this.checkValue(this.state._value);\n if (error) {\n error = I18n.t(error as string);\n }\n }\n const parsed = parseFloat(this.state._value?.toString().replace(',', '.') || '');\n\n return (\n <FormControl\n variant=\"standard\"\n style={styles.control}\n >\n <TextField\n sx={{\n '& .up-down': {\n display: 'none',\n },\n '&:hover .up-down': {\n display: 'block',\n },\n }}\n variant=\"standard\"\n type={\n // because some users want to enter \"-\" first\n Number.isNaN(parsed)\n ? 'text'\n : this.props.schema.min !== undefined && this.props.schema.min >= 0\n ? 'number'\n : 'text'\n }\n fullWidth\n slotProps={{\n htmlInput: {\n min: this.props.schema.min,\n max: this.props.schema.max,\n step: this.props.schema.step,\n readOnly: this.props.schema.readOnly || false,\n },\n input: {\n endAdornment: this.props.schema.unit\n ? this.getText(this.props.schema.unit, this.props.schema.noTranslation)\n : null,\n },\n }}\n value={this.state._value === null || this.state._value === undefined ? '' : this.state._value}\n error={!!error}\n disabled={!!disabled}\n onChange={e => {\n const _value = e.target.value; // value is always a string and it is validly formatted\n const _error = this.checkValue(_value);\n if (_error) {\n this.onError(this.props.attr, I18n.t(_error));\n } else {\n this.onError(this.props.attr); // clear error\n }\n\n this.setState({ _value, oldValue: this.state._value }, () => {\n const parsed = parseFloat(_value.toString().replace(',', '.'));\n if (!Number.isNaN(parsed)) {\n void this.onChange(this.props.attr, parsed);\n } else {\n void this.onChange(this.props.attr, _value.toString().replace(',', '.'));\n }\n });\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={\n error && typeof error === 'string'\n ? error\n : this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )\n }\n />\n </FormControl>\n );\n }\n}\n\nexport default ConfigNumber;\n"]}