@iobroker/json-config 7.5.2 → 7.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -5
- package/build/JsonConfig.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertCollection.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertificates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
- package/build/JsonConfigComponent/ConfigChip.js.map +1 -1
- package/build/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCustom.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigCustom.js +35 -76
- package/build/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigDeviceManager.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInterface.js.map +1 -1
- package/build/JsonConfigComponent/ConfigJsonEditor.js +14 -5
- package/build/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPort.js.map +1 -1
- package/build/JsonConfigComponent/ConfigQrCode.js.map +1 -1
- package/build/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSlider.js.map +1 -1
- package/build/JsonConfigComponent/ConfigState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticInfo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/build/JsonConfigComponent/ConfigText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTopic.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUUID.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/build/JsonConfigComponent/index.d.ts +2 -2
- package/build/JsonConfigComponent/index.js.map +1 -1
- package/build/JsonConfigComponent/wrapper/Components/Editor.d.ts +2 -1
- package/build/JsonConfigComponent/wrapper/Components/Editor.js +1 -0
- package/build/JsonConfigComponent/wrapper/Components/Editor.js.map +1 -1
- package/build/types.d.ts +7 -1
- package/package.json +8 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigTabs.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,GAAwC;IAChD,IAAI,EAAE;QACF,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KAChB;IACD,KAAK,EAAE;QACH,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,OAAO;KACnB;IACD,cAAc,EAAE;QACZ,MAAM,EAAE,mBAAmB;KAC9B;IACD,iBAAiB,EAAE;QACf,MAAM,EAAE,mBAAmB;KAC9B;CACJ,CAAC;AAcF,MAAM,UAAW,SAAQ,aAA+C;IAC5D,aAAa,GAAyC,IAAI,CAAC;IAElD,MAAM,CAAkC;IAEzD,YAAY,KAAsB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,GAAuB,CAAC;QAE5B,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAClB,0BAA0B;YAC1B,kEAAkE;YAClE,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,IAAI,E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Toolbar, Menu, MenuItem, ListItemIcon } from '@mui/material';\nimport { Menu as MenuIcon } from '@mui/icons-material';\n\nimport type { ConfigItemTabs } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport ConfigPanel from './ConfigPanel';\n\nconst styles: Record<string, React.CSSProperties> = {\n tabs: {\n height: '100%',\n width: '100%',\n },\n panel: {\n width: '100%',\n display: 'block',\n },\n panelWithIcons: {\n height: 'calc(100% - 72px)',\n },\n panelWithoutIcons: {\n height: 'calc(100% - 48px)',\n },\n};\n\ninterface ConfigTabsProps extends ConfigGenericProps {\n schema: ConfigItemTabs;\n dialogName?: string;\n}\n\ninterface ConfigTabsState extends ConfigGenericState {\n tab?: string;\n width: number;\n openMenu: HTMLButtonElement | null;\n initialBreakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n}\n\nclass ConfigTabs extends ConfigGeneric<ConfigTabsProps, ConfigTabsState> {\n private resizeTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private readonly refDiv: React.RefObject<HTMLDivElement>;\n\n constructor(props: ConfigTabsProps) {\n super(props);\n let tab: string | undefined;\n\n if (this.props.root) {\n // read the path from hash\n // #tab-instances/config/system.adapter.ping.0/<TAB-NAME-OR-INDEX>\n const hash = (window.location.hash || '').replace(/^#/, '').split('/');\n if (hash.length >= 3 && hash[1] === 'config') {\n const tabS = hash[3];\n const tabN = parseInt(tabS, 10);\n if (tabS && tabN.toString() === tabS) {\n if (tabN >= 0 && tabN < Object.keys(this.props.schema.items).length) {\n tab = Object.keys(this.props.schema.items)[tabN];\n }\n } else if (tabS && Object.keys(this.props.schema.items).includes(tabS)) {\n tab = tabS;\n }\n\n // install on hash change handler\n window.addEventListener('hashchange', this.onHashTabsChanged, false);\n }\n }\n\n if (tab === undefined) {\n tab =\n (((window as any)._localStorage as Storage) || window.localStorage).getItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n ) || Object.keys(this.props.schema.items)[0];\n if (!Object.keys(this.props.schema.items).includes(tab)) {\n tab = Object.keys(this.props.schema.items)[0];\n }\n }\n this.refDiv = React.createRef();\n\n Object.assign(this.state, { tab, width: 0, openMenu: null });\n }\n\n componentWillUnmount(): void {\n if (this.resizeTimeout) {\n clearTimeout(this.resizeTimeout);\n this.resizeTimeout = null;\n }\n window.removeEventListener('hashchange', this.onHashTabsChanged, false);\n super.componentWillUnmount();\n }\n\n onHashTabsChanged = (): void => {\n const hash = (window.location.hash || '').replace(/^#/, '').split('/');\n if (hash.length > 3 && hash[1] === 'config') {\n const tabS = hash[3];\n const tabN = parseInt(tabS, 10);\n let tab;\n if (tabN.toString() === tabS) {\n if (tabN >= 0 && tabN < Object.keys(this.props.schema.items).length) {\n tab = Object.keys(this.props.schema.items)[tabN];\n }\n } else if (Object.keys(this.props.schema.items).includes(tabS)) {\n tab = tabS;\n }\n if (tab !== undefined && tab !== this.state.tab) {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n tab,\n );\n this.setState({ tab });\n }\n }\n };\n\n getCurrentBreakpoint(): 'xs' | 'sm' | 'md' | 'lg' | 'xl' {\n if (!this.state.width) {\n return 'md';\n }\n if (!this.state.initialBreakpoint) {\n let initialBreakpoint: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n if (this.state.width < 600) {\n initialBreakpoint = 'xs';\n } else if (this.state.width < 900) {\n initialBreakpoint = 'sm';\n } else if (this.state.width < 1200) {\n initialBreakpoint = 'md';\n } else if (this.state.width < 1536) {\n initialBreakpoint = 'lg';\n } else {\n initialBreakpoint = 'xl';\n }\n // Remember initial breakpoint and do not change it anymore\n setTimeout(() => {\n this.setState({ initialBreakpoint });\n }, 50);\n\n return initialBreakpoint;\n }\n\n return this.state.initialBreakpoint;\n }\n\n componentDidUpdate(): void {\n if (\n !this.state.initialBreakpoint &&\n this.refDiv.current?.clientWidth &&\n this.refDiv.current.clientWidth !== this.state.width\n ) {\n if (this.resizeTimeout) {\n clearTimeout(this.resizeTimeout);\n }\n this.resizeTimeout = setTimeout(() => {\n this.resizeTimeout = null;\n this.setState({ width: this.refDiv.current?.clientWidth });\n }, 50);\n }\n }\n\n onMenuChange(tab: string): void {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n tab,\n );\n this.setState({ tab }, () => {\n if (this.props.root) {\n const hash = (window.location.hash || '').split('/');\n if (hash.length >= 3 && hash[1] === 'config') {\n hash[3] = this.state.tab;\n window.location.hash = hash.join('/');\n }\n }\n });\n }\n\n render(): JSX.Element {\n const items = this.props.schema.items;\n let withIcons = false;\n const elements: { icon: React.JSX.Element | null; label: string; name: string; disabled: boolean }[] = [];\n\n Object.keys(items).map(name => {\n let disabled: boolean;\n if (this.props.custom) {\n const hidden = this.executeCustom(\n items[name].hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.index,\n this.props.globalData,\n );\n if (hidden) {\n return;\n }\n disabled = this.executeCustom(\n items[name].disabled,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.index,\n this.props.globalData,\n ) as boolean;\n } else {\n const hidden: boolean = this.execute(\n items[name].hidden,\n false,\n this.props.data,\n this.props.index,\n this.props.globalData,\n ) as boolean;\n if (hidden) {\n return;\n }\n disabled = this.execute(\n items[name].disabled,\n false,\n this.props.data,\n this.props.index,\n this.props.globalData,\n ) as boolean;\n }\n const icon = this.getIcon(items[name].icon);\n withIcons = withIcons || !!icon;\n elements.push({ icon, disabled, label: this.getText(items[name].label), name });\n });\n\n const currentBreakpoint = this.getCurrentBreakpoint();\n let tabs: React.JSX.Element;\n if (currentBreakpoint === 'xs' && elements.length > 2) {\n tabs = (\n <Toolbar\n style={{\n top: 2,\n backgroundColor: this.props.oContext.themeType === 'dark' ? '#222' : '#DDD',\n }}\n variant=\"dense\"\n >\n <IconButton\n onClick={(event: React.MouseEvent<HTMLButtonElement>) =>\n this.setState({ openMenu: event.currentTarget })\n }\n >\n <MenuIcon />\n </IconButton>\n {this.state.openMenu ? (\n <Menu\n open={!0}\n anchorEl={this.state.openMenu}\n onClose={() => this.setState({ openMenu: null })}\n >\n {elements.map(el => {\n return (\n <MenuItem\n disabled={el.disabled}\n key={el.name}\n onClick={() => {\n this.setState({ openMenu: null }, () => this.onMenuChange(el.name));\n }}\n selected={el.name === this.state.tab}\n >\n {withIcons ? <ListItemIcon>{el.icon}</ListItemIcon> : null}\n {el.label}\n </MenuItem>\n );\n })}\n </Menu>\n ) : null}\n </Toolbar>\n );\n } else {\n tabs = (\n <Tabs\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n style={this.props.schema.tabsStyle}\n value={this.state.tab}\n onChange={(_e, tab: string): void => this.onMenuChange(tab)}\n >\n {elements.map(el => {\n return (\n <Tab\n id={el.name}\n wrapped\n disabled={el.disabled}\n key={el.name}\n value={el.name}\n iconPosition={this.props.schema.iconPosition || 'start'}\n icon={el.icon}\n label={el.label}\n />\n );\n })}\n </Tabs>\n );\n }\n\n return (\n <div\n style={styles.tabs}\n ref={this.refDiv}\n >\n {tabs}\n <ConfigPanel\n oContext={this.props.oContext}\n isParentTab\n changed={this.props.changed}\n key={this.state.tab}\n index={1001}\n arrayIndex={this.props.arrayIndex}\n globalData={this.props.globalData}\n commandRunning={this.props.commandRunning}\n style={{\n ...styles.panel,\n ...(withIcons ? styles.panelWithIcons : styles.panelWithoutIcons),\n }}\n common={this.props.common}\n alive={this.props.alive}\n themeName={this.props.themeName}\n data={this.props.data}\n originalData={this.props.originalData}\n onChange={this.props.onChange}\n onError={this.props.onError}\n customObj={this.props.customObj}\n custom={this.props.custom}\n schema={items[this.state.tab]}\n table={this.props.table}\n withIcons={withIcons}\n />\n </div>\n );\n }\n}\n\nexport default ConfigTabs;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigTabs.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigTabs.tsx"],"names":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C,UAAU,EACjC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EACzC,KAAK,EAAE;oBACH,GAAG,MAAM,CAAC,KAAK;oBACf,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC;iBACpE,EACD,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACrB,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EACrC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAC7B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,SAAS,EAAE,SAAS,GACtB,CACA,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Tabs, Tab, IconButton, Toolbar, Menu, MenuItem, ListItemIcon } from '@mui/material';\nimport { Menu as MenuIcon } from '@mui/icons-material';\n\nimport type { ConfigItemTabs } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport ConfigPanel from './ConfigPanel';\n\nconst styles: Record<string, React.CSSProperties> = {\n tabs: {\n height: '100%',\n width: '100%',\n },\n panel: {\n width: '100%',\n display: 'block',\n },\n panelWithIcons: {\n height: 'calc(100% - 72px)',\n },\n panelWithoutIcons: {\n height: 'calc(100% - 48px)',\n },\n};\n\ninterface ConfigTabsProps extends ConfigGenericProps {\n schema: ConfigItemTabs;\n dialogName?: string;\n}\n\ninterface ConfigTabsState extends ConfigGenericState {\n tab?: string;\n width: number;\n openMenu: HTMLButtonElement | null;\n initialBreakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n}\n\nclass ConfigTabs extends ConfigGeneric<ConfigTabsProps, ConfigTabsState> {\n private resizeTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private readonly refDiv: React.RefObject<HTMLDivElement>;\n\n constructor(props: ConfigTabsProps) {\n super(props);\n let tab: string | undefined;\n\n if (this.props.root) {\n // read the path from hash\n // #tab-instances/config/system.adapter.ping.0/<TAB-NAME-OR-INDEX>\n const hash = (window.location.hash || '').replace(/^#/, '').split('/');\n if (hash.length >= 3 && hash[1] === 'config') {\n const tabS = hash[3];\n const tabN = parseInt(tabS, 10);\n if (tabS && tabN.toString() === tabS) {\n if (tabN >= 0 && tabN < Object.keys(this.props.schema.items).length) {\n tab = Object.keys(this.props.schema.items)[tabN];\n }\n } else if (tabS && Object.keys(this.props.schema.items).includes(tabS)) {\n tab = tabS;\n }\n\n // install on hash change handler\n window.addEventListener('hashchange', this.onHashTabsChanged, false);\n }\n }\n\n if (tab === undefined) {\n tab =\n (((window as any)._localStorage as Storage) || window.localStorage).getItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n ) || Object.keys(this.props.schema.items)[0];\n if (!Object.keys(this.props.schema.items).includes(tab)) {\n tab = Object.keys(this.props.schema.items)[0];\n }\n }\n this.refDiv = React.createRef();\n\n Object.assign(this.state, { tab, width: 0, openMenu: null });\n }\n\n componentWillUnmount(): void {\n if (this.resizeTimeout) {\n clearTimeout(this.resizeTimeout);\n this.resizeTimeout = null;\n }\n window.removeEventListener('hashchange', this.onHashTabsChanged, false);\n super.componentWillUnmount();\n }\n\n onHashTabsChanged = (): void => {\n const hash = (window.location.hash || '').replace(/^#/, '').split('/');\n if (hash.length > 3 && hash[1] === 'config') {\n const tabS = hash[3];\n const tabN = parseInt(tabS, 10);\n let tab;\n if (tabN.toString() === tabS) {\n if (tabN >= 0 && tabN < Object.keys(this.props.schema.items).length) {\n tab = Object.keys(this.props.schema.items)[tabN];\n }\n } else if (Object.keys(this.props.schema.items).includes(tabS)) {\n tab = tabS;\n }\n if (tab !== undefined && tab !== this.state.tab) {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n tab,\n );\n this.setState({ tab });\n }\n }\n };\n\n getCurrentBreakpoint(): 'xs' | 'sm' | 'md' | 'lg' | 'xl' {\n if (!this.state.width) {\n return 'md';\n }\n if (!this.state.initialBreakpoint) {\n let initialBreakpoint: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n if (this.state.width < 600) {\n initialBreakpoint = 'xs';\n } else if (this.state.width < 900) {\n initialBreakpoint = 'sm';\n } else if (this.state.width < 1200) {\n initialBreakpoint = 'md';\n } else if (this.state.width < 1536) {\n initialBreakpoint = 'lg';\n } else {\n initialBreakpoint = 'xl';\n }\n // Remember initial breakpoint and do not change it anymore\n setTimeout(() => {\n this.setState({ initialBreakpoint });\n }, 50);\n\n return initialBreakpoint;\n }\n\n return this.state.initialBreakpoint;\n }\n\n componentDidUpdate(): void {\n if (\n !this.state.initialBreakpoint &&\n this.refDiv.current?.clientWidth &&\n this.refDiv.current.clientWidth !== this.state.width\n ) {\n if (this.resizeTimeout) {\n clearTimeout(this.resizeTimeout);\n }\n this.resizeTimeout = setTimeout(() => {\n this.resizeTimeout = null;\n this.setState({ width: this.refDiv.current?.clientWidth });\n }, 50);\n }\n }\n\n onMenuChange(tab: string): void {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n tab,\n );\n this.setState({ tab }, () => {\n if (this.props.root) {\n const hash = (window.location.hash || '').split('/');\n if (hash.length >= 3 && hash[1] === 'config') {\n hash[3] = this.state.tab;\n window.location.hash = hash.join('/');\n }\n }\n });\n }\n\n render(): JSX.Element {\n const items = this.props.schema.items;\n let withIcons = false;\n const elements: { icon: React.JSX.Element | null; label: string; name: string; disabled: boolean }[] = [];\n\n Object.keys(items).map(name => {\n let disabled: boolean;\n if (this.props.custom) {\n const hidden = this.executeCustom(\n items[name].hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.index,\n this.props.globalData,\n );\n if (hidden) {\n return;\n }\n disabled = this.executeCustom(\n items[name].disabled,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.index,\n this.props.globalData,\n ) as boolean;\n } else {\n const hidden: boolean = this.execute(\n items[name].hidden,\n false,\n this.props.data,\n this.props.index,\n this.props.globalData,\n ) as boolean;\n if (hidden) {\n return;\n }\n disabled = this.execute(\n items[name].disabled,\n false,\n this.props.data,\n this.props.index,\n this.props.globalData,\n ) as boolean;\n }\n const icon = this.getIcon(items[name].icon);\n withIcons = withIcons || !!icon;\n elements.push({ icon, disabled, label: this.getText(items[name].label), name });\n });\n\n const currentBreakpoint = this.getCurrentBreakpoint();\n let tabs: React.JSX.Element;\n if (currentBreakpoint === 'xs' && elements.length > 2) {\n tabs = (\n <Toolbar\n style={{\n top: 2,\n backgroundColor: this.props.oContext.themeType === 'dark' ? '#222' : '#DDD',\n }}\n variant=\"dense\"\n >\n <IconButton\n onClick={(event: React.MouseEvent<HTMLButtonElement>) =>\n this.setState({ openMenu: event.currentTarget })\n }\n >\n <MenuIcon />\n </IconButton>\n {this.state.openMenu ? (\n <Menu\n open={!0}\n anchorEl={this.state.openMenu}\n onClose={() => this.setState({ openMenu: null })}\n >\n {elements.map(el => {\n return (\n <MenuItem\n disabled={el.disabled}\n key={el.name}\n onClick={() => {\n this.setState({ openMenu: null }, () => this.onMenuChange(el.name));\n }}\n selected={el.name === this.state.tab}\n >\n {withIcons ? <ListItemIcon>{el.icon}</ListItemIcon> : null}\n {el.label}\n </MenuItem>\n );\n })}\n </Menu>\n ) : null}\n </Toolbar>\n );\n } else {\n tabs = (\n <Tabs\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n style={this.props.schema.tabsStyle}\n value={this.state.tab}\n onChange={(_e, tab: string): void => this.onMenuChange(tab)}\n >\n {elements.map(el => {\n return (\n <Tab\n id={el.name}\n wrapped\n disabled={el.disabled}\n key={el.name}\n value={el.name}\n iconPosition={this.props.schema.iconPosition || 'start'}\n icon={el.icon}\n label={el.label}\n />\n );\n })}\n </Tabs>\n );\n }\n\n return (\n <div\n style={styles.tabs}\n ref={this.refDiv}\n >\n {tabs}\n <ConfigPanel\n oContext={this.props.oContext}\n isParentTab\n changed={this.props.changed}\n key={this.state.tab}\n index={1001}\n arrayIndex={this.props.arrayIndex}\n globalData={this.props.globalData}\n commandRunning={this.props.commandRunning}\n style={{\n ...styles.panel,\n ...(withIcons ? styles.panelWithIcons : styles.panelWithoutIcons),\n }}\n common={this.props.common}\n alive={this.props.alive}\n themeName={this.props.themeName}\n data={this.props.data}\n originalData={this.props.originalData}\n onChange={this.props.onChange}\n onError={this.props.onError}\n customObj={this.props.customObj}\n custom={this.props.custom}\n schema={items[this.state.tab]}\n table={this.props.table}\n withIcons={withIcons}\n />\n </div>\n );\n }\n}\n\nexport default ConfigTabs;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigText.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,aAAmE,MAA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'react';\n\nimport { Autocomplete, TextField, TextareaAutosize, InputAdornment, IconButton } from '@mui/material';\n\nimport { Close as CloseIcon } from '@mui/icons-material';\n\nimport { I18n, IconCopy, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemText } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n indeterminate: {\n opacity: 0.5,\n },\n label: {\n width: '100%',\n fontSize: 14,\n marginBottom: 2,\n },\n helper: {\n width: '100%',\n fontSize: 12,\n },\n error: {\n width: '100%',\n fontSize: 12,\n color: '#FF0000',\n },\n};\n\ninterface ConfigTextProps extends ConfigGenericProps {\n schema: ConfigItemText;\n}\n\ninterface ConfigTextState extends ConfigGenericState {\n oldValue?: string;\n jsonError?: boolean;\n}\n\nclass ConfigText extends ConfigGeneric<ConfigTextProps, ConfigTextState> {\n private updateTimeout: ReturnType<typeof setTimeout> | null = null;\n\n componentDidMount(): void {\n super.componentDidMount();\n let value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n if (Array.isArray(value) && this.props.oContext.multiEdit) {\n value = ConfigGeneric.DIFFERENT_VALUE;\n this.setState({ value, oldValue: value, jsonError: false });\n return;\n }\n\n this.setState({ value, oldValue: value, jsonError: this.validateJson(value) });\n }\n\n validateJson(value: string | null | undefined): boolean {\n let jsonError = false;\n if (this.props.schema.validateJson) {\n if (value || !this.props.schema.allowEmpty) {\n try {\n JSON.parse(value);\n } catch (err: unknown) {\n console.log('Error in JSON', err);\n jsonError = true;\n }\n }\n }\n\n return jsonError;\n }\n\n static getDerivedStateFromProps(props: ConfigTextProps, state: ConfigTextState): Partial<ConfigTextState> | null {\n if (props.oContext.multiEdit && state.value === ConfigGeneric.DIFFERENT_VALUE) {\n return { value: ConfigGeneric.DIFFERENT_VALUE };\n }\n\n let value = ConfigGeneric.getValue(props.data, props.attr);\n\n if (value !== null && value !== undefined) {\n value = value.toString();\n }\n\n if (value === null || value === undefined || (value !== state.value && value !== state.oldValue)) {\n return { value };\n }\n return null;\n }\n\n renderItem(error?: boolean, disabled?: boolean): JSX.Element {\n const isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric.DIFFERENT_VALUE;\n\n if (this.props.schema.time) {\n // show read-only time\n\n let time = '';\n if (typeof this.state.value === 'number') {\n // If the value is a number, it is a timestamp.\n if (this.state.value && this.state.value < 946659600000) {\n // If the value is less than 2000-01-01, it is a timestamp in seconds.\n time = new Date(this.state.value * 1000).toLocaleString();\n } else {\n time = new Date(this.state.value).toLocaleString();\n }\n } else if (typeof this.state.value === 'string') {\n // If the value is a string, it is a date string.\n time = new Date(this.state.value).toLocaleString();\n }\n\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={time}\n error={!!error || !!this.state.jsonError}\n disabled={!!disabled}\n slotProps={{\n htmlInput: {\n readOnly: true,\n },\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\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 = null;\n this.setState({ oldValue: null });\n }, 30);\n } else if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n this.updateTimeout = null;\n }\n\n if (isIndeterminate) {\n const autoCompleteOptions = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const arr =\n autoCompleteOptions\n ?.filter((a: any) => a || a === 0)\n .map((item: any) => ({ 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 value={arr[0]}\n // getOptionSelected={(option, value) => option.label === value.label}\n onChange={(_, value) => {\n const val = value ? value.value : '';\n const mayBePromise = this.onChange(this.props.attr, val, () => {\n this.setState({ value: val, oldValue: val, jsonError: this.validateJson(value) });\n });\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n options={arr}\n getOptionLabel={option => option.label}\n renderInput={params => (\n <TextField\n variant=\"standard\"\n {...params}\n error={!!error}\n placeholder={this.getText(this.props.schema.placeholder)}\n slotProps={{\n htmlInput: {\n ...params.inputProps,\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.props.schema.readOnly || false,\n },\n }}\n label={this.getText(this.props.schema.label)}\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\n let actionButton: React.JSX.Element | undefined;\n let actionButtonStyle: React.CSSProperties | undefined;\n if ((this.props.schema.readOnly || disabled) && this.props.schema.copyToClipboard) {\n if (this.props.schema.minRows > 1) {\n actionButtonStyle = {\n position: 'absolute',\n right: 3,\n top: 20,\n zIndex: 1000,\n };\n }\n actionButton = (\n <IconButton\n style={actionButtonStyle}\n size=\"small\"\n onClick={() => {\n Utils.copyToClipboard(this.state.value);\n window.alert(I18n.t('ra_Copied'));\n }}\n >\n <IconCopy />\n </IconButton>\n );\n } else if (!this.props.schema.readOnly && !disabled && this.state.value && !this.props.schema.noClearButton) {\n if (this.props.schema.minRows > 1) {\n actionButtonStyle = {\n position: 'absolute',\n right: 3,\n top: 20,\n zIndex: 1000,\n };\n }\n actionButton = (\n <IconButton\n style={actionButtonStyle}\n size=\"small\"\n onClick={() =>\n this.setState({ value: '', oldValue: this.state.value }, () =>\n this.onChange(this.props.attr, ''),\n )\n }\n >\n <CloseIcon />\n </IconButton>\n );\n if (this.props.schema.minRows <= 1) {\n actionButton = <InputAdornment position=\"end\">{actionButton}</InputAdornment>;\n }\n }\n\n if (this.props.schema.minRows > 1) {\n const helper = this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n );\n return (\n <div style={{ width: '100%', position: 'relative' }}>\n {this.props.schema.label ? (\n <div style={styles.label}>{this.getText(this.props.schema.label)}</div>\n ) : null}\n <TextareaAutosize\n // variant=\"standard\"\n style={{\n width: '100%',\n resize: 'vertical',\n backgroundColor: this.props.oContext.themeType === 'dark' ? '#363636' : '#cccccc',\n color: this.props.oContext.themeType === 'dark' ? '#fff' : '#111',\n }}\n minRows={this.props.schema.minRows}\n maxRows={this.props.schema.maxRows}\n value={this.state.value === null || this.state.value === undefined ? '' : this.state.value}\n disabled={!!disabled}\n readOnly={this.props.schema.readOnly || false}\n onChange={e => {\n const value = e.target.value;\n this.setState(\n { value, oldValue: this.state.value, jsonError: this.validateJson(value) },\n () => this.onChange(this.props.attr, value || ''),\n );\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n />\n {helper || error || this.state.jsonError ? (\n <div style={error ? styles.error : styles.helper}>\n {error || (this.state.jsonError ? I18n.t('ra_Invalid JSON') : helper)}\n </div>\n ) : null}\n </div>\n );\n }\n\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={this.state.value === null || this.state.value === undefined ? '' : this.state.value}\n error={!!error || !!this.state.jsonError}\n disabled={!!disabled}\n slotProps={{\n htmlInput: {\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.props.schema.readOnly || false,\n },\n input: {\n endAdornment: actionButton,\n },\n }}\n onChange={e => {\n const value = e.target.value;\n\n this.setState({ value, oldValue: this.state.value, jsonError: this.validateJson(value) }, () =>\n this.onChange(this.props.attr, value),\n );\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={\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 }\n />\n );\n }\n}\n\nexport default ConfigText;\n"]}
|
|
1
|
+
{"version":3,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C5C,UAAU,EACN,IAAI,CAAC,KAAK,CAAC,SAAS;gBAChB,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,GAEb,CACL,CAAC;IACN,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Autocomplete, TextField, TextareaAutosize, InputAdornment, IconButton } from '@mui/material';\n\nimport { Close as CloseIcon } from '@mui/icons-material';\n\nimport { I18n, IconCopy, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemText } 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 label: {\n width: '100%',\n fontSize: 14,\n marginBottom: 2,\n },\n helper: {\n width: '100%',\n fontSize: 12,\n },\n error: {\n width: '100%',\n fontSize: 12,\n color: '#FF0000',\n },\n};\n\ninterface ConfigTextProps extends ConfigGenericProps {\n schema: ConfigItemText;\n}\n\ninterface ConfigTextState extends ConfigGenericState {\n oldValue?: string;\n jsonError?: boolean;\n}\n\nclass ConfigText extends ConfigGeneric<ConfigTextProps, ConfigTextState> {\n private updateTimeout: ReturnType<typeof setTimeout> | null = null;\n\n componentDidMount(): void {\n super.componentDidMount();\n let value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n if (Array.isArray(value) && this.props.oContext.multiEdit) {\n value = ConfigGeneric.DIFFERENT_VALUE;\n this.setState({ value, oldValue: value, jsonError: false });\n return;\n }\n\n this.setState({ value, oldValue: value, jsonError: this.validateJson(value) });\n }\n\n validateJson(value: string | null | undefined): boolean {\n let jsonError = false;\n if (this.props.schema.validateJson) {\n if (value || !this.props.schema.allowEmpty) {\n try {\n JSON.parse(value);\n } catch (err: unknown) {\n console.log('Error in JSON', err);\n jsonError = true;\n }\n }\n }\n\n return jsonError;\n }\n\n static getDerivedStateFromProps(props: ConfigTextProps, state: ConfigTextState): Partial<ConfigTextState> | null {\n if (props.oContext.multiEdit && state.value === ConfigGeneric.DIFFERENT_VALUE) {\n return { value: ConfigGeneric.DIFFERENT_VALUE };\n }\n\n let value = ConfigGeneric.getValue(props.data, props.attr);\n\n if (value !== null && value !== undefined) {\n value = value.toString();\n }\n\n if (value === null || value === undefined || (value !== state.value && value !== state.oldValue)) {\n return { value };\n }\n return null;\n }\n\n renderItem(error?: boolean, disabled?: boolean): JSX.Element {\n const isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric.DIFFERENT_VALUE;\n\n if (this.props.schema.time) {\n // show read-only time\n\n let time = '';\n if (typeof this.state.value === 'number') {\n // If the value is a number, it is a timestamp.\n if (this.state.value && this.state.value < 946659600000) {\n // If the value is less than 2000-01-01, it is a timestamp in seconds.\n time = new Date(this.state.value * 1000).toLocaleString();\n } else {\n time = new Date(this.state.value).toLocaleString();\n }\n } else if (typeof this.state.value === 'string') {\n // If the value is a string, it is a date string.\n time = new Date(this.state.value).toLocaleString();\n }\n\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={time}\n error={!!error || !!this.state.jsonError}\n disabled={!!disabled}\n slotProps={{\n htmlInput: {\n readOnly: true,\n },\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\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 = null;\n this.setState({ oldValue: null });\n }, 30);\n } else if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n this.updateTimeout = null;\n }\n\n if (isIndeterminate) {\n const autoCompleteOptions = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const arr =\n autoCompleteOptions\n ?.filter((a: any) => a || a === 0)\n .map((item: any) => ({ 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 value={arr[0]}\n // getOptionSelected={(option, value) => option.label === value.label}\n onChange={(_, value) => {\n const val = value ? value.value : '';\n const mayBePromise = this.onChange(this.props.attr, val, () => {\n this.setState({ value: val, oldValue: val, jsonError: this.validateJson(value) });\n });\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n options={arr}\n getOptionLabel={option => option.label}\n renderInput={params => (\n <TextField\n variant=\"standard\"\n {...params}\n error={!!error}\n placeholder={this.getText(this.props.schema.placeholder)}\n slotProps={{\n htmlInput: {\n ...params.inputProps,\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.props.schema.readOnly || false,\n },\n }}\n label={this.getText(this.props.schema.label)}\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\n let actionButton: React.JSX.Element | undefined;\n let actionButtonStyle: React.CSSProperties | undefined;\n if ((this.props.schema.readOnly || disabled) && this.props.schema.copyToClipboard) {\n if (this.props.schema.minRows > 1) {\n actionButtonStyle = {\n position: 'absolute',\n right: 3,\n top: 20,\n zIndex: 1000,\n };\n }\n actionButton = (\n <IconButton\n style={actionButtonStyle}\n size=\"small\"\n onClick={() => {\n Utils.copyToClipboard(this.state.value);\n window.alert(I18n.t('ra_Copied'));\n }}\n >\n <IconCopy />\n </IconButton>\n );\n } else if (!this.props.schema.readOnly && !disabled && this.state.value && !this.props.schema.noClearButton) {\n if (this.props.schema.minRows > 1) {\n actionButtonStyle = {\n position: 'absolute',\n right: 3,\n top: 20,\n zIndex: 1000,\n };\n }\n actionButton = (\n <IconButton\n style={actionButtonStyle}\n size=\"small\"\n onClick={() =>\n this.setState({ value: '', oldValue: this.state.value }, () =>\n this.onChange(this.props.attr, ''),\n )\n }\n >\n <CloseIcon />\n </IconButton>\n );\n if (this.props.schema.minRows <= 1) {\n actionButton = <InputAdornment position=\"end\">{actionButton}</InputAdornment>;\n }\n }\n\n if (this.props.schema.minRows > 1) {\n const helper = this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n );\n return (\n <div style={{ width: '100%', position: 'relative' }}>\n {this.props.schema.label ? (\n <div style={styles.label}>{this.getText(this.props.schema.label)}</div>\n ) : null}\n <TextareaAutosize\n // variant=\"standard\"\n style={{\n width: '100%',\n resize: 'vertical',\n backgroundColor: this.props.oContext.themeType === 'dark' ? '#363636' : '#cccccc',\n color: this.props.oContext.themeType === 'dark' ? '#fff' : '#111',\n }}\n minRows={this.props.schema.minRows}\n maxRows={this.props.schema.maxRows}\n value={this.state.value === null || this.state.value === undefined ? '' : this.state.value}\n disabled={!!disabled}\n readOnly={this.props.schema.readOnly || false}\n onChange={e => {\n const value = e.target.value;\n this.setState(\n { value, oldValue: this.state.value, jsonError: this.validateJson(value) },\n () => this.onChange(this.props.attr, value || ''),\n );\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n />\n {helper || error || this.state.jsonError ? (\n <div style={error ? styles.error : styles.helper}>\n {error || (this.state.jsonError ? I18n.t('ra_Invalid JSON') : helper)}\n </div>\n ) : null}\n </div>\n );\n }\n\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={this.state.value === null || this.state.value === undefined ? '' : this.state.value}\n error={!!error || !!this.state.jsonError}\n disabled={!!disabled}\n slotProps={{\n htmlInput: {\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.props.schema.readOnly || false,\n },\n input: {\n endAdornment: actionButton,\n },\n }}\n onChange={e => {\n const value = e.target.value;\n\n this.setState({ value, oldValue: this.state.value, jsonError: this.validateJson(value) }, () =>\n this.onChange(this.props.attr, value),\n );\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={\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 }\n />\n );\n }\n}\n\nexport default ConfigText;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigTextSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigTextSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,aAAa,MAAM,SAAS,CAAC;AACpC,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;CACJ,CAAC;AAoBF,MAAM,gBAAiB,SAAQ,aAA2D;IAC9E,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,CAAqB;IAEzC,WAAW;QACP,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACnB,IAAI,IAAI,GAAoC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;YACnE,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACnD,MAAM,OAAO,GAAW,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ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AC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,GACH,CACL,CAAC;QACN,CAAC;QACD,OAAO,CACH,6BAAK,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE;YAClE,IAAI;YACJ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,CACtC,8BAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,GAAI,CACvE,CAAC,CAAC,CAAC,CACA,IAAI,CAAC,KAAK,CAAC,IAAI,CAClB,CACC,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton } from '@mui/material';\n\nimport { I18n, Icon, IconCopy, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSendTo } from '#JC/types';\nimport getIconByName from './Icons';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n },\n};\n\ninterface ConfigTextSendToProps extends ConfigGenericProps {\n schema: ConfigItemSendTo;\n}\n\ninterface ConfigTextSendToState extends ConfigGenericState {\n text?: string;\n style?: React.CSSProperties;\n icon?: string;\n iconStyle?: React.CSSProperties;\n}\n\ninterface Response {\n text: string;\n style?: React.CSSProperties;\n icon?: string;\n iconStyle?: React.CSSProperties;\n}\n\nclass ConfigTextSendTo extends ConfigGeneric<ConfigTextSendToProps, ConfigTextSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n askInstance(): void {\n if (this.props.alive) {\n let data: Record<string, any> | undefined = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = 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 }\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.command || 'send',\n data,\n )\n .then(result => {\n if (typeof result === 'object') {\n const _data: Response = result;\n this.setState({\n text: _data.text || '',\n style: _data.style,\n icon: _data.icon,\n iconStyle: _data.iconStyle,\n });\n } else if (typeof result === 'string') {\n this.setState({ text: result || '' });\n }\n })\n .catch(e => console.error(`Cannot send command: ${e}`));\n }\n }\n\n getLocalContext(): string {\n const localContext: Record<string, any> = {};\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n return JSON.stringify(localContext);\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element {\n if (this.props.alive) {\n const localContext = this.getLocalContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n if (this.state.text === undefined) {\n return null;\n }\n\n let icon: JSX.Element | null = null;\n if (this.state.icon) {\n icon = getIconByName(this.state.icon, {\n marginRight: this.state.text ? 8 : undefined,\n ...(this.state.iconStyle || undefined),\n });\n if (!icon) {\n icon = (\n <Icon\n src={this.state.icon}\n style={{ marginRight: this.state.text ? 8 : undefined, ...(this.state.iconStyle || undefined) }}\n />\n );\n }\n }\n\n if (this.props.schema.container === 'text') {\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n slotProps={{\n input: {\n endAdornment: this.props.schema.copyToClipboard ? (\n <IconButton\n size=\"small\"\n onClick={() => {\n Utils.copyToClipboard(this.state.text);\n window.alert(I18n.t('ra_Copied'));\n }}\n >\n <IconCopy />\n </IconButton>\n ) : undefined,\n },\n }}\n value={this.state.text}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n return (\n <div style={{ ...styles.fullWidth, ...(this.state.style || undefined) }}>\n {icon}\n {this.props.schema.container === 'html' ? (\n <span dangerouslySetInnerHTML={{ __html: this.state.text || '' }} />\n ) : (\n this.state.text\n )}\n </div>\n );\n }\n}\n\nexport default ConfigTextSendTo;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigTextSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigTextSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,aAAa,MAAM,SAAS,CAAC;AACpC,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;CACJ,CAAC;AAoBF,MAAM,gBAAiB,SAAQ,aAA2D;IAC9E,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,CAAqB;IAEzC,WAAW;QACP,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACnB,IAAI,IAAI,GAAoC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;YACnE,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACnD,MAAM,OAAO,GAAW,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAA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AI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,GACH,CACL,CAAC;QACN,CAAC;QACD,OAAO,CACH,6BAAK,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE;YAClE,IAAI;YACJ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,CACtC,8BAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,GAAI,CACvE,CAAC,CAAC,CAAC,CACA,IAAI,CAAC,KAAK,CAAC,IAAI,CAClB,CACC,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton } from '@mui/material';\n\nimport { I18n, Icon, IconCopy, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSendTo } from '../types';\nimport getIconByName from './Icons';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n },\n};\n\ninterface ConfigTextSendToProps extends ConfigGenericProps {\n schema: ConfigItemSendTo;\n}\n\ninterface ConfigTextSendToState extends ConfigGenericState {\n text?: string;\n style?: React.CSSProperties;\n icon?: string;\n iconStyle?: React.CSSProperties;\n}\n\ninterface Response {\n text: string;\n style?: React.CSSProperties;\n icon?: string;\n iconStyle?: React.CSSProperties;\n}\n\nclass ConfigTextSendTo extends ConfigGeneric<ConfigTextSendToProps, ConfigTextSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n askInstance(): void {\n if (this.props.alive) {\n let data: Record<string, any> | undefined = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = 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 }\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.command || 'send',\n data,\n )\n .then(result => {\n if (typeof result === 'object') {\n const _data: Response = result;\n this.setState({\n text: _data.text || '',\n style: _data.style,\n icon: _data.icon,\n iconStyle: _data.iconStyle,\n });\n } else if (typeof result === 'string') {\n this.setState({ text: result || '' });\n }\n })\n .catch(e => console.error(`Cannot send command: ${e}`));\n }\n }\n\n getLocalContext(): string {\n const localContext: Record<string, any> = {};\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n return JSON.stringify(localContext);\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element {\n if (this.props.alive) {\n const localContext = this.getLocalContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n if (this.state.text === undefined) {\n return null;\n }\n\n let icon: JSX.Element | null = null;\n if (this.state.icon) {\n icon = getIconByName(this.state.icon, {\n marginRight: this.state.text ? 8 : undefined,\n ...(this.state.iconStyle || undefined),\n });\n if (!icon) {\n icon = (\n <Icon\n src={this.state.icon}\n style={{ marginRight: this.state.text ? 8 : undefined, ...(this.state.iconStyle || undefined) }}\n />\n );\n }\n }\n\n if (this.props.schema.container === 'text') {\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n slotProps={{\n input: {\n endAdornment: this.props.schema.copyToClipboard ? (\n <IconButton\n size=\"small\"\n onClick={() => {\n Utils.copyToClipboard(this.state.text);\n window.alert(I18n.t('ra_Copied'));\n }}\n >\n <IconCopy />\n </IconButton>\n ) : undefined,\n },\n }}\n value={this.state.text}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n return (\n <div style={{ ...styles.fullWidth, ...(this.state.style || undefined) }}>\n {icon}\n {this.props.schema.container === 'html' ? (\n <span dangerouslySetInnerHTML={{ __html: this.state.text || '' }} />\n ) : (\n this.state.text\n )}\n </div>\n );\n }\n}\n\nexport default ConfigTextSendTo;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigTimePicker.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigTimePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,aAA0C,MAAM,iBAAiB,CAAC;AAOzE,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,aAAoC;IAC9E,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACvE,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,UAAU,CAAC,MAAe,EAAE,QAAiB;QACzC,4CAA4C;QAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,KAAK,UAAU,CAAC;QAElE,MAAM,KAAK,GAAU,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,oBAAoB,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC,CAAU,CAAC;QAEzG,OAAO,CACH,oBAAC,UAAU,IACP,EAAE,EAAE,KAAK,CAAC,E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AC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACzD,CAAC;gBAED,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YAC/F,CAAC,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,EACjE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAC9C,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TimePicker } from '@mui/x-date-pickers';\n\nimport type { ConfigItemTimePicker } from '
|
|
1
|
+
{"version":3,"file":"ConfigTimePicker.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigTimePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,aAA0C,MAAM,iBAAiB,CAAC;AAOzE,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,aAAoC;IAC9E,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACvE,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,UAAU,CAAC,MAAe,EAAE,QAAiB;QACzC,4CAA4C;QAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY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K,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;wBACvC,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;gBAClC,IAAI,WAAW,EAAE,CAAC;oBACd,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACzD,CAAC;gBAED,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YAC/F,CAAC,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,EACjE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAC9C,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TimePicker } from '@mui/x-date-pickers';\n\nimport type { ConfigItemTimePicker } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps } from './ConfigGeneric';\n\ninterface ConfigTimePickerProps extends ConfigGenericProps {\n schema: ConfigItemTimePicker;\n dialogName?: string;\n}\n\nexport default class ConfigTimePicker extends ConfigGeneric<ConfigTimePickerProps> {\n componentDidMount(): void {\n super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n this.setState({ value });\n }\n\n renderItem(_error: unknown, disabled: boolean): JSX.Element {\n // the format could be 'HH:mm:ss' or 'HH:mm'\n const shortFormat = this.props.schema.returnFormat !== 'HH:mm:ss';\n\n const value: never = new Date(Date.parse(`Thu, 01 Jan 1970 ${this.state.value || '00:00:00'}`)) as never;\n\n return (\n <TimePicker\n sx={theme => ({\n width: '100%',\n borderBottom: `1px solid ${theme.palette.text.primary}`,\n '& fieldset': {\n display: 'none',\n },\n '& input': {\n padding: `${theme.spacing(1.5)} 0 4px 0`,\n },\n '& .MuiInputAdornment-root': {\n marginLeft: 0,\n marginTop: 1, // it is already in spaces\n },\n '& label': {\n transform: 'translate(0px, -9px) scale(0.75)',\n },\n })}\n ampm={this.props.oContext.systemConfig.dateFormat.includes('/')}\n timeSteps={\n this.props.schema.timeSteps || this.props.schema.timesteps || { hours: 1, minutes: 5, seconds: 5 }\n }\n format={this.props.schema.format || 'HH:mm:ss'}\n disabled={!!disabled}\n value={value}\n onChange={(newValue: Date) => {\n let strValue: string;\n strValue =\n (newValue as any) instanceof Date\n ? newValue.toTimeString().split(' ')[0]\n : newValue.toTimeString();\n if (shortFormat) {\n strValue = strValue.split(':').slice(0, 2).join(':');\n }\n\n this.setState({ value: strValue }, () => this.onChange(this.props.attr, this.state.value));\n }}\n views={this.props.schema.views || ['hours', 'minutes', 'seconds']}\n label={this.getText(this.props.schema.label)}\n />\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigTopic.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigTopic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,SAAS,eAAe,CAAC,EAAU,EAAE,SAAiB;IAClD,IAAI,KAAK,CAAC;IACV,IAAI,SAAS,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,SAAS,EAAE,CAAC;QAC/D,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACJ,KAAK,GAAG,EAA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AAC,KAAK,EACd,QAAQ,EAAE,QAAQ,EAClB,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,EAAE,IAAI,CAAC,UAAU,CACvB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,EACD,QAAQ,EAAE,CAAC,CAAC,EAAE;gBACV,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC7B,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YAC1E,CAAC,GACH,CACL,CAAC;IACN,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField } from '@mui/material';\n\nimport type { ConfigItemTopic } from '
|
|
1
|
+
{"version":3,"file":"ConfigTopic.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigTopic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,SAAS,eAAe,CAAC,EAAU,EAAE,SAAiB;IAClD,IAAI,KAAK,CAAC;IACV,IAAI,SAAS,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,SAAS,EAAE,CAAC;QAC/D,KAAK,GAAG,EAAE,CA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GAAG,IAAI,SAAS;iBAC/E;aACJ,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,KAAK,EAAE,CAAC,CAAC,KAAK,EACd,QAAQ,EAAE,QAAQ,EAClB,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,EAAE,IAAI,CAAC,UAAU,CACvB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,EACD,QAAQ,EAAE,CAAC,CAAC,EAAE;gBACV,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC7B,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YAC1E,CAAC,GACH,CACL,CAAC;IACN,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField } from '@mui/material';\n\nimport type { ConfigItemTopic } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nfunction convertID2Topic(id: string, namespace: string): string {\n let topic;\n if (namespace && id.substring(0, namespace.length) === namespace) {\n topic = id.substring(namespace.length + 1);\n } else {\n topic = id;\n }\n topic = topic.replace(/\\./g, '/').replace(/_/g, ' ');\n return topic;\n}\n\ninterface ConfigTopicProps extends ConfigGenericProps {\n schema: ConfigItemTopic;\n}\n\nclass ConfigTopic extends ConfigGeneric<ConfigTopicProps, ConfigGenericState> {\n componentDidMount(): void {\n super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n if (!value && this.props.customObj?._id) {\n const topic = convertID2Topic(\n this.props.customObj._id,\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n );\n this.setState({ value: topic });\n } else {\n this.setState({ value: value || '' });\n }\n }\n\n renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n slotProps={{\n htmlInput: {\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n },\n }}\n value={this.state.value}\n error={!!error}\n disabled={disabled}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n onChange={e => {\n const value = e.target.value;\n this.setState({ value }, () => this.onChange(this.props.attr, value));\n }}\n />\n );\n }\n}\n\nexport default ConfigTopic;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigUUID.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigUUID.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,WAAW,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGzD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAUlG,MAAM,UAAW,SAAQ,aAA+C;IACpE,KAAK,CAAC,iBAAiB;QACnB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QAC/E,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,IAAI,SAAS,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,UAAU,CAAC,KAAc,EAAE,QAAiB;QACxC,OAAO,CACH,oBAAC,SAAS,IACN,OAAO,EAAC,UAAU,EAClB,SAAS,QACT,KAAK,EAAE,CAAC,CAAC,KAAK,EACd,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,SAAS,EAAE;gBACP,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC7B,KAAK,EAAE;oBACH,YAAY,EAAE,CACV,oBAAC,UAAU,IACP,OAAO,EAAE,GAAG,EAAE;4BACV,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;4BACvC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;wBAC1D,CAAC;wBAED,oBAAC,QAAQ,OAAG,CACH,CAChB;iBACJ;aACJ,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EAC5B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,yBAAyB,CAAC,EACjF,UAAU,EAAE,IAAI,CAAC,UAAU,CACvB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,GACH,CACL,CAAC;IACN,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton } from '@mui/material';\n\nimport { ContentCopy as IconCopy } from '@mui/icons-material';\n\nimport { Utils, I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemUUID } from '
|
|
1
|
+
{"version":3,"file":"ConfigUUID.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigUUID.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,WAAW,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGzD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAUlG,MAAM,UAAW,SAAQ,aAA+C;IACpE,KAAK,CAAC,iBAAiB;QACnB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QAC/E,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,IAAI,SAAS,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,UAAU,CAAC,KAAc,EAAE,QAAiB;QACxC,OAAO,CACH,oBAAC,SAAS,IACN,OAAO,EAAC,UAAU,EAClB,SAAS,QACT,KAAK,EAAE,CAAC,CAAC,KAAK,EACd,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,SAAS,EAAE;gBACP,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC7B,KAAK,EAAE;oBACH,YAAY,EAAE,CACV,oBAAC,UAAU,IACP,OAAO,EAAE,GAAG,EAAE;4BACV,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;4BACvC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;wBAC1D,CAAC;wBAED,oBAAC,QAAQ,OAAG,CACH,CAChB;iBACJ;aACJ,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EAC5B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,yBAAyB,CAAC,EACjF,UAAU,EAAE,IAAI,CAAC,UAAU,CACvB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,GACH,CACL,CAAC;IACN,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton } from '@mui/material';\n\nimport { ContentCopy as IconCopy } from '@mui/icons-material';\n\nimport { Utils, I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemUUID } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigUUIDProps extends ConfigGenericProps {\n schema: ConfigItemUUID;\n}\n\ninterface ConfigUUIDState extends ConfigGenericState {\n uuid?: string;\n}\n\nclass ConfigUUID extends ConfigGeneric<ConfigUUIDProps, ConfigUUIDState> {\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n\n const uuidObj = await this.props.oContext.socket.getObject('system.meta.uuid');\n this.setState({ uuid: uuidObj?.native?.uuid || 'unknown' });\n }\n\n renderItem(error: unknown, disabled: boolean): JSX.Element {\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n error={!!error}\n disabled={!!disabled}\n slotProps={{\n htmlInput: { readOnly: true },\n input: {\n endAdornment: (\n <IconButton\n onClick={() => {\n Utils.copyToClipboard(this.state.uuid);\n window.alert(I18n.t('ra_Copied %s', this.state.uuid));\n }}\n >\n <IconCopy />\n </IconButton>\n ),\n },\n }}\n value={this.state.uuid || ''}\n label={this.getText(this.props.schema.label) || I18n.t('ra_Serial number (UUID)')}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n}\n\nexport default ConfigUUID;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigUser.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigUser.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErG,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAG/D,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,IAAI,EAAE;QACF,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,CAAC;KACjB;CACJ,CAAC;AAUF,MAAM,UAAW,SAAQ,aAA+C;IACpE,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM;aACrB,QAAQ,EAAE;aACV,IAAI,CAAC,KAAK,CAAC,EAAE;YACV,MAAM,MAAM,GAAoE,EAAE,CAAC;YACnF,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAEhC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBAC1B,KAAK,CAAC,OAAO,CACT,IAAI,CAAC,EAAE,CACH,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG;oBAChB,KAAK,EAAE,IAAI,CAAC,MAAM,EAA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,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACtB,oBAAC,cAAc,QACV,IAAI,CAAC,UAAU,CACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACY,CACpB,CAAC,CAAC,CAAC,IAAI,CACE,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { InputLabel, TextField, MenuItem, FormHelperText, FormControl, Select } from '@mui/material';\n\nimport { Icon, Utils, I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemUser } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n icon: {\n width: 16,\n height: 16,\n marginRight: 8,\n },\n};\n\ninterface ConfigUserProps extends ConfigGenericProps {\n schema: ConfigItemUser;\n}\n\ninterface ConfigUserState extends ConfigGenericState {\n users: Record<string, { color?: string; icon?: string; name: string }>;\n}\n\nclass ConfigUser extends ConfigGeneric<ConfigUserProps, ConfigUserState> {\n componentDidMount(): void {\n super.componentDidMount();\n this.props.oContext.socket\n .getUsers()\n .then(users => {\n const _users: Record<string, { color?: string; icon?: string; name: string }> = {};\n const lang = I18n.getLanguage();\n\n if (this.props.schema.short) {\n users.forEach(\n user =>\n (_users[user._id] = {\n color: user.common?.color,\n icon: user.common?.icon,\n name: Utils.getObjectNameFromObj(user, lang),\n }),\n );\n } else {\n users.forEach(\n user =>\n (_users[user._id.replace(/^system\\.user\\./, '')] = {\n color: user.common?.color,\n icon: user.common?.icon,\n name: Utils.getObjectNameFromObj(user, lang),\n }),\n );\n }\n\n this.setState({ users: _users });\n })\n .catch(e => console.error(`Cannot get users: ${e}`));\n }\n\n renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n return (\n <FormControl\n variant=\"standard\"\n fullWidth\n >\n {this.state.users && this.props.schema.label ? (\n <InputLabel>{this.getText(this.props.schema.label)}</InputLabel>\n ) : null}\n {!this.state.users ? (\n <TextField\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={value}\n onChange={e => this.onChange(this.props.attr, e.target.value)}\n label={this.getText(this.props.schema.label)}\n />\n ) : (\n <Select\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={value}\n renderValue={val => (\n <span>\n {this.state.users && this.state.users[val]?.icon ? (\n <Icon\n src={this.state.users && this.state.users[val]?.icon}\n style={styles.icon}\n />\n ) : null}\n {(this.state.users && this.state.users[val]?.name) || val || ''}\n </span>\n )}\n style={{\n color: (this.state.users && this.state.users[value]?.color) || undefined,\n backgroundColor: Utils.getInvertedColor(\n this.state.users && this.state.users[value]?.color,\n this.props.oContext.themeType,\n ),\n }}\n onChange={e => this.onChange(this.props.attr, e.target.value)}\n >\n {this.state.users &&\n Object.keys(this.state.users).map(id => (\n <MenuItem\n style={{\n color: this.state.users[id].color || undefined,\n backgroundColor: Utils.getInvertedColor(\n this.state.users[id].color,\n this.props.oContext.themeType,\n ),\n }}\n key={id}\n value={id}\n >\n {this.state.users[id].icon ? (\n <Icon\n src={this.state.users[id].icon}\n style={styles.icon}\n />\n ) : null}\n {this.state.users[id].name}\n </MenuItem>\n ))}\n </Select>\n )}\n {this.props.schema.help ? (\n <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText>\n ) : null}\n </FormControl>\n );\n }\n}\n\nexport default ConfigUser;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigUser.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigUser.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,UAAU,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gBACb,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CACpC,oBAAC,QAAQ,IACL,KAAK,EAAE;wBACH,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,SAAS;wBAC9C,eAAe,EAAE,KAAK,CAAC,gBAAgB,CACnC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,EAC1B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAChC;qBACJ,EACD,GAAG,EAAE,EAAE,EACP,KAAK,EAAE,EAAE;oBAER,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACzB,oBAAC,IAAI,IACD,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,EAC9B,KAAK,EAAE,MAAM,CAAC,IAAI,GACpB,CACL,CAAC,CAAC,CAAC,IAAI;oBACP,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CACnB,CACd,CAAC,CACD,CACZ;YACA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACtB,oBAAC,cAAc,QACV,IAAI,CAAC,UAAU,CACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACY,CACpB,CAAC,CAAC,CAAC,IAAI,CACE,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { InputLabel, TextField, MenuItem, FormHelperText, FormControl, Select } from '@mui/material';\n\nimport { Icon, Utils, I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemUser } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n icon: {\n width: 16,\n height: 16,\n marginRight: 8,\n },\n};\n\ninterface ConfigUserProps extends ConfigGenericProps {\n schema: ConfigItemUser;\n}\n\ninterface ConfigUserState extends ConfigGenericState {\n users: Record<string, { color?: string; icon?: string; name: string }>;\n}\n\nclass ConfigUser extends ConfigGeneric<ConfigUserProps, ConfigUserState> {\n componentDidMount(): void {\n super.componentDidMount();\n this.props.oContext.socket\n .getUsers()\n .then(users => {\n const _users: Record<string, { color?: string; icon?: string; name: string }> = {};\n const lang = I18n.getLanguage();\n\n if (this.props.schema.short) {\n users.forEach(\n user =>\n (_users[user._id] = {\n color: user.common?.color,\n icon: user.common?.icon,\n name: Utils.getObjectNameFromObj(user, lang),\n }),\n );\n } else {\n users.forEach(\n user =>\n (_users[user._id.replace(/^system\\.user\\./, '')] = {\n color: user.common?.color,\n icon: user.common?.icon,\n name: Utils.getObjectNameFromObj(user, lang),\n }),\n );\n }\n\n this.setState({ users: _users });\n })\n .catch(e => console.error(`Cannot get users: ${e}`));\n }\n\n renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n return (\n <FormControl\n variant=\"standard\"\n fullWidth\n >\n {this.state.users && this.props.schema.label ? (\n <InputLabel>{this.getText(this.props.schema.label)}</InputLabel>\n ) : null}\n {!this.state.users ? (\n <TextField\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={value}\n onChange={e => this.onChange(this.props.attr, e.target.value)}\n label={this.getText(this.props.schema.label)}\n />\n ) : (\n <Select\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={value}\n renderValue={val => (\n <span>\n {this.state.users && this.state.users[val]?.icon ? (\n <Icon\n src={this.state.users && this.state.users[val]?.icon}\n style={styles.icon}\n />\n ) : null}\n {(this.state.users && this.state.users[val]?.name) || val || ''}\n </span>\n )}\n style={{\n color: (this.state.users && this.state.users[value]?.color) || undefined,\n backgroundColor: Utils.getInvertedColor(\n this.state.users && this.state.users[value]?.color,\n this.props.oContext.themeType,\n ),\n }}\n onChange={e => this.onChange(this.props.attr, e.target.value)}\n >\n {this.state.users &&\n Object.keys(this.state.users).map(id => (\n <MenuItem\n style={{\n color: this.state.users[id].color || undefined,\n backgroundColor: Utils.getInvertedColor(\n this.state.users[id].color,\n this.props.oContext.themeType,\n ),\n }}\n key={id}\n value={id}\n >\n {this.state.users[id].icon ? (\n <Icon\n src={this.state.users[id].icon}\n style={styles.icon}\n />\n ) : null}\n {this.state.users[id].name}\n </MenuItem>\n ))}\n </Select>\n )}\n {this.props.schema.help ? (\n <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText>\n ) : null}\n </FormControl>\n );\n }\n}\n\nexport default ConfigUser;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { Component, type JSX } from 'react';
|
|
2
2
|
import { type AdminConnection, type ThemeName, type ThemeType, type IobTheme } from '@iobroker/adapter-react-v5';
|
|
3
3
|
import type { BackEndCommand, ConfigItemPanel, ConfigItemTabs } from '../types';
|
|
4
|
-
import type ConfigGeneric from '
|
|
5
|
-
import { type DeviceManagerPropsProps } from '
|
|
4
|
+
import type ConfigGeneric from './ConfigGeneric';
|
|
5
|
+
import { type DeviceManagerPropsProps } from './ConfigGeneric';
|
|
6
6
|
interface JsonConfigComponentProps {
|
|
7
7
|
socket: AdminConnection;
|
|
8
8
|
themeName: ThemeName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"./src/","sources":["JsonConfigComponent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAA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AAI,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC,CAAC;IAEF,MAAM;QACF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC7C,OAAO,oBAAC,cAAc,OAAG,CAAC;QAC9B,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACpD,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YAChD,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,CACH,6BACI,KAAK,EAAE;gBACH,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gBACnD,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK;gBACnB,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;aAC7B,IAEA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CACjC,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,mBAAmB,CAAC","sourcesContent":["import React, { Component, type JSX } from 'react';\n\nimport { LinearProgress } from '@mui/material';\n\nimport { type AdminConnection, I18n, type ThemeName, type ThemeType, type IobTheme } from '@iobroker/adapter-react-v5';\n\nimport type { BackEndCommand, ConfigItemPanel, ConfigItemTabs, JsonConfigContext } from '#JC/types';\nimport type ConfigGeneric from '#JC/JsonConfigComponent/ConfigGeneric';\n// eslint-disable-next-line no-duplicate-imports\nimport { type DeviceManagerPropsProps } from '#JC/JsonConfigComponent/ConfigGeneric';\nimport ConfigTabs from './ConfigTabs';\nimport ConfigPanel from './ConfigPanel';\n\nconst styles: Record<string, React.CSSProperties> = {\n root: {\n width: '100%',\n height: '100%',\n },\n};\n\ninterface JsonConfigComponentProps {\n socket: AdminConnection;\n themeName: ThemeName;\n themeType: ThemeType;\n adapterName: string;\n instance: number;\n isFloatComma: boolean;\n dateFormat: string;\n imagePrefix?: string;\n schema: ConfigItemTabs | ConfigItemPanel;\n common?: Record<string, any>;\n data: Record<string, any>;\n updateData?: number;\n onError: (error: boolean) => void;\n onChange?: (data: Record<string, any>, changed: boolean, saveConfig: boolean) => void;\n /** Backend request to refresh data */\n onBackEndCommand?: (command?: BackEndCommand) => void;\n custom?: boolean;\n onValueChange?: (attr: string, value: any, saveConfig: boolean) => void;\n embedded?: boolean;\n multiEdit?: boolean;\n instanceObj?: ioBroker.InstanceObject;\n customObj?: ioBroker.Object;\n customs?: Record<string, typeof ConfigGeneric>;\n DeviceManager?: React.FC<DeviceManagerPropsProps>;\n style?: React.CSSProperties;\n theme: IobTheme;\n expertMode?: boolean;\n}\n\ninterface JsonConfigComponentState {\n originalData: string;\n changed: boolean;\n errors: Record<string, string>;\n systemConfig: ioBroker.SystemConfigCommon | null;\n updateData?: number;\n alive: boolean;\n commandRunning: boolean;\n schema: ConfigItemTabs | ConfigItemPanel;\n}\n\nexport class JsonConfigComponent extends Component<JsonConfigComponentProps, JsonConfigComponentState> {\n private readonly forceUpdateHandlers: Record<string, (data: any) => void>;\n\n private errorTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private errorCached: Record<string, string> | null = null;\n\n private oContext: JsonConfigContext;\n\n constructor(props: JsonConfigComponentProps) {\n super(props);\n\n this.state = {\n originalData: JSON.stringify(this.props.data),\n changed: false,\n errors: {},\n updateData: this.props.updateData || 0,\n systemConfig: null,\n alive: false,\n commandRunning: false,\n schema: JSON.parse(JSON.stringify(this.props.schema)),\n };\n\n this.forceUpdateHandlers = {};\n\n this.buildDependencies(this.state.schema);\n\n this.readData();\n }\n\n static getDerivedStateFromProps(\n props: JsonConfigComponentProps,\n state: JsonConfigComponentState,\n ): Partial<JsonConfigComponentState> | null {\n if (props.updateData !== state.updateData) {\n return {\n updateData: props.updateData,\n originalData: JSON.stringify(props.data),\n schema: JSON.parse(JSON.stringify(props.schema)),\n };\n }\n return null;\n }\n\n static async loadI18n(\n socket: AdminConnection,\n i18n: boolean | string | Record<string, Record<ioBroker.Languages, string>>,\n adapterName: string,\n ): Promise<string> {\n if (i18n === true || (i18n && typeof i18n === 'string')) {\n const lang = I18n.getLanguage();\n const path = typeof i18n === 'string' ? i18n : 'i18n';\n let exists = await socket.fileExists(`${adapterName}.admin`, `${path}/${lang}.json`);\n let fileName;\n if (exists) {\n fileName = `${path}/${lang}.json`;\n } else {\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/${lang}/translations.json`);\n if (exists) {\n fileName = `${path}/${lang}/translations.json`;\n } else if (lang !== 'en') {\n // fallback to english\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/en.json`);\n if (exists) {\n fileName = `${path}/en.json`;\n } else {\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/en/translations.json`);\n if (exists) {\n fileName = `${path}/en/translations.json`;\n }\n }\n }\n }\n\n if (fileName) {\n const jsonFile = await socket.readFile(`${adapterName}.admin`, fileName);\n let jsonStr: string;\n if (jsonFile.file !== undefined) {\n jsonStr = jsonFile.file;\n } else {\n // @ts-expect-error deprecated\n jsonStr = jsonFile;\n }\n\n try {\n const json = JSON.parse(jsonStr);\n // apply file to I18n\n I18n.extendTranslations(json, lang);\n } catch (e) {\n console.error(`Cannot parse language file \"${adapterName}.admin/${fileName}: ${e}`);\n return '';\n }\n return fileName;\n }\n console.warn(`Cannot find i18n for ${adapterName} / ${fileName}`);\n return '';\n }\n if (i18n && typeof i18n === 'object') {\n I18n.extendTranslations(i18n);\n return '';\n }\n return '';\n }\n\n onCommandRunning = (commandRunning: boolean): void => this.setState({ commandRunning });\n\n readData(): void {\n void this.props.socket\n .getCompactSystemConfig()\n .then(systemConfig =>\n this.props.socket\n .getState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`)\n .then(state =>\n this.setState({ systemConfig: systemConfig.common, alive: !!(state && state.val) }, () => {\n this.updateContext(true);\n if (!this.props.custom) {\n void this.props.socket.subscribeState(\n `system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,\n this.onAlive,\n );\n }\n }),\n ),\n )\n .catch(e => console.error(`Cannot read system config: ${e}`));\n }\n\n onAlive = (_id: string, state?: ioBroker.State | null): void => {\n if (!!state?.val !== this.state.alive) {\n this.setState({ alive: !!state?.val });\n }\n };\n\n onChange = (attrOrData: string | Record<string, any>, value: any, cb?: () => void, saveConfig?: boolean): void => {\n if (this.props.onValueChange) {\n this.props.onValueChange(attrOrData as string, value, saveConfig);\n if (cb) {\n cb();\n }\n } else if (attrOrData && this.props.onChange) {\n const newState: Partial<JsonConfigComponentState> = {\n changed: JSON.stringify(attrOrData) !== this.state.originalData,\n };\n\n this.setState(newState as JsonConfigComponentState, () => {\n this.props.onChange(attrOrData as Record<string, any>, newState.changed, saveConfig);\n if (cb) {\n cb();\n }\n });\n } else if (saveConfig) {\n this.props.onChange(null, null, saveConfig);\n }\n };\n\n onError = (attr: string, error?: string): void => {\n this.errorCached = this.errorCached || JSON.parse(JSON.stringify(this.state.errors));\n const errors = this.errorCached;\n if (error) {\n errors[attr] = error;\n } else {\n delete errors[attr];\n }\n\n if (this.errorTimeout) {\n clearTimeout(this.errorTimeout);\n }\n if (JSON.stringify(errors) !== JSON.stringify(this.state.errors)) {\n this.errorTimeout = setTimeout(\n () =>\n this.setState({ errors: this.errorCached }, () => {\n this.errorTimeout = null;\n this.errorCached = null;\n this.props.onError(!!Object.keys(this.state.errors).length);\n }),\n 50,\n );\n } else {\n this.errorCached = null;\n }\n };\n\n flatten(schema: Record<string, any>, _list?: Record<string, any>): Record<string, any> {\n _list = _list || {};\n if (schema.items) {\n Object.keys(schema.items).forEach(attr => {\n _list[attr] = schema.items[attr];\n this.flatten(schema.items[attr], _list);\n });\n }\n\n return _list;\n }\n\n buildDependencies(schema: ConfigItemTabs | ConfigItemPanel): void {\n const attrs = this.flatten(schema as Record<string, any>);\n Object.keys(attrs).forEach(attr => {\n if (attrs[attr].confirm?.alsoDependsOn) {\n attrs[attr].confirm?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].confirmDependsOn = attrs[dep].confirmDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n if (depObj.confirm) {\n depObj.confirm.cancel = 'Undo';\n }\n\n attrs[dep].confirmDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].onChange?.alsoDependsOn) {\n attrs[attr].onChange?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].onChangeDependsOn = attrs[dep].onChangeDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].onChangeDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].hidden?.alsoDependsOn) {\n attrs[attr].hidden?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].hiddenDependsOn = attrs[dep].hiddenDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].hiddenDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].label?.alsoDependsOn) {\n attrs[attr].label?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].labelDependsOn = attrs[dep].labelDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].labelDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].help?.alsoDependsOn) {\n attrs[attr].help?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].helpDependsOn = attrs[dep].helpDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].helpDependsOn.push(depObj);\n }\n });\n }\n });\n }\n\n updateContext(forceUpdate?: boolean): void {\n this.oContext = {\n DeviceManager: this.props.DeviceManager,\n adapterName: this.props.adapterName,\n changeLanguage: this.changeLanguage,\n common: this.props.common,\n customs: this.props.customs,\n dateFormat: this.props.dateFormat,\n embedded: this.props.embedded,\n expertMode: this.props.expertMode,\n forceUpdate: this.forceAttrUpdate,\n imagePrefix: this.props.imagePrefix,\n instance: this.props.instance,\n instanceObj: this.props.instanceObj,\n isFloatComma: this.props.isFloatComma,\n multiEdit: this.props.multiEdit,\n onBackEndCommand: this.props.onBackEndCommand,\n onCommandRunning: this.onCommandRunning,\n onValueChange: this.props.onValueChange,\n registerOnForceUpdate: this.registerOnForceUpdate,\n socket: this.props.socket,\n systemConfig: this.state.systemConfig,\n theme: this.props.theme,\n // could be changed dynamically\n themeType: this.props.themeType,\n _themeName: this.props.themeName,\n updateData: this.state.updateData,\n } as JsonConfigContext;\n\n if (forceUpdate) {\n this.forceUpdate();\n }\n }\n\n renderItem(item: ConfigItemTabs | ConfigItemPanel): JSX.Element | null {\n if (item.type === 'tabs') {\n return (\n <ConfigTabs\n oContext={this.oContext}\n alive={this.state.alive}\n changed={this.state.changed}\n commandRunning={this.state.commandRunning}\n common={this.props.common}\n custom={this.props.custom}\n customObj={this.props.customObj}\n data={this.props.data}\n onChange={this.onChange}\n onError={(attr, error) => this.onError(attr, error)}\n originalData={JSON.parse(this.state.originalData)}\n root\n schema={item}\n themeName={this.props.themeName}\n />\n );\n }\n if (\n item.type === 'panel' ||\n // @ts-expect-error type could be empty\n !item.type\n ) {\n return (\n <ConfigPanel\n oContext={this.oContext}\n alive={this.state.alive}\n changed={this.state.changed}\n commandRunning={this.state.commandRunning}\n common={this.props.common}\n custom={this.props.custom}\n customObj={this.props.customObj}\n data={this.props.data}\n index={1000}\n isParentTab={!this.props.embedded}\n onChange={this.onChange}\n onError={(attr, error) => this.onError(attr, error)}\n originalData={JSON.parse(this.state.originalData)}\n root\n schema={item}\n themeName={this.props.themeName}\n />\n );\n }\n console.error(`Unknown item type in root: ${JSON.stringify(item)}`);\n\n return null;\n }\n\n changeLanguage = (): void => {\n this.forceUpdate();\n };\n\n forceAttrUpdate = (attr: string | string[], data: any): void => {\n if (Array.isArray(attr)) {\n attr.forEach(a => this.forceUpdateHandlers[a] && this.forceUpdateHandlers[a](data));\n } else if (this.forceUpdateHandlers[attr]) {\n this.forceUpdateHandlers[attr](data);\n }\n };\n\n registerOnForceUpdate = (attr: string, cb?: ((data: any) => void) | null): void => {\n if (cb) {\n this.forceUpdateHandlers[attr] = cb;\n } else if (this.forceUpdateHandlers[attr]) {\n delete this.forceUpdateHandlers[attr];\n }\n };\n\n render(): JSX.Element {\n if (!this.state.systemConfig || !this.oContext) {\n return <LinearProgress />;\n }\n\n if (this.oContext._themeName !== this.props.themeName) {\n this.oContext._themeName = this.props.themeName;\n setTimeout(() => this.updateContext(true), 0);\n }\n\n return (\n <div\n style={{\n ...(!this.props.embedded ? styles.root : undefined),\n ...this.props.style,\n ...this.state.schema.style,\n }}\n >\n {this.renderItem(this.state.schema)}\n </div>\n );\n }\n}\n\nexport default JsonConfigComponent;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"./src/","sources":["JsonConfigComponent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAwB,IAAI,EAAiD,MAAM,4BAA4B,CAAC;AAMvH,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,GAAwC;IAChD,IAAI,EAAE;QACF,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;KACjB;CACJ,CAAC;AA2CF,MAAM,OAAO,mBAAoB,SAAQ,SAA6D;IACjF,mBAAmB,CAAsC;IAElE,YAAY,GAAyC,IAAI,CAAC;IAE1D,WAAW,GAAkC,IAAI,CAAC;IAElD,QAAQ,CAAoB;IAEpC,YAAY,KAA+B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,KAAK,GAAG;YACT,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YAC7C,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,EAAE;YACV,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC;YACtC,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,KAAK;YACZ,cAAc,EAAE,KAAK;YACrB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SACxD,CAAC;QAEF,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;QAE9B,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KA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Y,EAAE,EAAiC,EAAQ,EAAE;QAC9E,IAAI,EAAE,EAAE,CAAC;YACL,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACxC,CAAC;aAAM,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC,CAAC;IAEF,MAAM;QACF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC7C,OAAO,oBAAC,cAAc,OAAG,CAAC;QAC9B,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACpD,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YAChD,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,CACH,6BACI,KAAK,EAAE;gBACH,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gBACnD,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK;gBACnB,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;aAC7B,IAEA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CACjC,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,mBAAmB,CAAC","sourcesContent":["import React, { Component, type JSX } from 'react';\n\nimport { LinearProgress } from '@mui/material';\n\nimport { type AdminConnection, I18n, type ThemeName, type ThemeType, type IobTheme } from '@iobroker/adapter-react-v5';\n\nimport type { BackEndCommand, ConfigItemPanel, ConfigItemTabs, JsonConfigContext } from '../types';\nimport type ConfigGeneric from './ConfigGeneric';\n// eslint-disable-next-line no-duplicate-imports\nimport { type DeviceManagerPropsProps } from './ConfigGeneric';\nimport ConfigTabs from './ConfigTabs';\nimport ConfigPanel from './ConfigPanel';\n\nconst styles: Record<string, React.CSSProperties> = {\n root: {\n width: '100%',\n height: '100%',\n },\n};\n\ninterface JsonConfigComponentProps {\n socket: AdminConnection;\n themeName: ThemeName;\n themeType: ThemeType;\n adapterName: string;\n instance: number;\n isFloatComma: boolean;\n dateFormat: string;\n imagePrefix?: string;\n schema: ConfigItemTabs | ConfigItemPanel;\n common?: Record<string, any>;\n data: Record<string, any>;\n updateData?: number;\n onError: (error: boolean) => void;\n onChange?: (data: Record<string, any>, changed: boolean, saveConfig: boolean) => void;\n /** Backend request to refresh data */\n onBackEndCommand?: (command?: BackEndCommand) => void;\n custom?: boolean;\n onValueChange?: (attr: string, value: any, saveConfig: boolean) => void;\n embedded?: boolean;\n multiEdit?: boolean;\n instanceObj?: ioBroker.InstanceObject;\n customObj?: ioBroker.Object;\n customs?: Record<string, typeof ConfigGeneric>;\n DeviceManager?: React.FC<DeviceManagerPropsProps>;\n style?: React.CSSProperties;\n theme: IobTheme;\n expertMode?: boolean;\n}\n\ninterface JsonConfigComponentState {\n originalData: string;\n changed: boolean;\n errors: Record<string, string>;\n systemConfig: ioBroker.SystemConfigCommon | null;\n updateData?: number;\n alive: boolean;\n commandRunning: boolean;\n schema: ConfigItemTabs | ConfigItemPanel;\n}\n\nexport class JsonConfigComponent extends Component<JsonConfigComponentProps, JsonConfigComponentState> {\n private readonly forceUpdateHandlers: Record<string, (data: any) => void>;\n\n private errorTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private errorCached: Record<string, string> | null = null;\n\n private oContext: JsonConfigContext;\n\n constructor(props: JsonConfigComponentProps) {\n super(props);\n\n this.state = {\n originalData: JSON.stringify(this.props.data),\n changed: false,\n errors: {},\n updateData: this.props.updateData || 0,\n systemConfig: null,\n alive: false,\n commandRunning: false,\n schema: JSON.parse(JSON.stringify(this.props.schema)),\n };\n\n this.forceUpdateHandlers = {};\n\n this.buildDependencies(this.state.schema);\n\n this.readData();\n }\n\n static getDerivedStateFromProps(\n props: JsonConfigComponentProps,\n state: JsonConfigComponentState,\n ): Partial<JsonConfigComponentState> | null {\n if (props.updateData !== state.updateData) {\n return {\n updateData: props.updateData,\n originalData: JSON.stringify(props.data),\n schema: JSON.parse(JSON.stringify(props.schema)),\n };\n }\n return null;\n }\n\n static async loadI18n(\n socket: AdminConnection,\n i18n: boolean | string | Record<string, Record<ioBroker.Languages, string>>,\n adapterName: string,\n ): Promise<string> {\n if (i18n === true || (i18n && typeof i18n === 'string')) {\n const lang = I18n.getLanguage();\n const path = typeof i18n === 'string' ? i18n : 'i18n';\n let exists = await socket.fileExists(`${adapterName}.admin`, `${path}/${lang}.json`);\n let fileName;\n if (exists) {\n fileName = `${path}/${lang}.json`;\n } else {\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/${lang}/translations.json`);\n if (exists) {\n fileName = `${path}/${lang}/translations.json`;\n } else if (lang !== 'en') {\n // fallback to english\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/en.json`);\n if (exists) {\n fileName = `${path}/en.json`;\n } else {\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/en/translations.json`);\n if (exists) {\n fileName = `${path}/en/translations.json`;\n }\n }\n }\n }\n\n if (fileName) {\n const jsonFile = await socket.readFile(`${adapterName}.admin`, fileName);\n let jsonStr: string;\n if (jsonFile.file !== undefined) {\n jsonStr = jsonFile.file;\n } else {\n // @ts-expect-error deprecated\n jsonStr = jsonFile;\n }\n\n try {\n const json = JSON.parse(jsonStr);\n // apply file to I18n\n I18n.extendTranslations(json, lang);\n } catch (e) {\n console.error(`Cannot parse language file \"${adapterName}.admin/${fileName}: ${e}`);\n return '';\n }\n return fileName;\n }\n console.warn(`Cannot find i18n for ${adapterName} / ${fileName}`);\n return '';\n }\n if (i18n && typeof i18n === 'object') {\n I18n.extendTranslations(i18n);\n return '';\n }\n return '';\n }\n\n onCommandRunning = (commandRunning: boolean): void => this.setState({ commandRunning });\n\n readData(): void {\n void this.props.socket\n .getCompactSystemConfig()\n .then(systemConfig =>\n this.props.socket\n .getState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`)\n .then(state =>\n this.setState({ systemConfig: systemConfig.common, alive: !!(state && state.val) }, () => {\n this.updateContext(true);\n if (!this.props.custom) {\n void this.props.socket.subscribeState(\n `system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,\n this.onAlive,\n );\n }\n }),\n ),\n )\n .catch(e => console.error(`Cannot read system config: ${e}`));\n }\n\n onAlive = (_id: string, state?: ioBroker.State | null): void => {\n if (!!state?.val !== this.state.alive) {\n this.setState({ alive: !!state?.val });\n }\n };\n\n onChange = (attrOrData: string | Record<string, any>, value: any, cb?: () => void, saveConfig?: boolean): void => {\n if (this.props.onValueChange) {\n this.props.onValueChange(attrOrData as string, value, saveConfig);\n if (cb) {\n cb();\n }\n } else if (attrOrData && this.props.onChange) {\n const newState: Partial<JsonConfigComponentState> = {\n changed: JSON.stringify(attrOrData) !== this.state.originalData,\n };\n\n this.setState(newState as JsonConfigComponentState, () => {\n this.props.onChange(attrOrData as Record<string, any>, newState.changed, saveConfig);\n if (cb) {\n cb();\n }\n });\n } else if (saveConfig) {\n this.props.onChange(null, null, saveConfig);\n }\n };\n\n onError = (attr: string, error?: string): void => {\n this.errorCached = this.errorCached || JSON.parse(JSON.stringify(this.state.errors));\n const errors = this.errorCached;\n if (error) {\n errors[attr] = error;\n } else {\n delete errors[attr];\n }\n\n if (this.errorTimeout) {\n clearTimeout(this.errorTimeout);\n }\n if (JSON.stringify(errors) !== JSON.stringify(this.state.errors)) {\n this.errorTimeout = setTimeout(\n () =>\n this.setState({ errors: this.errorCached }, () => {\n this.errorTimeout = null;\n this.errorCached = null;\n this.props.onError(!!Object.keys(this.state.errors).length);\n }),\n 50,\n );\n } else {\n this.errorCached = null;\n }\n };\n\n flatten(schema: Record<string, any>, _list?: Record<string, any>): Record<string, any> {\n _list = _list || {};\n if (schema.items) {\n Object.keys(schema.items).forEach(attr => {\n _list[attr] = schema.items[attr];\n this.flatten(schema.items[attr], _list);\n });\n }\n\n return _list;\n }\n\n buildDependencies(schema: ConfigItemTabs | ConfigItemPanel): void {\n const attrs = this.flatten(schema as Record<string, any>);\n Object.keys(attrs).forEach(attr => {\n if (attrs[attr].confirm?.alsoDependsOn) {\n attrs[attr].confirm?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].confirmDependsOn = attrs[dep].confirmDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n if (depObj.confirm) {\n depObj.confirm.cancel = 'Undo';\n }\n\n attrs[dep].confirmDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].onChange?.alsoDependsOn) {\n attrs[attr].onChange?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].onChangeDependsOn = attrs[dep].onChangeDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].onChangeDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].hidden?.alsoDependsOn) {\n attrs[attr].hidden?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].hiddenDependsOn = attrs[dep].hiddenDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].hiddenDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].label?.alsoDependsOn) {\n attrs[attr].label?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].labelDependsOn = attrs[dep].labelDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].labelDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].help?.alsoDependsOn) {\n attrs[attr].help?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].helpDependsOn = attrs[dep].helpDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].helpDependsOn.push(depObj);\n }\n });\n }\n });\n }\n\n updateContext(forceUpdate?: boolean): void {\n this.oContext = {\n DeviceManager: this.props.DeviceManager,\n adapterName: this.props.adapterName,\n changeLanguage: this.changeLanguage,\n common: this.props.common,\n customs: this.props.customs,\n dateFormat: this.props.dateFormat,\n embedded: this.props.embedded,\n expertMode: this.props.expertMode,\n forceUpdate: this.forceAttrUpdate,\n imagePrefix: this.props.imagePrefix,\n instance: this.props.instance,\n instanceObj: this.props.instanceObj,\n isFloatComma: this.props.isFloatComma,\n multiEdit: this.props.multiEdit,\n onBackEndCommand: this.props.onBackEndCommand,\n onCommandRunning: this.onCommandRunning,\n onValueChange: this.props.onValueChange,\n registerOnForceUpdate: this.registerOnForceUpdate,\n socket: this.props.socket,\n systemConfig: this.state.systemConfig,\n theme: this.props.theme,\n // could be changed dynamically\n themeType: this.props.themeType,\n _themeName: this.props.themeName,\n updateData: this.state.updateData,\n } as JsonConfigContext;\n\n if (forceUpdate) {\n this.forceUpdate();\n }\n }\n\n renderItem(item: ConfigItemTabs | ConfigItemPanel): JSX.Element | null {\n if (item.type === 'tabs') {\n return (\n <ConfigTabs\n oContext={this.oContext}\n alive={this.state.alive}\n changed={this.state.changed}\n commandRunning={this.state.commandRunning}\n common={this.props.common}\n custom={this.props.custom}\n customObj={this.props.customObj}\n data={this.props.data}\n onChange={this.onChange}\n onError={(attr, error) => this.onError(attr, error)}\n originalData={JSON.parse(this.state.originalData)}\n root\n schema={item}\n themeName={this.props.themeName}\n />\n );\n }\n if (\n item.type === 'panel' ||\n // @ts-expect-error type could be empty\n !item.type\n ) {\n return (\n <ConfigPanel\n oContext={this.oContext}\n alive={this.state.alive}\n changed={this.state.changed}\n commandRunning={this.state.commandRunning}\n common={this.props.common}\n custom={this.props.custom}\n customObj={this.props.customObj}\n data={this.props.data}\n index={1000}\n isParentTab={!this.props.embedded}\n onChange={this.onChange}\n onError={(attr, error) => this.onError(attr, error)}\n originalData={JSON.parse(this.state.originalData)}\n root\n schema={item}\n themeName={this.props.themeName}\n />\n );\n }\n console.error(`Unknown item type in root: ${JSON.stringify(item)}`);\n\n return null;\n }\n\n changeLanguage = (): void => {\n this.forceUpdate();\n };\n\n forceAttrUpdate = (attr: string | string[], data: any): void => {\n if (Array.isArray(attr)) {\n attr.forEach(a => this.forceUpdateHandlers[a] && this.forceUpdateHandlers[a](data));\n } else if (this.forceUpdateHandlers[attr]) {\n this.forceUpdateHandlers[attr](data);\n }\n };\n\n registerOnForceUpdate = (attr: string, cb?: ((data: any) => void) | null): void => {\n if (cb) {\n this.forceUpdateHandlers[attr] = cb;\n } else if (this.forceUpdateHandlers[attr]) {\n delete this.forceUpdateHandlers[attr];\n }\n };\n\n render(): JSX.Element {\n if (!this.state.systemConfig || !this.oContext) {\n return <LinearProgress />;\n }\n\n if (this.oContext._themeName !== this.props.themeName) {\n this.oContext._themeName = this.props.themeName;\n setTimeout(() => this.updateContext(true), 0);\n }\n\n return (\n <div\n style={{\n ...(!this.props.embedded ? styles.root : undefined),\n ...this.props.style,\n ...this.state.schema.style,\n }}\n >\n {this.renderItem(this.state.schema)}\n </div>\n );\n }\n}\n\nexport default JsonConfigComponent;\n"]}
|