linear-react-components-ui 1.1.20-beta.26 → 1.1.20-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/lib/alerts/BaseAlert.js +1 -1
- package/lib/alerts/Message.js +1 -1
- package/lib/assets/styles/wizard.scss +3 -1
- package/lib/avatar/index.js +9 -8
- package/lib/badge/index.js +4 -4
- package/lib/buttons/DangerButton.js +1 -1
- package/lib/buttons/DefaultButton.js +12 -4
- package/lib/buttons/InfoButton.js +1 -1
- package/lib/buttons/PrimaryButton.js +1 -1
- package/lib/buttons/SuccessButton.js +1 -1
- package/lib/buttons/WarningButton.js +1 -1
- package/lib/buttons/button_container/index.js +1 -1
- package/lib/buttons/split_button/index.js +1 -1
- package/lib/calendar/base/Day.js +1 -1
- package/lib/calendar/base/Month.js +1 -1
- package/lib/calendar/base/helpers.js +2 -2
- package/lib/calendar/base/index.js +1 -1
- package/lib/checkbox/index.js +1 -1
- package/lib/dialog/Custom.js +1 -1
- package/lib/dialog/Question.js +2 -4
- package/lib/dialog/base/Content.js +1 -1
- package/lib/dialog/base/Header.js +2 -2
- package/lib/dialog/base/index.js +4 -5
- package/lib/dialog/form/index.js +1 -1
- package/lib/dialog/types.d.ts +2 -0
- package/lib/dialog/wizard/index.d.ts +1 -1
- package/lib/dialog/wizard/index.js +8 -4
- package/lib/dialog/wizard/progressbar.js +1 -1
- package/lib/dialog/wizard/step.js +1 -1
- package/lib/drawer/Drawer.js +3 -3
- package/lib/drawer/Header.js +1 -1
- package/lib/dropdown/Popup.js +6 -6
- package/lib/dropdown/helper.js +1 -1
- package/lib/dropdown/withDropdown.js +2 -2
- package/lib/fieldset/index.js +7 -7
- package/lib/form/FieldArray.js +1 -1
- package/lib/form/FieldNumber.js +3 -3
- package/lib/form/FieldPeriod.js +2 -2
- package/lib/form/index.js +2 -2
- package/lib/gridlayout/GridCol.js +5 -5
- package/lib/gridlayout/GridRow.js +4 -1
- package/lib/hint/index.js +7 -1
- package/lib/icons/index.js +24 -27
- package/lib/inputs/base/InputTextBase.js +6 -8
- package/lib/inputs/base/Label.js +1 -1
- package/lib/inputs/base/helpers.js +7 -3
- package/lib/inputs/date/helpers.js +4 -1
- package/lib/inputs/date/index.js +9 -15
- package/lib/inputs/errorMessage/index.js +1 -1
- package/lib/inputs/file/DefaultFile.js +5 -6
- package/lib/inputs/file/DragDropFile.js +15 -17
- package/lib/inputs/file/File.js +3 -4
- package/lib/inputs/mask/BaseMask.js +1 -2
- package/lib/inputs/mask/helpers.d.ts +1 -1
- package/lib/inputs/multiSelect/Dropdown.js +9 -10
- package/lib/inputs/multiSelect/helper.js +1 -2
- package/lib/inputs/multiSelect/index.js +7 -9
- package/lib/inputs/period/PeriodList.js +1 -1
- package/lib/inputs/period/helper.js +3 -1
- package/lib/inputs/period/index.js +9 -14
- package/lib/inputs/search/index.js +1 -1
- package/lib/inputs/select/Dropdown.js +1 -1
- package/lib/inputs/select/helper.js +10 -13
- package/lib/inputs/select/multiple/Selecteds.js +1 -1
- package/lib/inputs/select/multiple/index.js +9 -14
- package/lib/inputs/select/simple/index.js +10 -17
- package/lib/inputs/textarea/index.js +1 -1
- package/lib/internals/withTooltip.js +9 -9
- package/lib/labelMessages/index.js +4 -3
- package/lib/labels/DefaultLabel.js +4 -1
- package/lib/labels/label_container/index.js +1 -1
- package/lib/list/Header.js +1 -1
- package/lib/list/Item.js +9 -7
- package/lib/list/index.js +2 -1
- package/lib/menus/float/MenuItem.js +2 -2
- package/lib/menus/float/SubMenuContainer.js +1 -1
- package/lib/menus/float/index.js +1 -1
- package/lib/menus/sidenav/ExpandMenu.js +1 -1
- package/lib/menus/sidenav/NavMenuGroup.js +1 -1
- package/lib/menus/sidenav/NavMenuItem.js +7 -9
- package/lib/menus/sidenav/NavSubMenuItem.js +1 -1
- package/lib/menus/sidenav/helpers.js +1 -1
- package/lib/menus/sidenav/index.js +5 -5
- package/lib/panel/Content.js +5 -7
- package/lib/panel/Default.js +2 -2
- package/lib/panel/Header.js +3 -3
- package/lib/permissionValidations.js +1 -1
- package/lib/popover/index.js +1 -1
- package/lib/progress/Bar.js +6 -6
- package/lib/radio/index.js +2 -2
- package/lib/shortcuts/index.js +1 -1
- package/lib/skeleton/SkeletonContainer.js +2 -1
- package/lib/skeleton/index.js +4 -1
- package/lib/spinner/index.js +2 -2
- package/lib/split/Split.js +1 -1
- package/lib/split/SplitSide.js +3 -3
- package/lib/table/Body.js +3 -3
- package/lib/table/Header.js +8 -11
- package/lib/table/HeaderColumn.js +1 -1
- package/lib/table/Row.js +3 -3
- package/lib/table/RowColumn.js +1 -1
- package/lib/table/index.js +6 -1
- package/lib/tabs/DropdownTabs.js +1 -1
- package/lib/tabs/Menu.js +1 -1
- package/lib/tabs/MenuTabs.js +2 -2
- package/lib/tabs/Panel.js +5 -7
- package/lib/tabs/context.js +3 -6
- package/lib/textContent/index.js +1 -1
- package/lib/toolbar/ButtonBar.js +1 -1
- package/lib/toolbar/index.js +1 -1
- package/lib/tooltip/index.js +7 -7
- package/lib/treetable/Body.js +1 -1
- package/lib/treetable/Header.js +2 -2
- package/lib/treetable/Row.d.ts +1 -1
- package/lib/treetable/Row.js +9 -13
- package/lib/treetable/helpers.d.ts +1 -1
- package/lib/treetable/index.d.ts +2 -2
- package/lib/treeview/Header.js +1 -1
- package/lib/treeview/Node.js +5 -5
- package/lib/treeview/index.js +4 -4
- package/lib/{types.d-b477e076.d.ts → types.d-73cece43.d.ts} +0 -1
- package/lib/uitour/index.js +6 -8
- package/package.json +1 -1
- package/lib/checkbox/Label.js +0 -31
- package/lib/inputs/mask/imaskHOC.js +0 -203
- package/lib/menus/sidenav/popup_menu_help/index.js +0 -85
- package/lib/tabs/DropdownItems.js +0 -62
- package/lib/tabs/MenuItems.js +0 -70
- package/lib/treeview_old/Header.js +0 -29
- package/lib/treeview_old/Node.js +0 -68
- package/lib/treeview_old/index.js +0 -43
|
@@ -33,7 +33,7 @@ const MultiSelectField = props => {
|
|
|
33
33
|
gridLayout,
|
|
34
34
|
dropdownAlignButton = 'left'
|
|
35
35
|
} = props;
|
|
36
|
-
const componentId =
|
|
36
|
+
const componentId = `multiSelect-component${uuid.v1()}`;
|
|
37
37
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
38
38
|
const [selecteds, setSelecteds] = (0, _react.useState)();
|
|
39
39
|
const [inputValue, setInputValue] = (0, _react.useState)('');
|
|
@@ -68,8 +68,8 @@ const MultiSelectField = props => {
|
|
|
68
68
|
};
|
|
69
69
|
const onMouseMove = event => {
|
|
70
70
|
const target = event.target;
|
|
71
|
-
if (
|
|
72
|
-
const newInsideComponent = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target
|
|
71
|
+
if (target?.className === '') return;
|
|
72
|
+
const newInsideComponent = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target?.className);
|
|
73
73
|
setInsideComponent(newInsideComponent);
|
|
74
74
|
};
|
|
75
75
|
const onBlurComponent = e => {
|
|
@@ -109,11 +109,10 @@ const MultiSelectField = props => {
|
|
|
109
109
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
110
110
|
};
|
|
111
111
|
const onClickOutSide = event => {
|
|
112
|
-
var _componentRef$current;
|
|
113
112
|
const {
|
|
114
113
|
target
|
|
115
114
|
} = event;
|
|
116
|
-
if (target !== componentRef.current && !
|
|
115
|
+
if (target !== componentRef.current && !componentRef.current?.contains(target)) {
|
|
117
116
|
setOpened(false);
|
|
118
117
|
setDataCombo(dataSource);
|
|
119
118
|
setInputValue('');
|
|
@@ -139,8 +138,7 @@ const MultiSelectField = props => {
|
|
|
139
138
|
};
|
|
140
139
|
(0, _react.useEffect)(() => {
|
|
141
140
|
if (gridLayout) {
|
|
142
|
-
|
|
143
|
-
const currentGridEl = (_selectWrapper$curren = selectWrapper.current) === null || _selectWrapper$curren === void 0 ? void 0 : _selectWrapper$curren.parentElement;
|
|
141
|
+
const currentGridEl = selectWrapper.current?.parentElement;
|
|
144
142
|
if (currentGridEl) setElementStyles(window.getComputedStyle(currentGridEl));
|
|
145
143
|
}
|
|
146
144
|
window.addEventListener('resize', onScreenResize);
|
|
@@ -154,10 +152,10 @@ const MultiSelectField = props => {
|
|
|
154
152
|
}, []);
|
|
155
153
|
(0, _react.useEffect)(() => {
|
|
156
154
|
if (dataSource && dataSource.length > 0) {
|
|
157
|
-
const newSelecteds = dataSource.filter(item => value
|
|
155
|
+
const newSelecteds = dataSource.filter(item => value?.includes(item[idKey]));
|
|
158
156
|
setSelecteds(newSelecteds);
|
|
159
157
|
}
|
|
160
|
-
}, [value
|
|
158
|
+
}, [value?.length, dataSource?.length]);
|
|
161
159
|
(0, _react.useEffect)(() => {
|
|
162
160
|
if (dataSource && dataCombo && !_lodash.default.isEqual(dataSource, dataCombo)) {
|
|
163
161
|
const newDataCombo = (0, _helper.default)(_objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -42,7 +42,7 @@ const PeriodList = _ref => {
|
|
|
42
42
|
role: "button",
|
|
43
43
|
tabIndex: -1,
|
|
44
44
|
onKeyDown: () => {},
|
|
45
|
-
key:
|
|
45
|
+
key: `item-${item.id}`,
|
|
46
46
|
className: (0, _helper.getDropdownItemCssClass)(itemSelected),
|
|
47
47
|
onClick: () => {
|
|
48
48
|
const dates = item.id !== 'custom' ? (0, _helper.CalcDatesByPeriod)(item.id) : null;
|
|
@@ -12,7 +12,9 @@ const getCalendarDropdownStyle = _ref => {
|
|
|
12
12
|
leftPosition,
|
|
13
13
|
width
|
|
14
14
|
} = _ref;
|
|
15
|
-
return
|
|
15
|
+
return `top: ${topPosition}px;
|
|
16
|
+
left: ${leftPosition}px;
|
|
17
|
+
width:${width}px`;
|
|
16
18
|
};
|
|
17
19
|
var _default = exports.default = getCalendarDropdownStyle;
|
|
18
20
|
const getDropdownItemCssClass = function () {
|
|
@@ -60,8 +60,7 @@ const PeriodPicker = props => {
|
|
|
60
60
|
const dropdownPeriodContainer = (0, _react.useRef)(null);
|
|
61
61
|
const inputFinalRef = (0, _react.useRef)(null);
|
|
62
62
|
const onScreenResize = () => {
|
|
63
|
-
|
|
64
|
-
const inputDimensionsAux = inputContainerRef === null || inputContainerRef === void 0 ? void 0 : (_inputContainerRef$cu = inputContainerRef.current) === null || _inputContainerRef$cu === void 0 ? void 0 : _inputContainerRef$cu.getBoundingClientRect();
|
|
63
|
+
const inputDimensionsAux = inputContainerRef?.current?.getBoundingClientRect();
|
|
65
64
|
setInputDimensions(inputDimensionsAux);
|
|
66
65
|
};
|
|
67
66
|
const onClickOutside = event => {
|
|
@@ -164,12 +163,11 @@ const PeriodPicker = props => {
|
|
|
164
163
|
}
|
|
165
164
|
};
|
|
166
165
|
const setValue = function (event, value) {
|
|
167
|
-
var _inputInitialRef$curr, _inputFinalRef$curren;
|
|
168
166
|
let shouldOpenDropdown = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
169
167
|
const valueDateName = event ? event.target.name : '';
|
|
170
168
|
const dateObj = (0, _moment.default)(value, 'DD/MM/YYYY');
|
|
171
|
-
if (showCalendarValueInitial)
|
|
172
|
-
if (showCalendarValueFinal)
|
|
169
|
+
if (showCalendarValueInitial) inputInitialRef.current?.focus();
|
|
170
|
+
if (showCalendarValueFinal) inputFinalRef.current?.focus();
|
|
173
171
|
if (valueDateName === 'valueFinal' && valueInitial && dateObj.isBefore(valueInitial)) {
|
|
174
172
|
setValueInitial(dateObj);
|
|
175
173
|
setValueFinal(valueInitial);
|
|
@@ -198,8 +196,7 @@ const PeriodPicker = props => {
|
|
|
198
196
|
});
|
|
199
197
|
}
|
|
200
198
|
if (valueDateName === 'valueInitial' && !valueFinal && shouldOpenDropdown) {
|
|
201
|
-
|
|
202
|
-
(_inputFinalRef$curren2 = inputFinalRef.current) === null || _inputFinalRef$curren2 === void 0 ? void 0 : _inputFinalRef$curren2.focus();
|
|
199
|
+
inputFinalRef.current?.focus();
|
|
203
200
|
setTimeout(() => setShowCalendarValueFinal(true), 100);
|
|
204
201
|
}
|
|
205
202
|
if (shouldCloseOnSelect) {
|
|
@@ -222,8 +219,7 @@ const PeriodPicker = props => {
|
|
|
222
219
|
name: "calendar"
|
|
223
220
|
}),
|
|
224
221
|
onClick: () => {
|
|
225
|
-
|
|
226
|
-
(_inputInitialRef$curr2 = inputInitialRef.current) === null || _inputInitialRef$curr2 === void 0 ? void 0 : _inputInitialRef$curr2.focus();
|
|
222
|
+
inputInitialRef.current?.focus();
|
|
227
223
|
openCalendar('valueInitial');
|
|
228
224
|
},
|
|
229
225
|
customClass: "calendar-button",
|
|
@@ -274,8 +270,7 @@ const PeriodPicker = props => {
|
|
|
274
270
|
});
|
|
275
271
|
const setPeriodDates = (selected, dates) => {
|
|
276
272
|
if (selected === 'custom') {
|
|
277
|
-
|
|
278
|
-
(_inputInitialRef$curr3 = inputInitialRef.current) === null || _inputInitialRef$curr3 === void 0 ? void 0 : _inputInitialRef$curr3.focus();
|
|
273
|
+
inputInitialRef.current?.focus();
|
|
279
274
|
setValuePeriodSelection(selected);
|
|
280
275
|
setShowPeriodSelection(false);
|
|
281
276
|
return;
|
|
@@ -358,7 +353,7 @@ const PeriodPicker = props => {
|
|
|
358
353
|
display: 'flex'
|
|
359
354
|
}
|
|
360
355
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
361
|
-
className:
|
|
356
|
+
className: `label ${props.customClassForLabel} ${props.labelUppercase && ' -uppercase'}`,
|
|
362
357
|
style: {
|
|
363
358
|
alignSelf: 'center'
|
|
364
359
|
}
|
|
@@ -375,10 +370,10 @@ const PeriodPicker = props => {
|
|
|
375
370
|
width: 20
|
|
376
371
|
}
|
|
377
372
|
}, hint))), /*#__PURE__*/_react.default.createElement(_textContent.default, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
378
|
-
className:
|
|
373
|
+
className: `periodpicker-component ${helperBase.getInputWrapperClass(_objectSpread(_objectSpread({}, props), {}, {
|
|
379
374
|
value: !valueInitial ? '' : (0, _moment.default)(valueInitial).format('DD/MM/YYYY'),
|
|
380
375
|
disabled: shouldDisable()
|
|
381
|
-
}))
|
|
376
|
+
}))}`,
|
|
382
377
|
ref: inputContainerRef
|
|
383
378
|
}, /*#__PURE__*/_react.default.createElement(_BaseMask.default, {
|
|
384
379
|
permissionAttr: props.permissionAttr,
|
|
@@ -49,7 +49,7 @@ const SearchField = props => {
|
|
|
49
49
|
};
|
|
50
50
|
const shouldDisable = () => props.disabled || onDenied && (onDenied.disabled || onDenied.hideContent);
|
|
51
51
|
const shouldBeReadOnly = () => props.readOnly || onDenied && onDenied.readOnly;
|
|
52
|
-
const hideContent = onDenied
|
|
52
|
+
const hideContent = onDenied?.hideContent;
|
|
53
53
|
const buttonProps = () => {
|
|
54
54
|
const disableCallbacks = shouldBeReadOnly() || shouldDisable() || hideContent;
|
|
55
55
|
let propsButton = {
|
|
@@ -80,7 +80,7 @@ const Dropdown = props => {
|
|
|
80
80
|
const disabled = currents && currents.length > 0 ? currents.some(s => s[idKey] === item[idKey]) : false;
|
|
81
81
|
const itemSelected = Boolean(selected && selected[idKey] === item[idKey]);
|
|
82
82
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
83
|
-
key:
|
|
83
|
+
key: `dropdowmIten ${item[idKey]}}`,
|
|
84
84
|
className: helper.getDropdownItemCssClass(itemSelected, disabled, striped)
|
|
85
85
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
86
86
|
className: "menubutton",
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.returnDropdownDynamicStyles = exports.getFilteredSimpleDataCombo = exports.getFilteredMultipleDataCombo = exports.getDropdownItemCssClass = exports.contentClass = void 0;
|
|
7
|
-
const contentClass = props =>
|
|
7
|
+
const contentClass = props => `content ${props.showClearButton ? '' : 'noclear'}`;
|
|
8
8
|
exports.contentClass = contentClass;
|
|
9
9
|
const getDropdownItemCssClass = (selected, disabled, striped) => {
|
|
10
10
|
let className = 'item';
|
|
@@ -21,12 +21,10 @@ const getFilteredSimpleDataCombo = _ref => {
|
|
|
21
21
|
inputText
|
|
22
22
|
} = _ref;
|
|
23
23
|
return dataSource && dataSource.filter(item => {
|
|
24
|
-
var _descriptionKey;
|
|
25
24
|
if (typeof descriptionKey === 'string') {
|
|
26
|
-
|
|
27
|
-
return ((_item$descriptionKey = item[descriptionKey]) === null || _item$descriptionKey === void 0 ? void 0 : _item$descriptionKey.toLowerCase().indexOf(inputText === null || inputText === void 0 ? void 0 : inputText.toString().toLowerCase())) > -1;
|
|
25
|
+
return item[descriptionKey]?.toLowerCase().indexOf(inputText?.toString().toLowerCase()) > -1;
|
|
28
26
|
}
|
|
29
|
-
return
|
|
27
|
+
return descriptionKey(item)?.toLowerCase().indexOf(inputText?.toString().toLowerCase()) > -1;
|
|
30
28
|
});
|
|
31
29
|
};
|
|
32
30
|
exports.getFilteredSimpleDataCombo = getFilteredSimpleDataCombo;
|
|
@@ -38,11 +36,10 @@ const getFilteredMultipleDataCombo = _ref2 => {
|
|
|
38
36
|
currents
|
|
39
37
|
} = _ref2;
|
|
40
38
|
return dataSource.filter(item => {
|
|
41
|
-
var _descriptionKey2;
|
|
42
39
|
if (typeof descriptionKey === 'string') {
|
|
43
|
-
return item[descriptionKey].toLowerCase().indexOf(inputText
|
|
40
|
+
return item[descriptionKey].toLowerCase().indexOf(inputText?.toString().toLowerCase()) > -1 && !currents.includes(item);
|
|
44
41
|
}
|
|
45
|
-
return
|
|
42
|
+
return descriptionKey(item)?.toLowerCase().indexOf(inputText?.toString().toLowerCase()) > -1 && !currents.includes(item);
|
|
46
43
|
});
|
|
47
44
|
};
|
|
48
45
|
exports.getFilteredMultipleDataCombo = getFilteredMultipleDataCombo;
|
|
@@ -54,7 +51,7 @@ const returnDropdownPosition = function (_ref3) {
|
|
|
54
51
|
} = _ref3;
|
|
55
52
|
let aboveDropdown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
56
53
|
const DEFAULT_MARGIN_BOTTOM = 10;
|
|
57
|
-
if (aboveDropdown && dropdownRef
|
|
54
|
+
if (aboveDropdown && dropdownRef?.current && dropdownRects?.height) {
|
|
58
55
|
return selectFieldRects.top + window.scrollY - (dropdownRef.current && dropdownRects.height) - DEFAULT_MARGIN_BOTTOM;
|
|
59
56
|
}
|
|
60
57
|
return selectFieldRects.top + window.scrollY + selectFieldRects.height;
|
|
@@ -65,10 +62,10 @@ const returnDropdownDynamicStyles = _ref4 => {
|
|
|
65
62
|
dropdownMaxHeight,
|
|
66
63
|
dropdownRef
|
|
67
64
|
} = _ref4;
|
|
68
|
-
const selectFieldRects = selectFieldRef
|
|
69
|
-
const dropdownRects = dropdownRef
|
|
70
|
-
const selectFieldRectsBottom = selectFieldRects ? selectFieldRects
|
|
71
|
-
const selectFieldRectsTop = selectFieldRects ? selectFieldRects
|
|
65
|
+
const selectFieldRects = selectFieldRef?.current ? selectFieldRef.current.getBoundingClientRect() : undefined;
|
|
66
|
+
const dropdownRects = dropdownRef?.current ? dropdownRef.current.getBoundingClientRect() : undefined;
|
|
67
|
+
const selectFieldRectsBottom = selectFieldRects ? selectFieldRects?.bottom : 0;
|
|
68
|
+
const selectFieldRectsTop = selectFieldRects ? selectFieldRects?.top : 0;
|
|
72
69
|
const dropdownBottomDistance = window.innerHeight - selectFieldRectsBottom;
|
|
73
70
|
const bottomOffset = 30;
|
|
74
71
|
let maxDropdownBottomDistance = 200;
|
|
@@ -15,7 +15,7 @@ const Selecteds = _ref => {
|
|
|
15
15
|
} = _ref;
|
|
16
16
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, currents.map(selected => /*#__PURE__*/_react.default.createElement("div", {
|
|
17
17
|
className: "selecteditem",
|
|
18
|
-
key:
|
|
18
|
+
key: `selected-${selected[idKey]}`
|
|
19
19
|
}, typeof descriptionKey === 'string' ? selected[descriptionKey] : descriptionKey(selected), /*#__PURE__*/_react.default.createElement("button", {
|
|
20
20
|
className: "close",
|
|
21
21
|
tabIndex: -1,
|
|
@@ -40,7 +40,7 @@ const MultipleSelect = props => {
|
|
|
40
40
|
const [insideComponent, setInsideComponent] = (0, _react.useState)(false);
|
|
41
41
|
const [onDenied, setOnDeniedSelect] = (0, _react.useState)();
|
|
42
42
|
const [valueFromProps, setValueFromProps] = (0, _react.useState)([]);
|
|
43
|
-
const componentId =
|
|
43
|
+
const componentId = `select-component${uuid.v1()}`;
|
|
44
44
|
const componentRef = (0, _react.useRef)(null);
|
|
45
45
|
const dropdownRef = (0, _react.useRef)(null);
|
|
46
46
|
const selectWrapper = (0, _react.useRef)();
|
|
@@ -60,11 +60,10 @@ const MultipleSelect = props => {
|
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
const onMouseMove = event => {
|
|
63
|
-
var _dropdownRef$current, _dropdownRef$current$;
|
|
64
63
|
const target = event.target;
|
|
65
|
-
const idDropdown =
|
|
64
|
+
const idDropdown = dropdownRef.current?.parentElement?.id || '';
|
|
66
65
|
const dropdownElement = document.getElementById(idDropdown);
|
|
67
|
-
const keepDropdownOpen = Boolean(dropdownElement
|
|
66
|
+
const keepDropdownOpen = Boolean(dropdownElement?.contains(target));
|
|
68
67
|
setInsideComponent(keepDropdownOpen);
|
|
69
68
|
};
|
|
70
69
|
const onClearClick = () => {
|
|
@@ -101,7 +100,6 @@ const MultipleSelect = props => {
|
|
|
101
100
|
setDropdownWidth(dropdownWidthFocus);
|
|
102
101
|
};
|
|
103
102
|
const onSelect = select => {
|
|
104
|
-
var _dropdownRef$current2;
|
|
105
103
|
if (select === null) return;
|
|
106
104
|
const currentsSelect = [...currents, select];
|
|
107
105
|
setCurrents(currentsSelect);
|
|
@@ -109,17 +107,16 @@ const MultipleSelect = props => {
|
|
|
109
107
|
setInputValue([]);
|
|
110
108
|
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
111
109
|
if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(i => i[idKey])));
|
|
112
|
-
|
|
110
|
+
dropdownRef.current?.focus();
|
|
113
111
|
};
|
|
114
112
|
const onUnselect = id => {
|
|
115
113
|
if (currents) {
|
|
116
|
-
var _dropdownRef$current3;
|
|
117
114
|
const result = currents.filter(item => item[idKey] !== id);
|
|
118
115
|
setCurrents(result);
|
|
119
116
|
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
120
117
|
setOpened(false);
|
|
121
118
|
if (props.onSelect) setSelected(props.onSelect(result.map(i => i[idKey])));
|
|
122
|
-
|
|
119
|
+
dropdownRef.current?.focus();
|
|
123
120
|
}
|
|
124
121
|
};
|
|
125
122
|
const onOpenClose = () => {
|
|
@@ -136,11 +133,9 @@ const MultipleSelect = props => {
|
|
|
136
133
|
const onInputKeyDown = e => {
|
|
137
134
|
if (e.keyCode) {
|
|
138
135
|
if (e.keyCode === constants.keyCodes.ENTER && selected && opened) {
|
|
139
|
-
|
|
140
|
-
(_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
|
|
136
|
+
e.preventDefault?.();
|
|
141
137
|
if (!currents.some(current => current[idKey] === selected[idKey])) {
|
|
142
|
-
|
|
143
|
-
(_e$preventDefault2 = e.preventDefault) === null || _e$preventDefault2 === void 0 ? void 0 : _e$preventDefault2.call(e);
|
|
138
|
+
e.preventDefault?.();
|
|
144
139
|
onSelect(selected);
|
|
145
140
|
}
|
|
146
141
|
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
@@ -186,7 +181,7 @@ const MultipleSelect = props => {
|
|
|
186
181
|
}, []);
|
|
187
182
|
(0, _react.useEffect)(() => {
|
|
188
183
|
if (props.gridLayout) {
|
|
189
|
-
const gridEl = document.querySelector(
|
|
184
|
+
const gridEl = document.querySelector(`#${componentId}>.-withinput.grid-container`);
|
|
190
185
|
if (gridElRef.current !== gridEl && gridEl) gridElRef.current = gridEl;
|
|
191
186
|
}
|
|
192
187
|
}, []);
|
|
@@ -238,7 +233,7 @@ const MultipleSelect = props => {
|
|
|
238
233
|
},
|
|
239
234
|
onClick: onFocus,
|
|
240
235
|
onKeyDown: onInputKeyDown,
|
|
241
|
-
customClassForWrapper:
|
|
236
|
+
customClassForWrapper: `selectwrapper ${(props.readOnly || shouldDisable() || shouldBeReadOnly()) && ' -undigitable'}`,
|
|
242
237
|
customClassForInputContent: "multiselect",
|
|
243
238
|
inputBaseRef: r => {
|
|
244
239
|
selectWrapper.current = r;
|
|
@@ -51,7 +51,7 @@ const SimpleSelect = props => {
|
|
|
51
51
|
const [onDenied, setOnDeniedSelect] = (0, _react.useState)();
|
|
52
52
|
const [isTyping, setIsTyping] = (0, _react.useState)(false);
|
|
53
53
|
const dropdownRef = (0, _react.useRef)(null);
|
|
54
|
-
const componentId =
|
|
54
|
+
const componentId = `select-component-${name}-${uuid.v1()}`;
|
|
55
55
|
const componentRef = (0, _react.useRef)(null);
|
|
56
56
|
const selectWrapper = (0, _react.useRef)();
|
|
57
57
|
const gridElement = (0, _react.useRef)();
|
|
@@ -60,20 +60,18 @@ const SimpleSelect = props => {
|
|
|
60
60
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
61
61
|
};
|
|
62
62
|
const onClickOutside = event => {
|
|
63
|
-
var _selectWrapper$curren, _dropdownRef$current;
|
|
64
63
|
const {
|
|
65
64
|
target
|
|
66
65
|
} = event;
|
|
67
|
-
if (target !== selectWrapper.current && !
|
|
66
|
+
if (target !== selectWrapper.current && !selectWrapper.current?.contains(target) && !dropdownRef.current?.contains(target)) {
|
|
68
67
|
setOpened(false);
|
|
69
68
|
}
|
|
70
69
|
};
|
|
71
70
|
const onMouseMove = event => {
|
|
72
|
-
var _dropdownRef$current2, _dropdownRef$current3;
|
|
73
71
|
const target = event.target;
|
|
74
|
-
const idDropdown =
|
|
72
|
+
const idDropdown = dropdownRef.current?.parentElement?.id || '';
|
|
75
73
|
const dropdownElement = document.getElementById(idDropdown);
|
|
76
|
-
const keepDropdownOpen = Boolean(dropdownElement
|
|
74
|
+
const keepDropdownOpen = Boolean(dropdownElement?.contains(target));
|
|
77
75
|
setInsideComponent(keepDropdownOpen);
|
|
78
76
|
};
|
|
79
77
|
const getSelectEvent = selectedEvent => ({
|
|
@@ -113,7 +111,6 @@ const SimpleSelect = props => {
|
|
|
113
111
|
}
|
|
114
112
|
};
|
|
115
113
|
const onSelect = selectedDropdown => {
|
|
116
|
-
var _dropdownRef$current4;
|
|
117
114
|
if (!selectedDropdown) return;
|
|
118
115
|
setSelected(selectedDropdown);
|
|
119
116
|
if (descriptionKeyIsString) setInputText(selectedDropdown[descriptionKey]);else setInputText(descriptionKey(selectedDropdown));
|
|
@@ -123,7 +120,7 @@ const SimpleSelect = props => {
|
|
|
123
120
|
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
124
121
|
setOpened(false);
|
|
125
122
|
});
|
|
126
|
-
|
|
123
|
+
dropdownRef.current?.focus();
|
|
127
124
|
};
|
|
128
125
|
const onOpenClose = () => {
|
|
129
126
|
setOpened(prevState => !prevState);
|
|
@@ -159,8 +156,7 @@ const SimpleSelect = props => {
|
|
|
159
156
|
const onInputKeyDown = e => {
|
|
160
157
|
if (e.keyCode) {
|
|
161
158
|
if (e.keyCode === constants.keyCodes.ENTER && selected && opened) {
|
|
162
|
-
|
|
163
|
-
(_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
|
|
159
|
+
e.preventDefault?.();
|
|
164
160
|
onSelect(selected);
|
|
165
161
|
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
166
162
|
if (!opened) setOpened(true);
|
|
@@ -168,7 +164,7 @@ const SimpleSelect = props => {
|
|
|
168
164
|
if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
|
|
169
165
|
index = dataCombo && index === dataCombo.length - 1 ? 0 : index + 1;
|
|
170
166
|
} else {
|
|
171
|
-
index = dataCombo && index === 0 ?
|
|
167
|
+
index = dataCombo && index === 0 ? dataCombo?.length - 1 : index - 1;
|
|
172
168
|
}
|
|
173
169
|
setSelected(dataCombo[index]);
|
|
174
170
|
if (descriptionKeyIsString) setInputText(dataCombo[index][descriptionKey]);
|
|
@@ -205,7 +201,7 @@ const SimpleSelect = props => {
|
|
|
205
201
|
}, []);
|
|
206
202
|
(0, _react.useEffect)(() => {
|
|
207
203
|
if (gridLayout) {
|
|
208
|
-
const gridEl = document.querySelector(
|
|
204
|
+
const gridEl = document.querySelector(`#${componentId}>.-withinput.grid-container`);
|
|
209
205
|
if (gridElement.current !== gridEl && gridEl) gridElement.current = gridEl;
|
|
210
206
|
}
|
|
211
207
|
}, [gridLayout]);
|
|
@@ -213,10 +209,7 @@ const SimpleSelect = props => {
|
|
|
213
209
|
if (dataSourceWithAllOptions.length > 0) {
|
|
214
210
|
let newCurrent = null;
|
|
215
211
|
if (value || value === 0) {
|
|
216
|
-
newCurrent = dataSourceWithAllOptions.find(i =>
|
|
217
|
-
var _i$idKey;
|
|
218
|
-
return (value || value === 0) && ((_i$idKey = i[idKey]) === null || _i$idKey === void 0 ? void 0 : _i$idKey.toString().toLowerCase()) === (value === null || value === void 0 ? void 0 : value.toString().toLowerCase());
|
|
219
|
-
});
|
|
212
|
+
newCurrent = dataSourceWithAllOptions.find(i => (value || value === 0) && i[idKey]?.toString().toLowerCase() === value?.toString().toLowerCase());
|
|
220
213
|
} else if (dataSourceWithAllOptions.length > 0 && selectFirstOnEnter) {
|
|
221
214
|
newCurrent = dataSourceWithAllOptions[0];
|
|
222
215
|
}
|
|
@@ -269,7 +262,7 @@ const SimpleSelect = props => {
|
|
|
269
262
|
},
|
|
270
263
|
onClick: onFocus,
|
|
271
264
|
onKeyDown: onInputKeyDown,
|
|
272
|
-
customClassForWrapper:
|
|
265
|
+
customClassForWrapper: `selectwrapper ${(undigitable || searchOnDropdown || shouldBeReadOnly()) && ' -undigitable'}`,
|
|
273
266
|
customClassForInputContent: "multiselect",
|
|
274
267
|
inputBaseRef: r => {
|
|
275
268
|
selectWrapper.current = r;
|
|
@@ -87,23 +87,23 @@ const withTooltip = WrappedComponent => {
|
|
|
87
87
|
const targetDimensions = targetElement.current.getBoundingClientRect();
|
|
88
88
|
const targetVerticalCenter = (targetDimensions.top + targetDimensions.bottom) / 2;
|
|
89
89
|
const tooltipClientWidth = tooltipElement.current.clientWidth;
|
|
90
|
-
let style =
|
|
90
|
+
let style = `width: ${typeof width === 'string' ? width : `${width}px`}`;
|
|
91
91
|
let left = targetDimensions.left + targetDimensions.width / 2 - tooltipClientWidth / 2;
|
|
92
92
|
left = Math.min(left, document.body.clientWidth - tooltipClientWidth - space);
|
|
93
|
-
style +=
|
|
93
|
+
style += `; left: ${Math.max(space, left)}px`;
|
|
94
94
|
switch (stateTooltipPosition) {
|
|
95
95
|
case 'top':
|
|
96
96
|
if (targetDimensions.top < height) {
|
|
97
97
|
setStateTooltipPosition('bottom');
|
|
98
98
|
} else {
|
|
99
|
-
style +=
|
|
99
|
+
style += `; top: ${targetDimensions.top + window.scrollY - height - 5}px`;
|
|
100
100
|
}
|
|
101
101
|
break;
|
|
102
102
|
case 'bottom':
|
|
103
103
|
if (window.innerHeight - targetDimensions.bottom < height) {
|
|
104
104
|
setStateTooltipPosition('top');
|
|
105
105
|
} else {
|
|
106
|
-
style +=
|
|
106
|
+
style += `; top: ${targetDimensions.top + window.scrollY + targetDimensions.height + 5}px`;
|
|
107
107
|
}
|
|
108
108
|
break;
|
|
109
109
|
case 'left':
|
|
@@ -114,16 +114,16 @@ const withTooltip = WrappedComponent => {
|
|
|
114
114
|
setStateTooltipPosition('right');
|
|
115
115
|
}
|
|
116
116
|
} else {
|
|
117
|
-
style +=
|
|
118
|
-
style +=
|
|
117
|
+
style += `; top: ${targetVerticalCenter + window.scrollY - height / 2}px`;
|
|
118
|
+
style += `; left: ${targetDimensions.left - tooltipClientWidth - 6}px`;
|
|
119
119
|
}
|
|
120
120
|
break;
|
|
121
121
|
case 'right':
|
|
122
122
|
if (window.innerWidth - targetDimensions.right < tooltipClientWidth) {
|
|
123
123
|
setStateTooltipPosition('left');
|
|
124
124
|
} else {
|
|
125
|
-
style +=
|
|
126
|
-
style +=
|
|
125
|
+
style += `; top: ${targetVerticalCenter + window.scrollY - height / 2}px`;
|
|
126
|
+
style += `; left: ${targetDimensions.left + targetDimensions.width + 5}px`;
|
|
127
127
|
}
|
|
128
128
|
break;
|
|
129
129
|
default:
|
|
@@ -166,7 +166,7 @@ const withTooltip = WrappedComponent => {
|
|
|
166
166
|
targetRef: getTarget
|
|
167
167
|
})), showTooltip && getTooltip());
|
|
168
168
|
};
|
|
169
|
-
EnhancedComponent.displayName =
|
|
169
|
+
EnhancedComponent.displayName = `withTooltip(${getDisplayName(WrappedComponent)})`;
|
|
170
170
|
return EnhancedComponent;
|
|
171
171
|
};
|
|
172
172
|
var _default = exports.default = withTooltip;
|
|
@@ -25,7 +25,8 @@ const LabelMessages = _ref => {
|
|
|
25
25
|
showCloseButton = false
|
|
26
26
|
} = _ref;
|
|
27
27
|
const [closed, setClosed] = (0, _react.useState)(false);
|
|
28
|
-
const getClass = () =>
|
|
28
|
+
const getClass = () => `labelmessages-component -${type} ${customClass}
|
|
29
|
+
${square && '-square'} ${flat && '-flat'}`;
|
|
29
30
|
const getIcon = () => {
|
|
30
31
|
if (icon) {
|
|
31
32
|
return icon;
|
|
@@ -34,14 +35,14 @@ const LabelMessages = _ref => {
|
|
|
34
35
|
name: iconName,
|
|
35
36
|
size: 16,
|
|
36
37
|
color: "#ffffff",
|
|
37
|
-
customClass:
|
|
38
|
+
customClass: `-${type}svg`
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
return null;
|
|
41
42
|
};
|
|
42
43
|
if (closed || !visible) return null;
|
|
43
44
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
44
|
-
className:
|
|
45
|
+
className: `${getClass()} ${customClass}`,
|
|
45
46
|
style: style
|
|
46
47
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
47
48
|
className: "labelmessagesitem text"
|
|
@@ -30,7 +30,10 @@ const DefaultLabel = _ref => {
|
|
|
30
30
|
} = _ref;
|
|
31
31
|
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
|
|
32
32
|
const [onDenied] = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr));
|
|
33
|
-
const getClass = () =>
|
|
33
|
+
const getClass = () => `label-component ${className} ${customClass} ${bordered ? '-bordered' : ''} ${disabled ? '-disabled' : ''}
|
|
34
|
+
${skeletonize ? '-skeletonized' : ''}
|
|
35
|
+
${size ? `-${size}` : ''}
|
|
36
|
+
${iconAlign ? `icon-${iconAlign}` : ''}`;
|
|
34
37
|
const getIcon = () => {
|
|
35
38
|
if (icon) {
|
|
36
39
|
return icon;
|
package/lib/list/Header.js
CHANGED
|
@@ -14,7 +14,7 @@ const Header = _ref => {
|
|
|
14
14
|
customClass
|
|
15
15
|
} = _ref;
|
|
16
16
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
17
|
-
className:
|
|
17
|
+
className: `list-header ${customClass}`,
|
|
18
18
|
style: style
|
|
19
19
|
}, /*#__PURE__*/_react.default.createElement("h1", {
|
|
20
20
|
className: "title"
|
package/lib/list/Item.js
CHANGED
|
@@ -60,7 +60,8 @@ const Item = props => {
|
|
|
60
60
|
const disabledByPermission = onDenied.disabled;
|
|
61
61
|
const shouldDisable = () => disabled || onDenied.disabled;
|
|
62
62
|
const disabledIconColor = 'rgb(193, 193, 193)';
|
|
63
|
-
const getClass = () =>
|
|
63
|
+
const getClass = () => `item ${customClass} ${separator && 'list-separator'} ${shouldDisable() && 'disabled'}
|
|
64
|
+
${displayCheckbox && 'list-checkbox'}`;
|
|
64
65
|
const getIcon = (iconName, icon) => {
|
|
65
66
|
const noIconDisabledByPermission = !icon && !displayCheckbox && !leftElement && !leftIconName && !leftIcon && onDenied.disabled;
|
|
66
67
|
if (icon) {
|
|
@@ -131,22 +132,23 @@ const Item = props => {
|
|
|
131
132
|
return itemId && selectedItemId === itemId ? selectedItemRef : null;
|
|
132
133
|
},
|
|
133
134
|
style: style,
|
|
134
|
-
className:
|
|
135
|
+
className: `item-container ${hovered && 'hovered'}
|
|
136
|
+
${itemId && selectedItemId === itemId ? '-activedlist' : ''}`
|
|
135
137
|
}, getProps(), {
|
|
136
138
|
key: itemId
|
|
137
139
|
}), url && !shouldDisable() && /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
|
|
138
140
|
className: "linkitem",
|
|
139
141
|
to: url
|
|
140
142
|
}), (displayCheckbox || leftElement || leftIconName || leftIcon) && /*#__PURE__*/_react.default.createElement("div", {
|
|
141
|
-
className:
|
|
143
|
+
className: `${getClass()} -icon-left`
|
|
142
144
|
}, renderCheckBox, leftElement, getIcon(leftIconName, leftIcon)), (text || subText || children) && /*#__PURE__*/_react.default.createElement("div", {
|
|
143
|
-
className:
|
|
145
|
+
className: `${getClass()}`
|
|
144
146
|
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
145
|
-
className:
|
|
147
|
+
className: `${text && 'text'}`
|
|
146
148
|
}, text), /*#__PURE__*/_react.default.createElement("p", {
|
|
147
|
-
className:
|
|
149
|
+
className: `${subText && 'subtext'}`
|
|
148
150
|
}, subText), children), (rightIconName || rightIcon || rightElement || disabledByPermission) && /*#__PURE__*/_react.default.createElement("div", {
|
|
149
|
-
className:
|
|
151
|
+
className: `${getClass()} -icon-right`
|
|
150
152
|
}, getIcon(rightIconName, rightIcon), rightElement));
|
|
151
153
|
};
|
|
152
154
|
var _default = exports.default = (0, _withTooltip.default)(Item);
|
package/lib/list/index.js
CHANGED
|
@@ -175,7 +175,8 @@ const List = props => {
|
|
|
175
175
|
"data-testid": "list-component",
|
|
176
176
|
style: style,
|
|
177
177
|
ref: listRef,
|
|
178
|
-
className:
|
|
178
|
+
className: `list-component ${condensed && '-condensed'}
|
|
179
|
+
${customClass} ${!transparent && '-listbackground'}`
|
|
179
180
|
}, newChildren));
|
|
180
181
|
};
|
|
181
182
|
var _default = exports.default = List;
|
|
@@ -29,7 +29,7 @@ const MenuItem = _ref => {
|
|
|
29
29
|
const dropdownContext = (0, _react.useContext)(_withDropdown.WithDropdownContext);
|
|
30
30
|
const handleOnClick = () => {
|
|
31
31
|
if (onClick) {
|
|
32
|
-
onClick(dropdownContext
|
|
32
|
+
onClick(dropdownContext?.handleDropdownClose);
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
if (dropdownContext) dropdownContext.handleDropdownClose();
|
|
@@ -37,7 +37,7 @@ const MenuItem = _ref => {
|
|
|
37
37
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
38
38
|
className: "floatmenuitem"
|
|
39
39
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
-
className:
|
|
40
|
+
className: `${customClassMenuItem} -items`
|
|
41
41
|
}, !_lodash.default.isEmpty(dropdownMenu) && !onClick && /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
42
42
|
customClass: "floatmenudropdown",
|
|
43
43
|
iconName: "more1",
|