linear-react-components-ui 1.1.2-beta.7 → 1.1.2-beta.9
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/assets/styles/checkbox.scss +0 -8
- package/lib/assets/styles/dialog.scss +10 -27
- package/lib/assets/styles/icon.scss +31 -4
- package/lib/assets/styles/multiSelect.scss +1 -6
- package/lib/assets/styles/select.scss +7 -13
- package/lib/assets/styles/tabs.scss +0 -3
- package/lib/assets/styles/textContent.scss +9 -0
- package/lib/checkbox/index.d.ts +2 -2
- package/lib/checkbox/index.js +11 -12
- package/lib/checkbox/types.d.ts +1 -2
- package/lib/dialog/Custom.js +4 -2
- 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/dialog/form/index.js +3 -3
- package/lib/drawer/Drawer.js +4 -5
- package/lib/drawer/Header.js +1 -1
- 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/icons/helper.js +1 -1
- package/lib/icons/index.d.ts +3 -2
- package/lib/icons/index.js +10 -3
- package/lib/icons/types.d.ts +22 -9
- package/lib/index.d.ts +1 -0
- package/lib/inputs/base/InputTextBase.js +1 -3
- package/lib/inputs/base/types.d.ts +0 -1
- package/lib/inputs/multiSelect/ActionButtons.js +8 -10
- package/lib/inputs/multiSelect/Dropdown.js +6 -2
- package/lib/inputs/multiSelect/index.js +2 -2
- package/lib/inputs/select/ActionButtons.js +25 -16
- package/lib/inputs/select/Dropdown.js +6 -2
- 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 +21 -29
- package/lib/inputs/select/simple/index.js +32 -51
- package/lib/inputs/select/types.d.ts +1 -1
- package/lib/inputs/types.d.ts +2 -2
- package/lib/menus/float/types.d.ts +1 -1
- package/lib/menus/sidenav/index.js +3 -3
- package/lib/menus/sidenav/popup_menu_help/index.js +78 -0
- package/lib/menus/sidenav/popup_menu_search/index.js +2 -3
- package/lib/menus/sidenav/types.d.ts +1 -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/lib/textContent/index.d.ts +8 -0
- package/lib/textContent/index.js +30 -0
- package/lib/tooltip/index.js +2 -2
- package/lib/treeview/Node.js +2 -2
- package/package.json +2 -2
|
@@ -64,8 +64,7 @@ const InputTextBase = props => {
|
|
|
64
64
|
onDragOver,
|
|
65
65
|
onDrop,
|
|
66
66
|
onDragLeave,
|
|
67
|
-
readOnlyClass
|
|
68
|
-
autoComplete = 'on'
|
|
67
|
+
readOnlyClass
|
|
69
68
|
} = props;
|
|
70
69
|
let propsInput;
|
|
71
70
|
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
|
|
@@ -176,7 +175,6 @@ const InputTextBase = props => {
|
|
|
176
175
|
rows: props.rows,
|
|
177
176
|
cols: props.cols
|
|
178
177
|
}, inputProps())) : /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
179
|
-
autoComplete: autoComplete,
|
|
180
178
|
tabIndex: applyTabIndex()
|
|
181
179
|
}, inputProps())), children), helpers.getRightElements(errorMessages || [], skeletonize, rightElements)), /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
182
180
|
visible: !!hint,
|
|
@@ -20,24 +20,22 @@ const ActionButtons = _ref => {
|
|
|
20
20
|
dropdownAlignButton = 'left'
|
|
21
21
|
} = _ref;
|
|
22
22
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
23
|
-
transparent: true,
|
|
24
|
-
tabIndex: -1,
|
|
25
23
|
disabled: disabled,
|
|
26
|
-
boxShadow: false,
|
|
27
24
|
size: "small",
|
|
25
|
+
iconName: dropdownOpened ? 'up' : 'down',
|
|
28
26
|
onClick: handleOpenClose,
|
|
29
27
|
customClass: "actionbutton",
|
|
30
|
-
iconName: dropdownOpened ? 'up' : 'down'
|
|
31
|
-
}), /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
32
|
-
dropdown: true,
|
|
33
28
|
transparent: true,
|
|
29
|
+
boxShadow: false
|
|
30
|
+
}), /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
34
31
|
disabled: disabled,
|
|
35
|
-
tabIndex: -1,
|
|
36
|
-
boxShadow: false,
|
|
37
|
-
showIconDropdown: false,
|
|
38
32
|
iconName: "more1",
|
|
33
|
+
transparent: true,
|
|
34
|
+
boxShadow: false,
|
|
39
35
|
customClass: "actionbutton",
|
|
40
|
-
|
|
36
|
+
dropdown: true,
|
|
37
|
+
dropdownAlign: dropdownAlignButton,
|
|
38
|
+
showIconDropdown: false
|
|
41
39
|
}, /*#__PURE__*/_react.default.createElement(_list.default, null, /*#__PURE__*/_react.default.createElement(_list.ListItem, {
|
|
42
40
|
itemId: "1",
|
|
43
41
|
text: "Marcar Todos",
|
|
@@ -94,9 +94,11 @@ const Dropdown = props => {
|
|
|
94
94
|
className: "listcontainer"
|
|
95
95
|
}, dataCombo && dataCombo.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
96
96
|
className: "item selectall"
|
|
97
|
-
}, /*#__PURE__*/_react.default.createElement("
|
|
97
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
98
|
+
role: "button",
|
|
98
99
|
className: "menubutton",
|
|
99
100
|
tabIndex: -1,
|
|
101
|
+
onKeyPress: () => {},
|
|
100
102
|
onClick: () => isAllChecked ? onUncheckAll(true) : onCheckAll(true)
|
|
101
103
|
}, /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
102
104
|
name: isAllChecked && dataCombo.length > 0 ? 'checkboxChecked2' : 'checkboxUnchecked2',
|
|
@@ -108,9 +110,11 @@ const Dropdown = props => {
|
|
|
108
110
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
109
111
|
key: "dropdowmItem ".concat(item[idKey], "}"),
|
|
110
112
|
className: "item ".concat(isChecked && '-selected')
|
|
111
|
-
}, /*#__PURE__*/_react.default.createElement("
|
|
113
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
114
|
+
role: "button",
|
|
112
115
|
className: "menubutton",
|
|
113
116
|
tabIndex: -1,
|
|
117
|
+
onKeyPress: () => {},
|
|
114
118
|
onClick: () => {
|
|
115
119
|
onSelect(item);
|
|
116
120
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var uuid = _interopRequireWildcard(require("uuid"));
|
|
10
10
|
var _InputTextBase = _interopRequireDefault(require("../base/InputTextBase"));
|
|
11
11
|
var _ActionButtons = _interopRequireDefault(require("./ActionButtons"));
|
|
12
12
|
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
|
@@ -33,7 +33,7 @@ const MultiSelectField = props => {
|
|
|
33
33
|
gridLayout,
|
|
34
34
|
dropdownAlignButton = 'left'
|
|
35
35
|
} = props;
|
|
36
|
-
const componentId = "multiSelect-component".concat(
|
|
36
|
+
const componentId = "multiSelect-component".concat(uuid.v1());
|
|
37
37
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
38
38
|
const [selecteds, setSelecteds] = (0, _react.useState)();
|
|
39
39
|
const [inputValue, setInputValue] = (0, _react.useState)('');
|
|
@@ -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
|
-
|
|
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",
|
|
23
24
|
className: "actionbutton",
|
|
24
|
-
onClick:
|
|
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
|
-
tabIndex: -1,
|
|
33
|
+
customClass: "iconclear"
|
|
34
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
35
|
+
role: "button",
|
|
31
36
|
className: "actionbutton",
|
|
32
|
-
onClick:
|
|
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, {
|
|
@@ -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;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
|
-
var
|
|
9
|
+
var uuid = _interopRequireWildcard(require("uuid"));
|
|
10
10
|
var _Dropdown = _interopRequireDefault(require("../Dropdown"));
|
|
11
11
|
var _ActionButtons = _interopRequireDefault(require("../ActionButtons"));
|
|
12
12
|
var _Selecteds = _interopRequireDefault(require("./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)([]);
|
|
@@ -36,12 +35,11 @@ const MultipleSelect = props => {
|
|
|
36
35
|
const [insideComponent, setInsideComponent] = (0, _react.useState)(false);
|
|
37
36
|
const [onDenied, setOnDeniedSelect] = (0, _react.useState)();
|
|
38
37
|
const [valueFromProps, setValueFromProps] = (0, _react.useState)([]);
|
|
39
|
-
const componentId = "select-component".concat(
|
|
38
|
+
const componentId = "select-component".concat(uuid.v1());
|
|
40
39
|
const componentRef = (0, _react.useRef)(null);
|
|
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,10 +115,7 @@ 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) {
|
|
@@ -198,8 +190,6 @@ const MultipleSelect = props => {
|
|
|
198
190
|
ref: componentRef,
|
|
199
191
|
className: "select-component"
|
|
200
192
|
}, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
|
|
201
|
-
inputRef: inputTextRef,
|
|
202
|
-
autoComplete: "off",
|
|
203
193
|
value: inputValue.toString(),
|
|
204
194
|
readOnly: shouldBeReadOnly(),
|
|
205
195
|
onFocus: () => {
|
|
@@ -218,19 +208,21 @@ const MultipleSelect = props => {
|
|
|
218
208
|
selectWrapper.current = r;
|
|
219
209
|
},
|
|
220
210
|
handlerSetOnDenied: setOnDenied,
|
|
221
|
-
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
|
|
222
|
-
showClearButton: showClearButton,
|
|
211
|
+
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, _extends({}, props, {
|
|
223
212
|
disabled: shouldDisable() || shouldBeReadOnly(),
|
|
224
213
|
dropDownOpened: opened,
|
|
225
|
-
|
|
214
|
+
handleClear: () => {
|
|
226
215
|
if (shouldDisable()) return null;
|
|
227
216
|
return onClearClick();
|
|
228
217
|
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
218
|
+
handleOpenClose: () => {
|
|
219
|
+
onOpenClose();
|
|
220
|
+
}
|
|
221
|
+
}))
|
|
222
|
+
}), /*#__PURE__*/_react.default.createElement(_Selecteds.default, _extends({
|
|
223
|
+
currents: currents
|
|
224
|
+
}, props, {
|
|
225
|
+
handleOnUnselect: onUnselect
|
|
234
226
|
}))), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, props, {
|
|
235
227
|
selected: selected,
|
|
236
228
|
selectFieldRef: componentRef,
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var
|
|
8
|
+
var uuid = _interopRequireWildcard(require("uuid"));
|
|
9
9
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
10
|
var _Dropdown = _interopRequireDefault(require("../Dropdown"));
|
|
11
11
|
var _ActionButtons = _interopRequireDefault(require("../ActionButtons"));
|
|
@@ -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: {
|
|
@@ -104,6 +104,7 @@ const SimpleSelect = props => {
|
|
|
104
104
|
}
|
|
105
105
|
setOpened(true);
|
|
106
106
|
setInputText(valueFilter);
|
|
107
|
+
setSelected(selectedFilter);
|
|
107
108
|
if (selectedFilter) {
|
|
108
109
|
if (descriptionKeyIsString && valueFilter === selectedFilter[descriptionKey] || !descriptionKeyIsString && valueFilter === descriptionKey(selectedFilter)) {
|
|
109
110
|
onChange(selectedFilter);
|
|
@@ -111,22 +112,18 @@ const SimpleSelect = props => {
|
|
|
111
112
|
}
|
|
112
113
|
};
|
|
113
114
|
const onSelect = selectedDropdown => {
|
|
114
|
-
if (
|
|
115
|
+
if (selectedDropdown === undefined) return;
|
|
116
|
+
setOpened(false);
|
|
115
117
|
setSelected(selectedDropdown);
|
|
116
118
|
if (descriptionKeyIsString) setInputText(selectedDropdown[descriptionKey]);else setInputText(descriptionKey(selectedDropdown));
|
|
117
|
-
|
|
118
|
-
resolve(onChange(selectedDropdown));
|
|
119
|
-
}).finally(() => {
|
|
120
|
-
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
121
|
-
setOpened(false);
|
|
122
|
-
});
|
|
119
|
+
onChange(selectedDropdown);
|
|
123
120
|
};
|
|
124
121
|
const onOpenClose = () => {
|
|
125
|
-
setOpened(
|
|
122
|
+
setOpened(!opened);
|
|
126
123
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
127
124
|
};
|
|
128
125
|
const onFocus = () => {
|
|
129
|
-
|
|
126
|
+
setOpened(openDropdownOnFocus);
|
|
130
127
|
if (selectWrapper) {
|
|
131
128
|
const dropdownWidthFocus = selectWrapper.current ? selectWrapper.current.clientWidth : 0;
|
|
132
129
|
setDropdownWidth(dropdownWidthFocus);
|
|
@@ -136,20 +133,15 @@ const SimpleSelect = props => {
|
|
|
136
133
|
if (props.onBlur) {
|
|
137
134
|
const event = getSelectEvent(selected);
|
|
138
135
|
props.onBlur(event);
|
|
139
|
-
if (selected
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
resolve(onChange(null));
|
|
144
|
-
}).finally(() => {
|
|
145
|
-
onChange();
|
|
146
|
-
});
|
|
136
|
+
if (selected) {
|
|
137
|
+
if (descriptionKeyIsString && inputText !== selected[descriptionKey] || !descriptionKeyIsString && inputText !== descriptionKey(selected)) {
|
|
138
|
+
clearSelected();
|
|
139
|
+
}
|
|
147
140
|
}
|
|
148
141
|
}
|
|
149
142
|
if (!insideComponent) {
|
|
150
143
|
setOpened(false);
|
|
151
144
|
setIsTyping(false);
|
|
152
|
-
setDataCombo(dataSourceWithAllOptions);
|
|
153
145
|
}
|
|
154
146
|
};
|
|
155
147
|
const onInputKeyDown = e => {
|
|
@@ -167,22 +159,13 @@ const SimpleSelect = props => {
|
|
|
167
159
|
index = dataCombo && index === 0 ? (dataCombo === null || dataCombo === void 0 ? void 0 : dataCombo.length) - 1 : index - 1;
|
|
168
160
|
}
|
|
169
161
|
setSelected(dataCombo[index]);
|
|
170
|
-
if (descriptionKeyIsString) setInputText(dataCombo[index][descriptionKey]);
|
|
171
|
-
if (!descriptionKeyIsString) setInputText(descriptionKey(dataCombo[index]));
|
|
172
162
|
}
|
|
173
163
|
}
|
|
174
164
|
if (!isTyping) setIsTyping(true);
|
|
175
165
|
};
|
|
176
166
|
const onClearClick = () => {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}).finally(() => {
|
|
180
|
-
setSelected(null);
|
|
181
|
-
setInputText('');
|
|
182
|
-
onChange();
|
|
183
|
-
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
184
|
-
setOpened(false);
|
|
185
|
-
});
|
|
167
|
+
setSelected(undefined);
|
|
168
|
+
setInputText('');
|
|
186
169
|
};
|
|
187
170
|
const setOnDenied = onDeniedSelect => {
|
|
188
171
|
setOnDeniedSelect(onDeniedSelect);
|
|
@@ -245,8 +228,6 @@ const SimpleSelect = props => {
|
|
|
245
228
|
ref: componentRef,
|
|
246
229
|
className: "select-component"
|
|
247
230
|
}, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
|
|
248
|
-
inputRef: inputTextRef,
|
|
249
|
-
autoComplete: "off",
|
|
250
231
|
readOnly: undigitable || shouldBeReadOnly(),
|
|
251
232
|
value: inputText,
|
|
252
233
|
onFocus: onFocus,
|
|
@@ -261,18 +242,18 @@ const SimpleSelect = props => {
|
|
|
261
242
|
selectWrapper.current = r;
|
|
262
243
|
},
|
|
263
244
|
handlerSetOnDenied: inputOnDenied => setOnDenied(inputOnDenied),
|
|
264
|
-
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
|
|
245
|
+
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, _extends({}, props, {
|
|
265
246
|
disabled: shouldDisable() || shouldBeReadOnly(),
|
|
266
|
-
showClearButton: showClearButton,
|
|
267
247
|
dropDownOpened: opened,
|
|
268
|
-
|
|
248
|
+
handleClear: () => {
|
|
269
249
|
if (shouldDisable()) return null;
|
|
270
250
|
return onClearClick();
|
|
271
251
|
},
|
|
272
|
-
|
|
273
|
-
|
|
252
|
+
handleOpenClose: () => {
|
|
253
|
+
onOpenClose();
|
|
254
|
+
}
|
|
255
|
+
}))
|
|
274
256
|
})), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, props, {
|
|
275
|
-
opened: opened,
|
|
276
257
|
selected: selected,
|
|
277
258
|
inputValue: inputText,
|
|
278
259
|
selectFieldRef: componentRef,
|
|
@@ -286,9 +267,9 @@ const SimpleSelect = props => {
|
|
|
286
267
|
handleOnKeydown: onInputKeyDown,
|
|
287
268
|
handleOnBlur: () => onBlur,
|
|
288
269
|
handleOnFocus: onFocus,
|
|
270
|
+
opened: opened,
|
|
289
271
|
dataCombo: dataCombo,
|
|
290
|
-
dropdownWidth: dropdownWidth || 0
|
|
291
|
-
searchNotFoundText: searchNotFoundText
|
|
272
|
+
dropdownWidth: dropdownWidth || 0
|
|
292
273
|
})));
|
|
293
274
|
};
|
|
294
275
|
var _default = exports.default = SimpleSelect;
|
|
@@ -92,7 +92,7 @@ interface ISelectedsMultipleProps {
|
|
|
92
92
|
idKey: string;
|
|
93
93
|
descriptionKey: DescriptionKey;
|
|
94
94
|
currents: DataCombo[];
|
|
95
|
-
|
|
95
|
+
handleOnUnselect: (id: string) => void;
|
|
96
96
|
}
|
|
97
97
|
interface GetFilteredParams {
|
|
98
98
|
dataSource: DataCombo[];
|
package/lib/inputs/types.d.ts
CHANGED
|
@@ -133,8 +133,8 @@ interface IDropdownSelectProps {
|
|
|
133
133
|
align?: 'left' | 'right';
|
|
134
134
|
}
|
|
135
135
|
interface IActionButtonsSelectProps {
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
handleClear: () => void;
|
|
137
|
+
handleOpenClose: () => void;
|
|
138
138
|
dropDownOpened: boolean;
|
|
139
139
|
showClearButton?: boolean;
|
|
140
140
|
disabled?: boolean;
|
|
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "NavSubMenuItem", {
|
|
|
29
29
|
});
|
|
30
30
|
exports.default = void 0;
|
|
31
31
|
var _react = _interopRequireWildcard(require("react"));
|
|
32
|
-
var
|
|
32
|
+
var uuid = _interopRequireWildcard(require("uuid"));
|
|
33
33
|
var _NavMenuItem = _interopRequireDefault(require("./NavMenuItem"));
|
|
34
34
|
var _NavSubMenuItem = _interopRequireDefault(require("./NavSubMenuItem"));
|
|
35
35
|
var _NavMenuGroup = _interopRequireDefault(require("./NavMenuGroup"));
|
|
@@ -82,7 +82,7 @@ const SideNav = props => {
|
|
|
82
82
|
} = child;
|
|
83
83
|
if ((type === _NavMenuItem.default || type === _NavSubMenuItem.default) && !child.props.children) {
|
|
84
84
|
setMenuItemsContent(prevState => [...prevState, {
|
|
85
|
-
id: "".concat(child.props.title, "-").concat(
|
|
85
|
+
id: "".concat(child.props.title, "-").concat(uuid.v1()),
|
|
86
86
|
content: child.props.title,
|
|
87
87
|
url: child.props.url
|
|
88
88
|
}]);
|
|
@@ -127,7 +127,7 @@ const SideNav = props => {
|
|
|
127
127
|
}, [expanded]);
|
|
128
128
|
const returnMenuItems = () => menuItemsContent.filter(item => item.content !== '');
|
|
129
129
|
const getPopupMenuSearch = () => /*#__PURE__*/_react.default.createElement(_NavMenuGroup.default, {
|
|
130
|
-
key: "popup-menusearch-".concat(
|
|
130
|
+
key: "popup-menusearch-".concat(uuid.v1())
|
|
131
131
|
}, /*#__PURE__*/_react.default.createElement(_NavMenuItem.default, {
|
|
132
132
|
childrenIsSubMenu: false,
|
|
133
133
|
customClass: "-customsidenavitem",
|