@iobroker/json-config 8.0.8 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -3
- package/build/JsonConfigComponent/ChipInput.d.ts +1 -4
- package/build/JsonConfigComponent/ChipInput.js +4 -19
- package/build/JsonConfigComponent/ChipInput.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +17 -17
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigDatePicker.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigDatePicker.js +11 -3
- package/build/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIFrame.d.ts +17 -0
- package/build/JsonConfigComponent/ConfigIFrame.js +51 -0
- package/build/JsonConfigComponent/ConfigIFrame.js.map +1 -0
- package/build/JsonConfigComponent/ConfigIFrameSendTo.d.ts +21 -0
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js +89 -0
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js.map +1 -0
- package/build/JsonConfigComponent/ConfigJsonEditor.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigJsonEditor.js +11 -5
- package/build/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.js +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPanel.js +4 -0
- package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/build/types.d.ts +75 -49
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -25,9 +25,11 @@ This guide explains how to define configuration options for your ioBroker adapte
|
|
|
25
25
|
- In your adapter's `io-package.json` file, add the following line under the `common` section:
|
|
26
26
|
|
|
27
27
|
```json
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
28
|
+
{
|
|
29
|
+
"common": {
|
|
30
|
+
"adminUI": {
|
|
31
|
+
"config": "json"
|
|
32
|
+
}
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
```
|
|
@@ -150,6 +152,8 @@ You can install it via GitHub icon in admin by entering `iobroker.jsonconfig-dem
|
|
|
150
152
|
- [**`fileSelector`:**](#fileselector) Allows users to select files from the system (only Admin6)
|
|
151
153
|
- [**`func`:**](#func) Selects a function from the enum.func list (Admin 6 only)
|
|
152
154
|
- [**`header`:**](#header) Creates a heading with different sizes (h1-h5)
|
|
155
|
+
- [**`iframe`:**](#iframe) Show Iframe with given URL
|
|
156
|
+
- [**`iframeSendTo`:**](#iframe) Show Iframe with URL from backend
|
|
153
157
|
- [**`image`:**](#image) Uploads or displays an image
|
|
154
158
|
- [**`imageSendTo`:**](#imagesendto) Displays an image received from the backend and sends data based on a command
|
|
155
159
|
- [**`instance`:**](#instance) Selects an adapter instance
|
|
@@ -919,6 +923,66 @@ adapter.on("message", (obj) => {
|
|
|
919
923
|
});
|
|
920
924
|
```
|
|
921
925
|
|
|
926
|
+
### `iframe`
|
|
927
|
+
|
|
928
|
+
Shows an iframe with the specified URL. (from Admin 7.7.24)
|
|
929
|
+
|
|
930
|
+
| Property | Description |
|
|
931
|
+
|-------------------|------------------------------------------------------------------------------------------|
|
|
932
|
+
| `url` | URL to display in the iframe. If defined, it will be static element |
|
|
933
|
+
| `allowFullscreen` | Allow fullscreen mode (default: `false`) |
|
|
934
|
+
| `sandbox` | Sandbox attributes for security restrictions (e.g., `"allow-same-origin allow-scripts"`) |
|
|
935
|
+
| `loading` | Lazy loading: `lazy` or `eager` (default: `lazy`) |
|
|
936
|
+
| `frameBorder` | Frame border width (default: `0`) |
|
|
937
|
+
| `reloadOnShow` | Reload iframe when it becomes visible in the viewport |
|
|
938
|
+
|
|
939
|
+
#### Example for `iframe`
|
|
940
|
+
|
|
941
|
+
```json
|
|
942
|
+
{
|
|
943
|
+
"type": "iframe",
|
|
944
|
+
"url": "https://example.com",
|
|
945
|
+
"allowFullscreen": true,
|
|
946
|
+
"sandbox": "allow-same-origin allow-scripts",
|
|
947
|
+
"loading": "lazy",
|
|
948
|
+
"reloadOnShow": false
|
|
949
|
+
}
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
### `iframeSendTo`
|
|
953
|
+
|
|
954
|
+
Shows an iframe with a URL received from the backend. (from Admin 7.7.24)
|
|
955
|
+
|
|
956
|
+
| Property | Description |
|
|
957
|
+
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
958
|
+
| `command` | sendTo command |
|
|
959
|
+
| `jsonData` | string - `{"subject1": "${data.subject}", "options1": {"host": "${data.host}"}}`. This data will be sent to backend |
|
|
960
|
+
| `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to backend if jsonData is not defined. |
|
|
961
|
+
|
|
962
|
+
The backend must return a URL as a string.
|
|
963
|
+
|
|
964
|
+
#### Example for `iframeSendTo`
|
|
965
|
+
|
|
966
|
+
```json
|
|
967
|
+
{
|
|
968
|
+
"type": "iframeSendTo",
|
|
969
|
+
"command": "getUrl",
|
|
970
|
+
"jsonData": "{\"param\": \"${data.value}\"}",
|
|
971
|
+
"height": 600
|
|
972
|
+
}
|
|
973
|
+
```
|
|
974
|
+
|
|
975
|
+
#### Example of code in back-end for `iframeSendTo`
|
|
976
|
+
|
|
977
|
+
```js
|
|
978
|
+
adapter.on("message", (obj) => {
|
|
979
|
+
if (obj.command === "getUrl") {
|
|
980
|
+
const url = "https://example.com?param=" + obj.message.param;
|
|
981
|
+
adapter.sendTo(obj.from, obj.command, url, obj.callback);
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
```
|
|
985
|
+
|
|
922
986
|
### `selectSendTo`
|
|
923
987
|
|
|
924
988
|
Shows the drop-down menu with the given from the instance values.
|
|
@@ -1599,6 +1663,9 @@ The schema is used here: https://github.com/SchemaStore/schemastore/blob/6da29cd
|
|
|
1599
1663
|
### **WORK IN PROGRESS**
|
|
1600
1664
|
-->
|
|
1601
1665
|
## Changelog
|
|
1666
|
+
### 8.1.1 (2026-02-06)
|
|
1667
|
+
- (@GermanBluefox) Added `iframe` and `iframeSendTo` components
|
|
1668
|
+
|
|
1602
1669
|
### 8.0.8 (2026-01-27)
|
|
1603
1670
|
- (@GermanBluefox) Fixing the `alive` component
|
|
1604
1671
|
- (@GermanBluefox) Fixing the `datePicker` component
|
|
@@ -15,7 +15,7 @@ interface ChipRendererProps {
|
|
|
15
15
|
}
|
|
16
16
|
export declare const defaultChipRenderer: ({ value, isFocused, isDisabled, isReadOnly, handleClick, handleDelete, style }: ChipRendererProps, key: string) => JSX.Element;
|
|
17
17
|
interface ChipInputProps {
|
|
18
|
-
/** Allows
|
|
18
|
+
/** Allows duplicated (not unique) chips if set to true. */
|
|
19
19
|
allowDuplicates?: boolean;
|
|
20
20
|
/** If true, the placeholder will always be visible. */
|
|
21
21
|
alwaysShowPlaceholder?: boolean;
|
|
@@ -111,9 +111,6 @@ export default class ChipInput extends React.Component<ChipInputProps, ChipInput
|
|
|
111
111
|
componentDidMount(): void;
|
|
112
112
|
componentWillUnmount(): void;
|
|
113
113
|
static getDerivedStateFromProps(props: ChipInputProps, state: ChipInputState): Partial<ChipInputState> | null;
|
|
114
|
-
/**
|
|
115
|
-
* Blurs this component.
|
|
116
|
-
*/
|
|
117
114
|
/**
|
|
118
115
|
* Focuses this component.
|
|
119
116
|
*/
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import ReactDOM from 'react-dom';
|
|
7
|
-
import { Input, OutlinedInput, InputLabel, Chip, FormControl, FormHelperText, Box } from '@mui/material';
|
|
8
|
-
import
|
|
9
|
-
import blue from '@mui/material/colors/blue';
|
|
7
|
+
import { Input, OutlinedInput, InputLabel, Chip, FormControl, FormHelperText, Box, FilledInput } from '@mui/material';
|
|
8
|
+
import { blue } from '@mui/material/colors';
|
|
10
9
|
import { Utils } from '@iobroker/adapter-react-v5';
|
|
11
10
|
const variantComponent = {
|
|
12
11
|
standard: Input,
|
|
@@ -230,14 +229,6 @@ export default class ChipInput extends React.Component {
|
|
|
230
229
|
}
|
|
231
230
|
return newState;
|
|
232
231
|
}
|
|
233
|
-
/**
|
|
234
|
-
* Blurs this component.
|
|
235
|
-
*/
|
|
236
|
-
// blur() {
|
|
237
|
-
// if (this.input) {
|
|
238
|
-
// this.actualInput.blur();
|
|
239
|
-
// }
|
|
240
|
-
// }
|
|
241
232
|
/**
|
|
242
233
|
* Focuses this component.
|
|
243
234
|
*/
|
|
@@ -297,10 +288,10 @@ export default class ChipInput extends React.Component {
|
|
|
297
288
|
this._keyPressed = false;
|
|
298
289
|
this._preventChipCreation = false;
|
|
299
290
|
if (this.props.onKeyDown) {
|
|
300
|
-
// Needed for arrow controls on a menu in autocomplete scenario
|
|
291
|
+
// Needed for arrow controls on a menu in an autocomplete scenario
|
|
301
292
|
this.props.onKeyDown(event);
|
|
302
293
|
// Check if the callback marked the event as isDefaultPrevented() and skip further actions
|
|
303
|
-
// enter key, for example, should not always add the current value of the inputField
|
|
294
|
+
// an enter key, for example, should not always add the current value of the inputField
|
|
304
295
|
if (event.isDefaultPrevented()) {
|
|
305
296
|
return;
|
|
306
297
|
}
|
|
@@ -369,12 +360,6 @@ export default class ChipInput extends React.Component {
|
|
|
369
360
|
this.props.onKeyUp(event);
|
|
370
361
|
}
|
|
371
362
|
};
|
|
372
|
-
// handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
|
373
|
-
// this._keyPressed = true;
|
|
374
|
-
// if (this.props.onKeyPress) {
|
|
375
|
-
// this.props.onKeyPress(event);
|
|
376
|
-
// }
|
|
377
|
-
// };
|
|
378
363
|
handleUpdateInput = (e) => {
|
|
379
364
|
if (this.props.inputValue === null || this.props.inputValue === undefined) {
|
|
380
365
|
this.updateInput(e.target.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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CAAC,KAAK,EACf,SAAS,EAAE,eAAe,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,mBAAmB,EAAE,EACvG,EAAE,EAAE;wBACA,sBAAsB,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;wBACzE,qBAAqB,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;qBACtD,EACD,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAChC,SAAS,EAAE,IAAI,CAAC,aAAa;oBAC7B,mCAAmC;oBACnC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,MAAM,EAAE,IAAI,CAAC,eAAe,EAC5B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAChC,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,cAAc,EACzB,WAAW,EACP,CAAC,CAAC,QAAQ,IAAI,CAAC,mBAAmB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC;wBAC7E,qBAAqB;wBACjB,CAAC,CAAC,WAAW;wBACb,CAAC,CAAC,SAAS,EAEnB,QAAQ,EAAE,QAAQ,KACd,UAAU,KACV,SAAS,GACf,CACA;YACL,UAAU,IAAI,CACX,oBAAC,cAAc,OACP,mBAAmB,EACvB,SAAS,EAAE,mBAAmB,EAAE,SAAS,EACzC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,IAE5B,UAAU,CACE,CACpB,CACS,CACjB,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\n * Notice: Some code was adapted from Material-UI's text field.\n * Copyright (c) 2014 Call-Em-All (https://github.com/callemall/material-ui)\n */\nimport React, { type RefObject, type JSX } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Input, OutlinedInput, InputLabel, Chip, FormControl, FormHelperText, Box } from '@mui/material';\nimport FilledInput from '@mui/material/FilledInput/FilledInput';\nimport blue from '@mui/material/colors/blue';\n\nimport { type IobTheme, type ThemeType, Utils } from '@iobroker/adapter-react-v5';\n\nconst variantComponent = {\n standard: Input,\n filled: FilledInput,\n outlined: OutlinedInput,\n};\n\nconst styles: Record<string, any> = (theme: IobTheme): Record<string, any> => {\n const light = theme.palette.mode === 'light';\n const bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';\n\n return {\n root: {},\n inputRoot: {\n display: 'inline-flex',\n flexWrap: 'wrap',\n flex: 1,\n marginTop: 0,\n minWidth: 70,\n '&.mui-variant-outlined,&.mui-variant-filled': {\n boxSizing: 'border-box',\n },\n '&.mui-variant-outlined': {\n paddingTop: '14px',\n },\n '&.mui-variant-filled': {\n paddingTop: '28px',\n },\n },\n input: {\n display: 'inline-block',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n appearance: 'none', // Remove border in Safari, doesn't seem to break anything in other browsers\n WebkitTapHighlightColor: 'rgba(0,0,0,0)', // Remove mobile color flashing (deprecated style).\n float: 'left',\n flex: 1,\n },\n chipContainer: {\n display: 'flex',\n flexFlow: 'row wrap',\n alignItems: 'center',\n cursor: 'text',\n marginBottom: '-2px',\n minHeight: 40,\n },\n outlined: {\n '& input': {\n height: 16,\n paddingTop: '4px',\n paddingBottom: '12px',\n marginTop: '4px',\n marginBottom: '4px',\n },\n },\n standard: {\n marginTop: '18px',\n },\n filled: {\n '& input': {\n height: 22,\n marginBottom: '4px',\n marginTop: '4px',\n paddingTop: 0,\n },\n '$marginDense & input': {\n height: 26,\n },\n },\n labeled: {},\n label: {\n top: 4,\n '&$outlined&:not($labelShrink)': {\n top: 2,\n '$marginDense &': {\n top: 5,\n },\n },\n '&$filled&:not($labelShrink)': {\n top: 15,\n '$marginDense &': {\n top: 20,\n },\n },\n },\n labelShrink: {\n top: 0,\n },\n helperText: {\n marginBottom: -20,\n },\n focused: {},\n disabled: {},\n underline: {\n '&:after': {\n borderBottom: `2px solid ${theme.palette.primary[light ? 'dark' : 'light']}`,\n left: 0,\n bottom: 0,\n // Doing the other way around a crash on IE 11 \"''\" https://github.com/cssinjs/jss/issues/242\n content: '\"\"',\n position: 'absolute',\n right: 0,\n transform: 'scaleX(0)',\n transition: theme.transitions.create('transform', {\n duration: theme.transitions.duration.shorter,\n easing: theme.transitions.easing.easeOut,\n }),\n pointerEvents: 'none', // Transparent to the hover style.\n },\n '&$focused:after': {\n transform: 'scaleX(1)',\n },\n '&$error:after': {\n borderBottomColor: theme.palette.error.main,\n transform: 'scaleX(1)', // error is always underlined in red\n },\n '&:before': {\n borderBottom: `1px solid ${bottomLineColor}`,\n left: 0,\n bottom: 0,\n // Doing the other way around a crash on IE 11 \"''\" https://github.com/cssinjs/jss/issues/242\n content: '\"\\\\00a0\"',\n position: 'absolute',\n right: 0,\n transition: theme.transitions.create('border-bottom-color', {\n duration: theme.transitions.duration.shorter,\n }),\n pointerEvents: 'none', // Transparent to the hover style.\n },\n '&:hover:not($disabled):not($focused):not($error):before': {\n borderBottom: `2px solid ${theme.palette.text.primary}`,\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n borderBottom: `1px solid ${bottomLineColor}`,\n },\n },\n '&$disabled:before': {\n borderBottomStyle: 'dotted',\n },\n },\n error: {\n '&:after': {\n backgroundColor: theme.palette.error.main,\n transform: 'scaleX(1)', // error is always underlined in red\n },\n },\n chip: {\n margin: '0 8px 8px 0',\n float: 'left',\n },\n marginDense: {},\n };\n};\n\nconst keyCodes = {\n BACKSPACE: 8,\n DELETE: 46,\n LEFT_ARROW: 37,\n RIGHT_ARROW: 39,\n};\n\ninterface ChipRendererProps {\n value: string;\n isFocused: boolean;\n isDisabled: boolean;\n isReadOnly: boolean;\n handleClick: () => void;\n handleDelete: () => void;\n style: React.CSSProperties;\n}\n\nexport const defaultChipRenderer = (\n { value, isFocused, isDisabled, isReadOnly, handleClick, handleDelete, style }: ChipRendererProps,\n key: string,\n): JSX.Element => (\n <Chip\n key={key}\n style={{\n ...style,\n pointerEvents: isDisabled || isReadOnly ? 'none' : undefined,\n backgroundColor: isFocused ? blue[300] : undefined,\n }}\n onClick={handleClick}\n onDelete={handleDelete}\n label={value}\n />\n);\n\ninterface ChipInputProps {\n /** Allows duplicate chips if set to true. */\n allowDuplicates?: boolean;\n /** If true, the placeholder will always be visible. */\n alwaysShowPlaceholder?: boolean;\n /** Behavior when the chip input is blurred: `'clear'` clears the input, `'add'` creates a chip and `'ignore'` keeps the input. */\n blurBehavior?: 'clear' | 'add' | 'add-or-clear' | 'ignore';\n /** A function of the type `({ value, text, chip, isFocused, isDisabled, isReadOnly, handleClick, handleDelete, className }, key) => node` that returns a chip based on the given properties. This can be used to customize chip styles. Each item in the `dataSource` array will be passed to `chipRenderer` as arguments `chip`, `value` and `text`. If `dataSource` is an array of objects and `dataSourceConfig` is present, then `value` and `text` will instead correspond to the object values defined in `dataSourceConfig`. If `dataSourceConfig` is not set and `dataSource` is an array of objects, then a custom `chipRenderer` must be set. `chip` is always the raw value from `dataSource`, either an object or a string. */\n chipRenderer?: (props: ChipRendererProps) => JSX.Element;\n /** Whether the input value should be cleared if the `value` prop is changed. */\n clearInputValueOnChange?: boolean;\n /** Data source for auto complete. This should be an array of strings or objects. */\n dataSource?: string[];\n /** The chips to display by default (for uncontrolled mode). */\n defaultValue?: string[];\n /** Whether to use `setTimeout` to delay adding chips in case other input events like `onSelection` need to fire first */\n delayBeforeAdd?: boolean;\n /** Disables the chip input if set to true. */\n disabled?: boolean;\n /** Disable the input underline. Only valid for 'standard' variant */\n disableUnderline?: boolean;\n /** Props to pass through to the `FormHelperText` component. */\n FormHelperTextProps?: Record<string, any>;\n /** If true, the chip input will fill the available width. */\n fullWidth?: boolean;\n /** If true, the input field will always be below the chips and fill the available space. By default, it will try to be beside the chips. */\n fullWidthInput?: boolean;\n /** Helper text that is displayed below the input. */\n helperText?: string | JSX.Element;\n /** Props to pass through to the `InputLabel`. */\n InputLabelProps?: Record<string, any>;\n /** Props to pass through to the `Input`. */\n InputProps?: Record<string, any>;\n /** Use this property to pass a ref callback to the native input component. */\n inputRef?: (el: HTMLInputElement) => void;\n /** The input value (enables controlled mode for the text input if set). */\n inputValue?: string;\n /* The content of the floating label. */\n label?: string | JSX.Element;\n /** The key codes (`KeyboardEvent.keyCode`) used to determine when to create a new chip. */\n newChipKeyCodes?: number[];\n /** The keys (`KeyboardEvent.key`) used to determine when to create a new chip. */\n newChipKeys?: string[];\n /** Callback function that is called when a new chip was added (in controlled mode). */\n onAdd?: (chip: string) => void;\n /** Callback function that is called with the chip to be added and should return true to add the chip or false to prevent the chip from being added without clearing the text input. */\n onBeforeAdd?: (chip: string) => boolean;\n onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;\n onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n // onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Callback function that is called when the chips change (in uncontrolled mode). */\n onChange?: (chips: string[]) => void;\n /** Callback function that is called when a new chip was removed (in controlled mode). */\n onDelete: (chip: string, i: number) => void;\n /** Callback function that is called when the input changes. */\n onUpdateInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** A placeholder that is displayed if the input has no values. */\n placeholder?: string;\n /** Makes the chip input read-only if set to true. */\n readOnly?: boolean;\n /** The chips to display (enables controlled mode if set). */\n value?: string[];\n /** The variant of the Input component */\n variant?: 'outlined' | 'standard' | 'filled';\n className?: string;\n error?: boolean;\n id?: string;\n required?: boolean;\n rootRef?: RefObject<HTMLDivElement>;\n margin?: 'dense' | 'normal' | 'none';\n theme: IobTheme;\n}\n\ninterface ChipInputState {\n chips: string[];\n focusedChip: number | null;\n inputValue: string;\n isFocused: boolean;\n chipsUpdated: boolean;\n prevPropsValue: string[];\n variant: 'outlined' | 'standard' | 'filled';\n}\n\nexport default class ChipInput extends React.Component<ChipInputProps, ChipInputState> {\n private readonly labelRef: React.RefObject<HTMLLabelElement>;\n\n private labelNode: HTMLLabelElement | null = null;\n\n private readonly input: React.RefObject<HTMLInputElement>;\n\n private readonly newChipKeyCodes: number[];\n\n private readonly newChipKeys: string[];\n\n private actualInput: HTMLInputElement | null = null;\n\n private inputBlurTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private _keyPressed: boolean;\n\n private _preventChipCreation: boolean;\n\n private styles: Record<string, any> = {};\n\n private styleTheme: ThemeType | null = null;\n\n constructor(props: ChipInputProps) {\n super(props);\n this.state = {\n chips: props.defaultValue || [],\n focusedChip: null,\n inputValue: '',\n isFocused: false,\n chipsUpdated: false,\n prevPropsValue: [],\n variant: this.props.variant || 'standard',\n };\n this.newChipKeyCodes = props.newChipKeyCodes || [13];\n this.newChipKeys = props.newChipKeys || ['Enter'];\n\n this.labelRef = React.createRef();\n this.input = React.createRef();\n }\n\n componentDidMount(): void {\n if (this.state.variant === 'outlined') {\n // eslint-disable-next-line react/no-find-dom-node\n this.labelNode = ReactDOM.findDOMNode(this.labelRef.current) as HTMLLabelElement;\n this.forceUpdate();\n }\n }\n\n componentWillUnmount(): void {\n if (this.inputBlurTimeout) {\n clearTimeout(this.inputBlurTimeout);\n }\n }\n\n static getDerivedStateFromProps(props: ChipInputProps, state: ChipInputState): Partial<ChipInputState> | null {\n let newState: Partial<ChipInputState> | null = null;\n\n if (props.value && props.value.length !== state.prevPropsValue.length) {\n newState = { prevPropsValue: props.value };\n if (props.clearInputValueOnChange) {\n newState.inputValue = '';\n }\n }\n\n // if change detection is only necessary for clearInputValueOnChange\n if (props.clearInputValueOnChange && props.value && props.value.length !== state.prevPropsValue.length) {\n newState = { prevPropsValue: props.value, inputValue: '' };\n }\n\n if (props.disabled) {\n newState = { ...newState, focusedChip: null };\n }\n\n if (!state.chipsUpdated && props.defaultValue) {\n newState = { ...newState, chips: props.defaultValue };\n }\n\n return newState;\n }\n\n /**\n * Blurs this component.\n */\n // blur() {\n // if (this.input) {\n // this.actualInput.blur();\n // }\n // }\n\n /**\n * Focuses this component.\n */\n focus = (): void => {\n this.actualInput?.focus();\n if (this.state.focusedChip) {\n this.setState({ focusedChip: null });\n }\n };\n\n handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n if (this.props.onBlur) {\n this.props.onBlur(event);\n }\n this.setState({ isFocused: false });\n if (this.state.focusedChip) {\n this.setState({ focusedChip: null });\n }\n const value = event.target.value;\n let addChipOptions: { clearInputOnFail: boolean } | undefined;\n switch (this.props.blurBehavior || 'clear') {\n case 'add-or-clear':\n addChipOptions = { clearInputOnFail: true };\n // falls through\n case 'add':\n if (this.props.delayBeforeAdd) {\n // Let's assume that we only want to add the existing content as chip, when\n // another event has not added a chip within 200ms.\n // e.g., onSelection Callback in Autocomplete case\n const numChipsBefore = (this.props.value || this.state.chips).length;\n this.inputBlurTimeout = setTimeout(() => {\n const numChipsAfter = (this.props.value || this.state.chips).length;\n if (numChipsBefore === numChipsAfter) {\n this.handleAddChip(value, addChipOptions);\n } else {\n this.clearInput();\n }\n }, 150);\n } else {\n this.handleAddChip(value, addChipOptions);\n }\n break;\n\n case 'clear':\n this.clearInput();\n break;\n\n default:\n break;\n }\n };\n\n handleInputFocus = (event: React.FocusEvent<HTMLInputElement>): void => {\n this.setState({ isFocused: true });\n this.props.onFocus?.(event);\n };\n\n handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n const { focusedChip } = this.state;\n this._keyPressed = false;\n this._preventChipCreation = false;\n\n if (this.props.onKeyDown) {\n // Needed for arrow controls on a menu in autocomplete scenario\n this.props.onKeyDown(event);\n // Check if the callback marked the event as isDefaultPrevented() and skip further actions\n // enter key, for example, should not always add the current value of the inputField\n if (event.isDefaultPrevented()) {\n return;\n }\n }\n const chips = this.props.value || this.state.chips;\n if (this.newChipKeyCodes.includes(event.keyCode) || this.newChipKeys.includes(event.key)) {\n const result = this.handleAddChip((event.target as HTMLInputElement).value);\n if (result !== false) {\n event.preventDefault();\n }\n return;\n }\n\n switch (event.keyCode) {\n case keyCodes.BACKSPACE:\n if ((event.target as HTMLInputElement).value === '') {\n if (focusedChip) {\n this.handleDeleteChip(chips[focusedChip], focusedChip);\n if (focusedChip) {\n this.setState({ focusedChip: focusedChip - 1 });\n }\n } else {\n this.setState({ focusedChip: chips.length - 1 });\n }\n }\n break;\n case keyCodes.DELETE:\n if ((event.target as HTMLInputElement).value === '' && focusedChip) {\n this.handleDeleteChip(chips[focusedChip], focusedChip);\n if (focusedChip <= chips.length - 1) {\n this.setState({ focusedChip });\n }\n }\n break;\n case keyCodes.LEFT_ARROW:\n if (focusedChip === null && (event.target as HTMLInputElement).value === '' && chips.length) {\n this.setState({ focusedChip: chips.length - 1 });\n } else if (focusedChip !== null && focusedChip > 0) {\n this.setState({ focusedChip: focusedChip - 1 });\n }\n break;\n case keyCodes.RIGHT_ARROW:\n if (focusedChip !== null && focusedChip < chips.length - 1) {\n this.setState({ focusedChip: focusedChip + 1 });\n } else {\n this.setState({ focusedChip: null });\n }\n break;\n default:\n this.setState({ focusedChip: null });\n break;\n }\n };\n\n handleKeyUp = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n if (\n !this._preventChipCreation &&\n (this.newChipKeyCodes.includes(event.keyCode) || this.newChipKeys.includes(event.key)) &&\n this._keyPressed\n ) {\n this.clearInput();\n } else {\n this.updateInput((event.target as HTMLInputElement).value);\n }\n if (this.props.onKeyUp) {\n this.props.onKeyUp(event);\n }\n };\n\n // handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n // this._keyPressed = true;\n // if (this.props.onKeyPress) {\n // this.props.onKeyPress(event);\n // }\n // };\n\n handleUpdateInput = (e: React.ChangeEvent<HTMLInputElement>): void => {\n if (this.props.inputValue === null || this.props.inputValue === undefined) {\n this.updateInput(e.target.value);\n }\n\n if (this.props.onUpdateInput) {\n this.props.onUpdateInput(e);\n }\n };\n\n /**\n * Handles adding a chip.\n *\n * @param chip Value of the chip, either a string or an object (if dataSourceConfig is set)\n * @param options Additional options\n * @param options.clearInputOnFail If `true`, and `onBeforeAdd` returns `false`, clear the input\n * @returns True if the chip was added (or at least `onAdd` was called), false if adding the chip was prevented\n */\n handleAddChip(chip: string, options?: { clearInputOnFail: boolean }): boolean {\n if (this.props.onBeforeAdd && !this.props.onBeforeAdd(chip)) {\n this._preventChipCreation = true;\n if (options && options.clearInputOnFail) {\n this.clearInput();\n }\n return false;\n }\n this.clearInput();\n const chips = this.props.value || this.state.chips;\n\n if (chip.trim().length) {\n if (this.props.allowDuplicates || !chips.includes(chip)) {\n if (this.props.value && this.props.onAdd) {\n this.props.onAdd(chip);\n } else {\n this.updateChips([...this.state.chips, chip]);\n }\n }\n return true;\n }\n return false;\n }\n\n handleDeleteChip(chip: string, i: number): void {\n if (!this.props.value) {\n const chips = this.state.chips.slice();\n const changed = chips.splice(i, 1); // remove the chip at index i\n if (changed) {\n let focusedChip = this.state.focusedChip;\n if (this.state.focusedChip === i) {\n focusedChip = null;\n } else if (this.state.focusedChip !== null && this.state.focusedChip > i) {\n focusedChip = this.state.focusedChip - 1;\n }\n this.updateChips(chips, { focusedChip });\n }\n } else if (this.props.onDelete) {\n this.props.onDelete(chip, i);\n }\n }\n\n updateChips(chips: string[], additionalUpdates = {}): void {\n this.setState({ chips, chipsUpdated: true, ...additionalUpdates });\n if (this.props.onChange) {\n this.props.onChange(chips);\n }\n }\n\n /**\n * Clears the text field for adding new chips.\n * This only works in uncontrolled input mode, i.e., if the inputValue prop is not used.\n */\n clearInput(): void {\n this.updateInput('');\n }\n\n updateInput(value: string): void {\n this.setState({ inputValue: value });\n }\n\n /**\n * Set the reference to the actual input, that is the input of the Input.\n *\n * @param ref - The reference\n */\n setActualInputRef = (ref: HTMLInputElement): void => {\n this.actualInput = ref;\n if (this.props.inputRef) {\n this.props.inputRef(ref);\n }\n };\n\n render(): JSX.Element {\n const {\n alwaysShowPlaceholder,\n chipRenderer = defaultChipRenderer,\n className,\n disabled,\n disableUnderline,\n error,\n FormHelperTextProps,\n fullWidth,\n fullWidthInput,\n helperText,\n id,\n InputProps = {},\n InputLabelProps = {},\n inputValue,\n label,\n placeholder,\n readOnly,\n required,\n rootRef,\n value,\n margin,\n } = this.props;\n const variant = this.state.variant;\n\n if (this.styleTheme !== this.props.theme.palette.mode) {\n this.styleTheme = this.props.theme.palette.mode;\n this.styles = Utils.getStyle(this.props.theme, styles);\n }\n\n let chips = value || this.state.chips || [];\n if (!Array.isArray(chips)) {\n chips = ((chips as string) || '')\n .toString()\n .split(/[,\\s]+/)\n .map((c: string) => c.trim());\n }\n const actualInputValue = inputValue ?? this.state.inputValue;\n\n const hasInput = (this.props.value || actualInputValue).length || actualInputValue.length;\n const shrinkFloatingLabel =\n typeof InputLabelProps.shrink === 'boolean'\n ? InputLabelProps.shrink\n : label !== null && (hasInput || this.state.isFocused || chips.length);\n\n const chipComponents = chips.map((chip, i) =>\n chipRenderer(\n {\n value: chip,\n isDisabled: !!disabled,\n isReadOnly: !!readOnly,\n isFocused: this.state.focusedChip === i,\n handleClick: () => this.setState({ focusedChip: i }),\n handleDelete: () => this.handleDeleteChip(chip, i),\n style: this.styles.chip,\n },\n i.toString(),\n ),\n );\n\n const InputMore: { notched?: boolean; labelWidth?: number; startAdornment?: JSX.Element[] } = {};\n if (variant === 'outlined') {\n InputMore.notched = !!shrinkFloatingLabel;\n InputMore.labelWidth = (shrinkFloatingLabel && this.labelNode && this.labelNode.offsetWidth) || 0;\n }\n\n if (variant !== 'standard') {\n InputMore.startAdornment = chipComponents;\n } else {\n InputProps.disableUnderline = true;\n }\n\n const InputComponent = variantComponent[variant];\n\n return (\n <FormControl\n ref={rootRef}\n fullWidth={fullWidth}\n className={className}\n sx={{ ...this.styles.root, ...(margin === 'dense' ? this.styles.marginDense : {}) }}\n error={error}\n required={chips.length > 0 ? undefined : required}\n onClick={this.focus}\n disabled={disabled}\n variant={variant}\n component=\"div\"\n margin={margin}\n >\n {label && (\n <InputLabel\n htmlFor={id}\n sx={{\n '&.MuiInputLabel-root': this.styles.label,\n '&.MuiInputLabel-shrink': this.styles.labelShrink,\n }}\n shrink={!!shrinkFloatingLabel}\n focused={this.state.isFocused}\n variant={variant}\n ref={this.labelRef}\n required={required}\n component=\"label\"\n {...InputLabelProps}\n >\n {label}\n </InputLabel>\n )}\n <Box\n component=\"div\"\n id=\"input-chip-container\"\n sx={{\n ...this.styles[variant],\n ...this.styles.chipContainer,\n ...(this.state.isFocused ? this.styles.focused : undefined),\n ...(!disableUnderline && variant === 'standard' ? this.styles.underline : undefined),\n ...(disabled ? this.styles.disabled : undefined),\n ...(label ? this.styles.labeled : undefined),\n ...(error ? this.styles.error : undefined),\n }}\n >\n {variant === 'standard' && chipComponents}\n <InputComponent\n ref={this.input}\n className={`mui-variant-${this.styles[variant]} ${label ? 'mui-chip-with-label' : 'mui-chip-no-label'}`}\n sx={{\n '&.MuiInputBase-input': { ...this.styles.input, ...this.styles[variant] },\n '&.MuiInputBase-root': { ...this.styles.inputRoot },\n }}\n id={id}\n value={actualInputValue}\n onChange={this.handleUpdateInput}\n onKeyDown={this.handleKeyDown}\n // onKeyPress={this.handleKeyPress}\n onKeyUp={this.handleKeyUp}\n onFocus={this.handleInputFocus}\n onBlur={this.handleInputBlur}\n inputRef={this.setActualInputRef}\n disabled={disabled}\n fullWidth={fullWidthInput}\n placeholder={\n (!hasInput && (shrinkFloatingLabel || label === null || label === undefined)) ||\n alwaysShowPlaceholder\n ? placeholder\n : undefined\n }\n readOnly={readOnly}\n {...InputProps}\n {...InputMore}\n />\n </Box>\n {helperText && (\n <FormHelperText\n {...FormHelperTextProps}\n className={FormHelperTextProps?.className}\n style={this.styles.helperText}\n >\n {helperText}\n </FormHelperText>\n )}\n </FormControl>\n );\n }\n}\n"]}
|
|
1
|
+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EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;wBACzE,qBAAqB,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;qBACtD,EACD,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAChC,SAAS,EAAE,IAAI,CAAC,aAAa;oBAC7B,mCAAmC;oBACnC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,MAAM,EAAE,IAAI,CAAC,eAAe,EAC5B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAChC,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,cAAc,EACzB,WAAW,EACP,CAAC,CAAC,QAAQ,IAAI,CAAC,mBAAmB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC;wBAC7E,qBAAqB;wBACjB,CAAC,CAAC,WAAW;wBACb,CAAC,CAAC,SAAS,EAEnB,QAAQ,EAAE,QAAQ,KACd,UAAU,KACV,SAAS,GACf,CACA;YACL,UAAU,IAAI,CACX,oBAAC,cAAc,OACP,mBAAmB,EACvB,SAAS,EAAE,mBAAmB,EAAE,SAAS,EACzC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,IAE5B,UAAU,CACE,CACpB,CACS,CACjB,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\n * Notice: Some code was adapted from Material-UI's text field.\n * Copyright (c) 2014 Call-Em-All (https://github.com/callemall/material-ui)\n */\nimport React, { type RefObject, type JSX } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Input, OutlinedInput, InputLabel, Chip, FormControl, FormHelperText, Box, FilledInput } from '@mui/material';\nimport { blue } from '@mui/material/colors';\n\nimport { type IobTheme, type ThemeType, Utils } from '@iobroker/adapter-react-v5';\n\nconst variantComponent = {\n standard: Input,\n filled: FilledInput,\n outlined: OutlinedInput,\n};\n\nconst styles: Record<string, any> = (theme: IobTheme): Record<string, any> => {\n const light = theme.palette.mode === 'light';\n const bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';\n\n return {\n root: {},\n inputRoot: {\n display: 'inline-flex',\n flexWrap: 'wrap',\n flex: 1,\n marginTop: 0,\n minWidth: 70,\n '&.mui-variant-outlined,&.mui-variant-filled': {\n boxSizing: 'border-box',\n },\n '&.mui-variant-outlined': {\n paddingTop: '14px',\n },\n '&.mui-variant-filled': {\n paddingTop: '28px',\n },\n },\n input: {\n display: 'inline-block',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n appearance: 'none', // Remove border in Safari, doesn't seem to break anything in other browsers\n WebkitTapHighlightColor: 'rgba(0,0,0,0)', // Remove mobile color flashing (deprecated style).\n float: 'left',\n flex: 1,\n },\n chipContainer: {\n display: 'flex',\n flexFlow: 'row wrap',\n alignItems: 'center',\n cursor: 'text',\n marginBottom: '-2px',\n minHeight: 40,\n },\n outlined: {\n '& input': {\n height: 16,\n paddingTop: '4px',\n paddingBottom: '12px',\n marginTop: '4px',\n marginBottom: '4px',\n },\n },\n standard: {\n marginTop: '18px',\n },\n filled: {\n '& input': {\n height: 22,\n marginBottom: '4px',\n marginTop: '4px',\n paddingTop: 0,\n },\n '$marginDense & input': {\n height: 26,\n },\n },\n labeled: {},\n label: {\n top: 4,\n '&$outlined&:not($labelShrink)': {\n top: 2,\n '$marginDense &': {\n top: 5,\n },\n },\n '&$filled&:not($labelShrink)': {\n top: 15,\n '$marginDense &': {\n top: 20,\n },\n },\n },\n labelShrink: {\n top: 0,\n },\n helperText: {\n marginBottom: -20,\n },\n focused: {},\n disabled: {},\n underline: {\n '&:after': {\n borderBottom: `2px solid ${theme.palette.primary[light ? 'dark' : 'light']}`,\n left: 0,\n bottom: 0,\n // Doing the other way around a crash on IE 11 \"''\" https://github.com/cssinjs/jss/issues/242\n content: '\"\"',\n position: 'absolute',\n right: 0,\n transform: 'scaleX(0)',\n transition: theme.transitions.create('transform', {\n duration: theme.transitions.duration.shorter,\n easing: theme.transitions.easing.easeOut,\n }),\n pointerEvents: 'none', // Transparent to the hover style.\n },\n '&$focused:after': {\n transform: 'scaleX(1)',\n },\n '&$error:after': {\n borderBottomColor: theme.palette.error.main,\n transform: 'scaleX(1)', // error is always underlined in red\n },\n '&:before': {\n borderBottom: `1px solid ${bottomLineColor}`,\n left: 0,\n bottom: 0,\n // Doing the other way around a crash on IE 11 \"''\" https://github.com/cssinjs/jss/issues/242\n content: '\"\\\\00a0\"',\n position: 'absolute',\n right: 0,\n transition: theme.transitions.create('border-bottom-color', {\n duration: theme.transitions.duration.shorter,\n }),\n pointerEvents: 'none', // Transparent to the hover style.\n },\n '&:hover:not($disabled):not($focused):not($error):before': {\n borderBottom: `2px solid ${theme.palette.text.primary}`,\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n borderBottom: `1px solid ${bottomLineColor}`,\n },\n },\n '&$disabled:before': {\n borderBottomStyle: 'dotted',\n },\n },\n error: {\n '&:after': {\n backgroundColor: theme.palette.error.main,\n transform: 'scaleX(1)', // error is always underlined in red\n },\n },\n chip: {\n margin: '0 8px 8px 0',\n float: 'left',\n },\n marginDense: {},\n };\n};\n\nconst keyCodes = {\n BACKSPACE: 8,\n DELETE: 46,\n LEFT_ARROW: 37,\n RIGHT_ARROW: 39,\n};\n\ninterface ChipRendererProps {\n value: string;\n isFocused: boolean;\n isDisabled: boolean;\n isReadOnly: boolean;\n handleClick: () => void;\n handleDelete: () => void;\n style: React.CSSProperties;\n}\n\nexport const defaultChipRenderer = (\n { value, isFocused, isDisabled, isReadOnly, handleClick, handleDelete, style }: ChipRendererProps,\n key: string,\n): JSX.Element => (\n <Chip\n key={key}\n style={{\n ...style,\n pointerEvents: isDisabled || isReadOnly ? 'none' : undefined,\n backgroundColor: isFocused ? blue[300] : undefined,\n }}\n onClick={handleClick}\n onDelete={handleDelete}\n label={value}\n />\n);\n\ninterface ChipInputProps {\n /** Allows duplicated (not unique) chips if set to true. */\n allowDuplicates?: boolean;\n /** If true, the placeholder will always be visible. */\n alwaysShowPlaceholder?: boolean;\n /** Behavior when the chip input is blurred: `'clear'` clears the input, `'add'` creates a chip and `'ignore'` keeps the input. */\n blurBehavior?: 'clear' | 'add' | 'add-or-clear' | 'ignore';\n /** A function of the type `({ value, text, chip, isFocused, isDisabled, isReadOnly, handleClick, handleDelete, className }, key) => node` that returns a chip based on the given properties. This can be used to customize chip styles. Each item in the `dataSource` array will be passed to `chipRenderer` as arguments `chip`, `value` and `text`. If `dataSource` is an array of objects and `dataSourceConfig` is present, then `value` and `text` will instead correspond to the object values defined in `dataSourceConfig`. If `dataSourceConfig` is not set and `dataSource` is an array of objects, then a custom `chipRenderer` must be set. `chip` is always the raw value from `dataSource`, either an object or a string. */\n chipRenderer?: (props: ChipRendererProps) => JSX.Element;\n /** Whether the input value should be cleared if the `value` prop is changed. */\n clearInputValueOnChange?: boolean;\n /** Data source for auto complete. This should be an array of strings or objects. */\n dataSource?: string[];\n /** The chips to display by default (for uncontrolled mode). */\n defaultValue?: string[];\n /** Whether to use `setTimeout` to delay adding chips in case other input events like `onSelection` need to fire first */\n delayBeforeAdd?: boolean;\n /** Disables the chip input if set to true. */\n disabled?: boolean;\n /** Disable the input underline. Only valid for 'standard' variant */\n disableUnderline?: boolean;\n /** Props to pass through to the `FormHelperText` component. */\n FormHelperTextProps?: Record<string, any>;\n /** If true, the chip input will fill the available width. */\n fullWidth?: boolean;\n /** If true, the input field will always be below the chips and fill the available space. By default, it will try to be beside the chips. */\n fullWidthInput?: boolean;\n /** Helper text that is displayed below the input. */\n helperText?: string | JSX.Element;\n /** Props to pass through to the `InputLabel`. */\n InputLabelProps?: Record<string, any>;\n /** Props to pass through to the `Input`. */\n InputProps?: Record<string, any>;\n /** Use this property to pass a ref callback to the native input component. */\n inputRef?: (el: HTMLInputElement) => void;\n /** The input value (enables controlled mode for the text input if set). */\n inputValue?: string;\n /* The content of the floating label. */\n label?: string | JSX.Element;\n /** The key codes (`KeyboardEvent.keyCode`) used to determine when to create a new chip. */\n newChipKeyCodes?: number[];\n /** The keys (`KeyboardEvent.key`) used to determine when to create a new chip. */\n newChipKeys?: string[];\n /** Callback function that is called when a new chip was added (in controlled mode). */\n onAdd?: (chip: string) => void;\n /** Callback function that is called with the chip to be added and should return true to add the chip or false to prevent the chip from being added without clearing the text input. */\n onBeforeAdd?: (chip: string) => boolean;\n onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;\n onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n // onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Callback function that is called when the chips change (in uncontrolled mode). */\n onChange?: (chips: string[]) => void;\n /** Callback function that is called when a new chip was removed (in controlled mode). */\n onDelete: (chip: string, i: number) => void;\n /** Callback function that is called when the input changes. */\n onUpdateInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** A placeholder that is displayed if the input has no values. */\n placeholder?: string;\n /** Makes the chip input read-only if set to true. */\n readOnly?: boolean;\n /** The chips to display (enables controlled mode if set). */\n value?: string[];\n /** The variant of the Input component */\n variant?: 'outlined' | 'standard' | 'filled';\n className?: string;\n error?: boolean;\n id?: string;\n required?: boolean;\n rootRef?: RefObject<HTMLDivElement>;\n margin?: 'dense' | 'normal' | 'none';\n theme: IobTheme;\n}\n\ninterface ChipInputState {\n chips: string[];\n focusedChip: number | null;\n inputValue: string;\n isFocused: boolean;\n chipsUpdated: boolean;\n prevPropsValue: string[];\n variant: 'outlined' | 'standard' | 'filled';\n}\n\nexport default class ChipInput extends React.Component<ChipInputProps, ChipInputState> {\n private readonly labelRef: React.RefObject<HTMLLabelElement>;\n\n private labelNode: HTMLLabelElement | null = null;\n\n private readonly input: React.RefObject<HTMLInputElement>;\n\n private readonly newChipKeyCodes: number[];\n\n private readonly newChipKeys: string[];\n\n private actualInput: HTMLInputElement | null = null;\n\n private inputBlurTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private _keyPressed: boolean;\n\n private _preventChipCreation: boolean;\n\n private styles: Record<string, any> = {};\n\n private styleTheme: ThemeType | null = null;\n\n constructor(props: ChipInputProps) {\n super(props);\n this.state = {\n chips: props.defaultValue || [],\n focusedChip: null,\n inputValue: '',\n isFocused: false,\n chipsUpdated: false,\n prevPropsValue: [],\n variant: this.props.variant || 'standard',\n };\n this.newChipKeyCodes = props.newChipKeyCodes || [13];\n this.newChipKeys = props.newChipKeys || ['Enter'];\n\n this.labelRef = React.createRef();\n this.input = React.createRef();\n }\n\n componentDidMount(): void {\n if (this.state.variant === 'outlined') {\n // eslint-disable-next-line react/no-find-dom-node\n this.labelNode = ReactDOM.findDOMNode(this.labelRef.current) as HTMLLabelElement;\n this.forceUpdate();\n }\n }\n\n componentWillUnmount(): void {\n if (this.inputBlurTimeout) {\n clearTimeout(this.inputBlurTimeout);\n }\n }\n\n static getDerivedStateFromProps(props: ChipInputProps, state: ChipInputState): Partial<ChipInputState> | null {\n let newState: Partial<ChipInputState> | null = null;\n\n if (props.value && props.value.length !== state.prevPropsValue.length) {\n newState = { prevPropsValue: props.value };\n if (props.clearInputValueOnChange) {\n newState.inputValue = '';\n }\n }\n\n // if change detection is only necessary for clearInputValueOnChange\n if (props.clearInputValueOnChange && props.value && props.value.length !== state.prevPropsValue.length) {\n newState = { prevPropsValue: props.value, inputValue: '' };\n }\n\n if (props.disabled) {\n newState = { ...newState, focusedChip: null };\n }\n\n if (!state.chipsUpdated && props.defaultValue) {\n newState = { ...newState, chips: props.defaultValue };\n }\n\n return newState;\n }\n\n /**\n * Focuses this component.\n */\n focus = (): void => {\n this.actualInput?.focus();\n if (this.state.focusedChip) {\n this.setState({ focusedChip: null });\n }\n };\n\n handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n if (this.props.onBlur) {\n this.props.onBlur(event);\n }\n this.setState({ isFocused: false });\n if (this.state.focusedChip) {\n this.setState({ focusedChip: null });\n }\n const value = event.target.value;\n let addChipOptions: { clearInputOnFail: boolean } | undefined;\n switch (this.props.blurBehavior || 'clear') {\n case 'add-or-clear':\n addChipOptions = { clearInputOnFail: true };\n // falls through\n case 'add':\n if (this.props.delayBeforeAdd) {\n // Let's assume that we only want to add the existing content as chip, when\n // another event has not added a chip within 200ms.\n // e.g., onSelection Callback in Autocomplete case\n const numChipsBefore = (this.props.value || this.state.chips).length;\n this.inputBlurTimeout = setTimeout(() => {\n const numChipsAfter = (this.props.value || this.state.chips).length;\n if (numChipsBefore === numChipsAfter) {\n this.handleAddChip(value, addChipOptions);\n } else {\n this.clearInput();\n }\n }, 150);\n } else {\n this.handleAddChip(value, addChipOptions);\n }\n break;\n\n case 'clear':\n this.clearInput();\n break;\n\n default:\n break;\n }\n };\n\n handleInputFocus = (event: React.FocusEvent<HTMLInputElement>): void => {\n this.setState({ isFocused: true });\n this.props.onFocus?.(event);\n };\n\n handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n const { focusedChip } = this.state;\n this._keyPressed = false;\n this._preventChipCreation = false;\n\n if (this.props.onKeyDown) {\n // Needed for arrow controls on a menu in an autocomplete scenario\n this.props.onKeyDown(event);\n // Check if the callback marked the event as isDefaultPrevented() and skip further actions\n // an enter key, for example, should not always add the current value of the inputField\n if (event.isDefaultPrevented()) {\n return;\n }\n }\n const chips = this.props.value || this.state.chips;\n if (this.newChipKeyCodes.includes(event.keyCode) || this.newChipKeys.includes(event.key)) {\n const result = this.handleAddChip((event.target as HTMLInputElement).value);\n if (result !== false) {\n event.preventDefault();\n }\n return;\n }\n\n switch (event.keyCode) {\n case keyCodes.BACKSPACE:\n if ((event.target as HTMLInputElement).value === '') {\n if (focusedChip) {\n this.handleDeleteChip(chips[focusedChip], focusedChip);\n if (focusedChip) {\n this.setState({ focusedChip: focusedChip - 1 });\n }\n } else {\n this.setState({ focusedChip: chips.length - 1 });\n }\n }\n break;\n case keyCodes.DELETE:\n if ((event.target as HTMLInputElement).value === '' && focusedChip) {\n this.handleDeleteChip(chips[focusedChip], focusedChip);\n if (focusedChip <= chips.length - 1) {\n this.setState({ focusedChip });\n }\n }\n break;\n case keyCodes.LEFT_ARROW:\n if (focusedChip === null && (event.target as HTMLInputElement).value === '' && chips.length) {\n this.setState({ focusedChip: chips.length - 1 });\n } else if (focusedChip !== null && focusedChip > 0) {\n this.setState({ focusedChip: focusedChip - 1 });\n }\n break;\n case keyCodes.RIGHT_ARROW:\n if (focusedChip !== null && focusedChip < chips.length - 1) {\n this.setState({ focusedChip: focusedChip + 1 });\n } else {\n this.setState({ focusedChip: null });\n }\n break;\n default:\n this.setState({ focusedChip: null });\n break;\n }\n };\n\n handleKeyUp = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n if (\n !this._preventChipCreation &&\n (this.newChipKeyCodes.includes(event.keyCode) || this.newChipKeys.includes(event.key)) &&\n this._keyPressed\n ) {\n this.clearInput();\n } else {\n this.updateInput((event.target as HTMLInputElement).value);\n }\n if (this.props.onKeyUp) {\n this.props.onKeyUp(event);\n }\n };\n\n handleUpdateInput = (e: React.ChangeEvent<HTMLInputElement>): void => {\n if (this.props.inputValue === null || this.props.inputValue === undefined) {\n this.updateInput(e.target.value);\n }\n\n if (this.props.onUpdateInput) {\n this.props.onUpdateInput(e);\n }\n };\n\n /**\n * Handles adding a chip.\n *\n * @param chip Value of the chip, either a string or an object (if dataSourceConfig is set)\n * @param options Additional options\n * @param options.clearInputOnFail If `true`, and `onBeforeAdd` returns `false`, clear the input\n * @returns True if the chip was added (or at least `onAdd` was called), false if adding the chip was prevented\n */\n handleAddChip(chip: string, options?: { clearInputOnFail: boolean }): boolean {\n if (this.props.onBeforeAdd && !this.props.onBeforeAdd(chip)) {\n this._preventChipCreation = true;\n if (options && options.clearInputOnFail) {\n this.clearInput();\n }\n return false;\n }\n this.clearInput();\n const chips = this.props.value || this.state.chips;\n\n if (chip.trim().length) {\n if (this.props.allowDuplicates || !chips.includes(chip)) {\n if (this.props.value && this.props.onAdd) {\n this.props.onAdd(chip);\n } else {\n this.updateChips([...this.state.chips, chip]);\n }\n }\n return true;\n }\n return false;\n }\n\n handleDeleteChip(chip: string, i: number): void {\n if (!this.props.value) {\n const chips = this.state.chips.slice();\n const changed = chips.splice(i, 1); // remove the chip at index i\n if (changed) {\n let focusedChip = this.state.focusedChip;\n if (this.state.focusedChip === i) {\n focusedChip = null;\n } else if (this.state.focusedChip !== null && this.state.focusedChip > i) {\n focusedChip = this.state.focusedChip - 1;\n }\n this.updateChips(chips, { focusedChip });\n }\n } else if (this.props.onDelete) {\n this.props.onDelete(chip, i);\n }\n }\n\n updateChips(chips: string[], additionalUpdates = {}): void {\n this.setState({ chips, chipsUpdated: true, ...additionalUpdates });\n if (this.props.onChange) {\n this.props.onChange(chips);\n }\n }\n\n /**\n * Clears the text field for adding new chips.\n * This only works in uncontrolled input mode, i.e., if the inputValue prop is not used.\n */\n clearInput(): void {\n this.updateInput('');\n }\n\n updateInput(value: string): void {\n this.setState({ inputValue: value });\n }\n\n /**\n * Set the reference to the actual input, that is the input of the Input.\n *\n * @param ref - The reference\n */\n setActualInputRef = (ref: HTMLInputElement): void => {\n this.actualInput = ref;\n if (this.props.inputRef) {\n this.props.inputRef(ref);\n }\n };\n\n render(): JSX.Element {\n const {\n alwaysShowPlaceholder,\n chipRenderer = defaultChipRenderer,\n className,\n disabled,\n disableUnderline,\n error,\n FormHelperTextProps,\n fullWidth,\n fullWidthInput,\n helperText,\n id,\n InputProps = {},\n InputLabelProps = {},\n inputValue,\n label,\n placeholder,\n readOnly,\n required,\n rootRef,\n value,\n margin,\n } = this.props;\n const variant = this.state.variant;\n\n if (this.styleTheme !== this.props.theme.palette.mode) {\n this.styleTheme = this.props.theme.palette.mode;\n this.styles = Utils.getStyle(this.props.theme, styles);\n }\n\n let chips = value || this.state.chips || [];\n if (!Array.isArray(chips)) {\n chips = ((chips as string) || '')\n .toString()\n .split(/[,\\s]+/)\n .map((c: string) => c.trim());\n }\n const actualInputValue = inputValue ?? this.state.inputValue;\n\n const hasInput = (this.props.value || actualInputValue).length || actualInputValue.length;\n const shrinkFloatingLabel =\n typeof InputLabelProps.shrink === 'boolean'\n ? InputLabelProps.shrink\n : label !== null && (hasInput || this.state.isFocused || chips.length);\n\n const chipComponents = chips.map((chip, i) =>\n chipRenderer(\n {\n value: chip,\n isDisabled: !!disabled,\n isReadOnly: !!readOnly,\n isFocused: this.state.focusedChip === i,\n handleClick: () => this.setState({ focusedChip: i }),\n handleDelete: () => this.handleDeleteChip(chip, i),\n style: this.styles.chip,\n },\n i.toString(),\n ),\n );\n\n const InputMore: { notched?: boolean; labelWidth?: number; startAdornment?: JSX.Element[] } = {};\n if (variant === 'outlined') {\n InputMore.notched = !!shrinkFloatingLabel;\n InputMore.labelWidth = (shrinkFloatingLabel && this.labelNode && this.labelNode.offsetWidth) || 0;\n }\n\n if (variant !== 'standard') {\n InputMore.startAdornment = chipComponents;\n } else {\n InputProps.disableUnderline = true;\n }\n\n const InputComponent = variantComponent[variant];\n\n return (\n <FormControl\n ref={rootRef}\n fullWidth={fullWidth}\n className={className}\n sx={{ ...this.styles.root, ...(margin === 'dense' ? this.styles.marginDense : {}) }}\n error={error}\n required={chips.length > 0 ? undefined : required}\n onClick={this.focus}\n disabled={disabled}\n variant={variant}\n component=\"div\"\n margin={margin}\n >\n {label && (\n <InputLabel\n htmlFor={id}\n sx={{\n '&.MuiInputLabel-root': this.styles.label,\n '&.MuiInputLabel-shrink': this.styles.labelShrink,\n }}\n shrink={!!shrinkFloatingLabel}\n focused={this.state.isFocused}\n variant={variant}\n ref={this.labelRef}\n required={required}\n component=\"label\"\n {...InputLabelProps}\n >\n {label}\n </InputLabel>\n )}\n <Box\n component=\"div\"\n id=\"input-chip-container\"\n sx={{\n ...this.styles[variant],\n ...this.styles.chipContainer,\n ...(this.state.isFocused ? this.styles.focused : undefined),\n ...(!disableUnderline && variant === 'standard' ? this.styles.underline : undefined),\n ...(disabled ? this.styles.disabled : undefined),\n ...(label ? this.styles.labeled : undefined),\n ...(error ? this.styles.error : undefined),\n }}\n >\n {variant === 'standard' && chipComponents}\n <InputComponent\n ref={this.input}\n className={`mui-variant-${this.styles[variant]} ${label ? 'mui-chip-with-label' : 'mui-chip-no-label'}`}\n sx={{\n '&.MuiInputBase-input': { ...this.styles.input, ...this.styles[variant] },\n '&.MuiInputBase-root': { ...this.styles.inputRoot },\n }}\n id={id}\n value={actualInputValue}\n onChange={this.handleUpdateInput}\n onKeyDown={this.handleKeyDown}\n // onKeyPress={this.handleKeyPress}\n onKeyUp={this.handleKeyUp}\n onFocus={this.handleInputFocus}\n onBlur={this.handleInputBlur}\n inputRef={this.setActualInputRef}\n disabled={disabled}\n fullWidth={fullWidthInput}\n placeholder={\n (!hasInput && (shrinkFloatingLabel || label === null || label === undefined)) ||\n alwaysShowPlaceholder\n ? placeholder\n : undefined\n }\n readOnly={readOnly}\n {...InputProps}\n {...InputMore}\n />\n </Box>\n {helperText && (\n <FormHelperText\n {...FormHelperTextProps}\n className={FormHelperTextProps?.className}\n style={this.styles.helperText}\n >\n {helperText}\n </FormHelperText>\n )}\n </FormControl>\n );\n }\n}\n"]}
|
|
@@ -8,11 +8,11 @@ interface ConfigAutocompleteSendToProps extends ConfigGenericProps {
|
|
|
8
8
|
interface ConfigAutocompleteSendToState extends ConfigAutocompleteState {
|
|
9
9
|
loading?: boolean;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
export default class ConfigAutocompleteSendTo extends ConfigGeneric<ConfigAutocompleteSendToProps, ConfigAutocompleteSendToState> {
|
|
12
12
|
private initialized;
|
|
13
13
|
private localContext;
|
|
14
14
|
askInstance(): void;
|
|
15
15
|
getContext(): string;
|
|
16
16
|
renderItem(error: unknown, disabled: boolean): JSX.Element | null;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
18
|
+
export {};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Autocomplete, TextField, CircularProgress, InputAdornment } from '@mui/material';
|
|
3
3
|
import { I18n } from '@iobroker/adapter-react-v5';
|
|
4
4
|
import ConfigGeneric from './ConfigGeneric';
|
|
5
|
-
class ConfigAutocompleteSendTo extends ConfigGeneric {
|
|
5
|
+
export default class ConfigAutocompleteSendTo extends ConfigGeneric {
|
|
6
6
|
initialized = false;
|
|
7
7
|
localContext;
|
|
8
8
|
askInstance() {
|
|
@@ -106,19 +106,18 @@ class ConfigAutocompleteSendTo extends ConfigGeneric {
|
|
|
106
106
|
item = item || null;
|
|
107
107
|
}
|
|
108
108
|
if (!options.length) {
|
|
109
|
-
return (React.createElement(TextField, { variant: "standard", fullWidth: true, value: this.state.value === null || this.state.value === undefined ? '' : this.state.value, error: !!error, disabled: disabled,
|
|
110
|
-
maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
: undefined, onChange: e => {
|
|
109
|
+
return (React.createElement(TextField, { variant: "standard", fullWidth: true, value: this.state.value === null || this.state.value === undefined ? '' : this.state.value, error: !!error, disabled: disabled, slotProps: {
|
|
110
|
+
htmlInput: { maxLength: this.props.schema.maxLength || this.props.schema.max || undefined },
|
|
111
|
+
input: {
|
|
112
|
+
endAdornment: this.state.loading ? (React.createElement(InputAdornment, { position: "end" },
|
|
113
|
+
React.createElement(CircularProgress, { size: 20 }))) : null,
|
|
114
|
+
},
|
|
115
|
+
}, onChange: e => {
|
|
117
116
|
const value = e.target.value;
|
|
118
117
|
this.setState({ value }, () => this.onChange(this.props.attr, (value || '').trim()));
|
|
119
118
|
}, placeholder: this.getText(this.props.schema.placeholder), label: this.getText(this.props.schema.label), helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation) }));
|
|
120
119
|
}
|
|
121
|
-
return (React.createElement(Autocomplete, { value: item, fullWidth: true, freeSolo: !!this.props.schema.freeSolo, options: options, isOptionEqualToValue: (option, value) => option.value === value.value, filterOptions: (options, params) => {
|
|
120
|
+
return (React.createElement(Autocomplete, { value: item, fullWidth: true, freeSolo: !!this.props.schema.freeSolo, options: options, disabled: disabled, isOptionEqualToValue: (option, value) => option.value === value.value, filterOptions: (options, params) => {
|
|
122
121
|
const filtered = options.filter(option => {
|
|
123
122
|
if (params.inputValue === '') {
|
|
124
123
|
return true;
|
|
@@ -149,14 +148,15 @@ class ConfigAutocompleteSendTo extends ConfigGeneric {
|
|
|
149
148
|
}, renderInput: params => (React.createElement(TextField, { variant: "standard", ...params,
|
|
150
149
|
// inputProps are important and will be given in params
|
|
151
150
|
// inputProps={{maxLength: this.props.schema.maxLength || this.props.schema.max || undefined}}
|
|
152
|
-
error: !!error, placeholder: this.getText(this.props.schema.placeholder), label: this.getText(this.props.schema.label), helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation), disabled: disabled,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
React.createElement(
|
|
157
|
-
|
|
151
|
+
error: !!error, placeholder: this.getText(this.props.schema.placeholder), label: this.getText(this.props.schema.label), helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation), disabled: disabled, slotProps: {
|
|
152
|
+
input: {
|
|
153
|
+
...params.InputProps,
|
|
154
|
+
endAdornment: (React.createElement(React.Fragment, null,
|
|
155
|
+
this.state.loading ? (React.createElement(InputAdornment, { position: "end" },
|
|
156
|
+
React.createElement(CircularProgress, { size: 20 }))) : null,
|
|
157
|
+
disabled ? null : params.InputProps.endAdornment)),
|
|
158
|
+
},
|
|
158
159
|
} })) }));
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
|
-
export default ConfigAutocompleteSendTo;
|
|
162
162
|
//# sourceMappingURL=ConfigAutocompleteSendTo.js.map
|
|
@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,CAAC,KAAK,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,EAAE,IAAI,CAAC,UAAU,CACvB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,EACD,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE;oBACR,GAAG,MAAM,CAAC,UAAU;oBACpB,YAAY,EAAE,CACV;wBACK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAClB,oBAAC,cAAc,IAAC,QAAQ,EAAC,KAAK;4BAC1B,oBAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,GAAI,CACjB,CACpB,CAAC,CAAC,CAAC,IAAI;wBACP,MAAM,CAAC,UAAU,CAAC,YAAY,CAChC,CACN;iBACJ,GACH,CACL,GACH,CACL,CAAC;IACN,CAAC;CACJ;AAED,eAAe,wBAAwB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Autocomplete, TextField, CircularProgress, InputAdornment } from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemAutocompleteSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps } from './ConfigGeneric';\nimport type { ConfigAutocompleteState } from './ConfigAutocomplete';\n\ninterface ConfigAutocompleteSendToProps extends ConfigGenericProps {\n schema: ConfigItemAutocompleteSendTo;\n}\n\ninterface ConfigAutocompleteSendToState extends ConfigAutocompleteState {\n loading?: boolean;\n}\n\nclass ConfigAutocompleteSendTo extends ConfigGeneric<ConfigAutocompleteSendToProps, ConfigAutocompleteSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n askInstance(): void {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const selectOptions = this.props.schema.options\n ? this.props.schema.options.map((item: any) =>\n typeof item === 'string' ? { label: item, value: item } : JSON.parse(JSON.stringify(item)),\n )\n : [];\n\n if (this.props.alive) {\n let data = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n try {\n if (typeof dataStr === 'string') {\n data = JSON.parse(dataStr);\n }\n } catch {\n console.error(`Cannot parse json data: ${JSON.stringify(data)}`);\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n\n // Set loading state during sendTo request\n this.setState({ loading: true });\n\n void this.props.oContext.socket\n .sendTo(\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then((list: unknown) => {\n if (list && Array.isArray(list)) {\n list.forEach(item =>\n selectOptions.push(\n typeof item === 'string'\n ? { label: item, value: item }\n : JSON.parse(JSON.stringify(item)),\n ),\n );\n }\n\n // if __different\n if (Array.isArray(value)) {\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions, loading: false });\n } else {\n this.setState({ value, selectOptions, loading: false });\n }\n })\n .catch(error => {\n console.error('Error in autocompleteSendTo:', error);\n // Clear loading state on error\n this.setState({ loading: false });\n });\n } else if (Array.isArray(value)) {\n // if __different\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions });\n } else {\n this.setState({ value, selectOptions });\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n return JSON.stringify(localContext);\n }\n\n renderItem(error: unknown, disabled: boolean): JSX.Element | null {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n let item;\n const options: { value: string; label: string }[] = this.state.selectOptions\n ? JSON.parse(JSON.stringify(this.state.selectOptions))\n : [];\n const isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric.DIFFERENT_LABEL;\n\n if (isIndeterminate) {\n [...this.state.value]\n .filter(val => !options.find((it: any) => it.value === val))\n .forEach(it => options.push({ label: it.toString(), value: it }));\n\n item = { label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE };\n options.unshift(item);\n } else {\n item =\n this.state.value !== null &&\n this.state.value !== undefined &&\n options.find((item: any) => item.value == this.state.value); // let \"==\" be and not ===\n\n if (this.state.value !== null && this.state.value !== undefined && !item && this.props.schema.freeSolo) {\n item = { value: this.state.value, label: this.state.value };\n options.push(item);\n }\n item = item || null;\n }\n\n if (!options.length) {\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}\n disabled={disabled}\n inputProps={{\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n }}\n InputProps={\n this.state.loading\n ? {\n endAdornment: (\n <InputAdornment position=\"end\">\n <CircularProgress size={20} />\n </InputAdornment>\n ),\n }\n : undefined\n }\n onChange={e => {\n const value = e.target.value;\n this.setState({ value }, () => this.onChange(this.props.attr, (value || '').trim()));\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n return (\n <Autocomplete\n value={item}\n fullWidth\n freeSolo={!!this.props.schema.freeSolo}\n options={options}\n isOptionEqualToValue={(option, value) => option.value === value.value}\n filterOptions={(options: { value: string; label: string }[], params) => {\n const filtered = options.filter(option => {\n if (params.inputValue === '') {\n return true;\n }\n return (\n option.label.toLowerCase().includes(params.inputValue.toLowerCase()) ||\n option.value.toLowerCase().includes(params.inputValue.toLowerCase())\n );\n });\n\n if (this.props.schema.freeSolo && params.inputValue !== '') {\n filtered.push({\n label: params.inputValue,\n value: params.inputValue,\n });\n }\n\n return filtered;\n }}\n getOptionLabel={(option: { value: string; label: string }): string => option?.label ?? ''}\n onInputChange={e => {\n if (!e || !this.props.schema.freeSolo) {\n return;\n }\n\n const val = (e.target as HTMLInputElement).value;\n if (val !== this.state.value) {\n this.setState({ value: val }, () => this.onChange(this.props.attr, val));\n }\n }}\n onChange={(_, value) => {\n const val = typeof value === 'object' ? (value ? value.value : '') : value;\n if (val !== this.state.value) {\n this.setState({ value: val }, () => this.onChange(this.props.attr, val));\n }\n }}\n renderInput={params => (\n <TextField\n variant=\"standard\"\n {...params}\n // inputProps are important and will be given in params\n // inputProps={{maxLength: this.props.schema.maxLength || this.props.schema.max || undefined}}\n error={!!error}\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 disabled={disabled}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <>\n {this.state.loading ? (\n <InputAdornment position=\"end\">\n <CircularProgress size={20} />\n </InputAdornment>\n ) : null}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n />\n )}\n />\n );\n }\n}\n\nexport default ConfigAutocompleteSendTo;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigAutocompleteSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigAutocompleteSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO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,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,UAAU,EAAE,IAAI,CAAC,UAAU,CACvB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,EACD,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE;oBACP,KAAK,EAAE;wBACH,GAAG,MAAM,CAAC,UAAU;wBACpB,YAAY,EAAE,CACV;4BACK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAClB,oBAAC,cAAc,IAAC,QAAQ,EAAC,KAAK;gCAC1B,oBAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,GAAI,CACjB,CACpB,CAAC,CAAC,CAAC,IAAI;4BACP,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAClD,CACN;qBACJ;iBACJ,GACH,CACL,GACH,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Autocomplete, TextField, CircularProgress, InputAdornment } from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemAutocompleteSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps } from './ConfigGeneric';\nimport type { ConfigAutocompleteState } from './ConfigAutocomplete';\n\ninterface ConfigAutocompleteSendToProps extends ConfigGenericProps {\n schema: ConfigItemAutocompleteSendTo;\n}\n\ninterface ConfigAutocompleteSendToState extends ConfigAutocompleteState {\n loading?: boolean;\n}\n\nexport default class ConfigAutocompleteSendTo extends ConfigGeneric<\n ConfigAutocompleteSendToProps,\n ConfigAutocompleteSendToState\n> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n askInstance(): void {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const selectOptions = this.props.schema.options\n ? this.props.schema.options.map((item: any) =>\n typeof item === 'string' ? { label: item, value: item } : JSON.parse(JSON.stringify(item)),\n )\n : [];\n\n if (this.props.alive) {\n let data = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n try {\n if (typeof dataStr === 'string') {\n data = JSON.parse(dataStr);\n }\n } catch {\n console.error(`Cannot parse json data: ${JSON.stringify(data)}`);\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n\n // Set loading state during sendTo request\n this.setState({ loading: true });\n\n void this.props.oContext.socket\n .sendTo(\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then((list: unknown) => {\n if (list && Array.isArray(list)) {\n list.forEach(item =>\n selectOptions.push(\n typeof item === 'string'\n ? { label: item, value: item }\n : JSON.parse(JSON.stringify(item)),\n ),\n );\n }\n\n // if __different\n if (Array.isArray(value)) {\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions, loading: false });\n } else {\n this.setState({ value, selectOptions, loading: false });\n }\n })\n .catch(error => {\n console.error('Error in autocompleteSendTo:', error);\n // Clear loading state on error\n this.setState({ loading: false });\n });\n } else if (Array.isArray(value)) {\n // if __different\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions });\n } else {\n this.setState({ value, selectOptions });\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n return JSON.stringify(localContext);\n }\n\n renderItem(error: unknown, disabled: boolean): JSX.Element | null {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n let item;\n const options: { value: string; label: string }[] = this.state.selectOptions\n ? JSON.parse(JSON.stringify(this.state.selectOptions))\n : [];\n const isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric.DIFFERENT_LABEL;\n\n if (isIndeterminate) {\n [...this.state.value]\n .filter(val => !options.find((it: any) => it.value === val))\n .forEach(it => options.push({ label: it.toString(), value: it }));\n\n item = { label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE };\n options.unshift(item);\n } else {\n item =\n this.state.value !== null &&\n this.state.value !== undefined &&\n options.find((item: any) => item.value == this.state.value); // let \"==\" be and not ===\n\n if (this.state.value !== null && this.state.value !== undefined && !item && this.props.schema.freeSolo) {\n item = { value: this.state.value, label: this.state.value };\n options.push(item);\n }\n item = item || null;\n }\n\n if (!options.length) {\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}\n disabled={disabled}\n slotProps={{\n htmlInput: { maxLength: this.props.schema.maxLength || this.props.schema.max || undefined },\n input: {\n endAdornment: this.state.loading ? (\n <InputAdornment position=\"end\">\n <CircularProgress size={20} />\n </InputAdornment>\n ) : null,\n },\n }}\n onChange={e => {\n const value = e.target.value;\n this.setState({ value }, () => this.onChange(this.props.attr, (value || '').trim()));\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n return (\n <Autocomplete\n value={item}\n fullWidth\n freeSolo={!!this.props.schema.freeSolo}\n options={options}\n disabled={disabled}\n isOptionEqualToValue={(option, value) => option.value === value.value}\n filterOptions={(options: { value: string; label: string }[], params) => {\n const filtered = options.filter(option => {\n if (params.inputValue === '') {\n return true;\n }\n return (\n option.label.toLowerCase().includes(params.inputValue.toLowerCase()) ||\n option.value.toLowerCase().includes(params.inputValue.toLowerCase())\n );\n });\n\n if (this.props.schema.freeSolo && params.inputValue !== '') {\n filtered.push({\n label: params.inputValue,\n value: params.inputValue,\n });\n }\n\n return filtered;\n }}\n getOptionLabel={(option: { value: string; label: string }): string => option?.label ?? ''}\n onInputChange={e => {\n if (!e || !this.props.schema.freeSolo) {\n return;\n }\n\n const val = (e.target as HTMLInputElement).value;\n if (val !== this.state.value) {\n this.setState({ value: val }, () => this.onChange(this.props.attr, val));\n }\n }}\n onChange={(_, value) => {\n const val = typeof value === 'object' ? (value ? value.value : '') : value;\n if (val !== this.state.value) {\n this.setState({ value: val }, () => this.onChange(this.props.attr, val));\n }\n }}\n renderInput={params => (\n <TextField\n variant=\"standard\"\n {...params}\n // inputProps are important and will be given in params\n // inputProps={{maxLength: this.props.schema.maxLength || this.props.schema.max || undefined}}\n error={!!error}\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 disabled={disabled}\n slotProps={{\n input: {\n ...params.InputProps,\n endAdornment: (\n <>\n {this.state.loading ? (\n <InputAdornment position=\"end\">\n <CircularProgress size={20} />\n </InputAdornment>\n ) : null}\n {disabled ? null : params.InputProps.endAdornment}\n </>\n ),\n },\n }}\n />\n )}\n />\n );\n }\n}\n"]}
|
|
@@ -6,6 +6,6 @@ interface ConfigDatePickerProps extends ConfigGenericProps {
|
|
|
6
6
|
}
|
|
7
7
|
export default class ConfigDatePicker extends ConfigGeneric<ConfigDatePickerProps> {
|
|
8
8
|
componentDidMount(): void;
|
|
9
|
-
renderItem(
|
|
9
|
+
renderItem(error: boolean, disabled: boolean): JSX.Element;
|
|
10
10
|
}
|
|
11
11
|
export {};
|