linear-react-components-ui 1.1.24-rc.1 → 1.1.25-beta.10
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/{BaseMask-0c14ef51.d.ts → BaseMask-78847f45.d.ts} +1 -1
- package/lib/{Cnpj-bde01dd0.d.ts → Cnpj-8366781f.d.ts} +1 -1
- package/lib/{Cpf-3fa496ad.d.ts → Cpf-3dfd54eb.d.ts} +1 -1
- package/lib/{Phone-2bb0b397.d.ts → Phone-1962c0f2.d.ts} +1 -1
- package/lib/{ZipCode-09460e18.d.ts → ZipCode-be9c5b3b.d.ts} +1 -1
- package/lib/assets/styles/button.scss +1 -1
- package/lib/assets/styles/calendar.scss +3 -3
- package/lib/assets/styles/datepicker2.scss +8 -7
- package/lib/assets/styles/dialog.scss +1 -1
- package/lib/assets/styles/drawers.scss +1 -2
- package/lib/assets/styles/fieldset.scss +1 -1
- package/lib/assets/styles/gridlayout.scss +20 -19
- package/lib/assets/styles/multiSelect.scss +6 -6
- package/lib/assets/styles/periodpicker.scss +1 -1
- package/lib/assets/styles/radio.scss +114 -87
- package/lib/assets/styles/selectfield.scss +7 -3
- package/lib/assets/styles/split.scss +1 -1
- package/lib/assets/styles/table.scss +6 -0
- package/lib/assets/styles/tabs.scss +6 -2
- package/lib/assets/styles/textfield.scss +7 -3
- package/lib/assets/styles/tooltip.scss +5 -4
- package/lib/buttons/DefaultButton.js +1 -1
- package/lib/checkbox/index.js +3 -1
- package/lib/checkbox/types.d.ts +1 -0
- package/lib/dialog/base/Content.js +4 -4
- package/lib/dialog/base/index.js +20 -22
- package/lib/dialog/form/index.js +6 -4
- package/lib/drawer/Drawer.js +3 -4
- package/lib/drawer/index.js +1 -1
- package/lib/form2/index.d.ts +1 -1
- package/lib/form2/types.d.ts +4 -0
- package/lib/form2/useForm/index.js +2 -0
- package/lib/icons/helper.d.ts +12 -0
- package/lib/icons/helper.js +12 -0
- package/lib/{index-3b70931d.d.ts → index-02a27c19.d.ts} +2 -20
- package/lib/index-053f615b.d.ts +26 -0
- package/lib/{index-7dfa8924.d.ts → index-25b80f32.d.ts} +1 -1
- package/lib/{index-9e576346.d.ts → index-6f5c772d.d.ts} +1 -1
- package/lib/{index-208e7f62.d.ts → index-6fcf446c.d.ts} +2 -20
- package/lib/index-7159df18.d.ts +21 -0
- package/lib/index-afb7b5a9.d.ts +15 -0
- package/lib/inputs/date/index.js +3 -6
- package/lib/inputs/multiSelect/Dropdown.js +4 -3
- package/lib/inputs/multiSelect/index.js +23 -5
- package/lib/inputs/multiSelect/types.d.ts +2 -0
- package/lib/inputs/period/PeriodList.js +3 -12
- package/lib/inputs/period/index.js +97 -124
- package/lib/inputs/search/index.js +6 -2
- package/lib/inputs/select/multiple/index.js +3 -2
- package/lib/inputs/select/simple/index.js +4 -3
- package/lib/inputs/select/types.d.ts +1 -0
- package/lib/inputs/types.d.ts +1 -0
- package/lib/inputs2/checkboxfield/base.d.ts +29 -0
- package/lib/inputs2/checkboxfield/base.js +134 -0
- package/lib/inputs2/checkboxfield/index.d.ts +3 -2
- package/lib/inputs2/checkboxfield/index.js +32 -124
- package/lib/inputs2/colorfield/index.d.ts +6 -5
- package/lib/inputs2/date/base/index.js +1 -2
- package/lib/inputs2/date/datefield/base.d.ts +13 -0
- package/lib/inputs2/date/datefield/base.js +330 -0
- package/lib/inputs2/date/datefield/calendarbox.d.ts +1 -1
- package/lib/inputs2/date/datefield/index.js +34 -322
- package/lib/inputs2/date/datefield/types.d.ts +5 -3
- package/lib/inputs2/date/dateperiodfield/base.d.ts +13 -0
- package/lib/inputs2/date/dateperiodfield/base.js +595 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +1 -1
- package/lib/inputs2/date/dateperiodfield/index.js +34 -587
- package/lib/inputs2/date/dateperiodfield/types.d.ts +5 -3
- package/lib/inputs2/filefield/index.d.ts +6 -5
- package/lib/inputs2/index.d.ts +18 -15
- package/lib/inputs2/mask/BaseMask.d.ts +6 -5
- package/lib/inputs2/mask/Cnpj.d.ts +7 -6
- package/lib/inputs2/mask/Cpf.d.ts +7 -6
- package/lib/inputs2/mask/Phone.d.ts +7 -6
- package/lib/inputs2/mask/ZipCode.d.ts +7 -6
- package/lib/inputs2/numberfield/currency.d.ts +5 -4
- package/lib/inputs2/numberfield/decimal.d.ts +5 -4
- package/lib/inputs2/numberfield/index.d.ts +5 -4
- package/lib/inputs2/numberfield/index.js +19 -2
- package/lib/inputs2/numberfield/types.d.ts +5 -4
- package/lib/inputs2/radiofield/base.d.ts +12 -0
- package/lib/inputs2/radiofield/base.js +156 -0
- package/lib/inputs2/radiofield/index.d.ts +1 -1
- package/lib/inputs2/radiofield/index.js +30 -119
- package/lib/inputs2/radiofield/types.d.ts +6 -3
- package/lib/inputs2/selectfield/base.d.ts +11 -0
- package/lib/inputs2/selectfield/base.js +513 -0
- package/lib/inputs2/selectfield/index.d.ts +1 -1
- package/lib/inputs2/selectfield/index.js +35 -502
- package/lib/inputs2/selectfield/item.d.ts +1 -1
- package/lib/inputs2/selectfield/listbox.d.ts +1 -1
- package/lib/inputs2/selectfield/options.d.ts +1 -1
- package/lib/inputs2/selectfield/search.d.ts +1 -1
- package/lib/inputs2/selectfield/selections.d.ts +1 -1
- package/lib/inputs2/selectfield/types.d.ts +8 -6
- package/lib/inputs2/slot/index.d.ts +2 -2
- package/lib/inputs2/textareafield/base.d.ts +26 -0
- package/lib/inputs2/textareafield/base.js +166 -0
- package/lib/inputs2/textareafield/index.d.ts +4 -3
- package/lib/inputs2/textareafield/index.js +30 -154
- package/lib/inputs2/textfield/base.d.ts +26 -0
- package/lib/inputs2/textfield/base.js +131 -0
- package/lib/inputs2/textfield/index.d.ts +5 -4
- package/lib/inputs2/textfield/index.js +30 -120
- package/lib/radio/index.js +8 -7
- package/lib/table/index.js +18 -8
- package/lib/table/types.d.ts +1 -0
- package/lib/tabs/index.js +2 -2
- package/lib/tooltip/TooltipContent.js +1 -1
- package/lib/tooltip/useTooltip.js +25 -0
- package/package.json +1 -1
- package/lib/index-4b31b471.d.ts +0 -15
- package/lib/index-8a0c7463.d.ts +0 -41
- package/lib/index-9203efed.d.ts +0 -26
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
8
|
var uuid = _interopRequireWildcard(require("uuid"));
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _InputTextBase = _interopRequireDefault(require("../base/InputTextBase"));
|
|
11
11
|
var _ActionButtons = _interopRequireDefault(require("./ActionButtons"));
|
|
12
12
|
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
|
@@ -30,7 +30,8 @@ const MultiSelectField = props => {
|
|
|
30
30
|
value,
|
|
31
31
|
onBlur,
|
|
32
32
|
gridLayout,
|
|
33
|
-
dropdownAlignButton = 'left'
|
|
33
|
+
dropdownAlignButton = 'left',
|
|
34
|
+
dropdownMaxWidth = undefined
|
|
34
35
|
} = props;
|
|
35
36
|
const componentId = "multiSelect-component".concat(uuid.v1());
|
|
36
37
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
@@ -43,6 +44,7 @@ const MultiSelectField = props => {
|
|
|
43
44
|
const [onDenied, setOnDenied] = (0, _react.useState)();
|
|
44
45
|
const [insideComponent, setInsideComponent] = (0, _react.useState)(false);
|
|
45
46
|
const [elementStyles, setElementStyles] = (0, _react.useState)();
|
|
47
|
+
const inputRef = (0, _react.useRef)(null);
|
|
46
48
|
const componentRef = (0, _react.useRef)(null);
|
|
47
49
|
const selectWrapper = (0, _react.useRef)();
|
|
48
50
|
const handleOnSelect = itemSelected => {
|
|
@@ -91,8 +93,9 @@ const MultiSelectField = props => {
|
|
|
91
93
|
setInputValue(currentValue);
|
|
92
94
|
};
|
|
93
95
|
const onOpenClose = () => {
|
|
94
|
-
setOpened(!
|
|
96
|
+
setOpened(prevState => !prevState);
|
|
95
97
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
98
|
+
setDataCombo(dataSource);
|
|
96
99
|
};
|
|
97
100
|
const onCheckAll = function () {
|
|
98
101
|
let fromFilter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
@@ -118,6 +121,17 @@ const MultiSelectField = props => {
|
|
|
118
121
|
setInputValue('');
|
|
119
122
|
}
|
|
120
123
|
};
|
|
124
|
+
const onBlurOutSide = event => {
|
|
125
|
+
var _componentRef$current2;
|
|
126
|
+
const {
|
|
127
|
+
relatedTarget
|
|
128
|
+
} = event;
|
|
129
|
+
if (relatedTarget !== componentRef.current && !((_componentRef$current2 = componentRef.current) !== null && _componentRef$current2 !== void 0 && _componentRef$current2.contains(relatedTarget))) {
|
|
130
|
+
setOpened(false);
|
|
131
|
+
setDataCombo(dataSource);
|
|
132
|
+
setInputValue('');
|
|
133
|
+
}
|
|
134
|
+
};
|
|
121
135
|
const setOnDeniedValue = onDeniedValue => {
|
|
122
136
|
setOnDenied(onDeniedValue);
|
|
123
137
|
};
|
|
@@ -144,10 +158,12 @@ const MultiSelectField = props => {
|
|
|
144
158
|
}
|
|
145
159
|
window.addEventListener('resize', onScreenResize);
|
|
146
160
|
document.addEventListener('click', onClickOutSide);
|
|
161
|
+
document.addEventListener('focusout', onBlurOutSide);
|
|
147
162
|
document.addEventListener('mousemove', onMouseMove);
|
|
148
163
|
return () => {
|
|
149
164
|
window.removeEventListener('resize', onScreenResize);
|
|
150
165
|
document.removeEventListener('click', onClickOutSide);
|
|
166
|
+
document.removeEventListener('focusout', onBlurOutSide);
|
|
151
167
|
document.removeEventListener('mousemove', onMouseMove);
|
|
152
168
|
};
|
|
153
169
|
}, []);
|
|
@@ -175,8 +191,9 @@ const MultiSelectField = props => {
|
|
|
175
191
|
id: componentId,
|
|
176
192
|
ref: componentRef,
|
|
177
193
|
className: "multiSelect-component"
|
|
178
|
-
}, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
|
|
194
|
+
}, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, _lodash.default.omit(props, ['dropdownMaxWidth']), {
|
|
179
195
|
value: label,
|
|
196
|
+
inputRef: inputRef,
|
|
180
197
|
onFocus: () => {
|
|
181
198
|
onFocus();
|
|
182
199
|
},
|
|
@@ -213,7 +230,8 @@ const MultiSelectField = props => {
|
|
|
213
230
|
onFilter: handleOnFilter,
|
|
214
231
|
onFocus: onFocus,
|
|
215
232
|
onBlur: onBlurComponent,
|
|
216
|
-
gridWrapperStyle: elementStyles
|
|
233
|
+
gridWrapperStyle: elementStyles,
|
|
234
|
+
dropdownMaxWidth: dropdownMaxWidth
|
|
217
235
|
})));
|
|
218
236
|
};
|
|
219
237
|
var _default = exports.default = MultiSelectField;
|
|
@@ -44,6 +44,7 @@ interface IDropdownMultiSelectProps {
|
|
|
44
44
|
};
|
|
45
45
|
selectFieldRef?: RefObject<HTMLDivElement>;
|
|
46
46
|
dropdownMaxHeight?: number;
|
|
47
|
+
dropdownMaxWidth?: number;
|
|
47
48
|
}
|
|
48
49
|
interface IMultiSelectProps {
|
|
49
50
|
dataSource?: DataCombo[];
|
|
@@ -60,6 +61,7 @@ interface IMultiSelectProps {
|
|
|
60
61
|
hintPosition?: 'below' | 'onLabelRight';
|
|
61
62
|
themePopover?: 'light' | 'dark';
|
|
62
63
|
popoverAlign?: 'right' | 'left';
|
|
64
|
+
dropdownMaxWidth?: number;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
export { DescriptionKey, GetFilteredParams, IActionButtonsProps, IDropdownMultiSelectProps, IMultiSelectProps };
|
|
@@ -38,24 +38,15 @@ const PeriodList = _ref => {
|
|
|
38
38
|
className: "dropdown-period"
|
|
39
39
|
}, periodOptions.map(item => {
|
|
40
40
|
const itemSelected = selected === item.id;
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement("
|
|
42
|
-
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement("button", {
|
|
42
|
+
key: String('item-').concat(item.id),
|
|
43
43
|
tabIndex: -1,
|
|
44
|
-
onKeyDown: () => {},
|
|
45
|
-
key: "item-".concat(item.id),
|
|
46
44
|
className: (0, _helper.getDropdownItemCssClass)(itemSelected),
|
|
47
45
|
onClick: () => {
|
|
48
46
|
const dates = item.id !== 'custom' ? (0, _helper.CalcDatesByPeriod)(item.id) : null;
|
|
49
47
|
handleOnSelect(item.id, dates);
|
|
50
48
|
}
|
|
51
|
-
},
|
|
52
|
-
role: "button",
|
|
53
|
-
className: "menubutton",
|
|
54
|
-
tabIndex: -1,
|
|
55
|
-
onKeyPress: () => {}
|
|
56
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
57
|
-
className: "label"
|
|
58
|
-
}, item.label)));
|
|
49
|
+
}, item.label);
|
|
59
50
|
}));
|
|
60
51
|
};
|
|
61
52
|
var _default = exports.default = PeriodList;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
require("../../assets/styles/periodpicker.scss");
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _moment = _interopRequireDefault(require("moment"));
|
|
9
10
|
var _PeriodList = _interopRequireDefault(require("./PeriodList"));
|
|
@@ -16,7 +17,6 @@ var _Dialog = _interopRequireDefault(require("./Dialog"));
|
|
|
16
17
|
var _hint = _interopRequireDefault(require("../../hint"));
|
|
17
18
|
var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
|
|
18
19
|
var helperBase = _interopRequireWildcard(require("../base/helpers"));
|
|
19
|
-
require("../../assets/styles/periodpicker.scss");
|
|
20
20
|
var _errorMessage = require("../errorMessage");
|
|
21
21
|
var _textContent = _interopRequireDefault(require("../../textContent"));
|
|
22
22
|
var _popover = _interopRequireDefault(require("../../popover"));
|
|
@@ -42,9 +42,7 @@ const PeriodPicker = props => {
|
|
|
42
42
|
hintPosition = 'below',
|
|
43
43
|
themePopover = 'light',
|
|
44
44
|
popoverAlign = 'left',
|
|
45
|
-
gridLayout
|
|
46
|
-
nameDateInitial = 'valueInitial',
|
|
47
|
-
nameDateFinal = 'valueFinal'
|
|
45
|
+
gridLayout
|
|
48
46
|
} = props;
|
|
49
47
|
const idValueInitial = (0, _react.useId)();
|
|
50
48
|
const idValueFinal = (0, _react.useId)();
|
|
@@ -109,30 +107,6 @@ const PeriodPicker = props => {
|
|
|
109
107
|
setShowCalendarValueFinal(false);
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
|
-
if (calendarContainerRef.current && event && event.key && event.key === 'Tab') {
|
|
113
|
-
var _calendarContainerRef, _calendarContainerRef2;
|
|
114
|
-
const buttonForNavigateCalendar = (_calendarContainerRef = calendarContainerRef.current) === null || _calendarContainerRef === void 0 ? void 0 : _calendarContainerRef.getElementsByClassName('navbutton');
|
|
115
|
-
const datePicked = (_calendarContainerRef2 = calendarContainerRef.current) === null || _calendarContainerRef2 === void 0 ? void 0 : _calendarContainerRef2.getElementsByClassName('-selectedday');
|
|
116
|
-
const buttonDatePicked = datePicked[0].firstChild;
|
|
117
|
-
const buttonsForFocus = Array.from([...buttonForNavigateCalendar, buttonDatePicked]);
|
|
118
|
-
const firstElement = buttonsForFocus[0];
|
|
119
|
-
const lastElement = buttonsForFocus[buttonsForFocus.length - 1];
|
|
120
|
-
const calendarOpenedIsInitial = calendarContainerRef.current.id === 'valueInitial';
|
|
121
|
-
if (!event.shiftKey && showCalendarValueInitial && document.activeElement === inputInitialRef.current) {
|
|
122
|
-
event.preventDefault();
|
|
123
|
-
firstElement.focus();
|
|
124
|
-
}
|
|
125
|
-
if (event.shiftKey && calendarOpenedIsInitial && document.activeElement === firstElement) {
|
|
126
|
-
var _inputInitialRef$curr2;
|
|
127
|
-
event.preventDefault();
|
|
128
|
-
(_inputInitialRef$curr2 = inputInitialRef.current) === null || _inputInitialRef$curr2 === void 0 ? void 0 : _inputInitialRef$curr2.focus();
|
|
129
|
-
}
|
|
130
|
-
if (!event.shiftKey && calendarOpenedIsInitial && document.activeElement === lastElement) {
|
|
131
|
-
var _inputFinalRef$curren3;
|
|
132
|
-
event.preventDefault();
|
|
133
|
-
(_inputFinalRef$curren3 = inputFinalRef.current) === null || _inputFinalRef$curren3 === void 0 ? void 0 : _inputFinalRef$curren3.focus();
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
110
|
event.stopPropagation();
|
|
137
111
|
};
|
|
138
112
|
const keepPositionCalendarByScroll = () => {
|
|
@@ -143,52 +117,13 @@ const PeriodPicker = props => {
|
|
|
143
117
|
dropdownCalendarContainer.current.style.top = String(positionTop).concat('px');
|
|
144
118
|
}
|
|
145
119
|
};
|
|
146
|
-
(0, _react.useEffect)(() => {
|
|
147
|
-
var _document$getElementB;
|
|
148
|
-
window.addEventListener('resize', onScreenResize);
|
|
149
|
-
document.addEventListener('scroll', keepPositionCalendarByScroll);
|
|
150
|
-
(_document$getElementB = document.getElementById('modal-dialog-content')) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.addEventListener('scroll', keepPositionCalendarByScroll);
|
|
151
|
-
if (inputContainerRef.current) onScreenResize();
|
|
152
|
-
if (inputInitialRef && inputInitialRef.current) inputInitialRef.current.id = idValueInitial;
|
|
153
|
-
if (inputFinalRef && inputFinalRef.current) inputFinalRef.current.id = idValueFinal;
|
|
154
|
-
return () => {
|
|
155
|
-
var _document$getElementB2;
|
|
156
|
-
window.removeEventListener('resize', onScreenResize);
|
|
157
|
-
document.removeEventListener('scroll', keepPositionCalendarByScroll);
|
|
158
|
-
(_document$getElementB2 = document.getElementById('modal-dialog-content')) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.removeEventListener('scroll', keepPositionCalendarByScroll);
|
|
159
|
-
};
|
|
160
|
-
}, []);
|
|
161
|
-
(0, _react.useEffect)(() => {
|
|
162
|
-
document.addEventListener('keydown', onKeyDownPress);
|
|
163
|
-
return () => {
|
|
164
|
-
document.removeEventListener('keydown', onKeyDownPress);
|
|
165
|
-
};
|
|
166
|
-
}, [showCalendarValueFinal, showCalendarValueInitial, showPeriodSelection, calendarContainerRef.current]);
|
|
167
|
-
(0, _react.useEffect)(() => {
|
|
168
|
-
if (props.value && !((0, _moment.default)(props.value.initial).isSame(valueInitial) || (0, _moment.default)(props.value.final).isSame(valueFinal))) {
|
|
169
|
-
const {
|
|
170
|
-
initial: valueInitialProp,
|
|
171
|
-
final: valueFinalProp
|
|
172
|
-
} = props.value;
|
|
173
|
-
let newValueInitial;
|
|
174
|
-
let newValueFinal;
|
|
175
|
-
if ((0, _moment.default)(valueInitialProp, 'YYYY-MM-DD', true).isValid()) {
|
|
176
|
-
newValueInitial = (0, _moment.default)(valueInitialProp, 'YYYY-MM-DD');
|
|
177
|
-
}
|
|
178
|
-
if ((0, _moment.default)(valueFinalProp, 'YYYY-MM-DD', true).isValid()) {
|
|
179
|
-
newValueFinal = (0, _moment.default)(valueFinalProp, 'YYYY-MM-DD');
|
|
180
|
-
}
|
|
181
|
-
setValueInitial(newValueInitial);
|
|
182
|
-
setValueFinal(newValueFinal);
|
|
183
|
-
}
|
|
184
|
-
}, [props.value]);
|
|
185
120
|
const openCalendar = calendarName => {
|
|
186
121
|
if (calendarName === 'valueInitial') {
|
|
187
122
|
setCurrentTypeDate('valueInitial');
|
|
188
123
|
setShowCalendarValueFinal(false);
|
|
189
124
|
if (!showCalendarValueInitial) {
|
|
190
|
-
var _inputInitialRef$
|
|
191
|
-
(_inputInitialRef$
|
|
125
|
+
var _inputInitialRef$curr2;
|
|
126
|
+
(_inputInitialRef$curr2 = inputInitialRef.current) === null || _inputInitialRef$curr2 === void 0 ? void 0 : _inputInitialRef$curr2.focus();
|
|
192
127
|
if (showCalendarInDialog) {
|
|
193
128
|
setTimeout(() => {
|
|
194
129
|
var _currentDateButtonRef;
|
|
@@ -202,8 +137,8 @@ const PeriodPicker = props => {
|
|
|
202
137
|
setCurrentTypeDate('valueFinal');
|
|
203
138
|
setShowCalendarValueInitial(false);
|
|
204
139
|
if (!showCalendarValueFinal) {
|
|
205
|
-
var _inputFinalRef$
|
|
206
|
-
(_inputFinalRef$
|
|
140
|
+
var _inputFinalRef$curren3;
|
|
141
|
+
(_inputFinalRef$curren3 = inputFinalRef.current) === null || _inputFinalRef$curren3 === void 0 ? void 0 : _inputFinalRef$curren3.focus();
|
|
207
142
|
if (showCalendarInDialog) {
|
|
208
143
|
setTimeout(() => {
|
|
209
144
|
var _currentDateButtonRef2;
|
|
@@ -219,32 +154,41 @@ const PeriodPicker = props => {
|
|
|
219
154
|
};
|
|
220
155
|
const closeCalendar = calendarName => {
|
|
221
156
|
if (calendarName === 'valueInitial') {
|
|
222
|
-
var _inputInitialRef$
|
|
223
|
-
(_inputInitialRef$
|
|
157
|
+
var _inputInitialRef$curr3;
|
|
158
|
+
(_inputInitialRef$curr3 = inputInitialRef.current) === null || _inputInitialRef$curr3 === void 0 ? void 0 : _inputInitialRef$curr3.focus();
|
|
224
159
|
}
|
|
225
160
|
if (calendarName === 'valueFinal') {
|
|
226
|
-
var _inputFinalRef$
|
|
227
|
-
(_inputFinalRef$
|
|
161
|
+
var _inputFinalRef$curren4;
|
|
162
|
+
(_inputFinalRef$curren4 = inputFinalRef.current) === null || _inputFinalRef$curren4 === void 0 ? void 0 : _inputFinalRef$curren4.focus();
|
|
228
163
|
}
|
|
229
164
|
setShowCalendarValueInitial(false);
|
|
230
165
|
setShowCalendarValueFinal(false);
|
|
231
166
|
};
|
|
167
|
+
const onDateChange = date => {
|
|
168
|
+
var _props$onChange;
|
|
169
|
+
const initial = date.initial ? date.initial.format('YYYY-MM-DD') : '';
|
|
170
|
+
const final = date.final ? date.final.format('YYYY-MM-DD') : '';
|
|
171
|
+
props === null || props === void 0 ? void 0 : (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, undefined, '', {
|
|
172
|
+
initial,
|
|
173
|
+
final
|
|
174
|
+
});
|
|
175
|
+
};
|
|
232
176
|
const onCloseDateDialog = calendarName => {
|
|
233
177
|
setTimeout(() => {
|
|
234
178
|
if (calendarName === 'valueInitial') {
|
|
235
|
-
var _inputInitialRef$
|
|
236
|
-
(_inputInitialRef$
|
|
179
|
+
var _inputInitialRef$curr4;
|
|
180
|
+
(_inputInitialRef$curr4 = inputInitialRef.current) === null || _inputInitialRef$curr4 === void 0 ? void 0 : _inputInitialRef$curr4.focus();
|
|
237
181
|
setShowCalendarValueInitial(false);
|
|
238
182
|
}
|
|
239
183
|
if (calendarName === 'valueFinal') {
|
|
240
|
-
var _inputFinalRef$
|
|
241
|
-
(_inputFinalRef$
|
|
184
|
+
var _inputFinalRef$curren5;
|
|
185
|
+
(_inputFinalRef$curren5 = inputFinalRef.current) === null || _inputFinalRef$curren5 === void 0 ? void 0 : _inputFinalRef$curren5.focus();
|
|
242
186
|
setShowCalendarValueFinal(false);
|
|
243
187
|
}
|
|
244
188
|
if (calendarName === 'periodSelection') {
|
|
245
|
-
var _inputFinalRef$
|
|
189
|
+
var _inputFinalRef$curren6;
|
|
246
190
|
setShowPeriodSelection(false);
|
|
247
|
-
(_inputFinalRef$
|
|
191
|
+
(_inputFinalRef$curren6 = inputFinalRef.current) === null || _inputFinalRef$curren6 === void 0 ? void 0 : _inputFinalRef$curren6.focus();
|
|
248
192
|
setShowCalendarValueFinal(false);
|
|
249
193
|
}
|
|
250
194
|
}, 100);
|
|
@@ -259,13 +203,14 @@ const PeriodPicker = props => {
|
|
|
259
203
|
const onInputBlur = e => {
|
|
260
204
|
if (props.onBlur) props.onBlur(e);
|
|
261
205
|
};
|
|
262
|
-
const onInputChange =
|
|
206
|
+
const onInputChange = event => {
|
|
263
207
|
if (event) {
|
|
264
208
|
const {
|
|
265
|
-
name: changingAux
|
|
209
|
+
name: changingAux,
|
|
210
|
+
value
|
|
266
211
|
} = event.target;
|
|
267
|
-
if (value
|
|
268
|
-
if (changingAux ===
|
|
212
|
+
if (String(value).trim().length === 0) {
|
|
213
|
+
if (changingAux === 'valueInitial') {
|
|
269
214
|
setValueInitial(undefined);
|
|
270
215
|
} else {
|
|
271
216
|
setValueFinal(undefined);
|
|
@@ -273,38 +218,14 @@ const PeriodPicker = props => {
|
|
|
273
218
|
}
|
|
274
219
|
}
|
|
275
220
|
};
|
|
276
|
-
const onDateChange = date => {
|
|
277
|
-
if (props.onChange) {
|
|
278
|
-
const initial = date.initial ? date.initial.format('YYYY-MM-DD') : '';
|
|
279
|
-
const final = date.final ? date.final.format('YYYY-MM-DD') : '';
|
|
280
|
-
props.onChange(undefined, '', {
|
|
281
|
-
initial,
|
|
282
|
-
final
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
221
|
const setValue = function (event, value) {
|
|
287
|
-
var _inputInitialRef$
|
|
222
|
+
var _inputInitialRef$curr5, _inputFinalRef$curren7;
|
|
288
223
|
let shouldOpenDropdown = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
289
224
|
const valueDateName = event ? event.target.name : '';
|
|
290
225
|
const dateObj = (0, _moment.default)(value, 'DD/MM/YYYY');
|
|
291
|
-
if (showCalendarValueInitial) (_inputInitialRef$
|
|
292
|
-
if (showCalendarValueFinal) (_inputFinalRef$
|
|
293
|
-
if (valueDateName ===
|
|
294
|
-
setValueInitial(dateObj);
|
|
295
|
-
setValueFinal(valueInitial);
|
|
296
|
-
onDateChange({
|
|
297
|
-
initial: dateObj,
|
|
298
|
-
final: valueInitial
|
|
299
|
-
});
|
|
300
|
-
} else if (valueDateName === nameDateInitial && valueFinal && dateObj.isAfter(valueFinal)) {
|
|
301
|
-
setValueInitial(valueFinal);
|
|
302
|
-
setValueFinal(dateObj);
|
|
303
|
-
onDateChange({
|
|
304
|
-
initial: valueFinal,
|
|
305
|
-
final: dateObj
|
|
306
|
-
});
|
|
307
|
-
} else if (valueDateName === nameDateInitial) {
|
|
226
|
+
if (showCalendarValueInitial) (_inputInitialRef$curr5 = inputInitialRef.current) === null || _inputInitialRef$curr5 === void 0 ? void 0 : _inputInitialRef$curr5.focus();
|
|
227
|
+
if (showCalendarValueFinal) (_inputFinalRef$curren7 = inputFinalRef.current) === null || _inputFinalRef$curren7 === void 0 ? void 0 : _inputFinalRef$curren7.focus();
|
|
228
|
+
if (valueDateName === 'valueInitial') {
|
|
308
229
|
setValueInitial(dateObj);
|
|
309
230
|
onDateChange({
|
|
310
231
|
initial: dateObj,
|
|
@@ -317,9 +238,9 @@ const PeriodPicker = props => {
|
|
|
317
238
|
final: dateObj
|
|
318
239
|
});
|
|
319
240
|
}
|
|
320
|
-
if (valueDateName ===
|
|
321
|
-
var _inputFinalRef$
|
|
322
|
-
(_inputFinalRef$
|
|
241
|
+
if (valueDateName === 'valueInitial' && !valueFinal && shouldOpenDropdown) {
|
|
242
|
+
var _inputFinalRef$curren8;
|
|
243
|
+
(_inputFinalRef$curren8 = inputFinalRef.current) === null || _inputFinalRef$curren8 === void 0 ? void 0 : _inputFinalRef$curren8.focus();
|
|
323
244
|
setTimeout(() => setShowCalendarValueFinal(true), 100);
|
|
324
245
|
}
|
|
325
246
|
if (shouldCloseOnSelect) {
|
|
@@ -369,9 +290,9 @@ const PeriodPicker = props => {
|
|
|
369
290
|
}
|
|
370
291
|
};
|
|
371
292
|
const closePeriodSelection = () => {
|
|
372
|
-
var _inputFinalRef$
|
|
293
|
+
var _inputFinalRef$curren9;
|
|
373
294
|
setShowPeriodSelection(false);
|
|
374
|
-
(_inputFinalRef$
|
|
295
|
+
(_inputFinalRef$curren9 = inputFinalRef.current) === null || _inputFinalRef$curren9 === void 0 ? void 0 : _inputFinalRef$curren9.focus();
|
|
375
296
|
setShowCalendarValueFinal(false);
|
|
376
297
|
};
|
|
377
298
|
const getButtonSelectPeriod = (0, _react.useCallback)(() => {
|
|
@@ -404,10 +325,10 @@ const PeriodPicker = props => {
|
|
|
404
325
|
currentDateButton: buttonElement => currentDateButtonRef.current = buttonElement
|
|
405
326
|
});
|
|
406
327
|
const setPeriodDates = (selected, dates) => {
|
|
407
|
-
var _inputFinalRef$
|
|
328
|
+
var _inputFinalRef$curren0;
|
|
408
329
|
if (selected === 'custom') {
|
|
409
|
-
var _inputInitialRef$
|
|
410
|
-
(_inputInitialRef$
|
|
330
|
+
var _inputInitialRef$curr6;
|
|
331
|
+
(_inputInitialRef$curr6 = inputInitialRef.current) === null || _inputInitialRef$curr6 === void 0 ? void 0 : _inputInitialRef$curr6.focus();
|
|
411
332
|
setValuePeriodSelection(selected);
|
|
412
333
|
setShowPeriodSelection(false);
|
|
413
334
|
return;
|
|
@@ -420,7 +341,7 @@ const PeriodPicker = props => {
|
|
|
420
341
|
if (shouldCloseOnSelect) {
|
|
421
342
|
setShowPeriodSelection(false);
|
|
422
343
|
}
|
|
423
|
-
(_inputFinalRef$
|
|
344
|
+
(_inputFinalRef$curren0 = inputFinalRef.current) === null || _inputFinalRef$curren0 === void 0 ? void 0 : _inputFinalRef$curren0.focus();
|
|
424
345
|
setShowCalendarValueFinal(false);
|
|
425
346
|
};
|
|
426
347
|
const getCalendarInitial = () => {
|
|
@@ -431,7 +352,7 @@ const PeriodPicker = props => {
|
|
|
431
352
|
handlerClose: () => onCloseDateDialog('valueInitial'),
|
|
432
353
|
dialogSize: dialogSize,
|
|
433
354
|
onOpenChange: setShowCalendarValueInitial
|
|
434
|
-
}, getCalendar(valueInitial, calendarColorStyle,
|
|
355
|
+
}, getCalendar(valueInitial, calendarColorStyle, 'valueInitial'));
|
|
435
356
|
}
|
|
436
357
|
return /*#__PURE__*/_react.default.createElement(_Dropdown.default, {
|
|
437
358
|
containerRef: wrapperBaseInputPeriodRef,
|
|
@@ -450,7 +371,7 @@ const PeriodPicker = props => {
|
|
|
450
371
|
handlerClose: () => onCloseDateDialog('valueFinal'),
|
|
451
372
|
dialogSize: dialogSize,
|
|
452
373
|
onOpenChange: setShowCalendarValueFinal
|
|
453
|
-
}, getCalendar(valueFinal, calendarColorStyle,
|
|
374
|
+
}, getCalendar(valueFinal, calendarColorStyle, 'valueFinal'));
|
|
454
375
|
}
|
|
455
376
|
return /*#__PURE__*/_react.default.createElement(_Dropdown.default, {
|
|
456
377
|
containerRef: wrapperBaseInputPeriodRef,
|
|
@@ -478,6 +399,58 @@ const PeriodPicker = props => {
|
|
|
478
399
|
}
|
|
479
400
|
}, getPeriodSelection(valuePeriodSelection, setPeriodDates));
|
|
480
401
|
};
|
|
402
|
+
(0, _react.useEffect)(() => {
|
|
403
|
+
var _document$getElementB;
|
|
404
|
+
window.addEventListener('resize', onScreenResize);
|
|
405
|
+
document.addEventListener('scroll', keepPositionCalendarByScroll);
|
|
406
|
+
(_document$getElementB = document.getElementById('modal-dialog-content')) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.addEventListener('scroll', keepPositionCalendarByScroll);
|
|
407
|
+
if (inputContainerRef.current) onScreenResize();
|
|
408
|
+
if (inputInitialRef && inputInitialRef.current) inputInitialRef.current.id = idValueInitial;
|
|
409
|
+
if (inputFinalRef && inputFinalRef.current) inputFinalRef.current.id = idValueFinal;
|
|
410
|
+
return () => {
|
|
411
|
+
var _document$getElementB2;
|
|
412
|
+
window.removeEventListener('resize', onScreenResize);
|
|
413
|
+
document.removeEventListener('scroll', keepPositionCalendarByScroll);
|
|
414
|
+
(_document$getElementB2 = document.getElementById('modal-dialog-content')) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.removeEventListener('scroll', keepPositionCalendarByScroll);
|
|
415
|
+
};
|
|
416
|
+
}, []);
|
|
417
|
+
(0, _react.useEffect)(() => {
|
|
418
|
+
document.addEventListener('keydown', onKeyDownPress);
|
|
419
|
+
return () => {
|
|
420
|
+
document.removeEventListener('keydown', onKeyDownPress);
|
|
421
|
+
};
|
|
422
|
+
}, [showCalendarValueFinal, showCalendarValueInitial, showPeriodSelection, calendarContainerRef.current]);
|
|
423
|
+
(0, _react.useEffect)(() => {
|
|
424
|
+
if (valueFinal && valueInitial && (0, _moment.default)(valueFinal).isBefore((0, _moment.default)(valueInitial))) {
|
|
425
|
+
setValueInitial(valueFinal);
|
|
426
|
+
setValueFinal(valueInitial);
|
|
427
|
+
} else if (props.onChange) {
|
|
428
|
+
const initial = valueInitial ? valueInitial.format('YYYY-MM-DD') : '';
|
|
429
|
+
const final = valueFinal ? valueFinal.format('YYYY-MM-DD') : '';
|
|
430
|
+
props.onChange(undefined, '', {
|
|
431
|
+
initial,
|
|
432
|
+
final
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
}, [valueInitial, valueFinal]);
|
|
436
|
+
(0, _react.useEffect)(() => {
|
|
437
|
+
if (props.value && !((0, _moment.default)(props.value.initial).isSame(valueInitial) || (0, _moment.default)(props.value.final).isSame(valueFinal))) {
|
|
438
|
+
const {
|
|
439
|
+
initial: valueInitialProp,
|
|
440
|
+
final: valueFinalProp
|
|
441
|
+
} = props.value;
|
|
442
|
+
let newValueInitial;
|
|
443
|
+
let newValueFinal;
|
|
444
|
+
if ((0, _moment.default)(valueInitialProp, 'YYYY-MM-DD', true).isValid()) {
|
|
445
|
+
newValueInitial = (0, _moment.default)(valueInitialProp, 'YYYY-MM-DD');
|
|
446
|
+
}
|
|
447
|
+
if ((0, _moment.default)(valueFinalProp, 'YYYY-MM-DD', true).isValid()) {
|
|
448
|
+
newValueFinal = (0, _moment.default)(valueFinalProp, 'YYYY-MM-DD');
|
|
449
|
+
}
|
|
450
|
+
setValueInitial(newValueInitial);
|
|
451
|
+
setValueFinal(newValueFinal);
|
|
452
|
+
}
|
|
453
|
+
}, [props.value]);
|
|
481
454
|
if (onDenied && onDenied.unvisible) return null;
|
|
482
455
|
const component = () => /*#__PURE__*/_react.default.createElement("div", {
|
|
483
456
|
ref: wrapperBaseInputPeriodRef,
|
|
@@ -25,9 +25,10 @@ const SearchField = props => {
|
|
|
25
25
|
const {
|
|
26
26
|
resetButton = true,
|
|
27
27
|
advancedFilterProps = {},
|
|
28
|
-
value
|
|
28
|
+
value,
|
|
29
|
+
drawerFilterIsOpened = false
|
|
29
30
|
} = props;
|
|
30
|
-
const [advancedFilterOpened, setAdvancedFilterOpened] = (0, _react.useState)(
|
|
31
|
+
const [advancedFilterOpened, setAdvancedFilterOpened] = (0, _react.useState)(drawerFilterIsOpened);
|
|
31
32
|
const [valorCampo, setValorCampo] = (0, _react.useState)('');
|
|
32
33
|
const [onDenied, setOnDenied] = (0, _react.useState)();
|
|
33
34
|
const {
|
|
@@ -106,6 +107,9 @@ const SearchField = props => {
|
|
|
106
107
|
setValorCampo(value);
|
|
107
108
|
}
|
|
108
109
|
}, [value]);
|
|
110
|
+
(0, _react.useEffect)(() => {
|
|
111
|
+
setAdvancedFilterOpened(drawerFilterIsOpened);
|
|
112
|
+
}, [drawerFilterIsOpened]);
|
|
109
113
|
if (onDenied && onDenied.unvisible) {
|
|
110
114
|
return null;
|
|
111
115
|
}
|
|
@@ -33,7 +33,8 @@ const MultipleSelect = props => {
|
|
|
33
33
|
customClassForWrapper,
|
|
34
34
|
customClassForInputContent,
|
|
35
35
|
customClassForSideButtons,
|
|
36
|
-
disabled = false
|
|
36
|
+
disabled = false,
|
|
37
|
+
dropdownMaxWidth = undefined
|
|
37
38
|
} = props;
|
|
38
39
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
39
40
|
const [currents, setCurrents] = (0, _react.useState)([]);
|
|
@@ -278,7 +279,7 @@ const MultipleSelect = props => {
|
|
|
278
279
|
opened: opened,
|
|
279
280
|
dataCombo: dataCombo,
|
|
280
281
|
currents: currents,
|
|
281
|
-
dropdownWidth: dropdownWidth || 0
|
|
282
|
+
dropdownWidth: dropdownMaxWidth || dropdownWidth || 0
|
|
282
283
|
})), /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
283
284
|
visible: !!hint && hintPosition === 'below',
|
|
284
285
|
customClass: "hint",
|
|
@@ -38,7 +38,8 @@ const SimpleSelect = props => {
|
|
|
38
38
|
customClassForWrapper,
|
|
39
39
|
customClassForInputContent,
|
|
40
40
|
customClassForLabel,
|
|
41
|
-
customClassForSideButtons
|
|
41
|
+
customClassForSideButtons,
|
|
42
|
+
dropdownMaxWidth = undefined
|
|
42
43
|
} = props;
|
|
43
44
|
const descriptionKeyIsString = typeof descriptionKey === 'string';
|
|
44
45
|
const dataSourceWithAllOptions = allOptions ? [{
|
|
@@ -310,8 +311,8 @@ const SimpleSelect = props => {
|
|
|
310
311
|
handleOnBlur: () => onBlur,
|
|
311
312
|
handleOnFocus: onFocus,
|
|
312
313
|
dataCombo: dataCombo,
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
searchNotFoundText: searchNotFoundText,
|
|
315
|
+
dropdownWidth: dropdownMaxWidth || dropdownWidth || 0
|
|
315
316
|
})));
|
|
316
317
|
};
|
|
317
318
|
var _default = exports.default = SimpleSelect;
|
|
@@ -58,6 +58,7 @@ interface ISimpleSelectProps {
|
|
|
58
58
|
hintPosition?: 'below' | 'onLabelRight';
|
|
59
59
|
themePopover?: 'light' | 'dark';
|
|
60
60
|
popoverAlign?: 'right' | 'left';
|
|
61
|
+
dropdownMaxWidth?: number;
|
|
61
62
|
}
|
|
62
63
|
interface ISelectFieldProps extends Omit<ISimpleSelectProps, 'idKey' | 'value' | 'descriptionKey'> {
|
|
63
64
|
multiple?: boolean;
|
package/lib/inputs/types.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ interface ISearchProps extends IBaseProps {
|
|
|
31
31
|
rounded?: boolean;
|
|
32
32
|
inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null>;
|
|
33
33
|
style?: CSSProperties;
|
|
34
|
+
drawerFilterIsOpened?: boolean;
|
|
34
35
|
}
|
|
35
36
|
interface IDropdownProps {
|
|
36
37
|
children: ReactNode | ReactNode[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Size } from '../../@types/Size.js';
|
|
3
|
+
import { ColorTheme } from '../../@types/ColorStyles.js';
|
|
4
|
+
import { ITooltipCommonProps } from '../../tooltip/types.js';
|
|
5
|
+
import { HintPosition, Position } from '../../@types/Position.js';
|
|
6
|
+
|
|
7
|
+
type InputHTMLProps = Omit<React__default.ComponentPropsWithoutRef<'input'>, 'size' | 'type'>;
|
|
8
|
+
interface CheckboxFieldInputBaseProps extends InputHTMLProps, ITooltipCommonProps {
|
|
9
|
+
hint?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
size?: Exclude<Size, 'mini'>;
|
|
12
|
+
variant?: 'default' | 'secondary';
|
|
13
|
+
errors?: string[];
|
|
14
|
+
customClass?: string;
|
|
15
|
+
customClassLabel?: string;
|
|
16
|
+
customClassWrapper?: string;
|
|
17
|
+
customClassInputContainer?: string;
|
|
18
|
+
rounded?: boolean;
|
|
19
|
+
readOnly?: boolean;
|
|
20
|
+
skeletonize?: boolean;
|
|
21
|
+
labelUppercase?: boolean;
|
|
22
|
+
hintPosition?: HintPosition;
|
|
23
|
+
themePopover?: ColorTheme;
|
|
24
|
+
popoverAlign?: Extract<Position, 'left' | 'right'>;
|
|
25
|
+
tabIndex?: number;
|
|
26
|
+
}
|
|
27
|
+
declare const InputBase: React__default.ForwardRefExoticComponent<CheckboxFieldInputBaseProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
28
|
+
|
|
29
|
+
export { CheckboxFieldInputBaseProps, InputBase };
|