@iobroker/adapter-react-v5 4.8.1 → 4.9.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/Components/Logo.d.ts +9 -50
- package/Components/Logo.js +106 -173
- package/Components/ObjectBrowser.d.ts +9 -0
- package/Components/ObjectBrowser.js +370 -165
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/SaveCloseButtons.d.ts +17 -61
- package/Components/SaveCloseButtons.js +64 -124
- package/Components/Schedule.d.ts +31 -6
- package/Components/Schedule.js +1144 -1562
- package/Components/TabContainer.d.ts +9 -37
- package/Components/TabContainer.js +49 -74
- package/Components/TabContent.d.ts +6 -27
- package/Components/TabContent.js +24 -67
- package/Components/TabHeader.d.ts +6 -11
- package/Components/TabHeader.js +11 -40
- package/Components/ToggleThemeMenu.d.ts +10 -8
- package/Components/ToggleThemeMenu.js +16 -36
- package/Components/types.d.ts +10 -2
- package/Dialogs/SelectID.d.ts +39 -139
- package/Dialogs/SelectID.js +141 -271
- package/LegacyConnection.d.ts +1 -1
- package/README.md +9 -2
- package/i18n.d.ts +2 -2
- package/index.d.ts +127 -126
- package/index.js +213 -192
- package/package.json +7 -7
- package/Components/JsonConfigComponent/ChipInput.d.ts +0 -12
- package/Components/JsonConfigComponent/ChipInput.js +0 -763
- package/Components/JsonConfigComponent/ChipInput.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigAccordion.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigAccordion.js +0 -348
- package/Components/JsonConfigComponent/ConfigAccordion.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigAlive.d.ts +0 -10
- package/Components/JsonConfigComponent/ConfigAlive.js +0 -105
- package/Components/JsonConfigComponent/ConfigAlive.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigAutocomplete.d.ts +0 -37
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +0 -73
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +0 -131
- package/Components/JsonConfigComponent/ConfigCRON.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigCRON.js +0 -157
- package/Components/JsonConfigComponent/ConfigCRON.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCertCollection.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCertCollection.js +0 -128
- package/Components/JsonConfigComponent/ConfigCertCollection.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCertificateSelect.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js +0 -149
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCertificates.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCertificates.js +0 -284
- package/Components/JsonConfigComponent/ConfigCertificates.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCheckLicense.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigCheckLicense.js +0 -821
- package/Components/JsonConfigComponent/ConfigCheckLicense.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigCheckbox.js +0 -40
- package/Components/JsonConfigComponent/ConfigChip.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigChip.js +0 -120
- package/Components/JsonConfigComponent/ConfigChip.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigColor.d.ts +0 -22
- package/Components/JsonConfigComponent/ConfigColor.js +0 -120
- package/Components/JsonConfigComponent/ConfigColor.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCoordinates.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCoordinates.js +0 -265
- package/Components/JsonConfigComponent/ConfigCoordinates.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCustom.d.ts +0 -26
- package/Components/JsonConfigComponent/ConfigCustom.js +0 -316
- package/Components/JsonConfigComponent/ConfigCustom.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigDatePicker.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigDatePicker.js +0 -91
- package/Components/JsonConfigComponent/ConfigDatePicker.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigDeviceManager.d.ts +0 -6
- package/Components/JsonConfigComponent/ConfigDeviceManager.js +0 -18
- package/Components/JsonConfigComponent/ConfigFile.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigFile.js +0 -228
- package/Components/JsonConfigComponent/ConfigFile.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigFileSelector.js +0 -625
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigFunc.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigFunc.js +0 -124
- package/Components/JsonConfigComponent/ConfigFunc.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigGeneric.d.ts +0 -95
- package/Components/JsonConfigComponent/ConfigGeneric.js +0 -646
- package/Components/JsonConfigComponent/ConfigIP.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigIP.js +0 -130
- package/Components/JsonConfigComponent/ConfigIP.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigImageSendTo.d.ts +0 -10
- package/Components/JsonConfigComponent/ConfigImageSendTo.js +0 -114
- package/Components/JsonConfigComponent/ConfigImageSendTo.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigImageUpload.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigImageUpload.js +0 -166
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +0 -264
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigInterface.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigInterface.js +0 -146
- package/Components/JsonConfigComponent/ConfigInterface.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.d.ts +0 -13
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +0 -145
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigLanguage.d.ts +0 -7
- package/Components/JsonConfigComponent/ConfigLanguage.js +0 -110
- package/Components/JsonConfigComponent/ConfigLicense.d.ts +0 -24
- package/Components/JsonConfigComponent/ConfigLicense.js +0 -183
- package/Components/JsonConfigComponent/ConfigLicense.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigNumber.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigNumber.js +0 -117
- package/Components/JsonConfigComponent/ConfigObjectId.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigObjectId.js +0 -167
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPanel.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigPanel.js +0 -396
- package/Components/JsonConfigComponent/ConfigPanel.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPassword.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigPassword.js +0 -193
- package/Components/JsonConfigComponent/ConfigPassword.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPattern.d.ts +0 -21
- package/Components/JsonConfigComponent/ConfigPattern.js +0 -65
- package/Components/JsonConfigComponent/ConfigPattern.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPort.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigPort.js +0 -176
- package/Components/JsonConfigComponent/ConfigRoom.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigRoom.js +0 -124
- package/Components/JsonConfigComponent/ConfigRoom.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSelect.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigSelect.js +0 -159
- package/Components/JsonConfigComponent/ConfigSelect.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js +0 -272
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSendto.d.ts +0 -24
- package/Components/JsonConfigComponent/ConfigSendto.js +0 -294
- package/Components/JsonConfigComponent/ConfigSetState.d.ts +0 -18
- package/Components/JsonConfigComponent/ConfigSetState.js +0 -185
- package/Components/JsonConfigComponent/ConfigSetState.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSlider.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigSlider.js +0 -119
- package/Components/JsonConfigComponent/ConfigSlider.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticDivider.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticDivider.js +0 -68
- package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticHeader.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticHeader.js +0 -81
- package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticImage.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticImage.js +0 -71
- package/Components/JsonConfigComponent/ConfigStaticImage.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticText.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticText.js +0 -88
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTable.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigTable.js +0 -1064
- package/Components/JsonConfigComponent/ConfigTable.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTabs.d.ts +0 -34
- package/Components/JsonConfigComponent/ConfigTabs.js +0 -162
- package/Components/JsonConfigComponent/ConfigTabs.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigText.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigText.js +0 -226
- package/Components/JsonConfigComponent/ConfigText.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.d.ts +0 -10
- package/Components/JsonConfigComponent/ConfigTextSendTo.js +0 -129
- package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTimePicker.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigTimePicker.js +0 -85
- package/Components/JsonConfigComponent/ConfigTimePicker.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTopic.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigTopic.js +0 -110
- package/Components/JsonConfigComponent/ConfigTopic.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigUUID.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigUUID.js +0 -95
- package/Components/JsonConfigComponent/ConfigUUID.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigUser.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigUser.js +0 -142
- package/Components/JsonConfigComponent/ConfigUser.js.map +0 -1
- package/Components/JsonConfigComponent/DeviceManager/Communication.d.ts +0 -63
- package/Components/JsonConfigComponent/DeviceManager/Communication.js +0 -268
- package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.d.ts +0 -11
- package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.js +0 -15
- package/Components/JsonConfigComponent/DeviceManager/DeviceCard.d.ts +0 -53
- package/Components/JsonConfigComponent/DeviceManager/DeviceCard.js +0 -340
- package/Components/JsonConfigComponent/DeviceManager/DeviceControl.d.ts +0 -45
- package/Components/JsonConfigComponent/DeviceManager/DeviceControl.js +0 -146
- package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.d.ts +0 -12
- package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.js +0 -69
- package/Components/JsonConfigComponent/DeviceManager/DeviceList.d.ts +0 -51
- package/Components/JsonConfigComponent/DeviceManager/DeviceList.js +0 -226
- package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.d.ts +0 -13
- package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.js +0 -111
- package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.d.ts +0 -7
- package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.js +0 -16
- package/Components/JsonConfigComponent/DeviceManager/JsonConfig.d.ts +0 -11
- package/Components/JsonConfigComponent/DeviceManager/JsonConfig.js +0 -94
- package/Components/JsonConfigComponent/DeviceManager/TooltipButton.d.ts +0 -10
- package/Components/JsonConfigComponent/DeviceManager/TooltipButton.js +0 -22
- package/Components/JsonConfigComponent/DeviceManager/Utils.d.ts +0 -12
- package/Components/JsonConfigComponent/DeviceManager/Utils.js +0 -158
- package/Components/JsonConfigComponent/DeviceManager/i18n/de.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/en.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/es.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/fr.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/i18n.d.ts +0 -26
- package/Components/JsonConfigComponent/DeviceManager/i18n/it.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/nl.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/pl.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/pt.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/ru.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/uk.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/zh-cn.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/index.d.ts +0 -2
- package/Components/JsonConfigComponent/DeviceManager/index.js +0 -10
- package/Components/JsonConfigComponent/DeviceManager/index.js.map +0 -1
- package/Components/JsonConfigComponent/index.d.ts +0 -26
- package/Components/JsonConfigComponent/index.js +0 -520
- package/Components/JsonConfigComponent/index.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/AdminConnection.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/AdminConnection.js +0 -7
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/Icon.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/Icon.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/Icon.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/Utils.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/Utils.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/Utils.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/i18n.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/i18n.js +0 -10
- package/Components/JsonConfigComponent/wrapper/i18n.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.js +0 -10
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.js.map +0 -1
- package/Components/Logo.js.map +0 -1
- package/Components/SaveCloseButtons.js.map +0 -1
- package/Components/Schedule.js.map +0 -1
- package/Components/TabContainer.js.map +0 -1
- package/Components/TabContent.js.map +0 -1
- package/Components/TabHeader.js.map +0 -1
- package/Components/ToggleThemeMenu.js.map +0 -1
- package/Dialogs/SelectID.js.map +0 -1
|
@@ -1,763 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.defaultChipRenderer = exports["default"] = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
16
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
|
-
var _react = _interopRequireDefault(require("react"));
|
|
19
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
20
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
21
|
-
var _styles = require("@mui/styles");
|
|
22
|
-
var _material = require("@mui/material");
|
|
23
|
-
var _FilledInput = _interopRequireDefault(require("@mui/material/FilledInput/FilledInput"));
|
|
24
|
-
var _blue = _interopRequireDefault(require("@mui/material/colors/blue"));
|
|
25
|
-
var _Utils = _interopRequireDefault(require("../Utils"));
|
|
26
|
-
var _excluded = ["alwaysShowPlaceholder", "chipRenderer", "classes", "className", "dataSourceConfig", "disabled", "disableUnderline", "error", "FormHelperTextProps", "fullWidth", "fullWidthInput", "helperText", "id", "InputProps", "InputLabelProps", "inputValue", "label", "placeholder", "readOnly", "required", "rootRef", "value", "variant"];
|
|
27
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
|
-
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); }; }
|
|
30
|
-
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; } } /**
|
|
31
|
-
* Notice: Some code was adapted from Material-UI's text field.
|
|
32
|
-
* Copyright (c) 2014 Call-Em-All (https://github.com/callemall/material-ui)
|
|
33
|
-
*/
|
|
34
|
-
var variantComponent = {
|
|
35
|
-
standard: _material.Input,
|
|
36
|
-
filled: _FilledInput["default"],
|
|
37
|
-
outlined: _material.OutlinedInput
|
|
38
|
-
};
|
|
39
|
-
var styles = function styles(theme) {
|
|
40
|
-
var light = theme.palette.type === 'light';
|
|
41
|
-
var bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
|
|
42
|
-
return {
|
|
43
|
-
root: {},
|
|
44
|
-
inputRoot: {
|
|
45
|
-
display: 'inline-flex',
|
|
46
|
-
flexWrap: 'wrap',
|
|
47
|
-
flex: 1,
|
|
48
|
-
marginTop: 0,
|
|
49
|
-
minWidth: 70,
|
|
50
|
-
'&$outlined,&$filled': {
|
|
51
|
-
boxSizing: 'border-box'
|
|
52
|
-
},
|
|
53
|
-
'&$outlined': {
|
|
54
|
-
paddingTop: 14
|
|
55
|
-
},
|
|
56
|
-
'&$filled': {
|
|
57
|
-
paddingTop: 28
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
input: {
|
|
61
|
-
display: 'inline-block',
|
|
62
|
-
textOverflow: 'ellipsis',
|
|
63
|
-
overflow: 'hidden',
|
|
64
|
-
whiteSpace: 'nowrap',
|
|
65
|
-
appearance: 'none',
|
|
66
|
-
// Remove border in Safari, doesn't seem to break anything in other browsers
|
|
67
|
-
WebkitTapHighlightColor: 'rgba(0,0,0,0)',
|
|
68
|
-
// Remove mobile color flashing (deprecated style).
|
|
69
|
-
"float": 'left',
|
|
70
|
-
flex: 1
|
|
71
|
-
},
|
|
72
|
-
chipContainer: {
|
|
73
|
-
display: 'flex',
|
|
74
|
-
flexFlow: 'row wrap',
|
|
75
|
-
cursor: 'text',
|
|
76
|
-
marginBottom: -2,
|
|
77
|
-
minHeight: 40,
|
|
78
|
-
'&$labeled&$standard': {
|
|
79
|
-
marginTop: 18
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
outlined: {
|
|
83
|
-
'& input': {
|
|
84
|
-
height: 16,
|
|
85
|
-
paddingTop: 4,
|
|
86
|
-
paddingBottom: 12,
|
|
87
|
-
marginTop: 4,
|
|
88
|
-
marginBottom: 4
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
standard: {},
|
|
92
|
-
filled: {
|
|
93
|
-
'& input': {
|
|
94
|
-
height: 22,
|
|
95
|
-
marginBottom: 4,
|
|
96
|
-
marginTop: 4,
|
|
97
|
-
paddingTop: 0
|
|
98
|
-
},
|
|
99
|
-
'$marginDense & input': {
|
|
100
|
-
height: 26
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
labeled: {},
|
|
104
|
-
label: {
|
|
105
|
-
top: 4,
|
|
106
|
-
'&$outlined&:not($labelShrink)': {
|
|
107
|
-
top: 2,
|
|
108
|
-
'$marginDense &': {
|
|
109
|
-
top: 5
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
'&$filled&:not($labelShrink)': {
|
|
113
|
-
top: 15,
|
|
114
|
-
'$marginDense &': {
|
|
115
|
-
top: 20
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
labelShrink: {
|
|
120
|
-
top: 0
|
|
121
|
-
},
|
|
122
|
-
helperText: {
|
|
123
|
-
marginBottom: -20
|
|
124
|
-
},
|
|
125
|
-
focused: {},
|
|
126
|
-
disabled: {},
|
|
127
|
-
underline: {
|
|
128
|
-
'&:after': {
|
|
129
|
-
borderBottom: "2px solid ".concat(theme.palette.primary[light ? 'dark' : 'light']),
|
|
130
|
-
left: 0,
|
|
131
|
-
bottom: 0,
|
|
132
|
-
// Doing the other way around a crash on IE 11 "''" https://github.com/cssinjs/jss/issues/242
|
|
133
|
-
content: '""',
|
|
134
|
-
position: 'absolute',
|
|
135
|
-
right: 0,
|
|
136
|
-
transform: 'scaleX(0)',
|
|
137
|
-
transition: theme.transitions.create('transform', {
|
|
138
|
-
duration: theme.transitions.duration.shorter,
|
|
139
|
-
easing: theme.transitions.easing.easeOut
|
|
140
|
-
}),
|
|
141
|
-
pointerEvents: 'none' // Transparent to the hover style.
|
|
142
|
-
},
|
|
143
|
-
'&$focused:after': {
|
|
144
|
-
transform: 'scaleX(1)'
|
|
145
|
-
},
|
|
146
|
-
'&$error:after': {
|
|
147
|
-
borderBottomColor: theme.palette.error.main,
|
|
148
|
-
transform: 'scaleX(1)' // error is always underlined in red
|
|
149
|
-
},
|
|
150
|
-
'&:before': {
|
|
151
|
-
borderBottom: "1px solid ".concat(bottomLineColor),
|
|
152
|
-
left: 0,
|
|
153
|
-
bottom: 0,
|
|
154
|
-
// Doing the other way around a crash on IE 11 "''" https://github.com/cssinjs/jss/issues/242
|
|
155
|
-
content: '"\\00a0"',
|
|
156
|
-
position: 'absolute',
|
|
157
|
-
right: 0,
|
|
158
|
-
transition: theme.transitions.create('border-bottom-color', {
|
|
159
|
-
duration: theme.transitions.duration.shorter
|
|
160
|
-
}),
|
|
161
|
-
pointerEvents: 'none' // Transparent to the hover style.
|
|
162
|
-
},
|
|
163
|
-
'&:hover:not($disabled):not($focused):not($error):before': {
|
|
164
|
-
borderBottom: "2px solid ".concat(theme.palette.text.primary),
|
|
165
|
-
// Reset on touch devices, it doesn't add specificity
|
|
166
|
-
'@media (hover: none)': {
|
|
167
|
-
borderBottom: "1px solid ".concat(bottomLineColor)
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
'&$disabled:before': {
|
|
171
|
-
borderBottomStyle: 'dotted'
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
error: {
|
|
175
|
-
'&:after': {
|
|
176
|
-
backgroundColor: theme.palette.error.main,
|
|
177
|
-
transform: 'scaleX(1)' // error is always underlined in red
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
chip: {
|
|
181
|
-
margin: '0 8px 8px 0',
|
|
182
|
-
"float": 'left'
|
|
183
|
-
},
|
|
184
|
-
marginDense: {}
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
var keyCodes = {
|
|
188
|
-
BACKSPACE: 8,
|
|
189
|
-
DELETE: 46,
|
|
190
|
-
LEFT_ARROW: 37,
|
|
191
|
-
RIGHT_ARROW: 39
|
|
192
|
-
};
|
|
193
|
-
var defaultChipRenderer = exports.defaultChipRenderer = function defaultChipRenderer(_ref, key) {
|
|
194
|
-
var text = _ref.text,
|
|
195
|
-
isFocused = _ref.isFocused,
|
|
196
|
-
isDisabled = _ref.isDisabled,
|
|
197
|
-
isReadOnly = _ref.isReadOnly,
|
|
198
|
-
handleClick = _ref.handleClick,
|
|
199
|
-
handleDelete = _ref.handleDelete,
|
|
200
|
-
className = _ref.className;
|
|
201
|
-
return /*#__PURE__*/_react["default"].createElement(_material.Chip, {
|
|
202
|
-
key: key,
|
|
203
|
-
className: className,
|
|
204
|
-
style: {
|
|
205
|
-
pointerEvents: isDisabled || isReadOnly ? 'none' : undefined,
|
|
206
|
-
backgroundColor: isFocused ? _blue["default"][300] : undefined
|
|
207
|
-
},
|
|
208
|
-
onClick: handleClick,
|
|
209
|
-
onDelete: handleDelete,
|
|
210
|
-
label: text
|
|
211
|
-
});
|
|
212
|
-
};
|
|
213
|
-
var ChipInput = /*#__PURE__*/function (_React$Component) {
|
|
214
|
-
(0, _inherits2["default"])(ChipInput, _React$Component);
|
|
215
|
-
var _super = _createSuper(ChipInput);
|
|
216
|
-
function ChipInput(props) {
|
|
217
|
-
var _this;
|
|
218
|
-
(0, _classCallCheck2["default"])(this, ChipInput);
|
|
219
|
-
_this = _super.call(this, props);
|
|
220
|
-
/**
|
|
221
|
-
* Blurs this component.
|
|
222
|
-
* @public
|
|
223
|
-
*/
|
|
224
|
-
// blur() {
|
|
225
|
-
// if (this.input) {
|
|
226
|
-
// this.actualInput.blur();
|
|
227
|
-
// }
|
|
228
|
-
// }
|
|
229
|
-
/**
|
|
230
|
-
* Focuses this component.
|
|
231
|
-
* @public
|
|
232
|
-
*/
|
|
233
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "focus", function () {
|
|
234
|
-
_this.actualInput.focus();
|
|
235
|
-
if (_this.state.focusedChip) {
|
|
236
|
-
_this.setState({
|
|
237
|
-
focusedChip: null
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleInputBlur", function (event) {
|
|
242
|
-
if (_this.props.onBlur) {
|
|
243
|
-
_this.props.onBlur(event);
|
|
244
|
-
}
|
|
245
|
-
_this.setState({
|
|
246
|
-
isFocused: false
|
|
247
|
-
});
|
|
248
|
-
if (_this.state.focusedChip) {
|
|
249
|
-
_this.setState({
|
|
250
|
-
focusedChip: null
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
var value = event.target.value;
|
|
254
|
-
var addChipOptions;
|
|
255
|
-
switch (_this.props.blurBehavior) {
|
|
256
|
-
case 'add-or-clear':
|
|
257
|
-
addChipOptions = {
|
|
258
|
-
clearInputOnFail: true
|
|
259
|
-
};
|
|
260
|
-
// falls through
|
|
261
|
-
case 'add':
|
|
262
|
-
if (_this.props.delayBeforeAdd) {
|
|
263
|
-
// Let's assume that we only want to add the existing content as chip, when
|
|
264
|
-
// another event has not added a chip within 200ms.
|
|
265
|
-
// e.g., onSelection Callback in Autocomplete case
|
|
266
|
-
var numChipsBefore = (_this.props.value || _this.state.chips).length;
|
|
267
|
-
_this.inputBlurTimeout = setTimeout(function () {
|
|
268
|
-
var numChipsAfter = (_this.props.value || _this.state.chips).length;
|
|
269
|
-
if (numChipsBefore === numChipsAfter) {
|
|
270
|
-
_this.handleAddChip(value, addChipOptions);
|
|
271
|
-
} else {
|
|
272
|
-
_this.clearInput();
|
|
273
|
-
}
|
|
274
|
-
}, 150);
|
|
275
|
-
} else {
|
|
276
|
-
_this.handleAddChip(value, addChipOptions);
|
|
277
|
-
}
|
|
278
|
-
break;
|
|
279
|
-
case 'clear':
|
|
280
|
-
_this.clearInput();
|
|
281
|
-
break;
|
|
282
|
-
default:
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleInputFocus", function (event) {
|
|
287
|
-
_this.setState({
|
|
288
|
-
isFocused: true
|
|
289
|
-
});
|
|
290
|
-
if (_this.props.onFocus) {
|
|
291
|
-
_this.props.onFocus(event);
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeyDown", function (event) {
|
|
295
|
-
var focusedChip = _this.state.focusedChip;
|
|
296
|
-
_this._keyPressed = false;
|
|
297
|
-
_this._preventChipCreation = false;
|
|
298
|
-
if (_this.props.onKeyDown) {
|
|
299
|
-
// Needed for arrow controls on a menu in autocomplete scenario
|
|
300
|
-
_this.props.onKeyDown(event);
|
|
301
|
-
// Check if the callback marked the event as isDefaultPrevented() and skip further actions
|
|
302
|
-
// enter key, for example, should not always add the current value of the inputField
|
|
303
|
-
if (event.isDefaultPrevented()) {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
var chips = _this.props.value || _this.state.chips;
|
|
308
|
-
if (_this.props.newChipKeyCodes.includes(event.keyCode) || _this.props.newChipKeys.includes(event.key)) {
|
|
309
|
-
var result = _this.handleAddChip(event.target.value);
|
|
310
|
-
if (result !== false) {
|
|
311
|
-
event.preventDefault();
|
|
312
|
-
}
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
switch (event.keyCode) {
|
|
316
|
-
case keyCodes.BACKSPACE:
|
|
317
|
-
if (event.target.value === '') {
|
|
318
|
-
if (focusedChip) {
|
|
319
|
-
_this.handleDeleteChip(chips[focusedChip], focusedChip);
|
|
320
|
-
if (focusedChip) {
|
|
321
|
-
_this.setState({
|
|
322
|
-
focusedChip: focusedChip - 1
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
} else {
|
|
326
|
-
_this.setState({
|
|
327
|
-
focusedChip: chips.length - 1
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
break;
|
|
332
|
-
case keyCodes.DELETE:
|
|
333
|
-
if (event.target.value === '' && focusedChip) {
|
|
334
|
-
_this.handleDeleteChip(chips[focusedChip], focusedChip);
|
|
335
|
-
if (focusedChip <= chips.length - 1) {
|
|
336
|
-
_this.setState({
|
|
337
|
-
focusedChip: focusedChip
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
break;
|
|
342
|
-
case keyCodes.LEFT_ARROW:
|
|
343
|
-
if (focusedChip === null && event.target.value === '' && chips.length) {
|
|
344
|
-
_this.setState({
|
|
345
|
-
focusedChip: chips.length - 1
|
|
346
|
-
});
|
|
347
|
-
} else if (focusedChip !== null && focusedChip > 0) {
|
|
348
|
-
_this.setState({
|
|
349
|
-
focusedChip: focusedChip - 1
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
break;
|
|
353
|
-
case keyCodes.RIGHT_ARROW:
|
|
354
|
-
if (focusedChip !== null && focusedChip < chips.length - 1) {
|
|
355
|
-
_this.setState({
|
|
356
|
-
focusedChip: focusedChip + 1
|
|
357
|
-
});
|
|
358
|
-
} else {
|
|
359
|
-
_this.setState({
|
|
360
|
-
focusedChip: null
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
break;
|
|
364
|
-
default:
|
|
365
|
-
_this.setState({
|
|
366
|
-
focusedChip: null
|
|
367
|
-
});
|
|
368
|
-
break;
|
|
369
|
-
}
|
|
370
|
-
});
|
|
371
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeyUp", function (event) {
|
|
372
|
-
if (!_this._preventChipCreation && (_this.props.newChipKeyCodes.indexOf(event.keyCode) >= 0 || _this.props.newChipKeys.indexOf(event.key) >= 0) && _this._keyPressed) {
|
|
373
|
-
_this.clearInput();
|
|
374
|
-
} else {
|
|
375
|
-
_this.updateInput(event.target.value);
|
|
376
|
-
}
|
|
377
|
-
if (_this.props.onKeyUp) {
|
|
378
|
-
_this.props.onKeyUp(event);
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeyPress", function (event) {
|
|
382
|
-
_this._keyPressed = true;
|
|
383
|
-
if (_this.props.onKeyPress) {
|
|
384
|
-
_this.props.onKeyPress(event);
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleUpdateInput", function (e) {
|
|
388
|
-
if (_this.props.inputValue === null || _this.props.inputValue === undefined) {
|
|
389
|
-
_this.updateInput(e.target.value);
|
|
390
|
-
}
|
|
391
|
-
if (_this.props.onUpdateInput) {
|
|
392
|
-
_this.props.onUpdateInput(e);
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
/**
|
|
396
|
-
* Set the reference to the actual input, that is the input of the Input.
|
|
397
|
-
* @param {object} ref - The reference
|
|
398
|
-
*/
|
|
399
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setActualInputRef", function (ref) {
|
|
400
|
-
_this.actualInput = ref;
|
|
401
|
-
_this.props.inputRef && _this.props.inputRef(ref);
|
|
402
|
-
});
|
|
403
|
-
_this.state = {
|
|
404
|
-
chips: [],
|
|
405
|
-
focusedChip: null,
|
|
406
|
-
inputValue: '',
|
|
407
|
-
isFocused: false,
|
|
408
|
-
chipsUpdated: false,
|
|
409
|
-
prevPropsValue: []
|
|
410
|
-
};
|
|
411
|
-
if (props.defaultValue) {
|
|
412
|
-
_this.state.chips = props.defaultValue;
|
|
413
|
-
}
|
|
414
|
-
_this.labelRef = /*#__PURE__*/_react["default"].createRef();
|
|
415
|
-
_this.input = /*#__PURE__*/_react["default"].createRef();
|
|
416
|
-
return _this;
|
|
417
|
-
}
|
|
418
|
-
(0, _createClass2["default"])(ChipInput, [{
|
|
419
|
-
key: "componentDidMount",
|
|
420
|
-
value: function componentDidMount() {
|
|
421
|
-
if (this.props.variant === 'outlined') {
|
|
422
|
-
// eslint-disable-next-line react/no-find-dom-node
|
|
423
|
-
this.labelNode = _reactDom["default"].findDOMNode(this.labelRef.current);
|
|
424
|
-
this.forceUpdate();
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}, {
|
|
428
|
-
key: "componentWillUnmount",
|
|
429
|
-
value: function componentWillUnmount() {
|
|
430
|
-
clearTimeout(this.inputBlurTimeout);
|
|
431
|
-
}
|
|
432
|
-
}, {
|
|
433
|
-
key: "handleAddChip",
|
|
434
|
-
value:
|
|
435
|
-
/**
|
|
436
|
-
* Handles adding a chip.
|
|
437
|
-
* @param {string|object} chip Value of the chip, either a string or an object (if dataSourceConfig is set)
|
|
438
|
-
* @param {object=} options Additional options
|
|
439
|
-
* @param {boolean=} options.clearInputOnFail If `true`, and `onBeforeAdd` returns `false`, clear the input
|
|
440
|
-
* @returns True if the chip was added (or at least `onAdd` was called), false if adding the chip was prevented
|
|
441
|
-
*/
|
|
442
|
-
function handleAddChip(chip, options) {
|
|
443
|
-
var _this2 = this;
|
|
444
|
-
if (this.props.onBeforeAdd && !this.props.onBeforeAdd(chip)) {
|
|
445
|
-
this._preventChipCreation = true;
|
|
446
|
-
if (options && options.clearInputOnFail) {
|
|
447
|
-
this.clearInput();
|
|
448
|
-
}
|
|
449
|
-
return false;
|
|
450
|
-
}
|
|
451
|
-
this.clearInput();
|
|
452
|
-
var chips = this.props.value || this.state.chips;
|
|
453
|
-
if (this.props.dataSourceConfig) {
|
|
454
|
-
if (typeof chip === 'string') {
|
|
455
|
-
chip = (0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, this.props.dataSourceConfig.text, chip), this.props.dataSourceConfig.value, chip);
|
|
456
|
-
}
|
|
457
|
-
if (this.props.allowDuplicates || !chips.some(function (c) {
|
|
458
|
-
return c[_this2.props.dataSourceConfig.value] === chip[_this2.props.dataSourceConfig.value];
|
|
459
|
-
})) {
|
|
460
|
-
if (this.props.value && this.props.onAdd) {
|
|
461
|
-
this.props.onAdd(chip);
|
|
462
|
-
} else {
|
|
463
|
-
this.updateChips([].concat((0, _toConsumableArray2["default"])(this.state.chips), [chip]));
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
return true;
|
|
467
|
-
}
|
|
468
|
-
if (chip.trim().length > 0) {
|
|
469
|
-
if (this.props.allowDuplicates || !chips.includes(chip)) {
|
|
470
|
-
if (this.props.value && this.props.onAdd) {
|
|
471
|
-
this.props.onAdd(chip);
|
|
472
|
-
} else {
|
|
473
|
-
this.updateChips([].concat((0, _toConsumableArray2["default"])(this.state.chips), [chip]));
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
return true;
|
|
477
|
-
}
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
}, {
|
|
481
|
-
key: "handleDeleteChip",
|
|
482
|
-
value: function handleDeleteChip(chip, i) {
|
|
483
|
-
if (!this.props.value) {
|
|
484
|
-
var chips = this.state.chips.slice();
|
|
485
|
-
var changed = chips.splice(i, 1); // remove the chip at index i
|
|
486
|
-
if (changed) {
|
|
487
|
-
var focusedChip = this.state.focusedChip;
|
|
488
|
-
if (this.state.focusedChip === i) {
|
|
489
|
-
focusedChip = null;
|
|
490
|
-
} else if (this.state.focusedChip > i) {
|
|
491
|
-
focusedChip = this.state.focusedChip - 1;
|
|
492
|
-
}
|
|
493
|
-
this.updateChips(chips, {
|
|
494
|
-
focusedChip: focusedChip
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
} else if (this.props.onDelete) {
|
|
498
|
-
this.props.onDelete(chip, i);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
}, {
|
|
502
|
-
key: "updateChips",
|
|
503
|
-
value: function updateChips(chips) {
|
|
504
|
-
var additionalUpdates = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
505
|
-
this.setState(_objectSpread({
|
|
506
|
-
chips: chips,
|
|
507
|
-
chipsUpdated: true
|
|
508
|
-
}, additionalUpdates));
|
|
509
|
-
if (this.props.onChange) {
|
|
510
|
-
this.props.onChange(chips);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* Clears the text field for adding new chips.
|
|
516
|
-
* This only works in uncontrolled input mode, i.e. if the inputValue prop is not used.
|
|
517
|
-
* @public
|
|
518
|
-
*/
|
|
519
|
-
}, {
|
|
520
|
-
key: "clearInput",
|
|
521
|
-
value: function clearInput() {
|
|
522
|
-
this.updateInput('');
|
|
523
|
-
}
|
|
524
|
-
}, {
|
|
525
|
-
key: "updateInput",
|
|
526
|
-
value: function updateInput(value) {
|
|
527
|
-
this.setState({
|
|
528
|
-
inputValue: value
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
}, {
|
|
532
|
-
key: "render",
|
|
533
|
-
value: function render() {
|
|
534
|
-
var _this3 = this;
|
|
535
|
-
var _this$props = this.props,
|
|
536
|
-
alwaysShowPlaceholder = _this$props.alwaysShowPlaceholder,
|
|
537
|
-
_this$props$chipRende = _this$props.chipRenderer,
|
|
538
|
-
chipRenderer = _this$props$chipRende === void 0 ? defaultChipRenderer : _this$props$chipRende,
|
|
539
|
-
classes = _this$props.classes,
|
|
540
|
-
className = _this$props.className,
|
|
541
|
-
dataSourceConfig = _this$props.dataSourceConfig,
|
|
542
|
-
disabled = _this$props.disabled,
|
|
543
|
-
disableUnderline = _this$props.disableUnderline,
|
|
544
|
-
error = _this$props.error,
|
|
545
|
-
FormHelperTextProps = _this$props.FormHelperTextProps,
|
|
546
|
-
fullWidth = _this$props.fullWidth,
|
|
547
|
-
fullWidthInput = _this$props.fullWidthInput,
|
|
548
|
-
helperText = _this$props.helperText,
|
|
549
|
-
id = _this$props.id,
|
|
550
|
-
_this$props$InputProp = _this$props.InputProps,
|
|
551
|
-
InputProps = _this$props$InputProp === void 0 ? {} : _this$props$InputProp,
|
|
552
|
-
_this$props$InputLabe = _this$props.InputLabelProps,
|
|
553
|
-
InputLabelProps = _this$props$InputLabe === void 0 ? {} : _this$props$InputLabe,
|
|
554
|
-
inputValue = _this$props.inputValue,
|
|
555
|
-
label = _this$props.label,
|
|
556
|
-
placeholder = _this$props.placeholder,
|
|
557
|
-
readOnly = _this$props.readOnly,
|
|
558
|
-
required = _this$props.required,
|
|
559
|
-
rootRef = _this$props.rootRef,
|
|
560
|
-
value = _this$props.value,
|
|
561
|
-
variant = _this$props.variant,
|
|
562
|
-
other = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
|
|
563
|
-
var chips = value || this.state.chips || [];
|
|
564
|
-
if (!Array.isArray(chips)) {
|
|
565
|
-
chips = (chips || '').toString().split(/[,\s]+/).map(function (c) {
|
|
566
|
-
return c.trim();
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
var actualInputValue = inputValue !== null && inputValue !== void 0 ? inputValue : this.state.inputValue;
|
|
570
|
-
var hasInput = (this.props.value || actualInputValue).length || actualInputValue.length;
|
|
571
|
-
var shrinkFloatingLabel = typeof InputLabelProps.shrink === 'boolean' ? InputLabelProps.shrink : label !== null && (hasInput || this.state.isFocused || chips.length);
|
|
572
|
-
var chipComponents = chips.map(function (chip, i) {
|
|
573
|
-
var value_ = dataSourceConfig ? chip[dataSourceConfig.value] : chip;
|
|
574
|
-
return chipRenderer({
|
|
575
|
-
value: value_,
|
|
576
|
-
text: dataSourceConfig ? chip[dataSourceConfig.text] : chip,
|
|
577
|
-
chip: chip,
|
|
578
|
-
isDisabled: !!disabled,
|
|
579
|
-
isReadOnly: readOnly,
|
|
580
|
-
isFocused: _this3.state.focusedChip === i,
|
|
581
|
-
handleClick: function handleClick() {
|
|
582
|
-
return _this3.setState({
|
|
583
|
-
focusedChip: i
|
|
584
|
-
});
|
|
585
|
-
},
|
|
586
|
-
handleDelete: function handleDelete() {
|
|
587
|
-
return _this3.handleDeleteChip(chip, i);
|
|
588
|
-
},
|
|
589
|
-
className: classes.chip
|
|
590
|
-
}, i);
|
|
591
|
-
});
|
|
592
|
-
var InputMore = {};
|
|
593
|
-
if (variant === 'outlined') {
|
|
594
|
-
InputMore.notched = shrinkFloatingLabel;
|
|
595
|
-
InputMore.labelWidth = shrinkFloatingLabel && this.labelNode && this.labelNode.offsetWidth || 0;
|
|
596
|
-
}
|
|
597
|
-
if (variant !== 'standard') {
|
|
598
|
-
InputMore.startAdornment = chipComponents;
|
|
599
|
-
} else {
|
|
600
|
-
InputProps.disableUnderline = true;
|
|
601
|
-
}
|
|
602
|
-
var InputComponent = variantComponent[variant];
|
|
603
|
-
return /*#__PURE__*/_react["default"].createElement(_material.FormControl, (0, _extends2["default"])({
|
|
604
|
-
ref: rootRef,
|
|
605
|
-
fullWidth: fullWidth,
|
|
606
|
-
className: _Utils["default"].clsx(className, classes.root, other.margin === 'dense' && classes.marginDense),
|
|
607
|
-
error: error,
|
|
608
|
-
required: chips.length > 0 ? undefined : required,
|
|
609
|
-
onClick: this.focus,
|
|
610
|
-
disabled: disabled,
|
|
611
|
-
variant: variant
|
|
612
|
-
}, other), label && /*#__PURE__*/_react["default"].createElement(_material.InputLabel, (0, _extends2["default"])({
|
|
613
|
-
htmlFor: id,
|
|
614
|
-
classes: {
|
|
615
|
-
root: _Utils["default"].clsx(classes[variant], classes.label),
|
|
616
|
-
shrink: classes.labelShrink
|
|
617
|
-
},
|
|
618
|
-
shrink: shrinkFloatingLabel,
|
|
619
|
-
focused: this.state.isFocused,
|
|
620
|
-
variant: variant,
|
|
621
|
-
ref: this.labelRef,
|
|
622
|
-
required: required
|
|
623
|
-
}, InputLabelProps), label), /*#__PURE__*/_react["default"].createElement("div", {
|
|
624
|
-
className: _Utils["default"].clsx(classes[variant], classes.chipContainer, this.state.isFocused && classes.focused, !disableUnderline && variant === 'standard' && classes.underline, disabled && classes.disabled, label && classes.labeled, error && classes.error)
|
|
625
|
-
}, variant === 'standard' && chipComponents, /*#__PURE__*/_react["default"].createElement(InputComponent, (0, _extends2["default"])({
|
|
626
|
-
ref: this.input,
|
|
627
|
-
classes: {
|
|
628
|
-
input: _Utils["default"].clsx(classes.input, classes[variant]),
|
|
629
|
-
root: _Utils["default"].clsx(classes.inputRoot, classes[variant])
|
|
630
|
-
},
|
|
631
|
-
id: id,
|
|
632
|
-
value: actualInputValue,
|
|
633
|
-
onChange: this.handleUpdateInput,
|
|
634
|
-
onKeyDown: this.handleKeyDown,
|
|
635
|
-
onKeyPress: this.handleKeyPress,
|
|
636
|
-
onKeyUp: this.handleKeyUp,
|
|
637
|
-
onFocus: this.handleInputFocus,
|
|
638
|
-
onBlur: this.handleInputBlur,
|
|
639
|
-
inputRef: this.setActualInputRef,
|
|
640
|
-
disabled: disabled,
|
|
641
|
-
fullWidth: fullWidthInput,
|
|
642
|
-
placeholder: !hasInput && (shrinkFloatingLabel || label === null || label === undefined) || alwaysShowPlaceholder ? placeholder : null,
|
|
643
|
-
readOnly: readOnly
|
|
644
|
-
}, InputProps, InputMore))), helperText && /*#__PURE__*/_react["default"].createElement(_material.FormHelperText, (0, _extends2["default"])({}, FormHelperTextProps, {
|
|
645
|
-
className: FormHelperTextProps ? _Utils["default"].clsx(FormHelperTextProps.className, classes.helperText) : classes.helperText
|
|
646
|
-
}), helperText));
|
|
647
|
-
}
|
|
648
|
-
}], [{
|
|
649
|
-
key: "getDerivedStateFromProps",
|
|
650
|
-
value: function getDerivedStateFromProps(props, state) {
|
|
651
|
-
var newState = null;
|
|
652
|
-
if (props.value && props.value.length !== state.prevPropsValue.length) {
|
|
653
|
-
newState = {
|
|
654
|
-
prevPropsValue: props.value
|
|
655
|
-
};
|
|
656
|
-
if (props.clearInputValueOnChange) {
|
|
657
|
-
newState.inputValue = '';
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
// if change detection is only needed for clearInputValueOnChange
|
|
662
|
-
if (props.clearInputValueOnChange && props.value && props.value.length !== state.prevPropsValue.length) {
|
|
663
|
-
newState = {
|
|
664
|
-
prevPropsValue: props.value,
|
|
665
|
-
inputValue: ''
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
if (props.disabled) {
|
|
669
|
-
newState = _objectSpread(_objectSpread({}, newState), {}, {
|
|
670
|
-
focusedChip: null
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
if (!state.chipsUpdated && props.defaultValue) {
|
|
674
|
-
newState = _objectSpread(_objectSpread({}, newState), {}, {
|
|
675
|
-
chips: props.defaultValue
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
return newState;
|
|
679
|
-
}
|
|
680
|
-
}]);
|
|
681
|
-
return ChipInput;
|
|
682
|
-
}(_react["default"].Component);
|
|
683
|
-
ChipInput.propTypes = {
|
|
684
|
-
/** Allows duplicate chips if set to true. */
|
|
685
|
-
allowDuplicates: _propTypes["default"].bool,
|
|
686
|
-
/** If true, the placeholder will always be visible. */
|
|
687
|
-
alwaysShowPlaceholder: _propTypes["default"].bool,
|
|
688
|
-
/** Behavior when the chip input is blurred: `'clear'` clears the input, `'add'` creates a chip and `'ignore'` keeps the input. */
|
|
689
|
-
blurBehavior: _propTypes["default"].oneOf(['clear', 'add', 'add-or-clear', 'ignore']),
|
|
690
|
-
/** 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. */
|
|
691
|
-
chipRenderer: _propTypes["default"].func,
|
|
692
|
-
/** Whether the input value should be cleared if the `value` prop is changed. */
|
|
693
|
-
clearInputValueOnChange: _propTypes["default"].bool,
|
|
694
|
-
/** Data source for auto complete. This should be an array of strings or objects. */
|
|
695
|
-
dataSource: _propTypes["default"].array,
|
|
696
|
-
/** 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. */
|
|
697
|
-
dataSourceConfig: _propTypes["default"].shape({
|
|
698
|
-
text: _propTypes["default"].string.isRequired,
|
|
699
|
-
value: _propTypes["default"].string.isRequired
|
|
700
|
-
}),
|
|
701
|
-
/** The chips to display by default (for uncontrolled mode). */
|
|
702
|
-
defaultValue: _propTypes["default"].array,
|
|
703
|
-
/** Whether to use `setTimeout` to delay adding chips in case other input events like `onSelection` need to fire first */
|
|
704
|
-
delayBeforeAdd: _propTypes["default"].bool,
|
|
705
|
-
/** Disables the chip input if set to true. */
|
|
706
|
-
disabled: _propTypes["default"].bool,
|
|
707
|
-
/** Disable the input underline. Only valid for 'standard' variant */
|
|
708
|
-
disableUnderline: _propTypes["default"].bool,
|
|
709
|
-
/** Props to pass through to the `FormHelperText` component. */
|
|
710
|
-
FormHelperTextProps: _propTypes["default"].object,
|
|
711
|
-
/** If true, the chip input will fill the available width. */
|
|
712
|
-
fullWidth: _propTypes["default"].bool,
|
|
713
|
-
/** 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. */
|
|
714
|
-
fullWidthInput: _propTypes["default"].bool,
|
|
715
|
-
/** Helper text that is displayed below the input. */
|
|
716
|
-
helperText: _propTypes["default"].node,
|
|
717
|
-
/** Props to pass through to the `InputLabel`. */
|
|
718
|
-
InputLabelProps: _propTypes["default"].object,
|
|
719
|
-
/** Props to pass through to the `Input`. */
|
|
720
|
-
InputProps: _propTypes["default"].object,
|
|
721
|
-
/** Use this property to pass a ref callback to the native input component. */
|
|
722
|
-
inputRef: _propTypes["default"].func,
|
|
723
|
-
/** The input value (enables controlled mode for the text input if set). */
|
|
724
|
-
inputValue: _propTypes["default"].string,
|
|
725
|
-
/* The content of the floating label. */
|
|
726
|
-
label: _propTypes["default"].node,
|
|
727
|
-
/** The key codes (`KeyboardEvent.keyCode`) used to determine when to create a new chip. */
|
|
728
|
-
newChipKeyCodes: _propTypes["default"].arrayOf(_propTypes["default"].number),
|
|
729
|
-
/** The keys (`KeyboardEvent.key`) used to determine when to create a new chip. */
|
|
730
|
-
newChipKeys: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
731
|
-
/** Callback function that is called when a new chip was added (in controlled mode). */
|
|
732
|
-
onAdd: _propTypes["default"].func,
|
|
733
|
-
/** 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. */
|
|
734
|
-
onBeforeAdd: _propTypes["default"].func,
|
|
735
|
-
/** Callback function that is called when the chips change (in uncontrolled mode). */
|
|
736
|
-
onChange: _propTypes["default"].func,
|
|
737
|
-
/** Callback function that is called when a new chip was removed (in controlled mode). */
|
|
738
|
-
onDelete: _propTypes["default"].func,
|
|
739
|
-
/** Callback function that is called when the input changes. */
|
|
740
|
-
onUpdateInput: _propTypes["default"].func,
|
|
741
|
-
/** A placeholder that is displayed if the input has no values. */
|
|
742
|
-
placeholder: _propTypes["default"].string,
|
|
743
|
-
/** Makes the chip input read-only if set to true. */
|
|
744
|
-
readOnly: _propTypes["default"].bool,
|
|
745
|
-
/** The chips to display (enables controlled mode if set). */
|
|
746
|
-
value: _propTypes["default"].array,
|
|
747
|
-
/** The variant of the Input component */
|
|
748
|
-
variant: _propTypes["default"].oneOf(['outlined', 'standard', 'filled'])
|
|
749
|
-
};
|
|
750
|
-
ChipInput.defaultProps = {
|
|
751
|
-
allowDuplicates: false,
|
|
752
|
-
blurBehavior: 'clear',
|
|
753
|
-
clearInputValueOnChange: false,
|
|
754
|
-
delayBeforeAdd: false,
|
|
755
|
-
disableUnderline: false,
|
|
756
|
-
newChipKeyCodes: [13],
|
|
757
|
-
newChipKeys: ['Enter'],
|
|
758
|
-
variant: 'standard'
|
|
759
|
-
};
|
|
760
|
-
var _default = exports["default"] = (0, _styles.withStyles)(styles, {
|
|
761
|
-
name: 'WAMuiChipInput'
|
|
762
|
-
})(ChipInput);
|
|
763
|
-
//# sourceMappingURL=ChipInput.js.map
|