@iobroker/json-config 7.4.2 → 7.4.3
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 +7 -6
- package/build/JsonConfig.d.ts +1 -0
- package/build/JsonConfig.js +1 -1
- package/build/JsonConfig.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAccordion.js +8 -5
- package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAlive.js +4 -4
- package/build/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +10 -10
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCRON.js +2 -2
- package/build/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertCollection.js +1 -1
- package/build/JsonConfigComponent/ConfigCertCollection.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertificateSelect.js +1 -1
- package/build/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertificates.js +2 -2
- package/build/JsonConfigComponent/ConfigCertificates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckLicense.js +7 -7
- package/build/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigChip.js +1 -1
- package/build/JsonConfigComponent/ConfigChip.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.js +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCustom.js +2 -2
- package/build/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigDatePicker.js +1 -1
- package/build/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigDeviceManager.js +3 -3
- package/build/JsonConfigComponent/ConfigDeviceManager.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFile.js +9 -9
- package/build/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFileSelector.js +10 -10
- package/build/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFunc.js +3 -3
- package/build/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.d.ts +4 -23
- package/build/JsonConfigComponent/ConfigGeneric.js +41 -33
- package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIP.js +1 -1
- package/build/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.js +10 -10
- package/build/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageUpload.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigImageUpload.js +7 -7
- package/build/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInstanceSelect.js +3 -3
- package/build/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInterface.js +1 -1
- package/build/JsonConfigComponent/ConfigInterface.js.map +1 -1
- package/build/JsonConfigComponent/ConfigJsonEditor.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigJsonEditor.js +3 -3
- package/build/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLanguage.js +5 -5
- package/build/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLicense.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigLicense.js +4 -3
- package/build/JsonConfigComponent/ConfigLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigNumber.js +2 -2
- package/build/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.js +4 -3
- package/build/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPanel.js +10 -10
- package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPattern.js +2 -2
- package/build/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPort.js +3 -3
- package/build/JsonConfigComponent/ConfigPort.js.map +1 -1
- package/build/JsonConfigComponent/ConfigRoom.js +3 -3
- package/build/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelect.js +1 -1
- package/build/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.js +11 -11
- package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSendto.js +12 -12
- package/build/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSetState.js +4 -4
- package/build/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigState.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigState.js +18 -18
- package/build/JsonConfigComponent/ConfigState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticDivider.js +2 -2
- package/build/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticImage.js +3 -3
- package/build/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticInfo.js +6 -6
- package/build/JsonConfigComponent/ConfigStaticInfo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticText.js +6 -6
- package/build/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTable.js +5 -5
- package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTabs.js +7 -9
- package/build/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/build/JsonConfigComponent/ConfigText.js +4 -4
- package/build/JsonConfigComponent/ConfigText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigTextSendTo.js +11 -11
- package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTimePicker.js +1 -1
- package/build/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTopic.js +1 -1
- package/build/JsonConfigComponent/ConfigTopic.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUUID.js +1 -1
- package/build/JsonConfigComponent/ConfigUUID.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUser.js +3 -3
- package/build/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/build/JsonConfigComponent/index.d.ts +4 -1
- package/build/JsonConfigComponent/index.js +46 -10
- package/build/JsonConfigComponent/index.js.map +1 -1
- package/build/types.d.ts +37 -1
- package/package.json +5 -5
|
@@ -30,6 +30,7 @@ interface JsonConfigComponentProps {
|
|
|
30
30
|
DeviceManager?: React.FC<DeviceManagerPropsProps>;
|
|
31
31
|
style?: React.CSSProperties;
|
|
32
32
|
theme: IobTheme;
|
|
33
|
+
expertMode?: boolean;
|
|
33
34
|
}
|
|
34
35
|
interface JsonConfigComponentState {
|
|
35
36
|
originalData: string;
|
|
@@ -45,6 +46,7 @@ export declare class JsonConfigComponent extends Component<JsonConfigComponentPr
|
|
|
45
46
|
private readonly forceUpdateHandlers;
|
|
46
47
|
private errorTimeout;
|
|
47
48
|
private errorCached;
|
|
49
|
+
private oContext;
|
|
48
50
|
constructor(props: JsonConfigComponentProps);
|
|
49
51
|
static getDerivedStateFromProps(props: JsonConfigComponentProps, state: JsonConfigComponentState): Partial<JsonConfigComponentState> | null;
|
|
50
52
|
static loadI18n(socket: AdminConnection, i18n: boolean | string | Record<string, Record<ioBroker.Languages, string>>, adapterName: string): Promise<string>;
|
|
@@ -55,10 +57,11 @@ export declare class JsonConfigComponent extends Component<JsonConfigComponentPr
|
|
|
55
57
|
onError: (attr: string, error?: string) => void;
|
|
56
58
|
flatten(schema: Record<string, any>, _list?: Record<string, any>): Record<string, any>;
|
|
57
59
|
buildDependencies(schema: ConfigItemTabs | ConfigItemPanel): void;
|
|
60
|
+
updateContext(forceUpdate?: boolean): void;
|
|
58
61
|
renderItem(item: ConfigItemTabs | ConfigItemPanel): JSX.Element | null;
|
|
59
62
|
changeLanguage: () => void;
|
|
60
63
|
forceAttrUpdate: (attr: string | string[], data: any) => void;
|
|
61
|
-
registerOnForceUpdate: (attr: string, cb
|
|
64
|
+
registerOnForceUpdate: (attr: string, cb?: (data: any) => void) => void;
|
|
62
65
|
render(): JSX.Element;
|
|
63
66
|
}
|
|
64
67
|
export default JsonConfigComponent;
|
|
@@ -13,6 +13,7 @@ export class JsonConfigComponent extends Component {
|
|
|
13
13
|
forceUpdateHandlers;
|
|
14
14
|
errorTimeout = null;
|
|
15
15
|
errorCached = null;
|
|
16
|
+
oContext;
|
|
16
17
|
constructor(props) {
|
|
17
18
|
super(props);
|
|
18
19
|
this.state = {
|
|
@@ -103,14 +104,12 @@ export class JsonConfigComponent extends Component {
|
|
|
103
104
|
.getCompactSystemConfig()
|
|
104
105
|
.then(systemConfig => this.props.socket
|
|
105
106
|
.getState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`)
|
|
106
|
-
.then(state => {
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
.then(state => this.setState({ systemConfig: systemConfig.common, alive: !!(state && state.val) }, () => {
|
|
108
|
+
this.updateContext(true);
|
|
109
|
+
if (!this.props.custom) {
|
|
110
|
+
void this.props.socket.subscribeState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`, this.onAlive);
|
|
109
111
|
}
|
|
110
|
-
|
|
111
|
-
this.setState({ systemConfig: systemConfig.common, alive: !!(state && state.val) }, () => this.props.socket.subscribeState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`, this.onAlive));
|
|
112
|
-
}
|
|
113
|
-
}))
|
|
112
|
+
})))
|
|
114
113
|
.catch(e => console.error(`Cannot read system config: ${e}`));
|
|
115
114
|
}
|
|
116
115
|
onAlive = (_id, state) => {
|
|
@@ -256,15 +255,48 @@ export class JsonConfigComponent extends Component {
|
|
|
256
255
|
}
|
|
257
256
|
});
|
|
258
257
|
}
|
|
258
|
+
updateContext(forceUpdate) {
|
|
259
|
+
this.oContext = {
|
|
260
|
+
DeviceManager: this.props.DeviceManager,
|
|
261
|
+
adapterName: this.props.adapterName,
|
|
262
|
+
changeLanguage: this.changeLanguage,
|
|
263
|
+
common: this.props.common,
|
|
264
|
+
customs: this.props.customs,
|
|
265
|
+
dateFormat: this.props.dateFormat,
|
|
266
|
+
embedded: this.props.embedded,
|
|
267
|
+
expertMode: this.props.expertMode,
|
|
268
|
+
forceUpdate: this.forceAttrUpdate,
|
|
269
|
+
imagePrefix: this.props.imagePrefix,
|
|
270
|
+
instance: this.props.instance,
|
|
271
|
+
instanceObj: this.props.instanceObj,
|
|
272
|
+
isFloatComma: this.props.isFloatComma,
|
|
273
|
+
multiEdit: this.props.multiEdit,
|
|
274
|
+
onBackEndCommand: this.props.onBackEndCommand,
|
|
275
|
+
onCommandRunning: this.onCommandRunning,
|
|
276
|
+
onValueChange: this.props.onValueChange,
|
|
277
|
+
registerOnForceUpdate: this.registerOnForceUpdate,
|
|
278
|
+
socket: this.props.socket,
|
|
279
|
+
systemConfig: this.state.systemConfig,
|
|
280
|
+
theme: this.props.theme,
|
|
281
|
+
// could be changed dynamically
|
|
282
|
+
themeType: this.props.themeType,
|
|
283
|
+
_themeName: this.props.themeName,
|
|
284
|
+
updateData: this.state.updateData,
|
|
285
|
+
};
|
|
286
|
+
if (forceUpdate) {
|
|
287
|
+
this.forceUpdate();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
259
290
|
renderItem(item) {
|
|
260
291
|
if (item.type === 'tabs') {
|
|
261
|
-
return (React.createElement(ConfigTabs, {
|
|
292
|
+
return (React.createElement(ConfigTabs, { oContext: this.oContext, alive: this.state.alive, changed: this.state.changed, commandRunning: this.state.commandRunning, common: this.props.common, custom: this.props.custom, customObj: this.props.customObj, data: this.props.data, onChange: this.onChange, onError: (attr, error) => this.onError(attr, error), originalData: JSON.parse(this.state.originalData), root: true, schema: item, themeName: this.props.themeName }));
|
|
262
293
|
}
|
|
263
294
|
if (item.type === 'panel' ||
|
|
264
295
|
// @ts-expect-error type could be empty
|
|
265
296
|
!item.type) {
|
|
266
|
-
return (React.createElement(ConfigPanel, {
|
|
297
|
+
return (React.createElement(ConfigPanel, { oContext: this.oContext, alive: this.state.alive, changed: this.state.changed, commandRunning: this.state.commandRunning, common: this.props.common, custom: this.props.custom, customObj: this.props.customObj, data: this.props.data, index: 1000, isParentTab: !this.props.embedded, onChange: this.onChange, onError: (attr, error) => this.onError(attr, error), originalData: JSON.parse(this.state.originalData), root: true, schema: item, themeName: this.props.themeName }));
|
|
267
298
|
}
|
|
299
|
+
console.error(`Unknown item type in root: ${JSON.stringify(item)}`);
|
|
268
300
|
return null;
|
|
269
301
|
}
|
|
270
302
|
changeLanguage = () => {
|
|
@@ -287,9 +319,13 @@ export class JsonConfigComponent extends Component {
|
|
|
287
319
|
}
|
|
288
320
|
};
|
|
289
321
|
render() {
|
|
290
|
-
if (!this.state.systemConfig) {
|
|
322
|
+
if (!this.state.systemConfig || !this.oContext) {
|
|
291
323
|
return React.createElement(LinearProgress, null);
|
|
292
324
|
}
|
|
325
|
+
if (this.oContext._themeName !== this.props.themeName) {
|
|
326
|
+
this.oContext._themeName = this.props.themeName;
|
|
327
|
+
setTimeout(() => this.updateContext(true), 0);
|
|
328
|
+
}
|
|
293
329
|
return (React.createElement("div", { style: {
|
|
294
330
|
...(!this.props.embedded ? styles.root : undefined),
|
|
295
331
|
...this.props.style,
|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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 } from '#JC/types';\nimport type ConfigGeneric from '#JC/JsonConfigComponent/ConfigGeneric';\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}\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 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 if (this.props.custom) {\n this.setState({ systemConfig: systemConfig.common, alive: !!(state && state.val) });\n } else {\n this.setState({ systemConfig: systemConfig.common, alive: !!(state && state.val) }, () =>\n 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 renderItem(item: ConfigItemTabs | ConfigItemPanel): JSX.Element | null {\n if (item.type === 'tabs') {\n return (\n <ConfigTabs\n DeviceManager={this.props.DeviceManager}\n adapterName={this.props.adapterName}\n alive={this.state.alive}\n changeLanguage={this.changeLanguage}\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 customs={this.props.customs}\n data={this.props.data}\n dateFormat={this.props.dateFormat}\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 onChange={this.onChange}\n onCommandRunning={this.onCommandRunning}\n onError={(attr, error) => this.onError(attr, error)}\n onBackEndCommand={this.props.onBackEndCommand}\n originalData={JSON.parse(this.state.originalData)}\n registerOnForceUpdate={this.registerOnForceUpdate}\n root\n schema={item}\n socket={this.props.socket}\n systemConfig={this.state.systemConfig}\n theme={this.props.theme}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\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 DeviceManager={this.props.DeviceManager}\n adapterName={this.props.adapterName}\n alive={this.state.alive}\n changeLanguage={this.changeLanguage}\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 customs={this.props.customs}\n data={this.props.data}\n dateFormat={this.props.dateFormat}\n forceUpdate={this.forceAttrUpdate}\n imagePrefix={this.props.imagePrefix}\n index={1000}\n instance={this.props.instance}\n instanceObj={this.props.instanceObj}\n isFloatComma={this.props.isFloatComma}\n isParentTab={!this.props.embedded}\n multiEdit={this.props.multiEdit}\n onChange={this.onChange}\n onCommandRunning={this.onCommandRunning}\n onError={(attr, error) => this.onError(attr, error)}\n onBackEndCommand={this.props.onBackEndCommand}\n originalData={JSON.parse(this.state.originalData)}\n registerOnForceUpdate={this.registerOnForceUpdate}\n root\n schema={item}\n socket={this.props.socket}\n systemConfig={this.state.systemConfig}\n theme={this.props.theme}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\n />\n );\n }\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): 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) {\n return <LinearProgress />;\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;AAKvH,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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AAC,IAAY,EAAE,EAAiC,EAAQ,EAAE;QAC9E,IAAI,EAAE,EAAE;YACJ,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SACvC;aAAM,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE;YACvC,OAAO,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;SACzC;IACL,CAAC,CAAC;IAEF,MAAM;QACF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAC5C,OAAO,oBAAC,cAAc,OAAG,CAAC;SAC7B;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;YACnD,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;SACjD;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';\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"]}
|
package/build/types.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
AdminConnection,
|
|
4
|
+
IobTheme,
|
|
5
|
+
ObjectBrowserCustomFilter,
|
|
6
|
+
ObjectBrowserType,
|
|
7
|
+
ThemeType,
|
|
8
|
+
} from '@iobroker/adapter-react-v5';
|
|
9
|
+
import type { ConfigGeneric, DeviceManagerPropsProps } from '#JC/JsonConfigComponent/ConfigGeneric';
|
|
3
10
|
|
|
4
11
|
declare module '@mui/material/Button' {
|
|
5
12
|
interface ButtonPropsColorOverrides {
|
|
@@ -168,6 +175,8 @@ export interface ConfigItem {
|
|
|
168
175
|
ignoreOwnChanges?: boolean;
|
|
169
176
|
};
|
|
170
177
|
doNotSave?: boolean;
|
|
178
|
+
/** If the control should be shown ONLY in the expert mode */
|
|
179
|
+
expertMode?: boolean;
|
|
171
180
|
noMultiEdit?: boolean;
|
|
172
181
|
confirm?: ConfigItemConfirmData;
|
|
173
182
|
icon?: ConfigIconType;
|
|
@@ -994,6 +1003,33 @@ export type ConfigItemAny =
|
|
|
994
1003
|
| ConfigItemObjectId
|
|
995
1004
|
| ConfigItemQrCode;
|
|
996
1005
|
|
|
1006
|
+
export type JsonConfigContext = {
|
|
1007
|
+
DeviceManager?: React.FC<DeviceManagerPropsProps>;
|
|
1008
|
+
adapterName: string;
|
|
1009
|
+
changeLanguage?: () => void;
|
|
1010
|
+
customs?: Record<string, typeof ConfigGeneric>;
|
|
1011
|
+
dateFormat: string;
|
|
1012
|
+
embedded?: boolean;
|
|
1013
|
+
expertMode?: boolean;
|
|
1014
|
+
forceUpdate: (attr: string | string[], data: any) => void;
|
|
1015
|
+
imagePrefix?: string;
|
|
1016
|
+
instance: number;
|
|
1017
|
+
instanceObj?: ioBroker.InstanceObject;
|
|
1018
|
+
isFloatComma: boolean;
|
|
1019
|
+
/** If true, this field edits multiple data points at once and thus contains an array, should not be saved if not changed */
|
|
1020
|
+
multiEdit?: boolean;
|
|
1021
|
+
/** Backend request to refresh data */
|
|
1022
|
+
onBackEndCommand?: (command?: BackEndCommand) => void;
|
|
1023
|
+
onCommandRunning: (commandRunning: boolean) => void;
|
|
1024
|
+
onValueChange?: (attr: string, value: any, saveConfig: boolean) => void;
|
|
1025
|
+
registerOnForceUpdate?: (attr: string, cb?: (data: any) => void) => void;
|
|
1026
|
+
socket: AdminConnection;
|
|
1027
|
+
systemConfig: ioBroker.SystemConfigCommon;
|
|
1028
|
+
theme: IobTheme;
|
|
1029
|
+
themeType: ThemeType;
|
|
1030
|
+
_themeName: ThemeName;
|
|
1031
|
+
};
|
|
1032
|
+
|
|
997
1033
|
// Notification GUI
|
|
998
1034
|
|
|
999
1035
|
export type BackEndCommandType = 'nop' | 'refresh' | 'link' | 'message';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/json-config",
|
|
3
3
|
"description": "This package contains the ioBroker JSON config UI components",
|
|
4
|
-
"version": "7.4.
|
|
4
|
+
"version": "7.4.3",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@iobroker/adapter-react-v5": "7.4.
|
|
22
|
-
"@mui/x-date-pickers": "^7.
|
|
21
|
+
"@iobroker/adapter-react-v5": "7.4.3",
|
|
22
|
+
"@mui/x-date-pickers": "^7.23.0",
|
|
23
23
|
"crypto-js": "^4.2.0",
|
|
24
|
-
"react-ace": "^
|
|
24
|
+
"react-ace": "^13.0.0",
|
|
25
25
|
"react-qr-code": "^2.0.15"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"build/",
|
|
35
35
|
"LICENSE"
|
|
36
36
|
],
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "a36a282da4418ffd052c700aa871ae9381b087d3"
|
|
38
38
|
}
|