linear-react-components-ui 1.1.20-beta.21 → 1.1.20-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/alerts/BaseAlert.js +1 -1
- package/lib/alerts/Message.js +1 -1
- package/lib/avatar/index.js +8 -9
- package/lib/badge/index.js +4 -4
- package/lib/buttons/DangerButton.js +1 -1
- package/lib/buttons/DefaultButton.js +2 -11
- package/lib/buttons/InfoButton.js +1 -1
- package/lib/buttons/PrimaryButton.js +1 -1
- package/lib/buttons/SuccessButton.js +1 -1
- package/lib/buttons/WarningButton.js +1 -1
- package/lib/buttons/button_container/index.js +1 -1
- package/lib/buttons/split_button/index.js +1 -1
- package/lib/calendar/base/Day.js +1 -1
- package/lib/calendar/base/Month.js +1 -1
- package/lib/calendar/base/helpers.js +2 -2
- package/lib/calendar/base/index.js +1 -1
- package/lib/checkbox/Label.js +31 -0
- package/lib/checkbox/index.js +1 -1
- package/lib/dialog/Custom.js +1 -1
- package/lib/dialog/Question.js +4 -2
- package/lib/dialog/base/Content.js +1 -1
- package/lib/dialog/base/Header.js +2 -2
- package/lib/dialog/base/index.js +5 -4
- package/lib/dialog/form/index.js +1 -1
- package/lib/dialog/wizard/progressbar.js +1 -1
- package/lib/dialog/wizard/step.js +1 -1
- package/lib/drawer/Drawer.js +3 -3
- package/lib/drawer/Header.js +1 -1
- package/lib/dropdown/Popup.js +6 -6
- package/lib/dropdown/helper.js +1 -1
- package/lib/dropdown/withDropdown.js +2 -2
- package/lib/fieldset/index.js +7 -7
- package/lib/form/FieldArray.js +1 -1
- package/lib/form/FieldNumber.js +4 -4
- package/lib/form/FieldPeriod.js +2 -2
- package/lib/form/index.js +2 -2
- package/lib/gridlayout/GridCol.js +5 -5
- package/lib/gridlayout/GridRow.js +1 -4
- package/lib/hint/index.js +1 -7
- package/lib/icons/index.js +27 -24
- package/lib/inputs/base/InputTextBase.js +8 -6
- package/lib/inputs/base/Label.js +1 -1
- package/lib/inputs/base/helpers.js +3 -7
- package/lib/inputs/date/helpers.js +1 -4
- package/lib/inputs/date/index.js +15 -9
- package/lib/inputs/errorMessage/index.js +1 -1
- package/lib/inputs/file/DefaultFile.js +6 -5
- package/lib/inputs/file/DragDropFile.js +17 -15
- package/lib/inputs/file/File.js +4 -3
- package/lib/inputs/mask/BaseMask.js +1 -1
- package/lib/inputs/mask/helpers.d.ts +1 -1
- package/lib/inputs/mask/imaskHOC.js +203 -0
- package/lib/inputs/multiSelect/Dropdown.js +10 -9
- package/lib/inputs/multiSelect/helper.js +2 -1
- package/lib/inputs/multiSelect/index.js +9 -7
- package/lib/inputs/period/PeriodList.js +1 -1
- package/lib/inputs/period/helper.js +1 -3
- package/lib/inputs/period/index.js +14 -9
- package/lib/inputs/search/index.js +1 -1
- package/lib/inputs/select/Dropdown.js +1 -1
- package/lib/inputs/select/helper.js +13 -10
- package/lib/inputs/select/multiple/Selecteds.js +1 -1
- package/lib/inputs/select/multiple/index.js +14 -9
- package/lib/inputs/select/simple/index.js +17 -10
- package/lib/inputs/textarea/index.js +1 -1
- package/lib/internals/withTooltip.js +9 -9
- package/lib/labelMessages/index.js +3 -4
- package/lib/labels/DefaultLabel.js +1 -4
- package/lib/labels/label_container/index.js +1 -1
- package/lib/list/Header.js +1 -1
- package/lib/list/Item.js +7 -9
- package/lib/list/index.js +1 -2
- package/lib/menus/float/MenuItem.js +2 -2
- package/lib/menus/float/SubMenuContainer.js +1 -1
- package/lib/menus/float/index.js +1 -1
- package/lib/menus/sidenav/ExpandMenu.js +1 -1
- package/lib/menus/sidenav/NavMenuGroup.js +1 -1
- package/lib/menus/sidenav/NavMenuItem.js +9 -7
- package/lib/menus/sidenav/NavSubMenuItem.js +1 -1
- package/lib/menus/sidenav/helpers.js +1 -1
- package/lib/menus/sidenav/index.js +5 -5
- package/lib/menus/sidenav/popup_menu_help/index.js +85 -0
- package/lib/panel/Content.js +7 -5
- package/lib/panel/Default.js +2 -2
- package/lib/panel/Header.js +3 -3
- package/lib/permissionValidations.js +1 -1
- package/lib/popover/index.js +1 -1
- package/lib/progress/Bar.js +6 -6
- package/lib/radio/index.js +2 -2
- package/lib/shortcuts/index.js +1 -1
- package/lib/skeleton/SkeletonContainer.js +1 -2
- package/lib/skeleton/index.js +1 -4
- package/lib/spinner/index.js +2 -2
- package/lib/split/Split.js +1 -1
- package/lib/split/SplitSide.js +3 -3
- package/lib/table/Body.js +3 -3
- package/lib/table/Header.js +11 -8
- package/lib/table/HeaderColumn.js +1 -1
- package/lib/table/Row.js +3 -3
- package/lib/table/RowColumn.js +1 -1
- package/lib/table/index.js +1 -6
- package/lib/tabs/DropdownItems.js +62 -0
- package/lib/tabs/DropdownTabs.js +1 -1
- package/lib/tabs/Menu.js +1 -1
- package/lib/tabs/MenuItems.js +70 -0
- package/lib/tabs/MenuTabs.js +2 -2
- package/lib/tabs/Panel.js +7 -5
- package/lib/tabs/context.js +6 -3
- package/lib/textContent/index.js +1 -1
- package/lib/toolbar/ButtonBar.js +1 -1
- package/lib/toolbar/index.js +1 -1
- package/lib/tooltip/index.js +7 -7
- package/lib/treetable/Body.js +1 -1
- package/lib/treetable/Header.js +2 -2
- package/lib/treetable/Row.d.ts +1 -1
- package/lib/treetable/Row.js +13 -9
- package/lib/treetable/helpers.d.ts +1 -1
- package/lib/treetable/index.d.ts +2 -2
- package/lib/treeview/Header.js +1 -1
- package/lib/treeview/Node.js +5 -5
- package/lib/treeview/index.js +4 -4
- package/lib/treeview_old/Header.js +29 -0
- package/lib/treeview_old/Node.js +68 -0
- package/lib/treeview_old/index.js +43 -0
- package/lib/{types.d-73cece43.d.ts → types.d-3d9e44cd.d.ts} +1 -0
- package/lib/uitour/index.js +8 -6
- package/package.json +1 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _imask = _interopRequireDefault(require("imask"));
|
|
9
|
+
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
10
|
+
var _permissionValidations = require("../../permissionValidations");
|
|
11
|
+
var _format_number = require("../number/format_number");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
|
|
17
|
+
const IMaskHOC = ComposedComponent => {
|
|
18
|
+
const MaskedComponent = props => {
|
|
19
|
+
const {
|
|
20
|
+
permissionAttr,
|
|
21
|
+
skeletonize,
|
|
22
|
+
inputRef,
|
|
23
|
+
placeholderChar = '_',
|
|
24
|
+
lazy = false,
|
|
25
|
+
pattern = '',
|
|
26
|
+
radix = ' ',
|
|
27
|
+
thousandsSeparator = '',
|
|
28
|
+
mapToRadix = [],
|
|
29
|
+
scale = 2,
|
|
30
|
+
signed = false,
|
|
31
|
+
normalizeZeros = true,
|
|
32
|
+
padFractionalZeros = true,
|
|
33
|
+
mask,
|
|
34
|
+
commit = () => {},
|
|
35
|
+
parse,
|
|
36
|
+
format,
|
|
37
|
+
definitions,
|
|
38
|
+
groups,
|
|
39
|
+
min,
|
|
40
|
+
max,
|
|
41
|
+
dispatch,
|
|
42
|
+
value = '',
|
|
43
|
+
onChange,
|
|
44
|
+
isDateField = false,
|
|
45
|
+
autoCompleteMask
|
|
46
|
+
} = props;
|
|
47
|
+
const maskOptions = {
|
|
48
|
+
placeholderChar: placeholderChar === '' ? ' ' : placeholderChar,
|
|
49
|
+
lazy,
|
|
50
|
+
pattern,
|
|
51
|
+
radix,
|
|
52
|
+
thousandsSeparator,
|
|
53
|
+
mapToRadix,
|
|
54
|
+
scale,
|
|
55
|
+
signed,
|
|
56
|
+
normalizeZeros,
|
|
57
|
+
padFractionalZeros,
|
|
58
|
+
mask,
|
|
59
|
+
commit,
|
|
60
|
+
parse,
|
|
61
|
+
format,
|
|
62
|
+
definitions,
|
|
63
|
+
groups,
|
|
64
|
+
min,
|
|
65
|
+
max,
|
|
66
|
+
dispatch
|
|
67
|
+
};
|
|
68
|
+
const [onDenied] = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr));
|
|
69
|
+
const elementRef = (0, _react.useRef)(null);
|
|
70
|
+
const maskRef = (0, _react.useRef)(null);
|
|
71
|
+
const {
|
|
72
|
+
hideContent,
|
|
73
|
+
unvisible,
|
|
74
|
+
disabled,
|
|
75
|
+
readOnly
|
|
76
|
+
} = onDenied;
|
|
77
|
+
const dontInitMask = hideContent || unvisible || skeletonize;
|
|
78
|
+
const disableCallbacks = disabled || readOnly;
|
|
79
|
+
const setValue = newValue => {
|
|
80
|
+
if (maskRef.current) {
|
|
81
|
+
if (props.unmask) maskRef.current.unmaskedValue = newValue.toString();
|
|
82
|
+
maskRef.current.value = String(newValue);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const onAccept = (0, _react.useCallback)(() => {
|
|
86
|
+
if (onChange && !disableCallbacks && maskRef.current) {
|
|
87
|
+
const {
|
|
88
|
+
unmaskedValue,
|
|
89
|
+
el
|
|
90
|
+
} = maskRef.current;
|
|
91
|
+
const name = el.name || el.input && el.input.name;
|
|
92
|
+
onChange({
|
|
93
|
+
target: {
|
|
94
|
+
value: unmaskedValue,
|
|
95
|
+
name
|
|
96
|
+
}
|
|
97
|
+
}, props.unmask ? unmaskedValue : maskRef.current.value);
|
|
98
|
+
}
|
|
99
|
+
}, [onChange]);
|
|
100
|
+
const onComplete = (0, _react.useCallback)(() => {
|
|
101
|
+
if (props.onComplete && !disableCallbacks && maskRef.current) {
|
|
102
|
+
const {
|
|
103
|
+
unmaskedValue,
|
|
104
|
+
el
|
|
105
|
+
} = maskRef.current;
|
|
106
|
+
const name = el.name || el.input && el.input.name;
|
|
107
|
+
props.onComplete({
|
|
108
|
+
target: {
|
|
109
|
+
value: unmaskedValue,
|
|
110
|
+
name
|
|
111
|
+
}
|
|
112
|
+
}, props.unmask ? unmaskedValue : maskRef.current.value);
|
|
113
|
+
}
|
|
114
|
+
}, [props.onComplete]);
|
|
115
|
+
const autoCompleteMaskValue = (0, _react.useCallback)(eventTargetValue => {
|
|
116
|
+
if (autoCompleteMask && eventTargetValue.length && maskRef.current && elementRef.current) {
|
|
117
|
+
const sizeMask = maskRef.current.mask.toString().replace(/\D+/g, '').length;
|
|
118
|
+
if (sizeMask > eventTargetValue.length) {
|
|
119
|
+
switch (autoCompleteMask) {
|
|
120
|
+
case 'left':
|
|
121
|
+
setValue(eventTargetValue.padStart(sizeMask, '0'));
|
|
122
|
+
break;
|
|
123
|
+
case 'right':
|
|
124
|
+
setValue(eventTargetValue.padEnd(sizeMask, '0'));
|
|
125
|
+
break;
|
|
126
|
+
default:
|
|
127
|
+
setValue(eventTargetValue);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, [autoCompleteMask, maskRef.current, elementRef.current]);
|
|
133
|
+
const getMask = () => {
|
|
134
|
+
const element = elementRef.current;
|
|
135
|
+
if (element) {
|
|
136
|
+
const maskCurrent = maskRef.current;
|
|
137
|
+
if (!maskCurrent) {
|
|
138
|
+
maskRef.current = (0, _imask.default)(element, maskOptions);
|
|
139
|
+
if (value && typeof value !== 'number' && value.trim() !== '' || value && typeof value === 'number') onAccept();
|
|
140
|
+
setValue(value);
|
|
141
|
+
} else {
|
|
142
|
+
maskCurrent.updateOptions(maskOptions);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const destroyMask = () => {
|
|
147
|
+
if (maskRef.current) {
|
|
148
|
+
maskRef.current.destroy();
|
|
149
|
+
maskRef.current = null;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
(0, _react.useEffect)(() => {
|
|
153
|
+
if (props.handlerSetOnDenied) props.handlerSetOnDenied(onDenied);
|
|
154
|
+
if (!props.mask || dontInitMask) return;
|
|
155
|
+
getMask();
|
|
156
|
+
}, [maskOptions]);
|
|
157
|
+
(0, _react.useEffect)(() => {
|
|
158
|
+
if (!maskRef.current) return;
|
|
159
|
+
const maskCurrent = maskRef.current;
|
|
160
|
+
maskCurrent.on('accept', onAccept);
|
|
161
|
+
maskCurrent.on('complete', onComplete);
|
|
162
|
+
|
|
163
|
+
// eslint-disable-next-line consistent-return
|
|
164
|
+
return () => {
|
|
165
|
+
maskCurrent.off('accept', onAccept);
|
|
166
|
+
maskCurrent.off('complete', onComplete);
|
|
167
|
+
};
|
|
168
|
+
}, [onAccept, onComplete]);
|
|
169
|
+
(0, _react.useEffect)(() => {
|
|
170
|
+
if (maskOptions.mask && !dontInitMask) {
|
|
171
|
+
if (maskRef.current) {
|
|
172
|
+
const formattedValue = isDateField ? value : (0, _format_number.numberToPtBR)(value) || '';
|
|
173
|
+
setValue(formattedValue);
|
|
174
|
+
} else {
|
|
175
|
+
getMask();
|
|
176
|
+
}
|
|
177
|
+
} else if (!dontInitMask) {
|
|
178
|
+
destroyMask();
|
|
179
|
+
if (value && elementRef.current) elementRef.current.value = value;
|
|
180
|
+
}
|
|
181
|
+
}, [value, isDateField]);
|
|
182
|
+
(0, _react.useEffect)(() => destroyMask, []);
|
|
183
|
+
return /*#__PURE__*/_react.default.createElement(ComposedComponent, _extends({}, helpers.extractNonMaskProps(props, maskOptions), {
|
|
184
|
+
onDeniedActions: onDenied,
|
|
185
|
+
defaultValue: value,
|
|
186
|
+
onBlur: e => {
|
|
187
|
+
autoCompleteMaskValue(e.target.value);
|
|
188
|
+
if (props.onBlur) props.onBlur(e);
|
|
189
|
+
},
|
|
190
|
+
onChange: e => setValue(e.target.value),
|
|
191
|
+
inputRef: el => {
|
|
192
|
+
elementRef.current = el;
|
|
193
|
+
if (inputRef) {
|
|
194
|
+
if (typeof inputRef === 'object') inputRef.current = el;else inputRef(el);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}));
|
|
198
|
+
};
|
|
199
|
+
const nestedComponentName = ComposedComponent.displayName || ComposedComponent.name || 'Component';
|
|
200
|
+
MaskedComponent.displayName = "IMask(".concat(nestedComponentName, ")");
|
|
201
|
+
return MaskedComponent;
|
|
202
|
+
};
|
|
203
|
+
var _default = exports.default = IMaskHOC;
|
|
@@ -16,16 +16,17 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
16
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
17
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
18
|
const returnDropdownDynamicStyles = (selectFieldRef, dropdownMaxHeight) => {
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const
|
|
19
|
+
var _selectFieldRef$curre, _selectFieldRef$curre2, _selectFieldRef$curre3;
|
|
20
|
+
const selectFieldRects = selectFieldRef === null || selectFieldRef === void 0 ? void 0 : (_selectFieldRef$curre = selectFieldRef.current) === null || _selectFieldRef$curre === void 0 ? void 0 : _selectFieldRef$curre.getBoundingClientRect();
|
|
21
|
+
const bottom = selectFieldRects !== null && selectFieldRects !== void 0 && selectFieldRects.bottom ? selectFieldRects === null || selectFieldRects === void 0 ? void 0 : selectFieldRects.bottom : 0;
|
|
22
|
+
const offsetTop = selectFieldRef !== null && selectFieldRef !== void 0 && (_selectFieldRef$curre2 = selectFieldRef.current) !== null && _selectFieldRef$curre2 !== void 0 && _selectFieldRef$curre2.offsetTop ? selectFieldRef === null || selectFieldRef === void 0 ? void 0 : (_selectFieldRef$curre3 = selectFieldRef.current) === null || _selectFieldRef$curre3 === void 0 ? void 0 : _selectFieldRef$curre3.offsetTop : 0;
|
|
22
23
|
const dropdownBottomDistance = window.innerHeight - bottom;
|
|
23
24
|
let maxDropdownBottomDistance = 200;
|
|
24
25
|
let height = dropdownMaxHeight;
|
|
25
26
|
let dropdownPosition;
|
|
26
27
|
if (!height || height <= 0) {
|
|
27
28
|
if (dropdownBottomDistance < maxDropdownBottomDistance) {
|
|
28
|
-
height = selectFieldRects
|
|
29
|
+
height = selectFieldRects !== null && selectFieldRects !== void 0 && selectFieldRects.top ? selectFieldRects.top : 0;
|
|
29
30
|
dropdownPosition = window.innerHeight - offsetTop + 10;
|
|
30
31
|
} else {
|
|
31
32
|
height = dropdownBottomDistance;
|
|
@@ -37,8 +38,8 @@ const returnDropdownDynamicStyles = (selectFieldRef, dropdownMaxHeight) => {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
return {
|
|
40
|
-
maxHeight:
|
|
41
|
-
bottom:
|
|
41
|
+
maxHeight: "".concat(height - 30, "px"),
|
|
42
|
+
bottom: "".concat(dropdownPosition, "px")
|
|
42
43
|
};
|
|
43
44
|
};
|
|
44
45
|
const Dropdown = props => {
|
|
@@ -102,11 +103,11 @@ const Dropdown = props => {
|
|
|
102
103
|
customClass: "checkboxicon"
|
|
103
104
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
104
105
|
className: "label"
|
|
105
|
-
}, inputValue !== '' ? 'Selecionar todos pesquisados' : 'Selecionar Todos'))), dataCombo
|
|
106
|
+
}, inputValue !== '' ? 'Selecionar todos pesquisados' : 'Selecionar Todos'))), dataCombo === null || dataCombo === void 0 ? void 0 : dataCombo.map(item => {
|
|
106
107
|
const isChecked = selecteds ? selecteds.find(selected => selected[idKey] === item[idKey]) : undefined;
|
|
107
108
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
-
key:
|
|
109
|
-
className:
|
|
109
|
+
key: "dropdowmItem ".concat(item[idKey], "}"),
|
|
110
|
+
className: "item ".concat(isChecked && '-selected')
|
|
110
111
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
111
112
|
className: "menubutton",
|
|
112
113
|
tabIndex: -1,
|
|
@@ -11,10 +11,11 @@ const getFilteredDataCombo = _ref => {
|
|
|
11
11
|
inputText
|
|
12
12
|
} = _ref;
|
|
13
13
|
return dataSource.filter(item => {
|
|
14
|
+
var _descriptionKey;
|
|
14
15
|
if (typeof descriptionKey === 'string') {
|
|
15
16
|
return item[descriptionKey].toLowerCase().indexOf(inputText.toLowerCase()) > -1;
|
|
16
17
|
}
|
|
17
|
-
return descriptionKey(item)
|
|
18
|
+
return ((_descriptionKey = descriptionKey(item)) === null || _descriptionKey === void 0 ? void 0 : _descriptionKey.toLowerCase().indexOf(inputText.toLowerCase())) > -1;
|
|
18
19
|
});
|
|
19
20
|
};
|
|
20
21
|
var _default = exports.default = getFilteredDataCombo;
|
|
@@ -33,7 +33,7 @@ const MultiSelectField = props => {
|
|
|
33
33
|
gridLayout,
|
|
34
34
|
dropdownAlignButton = 'left'
|
|
35
35
|
} = props;
|
|
36
|
-
const componentId =
|
|
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)('');
|
|
@@ -68,8 +68,8 @@ const MultiSelectField = props => {
|
|
|
68
68
|
};
|
|
69
69
|
const onMouseMove = event => {
|
|
70
70
|
const target = event.target;
|
|
71
|
-
if (target
|
|
72
|
-
const newInsideComponent = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target
|
|
71
|
+
if ((target === null || target === void 0 ? void 0 : target.className) === '') return;
|
|
72
|
+
const newInsideComponent = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target === null || target === void 0 ? void 0 : target.className);
|
|
73
73
|
setInsideComponent(newInsideComponent);
|
|
74
74
|
};
|
|
75
75
|
const onBlurComponent = e => {
|
|
@@ -109,10 +109,11 @@ const MultiSelectField = props => {
|
|
|
109
109
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
110
110
|
};
|
|
111
111
|
const onClickOutSide = event => {
|
|
112
|
+
var _componentRef$current;
|
|
112
113
|
const {
|
|
113
114
|
target
|
|
114
115
|
} = event;
|
|
115
|
-
if (target !== componentRef.current && !componentRef.current
|
|
116
|
+
if (target !== componentRef.current && !((_componentRef$current = componentRef.current) !== null && _componentRef$current !== void 0 && _componentRef$current.contains(target))) {
|
|
116
117
|
setOpened(false);
|
|
117
118
|
setDataCombo(dataSource);
|
|
118
119
|
setInputValue('');
|
|
@@ -138,7 +139,8 @@ const MultiSelectField = props => {
|
|
|
138
139
|
};
|
|
139
140
|
(0, _react.useEffect)(() => {
|
|
140
141
|
if (gridLayout) {
|
|
141
|
-
|
|
142
|
+
var _selectWrapper$curren;
|
|
143
|
+
const currentGridEl = (_selectWrapper$curren = selectWrapper.current) === null || _selectWrapper$curren === void 0 ? void 0 : _selectWrapper$curren.parentElement;
|
|
142
144
|
if (currentGridEl) setElementStyles(window.getComputedStyle(currentGridEl));
|
|
143
145
|
}
|
|
144
146
|
window.addEventListener('resize', onScreenResize);
|
|
@@ -152,10 +154,10 @@ const MultiSelectField = props => {
|
|
|
152
154
|
}, []);
|
|
153
155
|
(0, _react.useEffect)(() => {
|
|
154
156
|
if (dataSource && dataSource.length > 0) {
|
|
155
|
-
const newSelecteds = dataSource.filter(item => value
|
|
157
|
+
const newSelecteds = dataSource.filter(item => value === null || value === void 0 ? void 0 : value.includes(item[idKey]));
|
|
156
158
|
setSelecteds(newSelecteds);
|
|
157
159
|
}
|
|
158
|
-
}, [value
|
|
160
|
+
}, [value === null || value === void 0 ? void 0 : value.length, dataSource === null || dataSource === void 0 ? void 0 : dataSource.length]);
|
|
159
161
|
(0, _react.useEffect)(() => {
|
|
160
162
|
if (dataSource && dataCombo && !_lodash.default.isEqual(dataSource, dataCombo)) {
|
|
161
163
|
const newDataCombo = (0, _helper.default)(_objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -42,7 +42,7 @@ const PeriodList = _ref => {
|
|
|
42
42
|
role: "button",
|
|
43
43
|
tabIndex: -1,
|
|
44
44
|
onKeyDown: () => {},
|
|
45
|
-
key:
|
|
45
|
+
key: "item-".concat(item.id),
|
|
46
46
|
className: (0, _helper.getDropdownItemCssClass)(itemSelected),
|
|
47
47
|
onClick: () => {
|
|
48
48
|
const dates = item.id !== 'custom' ? (0, _helper.CalcDatesByPeriod)(item.id) : null;
|
|
@@ -12,9 +12,7 @@ const getCalendarDropdownStyle = _ref => {
|
|
|
12
12
|
leftPosition,
|
|
13
13
|
width
|
|
14
14
|
} = _ref;
|
|
15
|
-
return
|
|
16
|
-
left: ${leftPosition}px;
|
|
17
|
-
width:${width}px`;
|
|
15
|
+
return "top: ".concat(topPosition, "px;\n left: ").concat(leftPosition, "px;\n width:").concat(width, "px");
|
|
18
16
|
};
|
|
19
17
|
var _default = exports.default = getCalendarDropdownStyle;
|
|
20
18
|
const getDropdownItemCssClass = function () {
|
|
@@ -60,7 +60,8 @@ const PeriodPicker = props => {
|
|
|
60
60
|
const dropdownPeriodContainer = (0, _react.useRef)(null);
|
|
61
61
|
const inputFinalRef = (0, _react.useRef)(null);
|
|
62
62
|
const onScreenResize = () => {
|
|
63
|
-
|
|
63
|
+
var _inputContainerRef$cu;
|
|
64
|
+
const inputDimensionsAux = inputContainerRef === null || inputContainerRef === void 0 ? void 0 : (_inputContainerRef$cu = inputContainerRef.current) === null || _inputContainerRef$cu === void 0 ? void 0 : _inputContainerRef$cu.getBoundingClientRect();
|
|
64
65
|
setInputDimensions(inputDimensionsAux);
|
|
65
66
|
};
|
|
66
67
|
const onClickOutside = event => {
|
|
@@ -163,11 +164,12 @@ const PeriodPicker = props => {
|
|
|
163
164
|
}
|
|
164
165
|
};
|
|
165
166
|
const setValue = function (event, value) {
|
|
167
|
+
var _inputInitialRef$curr, _inputFinalRef$curren;
|
|
166
168
|
let shouldOpenDropdown = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
167
169
|
const valueDateName = event ? event.target.name : '';
|
|
168
170
|
const dateObj = (0, _moment.default)(value, 'DD/MM/YYYY');
|
|
169
|
-
if (showCalendarValueInitial) inputInitialRef.current
|
|
170
|
-
if (showCalendarValueFinal) inputFinalRef.current
|
|
171
|
+
if (showCalendarValueInitial) (_inputInitialRef$curr = inputInitialRef.current) === null || _inputInitialRef$curr === void 0 ? void 0 : _inputInitialRef$curr.focus();
|
|
172
|
+
if (showCalendarValueFinal) (_inputFinalRef$curren = inputFinalRef.current) === null || _inputFinalRef$curren === void 0 ? void 0 : _inputFinalRef$curren.focus();
|
|
171
173
|
if (valueDateName === 'valueFinal' && valueInitial && dateObj.isBefore(valueInitial)) {
|
|
172
174
|
setValueInitial(dateObj);
|
|
173
175
|
setValueFinal(valueInitial);
|
|
@@ -196,7 +198,8 @@ const PeriodPicker = props => {
|
|
|
196
198
|
});
|
|
197
199
|
}
|
|
198
200
|
if (valueDateName === 'valueInitial' && !valueFinal && shouldOpenDropdown) {
|
|
199
|
-
|
|
201
|
+
var _inputFinalRef$curren2;
|
|
202
|
+
(_inputFinalRef$curren2 = inputFinalRef.current) === null || _inputFinalRef$curren2 === void 0 ? void 0 : _inputFinalRef$curren2.focus();
|
|
200
203
|
setTimeout(() => setShowCalendarValueFinal(true), 100);
|
|
201
204
|
}
|
|
202
205
|
if (shouldCloseOnSelect) {
|
|
@@ -219,7 +222,8 @@ const PeriodPicker = props => {
|
|
|
219
222
|
name: "calendar"
|
|
220
223
|
}),
|
|
221
224
|
onClick: () => {
|
|
222
|
-
|
|
225
|
+
var _inputInitialRef$curr2;
|
|
226
|
+
(_inputInitialRef$curr2 = inputInitialRef.current) === null || _inputInitialRef$curr2 === void 0 ? void 0 : _inputInitialRef$curr2.focus();
|
|
223
227
|
openCalendar('valueInitial');
|
|
224
228
|
},
|
|
225
229
|
customClass: "calendar-button",
|
|
@@ -270,7 +274,8 @@ const PeriodPicker = props => {
|
|
|
270
274
|
});
|
|
271
275
|
const setPeriodDates = (selected, dates) => {
|
|
272
276
|
if (selected === 'custom') {
|
|
273
|
-
|
|
277
|
+
var _inputInitialRef$curr3;
|
|
278
|
+
(_inputInitialRef$curr3 = inputInitialRef.current) === null || _inputInitialRef$curr3 === void 0 ? void 0 : _inputInitialRef$curr3.focus();
|
|
274
279
|
setValuePeriodSelection(selected);
|
|
275
280
|
setShowPeriodSelection(false);
|
|
276
281
|
return;
|
|
@@ -353,7 +358,7 @@ const PeriodPicker = props => {
|
|
|
353
358
|
display: 'flex'
|
|
354
359
|
}
|
|
355
360
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
356
|
-
className:
|
|
361
|
+
className: "label ".concat(props.customClassForLabel, " ").concat(props.labelUppercase && ' -uppercase'),
|
|
357
362
|
style: {
|
|
358
363
|
alignSelf: 'center'
|
|
359
364
|
}
|
|
@@ -370,10 +375,10 @@ const PeriodPicker = props => {
|
|
|
370
375
|
width: 20
|
|
371
376
|
}
|
|
372
377
|
}, hint))), /*#__PURE__*/_react.default.createElement(_textContent.default, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
373
|
-
className:
|
|
378
|
+
className: "periodpicker-component ".concat(helperBase.getInputWrapperClass(_objectSpread(_objectSpread({}, props), {}, {
|
|
374
379
|
value: !valueInitial ? '' : (0, _moment.default)(valueInitial).format('DD/MM/YYYY'),
|
|
375
380
|
disabled: shouldDisable()
|
|
376
|
-
}))
|
|
381
|
+
}))),
|
|
377
382
|
ref: inputContainerRef
|
|
378
383
|
}, /*#__PURE__*/_react.default.createElement(_BaseMask.default, {
|
|
379
384
|
permissionAttr: props.permissionAttr,
|
|
@@ -49,7 +49,7 @@ const SearchField = props => {
|
|
|
49
49
|
};
|
|
50
50
|
const shouldDisable = () => props.disabled || onDenied && (onDenied.disabled || onDenied.hideContent);
|
|
51
51
|
const shouldBeReadOnly = () => props.readOnly || onDenied && onDenied.readOnly;
|
|
52
|
-
const hideContent = onDenied
|
|
52
|
+
const hideContent = onDenied === null || onDenied === void 0 ? void 0 : onDenied.hideContent;
|
|
53
53
|
const buttonProps = () => {
|
|
54
54
|
const disableCallbacks = shouldBeReadOnly() || shouldDisable() || hideContent;
|
|
55
55
|
let propsButton = {
|
|
@@ -80,7 +80,7 @@ const Dropdown = props => {
|
|
|
80
80
|
const disabled = currents && currents.length > 0 ? currents.some(s => s[idKey] === item[idKey]) : false;
|
|
81
81
|
const itemSelected = Boolean(selected && selected[idKey] === item[idKey]);
|
|
82
82
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
83
|
-
key:
|
|
83
|
+
key: "dropdowmIten ".concat(item[idKey], "}"),
|
|
84
84
|
className: helper.getDropdownItemCssClass(itemSelected, disabled, striped)
|
|
85
85
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
86
86
|
className: "menubutton",
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.returnDropdownDynamicStyles = exports.getFilteredSimpleDataCombo = exports.getFilteredMultipleDataCombo = exports.getDropdownItemCssClass = exports.contentClass = void 0;
|
|
7
|
-
const contentClass = props =>
|
|
7
|
+
const contentClass = props => "content ".concat(props.showClearButton ? '' : 'noclear');
|
|
8
8
|
exports.contentClass = contentClass;
|
|
9
9
|
const getDropdownItemCssClass = (selected, disabled, striped) => {
|
|
10
10
|
let className = 'item';
|
|
@@ -21,10 +21,12 @@ const getFilteredSimpleDataCombo = _ref => {
|
|
|
21
21
|
inputText
|
|
22
22
|
} = _ref;
|
|
23
23
|
return dataSource && dataSource.filter(item => {
|
|
24
|
+
var _descriptionKey;
|
|
24
25
|
if (typeof descriptionKey === 'string') {
|
|
25
|
-
|
|
26
|
+
var _item$descriptionKey;
|
|
27
|
+
return ((_item$descriptionKey = item[descriptionKey]) === null || _item$descriptionKey === void 0 ? void 0 : _item$descriptionKey.toLowerCase().indexOf(inputText === null || inputText === void 0 ? void 0 : inputText.toString().toLowerCase())) > -1;
|
|
26
28
|
}
|
|
27
|
-
return descriptionKey(item)
|
|
29
|
+
return ((_descriptionKey = descriptionKey(item)) === null || _descriptionKey === void 0 ? void 0 : _descriptionKey.toLowerCase().indexOf(inputText === null || inputText === void 0 ? void 0 : inputText.toString().toLowerCase())) > -1;
|
|
28
30
|
});
|
|
29
31
|
};
|
|
30
32
|
exports.getFilteredSimpleDataCombo = getFilteredSimpleDataCombo;
|
|
@@ -36,10 +38,11 @@ const getFilteredMultipleDataCombo = _ref2 => {
|
|
|
36
38
|
currents
|
|
37
39
|
} = _ref2;
|
|
38
40
|
return dataSource.filter(item => {
|
|
41
|
+
var _descriptionKey2;
|
|
39
42
|
if (typeof descriptionKey === 'string') {
|
|
40
|
-
return item[descriptionKey].toLowerCase().indexOf(inputText
|
|
43
|
+
return item[descriptionKey].toLowerCase().indexOf(inputText === null || inputText === void 0 ? void 0 : inputText.toString().toLowerCase()) > -1 && !currents.includes(item);
|
|
41
44
|
}
|
|
42
|
-
return descriptionKey(item)
|
|
45
|
+
return ((_descriptionKey2 = descriptionKey(item)) === null || _descriptionKey2 === void 0 ? void 0 : _descriptionKey2.toLowerCase().indexOf(inputText === null || inputText === void 0 ? void 0 : inputText.toString().toLowerCase())) > -1 && !currents.includes(item);
|
|
43
46
|
});
|
|
44
47
|
};
|
|
45
48
|
exports.getFilteredMultipleDataCombo = getFilteredMultipleDataCombo;
|
|
@@ -51,7 +54,7 @@ const returnDropdownPosition = function (_ref3) {
|
|
|
51
54
|
} = _ref3;
|
|
52
55
|
let aboveDropdown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
53
56
|
const DEFAULT_MARGIN_BOTTOM = 10;
|
|
54
|
-
if (aboveDropdown && dropdownRef
|
|
57
|
+
if (aboveDropdown && dropdownRef !== null && dropdownRef !== void 0 && dropdownRef.current && dropdownRects !== null && dropdownRects !== void 0 && dropdownRects.height) {
|
|
55
58
|
return selectFieldRects.top + window.scrollY - (dropdownRef.current && dropdownRects.height) - DEFAULT_MARGIN_BOTTOM;
|
|
56
59
|
}
|
|
57
60
|
return selectFieldRects.top + window.scrollY + selectFieldRects.height;
|
|
@@ -62,10 +65,10 @@ const returnDropdownDynamicStyles = _ref4 => {
|
|
|
62
65
|
dropdownMaxHeight,
|
|
63
66
|
dropdownRef
|
|
64
67
|
} = _ref4;
|
|
65
|
-
const selectFieldRects = selectFieldRef
|
|
66
|
-
const dropdownRects = dropdownRef
|
|
67
|
-
const selectFieldRectsBottom = selectFieldRects ? selectFieldRects
|
|
68
|
-
const selectFieldRectsTop = selectFieldRects ? selectFieldRects
|
|
68
|
+
const selectFieldRects = selectFieldRef !== null && selectFieldRef !== void 0 && selectFieldRef.current ? selectFieldRef.current.getBoundingClientRect() : undefined;
|
|
69
|
+
const dropdownRects = dropdownRef !== null && dropdownRef !== void 0 && dropdownRef.current ? dropdownRef.current.getBoundingClientRect() : undefined;
|
|
70
|
+
const selectFieldRectsBottom = selectFieldRects ? selectFieldRects === null || selectFieldRects === void 0 ? void 0 : selectFieldRects.bottom : 0;
|
|
71
|
+
const selectFieldRectsTop = selectFieldRects ? selectFieldRects === null || selectFieldRects === void 0 ? void 0 : selectFieldRects.top : 0;
|
|
69
72
|
const dropdownBottomDistance = window.innerHeight - selectFieldRectsBottom;
|
|
70
73
|
const bottomOffset = 30;
|
|
71
74
|
let maxDropdownBottomDistance = 200;
|
|
@@ -15,7 +15,7 @@ const Selecteds = _ref => {
|
|
|
15
15
|
} = _ref;
|
|
16
16
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, currents.map(selected => /*#__PURE__*/_react.default.createElement("div", {
|
|
17
17
|
className: "selecteditem",
|
|
18
|
-
key:
|
|
18
|
+
key: "selected-".concat(selected[idKey])
|
|
19
19
|
}, typeof descriptionKey === 'string' ? selected[descriptionKey] : descriptionKey(selected), /*#__PURE__*/_react.default.createElement("button", {
|
|
20
20
|
className: "close",
|
|
21
21
|
tabIndex: -1,
|
|
@@ -40,7 +40,7 @@ const MultipleSelect = props => {
|
|
|
40
40
|
const [insideComponent, setInsideComponent] = (0, _react.useState)(false);
|
|
41
41
|
const [onDenied, setOnDeniedSelect] = (0, _react.useState)();
|
|
42
42
|
const [valueFromProps, setValueFromProps] = (0, _react.useState)([]);
|
|
43
|
-
const componentId =
|
|
43
|
+
const componentId = "select-component".concat(uuid.v1());
|
|
44
44
|
const componentRef = (0, _react.useRef)(null);
|
|
45
45
|
const dropdownRef = (0, _react.useRef)(null);
|
|
46
46
|
const selectWrapper = (0, _react.useRef)();
|
|
@@ -60,10 +60,11 @@ const MultipleSelect = props => {
|
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
const onMouseMove = event => {
|
|
63
|
+
var _dropdownRef$current, _dropdownRef$current$;
|
|
63
64
|
const target = event.target;
|
|
64
|
-
const idDropdown = dropdownRef.current
|
|
65
|
+
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) || '';
|
|
65
66
|
const dropdownElement = document.getElementById(idDropdown);
|
|
66
|
-
const keepDropdownOpen = Boolean(dropdownElement
|
|
67
|
+
const keepDropdownOpen = Boolean(dropdownElement === null || dropdownElement === void 0 ? void 0 : dropdownElement.contains(target));
|
|
67
68
|
setInsideComponent(keepDropdownOpen);
|
|
68
69
|
};
|
|
69
70
|
const onClearClick = () => {
|
|
@@ -100,6 +101,7 @@ const MultipleSelect = props => {
|
|
|
100
101
|
setDropdownWidth(dropdownWidthFocus);
|
|
101
102
|
};
|
|
102
103
|
const onSelect = select => {
|
|
104
|
+
var _dropdownRef$current2;
|
|
103
105
|
if (select === null) return;
|
|
104
106
|
const currentsSelect = [...currents, select];
|
|
105
107
|
setCurrents(currentsSelect);
|
|
@@ -107,16 +109,17 @@ const MultipleSelect = props => {
|
|
|
107
109
|
setInputValue([]);
|
|
108
110
|
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
109
111
|
if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(i => i[idKey])));
|
|
110
|
-
dropdownRef.current
|
|
112
|
+
(_dropdownRef$current2 = dropdownRef.current) === null || _dropdownRef$current2 === void 0 ? void 0 : _dropdownRef$current2.focus();
|
|
111
113
|
};
|
|
112
114
|
const onUnselect = id => {
|
|
113
115
|
if (currents) {
|
|
116
|
+
var _dropdownRef$current3;
|
|
114
117
|
const result = currents.filter(item => item[idKey] !== id);
|
|
115
118
|
setCurrents(result);
|
|
116
119
|
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
117
120
|
setOpened(false);
|
|
118
121
|
if (props.onSelect) setSelected(props.onSelect(result.map(i => i[idKey])));
|
|
119
|
-
dropdownRef.current
|
|
122
|
+
(_dropdownRef$current3 = dropdownRef.current) === null || _dropdownRef$current3 === void 0 ? void 0 : _dropdownRef$current3.focus();
|
|
120
123
|
}
|
|
121
124
|
};
|
|
122
125
|
const onOpenClose = () => {
|
|
@@ -133,9 +136,11 @@ const MultipleSelect = props => {
|
|
|
133
136
|
const onInputKeyDown = e => {
|
|
134
137
|
if (e.keyCode) {
|
|
135
138
|
if (e.keyCode === constants.keyCodes.ENTER && selected && opened) {
|
|
136
|
-
|
|
139
|
+
var _e$preventDefault;
|
|
140
|
+
(_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
|
|
137
141
|
if (!currents.some(current => current[idKey] === selected[idKey])) {
|
|
138
|
-
|
|
142
|
+
var _e$preventDefault2;
|
|
143
|
+
(_e$preventDefault2 = e.preventDefault) === null || _e$preventDefault2 === void 0 ? void 0 : _e$preventDefault2.call(e);
|
|
139
144
|
onSelect(selected);
|
|
140
145
|
}
|
|
141
146
|
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
@@ -181,7 +186,7 @@ const MultipleSelect = props => {
|
|
|
181
186
|
}, []);
|
|
182
187
|
(0, _react.useEffect)(() => {
|
|
183
188
|
if (props.gridLayout) {
|
|
184
|
-
const gridEl = document.querySelector(
|
|
189
|
+
const gridEl = document.querySelector("#".concat(componentId, ">.-withinput.grid-container"));
|
|
185
190
|
if (gridElRef.current !== gridEl && gridEl) gridElRef.current = gridEl;
|
|
186
191
|
}
|
|
187
192
|
}, []);
|
|
@@ -233,7 +238,7 @@ const MultipleSelect = props => {
|
|
|
233
238
|
},
|
|
234
239
|
onClick: onFocus,
|
|
235
240
|
onKeyDown: onInputKeyDown,
|
|
236
|
-
customClassForWrapper:
|
|
241
|
+
customClassForWrapper: "selectwrapper ".concat((props.readOnly || shouldDisable() || shouldBeReadOnly()) && ' -undigitable'),
|
|
237
242
|
customClassForInputContent: "multiselect",
|
|
238
243
|
inputBaseRef: r => {
|
|
239
244
|
selectWrapper.current = r;
|