@iobroker/json-config 8.3.12 → 8.4.0
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 +5 -1
- package/build/JsonConfigComponent/ConfigAccordion.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigAccordion.js +21 -19
- package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAlive.d.ts +3 -1
- package/build/JsonConfigComponent/ConfigAlive.js +22 -10
- package/build/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocomplete.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigAutocomplete.js +2 -2
- package/build/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +3 -3
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCRON.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigCRON.js +2 -2
- package/build/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertCollection.js +2 -2
- 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/ConfigCheckDocker.js +1 -1
- package/build/JsonConfigComponent/ConfigCheckDocker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckLicense.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigCheckLicense.js +7 -7
- package/build/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigChip.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigChip.js +2 -2
- package/build/JsonConfigComponent/ConfigChip.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.js +3 -3
- package/build/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigDatePicker.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigDatePicker.js +2 -2
- package/build/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFile.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigFile.js +2 -2
- package/build/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFileSelector.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigFileSelector.js +2 -2
- package/build/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFunc.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigFunc.js +2 -2
- package/build/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.d.ts +22 -7
- package/build/JsonConfigComponent/ConfigGeneric.js +166 -52
- package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIFrame.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigIFrame.js +2 -2
- package/build/JsonConfigComponent/ConfigIFrame.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIFrameSendTo.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js +6 -6
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIP.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigIP.js +2 -2
- package/build/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigImageSendTo.js +6 -6
- package/build/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageUpload.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigImageUpload.js +2 -2
- package/build/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInstanceSelect.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigInstanceSelect.js +2 -2
- package/build/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInterface.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigInterface.js +5 -5
- package/build/JsonConfigComponent/ConfigInterface.js.map +1 -1
- package/build/JsonConfigComponent/ConfigJsonEditor.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigJsonEditor.js +2 -2
- package/build/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLanguage.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigLanguage.js +2 -2
- package/build/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLicense.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigLicense.js +2 -2
- package/build/JsonConfigComponent/ConfigLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigNumber.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigNumber.js +2 -2
- package/build/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/build/JsonConfigComponent/ConfigOAuth2.js +1 -1
- package/build/JsonConfigComponent/ConfigOAuth2.js.map +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.js +3 -3
- package/build/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPanel.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigPanel.js +11 -8
- package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPassword.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigPassword.js +2 -2
- package/build/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPattern.d.ts +8 -1
- package/build/JsonConfigComponent/ConfigPattern.js +29 -3
- package/build/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPort.js +2 -2
- package/build/JsonConfigComponent/ConfigPort.js.map +1 -1
- package/build/JsonConfigComponent/ConfigQrCode.js +1 -1
- package/build/JsonConfigComponent/ConfigQrCode.js.map +1 -1
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js +5 -5
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigRoom.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigRoom.js +2 -2
- package/build/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelect.d.ts +13 -11
- package/build/JsonConfigComponent/ConfigSelect.js +35 -29
- package/build/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.d.ts +16 -11
- package/build/JsonConfigComponent/ConfigSelectSendTo.js +26 -23
- package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSendto.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigSendto.js +8 -8
- package/build/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSetState.js +2 -2
- package/build/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSlider.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigSlider.js +2 -2
- package/build/JsonConfigComponent/ConfigSlider.js.map +1 -1
- package/build/JsonConfigComponent/ConfigState.d.ts +2 -1
- package/build/JsonConfigComponent/ConfigState.js +32 -26
- package/build/JsonConfigComponent/ConfigState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTable.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigTable.js +21 -19
- package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTabs.d.ts +6 -0
- package/build/JsonConfigComponent/ConfigTabs.js +57 -21
- package/build/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/build/JsonConfigComponent/ConfigText.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigText.js +2 -2
- package/build/JsonConfigComponent/ConfigText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.js +3 -3
- package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTimePicker.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigTimePicker.js +2 -2
- package/build/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTopic.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigTopic.js +2 -2
- package/build/JsonConfigComponent/ConfigTopic.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUUID.js +2 -2
- package/build/JsonConfigComponent/ConfigUUID.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUser.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigUser.js +2 -2
- package/build/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/build/JsonConfigComponent/ConfigYamlEditor.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigYamlEditor.js +2 -2
- package/build/JsonConfigComponent/ConfigYamlEditor.js.map +1 -1
- package/build/JsonConfigComponent/index.d.ts +2 -0
- package/build/JsonConfigComponent/index.js +16 -1
- package/build/JsonConfigComponent/index.js.map +1 -1
- package/build/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigRoom.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigRoom.tsx"],"names":[],"m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,GAAG,EACb,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,EACxC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,GAC1B,CACL,CAAC,CAAC,CAAC,CACA,EAAE,CAAC,KAAK,CACX,CACM,CACd,CAAC,CACG;YACR,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, MenuItem, FormHelperText, FormControl, Select } from '@mui/material';\n\nimport { TextWithIcon, I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemRoom } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigRoomProps extends ConfigGenericProps {\n schema: ConfigItemRoom;\n}\n\ninterface ConfigRoomState extends ConfigGenericState {\n selectOptions?: { value: string; label: string; obj?: ioBroker.EnumObject }[];\n}\n\nclass ConfigRoom extends ConfigGeneric<ConfigRoomProps, ConfigRoomState> {\n async componentDidMount(): Promise<void> {\n await super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n void this.props.oContext.socket\n .getEnums('rooms')\n .then(enums => {\n const selectOptions: { value: string; label: string; obj?: ioBroker.EnumObject }[] = Object.keys(\n enums,\n ).map(id => ({\n value: this.props.schema.short ? id.replace('enum.rooms.', '') : id,\n label: this.getText(enums[id].common.name),\n obj: enums[id],\n }));\n\n if (this.props.schema.allowDeactivate !== false) {\n selectOptions.unshift({ label: I18n.t(ConfigGeneric.NONE_LABEL), value: ConfigGeneric.NONE_VALUE });\n }\n\n this.setState({ value, selectOptions });\n })\n .catch(e => console.error(`Cannot get enums: ${e}`));\n }\n\n renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (!this.state.selectOptions) {\n return null;\n }\n\n const item = this.state.selectOptions.find(it => it.value === this.state.value);\n\n return (\n <FormControl\n variant=\"standard\"\n fullWidth\n >\n {this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={this.state.value || '_'}\n renderValue={() =>\n item ? (\n item.obj ? (\n <TextWithIcon\n value={item.obj}\n themeType={this.props.oContext.themeType}\n lang={I18n.getLanguage()}\n />\n ) : (\n item.label\n )\n ) : (\n ''\n )\n }\n onChange={e => {\n this.setState({ value: e.target.value === '_' ? '' : e.target.value }, () =>\n this.onChange(this.props.attr, this.state.value),\n );\n }}\n >\n {this.state.selectOptions.map(it => (\n <MenuItem\n key={it.value}\n value={it.value}\n style={it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {}}\n >\n {it.obj ? (\n <TextWithIcon\n value={it.obj}\n themeType={this.props.oContext.themeType}\n lang={I18n.getLanguage()}\n />\n ) : (\n it.label\n )}\n </MenuItem>\n ))}\n </Select>\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 ConfigRoom;\n"]}
|
|
@@ -4,22 +4,24 @@ import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from
|
|
|
4
4
|
interface ConfigInstanceSelectProps extends ConfigGenericProps {
|
|
5
5
|
schema: ConfigItemSelect;
|
|
6
6
|
}
|
|
7
|
+
interface SelectItem {
|
|
8
|
+
label: string;
|
|
9
|
+
value: number | string;
|
|
10
|
+
group?: boolean;
|
|
11
|
+
hidden?: string | boolean;
|
|
12
|
+
color?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
icon?: string;
|
|
15
|
+
hiddenValue?: boolean;
|
|
16
|
+
}
|
|
7
17
|
interface ConfigInstanceSelectState extends ConfigGenericState {
|
|
8
|
-
selectOptions?:
|
|
9
|
-
label: string;
|
|
10
|
-
value: number | string;
|
|
11
|
-
group?: boolean;
|
|
12
|
-
hidden?: string | boolean;
|
|
13
|
-
color?: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
icon?: string;
|
|
16
|
-
}[];
|
|
18
|
+
selectOptions?: SelectItem[];
|
|
17
19
|
}
|
|
18
20
|
export default class ConfigSelect extends ConfigGeneric<ConfigInstanceSelectProps, ConfigInstanceSelectState> {
|
|
19
21
|
private initialValue;
|
|
20
|
-
componentDidMount(): void
|
|
22
|
+
componentDidMount(): Promise<void>;
|
|
21
23
|
_getValue(): string | string[];
|
|
22
|
-
|
|
24
|
+
private isHidden;
|
|
23
25
|
renderRadio(error: string, disabled: boolean): JSX.Element;
|
|
24
26
|
renderItem(error: string, disabled: boolean): JSX.Element;
|
|
25
27
|
}
|
|
@@ -19,8 +19,8 @@ const styles = {
|
|
|
19
19
|
};
|
|
20
20
|
export default class ConfigSelect extends ConfigGeneric {
|
|
21
21
|
initialValue = '';
|
|
22
|
-
componentDidMount() {
|
|
23
|
-
super.componentDidMount();
|
|
22
|
+
async componentDidMount() {
|
|
23
|
+
await super.componentDidMount();
|
|
24
24
|
let value = ConfigGeneric.getValue(this.props.data, this.props.attr);
|
|
25
25
|
if (this.props.schema.multiple) {
|
|
26
26
|
if (typeof value === 'string') {
|
|
@@ -31,37 +31,45 @@ export default class ConfigSelect extends ConfigGeneric {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
const selectOptions = [];
|
|
34
|
-
(this.props.schema.options || [])
|
|
34
|
+
for (const item of this.props.schema.options || []) {
|
|
35
35
|
// if optgroup
|
|
36
36
|
const groupItem = item;
|
|
37
37
|
if (Array.isArray(groupItem.items)) {
|
|
38
|
-
|
|
38
|
+
const selectItem = {
|
|
39
39
|
label: this.getText(item.label, this.props.schema.noTranslation),
|
|
40
40
|
value: item.value,
|
|
41
41
|
group: true,
|
|
42
42
|
color: item.color,
|
|
43
43
|
description: this.getText(item.description),
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
};
|
|
45
|
+
selectItem.hiddenValue = await this.isHidden(selectItem);
|
|
46
|
+
selectOptions.push(selectItem);
|
|
47
|
+
for (const it of groupItem.items) {
|
|
48
|
+
const selectSubItem = {
|
|
49
|
+
label: this.getText(it.label, this.props.schema.noTranslation),
|
|
50
|
+
value: it.value,
|
|
51
|
+
hidden: it.hidden,
|
|
52
|
+
color: item.color,
|
|
53
|
+
description: this.getText(item.description),
|
|
54
|
+
icon: it.icon,
|
|
55
|
+
};
|
|
56
|
+
selectSubItem.hiddenValue = await this.isHidden(selectSubItem);
|
|
57
|
+
selectOptions.push(selectSubItem);
|
|
58
|
+
}
|
|
53
59
|
}
|
|
54
60
|
else {
|
|
55
|
-
|
|
61
|
+
const selectItem = {
|
|
56
62
|
label: this.getText(item.label, this.props.schema.noTranslation),
|
|
57
63
|
value: item.value,
|
|
58
64
|
hidden: item.hidden,
|
|
59
65
|
color: item.color,
|
|
60
66
|
description: this.getText(item.description),
|
|
61
67
|
icon: item.icon,
|
|
62
|
-
}
|
|
68
|
+
};
|
|
69
|
+
selectItem.hiddenValue = await this.isHidden(selectItem);
|
|
70
|
+
selectOptions.push(selectItem);
|
|
63
71
|
}
|
|
64
|
-
}
|
|
72
|
+
}
|
|
65
73
|
// Report value-to-label mapping to parent table for filtering
|
|
66
74
|
if (this.props.onFilterLabelUpdate && this.props.table) {
|
|
67
75
|
const valueToLabel = {};
|
|
@@ -99,20 +107,18 @@ export default class ConfigSelect extends ConfigGeneric {
|
|
|
99
107
|
}
|
|
100
108
|
return value;
|
|
101
109
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return !this.execute(item.hidden, this.props.schema.default, this.props.data, this.props.arrayIndex, this.props.globalData);
|
|
112
|
-
});
|
|
110
|
+
async isHidden(item) {
|
|
111
|
+
// if optgroup or no hidden function
|
|
112
|
+
if (!item.hidden) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
if (this.props.custom) {
|
|
116
|
+
return !!(await this.executeCustom(item.hidden, this.props.data, this.props.customObj, this.props.oContext.instanceObj, this.props.arrayIndex, this.props.globalData));
|
|
117
|
+
}
|
|
118
|
+
return !!(await this.execute(item.hidden, this.props.schema.default, this.props.data, this.props.arrayIndex, this.props.globalData));
|
|
113
119
|
}
|
|
114
120
|
renderRadio(error, disabled) {
|
|
115
|
-
const selectOptions = this.
|
|
121
|
+
const selectOptions = this.state.selectOptions.filter(it => !it.hiddenValue && !it.group);
|
|
116
122
|
const value = this._getValue();
|
|
117
123
|
return (React.createElement(FormControl, { fullWidth: true, error: !!error, disabled: !!disabled, id: `jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}` },
|
|
118
124
|
this.props.schema.label ? React.createElement(FormLabel, null, this.getText(this.props.schema.label)) : null,
|
|
@@ -138,7 +144,7 @@ export default class ConfigSelect extends ConfigGeneric {
|
|
|
138
144
|
if (this.props.schema.format === 'radio') {
|
|
139
145
|
return this.renderRadio(error, disabled);
|
|
140
146
|
}
|
|
141
|
-
const selectOptions = this.
|
|
147
|
+
const selectOptions = this.state.selectOptions.filter(it => !it.hiddenValue);
|
|
142
148
|
const value = this._getValue();
|
|
143
149
|
const item = this.props.schema.multiple ? null : selectOptions.find(it => it.value == value); // let "==" be and not ===
|
|
144
150
|
return (React.createElement(FormControl, { variant: "standard", fullWidth: true, sx: this.props.table !== undefined && styles.noMargin, id: `jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}` },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigSelect.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,UAAU,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,UAAU,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGxD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwB;IAChC,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;IACD,QAAQ,EAAE;QACN,OAAO,EAAE;YACL,SAAS,EAAE,CAAC;SACf;KACJ;IACD,IAAI,EAAE;QACF,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,CAAC;KACjB;CACJ,CAAC;AAkBF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,aAAmE;IACjG,YAAY,GAAsB,EAAE,CAAC;IAE7C,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,KAAK,GAAsB,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAExF,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC5B,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC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c,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","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n FormHelperText,\n FormControl,\n FormLabel,\n Select,\n MenuItem,\n ListSubheader,\n Chip,\n ListItemText,\n Checkbox,\n RadioGroup,\n Radio,\n FormControlLabel,\n Typography,\n} from '@mui/material';\n\nimport { I18n, Icon } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSelect, ConfigItemSelectOption } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, any> = {\n fullWidth: {\n width: '100%',\n },\n noMargin: {\n '&>div': {\n marginTop: 0,\n },\n },\n icon: {\n width: 20,\n height: 20,\n marginRight: 4,\n },\n};\n\ninterface ConfigInstanceSelectProps extends ConfigGenericProps {\n schema: ConfigItemSelect;\n}\n\ninterface ConfigInstanceSelectState extends ConfigGenericState {\n selectOptions?: {\n label: string;\n value: number | string;\n group?: boolean;\n hidden?: string | boolean;\n color?: string;\n description?: string;\n icon?: string;\n }[];\n}\n\nexport default class ConfigSelect extends ConfigGeneric<ConfigInstanceSelectProps, ConfigInstanceSelectState> {\n private initialValue: string | string[] = '';\n\n componentDidMount(): void {\n super.componentDidMount();\n let value: string | string[] = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n const selectOptions: {\n label: string;\n value: number | string;\n group?: boolean;\n hidden?: string | boolean;\n color?: string;\n description?: string;\n icon?: string;\n }[] = [];\n\n (this.props.schema.options || []).forEach(item => {\n // if optgroup\n const groupItem: {\n items: ConfigItemSelectOption[];\n label: ioBroker.StringOrTranslated;\n value?: number | string;\n hidden?: string | boolean;\n description?: string;\n } = item as {\n items: ConfigItemSelectOption[];\n label: ioBroker.StringOrTranslated;\n value?: number | string;\n hidden?: string | boolean;\n description?: string;\n };\n if (Array.isArray(groupItem.items)) {\n selectOptions.push({\n label: this.getText(item.label, this.props.schema.noTranslation),\n value: item.value,\n group: true,\n color: item.color,\n description: this.getText(item.description),\n });\n groupItem.items.forEach(it =>\n selectOptions.push({\n label: this.getText(it.label, this.props.schema.noTranslation),\n value: it.value,\n hidden: it.hidden,\n color: item.color,\n description: this.getText(item.description),\n icon: it.icon,\n }),\n );\n } else {\n selectOptions.push({\n label: this.getText(item.label, this.props.schema.noTranslation),\n value: item.value,\n hidden: item.hidden,\n color: item.color,\n description: this.getText(item.description),\n icon: item.icon,\n });\n }\n });\n\n // Report value-to-label mapping to parent table for filtering\n if (this.props.onFilterLabelUpdate && this.props.table) {\n const valueToLabel: Record<string, string> = {};\n for (const opt of selectOptions) {\n if (!opt.group && opt.value !== ConfigGeneric.DIFFERENT_VALUE) {\n valueToLabel[opt.value.toString()] = opt.label;\n }\n }\n this.props.onFilterLabelUpdate(this.props.attr, valueToLabel);\n }\n\n // if __different\n if (Array.isArray(value) && !this.props.schema.multiple) {\n this.initialValue = [...value];\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions });\n } else {\n this.setState({ value, selectOptions });\n }\n }\n\n _getValue(): string | string[] {\n let value =\n this.state.value === null || this.state.value === undefined\n ? ConfigGeneric.getValue(this.props.data, this.props.attr)\n : this.state.value;\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n return value;\n }\n\n _filterOptions(\n selectOptions: ConfigInstanceSelectState['selectOptions'],\n ): ConfigInstanceSelectState['selectOptions'] {\n return (selectOptions || []).filter(item => {\n // if optgroup or no hidden function\n if (!item.hidden) {\n return true;\n }\n\n if (this.props.custom) {\n return !this.executeCustom(\n item.hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n );\n }\n return !this.execute(\n item.hidden,\n this.props.schema.default,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n );\n });\n }\n\n renderRadio(error: string, disabled: boolean): JSX.Element {\n const selectOptions = this._filterOptions(this.state.selectOptions).filter(it => !it.group);\n const value = this._getValue();\n\n return (\n <FormControl\n fullWidth\n error={!!error}\n disabled={!!disabled}\n id={`jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}`}\n >\n {this.props.schema.label ? <FormLabel>{this.getText(this.props.schema.label)}</FormLabel> : null}\n <RadioGroup\n row={!!this.props.schema.horizontal}\n value={value === undefined || value === null ? '' : value.toString()}\n onChange={e => {\n // find the original option value to preserve its type (number vs. string)\n const opt = selectOptions.find(it => it.value.toString() === e.target.value);\n const newValue = opt ? opt.value : e.target.value;\n this.setState({ value: newValue }, () => {\n const mayBePromise = this.onChange(this.props.attr, newValue);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n >\n {selectOptions.map((it, i) => (\n <FormControlLabel\n key={i}\n value={it.value.toString()}\n control={<Radio />}\n title={it.description || ''}\n label={\n <span style={{ display: 'flex', alignItems: 'center' }}>\n {it.icon ? (\n <Icon\n src={it.icon}\n style={styles.icon}\n />\n ) : null}\n <Typography\n component=\"span\"\n style={{ color: it.color }}\n >\n {it.label}\n </Typography>\n </span>\n }\n style={it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {}}\n />\n ))}\n </RadioGroup>\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 renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (!this.state.selectOptions) {\n return null;\n }\n\n if (this.props.schema.format === 'radio') {\n return this.renderRadio(error, disabled);\n }\n\n const selectOptions = this._filterOptions(this.state.selectOptions);\n\n const value = this._getValue();\n\n const item = this.props.schema.multiple ? null : selectOptions.find(it => it.value == value); // let \"==\" be and not ===\n\n return (\n <FormControl\n variant=\"standard\"\n fullWidth\n sx={this.props.table !== undefined && styles.noMargin}\n id={`jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}`}\n >\n {this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n error={!!error}\n multiple={this.props.schema.multiple}\n disabled={!!disabled}\n value={value || '_'}\n renderValue={(val: string | string[]) =>\n this.props.schema.multiple ? (\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>\n {(val as string[]).map((v: string) => {\n const it = selectOptions.find(_item => _item.value === v);\n if (it || this.props.schema.showAllValues !== false) {\n const label = it?.label || v;\n return (\n <Chip\n key={v}\n label={label}\n />\n );\n }\n return null;\n })}\n </div>\n ) : item?.color ? (\n <span style={{ display: 'flex', alignItems: 'center' }}>\n {item.icon ? (\n <Icon\n src={item.icon}\n style={styles.icon}\n />\n ) : null}\n <span>\n <div style={{ color: item.color }}>{item.label ?? val}</div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\n </span>\n </span>\n ) : item?.label === undefined ? (\n item?.icon ? (\n <span style={{ display: 'flex', alignItems: 'center' }}>\n <Icon\n src={item.icon}\n style={styles.icon}\n />\n {val}\n </span>\n ) : (\n val\n )\n ) : (\n <span style={{ display: 'flex', alignItems: 'center' }}>\n {item.icon ? (\n <Icon\n src={item.icon}\n style={styles.icon}\n />\n ) : null}\n <span>\n <div>{item.label}</div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\n </span>\n </span>\n )\n }\n onChange={e => {\n this.setState({ value: e.target.value === '_' ? '' : e.target.value }, () => {\n let mayBePromise: void | Promise<void>;\n if (this.state.value === ConfigGeneric.DIFFERENT_VALUE) {\n mayBePromise = this.onChange(this.props.attr, this.initialValue);\n } else {\n mayBePromise = this.onChange(this.props.attr, this.state.value);\n }\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n >\n {selectOptions.map((it, i) => {\n if (it.group) {\n return (\n <ListSubheader\n key={i}\n style={{ color: it.color }}\n >\n <div>{it.label}</div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\n </ListSubheader>\n );\n }\n return (\n <MenuItem\n key={i}\n value={it.value}\n style={it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {}}\n >\n {this.props.schema.multiple ? (\n <Checkbox\n checked={value.includes(it.value as string)}\n onClick={() => {\n const _value = JSON.parse(JSON.stringify(this._getValue()));\n const pos = value.indexOf(it.value as string);\n if (pos !== -1) {\n _value.splice(pos, 1);\n } else {\n _value.push(it.value);\n _value.sort();\n }\n this.setState({ value: _value }, () =>\n this.onChange(this.props.attr, _value),\n );\n }}\n />\n ) : null}\n {it.icon ? (\n <Icon\n src={it.icon}\n style={styles.icon}\n />\n ) : null}\n <ListItemText\n primary={it.label}\n secondary={it.description}\n slotProps={{\n secondary: {\n style: { fontSize: 'smaller', fontStyle: 'italic', opacity: 0.7 },\n },\n }}\n style={{ color: it.color }}\n />\n </MenuItem>\n );\n })}\n </Select>\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 </F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AAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;6BACpE;yBACJ,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,GAC5B,CACK,CACd,CAAC;YACN,CAAC,CAAC,CACG;YACR,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","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n FormHelperText,\n FormControl,\n FormLabel,\n Select,\n MenuItem,\n ListSubheader,\n Chip,\n ListItemText,\n Checkbox,\n RadioGroup,\n Radio,\n FormControlLabel,\n Typography,\n} from '@mui/material';\n\nimport { I18n, Icon } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSelect, ConfigItemSelectOption } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, any> = {\n fullWidth: {\n width: '100%',\n },\n noMargin: {\n '&>div': {\n marginTop: 0,\n },\n },\n icon: {\n width: 20,\n height: 20,\n marginRight: 4,\n },\n};\n\ninterface ConfigInstanceSelectProps extends ConfigGenericProps {\n schema: ConfigItemSelect;\n}\n\ninterface SelectItem {\n label: string;\n value: number | string;\n group?: boolean;\n hidden?: string | boolean;\n color?: string;\n description?: string;\n icon?: string;\n hiddenValue?: boolean;\n}\n\ninterface ConfigInstanceSelectState extends ConfigGenericState {\n selectOptions?: SelectItem[];\n}\n\nexport default class ConfigSelect extends ConfigGeneric<ConfigInstanceSelectProps, ConfigInstanceSelectState> {\n private initialValue: string | string[] = '';\n\n async componentDidMount(): Promise<void> {\n await super.componentDidMount();\n let value: string | string[] = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n const selectOptions: {\n label: string;\n value: number | string;\n group?: boolean;\n hidden?: string | boolean;\n color?: string;\n description?: string;\n icon?: string;\n hiddenValue?: boolean;\n }[] = [];\n\n for (const item of this.props.schema.options || []) {\n // if optgroup\n const groupItem: {\n items: ConfigItemSelectOption[];\n label: ioBroker.StringOrTranslated;\n value?: number | string;\n hidden?: string | boolean;\n description?: string;\n } = item as {\n items: ConfigItemSelectOption[];\n label: ioBroker.StringOrTranslated;\n value?: number | string;\n hidden?: string | boolean;\n description?: string;\n };\n if (Array.isArray(groupItem.items)) {\n const selectItem: SelectItem = {\n label: this.getText(item.label, this.props.schema.noTranslation),\n value: item.value,\n group: true,\n color: item.color,\n description: this.getText(item.description),\n };\n selectItem.hiddenValue = await this.isHidden(selectItem);\n selectOptions.push(selectItem);\n for (const it of groupItem.items) {\n const selectSubItem: SelectItem = {\n label: this.getText(it.label, this.props.schema.noTranslation),\n value: it.value,\n hidden: it.hidden,\n color: item.color,\n description: this.getText(item.description),\n icon: it.icon,\n };\n selectSubItem.hiddenValue = await this.isHidden(selectSubItem);\n selectOptions.push(selectSubItem);\n }\n } else {\n const selectItem: SelectItem = {\n label: this.getText(item.label, this.props.schema.noTranslation),\n value: item.value,\n hidden: item.hidden,\n color: item.color,\n description: this.getText(item.description),\n icon: item.icon,\n };\n selectItem.hiddenValue = await this.isHidden(selectItem);\n selectOptions.push(selectItem);\n }\n }\n\n // Report value-to-label mapping to parent table for filtering\n if (this.props.onFilterLabelUpdate && this.props.table) {\n const valueToLabel: Record<string, string> = {};\n for (const opt of selectOptions) {\n if (!opt.group && opt.value !== ConfigGeneric.DIFFERENT_VALUE) {\n valueToLabel[opt.value.toString()] = opt.label;\n }\n }\n this.props.onFilterLabelUpdate(this.props.attr, valueToLabel);\n }\n\n // if __different\n if (Array.isArray(value) && !this.props.schema.multiple) {\n this.initialValue = [...value];\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions });\n } else {\n this.setState({ value, selectOptions });\n }\n }\n\n _getValue(): string | string[] {\n let value =\n this.state.value === null || this.state.value === undefined\n ? ConfigGeneric.getValue(this.props.data, this.props.attr)\n : this.state.value;\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n return value;\n }\n\n private async isHidden(item: SelectItem): Promise<boolean> {\n // if optgroup or no hidden function\n if (!item.hidden) {\n return false;\n }\n\n if (this.props.custom) {\n return !!(await this.executeCustom(\n item.hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n ));\n }\n return !!(await this.execute(\n item.hidden,\n this.props.schema.default,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n ));\n }\n\n renderRadio(error: string, disabled: boolean): JSX.Element {\n const selectOptions = this.state.selectOptions.filter(it => !it.hiddenValue && !it.group);\n const value = this._getValue();\n\n return (\n <FormControl\n fullWidth\n error={!!error}\n disabled={!!disabled}\n id={`jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}`}\n >\n {this.props.schema.label ? <FormLabel>{this.getText(this.props.schema.label)}</FormLabel> : null}\n <RadioGroup\n row={!!this.props.schema.horizontal}\n value={value === undefined || value === null ? '' : value.toString()}\n onChange={e => {\n // find the original option value to preserve its type (number vs. string)\n const opt = selectOptions.find(it => it.value.toString() === e.target.value);\n const newValue = opt ? opt.value : e.target.value;\n this.setState({ value: newValue }, () => {\n const mayBePromise = this.onChange(this.props.attr, newValue);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n >\n {selectOptions.map((it, i) => (\n <FormControlLabel\n key={i}\n value={it.value.toString()}\n control={<Radio />}\n title={it.description || ''}\n label={\n <span style={{ display: 'flex', alignItems: 'center' }}>\n {it.icon ? (\n <Icon\n src={it.icon}\n style={styles.icon}\n />\n ) : null}\n <Typography\n component=\"span\"\n style={{ color: it.color }}\n >\n {it.label}\n </Typography>\n </span>\n }\n style={it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {}}\n />\n ))}\n </RadioGroup>\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 renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (!this.state.selectOptions) {\n return null;\n }\n\n if (this.props.schema.format === 'radio') {\n return this.renderRadio(error, disabled);\n }\n\n const selectOptions = this.state.selectOptions.filter(it => !it.hiddenValue);\n\n const value = this._getValue();\n\n const item = this.props.schema.multiple ? null : selectOptions.find(it => it.value == value); // let \"==\" be and not ===\n\n return (\n <FormControl\n variant=\"standard\"\n fullWidth\n sx={this.props.table !== undefined && styles.noMargin}\n id={`jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}`}\n >\n {this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n error={!!error}\n multiple={this.props.schema.multiple}\n disabled={!!disabled}\n value={value || '_'}\n renderValue={(val: string | string[]) =>\n this.props.schema.multiple ? (\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>\n {(val as string[]).map((v: string) => {\n const it = selectOptions.find(_item => _item.value === v);\n if (it || this.props.schema.showAllValues !== false) {\n const label = it?.label || v;\n return (\n <Chip\n key={v}\n label={label}\n />\n );\n }\n return null;\n })}\n </div>\n ) : item?.color ? (\n <span style={{ display: 'flex', alignItems: 'center' }}>\n {item.icon ? (\n <Icon\n src={item.icon}\n style={styles.icon}\n />\n ) : null}\n <span>\n <div style={{ color: item.color }}>{item.label ?? val}</div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\n </span>\n </span>\n ) : item?.label === undefined ? (\n item?.icon ? (\n <span style={{ display: 'flex', alignItems: 'center' }}>\n <Icon\n src={item.icon}\n style={styles.icon}\n />\n {val}\n </span>\n ) : (\n val\n )\n ) : (\n <span style={{ display: 'flex', alignItems: 'center' }}>\n {item.icon ? (\n <Icon\n src={item.icon}\n style={styles.icon}\n />\n ) : null}\n <span>\n <div>{item.label}</div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\n </span>\n </span>\n )\n }\n onChange={e => {\n this.setState({ value: e.target.value === '_' ? '' : e.target.value }, () => {\n let mayBePromise: void | Promise<void>;\n if (this.state.value === ConfigGeneric.DIFFERENT_VALUE) {\n mayBePromise = this.onChange(this.props.attr, this.initialValue);\n } else {\n mayBePromise = this.onChange(this.props.attr, this.state.value);\n }\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n >\n {selectOptions.map((it, i) => {\n if (it.group) {\n return (\n <ListSubheader\n key={i}\n style={{ color: it.color }}\n >\n <div>{it.label}</div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\n </ListSubheader>\n );\n }\n return (\n <MenuItem\n key={i}\n value={it.value}\n style={it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {}}\n >\n {this.props.schema.multiple ? (\n <Checkbox\n checked={value.includes(it.value as string)}\n onClick={() => {\n const _value = JSON.parse(JSON.stringify(this._getValue()));\n const pos = value.indexOf(it.value as string);\n if (pos !== -1) {\n _value.splice(pos, 1);\n } else {\n _value.push(it.value);\n _value.sort();\n }\n this.setState({ value: _value }, () =>\n this.onChange(this.props.attr, _value),\n );\n }}\n />\n ) : null}\n {it.icon ? (\n <Icon\n src={it.icon}\n style={styles.icon}\n />\n ) : null}\n <ListItemText\n primary={it.label}\n secondary={it.description}\n slotProps={{\n secondary: {\n style: { fontSize: 'smaller', fontStyle: 'italic', opacity: 0.7 },\n },\n }}\n style={{ color: it.color }}\n />\n </MenuItem>\n );\n })}\n </Select>\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"]}
|
|
@@ -4,27 +4,32 @@ import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from
|
|
|
4
4
|
interface ConfigSelectSendToProps extends ConfigGenericProps {
|
|
5
5
|
schema: ConfigItemSelectSendTo;
|
|
6
6
|
}
|
|
7
|
+
interface SelectItem {
|
|
8
|
+
label: string;
|
|
9
|
+
value: number | string;
|
|
10
|
+
group?: boolean;
|
|
11
|
+
hidden?: string | boolean;
|
|
12
|
+
color?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
icon?: string;
|
|
15
|
+
hiddenValue?: boolean;
|
|
16
|
+
}
|
|
7
17
|
interface ConfigSelectSendToState extends ConfigGenericState {
|
|
8
|
-
list?:
|
|
9
|
-
label: string;
|
|
10
|
-
value: string;
|
|
11
|
-
hidden?: boolean;
|
|
12
|
-
group?: boolean;
|
|
13
|
-
description?: string;
|
|
14
|
-
}[];
|
|
18
|
+
list?: SelectItem[];
|
|
15
19
|
running?: boolean;
|
|
16
20
|
}
|
|
17
|
-
|
|
21
|
+
export default class ConfigSelectSendTo extends ConfigGeneric<ConfigSelectSendToProps, ConfigSelectSendToState> {
|
|
18
22
|
private initialized;
|
|
19
23
|
private localContext;
|
|
20
|
-
askInstance(): void
|
|
24
|
+
askInstance(): Promise<void>;
|
|
21
25
|
/** Report value-to-label mapping to parent table for filtering */
|
|
22
26
|
reportFilterLabels(list: {
|
|
23
27
|
label: string;
|
|
24
|
-
value: string;
|
|
28
|
+
value: string | number;
|
|
25
29
|
}[] | undefined): void;
|
|
26
30
|
getContext(): string;
|
|
27
31
|
_getValue(): string | string[];
|
|
32
|
+
private isHidden;
|
|
28
33
|
renderItem(error: unknown, disabled: boolean): JSX.Element | string;
|
|
29
34
|
}
|
|
30
|
-
export
|
|
35
|
+
export {};
|
|
@@ -8,14 +8,14 @@ const styles = {
|
|
|
8
8
|
maxHeight: 800,
|
|
9
9
|
},
|
|
10
10
|
};
|
|
11
|
-
class ConfigSelectSendTo extends ConfigGeneric {
|
|
11
|
+
export default class ConfigSelectSendTo extends ConfigGeneric {
|
|
12
12
|
initialized = false;
|
|
13
13
|
localContext;
|
|
14
|
-
askInstance() {
|
|
14
|
+
async askInstance() {
|
|
15
15
|
if (this.props.alive) {
|
|
16
16
|
let data = this.props.schema.data;
|
|
17
17
|
if (data === undefined && this.props.schema.jsonData) {
|
|
18
|
-
const dataStr = this.
|
|
18
|
+
const dataStr = await this.getPatternAsync(this.props.schema.jsonData, null, true);
|
|
19
19
|
try {
|
|
20
20
|
data = JSON.parse(dataStr);
|
|
21
21
|
}
|
|
@@ -26,17 +26,19 @@ class ConfigSelectSendTo extends ConfigGeneric {
|
|
|
26
26
|
if (data === undefined) {
|
|
27
27
|
data = null;
|
|
28
28
|
}
|
|
29
|
-
this.setState({ running: true }, () => {
|
|
30
|
-
const instance = this.
|
|
31
|
-
|
|
32
|
-
.sendTo(instance, this.props.schema.command || 'send', data)
|
|
33
|
-
.then(list => {
|
|
29
|
+
this.setState({ running: true }, async () => {
|
|
30
|
+
const instance = await this.getPatternAsync(this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`);
|
|
31
|
+
try {
|
|
32
|
+
const list = await this.props.oContext.socket.sendTo(instance, this.props.schema.command || 'send', data);
|
|
34
33
|
this.reportFilterLabels(list);
|
|
34
|
+
for (const item of list) {
|
|
35
|
+
item.hiddenValue = await this.isHidden(item);
|
|
36
|
+
}
|
|
35
37
|
this.setState({ list, running: false });
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
38
40
|
console.error(`Cannot send command: ${e}`);
|
|
39
|
-
}
|
|
41
|
+
}
|
|
40
42
|
});
|
|
41
43
|
}
|
|
42
44
|
else {
|
|
@@ -77,6 +79,16 @@ class ConfigSelectSendTo extends ConfigGeneric {
|
|
|
77
79
|
}
|
|
78
80
|
return value;
|
|
79
81
|
}
|
|
82
|
+
async isHidden(item) {
|
|
83
|
+
// if optgroup or no hidden function
|
|
84
|
+
if (!item.hidden) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
if (this.props.custom) {
|
|
88
|
+
return !!(await this.executeCustom(item.hidden, this.props.data, this.props.customObj, this.props.oContext.instanceObj, this.props.arrayIndex, this.props.globalData));
|
|
89
|
+
}
|
|
90
|
+
return !!(await this.execute(item.hidden, this.props.schema.default, this.props.data, this.props.arrayIndex, this.props.globalData));
|
|
91
|
+
}
|
|
80
92
|
renderItem(error, disabled /* , defaultValue */) {
|
|
81
93
|
if (this.props.alive) {
|
|
82
94
|
const localContext = this.getContext();
|
|
@@ -105,15 +117,7 @@ class ConfigSelectSendTo extends ConfigGeneric {
|
|
|
105
117
|
if (this.state.running) {
|
|
106
118
|
return React.createElement(CircularProgress, { size: "24" });
|
|
107
119
|
}
|
|
108
|
-
const selectOptions = this.state.list.filter(item =>
|
|
109
|
-
if (!item.hidden) {
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
if (this.props.custom) {
|
|
113
|
-
return !this.executeCustom(item.hidden, this.props.data, this.props.customObj, this.props.oContext.instanceObj, this.props.arrayIndex, this.props.globalData);
|
|
114
|
-
}
|
|
115
|
-
return !this.execute(item.hidden, this.props.schema.default, this.props.data, this.props.arrayIndex, this.props.globalData);
|
|
116
|
-
});
|
|
120
|
+
const selectOptions = this.state.list.filter(item => !item.hiddenValue);
|
|
117
121
|
const item = selectOptions.find(it => it.value === value);
|
|
118
122
|
return (React.createElement(FormControl, { variant: "standard", fullWidth: true },
|
|
119
123
|
this.props.schema.label ? React.createElement(InputLabel, null, this.getText(this.props.schema.label)) : null,
|
|
@@ -140,9 +144,9 @@ class ConfigSelectSendTo extends ConfigGeneric {
|
|
|
140
144
|
it.description ? (React.createElement("div", { style: { opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' } }, this.getText(it.description))) : null));
|
|
141
145
|
}
|
|
142
146
|
return (React.createElement(MenuItem, { key: i, value: it.value },
|
|
143
|
-
this.props.schema.multiple ? (React.createElement(Checkbox, { checked: value.includes(it.value), onClick: () => {
|
|
147
|
+
this.props.schema.multiple ? (React.createElement(Checkbox, { checked: value.includes(it.value.toString()), onClick: () => {
|
|
144
148
|
const _value = JSON.parse(JSON.stringify(this._getValue()));
|
|
145
|
-
const pos = value.indexOf(it.value);
|
|
149
|
+
const pos = value.indexOf(it.value.toString());
|
|
146
150
|
if (pos !== -1) {
|
|
147
151
|
_value.splice(pos, 1);
|
|
148
152
|
}
|
|
@@ -161,5 +165,4 @@ class ConfigSelectSendTo extends ConfigGeneric {
|
|
|
161
165
|
this.props.schema.help ? (React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation))) : null));
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
|
-
export default ConfigSelectSendTo;
|
|
165
168
|
//# sourceMappingURL=ConfigSelectSendTo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigSelectSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSelectSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,UAAU,EACV,QAAQ,EACR,cAAc,EACd,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AC,CAAC,IAAI,CACE,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,kBAAkB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n MenuItem,\n FormHelperText,\n FormControl,\n Select,\n TextField,\n CircularProgress,\n ListItemText,\n Checkbox,\n Chip,\n Box,\n InputAdornment,\n IconButton,\n ListSubheader,\n} from '@mui/material';\n\nimport { Close as CloseIcon } from '@mui/icons-material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSelectSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n menuPaper: {\n maxHeight: 800,\n },\n};\n\n/*\nto use this option, your adapter must implement listUart message\n\nadapter.on('message', obj => {\n if (obj) {\n switch (obj.command) {\n case 'command':\n if (obj.callback) {\n try {\n const serialport = require('serialport');\n if (serialport) {\n // read all found serial ports\n serialport.list()\n .then(ports => {\n adapter.log.info('List of port: ' + JSON.stringify(ports));\n adapter.sendTo(obj.from, obj.command, ports.map(item =>\n ({label: item.path, value: item.path})), obj.callback);\n })\n .catch(e => {\n adapter.sendTo(obj.from, obj.command, [], obj.callback);\n adapter.log.error(e)\n });\n } else {\n adapter.log.warn('Module serialport is not available');\n adapter.sendTo(obj.from, obj.command, [{label: 'Not available', value: ''}], obj.callback);\n }\n } catch (e) {\n adapter.sendTo(obj.from, obj.command, [{label: 'Not available', value: ''}], obj.callback);\n }\n }\n\n break;\n }\n }\n});\n */\n\ninterface ConfigSelectSendToProps extends ConfigGenericProps {\n schema: ConfigItemSelectSendTo;\n}\n\ninterface ConfigSelectSendToState extends ConfigGenericState {\n list?: { label: string; value: string; hidden?: boolean; group?: boolean; description?: string }[];\n running?: boolean;\n}\n\nclass ConfigSelectSendTo extends ConfigGeneric<ConfigSelectSendToProps, ConfigSelectSendToState> {\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 this.setState({ running: true }, () => {\n const instance = this.getPattern(\n this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n );\n\n void this.props.oContext.socket\n .sendTo(instance, this.props.schema.command || 'send', data)\n .then(list => {\n this.reportFilterLabels(list);\n this.setState({ list, running: false });\n })\n .catch(e => {\n console.error(`Cannot send command: ${e}`);\n });\n });\n } else {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n this.setState({ value, running: false });\n }\n }\n\n /** Report value-to-label mapping to parent table for filtering */\n reportFilterLabels(list: { label: string; value: string }[] | undefined): void {\n if (this.props.onFilterLabelUpdate && this.props.table && Array.isArray(list)) {\n const valueToLabel: Record<string, string> = {};\n for (const opt of list) {\n if (opt.value !== ConfigGeneric.DIFFERENT_VALUE) {\n valueToLabel[opt.value] = opt.label;\n }\n }\n this.props.onFilterLabelUpdate(this.props.attr, valueToLabel);\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n\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\n return JSON.stringify(localContext);\n }\n\n _getValue(): string | string[] {\n let value: string | string[] | null | undefined =\n this.state.value === null || this.state.value === undefined\n ? ConfigGeneric.getValue(this.props.data, this.props.attr)\n : this.state.value;\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n return value;\n }\n\n renderItem(error: unknown, disabled: boolean /* , defaultValue */): JSX.Element | string {\n if (this.props.alive) {\n const localContext = this.getContext();\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 const value = this._getValue();\n\n if (!this.props.alive || (!this.state.running && !Array.isArray(this.state.list))) {\n if (this.props.schema.multiple || this.props.schema.manual === false) {\n return I18n.t('ra_Cannot retrieve options, as instance is offline');\n }\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={value}\n error={!!error}\n disabled={!!disabled}\n onChange={e => {\n const value_ = e.target.value;\n this.setState({ value: value_ }, () => this.onChange(this.props.attr, (value_ || '').trim()));\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 slotProps={{\n input: {\n endAdornment:\n this.state.value && !this.props.schema.noClearButton ? (\n <InputAdornment position=\"end\">\n <IconButton\n tabIndex={-1}\n size=\"small\"\n onClick={() =>\n this.setState({ value: '' }, () => this.onChange(this.props.attr, ''))\n }\n >\n <CloseIcon />\n </IconButton>\n </InputAdornment>\n ) : null,\n },\n }}\n />\n );\n }\n\n if (this.state.running) {\n return <CircularProgress size=\"24\" />;\n }\n\n const selectOptions = this.state.list.filter(item => {\n if (!item.hidden) {\n return true;\n }\n if (this.props.custom) {\n return !this.executeCustom(\n item.hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n );\n }\n return !this.execute(\n item.hidden,\n this.props.schema.default,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n );\n });\n\n const item = selectOptions.find(it => it.value === value);\n\n return (\n <FormControl\n variant=\"standard\"\n fullWidth\n >\n {this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n error={!!error}\n multiple={this.props.schema.multiple}\n disabled={!!disabled}\n // MenuProps={this.props.schema.multiple ? { classes: { paper: this.props.classes.menuPaper } } : undefined}\n sx={{\n '&.MuiSelect-paper': this.props.schema.multiple ? styles.menuPaper : undefined,\n }}\n value={value}\n renderValue={(val: string | string[]) =>\n this.props.schema.multiple ? (\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>\n {(val as string[]).map((v: string) => {\n const it = selectOptions.find(_item => _item.value === v);\n if (it || this.props.schema.showAllValues !== false) {\n const label = it?.label || v;\n return (\n <Chip\n key={v}\n label={label}\n />\n );\n }\n return null;\n })}\n </Box>\n ) : (\n this.getText(item?.label || (val as string), this.props.schema.noTranslation)\n )\n }\n onChange={e => {\n const mayBePromise = this.onChange(this.props.attr, e.target.value);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n >\n {selectOptions.map((it, i) => {\n if (it.group) {\n return (\n <ListSubheader key={i}>\n <div>{this.getText(it.label, this.props.schema.noTranslation)}</div>\n {it.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {this.getText(it.description)}\n </div>\n ) : null}\n </ListSubheader>\n );\n }\n return (\n <MenuItem\n key={i}\n value={it.value}\n >\n {this.props.schema.multiple ? (\n <Checkbox\n checked={value.includes(it.value)}\n onClick={() => {\n const _value = JSON.parse(JSON.stringify(this._getValue()));\n const pos = value.indexOf(it.value);\n if (pos !== -1) {\n _value.splice(pos, 1);\n } else {\n _value.push(it.value);\n _value.sort();\n }\n this.setState({ value: _value }, () =>\n this.onChange(this.props.attr, _value),\n );\n }}\n />\n ) : null}\n <ListItemText\n primary={this.getText(it.label)}\n secondary={this.getText(it.description)}\n slotProps={{\n secondary: {\n style: { fontSize: 'smaller', fontStyle: 'italic', opacity: 0.7 },\n },\n }}\n />\n </MenuItem>\n );\n })}\n </Select>\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 ConfigSelectSendTo;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigSelectSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSelectSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,UAAU,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,cAAc,EACd,UAAU,EACV,aAAa,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,SAAS,EAAE,GAAG;KACjB;CACJ,CAAC;AA2DF,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,aAA+D;IACnG,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,CAAqB;IAEzC,KAAK,CAAC,WAAW;QACb,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,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC3F,IAAI,CAAC;oBACD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC/B,CAAC;gBAAC,MAAM,CAAC;oBACL,OAA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CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAC/B,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,EACvC,SAAS,EAAE;4BACP,SAAS,EAAE;gCACP,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;6BACpE;yBACJ,GACH,CACK,CACd,CAAC;YACN,CAAC,CAAC,CACG;YACR,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","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n MenuItem,\n FormHelperText,\n FormControl,\n Select,\n TextField,\n CircularProgress,\n ListItemText,\n Checkbox,\n Chip,\n Box,\n InputAdornment,\n IconButton,\n ListSubheader,\n} from '@mui/material';\n\nimport { Close as CloseIcon } from '@mui/icons-material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSelectSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n menuPaper: {\n maxHeight: 800,\n },\n};\n\n/*\nto use this option, your adapter must implement listUart message\n\nadapter.on('message', obj => {\n if (obj) {\n switch (obj.command) {\n case 'command':\n if (obj.callback) {\n try {\n const serialport = require('serialport');\n if (serialport) {\n // read all found serial ports\n serialport.list()\n .then(ports => {\n adapter.log.info('List of port: ' + JSON.stringify(ports));\n adapter.sendTo(obj.from, obj.command, ports.map(item =>\n ({label: item.path, value: item.path})), obj.callback);\n })\n .catch(e => {\n adapter.sendTo(obj.from, obj.command, [], obj.callback);\n adapter.log.error(e)\n });\n } else {\n adapter.log.warn('Module serialport is not available');\n adapter.sendTo(obj.from, obj.command, [{label: 'Not available', value: ''}], obj.callback);\n }\n } catch (e) {\n adapter.sendTo(obj.from, obj.command, [{label: 'Not available', value: ''}], obj.callback);\n }\n }\n\n break;\n }\n }\n});\n */\n\ninterface ConfigSelectSendToProps extends ConfigGenericProps {\n schema: ConfigItemSelectSendTo;\n}\n\ninterface SelectItem {\n label: string;\n value: number | string;\n group?: boolean;\n hidden?: string | boolean;\n color?: string;\n description?: string;\n icon?: string;\n hiddenValue?: boolean;\n}\n\ninterface ConfigSelectSendToState extends ConfigGenericState {\n list?: SelectItem[];\n running?: boolean;\n}\n\nexport default class ConfigSelectSendTo extends ConfigGeneric<ConfigSelectSendToProps, ConfigSelectSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n async askInstance(): Promise<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 = await this.getPatternAsync(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 this.setState({ running: true }, async () => {\n const instance = await this.getPatternAsync(\n this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n );\n\n try {\n const list: SelectItem[] = await this.props.oContext.socket.sendTo(\n instance,\n this.props.schema.command || 'send',\n data,\n );\n this.reportFilterLabels(list);\n for (const item of list) {\n item.hiddenValue = await this.isHidden(item);\n }\n\n this.setState({ list, running: false });\n } catch (e) {\n console.error(`Cannot send command: ${e}`);\n }\n });\n } else {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n this.setState({ value, running: false });\n }\n }\n\n /** Report value-to-label mapping to parent table for filtering */\n reportFilterLabels(list: { label: string; value: string | number }[] | undefined): void {\n if (this.props.onFilterLabelUpdate && this.props.table && Array.isArray(list)) {\n const valueToLabel: Record<string, string> = {};\n for (const opt of list) {\n if (opt.value !== ConfigGeneric.DIFFERENT_VALUE) {\n valueToLabel[opt.value] = opt.label;\n }\n }\n this.props.onFilterLabelUpdate(this.props.attr, valueToLabel);\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n\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\n return JSON.stringify(localContext);\n }\n\n _getValue(): string | string[] {\n let value: string | string[] | null | undefined =\n this.state.value === null || this.state.value === undefined\n ? ConfigGeneric.getValue(this.props.data, this.props.attr)\n : this.state.value;\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n return value;\n }\n\n private async isHidden(item: SelectItem): Promise<boolean> {\n // if optgroup or no hidden function\n if (!item.hidden) {\n return false;\n }\n\n if (this.props.custom) {\n return !!(await this.executeCustom(\n item.hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n ));\n }\n return !!(await this.execute(\n item.hidden,\n this.props.schema.default,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n ));\n }\n\n renderItem(error: unknown, disabled: boolean /* , defaultValue */): JSX.Element | string {\n if (this.props.alive) {\n const localContext = this.getContext();\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 const value = this._getValue();\n\n if (!this.props.alive || (!this.state.running && !Array.isArray(this.state.list))) {\n if (this.props.schema.multiple || this.props.schema.manual === false) {\n return I18n.t('ra_Cannot retrieve options, as instance is offline');\n }\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={value}\n error={!!error}\n disabled={!!disabled}\n onChange={e => {\n const value_ = e.target.value;\n this.setState({ value: value_ }, () => this.onChange(this.props.attr, (value_ || '').trim()));\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 slotProps={{\n input: {\n endAdornment:\n this.state.value && !this.props.schema.noClearButton ? (\n <InputAdornment position=\"end\">\n <IconButton\n tabIndex={-1}\n size=\"small\"\n onClick={() =>\n this.setState({ value: '' }, () => this.onChange(this.props.attr, ''))\n }\n >\n <CloseIcon />\n </IconButton>\n </InputAdornment>\n ) : null,\n },\n }}\n />\n );\n }\n\n if (this.state.running) {\n return <CircularProgress size=\"24\" />;\n }\n\n const selectOptions = this.state.list.filter(item => !item.hiddenValue);\n\n const item = selectOptions.find(it => it.value === value);\n\n return (\n <FormControl\n variant=\"standard\"\n fullWidth\n >\n {this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n error={!!error}\n multiple={this.props.schema.multiple}\n disabled={!!disabled}\n // MenuProps={this.props.schema.multiple ? { classes: { paper: this.props.classes.menuPaper } } : undefined}\n sx={{\n '&.MuiSelect-paper': this.props.schema.multiple ? styles.menuPaper : undefined,\n }}\n value={value}\n renderValue={(val: string | string[]) =>\n this.props.schema.multiple ? (\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>\n {(val as string[]).map((v: string) => {\n const it = selectOptions.find(_item => _item.value === v);\n if (it || this.props.schema.showAllValues !== false) {\n const label = it?.label || v;\n return (\n <Chip\n key={v}\n label={label}\n />\n );\n }\n return null;\n })}\n </Box>\n ) : (\n this.getText(item?.label || (val as string), this.props.schema.noTranslation)\n )\n }\n onChange={e => {\n const mayBePromise = this.onChange(this.props.attr, e.target.value);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n >\n {selectOptions.map((it, i) => {\n if (it.group) {\n return (\n <ListSubheader key={i}>\n <div>{this.getText(it.label, this.props.schema.noTranslation)}</div>\n {it.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {this.getText(it.description)}\n </div>\n ) : null}\n </ListSubheader>\n );\n }\n return (\n <MenuItem\n key={i}\n value={it.value}\n >\n {this.props.schema.multiple ? (\n <Checkbox\n checked={value.includes(it.value.toString())}\n onClick={() => {\n const _value = JSON.parse(JSON.stringify(this._getValue()));\n const pos = value.indexOf(it.value.toString());\n if (pos !== -1) {\n _value.splice(pos, 1);\n } else {\n _value.push(it.value);\n _value.sort();\n }\n this.setState({ value: _value }, () =>\n this.onChange(this.props.attr, _value),\n );\n }}\n />\n ) : null}\n <ListItemText\n primary={this.getText(it.label)}\n secondary={this.getText(it.description)}\n slotProps={{\n secondary: {\n style: { fontSize: 'smaller', fontStyle: 'italic', opacity: 0.7 },\n },\n }}\n />\n </MenuItem>\n );\n })}\n </Select>\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"]}
|
|
@@ -20,7 +20,7 @@ export default class ConfigSendto extends ConfigGeneric<ConfigSendToProps, Confi
|
|
|
20
20
|
renderErrorDialog(): JSX.Element | null;
|
|
21
21
|
renderMessageDialog(): JSX.Element | null;
|
|
22
22
|
renderCopyDialog(): JSX.Element | null;
|
|
23
|
-
_onClick(): void
|
|
23
|
+
_onClick(): Promise<void>;
|
|
24
24
|
renderDialogConfirm(): JSX.Element | null;
|
|
25
25
|
renderItem(error: Error | undefined, disabled: boolean): JSX.Element;
|
|
26
26
|
}
|