linear-react-components-ui 0.4.77-beta.26 → 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 +55 -32
- 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 +74 -42
- package/lib/avatar/index.js +58 -13
- package/lib/badge/badge.spec.js +52 -30
- 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 +41 -41
- 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 +210 -136
- 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 +63 -32
- package/lib/calendar/index.js +10 -10
- package/lib/checkbox/Label.js +12 -2
- package/lib/checkbox/checkbox.spec.js +78 -37
- 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 +153 -79
- 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 +95 -52
- 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 +58 -34
- package/lib/dropdown/helper.js +2 -2
- package/lib/dropdown/withDropdown.js +43 -18
- package/lib/fieldset/fieldset.spec.js +123 -77
- 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 +90 -48
- 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 +70 -43
- package/lib/icons/helper.js +571 -560
- package/lib/icons/icons.spec.js +36 -20
- 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 +289 -174
- package/lib/inputs/base/helpers.js +4 -4
- package/lib/inputs/color/color_input.spec.js +67 -33
- 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 +156 -75
- 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 +290 -177
- package/lib/inputs/multiSelect/ActionButtons.js +14 -2
- package/lib/inputs/multiSelect/Dropdown.js +70 -43
- package/lib/inputs/multiSelect/index.js +80 -64
- 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 +83 -42
- 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 +86 -46
- 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 +182 -127
- package/lib/inputs/select/simple/index.js +462 -305
- package/lib/inputs/select/types.d.ts +4 -0
- package/lib/inputs/text/index.js +0 -1
- package/lib/inputs/text/textfield.spec.js +83 -42
- package/lib/inputs/textarea/index.js +15 -5
- package/lib/inputs/textarea/textarea.spec.js +27 -14
- 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 +61 -28
- 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 +68 -41
- 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 +358 -211
- package/lib/menus/float/MenuItem.js +42 -10
- package/lib/menus/float/SubMenuContainer.js +95 -0
- package/lib/menus/float/float-menu.spec.js +61 -27
- 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 +78 -29
- 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 +106 -69
- 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 +70 -40
- package/lib/progress/Bar.js +47 -37
- package/lib/progress/index.js +18 -8
- package/lib/progress/progress.spec.js +48 -32
- package/lib/radio/index.js +46 -22
- package/lib/radio/radio.spec.js +68 -41
- 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 +65 -43
- 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 +76 -51
- 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 +149 -94
- 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 +158 -95
- 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 +182 -134
- package/lib/tooltip/index.js +34 -25
- package/lib/tooltip/tooltip.spec.js +51 -24
- 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 +86 -49
- 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 +77 -55
- package/package.json +16 -40
- package/.husky/pre-push +0 -4
- package/babel.config.json +0 -11
- package/dist/main.js +0 -14
- package/lib/assets/styles/treetable.scss +0 -100
- package/lib/treetable/Body.js +0 -46
- package/lib/treetable/Header.js +0 -27
- package/lib/treetable/Row.js +0 -261
- package/lib/treetable/helpers.js +0 -41
- package/lib/treetable/index.js +0 -24
- package/lib/treetable/types.d.js +0 -5
- 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 _InputTextBase = _interopRequireDefault(require("../base/InputTextBase"));
|
|
13
15
|
|
|
14
16
|
var _buttons = _interopRequireDefault(require("../../buttons"));
|
|
@@ -29,160 +31,290 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
|
29
31
|
|
|
30
32
|
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."); }
|
|
31
33
|
|
|
34
|
+
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); }
|
|
35
|
+
|
|
32
36
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
33
37
|
|
|
34
38
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
35
39
|
|
|
36
|
-
function
|
|
40
|
+
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; }
|
|
37
41
|
|
|
38
|
-
function
|
|
42
|
+
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); }
|
|
39
43
|
|
|
40
|
-
function
|
|
44
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
41
45
|
|
|
42
|
-
function
|
|
46
|
+
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); } }
|
|
43
47
|
|
|
44
|
-
function
|
|
48
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
45
49
|
|
|
46
|
-
function
|
|
50
|
+
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); }
|
|
47
51
|
|
|
48
|
-
function
|
|
52
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
49
53
|
|
|
50
|
-
var
|
|
51
|
-
var _props$resetButton = props.resetButton,
|
|
52
|
-
resetButton = _props$resetButton === void 0 ? true : _props$resetButton,
|
|
53
|
-
advancedFilterProps = props.advancedFilterProps,
|
|
54
|
-
value = props.value;
|
|
54
|
+
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); }; }
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
-
advancedFilterOpened = _useState2[0],
|
|
59
|
-
setAdvancedFilterOpened = _useState2[1];
|
|
56
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
63
|
-
valorCampo = _useState4[0],
|
|
64
|
-
setValorCampo = _useState4[1];
|
|
58
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
68
|
-
onDenied = _useState6[0],
|
|
69
|
-
setOnDenied = _useState6[1];
|
|
60
|
+
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; } }
|
|
70
61
|
|
|
71
|
-
|
|
72
|
-
if (props.onReset) props.onReset(event);
|
|
73
|
-
setValorCampo('');
|
|
74
|
-
};
|
|
62
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
75
63
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (props.onChange) props.onChange(event);
|
|
79
|
-
setValorCampo(event.target.value);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
var shouldDisable = function shouldDisable() {
|
|
84
|
-
return props.disabled || onDenied && (onDenied.disabled || onDenied.hideContent);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
var shouldBeReadOnly = function shouldBeReadOnly() {
|
|
88
|
-
return props.readOnly || onDenied && onDenied.readOnly;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
var hideContent = onDenied && onDenied.hideContent;
|
|
92
|
-
|
|
93
|
-
var buttonProps = function buttonProps() {
|
|
94
|
-
var _ref = advancedFilterProps || {},
|
|
95
|
-
onStateChange = _ref.onStateChange;
|
|
96
|
-
|
|
97
|
-
var disableCallbacks = shouldBeReadOnly() || shouldDisable() || hideContent;
|
|
98
|
-
var propsButton = {
|
|
99
|
-
icon: /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
100
|
-
name: "filter1",
|
|
101
|
-
color: "#a9a8a8",
|
|
102
|
-
key: "filter-icon"
|
|
103
|
-
}),
|
|
104
|
-
key: 'advanced-filter-button',
|
|
105
|
-
boxShadow: false,
|
|
106
|
-
readOnly: shouldBeReadOnly(),
|
|
107
|
-
style: {
|
|
108
|
-
padding: '0 0 0 5px',
|
|
109
|
-
width: 30
|
|
110
|
-
},
|
|
111
|
-
transparent: true,
|
|
112
|
-
disabled: shouldDisable()
|
|
113
|
-
};
|
|
64
|
+
var SearchField = /*#__PURE__*/function (_Component) {
|
|
65
|
+
_inherits(SearchField, _Component);
|
|
114
66
|
|
|
115
|
-
|
|
116
|
-
propsButton = _extends({}, propsButton, {
|
|
117
|
-
onClick: function onClick(e) {
|
|
118
|
-
if (props.onClick) props.onClick(e);
|
|
119
|
-
setAdvancedFilterOpened(!advancedFilterOpened);
|
|
120
|
-
if (onStateChange) onStateChange(!advancedFilterOpened);
|
|
121
|
-
}
|
|
122
|
-
}, propsButton);
|
|
123
|
-
}
|
|
67
|
+
var _super = _createSuper(SearchField);
|
|
124
68
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
var enableFilterButton = advancedFilterProps !== undefined;
|
|
130
|
-
var elements = [/*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
131
|
-
name: "search",
|
|
132
|
-
color: "#a9a8a8",
|
|
133
|
-
key: "search-icon",
|
|
134
|
-
disabled: shouldDisable()
|
|
135
|
-
})];
|
|
136
|
-
|
|
137
|
-
var resetButtonIcon = /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
138
|
-
name: "cancel2",
|
|
139
|
-
color: "#a9a8a8",
|
|
140
|
-
key: "inputSearchIcon",
|
|
141
|
-
style: {
|
|
142
|
-
cursor: 'pointer',
|
|
143
|
-
pointerEvents: 'auto'
|
|
144
|
-
},
|
|
145
|
-
onClick: onReset
|
|
146
|
-
});
|
|
69
|
+
function SearchField() {
|
|
70
|
+
var _this;
|
|
71
|
+
|
|
72
|
+
_classCallCheck(this, SearchField);
|
|
147
73
|
|
|
148
|
-
|
|
74
|
+
_this = _super.call(this);
|
|
75
|
+
Object.defineProperty(_assertThisInitialized(_this), "onReset", {
|
|
76
|
+
configurable: true,
|
|
77
|
+
enumerable: true,
|
|
78
|
+
writable: true,
|
|
79
|
+
value: function value(event) {
|
|
80
|
+
var onReset = _this.props.onReset;
|
|
81
|
+
if (onReset) onReset(event);
|
|
149
82
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
83
|
+
_this.setState({
|
|
84
|
+
value: ''
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(_assertThisInitialized(_this), "onChange", {
|
|
89
|
+
configurable: true,
|
|
90
|
+
enumerable: true,
|
|
91
|
+
writable: true,
|
|
92
|
+
value: function value(event) {
|
|
93
|
+
var onChange = _this.props.onChange;
|
|
94
|
+
if (onChange) onChange(event);
|
|
95
|
+
|
|
96
|
+
_this.setState({
|
|
97
|
+
value: event.target.value
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
Object.defineProperty(_assertThisInitialized(_this), "onReset", {
|
|
102
|
+
configurable: true,
|
|
103
|
+
enumerable: true,
|
|
104
|
+
writable: true,
|
|
105
|
+
value: function value(event) {
|
|
106
|
+
var onReset = _this.props.onReset;
|
|
107
|
+
if (onReset) onReset(event);
|
|
108
|
+
|
|
109
|
+
_this.setState({
|
|
110
|
+
value: ''
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(_assertThisInitialized(_this), "setOnDenied", {
|
|
115
|
+
configurable: true,
|
|
116
|
+
enumerable: true,
|
|
117
|
+
writable: true,
|
|
118
|
+
value: function value(onDenied) {
|
|
119
|
+
_this.setState({
|
|
120
|
+
onDenied: onDenied
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
Object.defineProperty(_assertThisInitialized(_this), "shouldDisable", {
|
|
125
|
+
configurable: true,
|
|
126
|
+
enumerable: true,
|
|
127
|
+
writable: true,
|
|
128
|
+
value: function value() {
|
|
129
|
+
var disabled = _this.props.disabled;
|
|
130
|
+
var onDenied = _this.state.onDenied;
|
|
131
|
+
return disabled || onDenied && (onDenied.disabled || onDenied.hideContent);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
Object.defineProperty(_assertThisInitialized(_this), "shouldBeReadOnly", {
|
|
135
|
+
configurable: true,
|
|
136
|
+
enumerable: true,
|
|
137
|
+
writable: true,
|
|
138
|
+
value: function value() {
|
|
139
|
+
var readOnly = _this.props.readOnly;
|
|
140
|
+
var onDenied = _this.state.onDenied;
|
|
141
|
+
return readOnly || onDenied && onDenied.readOnly;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(_assertThisInitialized(_this), "buttonProps", {
|
|
145
|
+
configurable: true,
|
|
146
|
+
enumerable: true,
|
|
147
|
+
writable: true,
|
|
148
|
+
value: function value() {
|
|
149
|
+
var advancedFilterOpened = _this.state.advancedFilterOpened;
|
|
150
|
+
var _this$props = _this.props,
|
|
151
|
+
_onClick = _this$props.onClick,
|
|
152
|
+
advancedFilterProps = _this$props.advancedFilterProps;
|
|
153
|
+
|
|
154
|
+
var _ref = advancedFilterProps || {},
|
|
155
|
+
onStateChange = _ref.onStateChange;
|
|
156
|
+
|
|
157
|
+
var disableCallbacks = _this.shouldBeReadOnly() || _this.shouldDisable() || _this.hideContent;
|
|
158
|
+
|
|
159
|
+
var propsButton = {
|
|
160
|
+
icon: /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
161
|
+
name: "filter1",
|
|
162
|
+
color: "#a9a8a8",
|
|
163
|
+
key: "filter-icon"
|
|
164
|
+
}),
|
|
165
|
+
key: 'advanced-filter-button',
|
|
166
|
+
boxShadow: false,
|
|
167
|
+
readOnly: _this.shouldBeReadOnly(),
|
|
168
|
+
style: {
|
|
169
|
+
padding: '0 0 0 5px',
|
|
170
|
+
width: 30
|
|
171
|
+
},
|
|
172
|
+
transparent: true,
|
|
173
|
+
disabled: _this.shouldDisable(),
|
|
174
|
+
cursor: true
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
if (!disableCallbacks) {
|
|
178
|
+
propsButton = _extends({}, propsButton, {
|
|
179
|
+
onClick: function onClick(e) {
|
|
180
|
+
if (_onClick) _onClick(e);
|
|
181
|
+
|
|
182
|
+
_this.setState({
|
|
183
|
+
advancedFilterOpened: !advancedFilterOpened
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
if (onStateChange) onStateChange(!advancedFilterOpened);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
154
190
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
191
|
+
return propsButton;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
Object.defineProperty(_assertThisInitialized(_this), "rightElements", {
|
|
195
|
+
configurable: true,
|
|
196
|
+
enumerable: true,
|
|
197
|
+
writable: true,
|
|
198
|
+
value: function value() {
|
|
199
|
+
var _this$props2 = _this.props,
|
|
200
|
+
resetButton = _this$props2.resetButton,
|
|
201
|
+
advancedFilterProps = _this$props2.advancedFilterProps;
|
|
202
|
+
var enableFilterButton = advancedFilterProps !== undefined;
|
|
203
|
+
var elements = [/*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
204
|
+
name: "search",
|
|
205
|
+
color: "#a9a8a8",
|
|
206
|
+
key: "search-icon",
|
|
207
|
+
disabled: _this.shouldDisable()
|
|
208
|
+
})];
|
|
209
|
+
|
|
210
|
+
var resetButtonIcon = /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
211
|
+
name: "cancel2",
|
|
212
|
+
color: "#a9a8a8",
|
|
213
|
+
key: "inputSearchIcon",
|
|
214
|
+
style: {
|
|
215
|
+
cursor: 'pointer',
|
|
216
|
+
pointerEvents: 'auto'
|
|
217
|
+
},
|
|
218
|
+
onClick: _this.onReset
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
var filterButton = /*#__PURE__*/_react.default.createElement(_buttons.default, _this.buttonProps());
|
|
222
|
+
|
|
223
|
+
if (enableFilterButton) elements = [].concat(_toConsumableArray(elements), [filterButton]);
|
|
224
|
+
if (resetButton && _this.state.value.trim() !== '') elements = [resetButtonIcon].concat(_toConsumableArray(elements));
|
|
225
|
+
return elements;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
_this.state = {
|
|
229
|
+
advancedFilterOpened: false,
|
|
230
|
+
value: '',
|
|
231
|
+
onDenied: undefined
|
|
232
|
+
};
|
|
233
|
+
return _this;
|
|
234
|
+
}
|
|
159
235
|
|
|
160
|
-
(
|
|
161
|
-
|
|
162
|
-
|
|
236
|
+
_createClass(SearchField, [{
|
|
237
|
+
key: "render",
|
|
238
|
+
value: function render() {
|
|
239
|
+
var _this2 = this;
|
|
240
|
+
|
|
241
|
+
var _this$state = this.state,
|
|
242
|
+
advancedFilterOpened = _this$state.advancedFilterOpened,
|
|
243
|
+
onDenied = _this$state.onDenied;
|
|
244
|
+
var advancedFilterProps = this.props.advancedFilterProps;
|
|
245
|
+
|
|
246
|
+
var _ref2 = advancedFilterProps || {},
|
|
247
|
+
headerTitle = _ref2.headerTitle,
|
|
248
|
+
content = _ref2.content,
|
|
249
|
+
onStateChange = _ref2.onStateChange;
|
|
250
|
+
|
|
251
|
+
if (onDenied && onDenied.unvisible) return null;
|
|
252
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, this.props, {
|
|
253
|
+
style: {
|
|
254
|
+
heigth: 40
|
|
255
|
+
},
|
|
256
|
+
onReset: this.onReset,
|
|
257
|
+
onChange: this.onChange,
|
|
258
|
+
value: this.state.value,
|
|
259
|
+
customClass: "",
|
|
260
|
+
handlerSetOnDenied: this.setOnDenied,
|
|
261
|
+
rightElements: this.rightElements()
|
|
262
|
+
})), advancedFilterOpened && /*#__PURE__*/_react.default.createElement(_drawer.default, _extends({
|
|
263
|
+
handlerClose: function handlerClose() {
|
|
264
|
+
_this2.setState({
|
|
265
|
+
advancedFilterOpened: false
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
if (onStateChange) onStateChange(false);
|
|
269
|
+
}
|
|
270
|
+
}, advancedFilterProps), headerTitle && /*#__PURE__*/_react.default.createElement(_drawer.DrawerHeader, {
|
|
271
|
+
title: headerTitle
|
|
272
|
+
}), /*#__PURE__*/_react.default.createElement(_drawer.DrawerContent, null, content)));
|
|
273
|
+
}
|
|
274
|
+
}]);
|
|
275
|
+
|
|
276
|
+
return SearchField;
|
|
277
|
+
}(_react.Component);
|
|
278
|
+
|
|
279
|
+
Object.defineProperty(SearchField, "getDerivedStateFromProps", {
|
|
280
|
+
configurable: true,
|
|
281
|
+
enumerable: true,
|
|
282
|
+
writable: true,
|
|
283
|
+
value: function value(props, state) {
|
|
284
|
+
var value = props.value;
|
|
285
|
+
|
|
286
|
+
if (value !== undefined && value !== state.value) {
|
|
287
|
+
return {
|
|
288
|
+
value: value
|
|
289
|
+
};
|
|
163
290
|
}
|
|
164
|
-
}, []);
|
|
165
291
|
|
|
166
|
-
if (onDenied && onDenied.unvisible) {
|
|
167
292
|
return null;
|
|
168
293
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
294
|
+
});
|
|
295
|
+
SearchField.propTypes = {
|
|
296
|
+
resetButton: _propTypes.default.bool,
|
|
297
|
+
onReset: _propTypes.default.func,
|
|
298
|
+
onChange: _propTypes.default.func,
|
|
299
|
+
onClick: _propTypes.default.func,
|
|
300
|
+
advancedFilterProps: _propTypes.default.object,
|
|
301
|
+
disabled: _propTypes.default.bool,
|
|
302
|
+
readOnly: _propTypes.default.bool,
|
|
303
|
+
value: _propTypes.default.string,
|
|
304
|
+
placeHolder: _propTypes.default.string,
|
|
305
|
+
permissionAttr: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.arrayOf(_propTypes.default.object)])
|
|
306
|
+
};
|
|
307
|
+
SearchField.defaultProps = {
|
|
308
|
+
resetButton: true,
|
|
309
|
+
onReset: undefined,
|
|
310
|
+
onChange: undefined,
|
|
311
|
+
onClick: undefined,
|
|
312
|
+
advancedFilterProps: undefined,
|
|
313
|
+
disabled: false,
|
|
314
|
+
readOnly: false,
|
|
315
|
+
value: undefined,
|
|
316
|
+
placeHolder: '',
|
|
317
|
+
permissionAttr: undefined
|
|
185
318
|
};
|
|
186
|
-
|
|
187
319
|
var _default = SearchField;
|
|
188
320
|
exports.default = _default;
|