linear-react-components-ui 1.1.2-beta.9 → 1.1.2
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/.eslintcache +1 -0
- package/.gitlab-ci.yml +1 -0
- package/.vscode/settings.json +10 -1
- package/lib/@types/Align.d.ts +1 -1
- package/lib/@types/ButtonTypes.d.ts +1 -1
- package/lib/@types/ColorStyles.d.ts +1 -1
- package/lib/@types/DataCombo.d.ts +1 -1
- package/lib/@types/Icon.d.ts +1 -1
- package/lib/@types/LabelStyles.d.ts +1 -1
- package/lib/@types/Period.d.ts +1 -1
- package/lib/@types/PermissionAttr.d.ts +1 -1
- package/lib/@types/PointerEvents.d.ts +1 -1
- package/lib/@types/Position.d.ts +1 -1
- package/lib/@types/PositionAlert.d.ts +1 -1
- package/lib/@types/Size.d.ts +1 -1
- package/lib/@types/SizePixels.d.ts +2 -2
- package/lib/@types/StorageMock.d.ts +1 -1
- package/lib/alerts/types.d.ts +1 -1
- package/lib/assets/styles/checkbox.scss +45 -38
- package/lib/assets/styles/colors.scss +3 -1
- package/lib/assets/styles/commons.scss +1 -0
- package/lib/assets/styles/dialog.scss +27 -10
- package/lib/assets/styles/error.scss +9 -0
- package/lib/assets/styles/fieldset.scss +3 -0
- package/lib/assets/styles/gridlayout.scss +0 -2
- package/lib/assets/styles/hint.scss +21 -0
- package/lib/assets/styles/icon.scss +4 -31
- package/lib/assets/styles/input.scss +7 -7
- package/lib/assets/styles/multiSelect.scss +6 -1
- package/lib/assets/styles/radio.scss +37 -35
- package/lib/assets/styles/select.scss +13 -7
- package/lib/assets/styles/tabs.scss +3 -0
- package/lib/avatar/types.d.ts +1 -1
- package/lib/badge/types.d.ts +1 -1
- package/lib/buttons/types.d.ts +1 -1
- package/lib/calendar/types.d.ts +1 -1
- package/lib/checkbox/Label.js +13 -4
- package/lib/checkbox/index.d.ts +2 -2
- package/lib/checkbox/index.js +22 -17
- package/lib/checkbox/types.d.ts +3 -2
- package/lib/dialog/base/Content.js +1 -0
- package/lib/dialog/base/Header.js +4 -4
- package/lib/dialog/base/index.js +9 -6
- package/lib/dialog/types.d.ts +1 -1
- package/lib/drawer/Drawer.js +5 -4
- package/lib/drawer/Header.js +1 -1
- package/lib/drawer/types.d.ts +1 -1
- package/lib/dropdown/Popup.d.ts +1 -1
- package/lib/dropdown/Popup.js +5 -2
- package/lib/dropdown/types.d.ts +2 -1
- package/lib/fieldset/index.js +4 -2
- package/lib/fieldset/types.d.ts +3 -1
- package/lib/form/Field.d.ts +3 -1
- package/lib/form/FieldArray.d.ts +2 -0
- package/lib/form/FieldNumber.d.ts +2 -0
- package/lib/form/FieldPeriod.d.ts +2 -0
- package/lib/form/helpers.d.ts +2 -0
- package/lib/form/index.d.ts +2 -0
- package/lib/form/types.d.ts +3 -1
- package/lib/form/withFieldHOC.d.ts +2 -0
- package/lib/form/withFormSecurity.d.ts +2 -0
- package/lib/gridlayout/GridRow.js +10 -2
- package/lib/gridlayout/types.d.ts +2 -2
- package/lib/hint/helpers.d.ts +3 -0
- package/lib/hint/helpers.js +21 -0
- package/lib/hint/index.d.ts +2 -1
- package/lib/hint/index.js +9 -15
- package/lib/hint/types.d.ts +4 -1
- package/lib/icons/helper.d.ts +4 -0
- package/lib/icons/helper.js +5 -1
- package/lib/icons/index.d.ts +2 -3
- package/lib/icons/index.js +3 -10
- package/lib/icons/types.d.ts +9 -22
- package/lib/index.d.ts +0 -1
- package/lib/inputs/base/InputTextBase.d.ts +2 -0
- package/lib/inputs/base/InputTextBase.js +54 -8
- package/lib/inputs/base/Label.d.ts +14 -0
- package/lib/inputs/base/Label.js +35 -0
- package/lib/inputs/base/helpers.d.ts +3 -2
- package/lib/inputs/base/helpers.js +1 -8
- package/lib/inputs/base/types.d.ts +15 -2
- package/lib/inputs/color/types.d.ts +1 -1
- package/lib/inputs/date/Dialog.d.ts +2 -0
- package/lib/inputs/date/Dropdown.d.ts +2 -0
- package/lib/inputs/date/helpers.d.ts +2 -0
- package/lib/inputs/date/index.d.ts +2 -0
- package/lib/inputs/date/index.js +2 -0
- package/lib/inputs/date/types.d.ts +4 -1
- package/lib/inputs/errorMessage/index.d.ts +17 -0
- package/lib/inputs/errorMessage/index.js +26 -0
- package/lib/inputs/file/DefaultFile.d.ts +2 -0
- package/lib/inputs/file/DefaultFile.js +4 -2
- package/lib/inputs/file/DragDropFile.d.ts +2 -0
- package/lib/inputs/file/DragDropFile.js +4 -2
- package/lib/inputs/file/File.d.ts +2 -0
- package/lib/inputs/file/FileButtonSettings.d.ts +2 -0
- package/lib/inputs/file/helpers.d.ts +2 -0
- package/lib/inputs/file/index.d.ts +2 -0
- package/lib/inputs/file/types.d.ts +3 -1
- package/lib/inputs/inputHOC.d.ts +3 -1
- package/lib/inputs/mask/BaseMask.d.ts +3 -0
- package/lib/inputs/mask/Cnpj.d.ts +3 -0
- package/lib/inputs/mask/Cpf.d.ts +3 -0
- package/lib/inputs/mask/Phone.d.ts +3 -0
- package/lib/inputs/mask/ZipCode.d.ts +3 -0
- package/lib/inputs/mask/helpers.d.ts +2 -1
- package/lib/inputs/mask/imaskHOC.d.ts +3 -1
- package/lib/inputs/mask/index.d.ts +3 -0
- package/lib/inputs/mask/types.d.ts +6 -2
- package/lib/inputs/multiSelect/ActionButtons.d.ts +2 -0
- package/lib/inputs/multiSelect/ActionButtons.js +10 -8
- package/lib/inputs/multiSelect/Dropdown.d.ts +2 -0
- package/lib/inputs/multiSelect/Dropdown.js +2 -6
- package/lib/inputs/multiSelect/helper.d.ts +2 -0
- package/lib/inputs/multiSelect/index.d.ts +2 -0
- package/lib/inputs/multiSelect/types.d.ts +3 -1
- package/lib/inputs/number/BaseNumber.d.ts +3 -1
- package/lib/inputs/number/Currency.d.ts +3 -1
- package/lib/inputs/number/Decimal.d.ts +3 -1
- package/lib/inputs/number/index.d.ts +3 -1
- package/lib/inputs/number/types.d.ts +4 -2
- package/lib/inputs/period/Dialog.d.ts +2 -0
- package/lib/inputs/period/Dropdown.d.ts +2 -0
- package/lib/inputs/period/PeriodList.d.ts +2 -0
- package/lib/inputs/period/helper.d.ts +2 -0
- package/lib/inputs/period/index.d.ts +2 -0
- package/lib/inputs/period/index.js +4 -1
- package/lib/inputs/period/types.d.ts +3 -1
- package/lib/inputs/search/index.d.ts +3 -1
- package/lib/inputs/select/ActionButtons.d.ts +3 -1
- package/lib/inputs/select/ActionButtons.js +18 -27
- package/lib/inputs/select/Dropdown.d.ts +3 -1
- package/lib/inputs/select/Dropdown.js +2 -6
- package/lib/inputs/select/helper.d.ts +3 -1
- package/lib/inputs/select/index.d.ts +2 -0
- package/lib/inputs/select/multiple/Selecteds.d.ts +3 -1
- package/lib/inputs/select/multiple/Selecteds.js +3 -5
- package/lib/inputs/select/multiple/index.d.ts +2 -0
- package/lib/inputs/select/multiple/index.js +38 -19
- package/lib/inputs/select/simple/index.d.ts +2 -0
- package/lib/inputs/select/simple/index.js +60 -31
- package/lib/inputs/select/types.d.ts +6 -3
- package/lib/inputs/text/types.d.ts +1 -1
- package/lib/inputs/textarea/index.d.ts +2 -0
- package/lib/inputs/textarea/types.d.ts +3 -1
- package/lib/inputs/types.d.ts +12 -5
- package/lib/internals/types.d.ts +1 -1
- package/lib/internals/withTooltip.js +7 -3
- package/lib/labelMessages/types.d.ts +1 -1
- package/lib/labels/types.d.ts +1 -1
- package/lib/list/types.d.ts +1 -1
- package/lib/menus/float/index.d.ts +10 -10
- package/lib/menus/float/types.d.ts +2 -2
- package/lib/menus/sidenav/popup_menu_search/index.js +4 -3
- package/lib/menus/sidenav/types.d.ts +2 -2
- package/lib/panel/types.d.ts +1 -1
- package/lib/popover/types.d.ts +1 -1
- package/lib/progress/types.d.ts +1 -1
- package/lib/radio/types.d.ts +1 -1
- package/lib/shortcuts/types.d.ts +1 -1
- package/lib/skeleton/types.d.ts +1 -1
- package/lib/spinner/types.d.ts +1 -1
- package/lib/split/helpers.d.ts +1 -1
- package/lib/split/types.d.ts +1 -1
- package/lib/table/HeaderColumn.d.ts +1 -1
- package/lib/table/HeaderColumn.js +5 -1
- package/lib/table/types.d.ts +3 -1
- package/lib/tabs/context.js +1 -1
- package/lib/tabs/types.d.ts +4 -4
- package/lib/toolbar/types.d.ts +1 -1
- package/lib/tooltip/types.d.ts +1 -1
- package/lib/treetable/Row.d.ts +1 -1
- package/lib/treetable/helpers.d.ts +1 -1
- package/lib/treetable/index.d.ts +2 -2
- package/lib/treeview/types.d.ts +1 -1
- package/lib/{types.d-DvJcBS8L.d.ts → types.d-73cece43.d.ts} +1 -1
- package/lib/uitour/types.d.ts +1 -1
- package/package.json +7 -7
- package/.tool-versions +0 -1
- package/lib/assets/styles/textContent.scss +0 -9
- package/lib/menus/sidenav/popup_menu_help/index.js +0 -78
- package/lib/textContent/index.d.ts +0 -8
- package/lib/textContent/index.js +0 -30
|
@@ -11,17 +11,15 @@ const Selecteds = _ref => {
|
|
|
11
11
|
currents,
|
|
12
12
|
descriptionKey,
|
|
13
13
|
idKey,
|
|
14
|
-
|
|
14
|
+
handlerOnUnselect
|
|
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
18
|
key: "selected-".concat(selected[idKey])
|
|
19
|
-
}, typeof descriptionKey === 'string' ? selected[descriptionKey] : descriptionKey(selected), /*#__PURE__*/_react.default.createElement("
|
|
19
|
+
}, typeof descriptionKey === 'string' ? selected[descriptionKey] : descriptionKey(selected), /*#__PURE__*/_react.default.createElement("button", {
|
|
20
20
|
className: "close",
|
|
21
|
-
role: "button",
|
|
22
21
|
tabIndex: -1,
|
|
23
|
-
|
|
24
|
-
onClick: () => handleOnUnselect(selected[idKey])
|
|
22
|
+
onClick: () => handlerOnUnselect(selected[idKey])
|
|
25
23
|
}))));
|
|
26
24
|
};
|
|
27
25
|
var _default = exports.default = Selecteds;
|
|
@@ -5,6 +5,8 @@ import '../../../@types/PermissionAttr.js';
|
|
|
5
5
|
import '../../base/types.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '../../../@types/Period.js';
|
|
8
|
+
import '../../../internals/types.js';
|
|
9
|
+
import '../../../@types/Position.js';
|
|
8
10
|
|
|
9
11
|
declare const MultipleSelect: (props: IMultipleSelectProps) => JSX.Element;
|
|
10
12
|
|
|
@@ -24,7 +24,8 @@ const MultipleSelect = props => {
|
|
|
24
24
|
handlerClear,
|
|
25
25
|
value = [],
|
|
26
26
|
remoteSearch = false,
|
|
27
|
-
descriptionKey
|
|
27
|
+
descriptionKey,
|
|
28
|
+
showClearButton
|
|
28
29
|
} = props;
|
|
29
30
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
30
31
|
const [currents, setCurrents] = (0, _react.useState)([]);
|
|
@@ -40,6 +41,7 @@ const MultipleSelect = props => {
|
|
|
40
41
|
const dropdownRef = (0, _react.useRef)(null);
|
|
41
42
|
const selectWrapper = (0, _react.useRef)();
|
|
42
43
|
const gridElRef = (0, _react.useRef)();
|
|
44
|
+
const inputTextRef = (0, _react.useRef)(null);
|
|
43
45
|
const descriptionKeyIsString = typeof descriptionKey === 'string';
|
|
44
46
|
const onScreenResize = () => {
|
|
45
47
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
@@ -53,12 +55,12 @@ const MultipleSelect = props => {
|
|
|
53
55
|
}
|
|
54
56
|
};
|
|
55
57
|
const onMouseMove = event => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
setInsideComponent(
|
|
58
|
+
var _dropdownRef$current, _dropdownRef$current$;
|
|
59
|
+
const target = event.target;
|
|
60
|
+
const idDropdown = ((_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : (_dropdownRef$current$ = _dropdownRef$current.parentElement) === null || _dropdownRef$current$ === void 0 ? void 0 : _dropdownRef$current$.id) || '';
|
|
61
|
+
const dropdownElement = document.getElementById(idDropdown);
|
|
62
|
+
const keepDropdownOpen = Boolean(dropdownElement === null || dropdownElement === void 0 ? void 0 : dropdownElement.contains(target));
|
|
63
|
+
setInsideComponent(keepDropdownOpen);
|
|
62
64
|
};
|
|
63
65
|
const onClearClick = () => {
|
|
64
66
|
setSelected(undefined);
|
|
@@ -94,6 +96,7 @@ const MultipleSelect = props => {
|
|
|
94
96
|
setCurrents(currentsSelect);
|
|
95
97
|
setDataCombo(dataSource);
|
|
96
98
|
setInputValue([]);
|
|
99
|
+
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
97
100
|
setOpened(false);
|
|
98
101
|
if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(i => i[idKey])));
|
|
99
102
|
};
|
|
@@ -101,11 +104,13 @@ const MultipleSelect = props => {
|
|
|
101
104
|
if (currents) {
|
|
102
105
|
const result = currents.filter(item => item[idKey] !== id);
|
|
103
106
|
setCurrents(result);
|
|
107
|
+
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
108
|
+
setOpened(false);
|
|
104
109
|
if (props.onSelect) setSelected(props.onSelect(result.map(i => i[idKey])));
|
|
105
110
|
}
|
|
106
111
|
};
|
|
107
112
|
const onOpenClose = () => {
|
|
108
|
-
setOpened(!
|
|
113
|
+
setOpened(prevState => !prevState);
|
|
109
114
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
110
115
|
};
|
|
111
116
|
const onFocus = () => {
|
|
@@ -115,11 +120,16 @@ const MultipleSelect = props => {
|
|
|
115
120
|
};
|
|
116
121
|
const onBlur = e => {
|
|
117
122
|
if (props.onBlur) props.onBlur(e);
|
|
118
|
-
if (!insideComponent)
|
|
123
|
+
if (!insideComponent) {
|
|
124
|
+
setOpened(false);
|
|
125
|
+
setDataCombo(dataSource);
|
|
126
|
+
}
|
|
119
127
|
};
|
|
120
128
|
const onInputKeyDown = e => {
|
|
121
129
|
if (e.keyCode) {
|
|
122
130
|
if (e.keyCode === constants.keyCodes.ENTER && selected) {
|
|
131
|
+
var _e$preventDefault;
|
|
132
|
+
(_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
|
|
123
133
|
if (!currents.includes(selected)) onSelect(selected);
|
|
124
134
|
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
125
135
|
if (!opened) setOpened(true);
|
|
@@ -190,6 +200,17 @@ const MultipleSelect = props => {
|
|
|
190
200
|
ref: componentRef,
|
|
191
201
|
className: "select-component"
|
|
192
202
|
}, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
|
|
203
|
+
inputRef: ref => {
|
|
204
|
+
if (props.inputRef) {
|
|
205
|
+
if (!_lodash.default.isFunction(props.inputRef)) {
|
|
206
|
+
props.inputRef.current = ref;
|
|
207
|
+
} else {
|
|
208
|
+
props.inputRef(ref);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
inputTextRef.current = ref;
|
|
212
|
+
},
|
|
213
|
+
autoComplete: "off",
|
|
193
214
|
value: inputValue.toString(),
|
|
194
215
|
readOnly: shouldBeReadOnly(),
|
|
195
216
|
onFocus: () => {
|
|
@@ -208,21 +229,19 @@ const MultipleSelect = props => {
|
|
|
208
229
|
selectWrapper.current = r;
|
|
209
230
|
},
|
|
210
231
|
handlerSetOnDenied: setOnDenied,
|
|
211
|
-
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default,
|
|
232
|
+
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
|
|
233
|
+
showClearButton: showClearButton,
|
|
212
234
|
disabled: shouldDisable() || shouldBeReadOnly(),
|
|
213
235
|
dropDownOpened: opened,
|
|
214
|
-
|
|
236
|
+
handlerClear: () => {
|
|
215
237
|
if (shouldDisable()) return null;
|
|
216
238
|
return onClearClick();
|
|
217
239
|
},
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
currents: currents
|
|
224
|
-
}, props, {
|
|
225
|
-
handleOnUnselect: onUnselect
|
|
240
|
+
handlerOpenClose: onOpenClose
|
|
241
|
+
})
|
|
242
|
+
}), /*#__PURE__*/_react.default.createElement(_Selecteds.default, _extends({}, props, {
|
|
243
|
+
currents: currents,
|
|
244
|
+
handlerOnUnselect: onUnselect
|
|
226
245
|
}))), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, props, {
|
|
227
246
|
selected: selected,
|
|
228
247
|
selectFieldRef: componentRef,
|
|
@@ -5,6 +5,8 @@ import '../../../@types/PermissionAttr.js';
|
|
|
5
5
|
import '../../base/types.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '../../../@types/Period.js';
|
|
8
|
+
import '../../../internals/types.js';
|
|
9
|
+
import '../../../@types/Position.js';
|
|
8
10
|
|
|
9
11
|
declare const SimpleSelect: (props: ISimpleSelectProps) => JSX.Element;
|
|
10
12
|
|
|
@@ -19,7 +19,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
19
19
|
const SimpleSelect = props => {
|
|
20
20
|
const {
|
|
21
21
|
value,
|
|
22
|
-
descriptionKey
|
|
22
|
+
descriptionKey,
|
|
23
23
|
dataSource = [],
|
|
24
24
|
gridLayout,
|
|
25
25
|
onSearch,
|
|
@@ -32,7 +32,9 @@ const SimpleSelect = props => {
|
|
|
32
32
|
name = '',
|
|
33
33
|
undigitable,
|
|
34
34
|
searchOnDropdown = false,
|
|
35
|
-
allOptions = undefined
|
|
35
|
+
allOptions = undefined,
|
|
36
|
+
showClearButton = false,
|
|
37
|
+
searchNotFoundText
|
|
36
38
|
} = props;
|
|
37
39
|
const descriptionKeyIsString = typeof descriptionKey === 'string';
|
|
38
40
|
const dataSourceWithAllOptions = allOptions ? [{
|
|
@@ -48,15 +50,11 @@ const SimpleSelect = props => {
|
|
|
48
50
|
const [onDenied, setOnDeniedSelect] = (0, _react.useState)();
|
|
49
51
|
const [isTyping, setIsTyping] = (0, _react.useState)(false);
|
|
50
52
|
const dropdownRef = (0, _react.useRef)(null);
|
|
51
|
-
const componentId = "select-component".concat(uuid.v1());
|
|
53
|
+
const componentId = "select-component-".concat(name, "-").concat(uuid.v1());
|
|
52
54
|
const componentRef = (0, _react.useRef)(null);
|
|
53
55
|
const selectWrapper = (0, _react.useRef)();
|
|
54
56
|
const gridElement = (0, _react.useRef)();
|
|
55
|
-
const
|
|
56
|
-
setInputText('');
|
|
57
|
-
setSelected(null);
|
|
58
|
-
setDataCombo(dataSourceWithAllOptions);
|
|
59
|
-
};
|
|
57
|
+
const inputTextRef = (0, _react.useRef)(null);
|
|
60
58
|
const onScreenResize = () => {
|
|
61
59
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
62
60
|
};
|
|
@@ -70,10 +68,12 @@ const SimpleSelect = props => {
|
|
|
70
68
|
}
|
|
71
69
|
};
|
|
72
70
|
const onMouseMove = event => {
|
|
71
|
+
var _dropdownRef$current2, _dropdownRef$current3;
|
|
73
72
|
const target = event.target;
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
73
|
+
const idDropdown = ((_dropdownRef$current2 = dropdownRef.current) === null || _dropdownRef$current2 === void 0 ? void 0 : (_dropdownRef$current3 = _dropdownRef$current2.parentElement) === null || _dropdownRef$current3 === void 0 ? void 0 : _dropdownRef$current3.id) || '';
|
|
74
|
+
const dropdownElement = document.getElementById(idDropdown);
|
|
75
|
+
const keepDropdownOpen = Boolean(dropdownElement === null || dropdownElement === void 0 ? void 0 : dropdownElement.contains(target));
|
|
76
|
+
setInsideComponent(keepDropdownOpen);
|
|
77
77
|
};
|
|
78
78
|
const getSelectEvent = selectedEvent => ({
|
|
79
79
|
target: {
|
|
@@ -99,12 +99,12 @@ const SimpleSelect = props => {
|
|
|
99
99
|
});
|
|
100
100
|
if (dataComboFilter && dataComboFilter.length > 0) {
|
|
101
101
|
selectedFilter = dataComboFilter[0];
|
|
102
|
+
setSelected(selectedFilter);
|
|
102
103
|
}
|
|
103
104
|
setDataCombo(dataComboFilter);
|
|
104
105
|
}
|
|
105
106
|
setOpened(true);
|
|
106
107
|
setInputText(valueFilter);
|
|
107
|
-
setSelected(selectedFilter);
|
|
108
108
|
if (selectedFilter) {
|
|
109
109
|
if (descriptionKeyIsString && valueFilter === selectedFilter[descriptionKey] || !descriptionKeyIsString && valueFilter === descriptionKey(selectedFilter)) {
|
|
110
110
|
onChange(selectedFilter);
|
|
@@ -112,18 +112,22 @@ const SimpleSelect = props => {
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
const onSelect = selectedDropdown => {
|
|
115
|
-
if (selectedDropdown
|
|
116
|
-
setOpened(false);
|
|
115
|
+
if (!selectedDropdown) return;
|
|
117
116
|
setSelected(selectedDropdown);
|
|
118
117
|
if (descriptionKeyIsString) setInputText(selectedDropdown[descriptionKey]);else setInputText(descriptionKey(selectedDropdown));
|
|
119
|
-
|
|
118
|
+
new Promise(resolve => {
|
|
119
|
+
resolve(onChange(selectedDropdown));
|
|
120
|
+
}).finally(() => {
|
|
121
|
+
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
122
|
+
setOpened(false);
|
|
123
|
+
});
|
|
120
124
|
};
|
|
121
125
|
const onOpenClose = () => {
|
|
122
|
-
setOpened(!
|
|
126
|
+
setOpened(prevState => !prevState);
|
|
123
127
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
124
128
|
};
|
|
125
129
|
const onFocus = () => {
|
|
126
|
-
|
|
130
|
+
if (openDropdownOnFocus) setOpened(true);
|
|
127
131
|
if (selectWrapper) {
|
|
128
132
|
const dropdownWidthFocus = selectWrapper.current ? selectWrapper.current.clientWidth : 0;
|
|
129
133
|
setDropdownWidth(dropdownWidthFocus);
|
|
@@ -133,15 +137,20 @@ const SimpleSelect = props => {
|
|
|
133
137
|
if (props.onBlur) {
|
|
134
138
|
const event = getSelectEvent(selected);
|
|
135
139
|
props.onBlur(event);
|
|
136
|
-
if (selected) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
if (selected && descriptionKeyIsString && inputText !== selected[descriptionKey] || !descriptionKeyIsString && inputText !== descriptionKey(selected)) {
|
|
141
|
+
setSelected(null);
|
|
142
|
+
setInputText(inputText);
|
|
143
|
+
new Promise(resolve => {
|
|
144
|
+
resolve(onChange(null));
|
|
145
|
+
}).finally(() => {
|
|
146
|
+
onChange();
|
|
147
|
+
});
|
|
140
148
|
}
|
|
141
149
|
}
|
|
142
150
|
if (!insideComponent) {
|
|
143
151
|
setOpened(false);
|
|
144
152
|
setIsTyping(false);
|
|
153
|
+
setDataCombo(dataSourceWithAllOptions);
|
|
145
154
|
}
|
|
146
155
|
};
|
|
147
156
|
const onInputKeyDown = e => {
|
|
@@ -159,13 +168,22 @@ const SimpleSelect = props => {
|
|
|
159
168
|
index = dataCombo && index === 0 ? (dataCombo === null || dataCombo === void 0 ? void 0 : dataCombo.length) - 1 : index - 1;
|
|
160
169
|
}
|
|
161
170
|
setSelected(dataCombo[index]);
|
|
171
|
+
if (descriptionKeyIsString) setInputText(dataCombo[index][descriptionKey]);
|
|
172
|
+
if (!descriptionKeyIsString) setInputText(descriptionKey(dataCombo[index]));
|
|
162
173
|
}
|
|
163
174
|
}
|
|
164
175
|
if (!isTyping) setIsTyping(true);
|
|
165
176
|
};
|
|
166
177
|
const onClearClick = () => {
|
|
167
|
-
|
|
168
|
-
|
|
178
|
+
new Promise(resolve => {
|
|
179
|
+
resolve(onChange(null));
|
|
180
|
+
}).finally(() => {
|
|
181
|
+
setSelected(null);
|
|
182
|
+
setInputText('');
|
|
183
|
+
onChange();
|
|
184
|
+
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
185
|
+
setOpened(false);
|
|
186
|
+
});
|
|
169
187
|
};
|
|
170
188
|
const setOnDenied = onDeniedSelect => {
|
|
171
189
|
setOnDeniedSelect(onDeniedSelect);
|
|
@@ -228,6 +246,17 @@ const SimpleSelect = props => {
|
|
|
228
246
|
ref: componentRef,
|
|
229
247
|
className: "select-component"
|
|
230
248
|
}, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
|
|
249
|
+
inputRef: ref => {
|
|
250
|
+
if (props.inputRef) {
|
|
251
|
+
if (!_lodash.default.isFunction(props.inputRef)) {
|
|
252
|
+
props.inputRef.current = ref;
|
|
253
|
+
} else {
|
|
254
|
+
props.inputRef(ref);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
inputTextRef.current = ref;
|
|
258
|
+
},
|
|
259
|
+
autoComplete: "off",
|
|
231
260
|
readOnly: undigitable || shouldBeReadOnly(),
|
|
232
261
|
value: inputText,
|
|
233
262
|
onFocus: onFocus,
|
|
@@ -242,18 +271,18 @@ const SimpleSelect = props => {
|
|
|
242
271
|
selectWrapper.current = r;
|
|
243
272
|
},
|
|
244
273
|
handlerSetOnDenied: inputOnDenied => setOnDenied(inputOnDenied),
|
|
245
|
-
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default,
|
|
274
|
+
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
|
|
246
275
|
disabled: shouldDisable() || shouldBeReadOnly(),
|
|
276
|
+
showClearButton: showClearButton,
|
|
247
277
|
dropDownOpened: opened,
|
|
248
|
-
|
|
278
|
+
handlerClear: () => {
|
|
249
279
|
if (shouldDisable()) return null;
|
|
250
280
|
return onClearClick();
|
|
251
281
|
},
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
}))
|
|
282
|
+
handlerOpenClose: onOpenClose
|
|
283
|
+
})
|
|
256
284
|
})), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, props, {
|
|
285
|
+
opened: opened,
|
|
257
286
|
selected: selected,
|
|
258
287
|
inputValue: inputText,
|
|
259
288
|
selectFieldRef: componentRef,
|
|
@@ -267,9 +296,9 @@ const SimpleSelect = props => {
|
|
|
267
296
|
handleOnKeydown: onInputKeyDown,
|
|
268
297
|
handleOnBlur: () => onBlur,
|
|
269
298
|
handleOnFocus: onFocus,
|
|
270
|
-
opened: opened,
|
|
271
299
|
dataCombo: dataCombo,
|
|
272
|
-
dropdownWidth: dropdownWidth || 0
|
|
300
|
+
dropdownWidth: dropdownWidth || 0,
|
|
301
|
+
searchNotFoundText: searchNotFoundText
|
|
273
302
|
})));
|
|
274
303
|
};
|
|
275
304
|
var _default = exports.default = SimpleSelect;
|
|
@@ -2,8 +2,10 @@ import { TextAlign } from '../../@types/Align.js';
|
|
|
2
2
|
import { DataCombo } from '../../@types/DataCombo.js';
|
|
3
3
|
import { PermissionAttr } from '../../@types/PermissionAttr.js';
|
|
4
4
|
import { CustomInputEvent } from '../base/types.js';
|
|
5
|
-
import 'react';
|
|
5
|
+
import { MutableRefObject } from 'react';
|
|
6
6
|
import '../../@types/Period.js';
|
|
7
|
+
import '../../internals/types.js';
|
|
8
|
+
import '../../@types/Position.js';
|
|
7
9
|
|
|
8
10
|
type AllOptions = {
|
|
9
11
|
idValue?: number | null;
|
|
@@ -47,6 +49,7 @@ interface ISimpleSelectProps {
|
|
|
47
49
|
autoFocus?: boolean;
|
|
48
50
|
onFocus?: () => void;
|
|
49
51
|
allOptions?: AllOptions;
|
|
52
|
+
inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
|
|
50
53
|
}
|
|
51
54
|
interface ISelectFieldProps extends Omit<ISimpleSelectProps, 'idKey' | 'value' | 'descriptionKey'> {
|
|
52
55
|
multiple?: boolean;
|
|
@@ -92,7 +95,7 @@ interface ISelectedsMultipleProps {
|
|
|
92
95
|
idKey: string;
|
|
93
96
|
descriptionKey: DescriptionKey;
|
|
94
97
|
currents: DataCombo[];
|
|
95
|
-
|
|
98
|
+
handlerOnUnselect: (id: string) => void;
|
|
96
99
|
}
|
|
97
100
|
interface GetFilteredParams {
|
|
98
101
|
dataSource: DataCombo[];
|
|
@@ -106,4 +109,4 @@ interface GetMultipleFilteredParams extends GetFilteredParams {
|
|
|
106
109
|
inputText: number[] | string[];
|
|
107
110
|
}
|
|
108
111
|
|
|
109
|
-
export
|
|
112
|
+
export { AllOptions, DescriptionKey, GetFilteredParams, GetMultipleFilteredParams, GetSimpleFilteredParams, IMultipleSelectProps, ISelectFieldProps, ISelectedsMultipleProps, ISimpleSelectProps };
|
|
@@ -4,6 +4,8 @@ import 'react';
|
|
|
4
4
|
import '../../@types/Align.js';
|
|
5
5
|
import '../../@types/Period.js';
|
|
6
6
|
import '../../@types/PermissionAttr.js';
|
|
7
|
+
import '../../internals/types.js';
|
|
8
|
+
import '../../@types/Position.js';
|
|
7
9
|
|
|
8
10
|
declare const TextArea: (props: ITextAreaProps) => JSX.Element;
|
|
9
11
|
|
|
@@ -3,6 +3,8 @@ import 'react';
|
|
|
3
3
|
import '../../@types/Align.js';
|
|
4
4
|
import '../../@types/Period.js';
|
|
5
5
|
import '../../@types/PermissionAttr.js';
|
|
6
|
+
import '../../internals/types.js';
|
|
7
|
+
import '../../@types/Position.js';
|
|
6
8
|
|
|
7
9
|
interface ITextAreaProps extends IBaseProps {
|
|
8
10
|
rows?: number;
|
|
@@ -11,4 +13,4 @@ interface ITextAreaProps extends IBaseProps {
|
|
|
11
13
|
type?: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
export
|
|
16
|
+
export { ITextAreaProps };
|
package/lib/inputs/types.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ReactNode, MouseEvent, MutableRefObject, CSSProperties, KeyboardEvent, ReactElement } from 'react';
|
|
2
|
+
import IMask from 'imask';
|
|
2
3
|
import { PermissionAttr, OnDenied } from '../@types/PermissionAttr.js';
|
|
3
4
|
import { DataCombo } from '../@types/DataCombo.js';
|
|
4
5
|
import { IBaseProps, CustomInputEvent } from './base/types.js';
|
|
5
6
|
import { IDrawerProps } from '../drawer/types.js';
|
|
6
7
|
import { TextAlign } from '../@types/Align.js';
|
|
7
8
|
import '../@types/Period.js';
|
|
9
|
+
import '../internals/types.js';
|
|
8
10
|
import '../@types/Position.js';
|
|
9
11
|
import '../@types/Icon.js';
|
|
10
12
|
import '../icons/helper.js';
|
|
@@ -62,7 +64,7 @@ interface IMaskHOCProps {
|
|
|
62
64
|
inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
|
|
63
65
|
placeholderChar?: string;
|
|
64
66
|
lazy?: boolean;
|
|
65
|
-
definitions?:
|
|
67
|
+
definitions?: IMask.AllMaskedOptions['definitions'];
|
|
66
68
|
groups?: object;
|
|
67
69
|
pattern?: string;
|
|
68
70
|
format?: () => void;
|
|
@@ -97,7 +99,7 @@ interface IMaskHOCProps {
|
|
|
97
99
|
rounded?: boolean;
|
|
98
100
|
errorMessages?: string[];
|
|
99
101
|
skeletonize?: boolean;
|
|
100
|
-
mask?:
|
|
102
|
+
mask?: IMask.AnyMask;
|
|
101
103
|
isDateField?: boolean;
|
|
102
104
|
autoCompleteMask?: 'left' | 'right';
|
|
103
105
|
}
|
|
@@ -133,8 +135,8 @@ interface IDropdownSelectProps {
|
|
|
133
135
|
align?: 'left' | 'right';
|
|
134
136
|
}
|
|
135
137
|
interface IActionButtonsSelectProps {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
handlerClear: () => void;
|
|
139
|
+
handlerOpenClose: () => void;
|
|
138
140
|
dropDownOpened: boolean;
|
|
139
141
|
showClearButton?: boolean;
|
|
140
142
|
disabled?: boolean;
|
|
@@ -149,5 +151,10 @@ interface IButtonsProps {
|
|
|
149
151
|
transparent: boolean;
|
|
150
152
|
disabled?: boolean;
|
|
151
153
|
}
|
|
154
|
+
interface ErrorProps {
|
|
155
|
+
customClass?: string;
|
|
156
|
+
style?: React.CSSProperties;
|
|
157
|
+
messages?: string | string[];
|
|
158
|
+
}
|
|
152
159
|
|
|
153
|
-
export
|
|
160
|
+
export { ErrorProps, IActionButtonsSelectProps, IAdvancedFilterProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
|
package/lib/internals/types.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ const withTooltip = WrappedComponent => {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
-
}, [errorMessage]);
|
|
78
|
+
}, [errorMessage, tooltip]);
|
|
79
79
|
(0, _react.useEffect)(() => {
|
|
80
80
|
if (targetElement.current && tooltipElement.current) {
|
|
81
81
|
const {
|
|
@@ -106,7 +106,11 @@ const withTooltip = WrappedComponent => {
|
|
|
106
106
|
break;
|
|
107
107
|
case 'left':
|
|
108
108
|
if (targetDimensions.left < tooltipClientWidth) {
|
|
109
|
-
|
|
109
|
+
if (window.innerWidth - targetDimensions.right < tooltipClientWidth) {
|
|
110
|
+
setStateTooltipPosition('bottom');
|
|
111
|
+
} else {
|
|
112
|
+
setStateTooltipPosition('right');
|
|
113
|
+
}
|
|
110
114
|
} else {
|
|
111
115
|
style += "; top: ".concat(targetVerticalCenter + window.scrollY - height / 2, "px");
|
|
112
116
|
style += "; left: ".concat(targetDimensions.left - tooltipClientWidth - 6, "px");
|
|
@@ -125,7 +129,7 @@ const withTooltip = WrappedComponent => {
|
|
|
125
129
|
}
|
|
126
130
|
setTooltipStyle(style);
|
|
127
131
|
}
|
|
128
|
-
}, [tooltipDimensions,
|
|
132
|
+
}, [tooltipDimensions, stateTooltipPosition]);
|
|
129
133
|
(0, _react.useEffect)(() => {
|
|
130
134
|
setStateTooltipPosition(tooltipPosition);
|
|
131
135
|
}, [window.scrollY, window.scrollX, window.innerWidth]);
|
package/lib/labels/types.d.ts
CHANGED
package/lib/list/types.d.ts
CHANGED
|
@@ -63,4 +63,4 @@ interface IListContext {
|
|
|
63
63
|
handleSelectItem: (itemId: string, onClick?: () => void) => void;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export
|
|
66
|
+
export { IListContext, IListHeaderProps, IListItemProps, IListProps, ItemId, KeyboardEvent };
|
|
@@ -16,21 +16,21 @@ declare function SubMenuContainer({ title, customClass, handlerGoBack, skeletoni
|
|
|
16
16
|
}): JSX.Element;
|
|
17
17
|
declare namespace SubMenuContainer {
|
|
18
18
|
namespace propTypes {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
20
|
+
const handlerGoBack: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
+
const title: PropTypes.Requireable<string>;
|
|
22
|
+
const customClass: PropTypes.Requireable<string>;
|
|
23
|
+
const skeletonize: PropTypes.Requireable<boolean>;
|
|
24
|
+
const skeletonQtty: PropTypes.Requireable<number>;
|
|
25
25
|
}
|
|
26
26
|
namespace defaultProps {
|
|
27
|
-
|
|
27
|
+
const title_1: undefined;
|
|
28
28
|
export { title_1 as title };
|
|
29
|
-
|
|
29
|
+
const customClass_1: undefined;
|
|
30
30
|
export { customClass_1 as customClass };
|
|
31
|
-
|
|
31
|
+
const skeletonize_1: boolean;
|
|
32
32
|
export { skeletonize_1 as skeletonize };
|
|
33
|
-
|
|
33
|
+
const skeletonQtty_1: number;
|
|
34
34
|
export { skeletonQtty_1 as skeletonQtty };
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -19,7 +19,7 @@ interface IFloatMenuItemProps {
|
|
|
19
19
|
title?: string;
|
|
20
20
|
url?: string;
|
|
21
21
|
urlHref?: string;
|
|
22
|
-
iconName
|
|
22
|
+
iconName?: IconNames;
|
|
23
23
|
iconColor?: string;
|
|
24
24
|
iconSize?: SizePixels;
|
|
25
25
|
customClass?: string;
|
|
@@ -27,4 +27,4 @@ interface IFloatMenuItemProps {
|
|
|
27
27
|
onClick?: (dropdownClose?: () => void) => void;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export
|
|
30
|
+
export { IFloatMenuContext, IFloatMenuItemProps, IFloatMenuProps };
|
|
@@ -32,17 +32,18 @@ const PopupMenuSearch = props => {
|
|
|
32
32
|
style
|
|
33
33
|
});
|
|
34
34
|
const closeOnEsc = e => {
|
|
35
|
-
if (e.
|
|
35
|
+
if (e.key === 'Escape') {
|
|
36
36
|
handlerClose();
|
|
37
|
+
e.stopPropagation();
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
40
|
(0, _react.useEffect)(() => {
|
|
40
41
|
body.appendChild(popupRef.current);
|
|
41
42
|
if (searchFieldRef && searchFieldRef.current) searchFieldRef.current.focus();
|
|
42
|
-
document.body.addEventListener('
|
|
43
|
+
document.body.addEventListener('keydown', closeOnEsc);
|
|
43
44
|
return () => {
|
|
44
45
|
body.removeChild(popupRef.current);
|
|
45
|
-
document.body.removeEventListener('
|
|
46
|
+
document.body.removeEventListener('keydown', closeOnEsc);
|
|
46
47
|
};
|
|
47
48
|
}, []);
|
|
48
49
|
(0, _react.useEffect)(() => {
|
|
@@ -60,7 +60,7 @@ interface INavSubMenuItemProps {
|
|
|
60
60
|
interface IExpandMenuProps {
|
|
61
61
|
expandMenuCustomClass?: string;
|
|
62
62
|
onExpandMenu?: () => void;
|
|
63
|
-
iconName
|
|
63
|
+
iconName?: IconNames;
|
|
64
64
|
}
|
|
65
65
|
interface IEmptyListProps {
|
|
66
66
|
info?: string;
|
|
@@ -81,4 +81,4 @@ interface ISideNavContext {
|
|
|
81
81
|
}
|
|
82
82
|
type ITargetDimensions = DOMRect;
|
|
83
83
|
|
|
84
|
-
export
|
|
84
|
+
export { IEmptyListProps, IExpandMenuProps, IMenuItemContent, IMenuLinkProps, INavMenuGroupProps, INavMenuItemProps, INavSubMenuItemProps, IPopupMenuSearchProps, ISideNavContext, ISideNavDimensions, ISideNavProps, ISubMenuContext, ITargetDimensions };
|
package/lib/panel/types.d.ts
CHANGED
|
@@ -44,4 +44,4 @@ interface IParameterFunction {
|
|
|
44
44
|
componentName: string;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export
|
|
47
|
+
export { AsyncFunc, ContextProps, Func, IPanelContentProps, IPanelHeaderProps, IPanelProps, IParameterFunction };
|
package/lib/popover/types.d.ts
CHANGED
package/lib/progress/types.d.ts
CHANGED
package/lib/radio/types.d.ts
CHANGED