@iobroker/adapter-react-v5 3.1.34 → 3.2.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/Components/404.js +0 -23
- package/Components/404.js.map +1 -1
- package/Components/ColorPicker.js +6 -37
- package/Components/ColorPicker.js.map +1 -1
- package/Components/ComplexCron.js +10 -84
- package/Components/ComplexCron.js.map +1 -1
- package/Components/CustomModal.js +29 -54
- package/Components/CustomModal.js.map +1 -1
- package/Components/FileBrowser.js +15 -265
- package/Components/FileBrowser.js.map +1 -1
- package/Components/FileViewer.js +7 -68
- package/Components/FileViewer.js.map +1 -1
- package/Components/Icon.d.ts +1 -1
- package/Components/Icon.js +2 -42
- package/Components/Icon.js.map +1 -1
- package/Components/IconPicker.js +6 -28
- package/Components/IconPicker.js.map +1 -1
- package/Components/IconSelector.js +3 -55
- package/Components/IconSelector.js.map +1 -1
- package/Components/Image.js +1 -38
- package/Components/Image.js.map +1 -1
- package/Components/JsonConfigComponent/ChipInput.js +66 -197
- package/Components/JsonConfigComponent/ChipInput.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAlive.js +0 -31
- package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +6 -39
- package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +6 -52
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCRON.js +5 -39
- package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js +4 -42
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.js +0 -28
- package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigChip.js +4 -33
- package/Components/JsonConfigComponent/ConfigChip.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigColor.js +0 -34
- package/Components/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCoordinates.js +0 -33
- package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCustom.js +14 -73
- package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigDatePicker.js +0 -25
- package/Components/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFile.js +0 -46
- package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.js +7 -126
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFunc.js +0 -34
- package/Components/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigGeneric.js +15 -110
- package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigIP.js +2 -35
- package/Components/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigImageUpload.js +4 -44
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +1 -59
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +7 -40
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js +2 -42
- package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigNumber.js +2 -45
- package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigObjectId.js +6 -40
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPanel.js +7 -91
- package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPassword.js +0 -42
- package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPattern.js +0 -25
- package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigRoom.js +0 -34
- package/Components/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelect.js +4 -34
- package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js +11 -67
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSendto.js +8 -91
- package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSetState.js +0 -55
- package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSlider.js +0 -28
- package/Components/JsonConfigComponent/ConfigSlider.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticDivider.js +0 -21
- package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticHeader.js +0 -24
- package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticImage.js +0 -23
- package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticText.js +0 -31
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTable.js +13 -105
- package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTabs.js +2 -35
- package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigText.js +0 -34
- package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.js +0 -37
- package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTimePicker.js +0 -25
- package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTopic.js +0 -29
- package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigUser.js +2 -40
- package/Components/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/Components/JsonConfigComponent/index.js +5 -81
- package/Components/JsonConfigComponent/index.js.map +1 -1
- package/Components/Loader.js +2 -20
- package/Components/Loader.js.map +1 -1
- package/Components/Loaders/PT.js +2 -20
- package/Components/Loaders/PT.js.map +1 -1
- package/Components/Loaders/Vendor.js +2 -21
- package/Components/Loaders/Vendor.js.map +1 -1
- package/Components/Logo.js +6 -39
- package/Components/Logo.js.map +1 -1
- package/Components/MDUtils.js +3 -27
- package/Components/MDUtils.js.map +1 -1
- package/Components/ObjectBrowser.d.ts +1 -1
- package/Components/ObjectBrowser.js +181 -788
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/Router.js +7 -31
- package/Components/Router.js.map +1 -1
- package/Components/SaveCloseButtons.js +2 -32
- package/Components/SaveCloseButtons.js.map +1 -1
- package/Components/Schedule.js +29 -251
- package/Components/Schedule.js.map +1 -1
- package/Components/SelectWithIcon.d.ts +1 -1
- package/Components/SelectWithIcon.js +0 -48
- package/Components/SelectWithIcon.js.map +1 -1
- package/Components/SimpleCron/cron2text.js +45 -91
- package/Components/SimpleCron/cron2text.js.map +1 -1
- package/Components/SimpleCron/cronText.js +0 -6
- package/Components/SimpleCron/cronText.js.map +1 -1
- package/Components/SimpleCron/index.js +19 -102
- package/Components/SimpleCron/index.js.map +1 -1
- package/Components/SimpleCron/jquery.cron.locale.js +44 -24
- package/Components/SimpleCron/jquery.cron.locale.js.map +1 -1
- package/Components/TabContainer.js +2 -23
- package/Components/TabContainer.js.map +1 -1
- package/Components/TabContent.js +2 -22
- package/Components/TabContent.js.map +1 -1
- package/Components/TabHeader.js +1 -17
- package/Components/TabHeader.js.map +1 -1
- package/Components/TableResize.js +6 -51
- package/Components/TableResize.js.map +1 -1
- package/Components/TextWithIcon.js +0 -20
- package/Components/TextWithIcon.js.map +1 -1
- package/Components/ToggleThemeMenu.js +5 -13
- package/Components/ToggleThemeMenu.js.map +1 -1
- package/Components/TreeTable.js +4 -121
- package/Components/TreeTable.js.map +1 -1
- package/Components/UploadImage.js +17 -60
- package/Components/UploadImage.js.map +1 -1
- package/Components/Utils.js +87 -263
- package/Components/Utils.js.map +1 -1
- package/Components/copy-to-clipboard.js +16 -38
- package/Components/copy-to-clipboard.js.map +1 -1
- package/Components/withWidth.js +2 -10
- package/Components/withWidth.js.map +1 -1
- package/Connection.d.ts +1 -0
- package/Connection.js +156 -527
- package/Connection.js.map +1 -1
- package/Dialogs/ComplexCron.js +0 -34
- package/Dialogs/ComplexCron.js.map +1 -1
- package/Dialogs/Confirm.js +1 -39
- package/Dialogs/Confirm.js.map +1 -1
- package/Dialogs/Cron.js +1 -37
- package/Dialogs/Cron.js.map +1 -1
- package/Dialogs/Error.d.ts +1 -1
- package/Dialogs/Error.js +2 -29
- package/Dialogs/Error.js.map +1 -1
- package/Dialogs/FileSelect.js +2 -36
- package/Dialogs/FileSelect.js.map +1 -1
- package/Dialogs/Message.js +2 -27
- package/Dialogs/Message.js.map +1 -1
- package/Dialogs/SelectID.d.ts +1 -1
- package/Dialogs/SelectID.js +3 -40
- package/Dialogs/SelectID.js.map +1 -1
- package/Dialogs/SimpleCron.js +1 -33
- package/Dialogs/SimpleCron.js.map +1 -1
- package/Dialogs/TextInput.js +2 -34
- package/Dialogs/TextInput.js.map +1 -1
- package/GenericApp.js +55 -150
- package/GenericApp.js.map +1 -1
- package/Prompt.js +0 -2
- package/Prompt.js.map +1 -1
- package/README.md +11 -4
- package/Theme.js +7 -22
- package/Theme.js.map +1 -1
- package/i18n/uk.json +326 -0
- package/i18n.d.ts +2 -0
- package/i18n.js +9 -29
- package/i18n.js.map +1 -1
- package/icons/IconAdapter.d.ts +2 -2
- package/icons/IconAdapter.js +2 -6
- package/icons/IconAdapter.js.map +1 -1
- package/icons/IconAlias.d.ts +2 -2
- package/icons/IconAlias.js +2 -6
- package/icons/IconAlias.js.map +1 -1
- package/icons/IconChannel.d.ts +2 -2
- package/icons/IconChannel.js +2 -6
- package/icons/IconChannel.js.map +1 -1
- package/icons/IconClearFilter.d.ts +2 -2
- package/icons/IconClearFilter.js +0 -5
- package/icons/IconClearFilter.js.map +1 -1
- package/icons/IconClosed.d.ts +2 -2
- package/icons/IconClosed.js +0 -5
- package/icons/IconClosed.js.map +1 -1
- package/icons/IconCopy.d.ts +2 -2
- package/icons/IconCopy.js +0 -5
- package/icons/IconCopy.js.map +1 -1
- package/icons/IconDevice.d.ts +2 -2
- package/icons/IconDevice.js +0 -5
- package/icons/IconDevice.js.map +1 -1
- package/icons/IconDocument.d.ts +2 -2
- package/icons/IconDocument.js +0 -5
- package/icons/IconDocument.js.map +1 -1
- package/icons/IconDocumentReadOnly.d.ts +2 -2
- package/icons/IconDocumentReadOnly.js +0 -5
- package/icons/IconDocumentReadOnly.js.map +1 -1
- package/icons/IconExpert.d.ts +2 -2
- package/icons/IconExpert.js +0 -5
- package/icons/IconExpert.js.map +1 -1
- package/icons/IconFx.d.ts +2 -2
- package/icons/IconFx.js +0 -5
- package/icons/IconFx.js.map +1 -1
- package/icons/IconInstance.d.ts +2 -2
- package/icons/IconInstance.js +0 -5
- package/icons/IconInstance.js.map +1 -1
- package/icons/IconLogout.d.ts +2 -2
- package/icons/IconLogout.js +0 -5
- package/icons/IconLogout.js.map +1 -1
- package/icons/IconNoIcon.d.ts +2 -2
- package/icons/IconNoIcon.js +0 -5
- package/icons/IconNoIcon.js.map +1 -1
- package/icons/IconOpen.d.ts +2 -2
- package/icons/IconOpen.js +0 -5
- package/icons/IconOpen.js.map +1 -1
- package/icons/IconState.d.ts +2 -2
- package/icons/IconState.js +0 -6
- package/icons/IconState.js.map +1 -1
- package/package.json +15 -15
|
@@ -1,74 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.defaultChipRenderer = exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
16
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
|
|
20
13
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
-
|
|
22
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
-
|
|
24
15
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
-
|
|
26
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
-
|
|
28
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
-
|
|
30
18
|
var _react = _interopRequireDefault(require("react"));
|
|
31
|
-
|
|
32
19
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
33
|
-
|
|
34
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
35
|
-
|
|
36
21
|
var _Input = _interopRequireDefault(require("@mui/material/Input"));
|
|
37
|
-
|
|
38
22
|
var _FilledInput = _interopRequireDefault(require("@mui/material/FilledInput/FilledInput"));
|
|
39
|
-
|
|
40
23
|
var _OutlinedInput = _interopRequireDefault(require("@mui/material/OutlinedInput"));
|
|
41
|
-
|
|
42
24
|
var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
43
|
-
|
|
44
25
|
var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
|
|
45
|
-
|
|
46
26
|
var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
|
|
47
|
-
|
|
48
27
|
var _blue = _interopRequireDefault(require("@mui/material/colors/blue"));
|
|
49
|
-
|
|
50
28
|
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
51
|
-
|
|
52
29
|
var _FormHelperText = _interopRequireDefault(require("@mui/material/FormHelperText"));
|
|
53
|
-
|
|
54
30
|
var _Utils = _interopRequireDefault(require("../Utils"));
|
|
55
|
-
|
|
56
31
|
var _excluded = ["allowDuplicates", "alwaysShowPlaceholder", "blurBehavior", "children", "chipRenderer", "classes", "className", "clearInputValueOnChange", "dataSource", "dataSourceConfig", "defaultValue", "delayBeforeAdd", "disabled", "disableUnderline", "error", "filter", "FormHelperTextProps", "fullWidth", "fullWidthInput", "helperText", "id", "InputProps", "inputRef", "InputLabelProps", "inputValue", "label", "newChipKeyCodes", "newChipKeys", "onBeforeAdd", "onAdd", "onBlur", "onDelete", "onChange", "onFocus", "onKeyDown", "onKeyPress", "onKeyUp", "onUpdateInput", "placeholder", "readOnly", "required", "rootRef", "value", "variant"];
|
|
57
|
-
|
|
58
32
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
59
|
-
|
|
60
33
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
61
|
-
|
|
62
34
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
63
|
-
|
|
64
35
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
65
|
-
|
|
66
36
|
var variantComponent = {
|
|
67
37
|
standard: _Input["default"],
|
|
68
38
|
filled: _FilledInput["default"],
|
|
69
39
|
outlined: _OutlinedInput["default"]
|
|
70
40
|
};
|
|
71
|
-
|
|
72
41
|
var styles = function styles(theme) {
|
|
73
42
|
var light = theme.palette.type === 'light';
|
|
74
43
|
var bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
|
|
@@ -172,16 +141,16 @@ var styles = function styles(theme) {
|
|
|
172
141
|
easing: theme.transitions.easing.easeOut
|
|
173
142
|
}),
|
|
174
143
|
pointerEvents: 'none' // Transparent to the hover style.
|
|
175
|
-
|
|
176
144
|
},
|
|
145
|
+
|
|
177
146
|
'&$focused:after': {
|
|
178
147
|
transform: 'scaleX(1)'
|
|
179
148
|
},
|
|
180
149
|
'&$error:after': {
|
|
181
150
|
borderBottomColor: theme.palette.error.main,
|
|
182
151
|
transform: 'scaleX(1)' // error is always underlined in red
|
|
183
|
-
|
|
184
152
|
},
|
|
153
|
+
|
|
185
154
|
'&:before': {
|
|
186
155
|
borderBottom: "1px solid ".concat(bottomLineColor),
|
|
187
156
|
left: 0,
|
|
@@ -194,8 +163,8 @@ var styles = function styles(theme) {
|
|
|
194
163
|
duration: theme.transitions.duration.shorter
|
|
195
164
|
}),
|
|
196
165
|
pointerEvents: 'none' // Transparent to the hover style.
|
|
197
|
-
|
|
198
166
|
},
|
|
167
|
+
|
|
199
168
|
'&:hover:not($disabled):not($focused):not($error):before': {
|
|
200
169
|
borderBottom: "2px solid ".concat(theme.palette.text.primary),
|
|
201
170
|
// Reset on touch devices, it doesn't add specificity
|
|
@@ -211,9 +180,9 @@ var styles = function styles(theme) {
|
|
|
211
180
|
'&:after': {
|
|
212
181
|
backgroundColor: theme.palette.error.main,
|
|
213
182
|
transform: 'scaleX(1)' // error is always underlined in red
|
|
214
|
-
|
|
215
183
|
}
|
|
216
184
|
},
|
|
185
|
+
|
|
217
186
|
chip: {
|
|
218
187
|
margin: '0 8px 8px 0',
|
|
219
188
|
"float": 'left'
|
|
@@ -221,22 +190,17 @@ var styles = function styles(theme) {
|
|
|
221
190
|
marginDense: {}
|
|
222
191
|
};
|
|
223
192
|
};
|
|
224
|
-
|
|
225
193
|
var keyCodes = {
|
|
226
194
|
BACKSPACE: 8,
|
|
227
195
|
DELETE: 46,
|
|
228
196
|
LEFT_ARROW: 37,
|
|
229
197
|
RIGHT_ARROW: 39
|
|
230
198
|
};
|
|
231
|
-
|
|
232
199
|
var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
233
200
|
(0, _inherits2["default"])(ChipInput, _React$Component);
|
|
234
|
-
|
|
235
201
|
var _super = _createSuper(ChipInput);
|
|
236
|
-
|
|
237
202
|
function ChipInput(props) {
|
|
238
203
|
var _this;
|
|
239
|
-
|
|
240
204
|
(0, _classCallCheck2["default"])(this, ChipInput);
|
|
241
205
|
_this = _super.call(this, props);
|
|
242
206
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
@@ -251,7 +215,6 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
251
215
|
});
|
|
252
216
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "focus", function () {
|
|
253
217
|
_this.actualInput.focus();
|
|
254
|
-
|
|
255
218
|
if (_this.state.focusedChip) {
|
|
256
219
|
_this.setState({
|
|
257
220
|
focusedChip: null
|
|
@@ -262,27 +225,22 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
262
225
|
if (_this.props.onBlur) {
|
|
263
226
|
_this.props.onBlur(event);
|
|
264
227
|
}
|
|
265
|
-
|
|
266
228
|
_this.setState({
|
|
267
229
|
isFocused: false
|
|
268
230
|
});
|
|
269
|
-
|
|
270
231
|
if (_this.state.focusedChip) {
|
|
271
232
|
_this.setState({
|
|
272
233
|
focusedChip: null
|
|
273
234
|
});
|
|
274
235
|
}
|
|
275
|
-
|
|
276
236
|
var value = event.target.value;
|
|
277
237
|
var addChipOptions;
|
|
278
|
-
|
|
279
238
|
switch (_this.props.blurBehavior) {
|
|
280
239
|
case 'add-or-clear':
|
|
281
240
|
addChipOptions = {
|
|
282
241
|
clearInputOnFail: true
|
|
283
242
|
};
|
|
284
243
|
// falls through
|
|
285
|
-
|
|
286
244
|
case 'add':
|
|
287
245
|
if (_this.props.delayBeforeAdd) {
|
|
288
246
|
// Let's assume that we only want to add the existing content as chip, when
|
|
@@ -291,7 +249,6 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
291
249
|
var numChipsBefore = (_this.props.value || _this.state.chips).length;
|
|
292
250
|
_this.inputBlurTimeout = setTimeout(function () {
|
|
293
251
|
var numChipsAfter = (_this.props.value || _this.state.chips).length;
|
|
294
|
-
|
|
295
252
|
if (numChipsBefore === numChipsAfter) {
|
|
296
253
|
_this.handleAddChip(value, addChipOptions);
|
|
297
254
|
} else {
|
|
@@ -301,14 +258,10 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
301
258
|
} else {
|
|
302
259
|
_this.handleAddChip(value, addChipOptions);
|
|
303
260
|
}
|
|
304
|
-
|
|
305
261
|
break;
|
|
306
|
-
|
|
307
262
|
case 'clear':
|
|
308
263
|
_this.clearInput();
|
|
309
|
-
|
|
310
264
|
break;
|
|
311
|
-
|
|
312
265
|
default:
|
|
313
266
|
break;
|
|
314
267
|
}
|
|
@@ -317,7 +270,6 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
317
270
|
_this.setState({
|
|
318
271
|
isFocused: true
|
|
319
272
|
});
|
|
320
|
-
|
|
321
273
|
if (_this.props.onFocus) {
|
|
322
274
|
_this.props.onFocus(event);
|
|
323
275
|
}
|
|
@@ -326,36 +278,28 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
326
278
|
var focusedChip = _this.state.focusedChip;
|
|
327
279
|
_this._keyPressed = false;
|
|
328
280
|
_this._preventChipCreation = false;
|
|
329
|
-
|
|
330
281
|
if (_this.props.onKeyDown) {
|
|
331
282
|
// Needed for arrow controls on menu in autocomplete scenario
|
|
332
|
-
_this.props.onKeyDown(event);
|
|
283
|
+
_this.props.onKeyDown(event);
|
|
284
|
+
// Check if the callback marked the event as isDefaultPrevented() and skip further actions
|
|
333
285
|
// enter key for example should not always add the current value of the inputField
|
|
334
|
-
|
|
335
|
-
|
|
336
286
|
if (event.isDefaultPrevented()) {
|
|
337
287
|
return;
|
|
338
288
|
}
|
|
339
289
|
}
|
|
340
|
-
|
|
341
290
|
var chips = _this.props.value || _this.state.chips;
|
|
342
|
-
|
|
343
291
|
if (_this.props.newChipKeyCodes.includes(event.keyCode) || _this.props.newChipKeys.includes(event.key)) {
|
|
344
292
|
var result = _this.handleAddChip(event.target.value);
|
|
345
|
-
|
|
346
293
|
if (result !== false) {
|
|
347
294
|
event.preventDefault();
|
|
348
295
|
}
|
|
349
|
-
|
|
350
296
|
return;
|
|
351
297
|
}
|
|
352
|
-
|
|
353
298
|
switch (event.keyCode) {
|
|
354
299
|
case keyCodes.BACKSPACE:
|
|
355
300
|
if (event.target.value === '') {
|
|
356
301
|
if (focusedChip) {
|
|
357
302
|
_this.handleDeleteChip(chips[focusedChip], focusedChip);
|
|
358
|
-
|
|
359
303
|
if (focusedChip) {
|
|
360
304
|
_this.setState({
|
|
361
305
|
focusedChip: focusedChip - 1
|
|
@@ -367,22 +311,17 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
367
311
|
});
|
|
368
312
|
}
|
|
369
313
|
}
|
|
370
|
-
|
|
371
314
|
break;
|
|
372
|
-
|
|
373
315
|
case keyCodes.DELETE:
|
|
374
316
|
if (event.target.value === '' && focusedChip) {
|
|
375
317
|
_this.handleDeleteChip(chips[focusedChip], focusedChip);
|
|
376
|
-
|
|
377
318
|
if (focusedChip <= chips.length - 1) {
|
|
378
319
|
_this.setState({
|
|
379
320
|
focusedChip: focusedChip
|
|
380
321
|
});
|
|
381
322
|
}
|
|
382
323
|
}
|
|
383
|
-
|
|
384
324
|
break;
|
|
385
|
-
|
|
386
325
|
case keyCodes.LEFT_ARROW:
|
|
387
326
|
if (focusedChip == null && event.target.value === '' && chips.length) {
|
|
388
327
|
_this.setState({
|
|
@@ -393,9 +332,7 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
393
332
|
focusedChip: focusedChip - 1
|
|
394
333
|
});
|
|
395
334
|
}
|
|
396
|
-
|
|
397
335
|
break;
|
|
398
|
-
|
|
399
336
|
case keyCodes.RIGHT_ARROW:
|
|
400
337
|
if (focusedChip != null && focusedChip < chips.length - 1) {
|
|
401
338
|
_this.setState({
|
|
@@ -406,14 +343,11 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
406
343
|
focusedChip: null
|
|
407
344
|
});
|
|
408
345
|
}
|
|
409
|
-
|
|
410
346
|
break;
|
|
411
|
-
|
|
412
347
|
default:
|
|
413
348
|
_this.setState({
|
|
414
349
|
focusedChip: null
|
|
415
350
|
});
|
|
416
|
-
|
|
417
351
|
break;
|
|
418
352
|
}
|
|
419
353
|
});
|
|
@@ -423,14 +357,12 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
423
357
|
} else {
|
|
424
358
|
_this.updateInput(event.target.value);
|
|
425
359
|
}
|
|
426
|
-
|
|
427
360
|
if (_this.props.onKeyUp) {
|
|
428
361
|
_this.props.onKeyUp(event);
|
|
429
362
|
}
|
|
430
363
|
});
|
|
431
364
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeyPress", function (event) {
|
|
432
365
|
_this._keyPressed = true;
|
|
433
|
-
|
|
434
366
|
if (_this.props.onKeyPress) {
|
|
435
367
|
_this.props.onKeyPress(event);
|
|
436
368
|
}
|
|
@@ -439,7 +371,6 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
439
371
|
if (_this.props.inputValue == null) {
|
|
440
372
|
_this.updateInput(e.target.value);
|
|
441
373
|
}
|
|
442
|
-
|
|
443
374
|
if (_this.props.onUpdateInput) {
|
|
444
375
|
_this.props.onUpdateInput(e);
|
|
445
376
|
}
|
|
@@ -448,16 +379,13 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
448
379
|
_this.actualInput = ref;
|
|
449
380
|
_this.props.inputRef && _this.props.inputRef(ref);
|
|
450
381
|
});
|
|
451
|
-
|
|
452
382
|
if (props.defaultValue) {
|
|
453
383
|
_this.state.chips = props.defaultValue;
|
|
454
384
|
}
|
|
455
|
-
|
|
456
385
|
_this.labelRef = /*#__PURE__*/_react["default"].createRef();
|
|
457
386
|
_this.input = /*#__PURE__*/_react["default"].createRef();
|
|
458
387
|
return _this;
|
|
459
388
|
}
|
|
460
|
-
|
|
461
389
|
(0, _createClass2["default"])(ChipInput, [{
|
|
462
390
|
key: "componentDidMount",
|
|
463
391
|
value: function componentDidMount() {
|
|
@@ -483,11 +411,11 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
483
411
|
this.actualInput.blur();
|
|
484
412
|
}
|
|
485
413
|
}
|
|
414
|
+
|
|
486
415
|
/**
|
|
487
416
|
* Focuses this component.
|
|
488
417
|
* @public
|
|
489
418
|
*/
|
|
490
|
-
|
|
491
419
|
}, {
|
|
492
420
|
key: "handleAddChip",
|
|
493
421
|
value:
|
|
@@ -500,27 +428,20 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
500
428
|
*/
|
|
501
429
|
function handleAddChip(chip, options) {
|
|
502
430
|
var _this2 = this;
|
|
503
|
-
|
|
504
431
|
if (this.props.onBeforeAdd && !this.props.onBeforeAdd(chip)) {
|
|
505
432
|
this._preventChipCreation = true;
|
|
506
|
-
|
|
507
433
|
if (options && options.clearInputOnFail) {
|
|
508
434
|
this.clearInput();
|
|
509
435
|
}
|
|
510
|
-
|
|
511
436
|
return false;
|
|
512
437
|
}
|
|
513
|
-
|
|
514
438
|
this.clearInput();
|
|
515
439
|
var chips = this.props.value || this.state.chips;
|
|
516
|
-
|
|
517
440
|
if (this.props.dataSourceConfig) {
|
|
518
441
|
if (typeof chip === 'string') {
|
|
519
442
|
var _chip;
|
|
520
|
-
|
|
521
443
|
chip = (_chip = {}, (0, _defineProperty2["default"])(_chip, this.props.dataSourceConfig.text, chip), (0, _defineProperty2["default"])(_chip, this.props.dataSourceConfig.value, chip), _chip);
|
|
522
444
|
}
|
|
523
|
-
|
|
524
445
|
if (this.props.allowDuplicates || !chips.some(function (c) {
|
|
525
446
|
return c[_this2.props.dataSourceConfig.value] === chip[_this2.props.dataSourceConfig.value];
|
|
526
447
|
})) {
|
|
@@ -530,10 +451,8 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
530
451
|
this.updateChips([].concat((0, _toConsumableArray2["default"])(this.state.chips), [chip]));
|
|
531
452
|
}
|
|
532
453
|
}
|
|
533
|
-
|
|
534
454
|
return true;
|
|
535
455
|
}
|
|
536
|
-
|
|
537
456
|
if (chip.trim().length > 0) {
|
|
538
457
|
if (this.props.allowDuplicates || !chips.includes(chip)) {
|
|
539
458
|
if (this.props.value && this.props.onAdd) {
|
|
@@ -542,10 +461,8 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
542
461
|
this.updateChips([].concat((0, _toConsumableArray2["default"])(this.state.chips), [chip]));
|
|
543
462
|
}
|
|
544
463
|
}
|
|
545
|
-
|
|
546
464
|
return true;
|
|
547
465
|
}
|
|
548
|
-
|
|
549
466
|
return false;
|
|
550
467
|
}
|
|
551
468
|
}, {
|
|
@@ -554,16 +471,13 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
554
471
|
if (!this.props.value) {
|
|
555
472
|
var chips = this.state.chips.slice();
|
|
556
473
|
var changed = chips.splice(i, 1); // remove the chip at index i
|
|
557
|
-
|
|
558
474
|
if (changed) {
|
|
559
475
|
var focusedChip = this.state.focusedChip;
|
|
560
|
-
|
|
561
476
|
if (this.state.focusedChip === i) {
|
|
562
477
|
focusedChip = null;
|
|
563
478
|
} else if (this.state.focusedChip > i) {
|
|
564
479
|
focusedChip = this.state.focusedChip - 1;
|
|
565
480
|
}
|
|
566
|
-
|
|
567
481
|
this.updateChips(chips, {
|
|
568
482
|
focusedChip: focusedChip
|
|
569
483
|
});
|
|
@@ -580,17 +494,16 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
580
494
|
chips: chips,
|
|
581
495
|
chipsUpdated: true
|
|
582
496
|
}, additionalUpdates));
|
|
583
|
-
|
|
584
497
|
if (this.props.onChange) {
|
|
585
498
|
this.props.onChange(chips);
|
|
586
499
|
}
|
|
587
500
|
}
|
|
501
|
+
|
|
588
502
|
/**
|
|
589
503
|
* Clears the text field for adding new chips.
|
|
590
504
|
* This only works in uncontrolled input mode, i.e. if the inputValue prop is not used.
|
|
591
505
|
* @public
|
|
592
506
|
*/
|
|
593
|
-
|
|
594
507
|
}, {
|
|
595
508
|
key: "clearInput",
|
|
596
509
|
value: function clearInput() {
|
|
@@ -603,65 +516,64 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
603
516
|
inputValue: value
|
|
604
517
|
});
|
|
605
518
|
}
|
|
519
|
+
|
|
606
520
|
/**
|
|
607
521
|
* Set the reference to the actual input, that is the input of the Input.
|
|
608
522
|
* @param {object} ref - The reference
|
|
609
523
|
*/
|
|
610
|
-
|
|
611
524
|
}, {
|
|
612
525
|
key: "render",
|
|
613
526
|
value: function render() {
|
|
614
527
|
var _this3 = this;
|
|
615
|
-
|
|
616
528
|
var _this$props = this.props,
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
529
|
+
allowDuplicates = _this$props.allowDuplicates,
|
|
530
|
+
alwaysShowPlaceholder = _this$props.alwaysShowPlaceholder,
|
|
531
|
+
blurBehavior = _this$props.blurBehavior,
|
|
532
|
+
children = _this$props.children,
|
|
533
|
+
_this$props$chipRende = _this$props.chipRenderer,
|
|
534
|
+
chipRenderer = _this$props$chipRende === void 0 ? defaultChipRenderer : _this$props$chipRende,
|
|
535
|
+
classes = _this$props.classes,
|
|
536
|
+
className = _this$props.className,
|
|
537
|
+
clearInputValueOnChange = _this$props.clearInputValueOnChange,
|
|
538
|
+
dataSource = _this$props.dataSource,
|
|
539
|
+
dataSourceConfig = _this$props.dataSourceConfig,
|
|
540
|
+
defaultValue = _this$props.defaultValue,
|
|
541
|
+
delayBeforeAdd = _this$props.delayBeforeAdd,
|
|
542
|
+
disabled = _this$props.disabled,
|
|
543
|
+
disableUnderline = _this$props.disableUnderline,
|
|
544
|
+
error = _this$props.error,
|
|
545
|
+
filter = _this$props.filter,
|
|
546
|
+
FormHelperTextProps = _this$props.FormHelperTextProps,
|
|
547
|
+
fullWidth = _this$props.fullWidth,
|
|
548
|
+
fullWidthInput = _this$props.fullWidthInput,
|
|
549
|
+
helperText = _this$props.helperText,
|
|
550
|
+
id = _this$props.id,
|
|
551
|
+
_this$props$InputProp = _this$props.InputProps,
|
|
552
|
+
InputProps = _this$props$InputProp === void 0 ? {} : _this$props$InputProp,
|
|
553
|
+
inputRef = _this$props.inputRef,
|
|
554
|
+
_this$props$InputLabe = _this$props.InputLabelProps,
|
|
555
|
+
InputLabelProps = _this$props$InputLabe === void 0 ? {} : _this$props$InputLabe,
|
|
556
|
+
inputValue = _this$props.inputValue,
|
|
557
|
+
label = _this$props.label,
|
|
558
|
+
newChipKeyCodes = _this$props.newChipKeyCodes,
|
|
559
|
+
newChipKeys = _this$props.newChipKeys,
|
|
560
|
+
onBeforeAdd = _this$props.onBeforeAdd,
|
|
561
|
+
onAdd = _this$props.onAdd,
|
|
562
|
+
onBlur = _this$props.onBlur,
|
|
563
|
+
onDelete = _this$props.onDelete,
|
|
564
|
+
onChange = _this$props.onChange,
|
|
565
|
+
onFocus = _this$props.onFocus,
|
|
566
|
+
onKeyDown = _this$props.onKeyDown,
|
|
567
|
+
onKeyPress = _this$props.onKeyPress,
|
|
568
|
+
onKeyUp = _this$props.onKeyUp,
|
|
569
|
+
onUpdateInput = _this$props.onUpdateInput,
|
|
570
|
+
placeholder = _this$props.placeholder,
|
|
571
|
+
readOnly = _this$props.readOnly,
|
|
572
|
+
required = _this$props.required,
|
|
573
|
+
rootRef = _this$props.rootRef,
|
|
574
|
+
value = _this$props.value,
|
|
575
|
+
variant = _this$props.variant,
|
|
576
|
+
other = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
|
|
665
577
|
var chips = value || this.state.chips || [];
|
|
666
578
|
var actualInputValue = inputValue != null ? inputValue : this.state.inputValue;
|
|
667
579
|
var hasInput = (this.props.value || actualInputValue).length || actualInputValue.length;
|
|
@@ -687,18 +599,15 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
687
599
|
}, i);
|
|
688
600
|
});
|
|
689
601
|
var InputMore = {};
|
|
690
|
-
|
|
691
602
|
if (variant === 'outlined') {
|
|
692
603
|
InputMore.notched = shrinkFloatingLabel;
|
|
693
604
|
InputMore.labelWidth = shrinkFloatingLabel && this.labelNode && this.labelNode.offsetWidth || 0;
|
|
694
605
|
}
|
|
695
|
-
|
|
696
606
|
if (variant !== 'standard') {
|
|
697
607
|
InputMore.startAdornment = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, chipComponents);
|
|
698
608
|
} else {
|
|
699
609
|
InputProps.disableUnderline = true;
|
|
700
610
|
}
|
|
701
|
-
|
|
702
611
|
var InputComponent = variantComponent[variant];
|
|
703
612
|
return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], (0, _extends2["default"])({
|
|
704
613
|
ref: rootRef,
|
|
@@ -749,137 +658,101 @@ var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
|
749
658
|
key: "getDerivedStateFromProps",
|
|
750
659
|
value: function getDerivedStateFromProps(props, state) {
|
|
751
660
|
var newState = null;
|
|
752
|
-
|
|
753
661
|
if (props.value && props.value.length !== state.prevPropsValue.length) {
|
|
754
662
|
newState = {
|
|
755
663
|
prevPropsValue: props.value
|
|
756
664
|
};
|
|
757
|
-
|
|
758
665
|
if (props.clearInputValueOnChange) {
|
|
759
666
|
newState.inputValue = '';
|
|
760
667
|
}
|
|
761
|
-
}
|
|
762
|
-
|
|
668
|
+
}
|
|
763
669
|
|
|
670
|
+
// if change detection is only needed for clearInputValueOnChange
|
|
764
671
|
if (props.clearInputValueOnChange && props.value && props.value.length !== state.prevPropsValue.length) {
|
|
765
672
|
newState = {
|
|
766
673
|
prevPropsValue: props.value,
|
|
767
674
|
inputValue: ''
|
|
768
675
|
};
|
|
769
676
|
}
|
|
770
|
-
|
|
771
677
|
if (props.disabled) {
|
|
772
678
|
newState = _objectSpread(_objectSpread({}, newState), {}, {
|
|
773
679
|
focusedChip: null
|
|
774
680
|
});
|
|
775
681
|
}
|
|
776
|
-
|
|
777
682
|
if (!state.chipsUpdated && props.defaultValue) {
|
|
778
683
|
newState = _objectSpread(_objectSpread({}, newState), {}, {
|
|
779
684
|
chips: props.defaultValue
|
|
780
685
|
});
|
|
781
686
|
}
|
|
782
|
-
|
|
783
687
|
return newState;
|
|
784
688
|
}
|
|
785
689
|
}]);
|
|
786
690
|
return ChipInput;
|
|
787
691
|
}(_react["default"].Component);
|
|
788
|
-
|
|
789
692
|
ChipInput.propTypes = {
|
|
790
693
|
/** Allows duplicate chips if set to true. */
|
|
791
694
|
allowDuplicates: _propTypes["default"].bool,
|
|
792
|
-
|
|
793
695
|
/** If true, the placeholder will always be visible. */
|
|
794
696
|
alwaysShowPlaceholder: _propTypes["default"].bool,
|
|
795
|
-
|
|
796
697
|
/** Behavior when the chip input is blurred: `'clear'` clears the input, `'add'` creates a chip and `'ignore'` keeps the input. */
|
|
797
698
|
blurBehavior: _propTypes["default"].oneOf(['clear', 'add', 'add-or-clear', 'ignore']),
|
|
798
|
-
|
|
799
699
|
/** 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. */
|
|
800
700
|
chipRenderer: _propTypes["default"].func,
|
|
801
|
-
|
|
802
701
|
/** Whether the input value should be cleared if the `value` prop is changed. */
|
|
803
702
|
clearInputValueOnChange: _propTypes["default"].bool,
|
|
804
|
-
|
|
805
703
|
/** Data source for auto complete. This should be an array of strings or objects. */
|
|
806
704
|
dataSource: _propTypes["default"].array,
|
|
807
|
-
|
|
808
705
|
/** Config for objects list dataSource, e.g. `{ text: 'text', value: 'value' }`. If not specified, the `dataSource` must be a flat array of strings or a custom `chipRenderer` must be set to handle the objects. */
|
|
809
706
|
dataSourceConfig: _propTypes["default"].shape({
|
|
810
707
|
text: _propTypes["default"].string.isRequired,
|
|
811
708
|
value: _propTypes["default"].string.isRequired
|
|
812
709
|
}),
|
|
813
|
-
|
|
814
710
|
/** The chips to display by default (for uncontrolled mode). */
|
|
815
711
|
defaultValue: _propTypes["default"].array,
|
|
816
|
-
|
|
817
712
|
/** Whether to use `setTimeout` to delay adding chips in case other input events like `onSelection` need to fire first */
|
|
818
713
|
delayBeforeAdd: _propTypes["default"].bool,
|
|
819
|
-
|
|
820
714
|
/** Disables the chip input if set to true. */
|
|
821
715
|
disabled: _propTypes["default"].bool,
|
|
822
|
-
|
|
823
716
|
/** Disable the input underline. Only valid for 'standard' variant */
|
|
824
717
|
disableUnderline: _propTypes["default"].bool,
|
|
825
|
-
|
|
826
718
|
/** Props to pass through to the `FormHelperText` component. */
|
|
827
719
|
FormHelperTextProps: _propTypes["default"].object,
|
|
828
|
-
|
|
829
720
|
/** If true, the chip input will fill the available width. */
|
|
830
721
|
fullWidth: _propTypes["default"].bool,
|
|
831
|
-
|
|
832
722
|
/** 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. */
|
|
833
723
|
fullWidthInput: _propTypes["default"].bool,
|
|
834
|
-
|
|
835
724
|
/** Helper text that is displayed below the input. */
|
|
836
725
|
helperText: _propTypes["default"].node,
|
|
837
|
-
|
|
838
726
|
/** Props to pass through to the `InputLabel`. */
|
|
839
727
|
InputLabelProps: _propTypes["default"].object,
|
|
840
|
-
|
|
841
728
|
/** Props to pass through to the `Input`. */
|
|
842
729
|
InputProps: _propTypes["default"].object,
|
|
843
|
-
|
|
844
730
|
/** Use this property to pass a ref callback to the native input component. */
|
|
845
731
|
inputRef: _propTypes["default"].func,
|
|
846
|
-
|
|
847
732
|
/** The input value (enables controlled mode for the text input if set). */
|
|
848
733
|
inputValue: _propTypes["default"].string,
|
|
849
|
-
|
|
850
734
|
/* The content of the floating label. */
|
|
851
735
|
label: _propTypes["default"].node,
|
|
852
|
-
|
|
853
736
|
/** The key codes (`KeyboardEvent.keyCode`) used to determine when to create a new chip. */
|
|
854
737
|
newChipKeyCodes: _propTypes["default"].arrayOf(_propTypes["default"].number),
|
|
855
|
-
|
|
856
738
|
/** The keys (`KeyboardEvent.key`) used to determine when to create a new chip. */
|
|
857
739
|
newChipKeys: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
858
|
-
|
|
859
740
|
/** Callback function that is called when a new chip was added (in controlled mode). */
|
|
860
741
|
onAdd: _propTypes["default"].func,
|
|
861
|
-
|
|
862
742
|
/** 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. */
|
|
863
743
|
onBeforeAdd: _propTypes["default"].func,
|
|
864
|
-
|
|
865
744
|
/** Callback function that is called when the chips change (in uncontrolled mode). */
|
|
866
745
|
onChange: _propTypes["default"].func,
|
|
867
|
-
|
|
868
746
|
/** Callback function that is called when a new chip was removed (in controlled mode). */
|
|
869
747
|
onDelete: _propTypes["default"].func,
|
|
870
|
-
|
|
871
748
|
/** Callback function that is called when the input changes. */
|
|
872
749
|
onUpdateInput: _propTypes["default"].func,
|
|
873
|
-
|
|
874
750
|
/** A placeholder that is displayed if the input has no values. */
|
|
875
751
|
placeholder: _propTypes["default"].string,
|
|
876
|
-
|
|
877
752
|
/** Makes the chip input read-only if set to true. */
|
|
878
753
|
readOnly: _propTypes["default"].bool,
|
|
879
|
-
|
|
880
754
|
/** The chips to display (enables controlled mode if set). */
|
|
881
755
|
value: _propTypes["default"].array,
|
|
882
|
-
|
|
883
756
|
/** The variant of the Input component */
|
|
884
757
|
variant: _propTypes["default"].oneOf(['outlined', 'standard', 'filled'])
|
|
885
758
|
};
|
|
@@ -893,22 +766,19 @@ ChipInput.defaultProps = {
|
|
|
893
766
|
newChipKeys: ['Enter'],
|
|
894
767
|
variant: 'standard'
|
|
895
768
|
};
|
|
896
|
-
|
|
897
769
|
var _default = (0, _withStyles["default"])(styles, {
|
|
898
770
|
name: 'WAMuiChipInput'
|
|
899
771
|
})(ChipInput);
|
|
900
|
-
|
|
901
772
|
exports["default"] = _default;
|
|
902
|
-
|
|
903
773
|
var defaultChipRenderer = function defaultChipRenderer(_ref, key) {
|
|
904
774
|
var value = _ref.value,
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
775
|
+
text = _ref.text,
|
|
776
|
+
isFocused = _ref.isFocused,
|
|
777
|
+
isDisabled = _ref.isDisabled,
|
|
778
|
+
isReadOnly = _ref.isReadOnly,
|
|
779
|
+
handleClick = _ref.handleClick,
|
|
780
|
+
handleDelete = _ref.handleDelete,
|
|
781
|
+
className = _ref.className;
|
|
912
782
|
return /*#__PURE__*/_react["default"].createElement(_Chip["default"], {
|
|
913
783
|
key: key,
|
|
914
784
|
className: className,
|
|
@@ -921,6 +791,5 @@ var defaultChipRenderer = function defaultChipRenderer(_ref, key) {
|
|
|
921
791
|
label: text
|
|
922
792
|
});
|
|
923
793
|
};
|
|
924
|
-
|
|
925
794
|
exports.defaultChipRenderer = defaultChipRenderer;
|
|
926
795
|
//# sourceMappingURL=ChipInput.js.map
|