linear-react-components-ui 1.1.20-beta.15 → 1.1.20-beta.16
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/input.scss +2 -2
- package/lib/assets/styles/popover.scss +3 -0
- package/lib/assets/styles/wizard.scss +1 -3
- 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 +11 -2
- 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 +46 -19
- package/lib/checkbox/types.d.ts +4 -0
- package/lib/dialog/Custom.js +1 -1
- package/lib/dialog/base/Content.js +1 -1
- package/lib/dialog/base/Header.js +2 -2
- package/lib/dialog/base/index.js +3 -4
- package/lib/dialog/form/index.js +1 -1
- package/lib/dialog/types.d.ts +0 -2
- package/lib/dialog/wizard/index.d.ts +1 -1
- package/lib/dialog/wizard/index.js +4 -8
- 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/form/types.d.ts +14 -1
- 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 +39 -15
- package/lib/inputs/base/Label.js +1 -1
- package/lib/inputs/base/helpers.js +7 -3
- package/lib/inputs/base/types.d.ts +3 -0
- package/lib/inputs/color/types.d.ts +5 -0
- package/lib/inputs/date/helpers.js +4 -1
- package/lib/inputs/date/index.js +9 -15
- package/lib/inputs/date/types.d.ts +4 -0
- package/lib/inputs/errorMessage/index.js +1 -1
- package/lib/inputs/file/DefaultFile.js +5 -6
- package/lib/inputs/file/DragDropFile.js +17 -18
- package/lib/inputs/file/File.js +3 -4
- package/lib/inputs/file/types.d.ts +3 -0
- package/lib/inputs/mask/BaseMask.js +1 -1
- package/lib/inputs/mask/helpers.d.ts +4 -0
- package/lib/inputs/mask/types.d.ts +4 -0
- 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/multiSelect/types.d.ts +4 -0
- package/lib/inputs/number/BaseNumber.d.ts +1 -1
- package/lib/inputs/number/Currency.d.ts +1 -1
- package/lib/inputs/number/Decimal.d.ts +1 -1
- package/lib/inputs/number/index.d.ts +1 -1
- package/lib/inputs/number/index.js +7 -3
- package/lib/inputs/number/types.d.ts +14 -2
- package/lib/inputs/period/PeriodList.js +1 -1
- package/lib/inputs/period/helper.js +3 -1
- package/lib/inputs/period/index.js +40 -18
- package/lib/inputs/period/types.d.ts +3 -0
- 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 +18 -16
- package/lib/inputs/select/simple/index.js +10 -17
- package/lib/inputs/select/types.d.ts +6 -0
- 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 +3 -2
- 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 +4 -6
- package/lib/popover/types.d.ts +2 -1
- package/lib/progress/Bar.js +6 -6
- package/lib/radio/index.d.ts +1 -1
- package/lib/radio/index.js +34 -3
- package/lib/radio/types.d.ts +6 -0
- 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.d.ts +18 -4
- package/lib/textContent/index.js +15 -5
- 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.js +8 -8
- package/lib/treeview/Header.js +1 -1
- package/lib/treeview/Node.js +5 -5
- package/lib/treeview/index.js +4 -4
- package/lib/uitour/index.js +6 -8
- package/package.json +1 -1
- package/lib/checkbox/Label.d.ts +0 -11
- package/lib/checkbox/Label.js +0 -31
|
@@ -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,
|
|
@@ -13,6 +13,7 @@ var _Selecteds = _interopRequireDefault(require("./Selecteds"));
|
|
|
13
13
|
var constants = _interopRequireWildcard(require("../../../internals/constants"));
|
|
14
14
|
var _InputTextBase = _interopRequireDefault(require("../../base/InputTextBase"));
|
|
15
15
|
var _helper = require("../helper");
|
|
16
|
+
var _hint = _interopRequireDefault(require("../../../hint"));
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -26,7 +27,9 @@ const MultipleSelect = props => {
|
|
|
26
27
|
remoteSearch = false,
|
|
27
28
|
descriptionKey,
|
|
28
29
|
showClearButton,
|
|
29
|
-
rightElements = []
|
|
30
|
+
rightElements = [],
|
|
31
|
+
hint,
|
|
32
|
+
hintPosition = 'below'
|
|
30
33
|
} = props;
|
|
31
34
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
32
35
|
const [currents, setCurrents] = (0, _react.useState)([]);
|
|
@@ -37,7 +40,7 @@ const MultipleSelect = props => {
|
|
|
37
40
|
const [insideComponent, setInsideComponent] = (0, _react.useState)(false);
|
|
38
41
|
const [onDenied, setOnDeniedSelect] = (0, _react.useState)();
|
|
39
42
|
const [valueFromProps, setValueFromProps] = (0, _react.useState)([]);
|
|
40
|
-
const componentId =
|
|
43
|
+
const componentId = `select-component${uuid.v1()}`;
|
|
41
44
|
const componentRef = (0, _react.useRef)(null);
|
|
42
45
|
const dropdownRef = (0, _react.useRef)(null);
|
|
43
46
|
const selectWrapper = (0, _react.useRef)();
|
|
@@ -57,11 +60,10 @@ const MultipleSelect = props => {
|
|
|
57
60
|
}
|
|
58
61
|
};
|
|
59
62
|
const onMouseMove = event => {
|
|
60
|
-
var _dropdownRef$current, _dropdownRef$current$;
|
|
61
63
|
const target = event.target;
|
|
62
|
-
const idDropdown =
|
|
64
|
+
const idDropdown = dropdownRef.current?.parentElement?.id || '';
|
|
63
65
|
const dropdownElement = document.getElementById(idDropdown);
|
|
64
|
-
const keepDropdownOpen = Boolean(dropdownElement
|
|
66
|
+
const keepDropdownOpen = Boolean(dropdownElement?.contains(target));
|
|
65
67
|
setInsideComponent(keepDropdownOpen);
|
|
66
68
|
};
|
|
67
69
|
const onClearClick = () => {
|
|
@@ -98,7 +100,6 @@ const MultipleSelect = props => {
|
|
|
98
100
|
setDropdownWidth(dropdownWidthFocus);
|
|
99
101
|
};
|
|
100
102
|
const onSelect = select => {
|
|
101
|
-
var _dropdownRef$current2;
|
|
102
103
|
if (select === null) return;
|
|
103
104
|
const currentsSelect = [...currents, select];
|
|
104
105
|
setCurrents(currentsSelect);
|
|
@@ -106,17 +107,16 @@ const MultipleSelect = props => {
|
|
|
106
107
|
setInputValue([]);
|
|
107
108
|
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
108
109
|
if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(i => i[idKey])));
|
|
109
|
-
|
|
110
|
+
dropdownRef.current?.focus();
|
|
110
111
|
};
|
|
111
112
|
const onUnselect = id => {
|
|
112
113
|
if (currents) {
|
|
113
|
-
var _dropdownRef$current3;
|
|
114
114
|
const result = currents.filter(item => item[idKey] !== id);
|
|
115
115
|
setCurrents(result);
|
|
116
116
|
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
117
117
|
setOpened(false);
|
|
118
118
|
if (props.onSelect) setSelected(props.onSelect(result.map(i => i[idKey])));
|
|
119
|
-
|
|
119
|
+
dropdownRef.current?.focus();
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
const onOpenClose = () => {
|
|
@@ -133,11 +133,9 @@ const MultipleSelect = props => {
|
|
|
133
133
|
const onInputKeyDown = e => {
|
|
134
134
|
if (e.keyCode) {
|
|
135
135
|
if (e.keyCode === constants.keyCodes.ENTER && selected && opened) {
|
|
136
|
-
|
|
137
|
-
(_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
|
|
136
|
+
e.preventDefault?.();
|
|
138
137
|
if (!currents.some(current => current[idKey] === selected[idKey])) {
|
|
139
|
-
|
|
140
|
-
(_e$preventDefault2 = e.preventDefault) === null || _e$preventDefault2 === void 0 ? void 0 : _e$preventDefault2.call(e);
|
|
138
|
+
e.preventDefault?.();
|
|
141
139
|
onSelect(selected);
|
|
142
140
|
}
|
|
143
141
|
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
@@ -183,7 +181,7 @@ const MultipleSelect = props => {
|
|
|
183
181
|
}, []);
|
|
184
182
|
(0, _react.useEffect)(() => {
|
|
185
183
|
if (props.gridLayout) {
|
|
186
|
-
const gridEl = document.querySelector(
|
|
184
|
+
const gridEl = document.querySelector(`#${componentId}>.-withinput.grid-container`);
|
|
187
185
|
if (gridElRef.current !== gridEl && gridEl) gridElRef.current = gridEl;
|
|
188
186
|
}
|
|
189
187
|
}, []);
|
|
@@ -235,7 +233,7 @@ const MultipleSelect = props => {
|
|
|
235
233
|
},
|
|
236
234
|
onClick: onFocus,
|
|
237
235
|
onKeyDown: onInputKeyDown,
|
|
238
|
-
customClassForWrapper:
|
|
236
|
+
customClassForWrapper: `selectwrapper ${(props.readOnly || shouldDisable() || shouldBeReadOnly()) && ' -undigitable'}`,
|
|
239
237
|
customClassForInputContent: "multiselect",
|
|
240
238
|
inputBaseRef: r => {
|
|
241
239
|
selectWrapper.current = r;
|
|
@@ -269,6 +267,10 @@ const MultipleSelect = props => {
|
|
|
269
267
|
dataCombo: dataCombo,
|
|
270
268
|
currents: currents,
|
|
271
269
|
dropdownWidth: dropdownWidth || 0
|
|
272
|
-
}))
|
|
270
|
+
})), /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
271
|
+
visible: !!hint && hintPosition === 'below',
|
|
272
|
+
customClass: "hint",
|
|
273
|
+
description: hint
|
|
274
|
+
}));
|
|
273
275
|
};
|
|
274
276
|
var _default = exports.default = MultipleSelect;
|
|
@@ -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;
|
|
@@ -51,6 +51,9 @@ interface ISimpleSelectProps {
|
|
|
51
51
|
allOptions?: AllOptions;
|
|
52
52
|
inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
|
|
53
53
|
rightElements?: JSX.Element[];
|
|
54
|
+
hintPosition?: 'below' | 'onLabelRight';
|
|
55
|
+
themePopover?: 'light' | 'dark';
|
|
56
|
+
popoverAlign?: 'right' | 'left';
|
|
54
57
|
}
|
|
55
58
|
interface ISelectFieldProps extends Omit<ISimpleSelectProps, 'idKey' | 'value' | 'descriptionKey'> {
|
|
56
59
|
multiple?: boolean;
|
|
@@ -91,6 +94,9 @@ interface IMultipleSelectProps extends Omit<ISimpleSelectProps, 'idKey' | 'value
|
|
|
91
94
|
handlerClear?: () => void;
|
|
92
95
|
disabled?: boolean;
|
|
93
96
|
gridLayout?: string;
|
|
97
|
+
hintPosition?: 'below' | 'onLabelRight';
|
|
98
|
+
themePopover?: 'light' | 'dark';
|
|
99
|
+
popoverAlign?: 'right' | 'left';
|
|
94
100
|
}
|
|
95
101
|
interface ISelectedsMultipleProps {
|
|
96
102
|
idKey: string;
|
|
@@ -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
|
@@ -36,7 +36,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
36
36
|
const List = props => {
|
|
37
37
|
const {
|
|
38
38
|
children,
|
|
39
|
-
customClass
|
|
39
|
+
customClass,
|
|
40
40
|
condensed,
|
|
41
41
|
transparent,
|
|
42
42
|
style,
|
|
@@ -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",
|
|
@@ -46,7 +46,7 @@ const SubMenuContainer = _ref => {
|
|
|
46
46
|
handlerGoBack();
|
|
47
47
|
}, []);
|
|
48
48
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
-
className:
|
|
49
|
+
className: `floatsubmenu ${customClass}`
|
|
50
50
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
51
51
|
className: "submenuheader"
|
|
52
52
|
}, /*#__PURE__*/_react.default.createElement(_icons.default, {
|
package/lib/menus/float/index.js
CHANGED
|
@@ -47,7 +47,7 @@ const FloatMenu = props => {
|
|
|
47
47
|
return /*#__PURE__*/_react.default.createElement(_helpers.default.Provider, {
|
|
48
48
|
value: contextValues
|
|
49
49
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
50
|
-
className:
|
|
50
|
+
className: `floatmenu-component ${customClass}`
|
|
51
51
|
}, /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
52
52
|
transparent: true,
|
|
53
53
|
key: "button-",
|
|
@@ -14,7 +14,7 @@ const ExpandMenu = _ref => {
|
|
|
14
14
|
iconName
|
|
15
15
|
} = _ref;
|
|
16
16
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
17
|
-
className:
|
|
17
|
+
className: `openclosemenu ${expandMenuCustomClass}`,
|
|
18
18
|
role: "button",
|
|
19
19
|
tabIndex: 0,
|
|
20
20
|
onClick: onExpandMenu,
|
|
@@ -20,7 +20,7 @@ const NavMenuGroup = _ref => {
|
|
|
20
20
|
} = (0, _react.useContext)(_helpers.SideNavContext);
|
|
21
21
|
return /*#__PURE__*/_react.default.createElement("ul", {
|
|
22
22
|
style: style,
|
|
23
|
-
className:
|
|
23
|
+
className: `${scrollable && 'customscroll'} ${(0, _helpers.default)(isExpanded, menuSize)}`
|
|
24
24
|
}, children);
|
|
25
25
|
};
|
|
26
26
|
var _default = exports.default = NavMenuGroup;
|
|
@@ -76,19 +76,17 @@ const NavMenuItem = props => {
|
|
|
76
76
|
(0, _react.useEffect)(() => {
|
|
77
77
|
if (showSubMenu && showDropdownOnClick) {
|
|
78
78
|
document.addEventListener('click', e => {
|
|
79
|
-
var _menuItemRef$current;
|
|
80
79
|
const target = e.target;
|
|
81
|
-
const insideMenu =
|
|
80
|
+
const insideMenu = menuItemRef.current?.contains(target);
|
|
82
81
|
if (!insideMenu) setShowSubMenu(false);
|
|
83
82
|
});
|
|
84
83
|
}
|
|
85
84
|
}, [showSubMenu, showDropdownOnClick]);
|
|
86
85
|
(0, _react.useEffect)(() => {
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
const heigthSubmenuContent = ((_submenuContentRef$cu = submenuContentRef.current) === null || _submenuContentRef$cu === void 0 ? void 0 : _submenuContentRef$cu.clientHeight) || 0;
|
|
86
|
+
const heigthSubmenuContainer = submenuContainerRef.current?.clientHeight || 0;
|
|
87
|
+
const heigthSubmenuContent = submenuContentRef.current?.clientHeight || 0;
|
|
90
88
|
const maxHeigthSubMenu = isOnEndWindow ? '100%' : (window.innerHeight - targetDimensions.top - (heigthSubmenuContainer - heigthSubmenuContent) - 1).toString().concat('px') || '0px';
|
|
91
|
-
|
|
89
|
+
submenuContentRef.current?.style.setProperty('max-height', maxHeigthSubMenu);
|
|
92
90
|
}, [showSubMenu]);
|
|
93
91
|
if (unvisible) return null;
|
|
94
92
|
return /*#__PURE__*/_react.default.createElement(_helpers.SubMenuContext.Provider, {
|
|
@@ -99,7 +97,7 @@ const NavMenuItem = props => {
|
|
|
99
97
|
menuItemRef.current = r;
|
|
100
98
|
if (targetRef) targetRef(r);
|
|
101
99
|
},
|
|
102
|
-
className:
|
|
100
|
+
className: `item ${url && !disabled && '-withlink'} ${customClass} ${disabled && '-disabled'}`,
|
|
103
101
|
onMouseEnter: onMouseEnter,
|
|
104
102
|
onMouseLeave: () => {
|
|
105
103
|
if (showDropdownOnClick) return;
|
|
@@ -123,7 +121,7 @@ const NavMenuItem = props => {
|
|
|
123
121
|
className: "title"
|
|
124
122
|
}, title), !childrenIsSubMenu && children)), showSubMenu && children && childrenIsSubMenu && !disabled && !openSearchMenuPopup && /*#__PURE__*/_react.default.createElement("div", {
|
|
125
123
|
ref: submenuContainerRef,
|
|
126
|
-
className:
|
|
124
|
+
className: `${customClassForDropdown} ${disableDefaultStyle ? '' : 'submenu-container'}`,
|
|
127
125
|
style: isOnEndWindow ? {
|
|
128
126
|
marginLeft: targetDimensions.width,
|
|
129
127
|
bottom: '0',
|
|
@@ -141,7 +139,7 @@ const NavMenuItem = props => {
|
|
|
141
139
|
ref: submenuContentRef,
|
|
142
140
|
className: "submenu",
|
|
143
141
|
style: {
|
|
144
|
-
gridTemplateColumns:
|
|
142
|
+
gridTemplateColumns: `repeat(${columnsQtty}, 1fr)`
|
|
145
143
|
}
|
|
146
144
|
}, children))));
|
|
147
145
|
};
|
|
@@ -28,7 +28,7 @@ const NavSubMenuItem = _ref => {
|
|
|
28
28
|
} = onDenied;
|
|
29
29
|
if (unvisible) return null;
|
|
30
30
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
31
|
-
className:
|
|
31
|
+
className: `item hvr-forward ${disabled && '-disabled'}`,
|
|
32
32
|
onKeyDown: () => {},
|
|
33
33
|
role: "button",
|
|
34
34
|
tabIndex: -1,
|
|
@@ -9,7 +9,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
9
9
|
const getCssClassMenu = (isExpanded, size) => {
|
|
10
10
|
let cssClass = 'expandedmenu';
|
|
11
11
|
if (!isExpanded) {
|
|
12
|
-
cssClass =
|
|
12
|
+
cssClass = `collapsedmenu -${size}`;
|
|
13
13
|
}
|
|
14
14
|
return cssClass;
|
|
15
15
|
};
|