@iobroker/json-config 7.3.2 → 7.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 +37 -12
- package/build/JsonConfigComponent/ConfigPanel.js +2 -0
- 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/ConfigStaticInfo.d.ts +10 -0
- package/build/JsonConfigComponent/ConfigStaticInfo.js +213 -0
- package/build/JsonConfigComponent/ConfigStaticInfo.js.map +1 -0
- package/build/JsonConfigComponent/ConfigStaticText.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigText.js +15 -7
- package/build/JsonConfigComponent/ConfigText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.js +2 -2
- package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/build/types.d.ts +33 -1
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -177,7 +177,7 @@ You can install it via GitHub icon in admin by entering `iobroker.jsonconfig-dem
|
|
|
177
177
|
- [**`coordinates`:**](#coordinates) Determines current location and used `system.config` coordinates if not possible in form "latitude,longitude"
|
|
178
178
|
- [**`table`:**](#table) Table with rows that can be added, deleted, or reordered
|
|
179
179
|
- [**`tabs`:**](#tabs) Tabs with items
|
|
180
|
-
- [**`text`:**](#text) Single-line text input field
|
|
180
|
+
- [**`text`:**](#text) Single- or multi-line text input field
|
|
181
181
|
- [**`textSendTo`:**](#textsendto) Shows readonly control with the given from the instance values.
|
|
182
182
|
- [**`timePicker`:**](#timepicker) Allows users to select a time
|
|
183
183
|
- [**`user`:**](#user) Selects a user from the `system.user` list
|
|
@@ -337,17 +337,18 @@ Tab with items
|
|
|
337
337
|
|
|
338
338
|
Text component
|
|
339
339
|
|
|
340
|
-
| Property
|
|
341
|
-
|
|
342
|
-
| `maxLength`
|
|
343
|
-
| `readOnly`
|
|
344
|
-
| `
|
|
345
|
-
| `
|
|
346
|
-
| `
|
|
347
|
-
| `
|
|
348
|
-
| `
|
|
349
|
-
| `
|
|
350
|
-
| `
|
|
340
|
+
| Property | Description |
|
|
341
|
+
|-------------------|--------------------------------------------------------------------------------------------------------|
|
|
342
|
+
| `maxLength` | max length of the text in field |
|
|
343
|
+
| `readOnly` | read-only field |
|
|
344
|
+
| `copyToClipboard` | show copy to clipboard button, but only if disabled or read-only is true |
|
|
345
|
+
| `trim` | default is true. Set this attribute to `false` if trim is not desired. |
|
|
346
|
+
| `minRows` | default is 1. Set this attribute to `2` or more if you want to have a textarea with more than one row. |
|
|
347
|
+
| `maxRows` | max rows of textarea. Used only if `minRows` > 1. |
|
|
348
|
+
| `noClearButton` | if true, the clear button will not be shown (admin >= 6.17.13) |
|
|
349
|
+
| `validateJson` | if true, the text will be validated as JSON |
|
|
350
|
+
| `allowEmpty` | if true, the JSON will be validated only if the value is not empty |
|
|
351
|
+
| `time` | the value is time in ms or a string. Used only with readOnly flag |
|
|
351
352
|
|
|
352
353
|
### `number`
|
|
353
354
|
|
|
@@ -1103,6 +1104,27 @@ Special input for ports. It checks automatically if port is used by other instan
|
|
|
1103
1104
|
| `variant` | Variant of button: `contained`, `outlined`, `text` |
|
|
1104
1105
|
| `readOnly` | Defines if the control is read-only |
|
|
1105
1106
|
|
|
1107
|
+
### `staticInfo`
|
|
1108
|
+
|
|
1109
|
+
(admin >= 7.3.3) Shows static information in preformatted form, like "Title: value unit"
|
|
1110
|
+
This control is used mostly in dynamic forms
|
|
1111
|
+
|
|
1112
|
+
| Property | Description |
|
|
1113
|
+
|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
1114
|
+
| `data` | Value to be shown |
|
|
1115
|
+
| `label` | Label for the value (could be multi-language) |
|
|
1116
|
+
| `unit` | (optional) unit (could be multi-language) |
|
|
1117
|
+
| `narrow` | (optional) Normally the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label |
|
|
1118
|
+
| `addColon` | (optional) Add to label the colon at the end if not exist in label |
|
|
1119
|
+
| `blinkOnUpdate` | (optional) Value should blink when updated (true or color) |
|
|
1120
|
+
| `blink` | (optional) Value should blink continuously (true or color) |
|
|
1121
|
+
| `styleLabel` | (optional) React CSS Styles |
|
|
1122
|
+
| `styleValue` | (optional) React CSS Styles |
|
|
1123
|
+
| `styleUnit` | (optional) React CSS Styles |
|
|
1124
|
+
| `copyToClipboard` | (optional) Show copy to clipboard button for value |
|
|
1125
|
+
| `labelIcon` | (optional) base64 icon for label |
|
|
1126
|
+
| `size` | (optional) font size: small, normal, large or number |
|
|
1127
|
+
|
|
1106
1128
|
### `deviceManager`
|
|
1107
1129
|
|
|
1108
1130
|
show device manager. For that, the adapter must support device manager protocol. See iobroker/dm-utils.
|
|
@@ -1400,3 +1422,6 @@ The following variables are available in JS function in custom settings:
|
|
|
1400
1422
|
```
|
|
1401
1423
|
|
|
1402
1424
|
You can find examples in [`telegram`](https://github.com/iobroker-community-adapters/ioBroker.telegram/tree/master/src-admin) or in [`pushbullet`](https://github.com/Jens1809/ioBroker.pushbullet/tree/master/src-admin) adapter.
|
|
1425
|
+
|
|
1426
|
+
## For maintainer
|
|
1427
|
+
To update location of JsonConfig schema, create pull request to this file: https://github.com/SchemaStore/schemastore/blob/master/src/api/json/catalog.json
|
|
@@ -45,6 +45,7 @@ import ConfigState from './ConfigState';
|
|
|
45
45
|
import ConfigStaticDivider from './ConfigStaticDivider';
|
|
46
46
|
import ConfigStaticHeader from './ConfigStaticHeader';
|
|
47
47
|
import ConfigStaticImage from './ConfigStaticImage';
|
|
48
|
+
import ConfigStaticInfo from './ConfigStaticInfo';
|
|
48
49
|
import ConfigStaticText from './ConfigStaticText';
|
|
49
50
|
import ConfigTable from './ConfigTable';
|
|
50
51
|
import ConfigText from './ConfigText';
|
|
@@ -101,6 +102,7 @@ const components = {
|
|
|
101
102
|
slider: ConfigSlider,
|
|
102
103
|
state: ConfigState,
|
|
103
104
|
staticImage: ConfigStaticImage,
|
|
105
|
+
staticInfo: ConfigStaticInfo,
|
|
104
106
|
staticLink: ConfigStaticText,
|
|
105
107
|
staticText: ConfigStaticText,
|
|
106
108
|
table: ConfigTable,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigPanel.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAiB,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,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,IAAI,MAAM,CAAC,OAAO,EACxC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAC/B,IAEA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAC9B,CACN,CACT,CAAC;SACL;QAED,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YACzB,MAAM,IAAI,GAAG,CACT,oBAAC,KAAK,IACF,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EACnC,IAAI,EAAE;oBACF,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;iBAC7B,EACD,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,IAE/E,OAAO,CACJ,CACX,CAAC;YAEF,IAAI,MAAM,CAAC,OAAO,EAAE;gBAChB,OAAO,CACH;oBACI,6BAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAI;oBAC/C,IAAI,CACN,CACN,CAAC;aACL;YACD,OAAO,IAAI,CAAC;SACf;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Grid2, Accordion, AccordionSummary, AccordionDetails, Typography, Box } from '@mui/material';\n\nimport { ExpandMore as ExpandMoreIcon } from '@mui/icons-material';\n\nimport { type IobTheme, Utils } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemPanel } from '#JC/types';\n\nimport ConfigGeneric, { type ConfigGenericState, type ConfigGenericProps } from './ConfigGeneric';\nimport ConfigAccordion from './ConfigAccordion';\nimport ConfigAlive from './ConfigAlive';\nimport ConfigAutocomplete from './ConfigAutocomplete';\nimport ConfigAutocompleteSendTo from './ConfigAutocompleteSendTo';\nimport ConfigCRON from './ConfigCRON';\nimport ConfigCertificateSelect from './ConfigCertificateSelect';\nimport ConfigCertificates from './ConfigCertificates';\nimport ConfigCertCollection from './ConfigCertCollection';\nimport ConfigCheckLicense from './ConfigCheckLicense';\nimport ConfigCheckbox from './ConfigCheckbox';\nimport ConfigChip from './ConfigChip';\nimport ConfigColor from './ConfigColor';\nimport ConfigCoordinates from './ConfigCoordinates';\nimport ConfigCustom from './ConfigCustom';\nimport ConfigDatePicker from './ConfigDatePicker';\nimport ConfigDeviceManager from './ConfigDeviceManager';\nimport ConfigFile from './ConfigFile';\nimport ConfigFileSelector from './ConfigFileSelector';\nimport ConfigFunc from './ConfigFunc';\nimport ConfigIP from './ConfigIP';\nimport ConfigImageSendTo from './ConfigImageSendTo';\nimport ConfigImageUpload from './ConfigImageUpload';\nimport ConfigInstanceSelect from './ConfigInstanceSelect';\nimport ConfigInterface from './ConfigInterface';\nimport ConfigJsonEditor from './ConfigJsonEditor';\nimport ConfigLanguage from './ConfigLanguage';\nimport ConfigLicense from './ConfigLicense';\nimport ConfigNumber from './ConfigNumber';\nimport ConfigObjectId from './ConfigObjectId';\nimport ConfigPassword from './ConfigPassword';\nimport ConfigPattern from './ConfigPattern';\nimport ConfigPort from './ConfigPort';\nimport ConfigRoom from './ConfigRoom';\nimport ConfigSelect from './ConfigSelect';\nimport ConfigSelectSendTo from './ConfigSelectSendTo';\nimport ConfigSendTo from './ConfigSendto';\nimport ConfigSetState from './ConfigSetState';\nimport ConfigSlider from './ConfigSlider';\nimport ConfigState from './ConfigState';\nimport ConfigStaticDivider from './ConfigStaticDivider';\nimport ConfigStaticHeader from './ConfigStaticHeader';\nimport ConfigStaticImage from './ConfigStaticImage';\nimport ConfigStaticText from './ConfigStaticText';\nimport ConfigTable from './ConfigTable';\nimport ConfigText from './ConfigText';\nimport ConfigTextSendTo from './ConfigTextSendTo';\nimport ConfigTimePicker from './ConfigTimePicker';\nimport ConfigTopic from './ConfigTopic';\nimport ConfigUUID from './ConfigUUID';\nimport ConfigUser from './ConfigUser';\nimport ConfigQrCode from './ConfigQrCode';\n\nconst components: Record<string, typeof ConfigGeneric<any, any>> = {\n accordion: ConfigAccordion,\n alive: ConfigAlive,\n autocomplete: ConfigAutocomplete,\n autocompleteSendTo: ConfigAutocompleteSendTo,\n certCollection: ConfigCertCollection,\n certificate: ConfigCertificateSelect,\n certificates: ConfigCertificates,\n checkbox: ConfigCheckbox,\n checkLicense: ConfigCheckLicense,\n chip: ConfigChip, // deprecated. Use \"chips\"\n chips: ConfigChip,\n color: ConfigColor,\n coordinates: ConfigCoordinates,\n cron: ConfigCRON,\n custom: ConfigCustom,\n datePicker: ConfigDatePicker,\n deviceManager: ConfigDeviceManager,\n divider: ConfigStaticDivider,\n file: ConfigFile,\n fileSelector: ConfigFileSelector,\n func: ConfigFunc,\n header: ConfigStaticHeader,\n image: ConfigImageUpload,\n imageSendTo: ConfigImageSendTo,\n instance: ConfigInstanceSelect,\n interface: ConfigInterface,\n ip: ConfigIP,\n jsonEditor: ConfigJsonEditor,\n language: ConfigLanguage,\n license: ConfigLicense,\n number: ConfigNumber,\n objectId: ConfigObjectId,\n password: ConfigPassword,\n pattern: ConfigPattern,\n port: ConfigPort,\n qrCode: ConfigQrCode,\n room: ConfigRoom,\n select: ConfigSelect,\n selectSendTo: ConfigSelectSendTo,\n // @deprecated Use \"sendTo\"\n sendto: ConfigSendTo,\n sendTo: ConfigSendTo,\n setState: ConfigSetState,\n slider: ConfigSlider,\n state: ConfigState,\n staticImage: ConfigStaticImage,\n staticLink: ConfigStaticText,\n staticText: ConfigStaticText,\n table: ConfigTable,\n text: ConfigText,\n textSendTo: ConfigTextSendTo,\n timePicker: ConfigTimePicker,\n topic: ConfigTopic,\n uuid: ConfigUUID,\n user: ConfigUser,\n};\n\nconst styles: Record<string, any> = {\n fullWidth: {\n width: '100%',\n // height: '100%',\n },\n paper: {\n margin: 1,\n width: 'auto !important',\n overflowY: 'auto',\n paddingBottom: 1,\n },\n paperWithIcons: {\n height: 'calc(100vh - 259px) !important',\n },\n paperWithoutIcons: {\n height: 'calc(100vh - 235px) !important',\n },\n padding: {\n padding: '10px',\n },\n heading: {},\n primary: (theme: IobTheme) => ({\n backgroundColor: theme.palette.primary.main,\n color: theme.palette.mode === 'dark' ? 'inherit' : '#FFF',\n }),\n secondary: (theme: IobTheme) => ({\n backgroundColor: theme.palette.secondary.main,\n }),\n};\n\ninterface ConfigPanelProps extends ConfigGenericProps {\n schema: ConfigItemPanel;\n withIcons?: boolean;\n}\ninterface ConfigPanelState extends ConfigGenericState {\n expanded?: boolean;\n}\n\nclass ConfigPanel extends ConfigGeneric<ConfigPanelProps, ConfigPanelState> {\n componentDidMount(): void {\n super.componentDidMount();\n if (this.props.schema && this.props.schema.collapsable) {\n this.setState({\n expanded:\n (((window as any)._localStorage as Storage) || window.localStorage).getItem(\n `${this.props.adapterName}.${this.props.attr}`,\n ) === 'true',\n });\n }\n }\n\n renderItems(items: Record<string, any>, disabled: boolean): JSX.Element[] | null {\n return items\n ? Object.keys(items).map(attr => {\n if (this.props.multiEdit && items[attr].noMultiEdit) {\n return null;\n }\n\n const type = items[attr].type || 'panel';\n let ItemComponent: typeof ConfigGeneric<any, any>;\n if (type === 'custom') {\n // name\n // url\n if (items[attr].url) {\n ItemComponent = ConfigCustom;\n } else if (this.props.customs && this.props.customs[items[attr].component]) {\n ItemComponent = this.props.customs[items[attr].component];\n } else {\n console.error(`Cannot find custom component: ${items[attr].component}`);\n ItemComponent = ConfigGeneric;\n }\n } else if (type === 'panel') {\n ItemComponent = ConfigPanel;\n } else {\n ItemComponent = components[type] || ConfigGeneric;\n }\n\n return (\n <ItemComponent\n key={`${attr}_${this.props.index === undefined ? '' : this.props.index}`}\n index={this.props.index}\n changed={this.props.changed}\n arrayIndex={this.props.arrayIndex}\n globalData={this.props.globalData}\n onCommandRunning={this.props.onCommandRunning}\n commandRunning={this.props.commandRunning}\n style={styles.panel}\n socket={this.props.socket}\n adapterName={this.props.adapterName}\n instance={this.props.instance}\n common={this.props.common}\n customs={this.props.customs}\n alive={this.props.alive}\n themeType={this.props.themeType}\n themeName={this.props.themeName}\n theme={this.props.theme}\n data={this.props.data}\n originalData={this.props.originalData}\n systemConfig={this.props.systemConfig}\n onError={this.props.onError}\n onChange={this.props.onChange}\n onBackEndCommand={this.props.onBackEndCommand}\n multiEdit={this.props.multiEdit}\n dateFormat={this.props.dateFormat}\n isFloatComma={this.props.isFloatComma}\n disabled={disabled}\n imagePrefix={this.props.imagePrefix}\n changeLanguage={this.props.changeLanguage}\n forceUpdate={this.props.forceUpdate}\n registerOnForceUpdate={this.props.registerOnForceUpdate}\n customObj={this.props.customObj}\n instanceObj={this.props.instanceObj}\n custom={this.props.custom}\n schema={items[attr]}\n DeviceManager={this.props.DeviceManager}\n attr={attr}\n table={this.props.table}\n />\n );\n })\n : null;\n }\n\n render(): JSX.Element | null {\n const schema = this.props.schema;\n\n if (!schema) {\n return null;\n }\n\n const { disabled, hidden } = this.calculate(schema);\n\n const items = this.props.schema.items;\n const schemaStyle = this.props.schema.style || {};\n\n if (hidden) {\n if (schema.hideOnlyControl) {\n const item = (\n <Grid2\n size={{\n xs: schema.xs || undefined,\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n sx={Utils.getStyle(\n this.props.theme,\n { marginBottom: 0, textAlign: 'left' /* marginRight: 8, */ },\n schemaStyle,\n this.props.themeType === 'dark' && schema.darkStyle,\n )}\n />\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n return item;\n }\n return null;\n }\n\n if (this.props.table) {\n return this.renderItems(items, disabled) as any as JSX.Element;\n }\n\n if (this.props.custom) {\n return (\n <Grid2\n key={`${this.props.attr}_${this.props.index}`}\n container\n style={styles.fullWidth}\n columnSpacing={2}\n rowSpacing={1}\n sx={schemaStyle}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n );\n }\n\n let content;\n if (schema.collapsable) {\n content = (\n <Accordion\n key={`${this.props.attr}_${this.props.index}`}\n style={styles.fullWidth}\n expanded={!!this.state.expanded}\n onChange={() => {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.adapterName}.${this.props.attr}`,\n this.state.expanded ? 'false' : 'true',\n );\n this.setState({ expanded: !this.state.expanded });\n }}\n >\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n sx={Utils.getStyle(\n this.props.theme,\n schemaStyle,\n this.props.themeType && schema.darkStyle,\n schema.color === 'primary'\n ? styles.primary\n : schema.color === 'secondary' && styles.secondary,\n { width: '100%' },\n )}\n >\n <Typography style={styles.heading}>{this.getText(schema.label)}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <Grid2\n container\n columnSpacing={2}\n rowSpacing={1}\n sx={{ ...schemaStyle, width: '100%', padding: '10px' }}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n </AccordionDetails>\n </Accordion>\n );\n } else {\n content = (\n <Box\n component=\"div\"\n key={`${this.props.attr}_${this.props.index}`}\n className={this.props.className}\n sx={Utils.getStyle(\n this.props.theme,\n this.props.style,\n schemaStyle,\n { width: '100%' },\n this.props.isParentTab && styles.paper,\n this.props.isParentTab &&\n (this.props.withIcons ? styles.paperWithIcons : styles.paperWithoutIcons),\n )}\n >\n <Grid2\n container\n columnSpacing={2}\n rowSpacing={1}\n sx={Utils.getStyle(\n this.props.theme,\n { width: '100%' },\n this.props.isParentTab && styles.padding,\n this.props.schema.innerStyle,\n )}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n </Box>\n );\n }\n\n if (!this.props.isParentTab) {\n const item = (\n <Grid2\n title={this.getText(schema.tooltip)}\n size={{\n xs: schema.xs || undefined,\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n sx={{ marginBottom: 0, /* marginRight: 8, */ textAlign: 'left', ...schemaStyle }}\n >\n {content}\n </Grid2>\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n return item;\n }\n return content;\n }\n}\n\nexport default ConfigPanel;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigPanel.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAiB,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,YAAY,MAAM,gBAAgB,C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B,UAAU,EAAE,CAAC,EACb,EAAE,EAAE,KAAK,CAAC,QAAQ,CACd,IAAI,CAAC,KAAK,CAAC,KAAK,EAChB,EAAE,KAAK,EAAE,MAAM,EAAE,EACjB,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,MAAM,CAAC,OAAO,EACxC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAC/B,IAEA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAC9B,CACN,CACT,CAAC;SACL;QAED,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YACzB,MAAM,IAAI,GAAG,CACT,oBAAC,KAAK,IACF,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EACnC,IAAI,EAAE;oBACF,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;iBAC7B,EACD,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,IAE/E,OAAO,CACJ,CACX,CAAC;YAEF,IAAI,MAAM,CAAC,OAAO,EAAE;gBAChB,OAAO,CACH;oBACI,6BAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAI;oBAC/C,IAAI,CACN,CACN,CAAC;aACL;YACD,OAAO,IAAI,CAAC;SACf;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Grid2, Accordion, AccordionSummary, AccordionDetails, Typography, Box } from '@mui/material';\n\nimport { ExpandMore as ExpandMoreIcon } from '@mui/icons-material';\n\nimport { type IobTheme, Utils } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemPanel } from '#JC/types';\n\nimport ConfigGeneric, { type ConfigGenericState, type ConfigGenericProps } from './ConfigGeneric';\nimport ConfigAccordion from './ConfigAccordion';\nimport ConfigAlive from './ConfigAlive';\nimport ConfigAutocomplete from './ConfigAutocomplete';\nimport ConfigAutocompleteSendTo from './ConfigAutocompleteSendTo';\nimport ConfigCRON from './ConfigCRON';\nimport ConfigCertificateSelect from './ConfigCertificateSelect';\nimport ConfigCertificates from './ConfigCertificates';\nimport ConfigCertCollection from './ConfigCertCollection';\nimport ConfigCheckLicense from './ConfigCheckLicense';\nimport ConfigCheckbox from './ConfigCheckbox';\nimport ConfigChip from './ConfigChip';\nimport ConfigColor from './ConfigColor';\nimport ConfigCoordinates from './ConfigCoordinates';\nimport ConfigCustom from './ConfigCustom';\nimport ConfigDatePicker from './ConfigDatePicker';\nimport ConfigDeviceManager from './ConfigDeviceManager';\nimport ConfigFile from './ConfigFile';\nimport ConfigFileSelector from './ConfigFileSelector';\nimport ConfigFunc from './ConfigFunc';\nimport ConfigIP from './ConfigIP';\nimport ConfigImageSendTo from './ConfigImageSendTo';\nimport ConfigImageUpload from './ConfigImageUpload';\nimport ConfigInstanceSelect from './ConfigInstanceSelect';\nimport ConfigInterface from './ConfigInterface';\nimport ConfigJsonEditor from './ConfigJsonEditor';\nimport ConfigLanguage from './ConfigLanguage';\nimport ConfigLicense from './ConfigLicense';\nimport ConfigNumber from './ConfigNumber';\nimport ConfigObjectId from './ConfigObjectId';\nimport ConfigPassword from './ConfigPassword';\nimport ConfigPattern from './ConfigPattern';\nimport ConfigPort from './ConfigPort';\nimport ConfigRoom from './ConfigRoom';\nimport ConfigSelect from './ConfigSelect';\nimport ConfigSelectSendTo from './ConfigSelectSendTo';\nimport ConfigSendTo from './ConfigSendto';\nimport ConfigSetState from './ConfigSetState';\nimport ConfigSlider from './ConfigSlider';\nimport ConfigState from './ConfigState';\nimport ConfigStaticDivider from './ConfigStaticDivider';\nimport ConfigStaticHeader from './ConfigStaticHeader';\nimport ConfigStaticImage from './ConfigStaticImage';\nimport ConfigStaticInfo from './ConfigStaticInfo';\nimport ConfigStaticText from './ConfigStaticText';\nimport ConfigTable from './ConfigTable';\nimport ConfigText from './ConfigText';\nimport ConfigTextSendTo from './ConfigTextSendTo';\nimport ConfigTimePicker from './ConfigTimePicker';\nimport ConfigTopic from './ConfigTopic';\nimport ConfigUUID from './ConfigUUID';\nimport ConfigUser from './ConfigUser';\nimport ConfigQrCode from './ConfigQrCode';\n\nconst components: Record<string, typeof ConfigGeneric<any, any>> = {\n accordion: ConfigAccordion,\n alive: ConfigAlive,\n autocomplete: ConfigAutocomplete,\n autocompleteSendTo: ConfigAutocompleteSendTo,\n certCollection: ConfigCertCollection,\n certificate: ConfigCertificateSelect,\n certificates: ConfigCertificates,\n checkbox: ConfigCheckbox,\n checkLicense: ConfigCheckLicense,\n chip: ConfigChip, // deprecated. Use \"chips\"\n chips: ConfigChip,\n color: ConfigColor,\n coordinates: ConfigCoordinates,\n cron: ConfigCRON,\n custom: ConfigCustom,\n datePicker: ConfigDatePicker,\n deviceManager: ConfigDeviceManager,\n divider: ConfigStaticDivider,\n file: ConfigFile,\n fileSelector: ConfigFileSelector,\n func: ConfigFunc,\n header: ConfigStaticHeader,\n image: ConfigImageUpload,\n imageSendTo: ConfigImageSendTo,\n instance: ConfigInstanceSelect,\n interface: ConfigInterface,\n ip: ConfigIP,\n jsonEditor: ConfigJsonEditor,\n language: ConfigLanguage,\n license: ConfigLicense,\n number: ConfigNumber,\n objectId: ConfigObjectId,\n password: ConfigPassword,\n pattern: ConfigPattern,\n port: ConfigPort,\n qrCode: ConfigQrCode,\n room: ConfigRoom,\n select: ConfigSelect,\n selectSendTo: ConfigSelectSendTo,\n // @deprecated Use \"sendTo\"\n sendto: ConfigSendTo,\n sendTo: ConfigSendTo,\n setState: ConfigSetState,\n slider: ConfigSlider,\n state: ConfigState,\n staticImage: ConfigStaticImage,\n staticInfo: ConfigStaticInfo,\n staticLink: ConfigStaticText,\n staticText: ConfigStaticText,\n table: ConfigTable,\n text: ConfigText,\n textSendTo: ConfigTextSendTo,\n timePicker: ConfigTimePicker,\n topic: ConfigTopic,\n uuid: ConfigUUID,\n user: ConfigUser,\n};\n\nconst styles: Record<string, any> = {\n fullWidth: {\n width: '100%',\n // height: '100%',\n },\n paper: {\n margin: 1,\n width: 'auto !important',\n overflowY: 'auto',\n paddingBottom: 1,\n },\n paperWithIcons: {\n height: 'calc(100vh - 259px) !important',\n },\n paperWithoutIcons: {\n height: 'calc(100vh - 235px) !important',\n },\n padding: {\n padding: '10px',\n },\n heading: {},\n primary: (theme: IobTheme) => ({\n backgroundColor: theme.palette.primary.main,\n color: theme.palette.mode === 'dark' ? 'inherit' : '#FFF',\n }),\n secondary: (theme: IobTheme) => ({\n backgroundColor: theme.palette.secondary.main,\n }),\n};\n\ninterface ConfigPanelProps extends ConfigGenericProps {\n schema: ConfigItemPanel;\n withIcons?: boolean;\n}\ninterface ConfigPanelState extends ConfigGenericState {\n expanded?: boolean;\n}\n\nclass ConfigPanel extends ConfigGeneric<ConfigPanelProps, ConfigPanelState> {\n componentDidMount(): void {\n super.componentDidMount();\n if (this.props.schema && this.props.schema.collapsable) {\n this.setState({\n expanded:\n (((window as any)._localStorage as Storage) || window.localStorage).getItem(\n `${this.props.adapterName}.${this.props.attr}`,\n ) === 'true',\n });\n }\n }\n\n renderItems(items: Record<string, any>, disabled: boolean): JSX.Element[] | null {\n return items\n ? Object.keys(items).map(attr => {\n if (this.props.multiEdit && items[attr].noMultiEdit) {\n return null;\n }\n\n const type = items[attr].type || 'panel';\n let ItemComponent: typeof ConfigGeneric<any, any>;\n if (type === 'custom') {\n // name\n // url\n if (items[attr].url) {\n ItemComponent = ConfigCustom;\n } else if (this.props.customs && this.props.customs[items[attr].component]) {\n ItemComponent = this.props.customs[items[attr].component];\n } else {\n console.error(`Cannot find custom component: ${items[attr].component}`);\n ItemComponent = ConfigGeneric;\n }\n } else if (type === 'panel') {\n ItemComponent = ConfigPanel;\n } else {\n ItemComponent = components[type] || ConfigGeneric;\n }\n\n return (\n <ItemComponent\n key={`${attr}_${this.props.index === undefined ? '' : this.props.index}`}\n index={this.props.index}\n changed={this.props.changed}\n arrayIndex={this.props.arrayIndex}\n globalData={this.props.globalData}\n onCommandRunning={this.props.onCommandRunning}\n commandRunning={this.props.commandRunning}\n style={styles.panel}\n socket={this.props.socket}\n adapterName={this.props.adapterName}\n instance={this.props.instance}\n common={this.props.common}\n customs={this.props.customs}\n alive={this.props.alive}\n themeType={this.props.themeType}\n themeName={this.props.themeName}\n theme={this.props.theme}\n data={this.props.data}\n originalData={this.props.originalData}\n systemConfig={this.props.systemConfig}\n onError={this.props.onError}\n onChange={this.props.onChange}\n onBackEndCommand={this.props.onBackEndCommand}\n multiEdit={this.props.multiEdit}\n dateFormat={this.props.dateFormat}\n isFloatComma={this.props.isFloatComma}\n disabled={disabled}\n imagePrefix={this.props.imagePrefix}\n changeLanguage={this.props.changeLanguage}\n forceUpdate={this.props.forceUpdate}\n registerOnForceUpdate={this.props.registerOnForceUpdate}\n customObj={this.props.customObj}\n instanceObj={this.props.instanceObj}\n custom={this.props.custom}\n schema={items[attr]}\n DeviceManager={this.props.DeviceManager}\n attr={attr}\n table={this.props.table}\n />\n );\n })\n : null;\n }\n\n render(): JSX.Element | null {\n const schema = this.props.schema;\n\n if (!schema) {\n return null;\n }\n\n const { disabled, hidden } = this.calculate(schema);\n\n const items = this.props.schema.items;\n const schemaStyle = this.props.schema.style || {};\n\n if (hidden) {\n if (schema.hideOnlyControl) {\n const item = (\n <Grid2\n size={{\n xs: schema.xs || undefined,\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n sx={Utils.getStyle(\n this.props.theme,\n { marginBottom: 0, textAlign: 'left' /* marginRight: 8, */ },\n schemaStyle,\n this.props.themeType === 'dark' && schema.darkStyle,\n )}\n />\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n return item;\n }\n return null;\n }\n\n if (this.props.table) {\n return this.renderItems(items, disabled) as any as JSX.Element;\n }\n\n if (this.props.custom) {\n return (\n <Grid2\n key={`${this.props.attr}_${this.props.index}`}\n container\n style={styles.fullWidth}\n columnSpacing={2}\n rowSpacing={1}\n sx={schemaStyle}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n );\n }\n\n let content;\n if (schema.collapsable) {\n content = (\n <Accordion\n key={`${this.props.attr}_${this.props.index}`}\n style={styles.fullWidth}\n expanded={!!this.state.expanded}\n onChange={() => {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.adapterName}.${this.props.attr}`,\n this.state.expanded ? 'false' : 'true',\n );\n this.setState({ expanded: !this.state.expanded });\n }}\n >\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n sx={Utils.getStyle(\n this.props.theme,\n schemaStyle,\n this.props.themeType && schema.darkStyle,\n schema.color === 'primary'\n ? styles.primary\n : schema.color === 'secondary' && styles.secondary,\n { width: '100%' },\n )}\n >\n <Typography style={styles.heading}>{this.getText(schema.label)}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <Grid2\n container\n columnSpacing={2}\n rowSpacing={1}\n sx={{ ...schemaStyle, width: '100%', padding: '10px' }}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n </AccordionDetails>\n </Accordion>\n );\n } else {\n content = (\n <Box\n component=\"div\"\n key={`${this.props.attr}_${this.props.index}`}\n className={this.props.className}\n sx={Utils.getStyle(\n this.props.theme,\n this.props.style,\n schemaStyle,\n { width: '100%' },\n this.props.isParentTab && styles.paper,\n this.props.isParentTab &&\n (this.props.withIcons ? styles.paperWithIcons : styles.paperWithoutIcons),\n )}\n >\n <Grid2\n container\n columnSpacing={2}\n rowSpacing={1}\n sx={Utils.getStyle(\n this.props.theme,\n { width: '100%' },\n this.props.isParentTab && styles.padding,\n this.props.schema.innerStyle,\n )}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n </Box>\n );\n }\n\n if (!this.props.isParentTab) {\n const item = (\n <Grid2\n title={this.getText(schema.tooltip)}\n size={{\n xs: schema.xs || undefined,\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n sx={{ marginBottom: 0, /* marginRight: 8, */ textAlign: 'left', ...schemaStyle }}\n >\n {content}\n </Grid2>\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n return item;\n }\n return content;\n }\n}\n\nexport default ConfigPanel;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IconButton, TextField } from '@mui/material';
|
|
3
|
-
import { IconCopy, Utils } from '@iobroker/adapter-react-v5';
|
|
3
|
+
import { I18n, IconCopy, Utils } from '@iobroker/adapter-react-v5';
|
|
4
4
|
import ConfigGeneric from './ConfigGeneric';
|
|
5
5
|
class ConfigPattern extends ConfigGeneric {
|
|
6
6
|
renderItem(_error, disabled) {
|
|
@@ -8,7 +8,7 @@ class ConfigPattern extends ConfigGeneric {
|
|
|
8
8
|
input: {
|
|
9
9
|
endAdornment: this.props.schema.copyToClipboard ? (React.createElement(IconButton, { size: "small", onClick: () => {
|
|
10
10
|
Utils.copyToClipboard(this.getPattern(this.props.schema.pattern));
|
|
11
|
-
window.alert('
|
|
11
|
+
window.alert(I18n.t('ra_Copied'));
|
|
12
12
|
} },
|
|
13
13
|
React.createElement(IconCopy, null))) : undefined,
|
|
14
14
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigPattern.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigPattern.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA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C,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,UAAU,EAAE,IAAI,CAAC,UAAU,CACvB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,GACH,CACL,CAAC;IACN,CAAC;CACJ;AAED,eAAe,aAAa,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { IconButton, TextField } from '@mui/material';\n\nimport { I18n, IconCopy, Utils } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemPattern } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigPatternProps extends ConfigGenericProps {\n schema: ConfigItemPattern;\n}\n\nclass ConfigPattern extends ConfigGeneric<ConfigPatternProps, ConfigGenericState> {\n renderItem(_error: unknown, disabled: boolean): JSX.Element | null {\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n disabled={!!disabled}\n slotProps={{\n input: {\n endAdornment: this.props.schema.copyToClipboard ? (\n <IconButton\n size=\"small\"\n onClick={() => {\n Utils.copyToClipboard(this.getPattern(this.props.schema.pattern));\n window.alert(I18n.t('ra_Copied'));\n }}\n >\n <IconCopy />\n </IconButton>\n ) : undefined,\n },\n }}\n value={this.getPattern(this.props.schema.pattern)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n}\n\nexport default ConfigPattern;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type JSX } from 'react';
|
|
2
|
+
import type { ConfigItemStaticInfo } from '#JC/types';
|
|
3
|
+
import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
|
|
4
|
+
interface ConfigStaticInfoProps extends ConfigGenericProps {
|
|
5
|
+
schema: ConfigItemStaticInfo;
|
|
6
|
+
}
|
|
7
|
+
declare class ConfigStaticInfo extends ConfigGeneric<ConfigStaticInfoProps, ConfigGenericState> {
|
|
8
|
+
renderItem(_error: string): JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
export default ConfigStaticInfo;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import { ContentCopy } from '@mui/icons-material';
|
|
4
|
+
import { I18n, Icon, Utils } from '@iobroker/adapter-react-v5';
|
|
5
|
+
import ConfigGeneric from './ConfigGeneric';
|
|
6
|
+
function valueBlinkOnce(theme, force, color) {
|
|
7
|
+
if (typeof color === 'string') {
|
|
8
|
+
return {
|
|
9
|
+
'@keyframes newValueAnimationOnceColor': {
|
|
10
|
+
'0%': {
|
|
11
|
+
color: force ? `${color} !important` : color,
|
|
12
|
+
},
|
|
13
|
+
'100%': {
|
|
14
|
+
color: theme.palette.mode === 'dark'
|
|
15
|
+
? force
|
|
16
|
+
? '#fff !important'
|
|
17
|
+
: '#fff'
|
|
18
|
+
: force
|
|
19
|
+
? '#000 !important'
|
|
20
|
+
: '#000',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
animation: 'newValueAnimationOnceColor 2s ease-in-out',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
'@keyframes newValueAnimationOnce': {
|
|
28
|
+
'0%': {
|
|
29
|
+
color: force ? `#00f900 !important` : '#00f900',
|
|
30
|
+
},
|
|
31
|
+
'80%': {
|
|
32
|
+
color: theme.palette.mode === 'dark'
|
|
33
|
+
? force
|
|
34
|
+
? `#518851 !important`
|
|
35
|
+
: '#518851'
|
|
36
|
+
: force
|
|
37
|
+
? `#008000 !important`
|
|
38
|
+
: '#008000',
|
|
39
|
+
},
|
|
40
|
+
'100%': {
|
|
41
|
+
color: theme.palette.mode === 'dark'
|
|
42
|
+
? force
|
|
43
|
+
? '#fff !important'
|
|
44
|
+
: '#fff'
|
|
45
|
+
: force
|
|
46
|
+
? '#000 !important'
|
|
47
|
+
: '#000',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
animation: 'newValueAnimationOnce 2s ease-in-out',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function valueBlink(theme, color) {
|
|
54
|
+
if (typeof color === 'string') {
|
|
55
|
+
return {
|
|
56
|
+
'@keyframes blinkAnimationColor': {
|
|
57
|
+
'0%': {
|
|
58
|
+
color,
|
|
59
|
+
},
|
|
60
|
+
'100%': {
|
|
61
|
+
color: theme.palette.mode === 'dark' ? '#fff' : '#000',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
animation: 'blinkAnimationColor 2s ease-in-out infinite',
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
'@keyframes blinkAnimation': {
|
|
69
|
+
'0%': {
|
|
70
|
+
color: '#00f900',
|
|
71
|
+
},
|
|
72
|
+
'80%': {
|
|
73
|
+
color: theme.palette.mode === 'dark' ? '#518851' : '#008000',
|
|
74
|
+
},
|
|
75
|
+
'100%': {
|
|
76
|
+
color: theme.palette.mode === 'dark' ? '#fff' : '#000',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
animation: 'blinkAnimation 2s ease-in-out infinite',
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const styles = {
|
|
83
|
+
label: {
|
|
84
|
+
fontWeight: 'bold',
|
|
85
|
+
},
|
|
86
|
+
valueImage: {
|
|
87
|
+
maxHeight: '100%',
|
|
88
|
+
},
|
|
89
|
+
valueAndUnit: {
|
|
90
|
+
display: 'flex',
|
|
91
|
+
gap: 4,
|
|
92
|
+
alignItems: 'baseline',
|
|
93
|
+
},
|
|
94
|
+
value: {},
|
|
95
|
+
unit: {
|
|
96
|
+
fontSize: 'smaller',
|
|
97
|
+
opacity: 0.7,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
class ConfigStaticInfo extends ConfigGeneric {
|
|
101
|
+
renderItem(_error) {
|
|
102
|
+
let label = this.getText(this.props.schema.text || this.props.schema.label, this.props.schema.noTranslation);
|
|
103
|
+
if (this.props.schema.addColon && typeof label === 'string' && !label.trim().endsWith(':')) {
|
|
104
|
+
label = `${label.trim()}:`;
|
|
105
|
+
}
|
|
106
|
+
if (label &&
|
|
107
|
+
(label.includes('<a ') || label.includes('<br') || label.includes('<b>') || label.includes('<i>'))) {
|
|
108
|
+
label = Utils.renderTextWithA(label);
|
|
109
|
+
}
|
|
110
|
+
let fontSize;
|
|
111
|
+
if (this.props.schema.size === 'normal') {
|
|
112
|
+
fontSize = 16;
|
|
113
|
+
}
|
|
114
|
+
else if (this.props.schema.size === 'large') {
|
|
115
|
+
fontSize = 20;
|
|
116
|
+
}
|
|
117
|
+
else if (typeof this.props.schema.size === 'number') {
|
|
118
|
+
fontSize = this.props.schema.size;
|
|
119
|
+
}
|
|
120
|
+
const divStyle = {
|
|
121
|
+
width: '100%',
|
|
122
|
+
height: '100%',
|
|
123
|
+
display: 'flex',
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
position: 'relative',
|
|
126
|
+
fontSize,
|
|
127
|
+
};
|
|
128
|
+
if (this.props.schema.narrow) {
|
|
129
|
+
divStyle.gap = 8;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
divStyle.justifyContent = 'space-between';
|
|
133
|
+
}
|
|
134
|
+
let value;
|
|
135
|
+
let valueTxt;
|
|
136
|
+
if (this.props.schema.data && typeof this.props.schema.data === 'object' && this.props.schema.data.en) {
|
|
137
|
+
valueTxt = this.getText(this.props.schema.data);
|
|
138
|
+
}
|
|
139
|
+
else if (typeof this.props.schema.data === 'object' ||
|
|
140
|
+
this.props.schema.data === undefined ||
|
|
141
|
+
this.props.schema.data === null) {
|
|
142
|
+
valueTxt = JSON.stringify(this.props.schema.data);
|
|
143
|
+
}
|
|
144
|
+
else if (typeof this.props.schema.data === 'number') {
|
|
145
|
+
valueTxt = this.props.schema.data.toString();
|
|
146
|
+
if (this.props.isFloatComma) {
|
|
147
|
+
valueTxt = valueTxt.replace('.', ',');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
valueTxt = this.props.schema.data.toString();
|
|
152
|
+
}
|
|
153
|
+
if (valueTxt.startsWith('data:image/')) {
|
|
154
|
+
value = (React.createElement("div", { style: { ...styles.value, ...styles.valueImage, ...(this.props.schema.styleValue || undefined) } },
|
|
155
|
+
React.createElement(Icon, { src: valueTxt })));
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
value = React.createElement("div", { style: { ...styles.value, ...(this.props.schema.styleValue || undefined) } }, valueTxt);
|
|
159
|
+
}
|
|
160
|
+
if (this.props.schema.blinkOnUpdate && this.props.schema.blink) {
|
|
161
|
+
const style1 = valueBlinkOnce(this.props.theme, true, this.props.schema.blinkOnUpdate);
|
|
162
|
+
const style2 = valueBlink(this.props.theme, this.props.schema.blink);
|
|
163
|
+
value = (React.createElement(Box, { key: valueTxt, sx: { ...style1, ...style2 } }, value));
|
|
164
|
+
}
|
|
165
|
+
else if (this.props.schema.blinkOnUpdate) {
|
|
166
|
+
const style = valueBlinkOnce(this.props.theme, false, this.props.schema.blinkOnUpdate);
|
|
167
|
+
value = (React.createElement(Box, { key: valueTxt, sx: style }, value));
|
|
168
|
+
}
|
|
169
|
+
else if (this.props.schema.blink) {
|
|
170
|
+
const style = valueBlink(this.props.theme, this.props.schema.blink);
|
|
171
|
+
value = React.createElement(Box, { sx: style }, value);
|
|
172
|
+
}
|
|
173
|
+
if (this.props.schema.unit) {
|
|
174
|
+
value = (React.createElement("div", { style: styles.valueAndUnit },
|
|
175
|
+
value,
|
|
176
|
+
React.createElement("div", { style: { ...styles.unit, ...(this.props.schema.styleUnit || undefined) } }, this.getText(this.props.schema.unit))));
|
|
177
|
+
}
|
|
178
|
+
let labelIcon;
|
|
179
|
+
if (this.props.schema.labelIcon) {
|
|
180
|
+
labelIcon = (React.createElement(Icon, { src: this.props.schema.labelIcon, style: { marginRight: 4 } }));
|
|
181
|
+
}
|
|
182
|
+
let copyButton;
|
|
183
|
+
if (this.props.schema.copyToClipboard) {
|
|
184
|
+
copyButton = (React.createElement(ContentCopy, { className: "staticCopyButton", style: {
|
|
185
|
+
position: 'absolute',
|
|
186
|
+
top: 'calc(50% - 12px)',
|
|
187
|
+
right: 0,
|
|
188
|
+
cursor: 'pointer',
|
|
189
|
+
}, onClick: () => {
|
|
190
|
+
Utils.copyToClipboard(valueTxt);
|
|
191
|
+
window.alert(I18n.t('ra_Copied'));
|
|
192
|
+
} }));
|
|
193
|
+
}
|
|
194
|
+
return (React.createElement(Box, { component: "div", style: divStyle, sx: {
|
|
195
|
+
'& .staticCopyButton': {
|
|
196
|
+
display: 'none',
|
|
197
|
+
},
|
|
198
|
+
'& .staticCopyButton:action': {
|
|
199
|
+
transform: 'scale(0.9)',
|
|
200
|
+
},
|
|
201
|
+
'&:hover .staticCopyButton': {
|
|
202
|
+
display: 'block',
|
|
203
|
+
},
|
|
204
|
+
} },
|
|
205
|
+
React.createElement("div", { style: { ...styles.label, ...(this.props.schema.styleLabel || undefined) } },
|
|
206
|
+
labelIcon,
|
|
207
|
+
label),
|
|
208
|
+
value,
|
|
209
|
+
copyButton));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
export default ConfigStaticInfo;
|
|
213
|
+
//# sourceMappingURL=ConfigStaticInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigStaticInfo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigStaticInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAiB,KAAK,E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;oBACV,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;oBAChC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACtC,CAAC,GACH,CACL,CAAC;SACL;QAED,OAAO,CACH,oBAAC,GAAG,IACA,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,QAAQ,EACf,EAAE,EAAE;gBACA,qBAAqB,EAAE;oBACnB,OAAO,EAAE,MAAM;iBAClB;gBACD,4BAA4B,EAAE;oBAC1B,SAAS,EAAE,YAAY;iBAC1B;gBACD,2BAA2B,EAAE;oBACzB,OAAO,EAAE,OAAO;iBACnB;aACJ;YAED,6BAAK,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,IAAI,SAAS,CAAC,EAAE;gBAC1E,SAAS;gBACT,KAAK,CACJ;YACL,KAAK;YACL,UAAU,CACT,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Box } from '@mui/material';\nimport { ContentCopy } from '@mui/icons-material';\nimport { I18n, Icon, type IobTheme, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemStaticInfo } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nfunction valueBlinkOnce(theme: IobTheme, force: boolean, color?: string | boolean): any {\n if (typeof color === 'string') {\n return {\n '@keyframes newValueAnimationOnceColor': {\n '0%': {\n color: force ? `${color} !important` : color,\n },\n '100%': {\n color:\n theme.palette.mode === 'dark'\n ? force\n ? '#fff !important'\n : '#fff'\n : force\n ? '#000 !important'\n : '#000',\n },\n },\n animation: 'newValueAnimationOnceColor 2s ease-in-out',\n };\n }\n return {\n '@keyframes newValueAnimationOnce': {\n '0%': {\n color: force ? `#00f900 !important` : '#00f900',\n },\n '80%': {\n color:\n theme.palette.mode === 'dark'\n ? force\n ? `#518851 !important`\n : '#518851'\n : force\n ? `#008000 !important`\n : '#008000',\n },\n '100%': {\n color:\n theme.palette.mode === 'dark'\n ? force\n ? '#fff !important'\n : '#fff'\n : force\n ? '#000 !important'\n : '#000',\n },\n },\n animation: 'newValueAnimationOnce 2s ease-in-out',\n };\n}\n\nfunction valueBlink(theme: IobTheme, color?: string | boolean): any {\n if (typeof color === 'string') {\n return {\n '@keyframes blinkAnimationColor': {\n '0%': {\n color,\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'blinkAnimationColor 2s ease-in-out infinite',\n };\n }\n return {\n '@keyframes blinkAnimation': {\n '0%': {\n color: '#00f900',\n },\n '80%': {\n color: theme.palette.mode === 'dark' ? '#518851' : '#008000',\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'blinkAnimation 2s ease-in-out infinite',\n };\n}\n\nconst styles: Record<string, any> = {\n label: {\n fontWeight: 'bold',\n },\n valueImage: {\n maxHeight: '100%',\n },\n valueAndUnit: {\n display: 'flex',\n gap: 4,\n alignItems: 'baseline',\n },\n value: {},\n unit: {\n fontSize: 'smaller',\n opacity: 0.7,\n },\n};\n\ninterface ConfigStaticInfoProps extends ConfigGenericProps {\n schema: ConfigItemStaticInfo;\n}\n\nclass ConfigStaticInfo extends ConfigGeneric<ConfigStaticInfoProps, ConfigGenericState> {\n renderItem(_error: string): JSX.Element {\n let label: string | JSX.Element | JSX.Element[] = this.getText(\n this.props.schema.text || this.props.schema.label,\n this.props.schema.noTranslation,\n );\n if (this.props.schema.addColon && typeof label === 'string' && !label.trim().endsWith(':')) {\n label = `${label.trim()}:`;\n }\n\n if (\n label &&\n (label.includes('<a ') || label.includes('<br') || label.includes('<b>') || label.includes('<i>'))\n ) {\n label = Utils.renderTextWithA(label);\n }\n let fontSize: number | undefined;\n if (this.props.schema.size === 'normal') {\n fontSize = 16;\n } else if (this.props.schema.size === 'large') {\n fontSize = 20;\n } else if (typeof this.props.schema.size === 'number') {\n fontSize = this.props.schema.size;\n }\n\n const divStyle: React.CSSProperties = {\n width: '100%',\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n position: 'relative',\n fontSize,\n };\n\n if (this.props.schema.narrow) {\n divStyle.gap = 8;\n } else {\n divStyle.justifyContent = 'space-between';\n }\n\n let value: React.JSX.Element;\n let valueTxt: string;\n if (this.props.schema.data && typeof this.props.schema.data === 'object' && this.props.schema.data.en) {\n valueTxt = this.getText(this.props.schema.data);\n } else if (\n typeof this.props.schema.data === 'object' ||\n this.props.schema.data === undefined ||\n this.props.schema.data === null\n ) {\n valueTxt = JSON.stringify(this.props.schema.data);\n } else if (typeof this.props.schema.data === 'number') {\n valueTxt = this.props.schema.data.toString();\n if (this.props.isFloatComma) {\n valueTxt = valueTxt.replace('.', ',');\n }\n } else {\n valueTxt = this.props.schema.data.toString();\n }\n if (valueTxt.startsWith('data:image/')) {\n value = (\n <div style={{ ...styles.value, ...styles.valueImage, ...(this.props.schema.styleValue || undefined) }}>\n <Icon src={valueTxt} />\n </div>\n );\n } else {\n value = <div style={{ ...styles.value, ...(this.props.schema.styleValue || undefined) }}>{valueTxt}</div>;\n }\n if (this.props.schema.blinkOnUpdate && this.props.schema.blink) {\n const style1 = valueBlinkOnce(this.props.theme, true, this.props.schema.blinkOnUpdate);\n const style2 = valueBlink(this.props.theme, this.props.schema.blink);\n value = (\n <Box\n key={valueTxt}\n sx={{ ...style1, ...style2 }}\n >\n {value}\n </Box>\n );\n } else if (this.props.schema.blinkOnUpdate) {\n const style = valueBlinkOnce(this.props.theme, false, this.props.schema.blinkOnUpdate);\n value = (\n <Box\n key={valueTxt}\n sx={style}\n >\n {value}\n </Box>\n );\n } else if (this.props.schema.blink) {\n const style = valueBlink(this.props.theme, this.props.schema.blink);\n value = <Box sx={style}>{value}</Box>;\n }\n\n if (this.props.schema.unit) {\n value = (\n <div style={styles.valueAndUnit}>\n {value}\n <div style={{ ...styles.unit, ...(this.props.schema.styleUnit || undefined) }}>\n {this.getText(this.props.schema.unit)}\n </div>\n </div>\n );\n }\n\n let labelIcon: React.JSX.Element | undefined;\n if (this.props.schema.labelIcon) {\n labelIcon = (\n <Icon\n src={this.props.schema.labelIcon}\n style={{ marginRight: 4 }}\n />\n );\n }\n let copyButton: React.JSX.Element | undefined;\n if (this.props.schema.copyToClipboard) {\n copyButton = (\n <ContentCopy\n className=\"staticCopyButton\"\n style={{\n position: 'absolute',\n top: 'calc(50% - 12px)',\n right: 0,\n cursor: 'pointer',\n }}\n onClick={() => {\n Utils.copyToClipboard(valueTxt);\n window.alert(I18n.t('ra_Copied'));\n }}\n />\n );\n }\n\n return (\n <Box\n component=\"div\"\n style={divStyle}\n sx={{\n '& .staticCopyButton': {\n display: 'none',\n },\n '& .staticCopyButton:action': {\n transform: 'scale(0.9)',\n },\n '&:hover .staticCopyButton': {\n display: 'block',\n },\n }}\n >\n <div style={{ ...styles.label, ...(this.props.schema.styleLabel || undefined) }}>\n {labelIcon}\n {label}\n </div>\n {value}\n {copyButton}\n </Box>\n );\n }\n}\n\nexport default ConfigStaticInfo;\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
2
|
import type { ConfigItemStaticText } from '#JC/types';
|
|
3
3
|
import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
|
|
4
|
-
interface
|
|
4
|
+
interface ConfigStaticTextProps extends ConfigGenericProps {
|
|
5
5
|
schema: ConfigItemStaticText;
|
|
6
6
|
}
|
|
7
|
-
declare class ConfigStaticText extends ConfigGeneric<
|
|
7
|
+
declare class ConfigStaticText extends ConfigGeneric<ConfigStaticTextProps, ConfigGenericState> {
|
|
8
8
|
renderItem(_error: string, disabled: boolean): JSX.Element;
|
|
9
9
|
}
|
|
10
10
|
export default ConfigStaticText;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Conf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gBAClB,CAAC,CAAC,GAAG,EAAE;oBACD,2CAA2C;oBAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;oBACxF,IAAI,IAAI,EAAE;wBACN,IAAI,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE;4BAC7B,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC;gCACxB,OAAO,EAAE,MAAM;gCACf,GAAG,EAAE,IAAI;gCACT,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,QAAQ;gCAC5C,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;6BACjC,CAAC,CAAC;yBACN;6BAAM;4BACH,MAAM,CACF,IAAI,EACJ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,QAAQ,EACpC,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CACrD,CAAC;yBACL;qBACJ;gBACL,CAAC;gBACH,CAAC,CAAC,IAAI,IAGb,IAAI,CACH,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Box, Button } from '@mui/material';\n\nimport { type IobTheme, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemStaticText } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, any> = {\n fullWidth: {\n height: '100%',\n width: '100%',\n },\n link: (theme: IobTheme) => ({\n textDecoration: 'underline',\n color: theme.palette.mode === 'dark' ? '#4dabf5' : '#254e72',\n cursor: 'pointer',\n }),\n};\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nfunction onLink(href: string, target: '_blank' | '_self' | string, instanceId: string): void {\n let _target;\n let url = '';\n if (!href) {\n url = `#tab-instances/config/${instanceId}`;\n _target = target || '_self';\n } else if (href.toString().startsWith('#')) {\n _target = target || '_self';\n url = href;\n } else if (href.toString().startsWith('/')) {\n _target = target || '_self';\n url = href;\n } else if (href.startsWith('http://') || href.startsWith('https://')) {\n _target = target || '_blank';\n url = href;\n } else {\n url = `#tab-instances/config/${instanceId}/${href}`;\n _target = target || '_self';\n }\n if (_target === '_self') {\n // close dialog\n setTimeout(\n (_url: string) => {\n if (_url.startsWith('#')) {\n window.location.hash = _url;\n } else if (_url.startsWith('/')) {\n url = `${window.location.protocol}:${window.location.host}${url}`;\n } else if (_url.startsWith('http://') || _url.startsWith('https://')) {\n window.location.href = _url;\n }\n },\n 100,\n url,\n );\n } else {\n if (url.startsWith('#')) {\n url = `${window.location.protocol}:${window.location.host}${window.location.pathname}${url}`;\n } else if (url.startsWith('/')) {\n url = `${window.location.protocol}:${window.location.host}${url}`;\n }\n\n window.open(url, _target);\n }\n}\n\ninterface ConfigInstanceSelectProps extends ConfigGenericProps {\n schema: ConfigItemStaticText;\n}\n\nclass ConfigStaticText extends ConfigGeneric<ConfigInstanceSelectProps, ConfigGenericState> {\n renderItem(_error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (this.props.schema.button) {\n const icon = this.getIcon();\n return (\n <Button\n variant={this.props.schema.variant || undefined}\n color={this.props.schema.color || 'grey'}\n style={{ ...styles.fullWidth, ...(this.props.schema.controlStyle || undefined) }}\n disabled={disabled}\n startIcon={icon}\n onClick={\n this.props.schema.href\n ? () => {\n // calculate one more time just before call\n const href = this.props.schema.href\n ? this.getText(this.props.schema.href, true)\n : null;\n if (href) {\n if (this.props.onBackEndCommand) {\n this.props.onBackEndCommand({\n command: 'link',\n url: href,\n target: this.props.schema.target,\n close: this.props.schema.close,\n });\n } else {\n onLink(\n href,\n this.props.schema.target,\n `${this.props.adapterName}.${this.props.instance}`,\n );\n }\n }\n }\n : null\n }\n >\n {this.getText(this.props.schema.text || this.props.schema.label, this.props.schema.noTranslation)}\n </Button>\n );\n }\n let text: string | JSX.Element | JSX.Element[] = this.getText(\n this.props.schema.text || this.props.schema.label,\n this.props.schema.noTranslation,\n );\n if (text && (text.includes('<a ') || text.includes('<br') || text.includes('<b>') || text.includes('<i>'))) {\n text = Utils.renderTextWithA(text);\n }\n\n return (\n <Box\n component=\"span\"\n style={{ ...(this.props.schema.controlStyle || undefined) }}\n sx={this.props.schema.href ? styles.link : undefined}\n onClick={\n this.props.schema.href\n ? () => {\n // calculate one more time just before call\n const href = this.props.schema.href ? this.getText(this.props.schema.href, true) : null;\n if (href) {\n if (this.props.onBackEndCommand) {\n this.props.onBackEndCommand({\n command: 'link',\n url: href,\n target: this.props.schema.target || '_blank',\n close: this.props.schema.close,\n });\n } else {\n onLink(\n href,\n this.props.schema.target || '_blank',\n `${this.props.adapterName}.${this.props.instance}`,\n );\n }\n }\n }\n : null\n }\n >\n {text}\n </Box>\n );\n }\n}\n\nexport default ConfigStaticText;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigStaticText.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigStaticText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAiB,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwB;IAChC,SAAS,EAAE;QACP,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KAChB;IACD,IAAI,EAAE,CAAC,KAAe,EAAE,EAAE,CAAC,CAAC;QACxB,cAAc,EAAE,WAAW;QAC3B,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CA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C,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;6BACjC,CAAC,CAAC;yBACN;6BAAM;4BACH,MAAM,CACF,IAAI,EACJ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,QAAQ,EACpC,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CACrD,CAAC;yBACL;qBACJ;gBACL,CAAC;gBACH,CAAC,CAAC,IAAI,IAGb,IAAI,CACH,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Box, Button } from '@mui/material';\n\nimport { type IobTheme, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemStaticText } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, any> = {\n fullWidth: {\n height: '100%',\n width: '100%',\n },\n link: (theme: IobTheme) => ({\n textDecoration: 'underline',\n color: theme.palette.mode === 'dark' ? '#4dabf5' : '#254e72',\n cursor: 'pointer',\n }),\n};\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nfunction onLink(href: string, target: '_blank' | '_self' | string, instanceId: string): void {\n let _target;\n let url = '';\n if (!href) {\n url = `#tab-instances/config/${instanceId}`;\n _target = target || '_self';\n } else if (href.toString().startsWith('#')) {\n _target = target || '_self';\n url = href;\n } else if (href.toString().startsWith('/')) {\n _target = target || '_self';\n url = href;\n } else if (href.startsWith('http://') || href.startsWith('https://')) {\n _target = target || '_blank';\n url = href;\n } else {\n url = `#tab-instances/config/${instanceId}/${href}`;\n _target = target || '_self';\n }\n if (_target === '_self') {\n // close dialog\n setTimeout(\n (_url: string) => {\n if (_url.startsWith('#')) {\n window.location.hash = _url;\n } else if (_url.startsWith('/')) {\n url = `${window.location.protocol}:${window.location.host}${url}`;\n } else if (_url.startsWith('http://') || _url.startsWith('https://')) {\n window.location.href = _url;\n }\n },\n 100,\n url,\n );\n } else {\n if (url.startsWith('#')) {\n url = `${window.location.protocol}:${window.location.host}${window.location.pathname}${url}`;\n } else if (url.startsWith('/')) {\n url = `${window.location.protocol}:${window.location.host}${url}`;\n }\n\n window.open(url, _target);\n }\n}\n\ninterface ConfigStaticTextProps extends ConfigGenericProps {\n schema: ConfigItemStaticText;\n}\n\nclass ConfigStaticText extends ConfigGeneric<ConfigStaticTextProps, ConfigGenericState> {\n renderItem(_error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (this.props.schema.button) {\n const icon = this.getIcon();\n return (\n <Button\n variant={this.props.schema.variant || undefined}\n color={this.props.schema.color || 'grey'}\n style={{ ...styles.fullWidth, ...(this.props.schema.controlStyle || undefined) }}\n disabled={disabled}\n startIcon={icon}\n onClick={\n this.props.schema.href\n ? () => {\n // calculate one more time just before call\n const href = this.props.schema.href\n ? this.getText(this.props.schema.href, true)\n : null;\n if (href) {\n if (this.props.onBackEndCommand) {\n this.props.onBackEndCommand({\n command: 'link',\n url: href,\n target: this.props.schema.target,\n close: this.props.schema.close,\n });\n } else {\n onLink(\n href,\n this.props.schema.target,\n `${this.props.adapterName}.${this.props.instance}`,\n );\n }\n }\n }\n : null\n }\n >\n {this.getText(this.props.schema.text || this.props.schema.label, this.props.schema.noTranslation)}\n </Button>\n );\n }\n let text: string | JSX.Element | JSX.Element[] = this.getText(\n this.props.schema.text || this.props.schema.label,\n this.props.schema.noTranslation,\n );\n if (text && (text.includes('<a ') || text.includes('<br') || text.includes('<b>') || text.includes('<i>'))) {\n text = Utils.renderTextWithA(text);\n }\n\n return (\n <Box\n component=\"span\"\n style={{ ...(this.props.schema.controlStyle || undefined) }}\n sx={this.props.schema.href ? styles.link : undefined}\n onClick={\n this.props.schema.href\n ? () => {\n // calculate one more time just before call\n const href = this.props.schema.href ? this.getText(this.props.schema.href, true) : null;\n if (href) {\n if (this.props.onBackEndCommand) {\n this.props.onBackEndCommand({\n command: 'link',\n url: href,\n target: this.props.schema.target || '_blank',\n close: this.props.schema.close,\n });\n } else {\n onLink(\n href,\n this.props.schema.target || '_blank',\n `${this.props.adapterName}.${this.props.instance}`,\n );\n }\n }\n }\n : null\n }\n >\n {text}\n </Box>\n );\n }\n}\n\nexport default ConfigStaticText;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Autocomplete, TextField, TextareaAutosize, InputAdornment, IconButton } from '@mui/material';
|
|
3
3
|
import { Close as CloseIcon } from '@mui/icons-material';
|
|
4
|
-
import { I18n } from '@iobroker/adapter-react-v5';
|
|
4
|
+
import { I18n, IconCopy, Utils } from '@iobroker/adapter-react-v5';
|
|
5
5
|
import ConfigGeneric from './ConfigGeneric';
|
|
6
6
|
const styles = {
|
|
7
7
|
indeterminate: {
|
|
@@ -142,18 +142,26 @@ class ConfigText extends ConfigGeneric {
|
|
|
142
142
|
}, placeholder: this.getText(this.props.schema.placeholder) }),
|
|
143
143
|
helper || error || this.state.jsonError ? (React.createElement("div", { style: error ? styles.error : styles.helper }, error || (this.state.jsonError ? I18n.t('ra_Invalid JSON') : helper))) : null));
|
|
144
144
|
}
|
|
145
|
+
let actionButton;
|
|
146
|
+
if ((this.props.schema.readOnly || disabled) && this.props.schema.copyToClipboard) {
|
|
147
|
+
actionButton = (React.createElement(IconButton, { size: "small", onClick: () => {
|
|
148
|
+
Utils.copyToClipboard(this.state.value);
|
|
149
|
+
window.alert(I18n.t('ra_Copied'));
|
|
150
|
+
} },
|
|
151
|
+
React.createElement(IconCopy, null)));
|
|
152
|
+
}
|
|
153
|
+
else if (!this.props.schema.readOnly && !disabled && this.state.value && !this.props.schema.noClearButton) {
|
|
154
|
+
actionButton = (React.createElement(InputAdornment, { position: "end" },
|
|
155
|
+
React.createElement(IconButton, { size: "small", onClick: () => this.setState({ value: '', oldValue: this.state.value }, () => this.onChange(this.props.attr, '')) },
|
|
156
|
+
React.createElement(CloseIcon, null))));
|
|
157
|
+
}
|
|
145
158
|
return (React.createElement(TextField, { variant: "standard", fullWidth: true, value: this.state.value === null || this.state.value === undefined ? '' : this.state.value, error: !!error || !!this.state.jsonError, disabled: !!disabled, slotProps: {
|
|
146
159
|
htmlInput: {
|
|
147
160
|
maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,
|
|
148
161
|
readOnly: this.props.schema.readOnly || false,
|
|
149
162
|
},
|
|
150
163
|
input: {
|
|
151
|
-
endAdornment:
|
|
152
|
-
!disabled &&
|
|
153
|
-
this.state.value &&
|
|
154
|
-
!this.props.schema.noClearButton ? (React.createElement(InputAdornment, { position: "end" },
|
|
155
|
-
React.createElement(IconButton, { size: "small", onClick: () => this.setState({ value: '', oldValue: this.state.value }, () => this.onChange(this.props.attr, '')) },
|
|
156
|
-
React.createElement(CloseIcon, null)))) : null,
|
|
164
|
+
endAdornment: actionButton,
|
|
157
165
|
},
|
|
158
166
|
}, onChange: e => {
|
|
159
167
|
const value = e.target.value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigText.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,aAAa,EAAE;QACX,OAAO,EAAE,GAAG;KACf;IACD,KAAK,EAAE;QACH,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,EAAE;KACf;IACD,MAAM,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,EAAE;KACf;IACD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E,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,CAC3F,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CACxC,CAAC;YACN,CAAC,EACD,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EACxD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,UAAU,EACN,IAAI,CAAC,KAAK,CAAC,SAAS;gBAChB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC;gBAC3B,CAAC,CAAC,IAAI,CAAC,UAAU,CACX,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,GAEb,CACL,CAAC;IACN,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Autocomplete, TextField, TextareaAutosize, InputAdornment, IconButton } from '@mui/material';\n\nimport { Close as CloseIcon } from '@mui/icons-material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemText } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n indeterminate: {\n opacity: 0.5,\n },\n label: {\n width: '100%',\n fontSize: 16,\n },\n helper: {\n width: '100%',\n fontSize: 12,\n },\n error: {\n width: '100%',\n fontSize: 12,\n color: '#FF0000',\n },\n};\n\ninterface ConfigTextProps extends ConfigGenericProps {\n schema: ConfigItemText;\n}\n\ninterface ConfigTextState extends ConfigGenericState {\n oldValue?: string;\n jsonError?: boolean;\n}\n\nclass ConfigText extends ConfigGeneric<ConfigTextProps, ConfigTextState> {\n private updateTimeout: ReturnType<typeof setTimeout> | null = null;\n\n componentDidMount(): void {\n super.componentDidMount();\n let value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n if (Array.isArray(value) && this.props.multiEdit) {\n value = ConfigGeneric.DIFFERENT_VALUE;\n this.setState({ value, oldValue: value, jsonError: false });\n return;\n }\n\n this.setState({ value, oldValue: value, jsonError: this.validateJson(value) });\n }\n\n validateJson(value: string | null | undefined): boolean {\n let jsonError = false;\n if (this.props.schema.validateJson) {\n if (value || !this.props.schema.allowEmpty) {\n try {\n JSON.parse(value);\n } catch (err: unknown) {\n console.log('Error in JSON', err);\n jsonError = true;\n }\n }\n }\n\n return jsonError;\n }\n\n static getDerivedStateFromProps(props: ConfigTextProps, state: ConfigTextState): Partial<ConfigTextState> | null {\n if (props.multiEdit && state.value === ConfigGeneric.DIFFERENT_VALUE) {\n return { value: ConfigGeneric.DIFFERENT_VALUE };\n }\n\n let value = ConfigGeneric.getValue(props.data, props.attr);\n\n if (value !== null && value !== undefined) {\n value = value.toString();\n }\n\n if (value === null || value === undefined || (value !== state.value && value !== state.oldValue)) {\n return { value };\n }\n return null;\n }\n\n renderItem(error?: boolean, disabled?: boolean): JSX.Element {\n const isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric.DIFFERENT_VALUE;\n\n if (this.props.schema.time) {\n // show read-only time\n\n let time = '';\n if (typeof this.state.value === 'number') {\n // If the value is a number, it is a timestamp.\n if (this.state.value && this.state.value < 946659600000) {\n // If the value is less than 2000-01-01, it is a timestamp in seconds.\n time = new Date(this.state.value * 1000).toLocaleString();\n } else {\n time = new Date(this.state.value).toLocaleString();\n }\n } else if (typeof this.state.value === 'string') {\n // If the value is a string, it is a date string.\n time = new Date(this.state.value).toLocaleString();\n }\n\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={time}\n error={!!error || !!this.state.jsonError}\n disabled={!!disabled}\n slotProps={{\n htmlInput: {\n readOnly: true,\n },\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n\n if (this.state.oldValue !== null && this.state.oldValue !== undefined) {\n if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n }\n this.updateTimeout = setTimeout(() => {\n this.updateTimeout = null;\n this.setState({ oldValue: null });\n }, 30);\n } else if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n this.updateTimeout = null;\n }\n\n if (isIndeterminate) {\n const autoCompleteOptions = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const arr =\n autoCompleteOptions\n ?.filter((a: any) => a || a === 0)\n .map((item: any) => ({ label: item.toString() || '', value: item })) || [];\n\n arr.unshift({ label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE });\n\n return (\n <Autocomplete\n style={styles.indeterminate}\n fullWidth\n value={arr[0]}\n // getOptionSelected={(option, value) => option.label === value.label}\n onChange={(_, value) => {\n const val = value ? value.value : '';\n const mayBePromise = this.onChange(this.props.attr, val, () => {\n this.setState({ value: val, oldValue: val, jsonError: this.validateJson(value) });\n });\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n options={arr}\n getOptionLabel={option => option.label}\n renderInput={params => (\n <TextField\n variant=\"standard\"\n {...params}\n error={!!error}\n placeholder={this.getText(this.props.schema.placeholder)}\n slotProps={{\n htmlInput: {\n ...params.inputProps,\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.props.schema.readOnly || false,\n },\n }}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n disabled={!!disabled}\n />\n )}\n />\n );\n }\n if (this.props.schema.minRows > 1) {\n const helper = this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n );\n return (\n <div style={{ width: '100%' }}>\n {this.props.schema.label ? (\n <div style={styles.label}>{this.getText(this.props.schema.label)}</div>\n ) : null}\n <TextareaAutosize\n // variant=\"standard\"\n style={{\n width: '100%',\n resize: 'vertical',\n backgroundColor: this.props.themeType === 'dark' ? '#363636' : '#cccccc',\n color: this.props.themeType === 'dark' ? '#fff' : '#111',\n }}\n minRows={this.props.schema.minRows}\n maxRows={this.props.schema.maxRows}\n value={this.state.value === null || this.state.value === undefined ? '' : this.state.value}\n disabled={!!disabled}\n readOnly={this.props.schema.readOnly || false}\n onChange={e => {\n const value = e.target.value;\n this.setState(\n { value, oldValue: this.state.value, jsonError: this.validateJson(value) },\n () => this.onChange(this.props.attr, value || ''),\n );\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n />\n {helper || error || this.state.jsonError ? (\n <div style={error ? styles.error : styles.helper}>\n {error || (this.state.jsonError ? I18n.t('ra_Invalid JSON') : helper)}\n </div>\n ) : null}\n </div>\n );\n }\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={this.state.value === null || this.state.value === undefined ? '' : this.state.value}\n error={!!error || !!this.state.jsonError}\n disabled={!!disabled}\n slotProps={{\n htmlInput: {\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.props.schema.readOnly || false,\n },\n input: {\n endAdornment:\n !this.props.schema.readOnly &&\n !disabled &&\n this.state.value &&\n !this.props.schema.noClearButton ? (\n <InputAdornment position=\"end\">\n <IconButton\n size=\"small\"\n onClick={() =>\n this.setState({ value: '', oldValue: this.state.value }, () =>\n this.onChange(this.props.attr, ''),\n )\n }\n >\n <CloseIcon />\n </IconButton>\n </InputAdornment>\n ) : null,\n },\n }}\n onChange={e => {\n const value = e.target.value;\n\n this.setState({ value, oldValue: this.state.value, jsonError: this.validateJson(value) }, () =>\n this.onChange(this.props.attr, value),\n );\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={\n this.state.jsonError\n ? I18n.t('ra_Invalid JSON')\n : this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )\n }\n />\n );\n }\n}\n\nexport default ConfigText;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigText.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,aAAa,EAAE;QACX,OAAO,EAAE,GAAG;KACf;IACD,KAAK,EAAE;QACH,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,EAAE;KACf;IACD,MAAM,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,EAAE;KACf;IACD,KAAK,EAAE;QACH,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,SAAS;KACnB;CACJ,CAAC;AAWF,MAAM,UAAW,SAAQ,aAA+C;IAC5D,aAAa,GAAyC,IAAI,CAAC;IAEnE,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAErE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAA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,KAAK,CAAC;gBAE7B,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,CAC3F,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CACxC,CAAC;YACN,CAAC,EACD,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EACxD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,UAAU,EACN,IAAI,CAAC,KAAK,CAAC,SAAS;gBAChB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC;gBAC3B,CAAC,CAAC,IAAI,CAAC,UAAU,CACX,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,GAEb,CACL,CAAC;IACN,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Autocomplete, TextField, TextareaAutosize, InputAdornment, IconButton } from '@mui/material';\n\nimport { Close as CloseIcon } from '@mui/icons-material';\n\nimport { I18n, IconCopy, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemText } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n indeterminate: {\n opacity: 0.5,\n },\n label: {\n width: '100%',\n fontSize: 16,\n },\n helper: {\n width: '100%',\n fontSize: 12,\n },\n error: {\n width: '100%',\n fontSize: 12,\n color: '#FF0000',\n },\n};\n\ninterface ConfigTextProps extends ConfigGenericProps {\n schema: ConfigItemText;\n}\n\ninterface ConfigTextState extends ConfigGenericState {\n oldValue?: string;\n jsonError?: boolean;\n}\n\nclass ConfigText extends ConfigGeneric<ConfigTextProps, ConfigTextState> {\n private updateTimeout: ReturnType<typeof setTimeout> | null = null;\n\n componentDidMount(): void {\n super.componentDidMount();\n let value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n if (Array.isArray(value) && this.props.multiEdit) {\n value = ConfigGeneric.DIFFERENT_VALUE;\n this.setState({ value, oldValue: value, jsonError: false });\n return;\n }\n\n this.setState({ value, oldValue: value, jsonError: this.validateJson(value) });\n }\n\n validateJson(value: string | null | undefined): boolean {\n let jsonError = false;\n if (this.props.schema.validateJson) {\n if (value || !this.props.schema.allowEmpty) {\n try {\n JSON.parse(value);\n } catch (err: unknown) {\n console.log('Error in JSON', err);\n jsonError = true;\n }\n }\n }\n\n return jsonError;\n }\n\n static getDerivedStateFromProps(props: ConfigTextProps, state: ConfigTextState): Partial<ConfigTextState> | null {\n if (props.multiEdit && state.value === ConfigGeneric.DIFFERENT_VALUE) {\n return { value: ConfigGeneric.DIFFERENT_VALUE };\n }\n\n let value = ConfigGeneric.getValue(props.data, props.attr);\n\n if (value !== null && value !== undefined) {\n value = value.toString();\n }\n\n if (value === null || value === undefined || (value !== state.value && value !== state.oldValue)) {\n return { value };\n }\n return null;\n }\n\n renderItem(error?: boolean, disabled?: boolean): JSX.Element {\n const isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric.DIFFERENT_VALUE;\n\n if (this.props.schema.time) {\n // show read-only time\n\n let time = '';\n if (typeof this.state.value === 'number') {\n // If the value is a number, it is a timestamp.\n if (this.state.value && this.state.value < 946659600000) {\n // If the value is less than 2000-01-01, it is a timestamp in seconds.\n time = new Date(this.state.value * 1000).toLocaleString();\n } else {\n time = new Date(this.state.value).toLocaleString();\n }\n } else if (typeof this.state.value === 'string') {\n // If the value is a string, it is a date string.\n time = new Date(this.state.value).toLocaleString();\n }\n\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={time}\n error={!!error || !!this.state.jsonError}\n disabled={!!disabled}\n slotProps={{\n htmlInput: {\n readOnly: true,\n },\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n\n if (this.state.oldValue !== null && this.state.oldValue !== undefined) {\n if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n }\n this.updateTimeout = setTimeout(() => {\n this.updateTimeout = null;\n this.setState({ oldValue: null });\n }, 30);\n } else if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n this.updateTimeout = null;\n }\n\n if (isIndeterminate) {\n const autoCompleteOptions = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const arr =\n autoCompleteOptions\n ?.filter((a: any) => a || a === 0)\n .map((item: any) => ({ label: item.toString() || '', value: item })) || [];\n\n arr.unshift({ label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE });\n\n return (\n <Autocomplete\n style={styles.indeterminate}\n fullWidth\n value={arr[0]}\n // getOptionSelected={(option, value) => option.label === value.label}\n onChange={(_, value) => {\n const val = value ? value.value : '';\n const mayBePromise = this.onChange(this.props.attr, val, () => {\n this.setState({ value: val, oldValue: val, jsonError: this.validateJson(value) });\n });\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n options={arr}\n getOptionLabel={option => option.label}\n renderInput={params => (\n <TextField\n variant=\"standard\"\n {...params}\n error={!!error}\n placeholder={this.getText(this.props.schema.placeholder)}\n slotProps={{\n htmlInput: {\n ...params.inputProps,\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.props.schema.readOnly || false,\n },\n }}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n disabled={!!disabled}\n />\n )}\n />\n );\n }\n if (this.props.schema.minRows > 1) {\n const helper = this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n );\n return (\n <div style={{ width: '100%' }}>\n {this.props.schema.label ? (\n <div style={styles.label}>{this.getText(this.props.schema.label)}</div>\n ) : null}\n <TextareaAutosize\n // variant=\"standard\"\n style={{\n width: '100%',\n resize: 'vertical',\n backgroundColor: this.props.themeType === 'dark' ? '#363636' : '#cccccc',\n color: this.props.themeType === 'dark' ? '#fff' : '#111',\n }}\n minRows={this.props.schema.minRows}\n maxRows={this.props.schema.maxRows}\n value={this.state.value === null || this.state.value === undefined ? '' : this.state.value}\n disabled={!!disabled}\n readOnly={this.props.schema.readOnly || false}\n onChange={e => {\n const value = e.target.value;\n this.setState(\n { value, oldValue: this.state.value, jsonError: this.validateJson(value) },\n () => this.onChange(this.props.attr, value || ''),\n );\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n />\n {helper || error || this.state.jsonError ? (\n <div style={error ? styles.error : styles.helper}>\n {error || (this.state.jsonError ? I18n.t('ra_Invalid JSON') : helper)}\n </div>\n ) : null}\n </div>\n );\n }\n let actionButton: React.JSX.Element | undefined;\n if ((this.props.schema.readOnly || disabled) && this.props.schema.copyToClipboard) {\n actionButton = (\n <IconButton\n size=\"small\"\n onClick={() => {\n Utils.copyToClipboard(this.state.value);\n window.alert(I18n.t('ra_Copied'));\n }}\n >\n <IconCopy />\n </IconButton>\n );\n } else if (!this.props.schema.readOnly && !disabled && this.state.value && !this.props.schema.noClearButton) {\n actionButton = (\n <InputAdornment position=\"end\">\n <IconButton\n size=\"small\"\n onClick={() =>\n this.setState({ value: '', oldValue: this.state.value }, () =>\n this.onChange(this.props.attr, ''),\n )\n }\n >\n <CloseIcon />\n </IconButton>\n </InputAdornment>\n );\n }\n\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={this.state.value === null || this.state.value === undefined ? '' : this.state.value}\n error={!!error || !!this.state.jsonError}\n disabled={!!disabled}\n slotProps={{\n htmlInput: {\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.props.schema.readOnly || false,\n },\n input: {\n endAdornment: actionButton,\n },\n }}\n onChange={e => {\n const value = e.target.value;\n\n this.setState({ value, oldValue: this.state.value, jsonError: this.validateJson(value) }, () =>\n this.onChange(this.props.attr, value),\n );\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={\n this.state.jsonError\n ? I18n.t('ra_Invalid JSON')\n : this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )\n }\n />\n );\n }\n}\n\nexport default ConfigText;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TextField, IconButton } from '@mui/material';
|
|
3
|
-
import { Icon, IconCopy, Utils } from '@iobroker/adapter-react-v5';
|
|
3
|
+
import { I18n, Icon, IconCopy, Utils } from '@iobroker/adapter-react-v5';
|
|
4
4
|
import getIconByName from './Icons';
|
|
5
5
|
import ConfigGeneric from './ConfigGeneric';
|
|
6
6
|
const styles = {
|
|
@@ -79,7 +79,7 @@ class ConfigTextSendTo extends ConfigGeneric {
|
|
|
79
79
|
input: {
|
|
80
80
|
endAdornment: this.props.schema.copyToClipboard ? (React.createElement(IconButton, { size: "small", onClick: () => {
|
|
81
81
|
Utils.copyToClipboard(this.state.text);
|
|
82
|
-
window.alert('
|
|
82
|
+
window.alert(I18n.t('ra_Copied'));
|
|
83
83
|
} },
|
|
84
84
|
React.createElement(IconCopy, null))) : undefined,
|
|
85
85
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigTextSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigTextSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM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C,IAAI,IAAI,EAAE,EAAE,GAAI,CACvE,CAAC,CAAC,CAAC,CACA,IAAI,CAAC,KAAK,CAAC,IAAI,CAClB,CACC,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton } from '@mui/material';\n\nimport { I18n, Icon, IconCopy, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSendTo } from '#JC/types';\nimport getIconByName from './Icons';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n },\n};\n\ninterface ConfigTextSendToProps extends ConfigGenericProps {\n schema: ConfigItemSendTo;\n}\n\ninterface ConfigTextSendToState extends ConfigGenericState {\n text?: string;\n style?: React.CSSProperties;\n icon?: string;\n iconStyle?: React.CSSProperties;\n}\n\ninterface Response {\n text: string;\n style?: React.CSSProperties;\n icon?: string;\n iconStyle?: React.CSSProperties;\n}\n\nclass ConfigTextSendTo extends ConfigGeneric<ConfigTextSendToProps, ConfigTextSendToState> {\n private initialized = false;\n\n private _context: 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);\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${dataStr}`);\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n\n void this.props.socket\n .sendTo(`${this.props.adapterName}.${this.props.instance}`, this.props.schema.command || 'send', data)\n .then(result => {\n if (typeof result === 'object') {\n const _data: Response = result;\n this.setState({\n text: _data.text || '',\n style: _data.style,\n icon: _data.icon,\n iconStyle: _data.iconStyle,\n });\n } else if (typeof result === 'string') {\n this.setState({ text: result || '' });\n }\n })\n .catch(e => console.error(`Cannot send command: ${e}`));\n }\n }\n\n getContext(): string {\n const context: Record<string, any> = {};\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (context[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n return JSON.stringify(context);\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element {\n if (this.props.alive) {\n const context = this.getContext();\n if (context !== this._context || !this.initialized) {\n this._context = context;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n if (this.state.text === undefined) {\n return null;\n }\n\n let icon: JSX.Element | null = null;\n if (this.state.icon) {\n icon = getIconByName(this.state.icon, {\n marginRight: this.state.text ? 8 : undefined,\n ...(this.state.iconStyle || undefined),\n });\n if (!icon) {\n icon = (\n <Icon\n src={this.state.icon}\n style={{ marginRight: this.state.text ? 8 : undefined, ...(this.state.iconStyle || undefined) }}\n />\n );\n }\n }\n\n if (this.props.schema.container === 'text') {\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n slotProps={{\n input: {\n endAdornment: this.props.schema.copyToClipboard ? (\n <IconButton\n size=\"small\"\n onClick={() => {\n Utils.copyToClipboard(this.state.text);\n window.alert(I18n.t('ra_Copied'));\n }}\n >\n <IconCopy />\n </IconButton>\n ) : undefined,\n },\n }}\n value={this.state.text}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n return (\n <div style={{ ...styles.fullWidth, ...(this.state.style || undefined) }}>\n {icon}\n {this.props.schema.container === 'html' ? (\n <span dangerouslySetInnerHTML={{ __html: this.state.text || '' }} />\n ) : (\n this.state.text\n )}\n </div>\n );\n }\n}\n\nexport default ConfigTextSendTo;\n"]}
|
package/build/types.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export type ConfigItemType =
|
|
|
32
32
|
| 'pattern'
|
|
33
33
|
| 'sendto'
|
|
34
34
|
| 'setState'
|
|
35
|
+
| 'staticInfo'
|
|
35
36
|
| 'staticText'
|
|
36
37
|
| 'staticLink'
|
|
37
38
|
| 'staticImage'
|
|
@@ -263,6 +264,8 @@ export interface ConfigItemText extends ConfigItem {
|
|
|
263
264
|
max?: number;
|
|
264
265
|
/** read-only field */
|
|
265
266
|
readOnly?: boolean;
|
|
267
|
+
/** show copy to clipboard button, but only if disabled or read-only */
|
|
268
|
+
copyToClipboard?: boolean;
|
|
266
269
|
/** default is true. Set this attribute to `false` if trim is not desired. */
|
|
267
270
|
trim?: boolean;
|
|
268
271
|
/** default is 1. Set this attribute to `2` or more if you want to have a textarea with more than one row. */
|
|
@@ -418,7 +421,7 @@ export interface ConfigItemStaticImage extends ConfigItem {
|
|
|
418
421
|
export interface ConfigItemStaticText extends Omit<ConfigItem, 'button'> {
|
|
419
422
|
type: 'staticText';
|
|
420
423
|
/** multi-language text */
|
|
421
|
-
text:
|
|
424
|
+
text: ioBroker.StringOrTranslated;
|
|
422
425
|
/** @deprecated use text */
|
|
423
426
|
label?: ioBroker.StringOrTranslated;
|
|
424
427
|
/** link. Link could be dynamic like `#tab-objects/customs/${data.parentId} */
|
|
@@ -439,6 +442,34 @@ export interface ConfigItemStaticText extends Omit<ConfigItem, 'button'> {
|
|
|
439
442
|
controlStyle: CustomCSSProperties;
|
|
440
443
|
}
|
|
441
444
|
|
|
445
|
+
export interface ConfigItemStaticInfo extends ConfigItem {
|
|
446
|
+
type: 'staticInfo';
|
|
447
|
+
/** multi-language text or value */
|
|
448
|
+
data: ioBroker.StringOrTranslated | number | boolean;
|
|
449
|
+
/** Base64 icon */
|
|
450
|
+
labelIcon?: string;
|
|
451
|
+
/** Unit */
|
|
452
|
+
unit?: ioBroker.StringOrTranslated;
|
|
453
|
+
/** Normally the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label*/
|
|
454
|
+
narrow?: boolean;
|
|
455
|
+
/** Add to label the colon at the end if not exist in label */
|
|
456
|
+
addColon?: boolean;
|
|
457
|
+
/** Value should blink when updated (true or color) */
|
|
458
|
+
blinkOnUpdate?: boolean | string;
|
|
459
|
+
/** Value should blink continuously (true or color) */
|
|
460
|
+
blink?: boolean | string;
|
|
461
|
+
/** Show copy to clipboard button for value */
|
|
462
|
+
copyToClipboard?: boolean;
|
|
463
|
+
/** Label style */
|
|
464
|
+
styleLabel?: CustomCSSProperties;
|
|
465
|
+
/** Value style */
|
|
466
|
+
styleValue?: CustomCSSProperties;
|
|
467
|
+
/** Unit style */
|
|
468
|
+
styleUnit?: CustomCSSProperties;
|
|
469
|
+
/** Font size */
|
|
470
|
+
size?: number | 'small' | 'normal' | 'large';
|
|
471
|
+
}
|
|
472
|
+
|
|
442
473
|
export interface ConfigItemRoom extends ConfigItem {
|
|
443
474
|
type: 'room';
|
|
444
475
|
short?: boolean;
|
|
@@ -938,6 +969,7 @@ export type ConfigItemAny =
|
|
|
938
969
|
| ConfigItemSetState
|
|
939
970
|
| ConfigItemStaticDivider
|
|
940
971
|
| ConfigItemStaticHeader
|
|
972
|
+
| ConfigItemStaticInfo
|
|
941
973
|
| ConfigItemStaticImage
|
|
942
974
|
| ConfigItemStaticText
|
|
943
975
|
| ConfigItemTopic
|
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
|
+
"version": "7.4.0",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
"prepublishOnly": "npm run build",
|
|
11
11
|
"build:ts": "tsc -p tsconfig.json",
|
|
12
12
|
"lint": "eslint -c eslint.config.mjs src",
|
|
13
|
-
"prettier": "prettier --write src/**/*.{ts,tsx,js,jsx,json,css,scss,md,html}"
|
|
13
|
+
"prettier": "prettier --write src/**/*.{ts,tsx,js,jsx,json,css,scss,md,html}",
|
|
14
|
+
"test": "tsc -p test/tsconfig.build.json && node test/testSchema.js",
|
|
15
|
+
"tsc-test": "tsc -p test/tsconfig.build.json"
|
|
14
16
|
},
|
|
15
17
|
"publishConfig": {
|
|
16
18
|
"access": "public"
|
|
17
19
|
},
|
|
18
20
|
"dependencies": {
|
|
19
|
-
"@iobroker/adapter-react-v5": "7.
|
|
21
|
+
"@iobroker/adapter-react-v5": "7.4.0",
|
|
20
22
|
"@mui/x-date-pickers": "^7.22.0",
|
|
21
23
|
"crypto-js": "^4.2.0",
|
|
22
24
|
"react-ace": "^12.0.0",
|
|
@@ -25,11 +27,12 @@
|
|
|
25
27
|
"devDependencies": {
|
|
26
28
|
"@craco/craco": "^7.1.0",
|
|
27
29
|
"@types/crypto-js": "^4.2.2",
|
|
30
|
+
"ajv": "^8.17.1",
|
|
28
31
|
"tsc-alias": "^1.8.10"
|
|
29
32
|
},
|
|
30
33
|
"files": [
|
|
31
34
|
"build/",
|
|
32
35
|
"LICENSE"
|
|
33
36
|
],
|
|
34
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "90a2d92cbe2e62a7afdabf73ae2141dfffc8b9e0"
|
|
35
38
|
}
|