linear-react-components-ui 0.4.77-beta.27 → 0.4.77-beta.28
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/.eslintrc.json +3 -76
- package/.husky/pre-commit +4 -0
- package/.vscode/settings.json +2 -2
- package/jest.config.js +3 -3
- package/lib/alerts/AlertContainer.js +19 -14
- package/lib/alerts/AlertProvider.js +9 -4
- package/lib/alerts/BaseAlert.js +8 -5
- package/lib/alerts/Message.js +40 -31
- package/lib/alerts/alert.spec.js +133 -0
- package/lib/alerts/helpers.js +5 -2
- package/lib/alerts/withAlert.js +2 -2
- package/lib/assets/styles/commons.scss +10 -0
- package/lib/assets/styles/dropdown.scss +36 -2
- package/lib/assets/styles/effects.scss +11 -0
- package/lib/assets/styles/list.scss +8 -0
- package/lib/assets/styles/table.scss +2 -7
- package/lib/avatar/avatar.spec.js +190 -0
- package/lib/avatar/index.js +58 -13
- package/lib/badge/badge.spec.js +127 -0
- package/lib/badge/index.js +22 -6
- package/lib/buttons/ActivateButton.js +3 -3
- package/lib/buttons/AddButton.js +1 -1
- package/lib/buttons/Button.js +11 -19
- package/lib/buttons/ButtonGroups.js +5 -0
- package/lib/buttons/CancelButton.js +3 -16
- package/lib/buttons/DangerButton.js +19 -14
- package/lib/buttons/DefaultButton.js +127 -65
- package/lib/buttons/DestroyButton.js +3 -12
- package/lib/buttons/EditButton.js +3 -3
- package/lib/buttons/InactivateButton.js +3 -3
- package/lib/buttons/InfoButton.js +19 -14
- package/lib/buttons/PrimaryButton.js +19 -14
- package/lib/buttons/RestoreButton.js +3 -3
- package/lib/buttons/SaveButton.js +2 -15
- package/lib/buttons/SpinnerLoading.js +230 -0
- package/lib/buttons/SuccessButton.js +18 -13
- package/lib/buttons/WarningButton.js +18 -13
- package/lib/buttons/button_container/index.js +18 -5
- package/lib/buttons/buttons.spec.js +504 -0
- package/lib/buttons/index.js +28 -28
- package/lib/buttons/split_button/index.js +30 -13
- package/lib/calendar/DangerCalendar.js +2 -11
- package/lib/calendar/InfoCalendar.js +2 -11
- package/lib/calendar/PrimaryCalendar.js +2 -11
- package/lib/calendar/SuccessCalendar.js +2 -11
- package/lib/calendar/WarningCalendar.js +2 -11
- package/lib/calendar/base/Day.js +8 -2
- package/lib/calendar/base/Month.js +5 -0
- package/lib/calendar/base/Week.js +6 -0
- package/lib/calendar/base/helpers.js +9 -9
- package/lib/calendar/base/index.js +36 -33
- package/lib/calendar/calendar.spec.js +171 -0
- package/lib/calendar/index.js +10 -10
- package/lib/checkbox/Label.js +12 -2
- package/lib/checkbox/checkbox.spec.js +215 -0
- package/lib/checkbox/index.js +79 -42
- package/lib/dialog/Alert.js +8 -3
- package/lib/dialog/Custom.js +25 -17
- package/lib/dialog/Error.js +6 -1
- package/lib/dialog/Information.js +6 -1
- package/lib/dialog/Question.js +17 -6
- package/lib/dialog/Warning.js +6 -1
- package/lib/dialog/base/Content.js +9 -0
- package/lib/dialog/base/Footer.js +8 -2
- package/lib/dialog/base/Header.js +22 -8
- package/lib/dialog/base/index.js +28 -6
- package/lib/dialog/dialog.spec.js +488 -0
- package/lib/dialog/form/index.js +32 -22
- package/lib/dialog/index.js +6 -6
- package/lib/drawer/Content.js +10 -1
- package/lib/drawer/Drawer.js +50 -29
- package/lib/drawer/Drawer.spec.js +258 -0
- package/lib/drawer/Header.js +31 -12
- package/lib/drawer/helpers.js +1 -1
- package/lib/drawer/index.js +4 -4
- package/lib/dropdown/Popup.js +16 -32
- package/lib/dropdown/dropdown.spec.js +169 -0
- package/lib/dropdown/helper.js +2 -2
- package/lib/dropdown/withDropdown.js +43 -18
- package/lib/fieldset/fieldset.spec.js +329 -0
- package/lib/fieldset/index.js +43 -12
- package/lib/form/Field.js +41 -14
- package/lib/form/FieldArray.js +50 -20
- package/lib/form/FieldNumber.js +44 -12
- package/lib/form/FieldPeriod.js +41 -19
- package/lib/form/form.spec.js +293 -0
- package/lib/form/helpers.js +16 -10
- package/lib/form/index.js +92 -57
- package/lib/form/withFieldHOC.js +120 -40
- package/lib/form/withFormSecurity.js +38 -17
- package/lib/gridlayout/GridCol.js +18 -3
- package/lib/gridlayout/GridRow.js +24 -4
- package/lib/gridlayout/gridLayout.spec.js +169 -0
- package/lib/icons/helper.js +571 -560
- package/lib/icons/icons.spec.js +86 -0
- package/lib/icons/index.js +40 -23
- package/lib/index.js +12 -12
- package/lib/inputs/base/InputTextBase.js +149 -40
- package/lib/inputs/base/base.spec.js +690 -0
- package/lib/inputs/base/helpers.js +4 -4
- package/lib/inputs/base/index.js +1 -0
- package/lib/inputs/color/color_input.spec.js +174 -0
- package/lib/inputs/color/index.js +29 -31
- package/lib/inputs/date/Dialog.js +8 -1
- package/lib/inputs/date/Dropdown.js +70 -18
- package/lib/inputs/date/date.spec.js +354 -0
- package/lib/inputs/date/helpers.js +1 -1
- package/lib/inputs/date/index.js +411 -255
- package/lib/inputs/inputHOC.js +96 -44
- package/lib/inputs/mask/BaseMask.js +45 -16
- package/lib/inputs/mask/Cnpj.js +19 -12
- package/lib/inputs/mask/Cpf.js +22 -14
- package/lib/inputs/mask/Phone.js +9 -1
- package/lib/inputs/mask/ZipCode.js +1 -1
- package/lib/inputs/mask/helpers.js +36 -21
- package/lib/inputs/mask/imaskHOC.js +255 -186
- package/lib/inputs/mask/index.js +4 -4
- package/lib/inputs/mask/input_mask.spec.js +607 -0
- package/lib/inputs/multiSelect/ActionButtons.js +14 -2
- package/lib/inputs/multiSelect/Dropdown.js +70 -43
- package/lib/inputs/multiSelect/index.js +80 -60
- package/lib/inputs/number/BaseNumber.js +62 -27
- package/lib/inputs/number/Currency.js +14 -4
- package/lib/inputs/number/format_number.js +1 -1
- package/lib/inputs/number/index.js +15 -9
- package/lib/inputs/number/numberfield.spec.js +215 -0
- package/lib/inputs/period/Dialog.js +8 -1
- package/lib/inputs/period/Dropdown.js +70 -16
- package/lib/inputs/period/PeriodList.js +19 -6
- package/lib/inputs/period/helper.js +71 -30
- package/lib/inputs/period/index.js +160 -112
- package/lib/inputs/search/index.js +261 -129
- package/lib/inputs/search/search_input.spec.js +209 -0
- package/lib/inputs/select/ActionButtons.js +20 -14
- package/lib/inputs/select/Dropdown.js +63 -30
- package/lib/inputs/select/helper.js +16 -18
- package/lib/inputs/select/index.js +13 -14
- package/lib/inputs/select/multiple/Selecteds.js +13 -5
- package/lib/inputs/select/multiple/index.js +414 -289
- package/lib/inputs/select/select.spec.js +395 -0
- package/lib/inputs/select/simple/index.js +461 -322
- package/lib/inputs/text/index.js +0 -1
- package/lib/inputs/text/textfield.spec.js +215 -0
- package/lib/inputs/textarea/index.js +15 -5
- package/lib/inputs/textarea/textarea.spec.js +59 -0
- package/lib/internals/constants.js +1 -1
- package/lib/internals/withTooltip.js +34 -26
- package/lib/labelMessages/index.js +45 -27
- package/lib/labelMessages/labelMessages.spec.js +176 -0
- package/lib/labels/DangerLabel.js +4 -13
- package/lib/labels/DefaultLabel.js +57 -25
- package/lib/labels/InfoLabel.js +4 -13
- package/lib/labels/PrimaryLabel.js +4 -13
- package/lib/labels/SuccessLabel.js +4 -13
- package/lib/labels/WarningLabel.js +4 -13
- package/lib/labels/index.js +10 -10
- package/lib/labels/label.spec.js +162 -0
- package/lib/labels/label_container/index.js +12 -2
- package/lib/list/Header.js +13 -0
- package/lib/list/Item.js +65 -27
- package/lib/list/helpers.js +2 -2
- package/lib/list/index.js +51 -31
- package/lib/list/list.spec.js +769 -0
- package/lib/menus/float/MenuItem.js +42 -10
- package/lib/menus/float/SubMenuContainer.js +95 -0
- package/lib/menus/float/float-menu.spec.js +221 -0
- package/lib/menus/float/helpers.js +1 -1
- package/lib/menus/float/index.js +39 -9
- package/lib/menus/sidenav/ExpandMenu.js +13 -1
- package/lib/menus/sidenav/MenuLink.js +14 -0
- package/lib/menus/sidenav/NavMenuGroup.js +12 -1
- package/lib/menus/sidenav/NavMenuItem.js +45 -19
- package/lib/menus/sidenav/NavSubMenuItem.js +15 -4
- package/lib/menus/sidenav/helpers.js +3 -3
- package/lib/menus/sidenav/index.js +60 -30
- package/lib/menus/sidenav/popup_menu_search/EmptyList.js +11 -2
- package/lib/menus/sidenav/popup_menu_search/index.js +11 -14
- package/lib/menus/sidenav/sidenav.spec.js +379 -0
- package/lib/panel/Content.js +18 -6
- package/lib/panel/DangerPanel.js +1 -1
- package/lib/panel/Default.js +45 -18
- package/lib/panel/Header.js +29 -7
- package/lib/panel/InfoPanel.js +1 -1
- package/lib/panel/PrimaryPanel.js +1 -1
- package/lib/panel/SuccessPanel.js +1 -1
- package/lib/panel/ToolBar.js +5 -0
- package/lib/panel/WarningPanel.js +1 -1
- package/lib/panel/helpers.js +3 -7
- package/lib/panel/index.js +14 -14
- package/lib/panel/panel.spec.js +216 -0
- package/lib/permissionValidations.js +12 -14
- package/lib/popover/PopoverText.js +5 -0
- package/lib/popover/PopoverTitle.js +5 -0
- package/lib/popover/index.js +40 -26
- package/lib/popover/popover.spec.js +146 -0
- package/lib/progress/Bar.js +47 -37
- package/lib/progress/index.js +18 -8
- package/lib/progress/progress.spec.js +94 -0
- package/lib/radio/index.js +46 -22
- package/lib/radio/radio.spec.js +189 -0
- package/lib/skeleton/SkeletonContainer.js +13 -0
- package/lib/skeleton/index.js +26 -7
- package/lib/spinner/SpinnerLoading.js +12 -4
- package/lib/spinner/index.js +29 -24
- package/lib/spinner/spinner.spec.js +152 -0
- package/lib/split/Split.js +62 -45
- package/lib/split/SplitSide.js +21 -1
- package/lib/split/helpers.js +1 -1
- package/lib/split/split.spec.js +163 -0
- package/lib/table/Body.js +16 -9
- package/lib/table/Header.js +19 -40
- package/lib/table/HeaderColumn.js +20 -6
- package/lib/table/Row.js +28 -7
- package/lib/table/RowColumn.js +30 -12
- package/lib/table/helpers.js +3 -3
- package/lib/table/index.js +53 -15
- package/lib/table/table.spec.js +352 -0
- package/lib/tabs/DropdownItems.js +53 -39
- package/lib/tabs/Menu.js +20 -16
- package/lib/tabs/MenuItems.js +39 -25
- package/lib/tabs/Panel.js +51 -18
- package/lib/tabs/index.js +75 -81
- package/lib/tabs/tabHelpers.js +8 -10
- package/lib/tabs/tabs.spec.js +321 -0
- package/lib/toolbar/ButtonBar.js +13 -32
- package/lib/toolbar/LabelBar.js +18 -31
- package/lib/toolbar/ToolBarGroup.js +12 -6
- package/lib/toolbar/helpers.js +1 -1
- package/lib/toolbar/index.js +33 -25
- package/lib/toolbar/toolbar.spec.js +394 -0
- package/lib/tooltip/index.js +34 -25
- package/lib/tooltip/tooltip.spec.js +215 -0
- package/lib/treeview/Header.js +12 -0
- package/lib/treeview/Node.js +387 -261
- package/lib/treeview/constants.js +2 -1
- package/lib/treeview/index.js +548 -363
- package/lib/treeview/treeview.spec.js +279 -0
- package/lib/treeview_old/Node.js +6 -6
- package/lib/uitour/helpers.js +1 -1
- package/lib/uitour/index.js +32 -15
- package/lib/uitour/uitour.spec.js +176 -0
- package/package.json +16 -40
- package/.husky/pre-push +0 -4
- package/babel.config.json +0 -11
- package/tsconfig.json +0 -32
- package/tsup.config.ts +0 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -9,6 +9,8 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
12
14
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
13
15
|
|
|
14
16
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
@@ -31,324 +33,447 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
31
33
|
|
|
32
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
35
|
|
|
34
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
35
|
-
|
|
36
36
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
37
37
|
|
|
38
38
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
39
39
|
|
|
40
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
41
|
+
|
|
40
42
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
41
43
|
|
|
42
44
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
43
45
|
|
|
44
|
-
function
|
|
46
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
45
47
|
|
|
46
|
-
function
|
|
48
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
47
49
|
|
|
48
|
-
function
|
|
50
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
49
51
|
|
|
50
|
-
function
|
|
52
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
53
|
+
|
|
54
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
55
|
+
|
|
56
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
57
|
+
|
|
58
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
59
|
+
|
|
60
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
61
|
+
|
|
62
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
63
|
+
|
|
64
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
65
|
+
|
|
66
|
+
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; } }
|
|
67
|
+
|
|
68
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
69
|
+
|
|
70
|
+
var MultipleSelect = /*#__PURE__*/function (_Component) {
|
|
71
|
+
_inherits(MultipleSelect, _Component);
|
|
72
|
+
|
|
73
|
+
var _super = _createSuper(MultipleSelect);
|
|
51
74
|
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var _useState13 = (0, _react.useState)(false),
|
|
98
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
99
|
-
insideComponent = _useState14[0],
|
|
100
|
-
setInsideComponent = _useState14[1];
|
|
101
|
-
|
|
102
|
-
var _useState15 = (0, _react.useState)(),
|
|
103
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
104
|
-
onDenied = _useState16[0],
|
|
105
|
-
setOnDeniedSelect = _useState16[1];
|
|
106
|
-
|
|
107
|
-
var _useState17 = (0, _react.useState)([]),
|
|
108
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
109
|
-
valueFromProps = _useState18[0],
|
|
110
|
-
setValueFromProps = _useState18[1];
|
|
111
|
-
|
|
112
|
-
var componentId = "select-component".concat(_uuid.default.v1());
|
|
113
|
-
var componentRef = (0, _react.useRef)(null);
|
|
114
|
-
var dropdownRef = (0, _react.useRef)(null);
|
|
115
|
-
var selectWrapper = (0, _react.useRef)();
|
|
116
|
-
var gridElRef = (0, _react.useRef)();
|
|
117
|
-
|
|
118
|
-
var onScreenResize = function onScreenResize() {
|
|
119
|
-
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
var onClickOutside = function onClickOutside(event) {
|
|
123
|
-
var target = event.target;
|
|
124
|
-
|
|
125
|
-
if (target !== selectWrapper.current && selectWrapper.current && !selectWrapper.current.contains(target) && dropdownRef.current && !dropdownRef.current.contains(target)) {
|
|
126
|
-
setOpened(false);
|
|
75
|
+
function MultipleSelect(props) {
|
|
76
|
+
var _this;
|
|
77
|
+
|
|
78
|
+
_classCallCheck(this, MultipleSelect);
|
|
79
|
+
|
|
80
|
+
_this = _super.call(this, props);
|
|
81
|
+
|
|
82
|
+
_initialiseProps.call(_assertThisInitialized(_this));
|
|
83
|
+
|
|
84
|
+
_this.componentId = "select-component".concat(_uuid.default.v1());
|
|
85
|
+
_this.componentRef = /*#__PURE__*/_react.default.createRef();
|
|
86
|
+
_this.dropdownRef = /*#__PURE__*/_react.default.createRef();
|
|
87
|
+
_this.state = {
|
|
88
|
+
valueFromProps: null,
|
|
89
|
+
dataCombo: props.dataSource,
|
|
90
|
+
currents: [],
|
|
91
|
+
selected: null,
|
|
92
|
+
inputValue: '',
|
|
93
|
+
opened: false,
|
|
94
|
+
dropdownWidth: 0,
|
|
95
|
+
insideComponent: false,
|
|
96
|
+
onDenied: undefined
|
|
97
|
+
};
|
|
98
|
+
_this.onFocus = _this.onFocus.bind(_assertThisInitialized(_this));
|
|
99
|
+
_this.onBlur = _this.onBlur.bind(_assertThisInitialized(_this));
|
|
100
|
+
_this.onOpenClose = _this.onOpenClose.bind(_assertThisInitialized(_this));
|
|
101
|
+
_this.onMouseMove = _this.onMouseMove.bind(_assertThisInitialized(_this));
|
|
102
|
+
_this.onInputKeyDown = _this.onInputKeyDown.bind(_assertThisInitialized(_this));
|
|
103
|
+
_this.onScreenResize = _this.onScreenResize.bind(_assertThisInitialized(_this));
|
|
104
|
+
_this.onFilter = _this.onFilter.bind(_assertThisInitialized(_this));
|
|
105
|
+
_this.onSelect = _this.onSelect.bind(_assertThisInitialized(_this));
|
|
106
|
+
_this.onUnselect = _this.onUnselect.bind(_assertThisInitialized(_this));
|
|
107
|
+
_this.onClickOutside = _this.onClickOutside.bind(_assertThisInitialized(_this));
|
|
108
|
+
_this.onClearClick = _this.onClearClick.bind(_assertThisInitialized(_this));
|
|
109
|
+
return _this;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
_createClass(MultipleSelect, [{
|
|
113
|
+
key: "componentDidMount",
|
|
114
|
+
value: function componentDidMount() {
|
|
115
|
+
var handlerClear = this.props.handlerClear;
|
|
116
|
+
window.addEventListener('resize', this.onScreenResize);
|
|
117
|
+
document.addEventListener('click', this.onClickOutside);
|
|
118
|
+
document.addEventListener('mousemove', this.onMouseMove);
|
|
119
|
+
if (handlerClear) handlerClear(this.onClearClick);
|
|
127
120
|
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
121
|
+
}, {
|
|
122
|
+
key: "componentDidUpdate",
|
|
123
|
+
value: function componentDidUpdate() {
|
|
124
|
+
if (this.props.gridLayout) {
|
|
125
|
+
var gridEl = document.querySelector("#".concat(this.componentId, ">.-withinput.grid-container"));
|
|
126
|
+
if (this.gridEl !== gridEl) this.gridEl = gridEl;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "componentWillUnmount",
|
|
131
|
+
value: function componentWillUnmount() {
|
|
132
|
+
window.removeEventListener('resize', this.onScreenResize);
|
|
133
|
+
document.removeEventListener('click', this.onClickOutside);
|
|
134
|
+
document.removeEventListener('mousemove', this.onMouseMove);
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "onScreenResize",
|
|
138
|
+
value: function onScreenResize() {
|
|
139
|
+
this.setState({
|
|
140
|
+
dropdownWidth: this.selectWrapper.clientWidth
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
key: "onClickOutside",
|
|
145
|
+
value: function onClickOutside(event) {
|
|
146
|
+
var selectWrapper = this.selectWrapper,
|
|
147
|
+
dropdownRef = this.dropdownRef;
|
|
148
|
+
var target = event.target;
|
|
149
|
+
|
|
150
|
+
if (target !== selectWrapper && !selectWrapper.contains(target) && dropdownRef.current && !dropdownRef.current.contains(target)) {
|
|
151
|
+
this.setState({
|
|
152
|
+
opened: false
|
|
159
153
|
});
|
|
160
154
|
}
|
|
161
|
-
|
|
162
|
-
if (dataComboFilter && dataComboFilter.length > 0) selectedFilter = dataComboFilter[0];
|
|
163
|
-
setDataCombo(dataComboFilter);
|
|
164
|
-
setOpened(true);
|
|
165
|
-
if (selectedFilter) setSelected(selectedFilter);
|
|
166
|
-
setInputValue(filteredValue);
|
|
167
155
|
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
setOpened(false);
|
|
177
|
-
if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(function (i) {
|
|
178
|
-
return i[idKey];
|
|
179
|
-
})));
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
var onUnselect = function onUnselect(id) {
|
|
183
|
-
if (currents) {
|
|
184
|
-
var result = currents.filter(function (item) {
|
|
185
|
-
return item[idKey] !== id;
|
|
156
|
+
}, {
|
|
157
|
+
key: "onMouseMove",
|
|
158
|
+
value: function onMouseMove(event) {
|
|
159
|
+
var target = event.target;
|
|
160
|
+
if (target.className === '') return;
|
|
161
|
+
var insideComponent = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target.className);
|
|
162
|
+
this.setState({
|
|
163
|
+
insideComponent: insideComponent
|
|
186
164
|
});
|
|
187
|
-
setCurrents(result);
|
|
188
|
-
if (props.onSelect) setSelected(props.onSelect(result.map(function (i) {
|
|
189
|
-
return i[idKey];
|
|
190
|
-
})));
|
|
191
165
|
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
var onInputKeyDown = function onInputKeyDown(e) {
|
|
211
|
-
if (e.keyCode === constants.keyCodes.ENTER && selected) {
|
|
212
|
-
if (!currents.includes(selected)) onSelect(selected);
|
|
213
|
-
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
214
|
-
if (!opened) setOpened(true);
|
|
215
|
-
var index = dataSource ? dataSource.findIndex(function (d) {
|
|
216
|
-
return d === selected;
|
|
217
|
-
}) : 0;
|
|
218
|
-
|
|
219
|
-
if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
|
|
220
|
-
index = dataSource && index === dataSource.length - 1 ? 0 : index + 1;
|
|
166
|
+
}, {
|
|
167
|
+
key: "onFilter",
|
|
168
|
+
value: function onFilter(value) {
|
|
169
|
+
var selected = null;
|
|
170
|
+
var _this$props = this.props,
|
|
171
|
+
dataSource = _this$props.dataSource,
|
|
172
|
+
remoteSearch = _this$props.remoteSearch,
|
|
173
|
+
onSearch = _this$props.onSearch;
|
|
174
|
+
var dataCombo = dataSource;
|
|
175
|
+
|
|
176
|
+
if (remoteSearch) {
|
|
177
|
+
if (onSearch) onSearch(value);
|
|
178
|
+
this.setState({
|
|
179
|
+
opened: true,
|
|
180
|
+
inputValue: value
|
|
181
|
+
});
|
|
221
182
|
} else {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
183
|
+
if (value !== '') {
|
|
184
|
+
dataCombo = (0, _helper.getFilteredMultipleDataCombo)(_extends({}, this.props, this.state, {
|
|
185
|
+
inputValue: value
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (dataCombo.length > 0) selected = dataCombo[0];
|
|
190
|
+
this.setState({
|
|
191
|
+
dataCombo: dataCombo,
|
|
192
|
+
opened: true,
|
|
193
|
+
selected: selected,
|
|
194
|
+
inputValue: value
|
|
195
|
+
});
|
|
227
196
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "onSelect",
|
|
200
|
+
value: function onSelect(selected) {
|
|
201
|
+
if (selected === null) return;
|
|
202
|
+
var _this$props2 = this.props,
|
|
203
|
+
dataSource = _this$props2.dataSource,
|
|
204
|
+
idKey = _this$props2.idKey,
|
|
205
|
+
onSelect = _this$props2.onSelect;
|
|
206
|
+
var currents = [].concat(_toConsumableArray(this.state.currents), [selected]);
|
|
207
|
+
this.setState({
|
|
208
|
+
currents: currents,
|
|
209
|
+
dataCombo: dataSource,
|
|
210
|
+
inputValue: ''
|
|
211
|
+
}, function () {
|
|
212
|
+
if (onSelect) onSelect(currents.map(function (i) {
|
|
236
213
|
return i[idKey];
|
|
237
214
|
}));
|
|
238
|
-
}
|
|
215
|
+
});
|
|
239
216
|
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
if (handlerClear) onClearClick();
|
|
259
|
-
return function () {
|
|
260
|
-
window.removeEventListener('resize', onScreenResize);
|
|
261
|
-
document.removeEventListener('click', onClickOutside);
|
|
262
|
-
document.removeEventListener('mousemove', onMouseMove);
|
|
263
|
-
};
|
|
264
|
-
}, []);
|
|
265
|
-
(0, _react.useEffect)(function () {
|
|
266
|
-
if (props.gridLayout) {
|
|
267
|
-
var gridEl = document.querySelector("#".concat(componentId, ">.-withinput.grid-container"));
|
|
268
|
-
if (gridElRef.current !== gridEl && gridEl) gridElRef.current = gridEl;
|
|
217
|
+
}, {
|
|
218
|
+
key: "onUnselect",
|
|
219
|
+
value: function onUnselect(id) {
|
|
220
|
+
var _this2 = this;
|
|
221
|
+
|
|
222
|
+
var _this$props3 = this.props,
|
|
223
|
+
onSelect = _this$props3.onSelect,
|
|
224
|
+
idKey = _this$props3.idKey;
|
|
225
|
+
var result = this.state.currents.filter(function (item) {
|
|
226
|
+
return item[_this2.props.idKey] !== id;
|
|
227
|
+
});
|
|
228
|
+
this.setState({
|
|
229
|
+
currents: result
|
|
230
|
+
}, function () {
|
|
231
|
+
if (onSelect) _this2.props.onSelect(result.map(function (i) {
|
|
232
|
+
return i[idKey];
|
|
233
|
+
}));
|
|
234
|
+
});
|
|
269
235
|
}
|
|
270
|
-
},
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
236
|
+
}, {
|
|
237
|
+
key: "onOpenClose",
|
|
238
|
+
value: function onOpenClose() {
|
|
239
|
+
this.setState({
|
|
240
|
+
opened: !this.state.opened,
|
|
241
|
+
dropdownWidth: this.selectWrapper.clientWidth
|
|
275
242
|
});
|
|
276
|
-
setValueFromProps(value);
|
|
277
|
-
setCurrents(newCurrents);
|
|
278
243
|
}
|
|
279
|
-
},
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
var
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
244
|
+
}, {
|
|
245
|
+
key: "onFocus",
|
|
246
|
+
value: function onFocus() {
|
|
247
|
+
var dropdownWidth = this.state.dropdownWidth;
|
|
248
|
+
dropdownWidth = this.selectWrapper ? this.selectWrapper.clientWidth : dropdownWidth;
|
|
249
|
+
this.setState({
|
|
250
|
+
opened: true,
|
|
251
|
+
dropdownWidth: dropdownWidth
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}, {
|
|
255
|
+
key: "onBlur",
|
|
256
|
+
value: function onBlur(e) {
|
|
257
|
+
var onBlur = this.props.onBlur;
|
|
258
|
+
if (onBlur) onBlur(e);
|
|
259
|
+
if (!this.state.insideComponent) this.setState({
|
|
260
|
+
opened: false
|
|
287
261
|
});
|
|
288
|
-
setDataCombo(filteredDataCombo);
|
|
289
|
-
setSelected(filteredDataCombo.length > 0 ? dataCombo[0] : null);
|
|
290
262
|
}
|
|
291
|
-
},
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
263
|
+
}, {
|
|
264
|
+
key: "onInputKeyDown",
|
|
265
|
+
value: function onInputKeyDown(e) {
|
|
266
|
+
var _this$props4 = this.props,
|
|
267
|
+
dataSource = _this$props4.dataSource,
|
|
268
|
+
descriptionKey = _this$props4.descriptionKey,
|
|
269
|
+
idKey = _this$props4.idKey,
|
|
270
|
+
onSelect = _this$props4.onSelect;
|
|
271
|
+
var selected = this.state.selected;
|
|
272
|
+
|
|
273
|
+
if (e.keyCode === constants.keyCodes.ENTER) {
|
|
274
|
+
this.onSelect(selected);
|
|
275
|
+
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
276
|
+
var index = dataSource.findIndex(function (d) {
|
|
277
|
+
return d === selected;
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
|
|
281
|
+
index = index === dataSource.length - 1 ? 0 : index + 1;
|
|
282
|
+
} else {
|
|
283
|
+
index = index === 0 ? dataSource.length - 1 : index - 1;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
this.setState({
|
|
287
|
+
inputValue: dataSource[index][descriptionKey],
|
|
288
|
+
selected: dataSource[index]
|
|
289
|
+
});
|
|
290
|
+
} else if (e.keyCode === constants.keyCodes.BACKSPACE) {
|
|
291
|
+
var inputValue = this.state.inputValue;
|
|
292
|
+
|
|
293
|
+
if (inputValue === '') {
|
|
294
|
+
var currents = _lodash.default.dropRight(this.state.currents);
|
|
295
|
+
|
|
296
|
+
this.setState({
|
|
297
|
+
currents: currents
|
|
298
|
+
}, function () {
|
|
299
|
+
if (onSelect) onSelect(currents.map(function (i) {
|
|
300
|
+
return i[idKey];
|
|
301
|
+
}));
|
|
302
|
+
});
|
|
303
|
+
}
|
|
326
304
|
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
305
|
+
}
|
|
306
|
+
}, {
|
|
307
|
+
key: "onClearClick",
|
|
308
|
+
value: function onClearClick() {
|
|
309
|
+
var onSelect = this.props.onSelect;
|
|
310
|
+
this.setState({
|
|
311
|
+
selected: null,
|
|
312
|
+
currents: []
|
|
313
|
+
}, function () {
|
|
314
|
+
if (onSelect) onSelect([]);
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
}, {
|
|
318
|
+
key: "render",
|
|
319
|
+
value: function render() {
|
|
320
|
+
var _this3 = this;
|
|
321
|
+
|
|
322
|
+
var _this$state = this.state,
|
|
323
|
+
opened = _this$state.opened,
|
|
324
|
+
inputValue = _this$state.inputValue;
|
|
325
|
+
var _this$props5 = this.props,
|
|
326
|
+
readOnly = _this$props5.readOnly,
|
|
327
|
+
gridLayout = _this$props5.gridLayout;
|
|
328
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
329
|
+
id: this.componentId,
|
|
330
|
+
ref: this.componentRef,
|
|
331
|
+
className: "select-component"
|
|
332
|
+
}, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, this.props, {
|
|
333
|
+
value: inputValue,
|
|
334
|
+
readOnly: this.shouldBeReadOnly(),
|
|
335
|
+
onFocus: function onFocus() {
|
|
336
|
+
_this3.onFocus();
|
|
337
|
+
},
|
|
338
|
+
onBlur: function onBlur(e) {
|
|
339
|
+
_this3.onBlur(e);
|
|
340
|
+
},
|
|
341
|
+
onChange: function onChange(e) {
|
|
342
|
+
_this3.onFilter(e.target.value);
|
|
343
|
+
},
|
|
344
|
+
onKeyDown: function onKeyDown(e) {
|
|
345
|
+
_this3.onInputKeyDown(e);
|
|
346
|
+
},
|
|
347
|
+
customClassForWrapper: "selectwrapper ".concat((readOnly || this.shouldDisable() || this.shouldBeReadOnly()) && ' -undigitable'),
|
|
348
|
+
customClassForInputContent: "multiselect",
|
|
349
|
+
inputBaseRef: function inputBaseRef(r) {
|
|
350
|
+
_this3.selectWrapper = r;
|
|
351
|
+
},
|
|
352
|
+
handlerSetOnDenied: this.setOnDenied,
|
|
353
|
+
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, _extends({}, this.state, this.props, {
|
|
354
|
+
disabled: this.shouldDisable() || this.shouldBeReadOnly(),
|
|
355
|
+
dropDownOpened: opened,
|
|
356
|
+
handleClear: function handleClear() {
|
|
357
|
+
if (_this3.shouldDisable()) return null;
|
|
358
|
+
return _this3.onClearClick();
|
|
359
|
+
},
|
|
360
|
+
handleOpenClose: function handleOpenClose() {
|
|
361
|
+
_this3.onOpenClose();
|
|
362
|
+
}
|
|
363
|
+
}))
|
|
364
|
+
}), /*#__PURE__*/_react.default.createElement(_Selecteds.default, _extends({}, this.state, this.props, {
|
|
365
|
+
handleOnUnselect: this.onUnselect
|
|
366
|
+
}))), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, this.state, this.props, {
|
|
367
|
+
selectFieldRef: this.componentRef,
|
|
368
|
+
dropdownRef: this.dropdownRef,
|
|
369
|
+
gridWrapperStyle: gridLayout ? window.getComputedStyle(this.gridEl) : undefined,
|
|
370
|
+
handleOnSelect: this.onSelect,
|
|
371
|
+
handleOnFilter: this.onFilter,
|
|
372
|
+
handleOnKeydown: this.onInputKeyDown,
|
|
373
|
+
handleOnBlur: this.onBlur,
|
|
374
|
+
handleOnFocus: this.onFocus
|
|
375
|
+
})));
|
|
376
|
+
}
|
|
377
|
+
}]);
|
|
378
|
+
|
|
379
|
+
return MultipleSelect;
|
|
380
|
+
}(_react.Component);
|
|
381
|
+
|
|
382
|
+
Object.defineProperty(MultipleSelect, "getDerivedStateFromProps", {
|
|
383
|
+
configurable: true,
|
|
384
|
+
enumerable: true,
|
|
385
|
+
writable: true,
|
|
386
|
+
value: function value(props, state) {
|
|
387
|
+
var dataSource = props.dataSource,
|
|
388
|
+
remoteSearch = props.remoteSearch,
|
|
389
|
+
value = props.value,
|
|
390
|
+
idKey = props.idKey;
|
|
391
|
+
|
|
392
|
+
if (value !== state.valueFromProps && dataSource.length > 0) {
|
|
393
|
+
return {
|
|
394
|
+
valueFromProps: value,
|
|
395
|
+
currents: dataSource.filter(function (item) {
|
|
396
|
+
return value.includes(item[idKey]);
|
|
397
|
+
})
|
|
398
|
+
};
|
|
399
|
+
} else if (dataSource !== state.dataCombo) {
|
|
400
|
+
var dataCombo = remoteSearch ? dataSource : (0, _helper.getFilteredMultipleDataCombo)(_extends({}, props, state));
|
|
401
|
+
return {
|
|
402
|
+
dataCombo: dataCombo,
|
|
403
|
+
selected: dataCombo.length > 0 ? dataCombo[0] : null
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
var _initialiseProps = function _initialiseProps() {
|
|
412
|
+
var _this4 = this;
|
|
413
|
+
|
|
414
|
+
Object.defineProperty(this, "setOnDenied", {
|
|
415
|
+
configurable: true,
|
|
416
|
+
enumerable: true,
|
|
417
|
+
writable: true,
|
|
418
|
+
value: function value(onDenied) {
|
|
419
|
+
_this4.setState({
|
|
420
|
+
onDenied: onDenied
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
Object.defineProperty(this, "shouldDisable", {
|
|
425
|
+
configurable: true,
|
|
426
|
+
enumerable: true,
|
|
427
|
+
writable: true,
|
|
428
|
+
value: function value() {
|
|
429
|
+
var disabled = _this4.props.disabled;
|
|
430
|
+
var onDenied = _this4.state.onDenied;
|
|
431
|
+
return disabled || onDenied && (onDenied.disabled || onDenied.hideContent);
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
Object.defineProperty(this, "shouldBeReadOnly", {
|
|
435
|
+
configurable: true,
|
|
436
|
+
enumerable: true,
|
|
437
|
+
writable: true,
|
|
438
|
+
value: function value() {
|
|
439
|
+
var readOnly = _this4.props.readOnly;
|
|
440
|
+
var onDenied = _this4.state.onDenied;
|
|
441
|
+
return readOnly || onDenied && onDenied.readOnly;
|
|
442
|
+
}
|
|
443
|
+
});
|
|
351
444
|
};
|
|
352
445
|
|
|
446
|
+
MultipleSelect.propTypes = {
|
|
447
|
+
dataSource: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
448
|
+
idKey: _propTypes.default.string.isRequired,
|
|
449
|
+
descriptionKey: _propTypes.default.string.isRequired,
|
|
450
|
+
value: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.number), _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
451
|
+
showClearButton: _propTypes.default.bool,
|
|
452
|
+
readOnly: _propTypes.default.bool,
|
|
453
|
+
searchOnDropdown: _propTypes.default.bool,
|
|
454
|
+
searchNotFoundText: _propTypes.default.string,
|
|
455
|
+
onSearch: _propTypes.default.func,
|
|
456
|
+
onSelect: _propTypes.default.func,
|
|
457
|
+
remoteSearch: _propTypes.default.bool,
|
|
458
|
+
onBlur: _propTypes.default.func,
|
|
459
|
+
handlerClear: _propTypes.default.func,
|
|
460
|
+
disabled: _propTypes.default.bool,
|
|
461
|
+
gridLayout: _propTypes.default.string
|
|
462
|
+
};
|
|
463
|
+
MultipleSelect.defaultProps = {
|
|
464
|
+
dataSource: [],
|
|
465
|
+
value: null,
|
|
466
|
+
showClearButton: true,
|
|
467
|
+
readOnly: false,
|
|
468
|
+
searchOnDropdown: false,
|
|
469
|
+
searchNotFoundText: '',
|
|
470
|
+
onSearch: undefined,
|
|
471
|
+
onSelect: undefined,
|
|
472
|
+
remoteSearch: false,
|
|
473
|
+
onBlur: undefined,
|
|
474
|
+
handlerClear: undefined,
|
|
475
|
+
disabled: false,
|
|
476
|
+
gridLayout: undefined
|
|
477
|
+
};
|
|
353
478
|
var _default = MultipleSelect;
|
|
354
479
|
exports.default = _default;
|