linear-react-components-ui 1.1.2-beta.22 → 1.1.2-beta.24
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/@types/SizePixels.d.ts +1 -1
- package/lib/assets/styles/checkbox.scss +38 -45
- package/lib/assets/styles/colors.scss +1 -3
- package/lib/assets/styles/commons.scss +0 -1
- package/lib/assets/styles/dialog.scss +10 -27
- package/lib/assets/styles/fieldset.scss +0 -3
- package/lib/assets/styles/gridlayout.scss +2 -0
- package/lib/assets/styles/hint.scss +0 -4
- package/lib/assets/styles/input.scss +7 -2
- package/lib/assets/styles/multiSelect.scss +1 -6
- package/lib/assets/styles/radio.scss +35 -37
- package/lib/assets/styles/select.scss +7 -13
- package/lib/assets/styles/sidenav.scss +10 -4
- package/lib/assets/styles/tabs.scss +0 -3
- package/lib/checkbox/Label.js +4 -13
- package/lib/checkbox/index.d.ts +1 -1
- package/lib/checkbox/index.js +11 -17
- package/lib/checkbox/types.d.ts +0 -1
- package/lib/dialog/base/Content.js +0 -1
- package/lib/dialog/base/Header.js +4 -4
- package/lib/dialog/base/index.js +4 -6
- package/lib/drawer/Drawer.js +4 -5
- package/lib/dropdown/Popup.d.ts +1 -1
- package/lib/dropdown/Popup.js +2 -5
- package/lib/dropdown/types.d.ts +0 -1
- package/lib/fieldset/index.js +2 -4
- package/lib/fieldset/types.d.ts +0 -2
- package/lib/gridlayout/GridRow.js +1 -9
- package/lib/gridlayout/types.d.ts +1 -1
- package/lib/hint/index.d.ts +1 -1
- package/lib/hint/index.js +15 -5
- package/lib/hint/types.d.ts +0 -1
- package/lib/inputs/base/InputTextBase.js +2 -8
- package/lib/inputs/base/helpers.d.ts +2 -1
- package/lib/inputs/base/helpers.js +8 -1
- package/lib/inputs/base/types.d.ts +0 -1
- package/lib/inputs/date/index.js +0 -2
- package/lib/inputs/date/types.d.ts +0 -1
- package/lib/inputs/file/DefaultFile.js +2 -4
- package/lib/inputs/file/DragDropFile.js +2 -4
- package/lib/inputs/inputHOC.d.ts +0 -1
- package/lib/inputs/mask/BaseMask.d.ts +0 -1
- package/lib/inputs/mask/Cnpj.d.ts +0 -1
- package/lib/inputs/mask/Cpf.d.ts +0 -1
- package/lib/inputs/mask/Phone.d.ts +0 -1
- package/lib/inputs/mask/ZipCode.d.ts +0 -1
- package/lib/inputs/mask/imaskHOC.d.ts +0 -1
- package/lib/inputs/mask/index.d.ts +0 -1
- package/lib/inputs/mask/types.d.ts +1 -3
- package/lib/inputs/multiSelect/ActionButtons.js +8 -10
- package/lib/inputs/multiSelect/Dropdown.js +6 -2
- package/lib/inputs/number/BaseNumber.d.ts +0 -1
- package/lib/inputs/number/Currency.d.ts +0 -1
- package/lib/inputs/number/Decimal.d.ts +0 -1
- package/lib/inputs/number/index.d.ts +0 -1
- package/lib/inputs/number/types.d.ts +0 -1
- package/lib/inputs/period/index.js +1 -4
- package/lib/inputs/search/index.d.ts +0 -1
- package/lib/inputs/select/ActionButtons.d.ts +0 -1
- package/lib/inputs/select/ActionButtons.js +27 -18
- package/lib/inputs/select/Dropdown.d.ts +0 -1
- package/lib/inputs/select/Dropdown.js +6 -2
- package/lib/inputs/select/helper.d.ts +0 -1
- package/lib/inputs/select/multiple/Selecteds.d.ts +1 -1
- package/lib/inputs/select/multiple/Selecteds.js +5 -3
- package/lib/inputs/select/multiple/index.js +19 -38
- package/lib/inputs/select/simple/index.js +31 -60
- package/lib/inputs/select/types.d.ts +2 -3
- package/lib/inputs/types.d.ts +5 -11
- package/lib/menus/sidenav/NavMenuGroup.d.ts +1 -1
- package/lib/menus/sidenav/NavMenuGroup.js +4 -2
- package/lib/menus/sidenav/NavMenuItem.js +13 -3
- package/lib/menus/sidenav/index.js +3 -3
- package/lib/menus/sidenav/popup_menu_search/index.js +3 -4
- package/lib/menus/sidenav/types.d.ts +2 -1
- package/lib/table/HeaderColumn.d.ts +1 -1
- package/lib/table/HeaderColumn.js +1 -5
- package/lib/table/types.d.ts +0 -2
- package/lib/tabs/context.js +1 -1
- package/lib/tabs/types.d.ts +3 -3
- package/package.json +1 -1
- package/.eslintcache +0 -1
- package/lib/assets/styles/error.scss +0 -9
- package/lib/hint/helpers.d.ts +0 -3
- package/lib/hint/helpers.js +0 -21
- package/lib/inputs/errorMessage/index.d.ts +0 -16
- package/lib/inputs/errorMessage/index.js +0 -26
|
@@ -11,28 +11,37 @@ const ActionButtons = props => {
|
|
|
11
11
|
const {
|
|
12
12
|
disabled = false,
|
|
13
13
|
showClearButton = true,
|
|
14
|
-
dropDownOpened
|
|
15
|
-
handlerOpenClose,
|
|
16
|
-
handlerClear
|
|
14
|
+
dropDownOpened
|
|
17
15
|
} = props;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
const returnOnClick = () => {
|
|
17
|
+
if (!disabled) {
|
|
18
|
+
return props.handleOpenClose();
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
};
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showClearButton && /*#__PURE__*/_react.default.createElement("span", {
|
|
23
|
+
role: "button",
|
|
24
|
+
className: "actionbutton",
|
|
25
|
+
onClick: () => {
|
|
26
|
+
props.handleClear();
|
|
27
|
+
},
|
|
28
|
+
onKeyPress: () => {},
|
|
29
|
+
tabIndex: -1
|
|
25
30
|
}, /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
31
|
+
pointerEvents: "none",
|
|
26
32
|
name: "cancel",
|
|
27
|
-
|
|
28
|
-
})), /*#__PURE__*/_react.default.createElement("
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
customClass: "iconclear"
|
|
34
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
35
|
+
role: "button",
|
|
36
|
+
className: "actionbutton",
|
|
37
|
+
onClick: () => {
|
|
38
|
+
returnOnClick();
|
|
39
|
+
},
|
|
40
|
+
onKeyPress: () => {},
|
|
41
|
+
tabIndex: -1
|
|
33
42
|
}, /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
name: dropDownOpened ? 'mini_up' : 'mini_down',
|
|
44
|
+
pointerEvents: "none"
|
|
36
45
|
})));
|
|
37
46
|
};
|
|
38
47
|
var _default = exports.default = ActionButtons;
|
|
@@ -29,6 +29,7 @@ const Dropdown = props => {
|
|
|
29
29
|
dropdownWidth,
|
|
30
30
|
gridWrapperStyle,
|
|
31
31
|
handleOnSelect,
|
|
32
|
+
handleOnBlur,
|
|
32
33
|
inputValue,
|
|
33
34
|
handleOnFocus,
|
|
34
35
|
opened,
|
|
@@ -82,12 +83,15 @@ const Dropdown = props => {
|
|
|
82
83
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
83
84
|
key: "dropdowmIten ".concat(item[idKey], "}"),
|
|
84
85
|
className: helper.getDropdownItemCssClass(itemSelected, disabled, striped)
|
|
85
|
-
}, /*#__PURE__*/_react.default.createElement("
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
87
|
+
role: "button",
|
|
86
88
|
className: "menubutton",
|
|
87
89
|
tabIndex: -1,
|
|
88
|
-
|
|
90
|
+
onKeyPress: () => {},
|
|
91
|
+
onClick: () => {
|
|
89
92
|
if (!disabled) {
|
|
90
93
|
handleOnSelect(item);
|
|
94
|
+
handleOnBlur(item);
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
97
|
}, item.iconName && /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IDropdownSelectProps } from '../types.js';
|
|
2
2
|
import { GetSimpleFilteredParams, GetMultipleFilteredParams } from './types.js';
|
|
3
3
|
import 'react';
|
|
4
|
-
import 'imask';
|
|
5
4
|
import '../../@types/PermissionAttr.js';
|
|
6
5
|
import '../../@types/DataCombo.js';
|
|
7
6
|
import '../base/types.js';
|
|
@@ -6,6 +6,6 @@ import '../../base/types.js';
|
|
|
6
6
|
import 'react';
|
|
7
7
|
import '../../../@types/Period.js';
|
|
8
8
|
|
|
9
|
-
declare const Selecteds: ({ currents, descriptionKey, idKey,
|
|
9
|
+
declare const Selecteds: ({ currents, descriptionKey, idKey, handleOnUnselect, }: ISelectedsMultipleProps) => JSX.Element;
|
|
10
10
|
|
|
11
11
|
export { Selecteds as default };
|
|
@@ -11,15 +11,17 @@ const Selecteds = _ref => {
|
|
|
11
11
|
currents,
|
|
12
12
|
descriptionKey,
|
|
13
13
|
idKey,
|
|
14
|
-
|
|
14
|
+
handleOnUnselect
|
|
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("span", {
|
|
20
20
|
className: "close",
|
|
21
|
+
role: "button",
|
|
21
22
|
tabIndex: -1,
|
|
22
|
-
|
|
23
|
+
onKeyPress: () => {},
|
|
24
|
+
onClick: () => handleOnUnselect(selected[idKey])
|
|
23
25
|
}))));
|
|
24
26
|
};
|
|
25
27
|
var _default = exports.default = Selecteds;
|
|
@@ -24,8 +24,7 @@ const MultipleSelect = props => {
|
|
|
24
24
|
handlerClear,
|
|
25
25
|
value = [],
|
|
26
26
|
remoteSearch = false,
|
|
27
|
-
descriptionKey
|
|
28
|
-
showClearButton
|
|
27
|
+
descriptionKey
|
|
29
28
|
} = props;
|
|
30
29
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
31
30
|
const [currents, setCurrents] = (0, _react.useState)([]);
|
|
@@ -41,7 +40,6 @@ const MultipleSelect = props => {
|
|
|
41
40
|
const dropdownRef = (0, _react.useRef)(null);
|
|
42
41
|
const selectWrapper = (0, _react.useRef)();
|
|
43
42
|
const gridElRef = (0, _react.useRef)();
|
|
44
|
-
const inputTextRef = (0, _react.useRef)(null);
|
|
45
43
|
const descriptionKeyIsString = typeof descriptionKey === 'string';
|
|
46
44
|
const onScreenResize = () => {
|
|
47
45
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
@@ -55,12 +53,12 @@ const MultipleSelect = props => {
|
|
|
55
53
|
}
|
|
56
54
|
};
|
|
57
55
|
const onMouseMove = event => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
setInsideComponent(
|
|
56
|
+
const {
|
|
57
|
+
target
|
|
58
|
+
} = event;
|
|
59
|
+
if (target.className === '') return;
|
|
60
|
+
const insideComponents = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target.className);
|
|
61
|
+
setInsideComponent(insideComponents);
|
|
64
62
|
};
|
|
65
63
|
const onClearClick = () => {
|
|
66
64
|
setSelected(undefined);
|
|
@@ -96,7 +94,6 @@ const MultipleSelect = props => {
|
|
|
96
94
|
setCurrents(currentsSelect);
|
|
97
95
|
setDataCombo(dataSource);
|
|
98
96
|
setInputValue([]);
|
|
99
|
-
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
100
97
|
setOpened(false);
|
|
101
98
|
if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(i => i[idKey])));
|
|
102
99
|
};
|
|
@@ -104,13 +101,11 @@ const MultipleSelect = props => {
|
|
|
104
101
|
if (currents) {
|
|
105
102
|
const result = currents.filter(item => item[idKey] !== id);
|
|
106
103
|
setCurrents(result);
|
|
107
|
-
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
108
|
-
setOpened(false);
|
|
109
104
|
if (props.onSelect) setSelected(props.onSelect(result.map(i => i[idKey])));
|
|
110
105
|
}
|
|
111
106
|
};
|
|
112
107
|
const onOpenClose = () => {
|
|
113
|
-
setOpened(
|
|
108
|
+
setOpened(!opened);
|
|
114
109
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
115
110
|
};
|
|
116
111
|
const onFocus = () => {
|
|
@@ -120,16 +115,11 @@ const MultipleSelect = props => {
|
|
|
120
115
|
};
|
|
121
116
|
const onBlur = e => {
|
|
122
117
|
if (props.onBlur) props.onBlur(e);
|
|
123
|
-
if (!insideComponent)
|
|
124
|
-
setOpened(false);
|
|
125
|
-
setDataCombo(dataSource);
|
|
126
|
-
}
|
|
118
|
+
if (!insideComponent) setOpened(false);
|
|
127
119
|
};
|
|
128
120
|
const onInputKeyDown = e => {
|
|
129
121
|
if (e.keyCode) {
|
|
130
122
|
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);
|
|
133
123
|
if (!currents.includes(selected)) onSelect(selected);
|
|
134
124
|
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
135
125
|
if (!opened) setOpened(true);
|
|
@@ -200,17 +190,6 @@ const MultipleSelect = props => {
|
|
|
200
190
|
ref: componentRef,
|
|
201
191
|
className: "select-component"
|
|
202
192
|
}, /*#__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",
|
|
214
193
|
value: inputValue.toString(),
|
|
215
194
|
readOnly: shouldBeReadOnly(),
|
|
216
195
|
onFocus: () => {
|
|
@@ -229,19 +208,21 @@ const MultipleSelect = props => {
|
|
|
229
208
|
selectWrapper.current = r;
|
|
230
209
|
},
|
|
231
210
|
handlerSetOnDenied: setOnDenied,
|
|
232
|
-
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
|
|
233
|
-
showClearButton: showClearButton,
|
|
211
|
+
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, _extends({}, props, {
|
|
234
212
|
disabled: shouldDisable() || shouldBeReadOnly(),
|
|
235
213
|
dropDownOpened: opened,
|
|
236
|
-
|
|
214
|
+
handleClear: () => {
|
|
237
215
|
if (shouldDisable()) return null;
|
|
238
216
|
return onClearClick();
|
|
239
217
|
},
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
218
|
+
handleOpenClose: () => {
|
|
219
|
+
onOpenClose();
|
|
220
|
+
}
|
|
221
|
+
}))
|
|
222
|
+
}), /*#__PURE__*/_react.default.createElement(_Selecteds.default, _extends({
|
|
223
|
+
currents: currents
|
|
224
|
+
}, props, {
|
|
225
|
+
handleOnUnselect: onUnselect
|
|
245
226
|
}))), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, props, {
|
|
246
227
|
selected: selected,
|
|
247
228
|
selectFieldRef: componentRef,
|
|
@@ -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,9 +32,7 @@ const SimpleSelect = props => {
|
|
|
32
32
|
name = '',
|
|
33
33
|
undigitable,
|
|
34
34
|
searchOnDropdown = false,
|
|
35
|
-
allOptions = undefined
|
|
36
|
-
showClearButton = false,
|
|
37
|
-
searchNotFoundText
|
|
35
|
+
allOptions = undefined
|
|
38
36
|
} = props;
|
|
39
37
|
const descriptionKeyIsString = typeof descriptionKey === 'string';
|
|
40
38
|
const dataSourceWithAllOptions = allOptions ? [{
|
|
@@ -50,11 +48,15 @@ const SimpleSelect = props => {
|
|
|
50
48
|
const [onDenied, setOnDeniedSelect] = (0, _react.useState)();
|
|
51
49
|
const [isTyping, setIsTyping] = (0, _react.useState)(false);
|
|
52
50
|
const dropdownRef = (0, _react.useRef)(null);
|
|
53
|
-
const componentId = "select-component
|
|
51
|
+
const componentId = "select-component".concat(uuid.v1());
|
|
54
52
|
const componentRef = (0, _react.useRef)(null);
|
|
55
53
|
const selectWrapper = (0, _react.useRef)();
|
|
56
54
|
const gridElement = (0, _react.useRef)();
|
|
57
|
-
const
|
|
55
|
+
const clearSelected = () => {
|
|
56
|
+
setInputText('');
|
|
57
|
+
setSelected(null);
|
|
58
|
+
setDataCombo(dataSourceWithAllOptions);
|
|
59
|
+
};
|
|
58
60
|
const onScreenResize = () => {
|
|
59
61
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
60
62
|
};
|
|
@@ -68,12 +70,10 @@ const SimpleSelect = props => {
|
|
|
68
70
|
}
|
|
69
71
|
};
|
|
70
72
|
const onMouseMove = event => {
|
|
71
|
-
var _dropdownRef$current2, _dropdownRef$current3;
|
|
72
73
|
const target = event.target;
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
setInsideComponent(keepDropdownOpen);
|
|
74
|
+
if (target.className === '') return;
|
|
75
|
+
const insideComponents = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target.className);
|
|
76
|
+
setInsideComponent(insideComponents);
|
|
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);
|
|
103
102
|
}
|
|
104
103
|
setDataCombo(dataComboFilter);
|
|
105
104
|
}
|
|
106
105
|
setOpened(true);
|
|
107
106
|
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,22 +112,18 @@ const SimpleSelect = props => {
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
const onSelect = selectedDropdown => {
|
|
115
|
-
if (
|
|
115
|
+
if (selectedDropdown === undefined) return;
|
|
116
|
+
setOpened(false);
|
|
116
117
|
setSelected(selectedDropdown);
|
|
117
118
|
if (descriptionKeyIsString) setInputText(selectedDropdown[descriptionKey]);else setInputText(descriptionKey(selectedDropdown));
|
|
118
|
-
|
|
119
|
-
resolve(onChange(selectedDropdown));
|
|
120
|
-
}).finally(() => {
|
|
121
|
-
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
122
|
-
setOpened(false);
|
|
123
|
-
});
|
|
119
|
+
onChange(selectedDropdown);
|
|
124
120
|
};
|
|
125
121
|
const onOpenClose = () => {
|
|
126
|
-
setOpened(
|
|
122
|
+
setOpened(!opened);
|
|
127
123
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
128
124
|
};
|
|
129
125
|
const onFocus = () => {
|
|
130
|
-
|
|
126
|
+
setOpened(openDropdownOnFocus);
|
|
131
127
|
if (selectWrapper) {
|
|
132
128
|
const dropdownWidthFocus = selectWrapper.current ? selectWrapper.current.clientWidth : 0;
|
|
133
129
|
setDropdownWidth(dropdownWidthFocus);
|
|
@@ -137,20 +133,15 @@ const SimpleSelect = props => {
|
|
|
137
133
|
if (props.onBlur) {
|
|
138
134
|
const event = getSelectEvent(selected);
|
|
139
135
|
props.onBlur(event);
|
|
140
|
-
if (selected
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
resolve(onChange(null));
|
|
145
|
-
}).finally(() => {
|
|
146
|
-
onChange();
|
|
147
|
-
});
|
|
136
|
+
if (selected) {
|
|
137
|
+
if (descriptionKeyIsString && inputText !== selected[descriptionKey] || !descriptionKeyIsString && inputText !== descriptionKey(selected)) {
|
|
138
|
+
clearSelected();
|
|
139
|
+
}
|
|
148
140
|
}
|
|
149
141
|
}
|
|
150
142
|
if (!insideComponent) {
|
|
151
143
|
setOpened(false);
|
|
152
144
|
setIsTyping(false);
|
|
153
|
-
setDataCombo(dataSourceWithAllOptions);
|
|
154
145
|
}
|
|
155
146
|
};
|
|
156
147
|
const onInputKeyDown = e => {
|
|
@@ -168,22 +159,13 @@ const SimpleSelect = props => {
|
|
|
168
159
|
index = dataCombo && index === 0 ? (dataCombo === null || dataCombo === void 0 ? void 0 : dataCombo.length) - 1 : index - 1;
|
|
169
160
|
}
|
|
170
161
|
setSelected(dataCombo[index]);
|
|
171
|
-
if (descriptionKeyIsString) setInputText(dataCombo[index][descriptionKey]);
|
|
172
|
-
if (!descriptionKeyIsString) setInputText(descriptionKey(dataCombo[index]));
|
|
173
162
|
}
|
|
174
163
|
}
|
|
175
164
|
if (!isTyping) setIsTyping(true);
|
|
176
165
|
};
|
|
177
166
|
const onClearClick = () => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}).finally(() => {
|
|
181
|
-
setSelected(null);
|
|
182
|
-
setInputText('');
|
|
183
|
-
onChange();
|
|
184
|
-
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
185
|
-
setOpened(false);
|
|
186
|
-
});
|
|
167
|
+
setSelected(undefined);
|
|
168
|
+
setInputText('');
|
|
187
169
|
};
|
|
188
170
|
const setOnDenied = onDeniedSelect => {
|
|
189
171
|
setOnDeniedSelect(onDeniedSelect);
|
|
@@ -246,17 +228,6 @@ const SimpleSelect = props => {
|
|
|
246
228
|
ref: componentRef,
|
|
247
229
|
className: "select-component"
|
|
248
230
|
}, /*#__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",
|
|
260
231
|
readOnly: undigitable || shouldBeReadOnly(),
|
|
261
232
|
value: inputText,
|
|
262
233
|
onFocus: onFocus,
|
|
@@ -271,18 +242,18 @@ const SimpleSelect = props => {
|
|
|
271
242
|
selectWrapper.current = r;
|
|
272
243
|
},
|
|
273
244
|
handlerSetOnDenied: inputOnDenied => setOnDenied(inputOnDenied),
|
|
274
|
-
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
|
|
245
|
+
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, _extends({}, props, {
|
|
275
246
|
disabled: shouldDisable() || shouldBeReadOnly(),
|
|
276
|
-
showClearButton: showClearButton,
|
|
277
247
|
dropDownOpened: opened,
|
|
278
|
-
|
|
248
|
+
handleClear: () => {
|
|
279
249
|
if (shouldDisable()) return null;
|
|
280
250
|
return onClearClick();
|
|
281
251
|
},
|
|
282
|
-
|
|
283
|
-
|
|
252
|
+
handleOpenClose: () => {
|
|
253
|
+
onOpenClose();
|
|
254
|
+
}
|
|
255
|
+
}))
|
|
284
256
|
})), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, props, {
|
|
285
|
-
opened: opened,
|
|
286
257
|
selected: selected,
|
|
287
258
|
inputValue: inputText,
|
|
288
259
|
selectFieldRef: componentRef,
|
|
@@ -296,9 +267,9 @@ const SimpleSelect = props => {
|
|
|
296
267
|
handleOnKeydown: onInputKeyDown,
|
|
297
268
|
handleOnBlur: () => onBlur,
|
|
298
269
|
handleOnFocus: onFocus,
|
|
270
|
+
opened: opened,
|
|
299
271
|
dataCombo: dataCombo,
|
|
300
|
-
dropdownWidth: dropdownWidth || 0
|
|
301
|
-
searchNotFoundText: searchNotFoundText
|
|
272
|
+
dropdownWidth: dropdownWidth || 0
|
|
302
273
|
})));
|
|
303
274
|
};
|
|
304
275
|
var _default = exports.default = SimpleSelect;
|
|
@@ -2,7 +2,7 @@ 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
|
|
5
|
+
import 'react';
|
|
6
6
|
import '../../@types/Period.js';
|
|
7
7
|
|
|
8
8
|
type AllOptions = {
|
|
@@ -47,7 +47,6 @@ interface ISimpleSelectProps {
|
|
|
47
47
|
autoFocus?: boolean;
|
|
48
48
|
onFocus?: () => void;
|
|
49
49
|
allOptions?: AllOptions;
|
|
50
|
-
inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
|
|
51
50
|
}
|
|
52
51
|
interface ISelectFieldProps extends Omit<ISimpleSelectProps, 'idKey' | 'value' | 'descriptionKey'> {
|
|
53
52
|
multiple?: boolean;
|
|
@@ -93,7 +92,7 @@ interface ISelectedsMultipleProps {
|
|
|
93
92
|
idKey: string;
|
|
94
93
|
descriptionKey: DescriptionKey;
|
|
95
94
|
currents: DataCombo[];
|
|
96
|
-
|
|
95
|
+
handleOnUnselect: (id: string) => void;
|
|
97
96
|
}
|
|
98
97
|
interface GetFilteredParams {
|
|
99
98
|
dataSource: DataCombo[];
|
package/lib/inputs/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReactNode, MouseEvent, MutableRefObject, CSSProperties, KeyboardEvent, ReactElement } from 'react';
|
|
2
|
-
import IMask from 'imask';
|
|
3
2
|
import { PermissionAttr, OnDenied } from '../@types/PermissionAttr.js';
|
|
4
3
|
import { DataCombo } from '../@types/DataCombo.js';
|
|
5
4
|
import { IBaseProps, CustomInputEvent } from './base/types.js';
|
|
@@ -63,7 +62,7 @@ interface IMaskHOCProps {
|
|
|
63
62
|
inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
|
|
64
63
|
placeholderChar?: string;
|
|
65
64
|
lazy?: boolean;
|
|
66
|
-
definitions?:
|
|
65
|
+
definitions?: object;
|
|
67
66
|
groups?: object;
|
|
68
67
|
pattern?: string;
|
|
69
68
|
format?: () => void;
|
|
@@ -98,7 +97,7 @@ interface IMaskHOCProps {
|
|
|
98
97
|
rounded?: boolean;
|
|
99
98
|
errorMessages?: string[];
|
|
100
99
|
skeletonize?: boolean;
|
|
101
|
-
mask?:
|
|
100
|
+
mask?: string | NumberConstructor;
|
|
102
101
|
isDateField?: boolean;
|
|
103
102
|
autoCompleteMask?: 'left' | 'right';
|
|
104
103
|
}
|
|
@@ -134,8 +133,8 @@ interface IDropdownSelectProps {
|
|
|
134
133
|
align?: 'left' | 'right';
|
|
135
134
|
}
|
|
136
135
|
interface IActionButtonsSelectProps {
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
handleClear: () => void;
|
|
137
|
+
handleOpenClose: () => void;
|
|
139
138
|
dropDownOpened: boolean;
|
|
140
139
|
showClearButton?: boolean;
|
|
141
140
|
disabled?: boolean;
|
|
@@ -150,10 +149,5 @@ interface IButtonsProps {
|
|
|
150
149
|
transparent: boolean;
|
|
151
150
|
disabled?: boolean;
|
|
152
151
|
}
|
|
153
|
-
interface ErrorProps {
|
|
154
|
-
customClass?: string;
|
|
155
|
-
style?: React.CSSProperties;
|
|
156
|
-
messages?: string | string[];
|
|
157
|
-
}
|
|
158
152
|
|
|
159
|
-
export type {
|
|
153
|
+
export type { IActionButtonsSelectProps, IAdvancedFilterProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
|
|
@@ -7,6 +7,6 @@ import '../../@types/Position.js';
|
|
|
7
7
|
import '../../@types/Icon.js';
|
|
8
8
|
import '../../icons/helper.js';
|
|
9
9
|
|
|
10
|
-
declare const NavMenuGroup: ({ children, scrollable }: INavMenuGroupProps) => JSX.Element;
|
|
10
|
+
declare const NavMenuGroup: ({ children, scrollable, style }: INavMenuGroupProps) => JSX.Element;
|
|
11
11
|
|
|
12
12
|
export { NavMenuGroup as default };
|
|
@@ -11,14 +11,16 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
11
11
|
const NavMenuGroup = _ref => {
|
|
12
12
|
let {
|
|
13
13
|
children,
|
|
14
|
-
scrollable
|
|
14
|
+
scrollable,
|
|
15
|
+
style
|
|
15
16
|
} = _ref;
|
|
16
17
|
const {
|
|
17
18
|
isExpanded,
|
|
18
19
|
menuSize
|
|
19
20
|
} = (0, _react.useContext)(_helpers.SideNavContext);
|
|
20
21
|
return /*#__PURE__*/_react.default.createElement("ul", {
|
|
21
|
-
|
|
22
|
+
style: style,
|
|
23
|
+
className: "".concat(scrollable && 'customscroll', "\n ").concat((0, _helpers.default)(isExpanded, menuSize))
|
|
22
24
|
}, children);
|
|
23
25
|
};
|
|
24
26
|
var _default = exports.default = NavMenuGroup;
|
|
@@ -30,6 +30,7 @@ const NavMenuItem = props => {
|
|
|
30
30
|
} = props;
|
|
31
31
|
const [showSubMenu, setShowSubMenu] = (0, _react.useState)(false);
|
|
32
32
|
const [targetDimensions, setTargetDimensions] = (0, _react.useState)({});
|
|
33
|
+
const [isFinalWindow, setIsFinalWindow] = (0, _react.useState)(false);
|
|
33
34
|
const submenuContainerRef = (0, _react.useRef)(null);
|
|
34
35
|
const submenuContentRef = (0, _react.useRef)(null);
|
|
35
36
|
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
|
|
@@ -44,9 +45,12 @@ const NavMenuItem = props => {
|
|
|
44
45
|
disabled
|
|
45
46
|
} = onDenied;
|
|
46
47
|
const onMouseEnter = e => {
|
|
48
|
+
const windowHeight = window.innerHeight;
|
|
47
49
|
const eventTarget = e.target;
|
|
50
|
+
const position = eventTarget.getBoundingClientRect();
|
|
48
51
|
setShowSubMenu(true);
|
|
49
|
-
setTargetDimensions(
|
|
52
|
+
setTargetDimensions(position);
|
|
53
|
+
if (position.bottom >= windowHeight - 150) setIsFinalWindow(true);
|
|
50
54
|
};
|
|
51
55
|
const toggleSubMenu = () => {
|
|
52
56
|
setShowSubMenu(!showSubMenu);
|
|
@@ -58,7 +62,7 @@ const NavMenuItem = props => {
|
|
|
58
62
|
var _submenuContainerRef$, _submenuContentRef$cu, _submenuContentRef$cu2;
|
|
59
63
|
const heigthSubmenuContainer = ((_submenuContainerRef$ = submenuContainerRef.current) === null || _submenuContainerRef$ === void 0 ? void 0 : _submenuContainerRef$.clientHeight) || 0;
|
|
60
64
|
const heigthSubmenuContent = ((_submenuContentRef$cu = submenuContentRef.current) === null || _submenuContentRef$cu === void 0 ? void 0 : _submenuContentRef$cu.clientHeight) || 0;
|
|
61
|
-
const maxHeigthSubMenu = (window.innerHeight - targetDimensions.top - (heigthSubmenuContainer - heigthSubmenuContent) - 1).toString().concat('px') || '0px';
|
|
65
|
+
const maxHeigthSubMenu = isFinalWindow ? '100%' : (window.innerHeight - targetDimensions.top - (heigthSubmenuContainer - heigthSubmenuContent) - 1).toString().concat('px') || '0px';
|
|
62
66
|
(_submenuContentRef$cu2 = submenuContentRef.current) === null || _submenuContentRef$cu2 === void 0 ? void 0 : _submenuContentRef$cu2.style.setProperty('max-height', maxHeigthSubMenu);
|
|
63
67
|
}, [showSubMenu]);
|
|
64
68
|
if (unvisible) return null;
|
|
@@ -72,6 +76,7 @@ const NavMenuItem = props => {
|
|
|
72
76
|
},
|
|
73
77
|
onMouseLeave: () => {
|
|
74
78
|
setShowSubMenu(false);
|
|
79
|
+
setIsFinalWindow(false);
|
|
75
80
|
}
|
|
76
81
|
}, /*#__PURE__*/_react.default.createElement(_MenuLink.default, _extends({
|
|
77
82
|
disabled: disabled
|
|
@@ -87,7 +92,12 @@ const NavMenuItem = props => {
|
|
|
87
92
|
}, title), !childrenIsSubMenu && children)), showSubMenu && children && childrenIsSubMenu && !disabled && !openSearchMenuPopup && /*#__PURE__*/_react.default.createElement("div", {
|
|
88
93
|
ref: submenuContainerRef,
|
|
89
94
|
className: "submenu-container",
|
|
90
|
-
style: {
|
|
95
|
+
style: isFinalWindow ? {
|
|
96
|
+
marginLeft: targetDimensions.width,
|
|
97
|
+
bottom: '0',
|
|
98
|
+
paddingBottom: '10px',
|
|
99
|
+
position: 'fixed'
|
|
100
|
+
} : {
|
|
91
101
|
marginLeft: targetDimensions.width,
|
|
92
102
|
top: targetDimensions.top,
|
|
93
103
|
minWidth,
|
|
@@ -93,12 +93,12 @@ const SideNav = props => {
|
|
|
93
93
|
childrenProps.forEach(child => {
|
|
94
94
|
if (child) {
|
|
95
95
|
compareChild(child);
|
|
96
|
-
if (child.props.children) scanChildrenContent(child.props.children);
|
|
96
|
+
if (child.props && child.props.children) scanChildrenContent(child.props.children);
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
} else if (childrenProps) {
|
|
100
100
|
compareChild(childrenProps);
|
|
101
|
-
if (childrenProps.props.children) scanChildrenContent(childrenProps.props.children);
|
|
101
|
+
if (childrenProps.props && childrenProps.props.children) scanChildrenContent(childrenProps.props.children);
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
const openSearchMenu = () => {
|
|
@@ -165,7 +165,7 @@ const SideNav = props => {
|
|
|
165
165
|
return /*#__PURE__*/_react.default.createElement(_helpers.SideNavContext.Provider, {
|
|
166
166
|
value: contextValues
|
|
167
167
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
168
|
-
className: "sidenav-component ".concat(openSearchMenuPopup ? '-blocked' : '', " ").concat(customClass),
|
|
168
|
+
className: "sidenav-component ".concat(isExpanded ? '-expanded' : '', " ").concat(openSearchMenuPopup ? '-blocked' : '', " ").concat(customClass),
|
|
169
169
|
ref: sideNavRef
|
|
170
170
|
}, showExpandMenu && /*#__PURE__*/_react.default.createElement(_ExpandMenu.default, {
|
|
171
171
|
expandMenuCustomClass: "".concat(isExpanded && 'closefromexpanded', " ").concat(expandMenuCustomClass),
|
|
@@ -32,18 +32,17 @@ const PopupMenuSearch = props => {
|
|
|
32
32
|
style
|
|
33
33
|
});
|
|
34
34
|
const closeOnEsc = e => {
|
|
35
|
-
if (e.key === '
|
|
35
|
+
if (e.keyCode === 27 || e.key === 'ESC') {
|
|
36
36
|
handlerClose();
|
|
37
|
-
e.stopPropagation();
|
|
38
37
|
}
|
|
39
38
|
};
|
|
40
39
|
(0, _react.useEffect)(() => {
|
|
41
40
|
body.appendChild(popupRef.current);
|
|
42
41
|
if (searchFieldRef && searchFieldRef.current) searchFieldRef.current.focus();
|
|
43
|
-
document.body.addEventListener('
|
|
42
|
+
document.body.addEventListener('keyup', closeOnEsc);
|
|
44
43
|
return () => {
|
|
45
44
|
body.removeChild(popupRef.current);
|
|
46
|
-
document.body.removeEventListener('
|
|
45
|
+
document.body.removeEventListener('keyup', closeOnEsc);
|
|
47
46
|
};
|
|
48
47
|
}, []);
|
|
49
48
|
(0, _react.useEffect)(() => {
|