linear-react-components-ui 1.1.2-beta.2 → 1.1.2-beta.20
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/SizePixels.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 +9 -2
- package/lib/assets/styles/hint.scss +4 -0
- package/lib/assets/styles/input.scss +2 -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/checkbox/Label.js +13 -4
- package/lib/checkbox/index.d.ts +2 -2
- package/lib/checkbox/index.js +21 -16
- package/lib/checkbox/types.d.ts +1 -0
- package/lib/dialog/base/Content.js +1 -0
- package/lib/dialog/base/Header.js +4 -4
- package/lib/dialog/base/index.js +6 -4
- package/lib/drawer/Drawer.js +5 -4
- package/lib/dropdown/Popup.d.ts +1 -1
- package/lib/dropdown/Popup.js +5 -2
- package/lib/dropdown/types.d.ts +1 -0
- package/lib/fieldset/index.js +4 -2
- package/lib/fieldset/types.d.ts +2 -0
- package/lib/gridlayout/GridRow.js +10 -2
- package/lib/gridlayout/types.d.ts +1 -0
- package/lib/hint/helpers.d.ts +3 -0
- package/lib/hint/helpers.js +21 -0
- package/lib/hint/index.d.ts +1 -1
- package/lib/hint/index.js +5 -15
- package/lib/hint/types.d.ts +1 -0
- package/lib/inputs/base/InputTextBase.js +8 -2
- package/lib/inputs/base/helpers.d.ts +1 -2
- package/lib/inputs/base/helpers.js +1 -8
- package/lib/inputs/base/types.d.ts +1 -0
- package/lib/inputs/errorMessage/index.d.ts +16 -0
- package/lib/inputs/errorMessage/index.js +26 -0
- package/lib/inputs/file/DefaultFile.js +4 -2
- package/lib/inputs/file/DragDropFile.js +4 -2
- package/lib/inputs/inputHOC.d.ts +1 -0
- package/lib/inputs/mask/BaseMask.d.ts +1 -0
- package/lib/inputs/mask/Cnpj.d.ts +1 -0
- package/lib/inputs/mask/Cpf.d.ts +1 -0
- package/lib/inputs/mask/Phone.d.ts +1 -0
- package/lib/inputs/mask/ZipCode.d.ts +1 -0
- package/lib/inputs/mask/imaskHOC.d.ts +1 -0
- package/lib/inputs/mask/index.d.ts +1 -0
- package/lib/inputs/mask/types.d.ts +3 -1
- package/lib/inputs/multiSelect/ActionButtons.js +10 -8
- package/lib/inputs/multiSelect/Dropdown.js +2 -6
- package/lib/inputs/number/BaseNumber.d.ts +1 -0
- package/lib/inputs/number/Currency.d.ts +1 -0
- package/lib/inputs/number/Decimal.d.ts +1 -0
- package/lib/inputs/number/index.d.ts +1 -0
- package/lib/inputs/number/types.d.ts +1 -0
- package/lib/inputs/period/index.js +4 -1
- package/lib/inputs/search/index.d.ts +1 -0
- package/lib/inputs/select/ActionButtons.d.ts +1 -0
- package/lib/inputs/select/ActionButtons.js +18 -27
- package/lib/inputs/select/Dropdown.d.ts +1 -0
- package/lib/inputs/select/Dropdown.js +2 -6
- package/lib/inputs/select/helper.d.ts +1 -0
- package/lib/inputs/select/multiple/Selecteds.d.ts +1 -1
- package/lib/inputs/select/multiple/Selecteds.js +3 -5
- package/lib/inputs/select/multiple/index.js +38 -19
- package/lib/inputs/select/simple/index.js +60 -31
- package/lib/inputs/select/types.d.ts +3 -2
- package/lib/inputs/types.d.ts +11 -5
- package/lib/menus/sidenav/popup_menu_search/index.js +4 -3
- package/lib/table/HeaderColumn.d.ts +1 -1
- package/lib/table/HeaderColumn.js +5 -1
- package/lib/table/types.d.ts +2 -0
- package/lib/tabs/context.js +1 -1
- package/lib/tabs/types.d.ts +3 -3
- package/package.json +4 -4
- package/.tool-versions +0 -1
|
@@ -16,6 +16,7 @@ var _Dialog = _interopRequireDefault(require("./Dialog"));
|
|
|
16
16
|
var _hint = _interopRequireDefault(require("../../hint"));
|
|
17
17
|
var helperBase = _interopRequireWildcard(require("../base/helpers"));
|
|
18
18
|
require("../../assets/styles/periodpicker.scss");
|
|
19
|
+
var _errorMessage = require("../errorMessage");
|
|
19
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
21
|
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); }
|
|
21
22
|
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; }
|
|
@@ -374,6 +375,8 @@ const PeriodPicker = props => {
|
|
|
374
375
|
visible: !!hint,
|
|
375
376
|
customClass: "hint",
|
|
376
377
|
description: hint
|
|
377
|
-
}),
|
|
378
|
+
}), /*#__PURE__*/_react.default.createElement(_errorMessage.ErrorMessage, {
|
|
379
|
+
messages: props.errorMessages
|
|
380
|
+
}));
|
|
378
381
|
};
|
|
379
382
|
var _default = exports.default = PeriodPicker;
|
|
@@ -11,37 +11,28 @@ const ActionButtons = props => {
|
|
|
11
11
|
const {
|
|
12
12
|
disabled = false,
|
|
13
13
|
showClearButton = true,
|
|
14
|
-
dropDownOpened
|
|
14
|
+
dropDownOpened,
|
|
15
|
+
handlerOpenClose,
|
|
16
|
+
handlerClear
|
|
15
17
|
} = props;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
role: "button",
|
|
24
|
-
className: "actionbutton",
|
|
25
|
-
onClick: () => {
|
|
26
|
-
props.handleClear();
|
|
27
|
-
},
|
|
28
|
-
onKeyPress: () => {},
|
|
29
|
-
tabIndex: -1
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
19
|
+
className: "actionbuttonsselect"
|
|
20
|
+
}, showClearButton && /*#__PURE__*/_react.default.createElement("button", {
|
|
21
|
+
disabled: disabled,
|
|
22
|
+
tabIndex: -1,
|
|
23
|
+
className: "actionbutton buttonclear",
|
|
24
|
+
onClick: handlerClear
|
|
30
25
|
}, /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
31
|
-
pointerEvents: "none",
|
|
32
26
|
name: "cancel",
|
|
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
|
|
42
|
-
}, /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
43
|
-
name: dropDownOpened ? 'mini_up' : 'mini_down',
|
|
44
27
|
pointerEvents: "none"
|
|
28
|
+
})), /*#__PURE__*/_react.default.createElement("button", {
|
|
29
|
+
disabled: disabled,
|
|
30
|
+
tabIndex: -1,
|
|
31
|
+
className: "actionbutton buttonopenclose",
|
|
32
|
+
onClick: handlerOpenClose
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
34
|
+
pointerEvents: "none",
|
|
35
|
+
name: dropDownOpened ? 'mini_up' : 'mini_down'
|
|
45
36
|
})));
|
|
46
37
|
};
|
|
47
38
|
var _default = exports.default = ActionButtons;
|
|
@@ -29,7 +29,6 @@ const Dropdown = props => {
|
|
|
29
29
|
dropdownWidth,
|
|
30
30
|
gridWrapperStyle,
|
|
31
31
|
handleOnSelect,
|
|
32
|
-
handleOnBlur,
|
|
33
32
|
inputValue,
|
|
34
33
|
handleOnFocus,
|
|
35
34
|
opened,
|
|
@@ -83,15 +82,12 @@ const Dropdown = props => {
|
|
|
83
82
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
84
83
|
key: "dropdowmIten ".concat(item[idKey], "}"),
|
|
85
84
|
className: helper.getDropdownItemCssClass(itemSelected, disabled, striped)
|
|
86
|
-
}, /*#__PURE__*/_react.default.createElement("
|
|
87
|
-
role: "button",
|
|
85
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
88
86
|
className: "menubutton",
|
|
89
87
|
tabIndex: -1,
|
|
90
|
-
|
|
91
|
-
onClick: () => {
|
|
88
|
+
onClick: event => {
|
|
92
89
|
if (!disabled) {
|
|
93
90
|
handleOnSelect(item);
|
|
94
|
-
handleOnBlur(item);
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
93
|
}, item.iconName && /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IDropdownSelectProps } from '../types.js';
|
|
2
2
|
import { GetSimpleFilteredParams, GetMultipleFilteredParams } from './types.js';
|
|
3
3
|
import 'react';
|
|
4
|
+
import 'imask';
|
|
4
5
|
import '../../@types/PermissionAttr.js';
|
|
5
6
|
import '../../@types/DataCombo.js';
|
|
6
7
|
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, handlerOnUnselect, }: ISelectedsMultipleProps) => JSX.Element;
|
|
10
10
|
|
|
11
11
|
export { Selecteds as default };
|
|
@@ -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;
|
|
@@ -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,
|
|
@@ -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,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 'react';
|
|
5
|
+
import { MutableRefObject } from 'react';
|
|
6
6
|
import '../../@types/Period.js';
|
|
7
7
|
|
|
8
8
|
type AllOptions = {
|
|
@@ -47,6 +47,7 @@ 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);
|
|
50
51
|
}
|
|
51
52
|
interface ISelectFieldProps extends Omit<ISimpleSelectProps, 'idKey' | 'value' | 'descriptionKey'> {
|
|
52
53
|
multiple?: boolean;
|
|
@@ -92,7 +93,7 @@ interface ISelectedsMultipleProps {
|
|
|
92
93
|
idKey: string;
|
|
93
94
|
descriptionKey: DescriptionKey;
|
|
94
95
|
currents: DataCombo[];
|
|
95
|
-
|
|
96
|
+
handlerOnUnselect: (id: string) => void;
|
|
96
97
|
}
|
|
97
98
|
interface GetFilteredParams {
|
|
98
99
|
dataSource: DataCombo[];
|
package/lib/inputs/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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';
|
|
@@ -62,7 +63,7 @@ interface IMaskHOCProps {
|
|
|
62
63
|
inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
|
|
63
64
|
placeholderChar?: string;
|
|
64
65
|
lazy?: boolean;
|
|
65
|
-
definitions?:
|
|
66
|
+
definitions?: IMask.AllMaskedOptions['definitions'];
|
|
66
67
|
groups?: object;
|
|
67
68
|
pattern?: string;
|
|
68
69
|
format?: () => void;
|
|
@@ -97,7 +98,7 @@ interface IMaskHOCProps {
|
|
|
97
98
|
rounded?: boolean;
|
|
98
99
|
errorMessages?: string[];
|
|
99
100
|
skeletonize?: boolean;
|
|
100
|
-
mask?:
|
|
101
|
+
mask?: IMask.AnyMask;
|
|
101
102
|
isDateField?: boolean;
|
|
102
103
|
autoCompleteMask?: 'left' | 'right';
|
|
103
104
|
}
|
|
@@ -133,8 +134,8 @@ interface IDropdownSelectProps {
|
|
|
133
134
|
align?: 'left' | 'right';
|
|
134
135
|
}
|
|
135
136
|
interface IActionButtonsSelectProps {
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
handlerClear: () => void;
|
|
138
|
+
handlerOpenClose: () => void;
|
|
138
139
|
dropDownOpened: boolean;
|
|
139
140
|
showClearButton?: boolean;
|
|
140
141
|
disabled?: boolean;
|
|
@@ -149,5 +150,10 @@ interface IButtonsProps {
|
|
|
149
150
|
transparent: boolean;
|
|
150
151
|
disabled?: boolean;
|
|
151
152
|
}
|
|
153
|
+
interface ErrorProps {
|
|
154
|
+
customClass?: string;
|
|
155
|
+
style?: React.CSSProperties;
|
|
156
|
+
messages?: string | string[];
|
|
157
|
+
}
|
|
152
158
|
|
|
153
|
-
export type { IActionButtonsSelectProps, IAdvancedFilterProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
|
|
159
|
+
export type { ErrorProps, IActionButtonsSelectProps, IAdvancedFilterProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
|
|
@@ -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)(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ITableHeaderProps } from './types.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
|
|
4
|
-
declare const HeaderColumn: ({ customClass, style, children, textAlign, visible, id, }: ITableHeaderProps) => JSX.Element | null;
|
|
4
|
+
declare const HeaderColumn: ({ customClass, style, children, textAlign, visible, id, rowSpan, colSpan, }: ITableHeaderProps) => JSX.Element | null;
|
|
5
5
|
|
|
6
6
|
export { HeaderColumn as default };
|
|
@@ -17,7 +17,9 @@ const HeaderColumn = _ref => {
|
|
|
17
17
|
children,
|
|
18
18
|
textAlign,
|
|
19
19
|
visible = true,
|
|
20
|
-
id
|
|
20
|
+
id,
|
|
21
|
+
rowSpan,
|
|
22
|
+
colSpan
|
|
21
23
|
} = _ref;
|
|
22
24
|
const {
|
|
23
25
|
skeletonize,
|
|
@@ -28,6 +30,8 @@ const HeaderColumn = _ref => {
|
|
|
28
30
|
if (!visible) return null;
|
|
29
31
|
return /*#__PURE__*/_react.default.createElement("th", {
|
|
30
32
|
id: id,
|
|
33
|
+
rowSpan: rowSpan,
|
|
34
|
+
colSpan: colSpan,
|
|
31
35
|
className: "headercolumn ".concat(customClass, " text-align-").concat(textAlign),
|
|
32
36
|
style: style
|
|
33
37
|
}, skeletonize && (skeletonInHeader || !skeletonInRows) && !vertical ? /*#__PURE__*/_react.default.createElement(_skeleton.default, {
|
package/lib/table/types.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ interface ITableHeaderProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
|
25
25
|
textAlign?: string;
|
|
26
26
|
visible?: boolean;
|
|
27
27
|
id?: string;
|
|
28
|
+
rowSpan?: number;
|
|
29
|
+
colSpan?: number;
|
|
28
30
|
}
|
|
29
31
|
interface ITableBodyProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
30
32
|
children?: ReactNode;
|
package/lib/tabs/context.js
CHANGED
|
@@ -67,7 +67,7 @@ function TabsProvider(_ref) {
|
|
|
67
67
|
updateTabs(tabId);
|
|
68
68
|
setSelectedTabId(tabId);
|
|
69
69
|
if (onTabChange) {
|
|
70
|
-
onTabChange(
|
|
70
|
+
onTabChange(tabId);
|
|
71
71
|
}
|
|
72
72
|
}, [onTabChange, setSelectedTabId, updateTabs]);
|
|
73
73
|
const removeTab = (0, _react.useCallback)(tabId => {
|
package/lib/tabs/types.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ interface TabsProviderProps {
|
|
|
23
23
|
container: RefObject<HTMLDivElement>;
|
|
24
24
|
tabsWidth: number | string;
|
|
25
25
|
selectedTab?: string | number | null;
|
|
26
|
-
onTabChange?: (tabId: string) => void;
|
|
26
|
+
onTabChange?: (tabId: string | number) => void;
|
|
27
27
|
onTabClose?: (tabId: string) => void;
|
|
28
28
|
firstTabIdent?: boolean;
|
|
29
29
|
}
|
|
@@ -32,12 +32,12 @@ interface ITabsPros {
|
|
|
32
32
|
toolbar?: ReactElement;
|
|
33
33
|
toolBarRef?: (value: HTMLDivElement | null) => void;
|
|
34
34
|
children?: ReactNode;
|
|
35
|
-
selectedTab?: string;
|
|
35
|
+
selectedTab?: string | number;
|
|
36
36
|
tabMenuSize?: Size;
|
|
37
37
|
tabMenuAlign?: Position;
|
|
38
38
|
firstTabIdent?: boolean;
|
|
39
39
|
tabMenuPosition?: Exclude<Position, 'center'>;
|
|
40
|
-
handlerTabClick?: (id?: string) => void;
|
|
40
|
+
handlerTabClick?: (id?: string | number) => void;
|
|
41
41
|
handlerCloseTab?: (id?: string, idx?: string) => void;
|
|
42
42
|
customClassForToolBar?: string;
|
|
43
43
|
tabsWidth?: string | number;
|