linear-react-components-ui 1.1.18-beta.17 → 1.1.18-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintcache +1 -1
- package/lib/assets/styles/calendar.scss +64 -30
- package/lib/assets/styles/datepicker.scss +26 -6
- package/lib/assets/styles/input.scss +2 -2
- package/lib/assets/styles/periodpicker.scss +60 -20
- package/lib/assets/styles/popover.scss +0 -3
- package/lib/assets/styles/sidenav.scss +1 -1
- package/lib/assets/styles/tabs.scss +32 -15
- package/lib/calendar/DangerCalendar.d.ts +1 -0
- package/lib/calendar/InfoCalendar.d.ts +1 -0
- package/lib/calendar/PrimaryCalendar.d.ts +1 -0
- package/lib/calendar/SuccessCalendar.d.ts +1 -0
- package/lib/calendar/WarningCalendar.d.ts +1 -0
- package/lib/calendar/base/Day.d.ts +1 -0
- package/lib/calendar/base/Day.js +6 -2
- package/lib/calendar/base/Month.d.ts +2 -1
- package/lib/calendar/base/Month.js +2 -0
- package/lib/calendar/base/Week.d.ts +1 -0
- package/lib/calendar/base/index.d.ts +1 -0
- package/lib/calendar/base/index.js +63 -13
- package/lib/calendar/index.d.ts +1 -0
- package/lib/calendar/types.d.ts +5 -0
- package/lib/checkbox/Label.d.ts +11 -0
- package/lib/checkbox/index.js +18 -45
- package/lib/checkbox/types.d.ts +0 -4
- package/lib/dialog/base/Content.js +5 -4
- package/lib/dialog/base/Header.js +0 -1
- package/lib/dialog/base/index.js +27 -3
- package/lib/drawer/Drawer.js +1 -1
- package/lib/form/types.d.ts +0 -14
- package/lib/inputs/base/InputTextBase.js +8 -34
- package/lib/inputs/base/types.d.ts +0 -3
- package/lib/inputs/color/types.d.ts +0 -5
- package/lib/inputs/date/Dialog.js +5 -4
- package/lib/inputs/date/Dropdown.js +15 -7
- package/lib/inputs/date/helpers.d.ts +1 -11
- package/lib/inputs/date/helpers.js +1 -11
- package/lib/inputs/date/index.js +138 -100
- package/lib/inputs/date/types.d.ts +7 -10
- package/lib/inputs/file/DragDropFile.js +1 -2
- package/lib/inputs/file/types.d.ts +0 -3
- package/lib/inputs/mask/helpers.d.ts +0 -4
- package/lib/inputs/mask/types.d.ts +0 -4
- package/lib/inputs/multiSelect/types.d.ts +0 -4
- package/lib/inputs/number/BaseNumber.d.ts +1 -1
- package/lib/inputs/number/Currency.d.ts +1 -1
- package/lib/inputs/number/Decimal.d.ts +1 -1
- package/lib/inputs/number/index.d.ts +1 -1
- package/lib/inputs/number/index.js +3 -7
- package/lib/inputs/number/types.d.ts +2 -14
- package/lib/inputs/period/Dialog.d.ts +1 -1
- package/lib/inputs/period/Dialog.js +5 -3
- package/lib/inputs/period/Dropdown.js +19 -8
- package/lib/inputs/period/PeriodList.js +3 -12
- package/lib/inputs/period/index.js +241 -112
- package/lib/inputs/period/types.d.ts +10 -11
- package/lib/inputs/select/ActionButtons.js +3 -2
- package/lib/inputs/select/multiple/index.js +10 -11
- package/lib/inputs/select/simple/index.js +10 -4
- package/lib/inputs/select/types.d.ts +4 -6
- package/lib/inputs/types.d.ts +1 -0
- package/lib/list/index.js +2 -2
- package/lib/popover/index.js +5 -3
- package/lib/popover/types.d.ts +1 -2
- package/lib/radio/index.d.ts +1 -1
- package/lib/radio/index.js +1 -32
- package/lib/radio/types.d.ts +0 -6
- package/lib/tabs/DropdownTabs.js +21 -7
- package/lib/tabs/context.d.ts +1 -1
- package/lib/tabs/context.js +3 -3
- package/lib/tabs/types.d.ts +2 -1
- package/lib/textContent/index.d.ts +4 -18
- package/lib/textContent/index.js +4 -14
- package/lib/toolbar/types.d.ts +2 -1
- package/package.json +1 -1
- package/lib/inputs/mask/imaskHOC.js +0 -203
- package/lib/menus/sidenav/popup_menu_help/index.js +0 -85
- package/lib/tabs/DropdownItems.js +0 -62
- package/lib/tabs/MenuItems.js +0 -70
- package/lib/treeview_old/Header.js +0 -29
- package/lib/treeview_old/Node.js +0 -68
- package/lib/treeview_old/index.js +0 -43
package/lib/inputs/date/index.js
CHANGED
|
@@ -6,23 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _moment = _interopRequireDefault(require("moment"));
|
|
9
|
-
var
|
|
9
|
+
var _Dialog = _interopRequireDefault(require("./Dialog"));
|
|
10
10
|
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
|
11
|
-
var _calendar = _interopRequireDefault(require("../../calendar"));
|
|
12
|
-
require("../../assets/styles/datepicker.scss");
|
|
13
|
-
var contants = _interopRequireWildcard(require("../../internals/constants"));
|
|
14
11
|
var _buttons = _interopRequireDefault(require("../../buttons"));
|
|
15
|
-
var
|
|
16
|
-
var
|
|
12
|
+
var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
|
|
13
|
+
var _calendar = _interopRequireDefault(require("../../calendar"));
|
|
14
|
+
var _BaseMask = _interopRequireDefault(require("../mask/BaseMask"));
|
|
17
15
|
var _helpers = require("./helpers");
|
|
16
|
+
require("../../assets/styles/datepicker.scss");
|
|
18
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
18
|
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); }
|
|
20
19
|
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; }
|
|
21
20
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
22
|
-
const CALENDAR_BUTTON_WIDTH = 24;
|
|
23
|
-
const CALENDAR_MIN_WIDTH = 250;
|
|
24
21
|
const DatePicker = props => {
|
|
25
|
-
var _window;
|
|
26
22
|
const {
|
|
27
23
|
showButtonOpen = true,
|
|
28
24
|
openOnFocus = true,
|
|
@@ -34,69 +30,105 @@ const DatePicker = props => {
|
|
|
34
30
|
name = '',
|
|
35
31
|
inputRef: inputRefProp,
|
|
36
32
|
dialogSize = {
|
|
37
|
-
width: '
|
|
38
|
-
height: '
|
|
39
|
-
}
|
|
33
|
+
width: '384px',
|
|
34
|
+
height: '384px'
|
|
35
|
+
},
|
|
36
|
+
gridLayout,
|
|
37
|
+
shouldCloseOnEsc = true
|
|
40
38
|
} = props;
|
|
41
39
|
const [valueState, setValueState] = (0, _react.useState)(value ? (0, _helpers.getMomentValue)(value) : undefined);
|
|
42
|
-
const [valueFromProps, setValueFromProps] = (0, _react.useState)(value);
|
|
43
40
|
const [showCalendar, setShowCalendar] = (0, _react.useState)(false);
|
|
41
|
+
const [valueFromProps, setValueFromProps] = (0, _react.useState)(value);
|
|
44
42
|
const [inputDimensions, setInputDimensions] = (0, _react.useState)();
|
|
45
|
-
const [
|
|
43
|
+
const [calendarOnDialog, setCalendarOnDialog] = (0, _react.useState)(false);
|
|
46
44
|
const [onDenied, setOnDenied] = (0, _react.useState)({
|
|
47
45
|
disabled: false,
|
|
48
46
|
readOnly: false,
|
|
49
47
|
unvisible: false,
|
|
50
48
|
hideContent: false
|
|
51
49
|
});
|
|
52
|
-
const
|
|
50
|
+
const inputDateRef = (0, _react.useRef)();
|
|
53
51
|
const buttonOpenRef = (0, _react.useRef)();
|
|
54
52
|
const dropdownContainer = (0, _react.useRef)();
|
|
55
|
-
const
|
|
53
|
+
const currentDateButtonRef = (0, _react.useRef)();
|
|
54
|
+
const calendarContainerRef = (0, _react.useRef)(null);
|
|
55
|
+
const datePickerContainerRef = (0, _react.useRef)(null);
|
|
56
56
|
const onScreenResize = () => {
|
|
57
|
-
var
|
|
58
|
-
setInputDimensions(
|
|
57
|
+
var _inputDateRef$current;
|
|
58
|
+
setInputDimensions(inputDateRef === null || inputDateRef === void 0 ? void 0 : (_inputDateRef$current = inputDateRef.current) === null || _inputDateRef$current === void 0 ? void 0 : _inputDateRef$current.getBoundingClientRect());
|
|
59
59
|
};
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
const onCloseDateDialog = () => {
|
|
61
|
+
setShowCalendar(false);
|
|
62
|
+
if (showCalendarInDialog) {
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
var _inputDateRef$current2;
|
|
65
|
+
setCalendarOnDialog(false);
|
|
66
|
+
(_inputDateRef$current2 = inputDateRef.current) === null || _inputDateRef$current2 === void 0 ? void 0 : _inputDateRef$current2.focus();
|
|
67
|
+
}, 100);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const onCloseWithoutBlur = event => {
|
|
71
|
+
var _datePickerContainerR;
|
|
72
|
+
const focusOnAnotherField = !((_datePickerContainerR = datePickerContainerRef.current) !== null && _datePickerContainerR !== void 0 && _datePickerContainerR.contains(event.relatedTarget));
|
|
73
|
+
if (!showCalendarInDialog && showCalendar && focusOnAnotherField) {
|
|
67
74
|
setShowCalendar(false);
|
|
68
75
|
}
|
|
69
76
|
};
|
|
77
|
+
const onKeyDownPress = event => {
|
|
78
|
+
if (shouldCloseOnEsc && showCalendar && event && event.key && event.key === 'Escape') {
|
|
79
|
+
var _inputDateRef$current3;
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
setShowCalendar(false);
|
|
82
|
+
(_inputDateRef$current3 = inputDateRef.current) === null || _inputDateRef$current3 === void 0 ? void 0 : _inputDateRef$current3.focus();
|
|
83
|
+
}
|
|
84
|
+
if (showCalendar && showCalendarInDialog && event && event.key && event.key === 'Tab') {
|
|
85
|
+
var _calendarContainerRef, _calendarContainerRef2;
|
|
86
|
+
const buttonForNavigateCalendar = (_calendarContainerRef = calendarContainerRef.current) === null || _calendarContainerRef === void 0 ? void 0 : _calendarContainerRef.getElementsByClassName('navbutton');
|
|
87
|
+
const datePicked = (_calendarContainerRef2 = calendarContainerRef.current) === null || _calendarContainerRef2 === void 0 ? void 0 : _calendarContainerRef2.getElementsByClassName('-selectedday');
|
|
88
|
+
const buttonDatePicked = datePicked[0].firstChild;
|
|
89
|
+
const buttonsForFocus = Array.from([...buttonForNavigateCalendar, buttonDatePicked]);
|
|
90
|
+
const firstElement = buttonsForFocus[0];
|
|
91
|
+
const lastElement = buttonsForFocus[buttonsForFocus.length - 1];
|
|
92
|
+
if (event.shiftKey && document.activeElement === firstElement) {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
lastElement.focus();
|
|
95
|
+
} else if (!event.shiftKey && document.activeElement === lastElement) {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
firstElement.focus();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
event.stopPropagation();
|
|
101
|
+
};
|
|
102
|
+
const keepPositionCalendarByScroll = () => {
|
|
103
|
+
var _inputDateRef$current4;
|
|
104
|
+
const inputDateDimensions = (_inputDateRef$current4 = inputDateRef.current) === null || _inputDateRef$current4 === void 0 ? void 0 : _inputDateRef$current4.getBoundingClientRect();
|
|
105
|
+
const positionTop = inputDateDimensions && inputDateDimensions.bottom;
|
|
106
|
+
if (dropdownContainer && dropdownContainer.current && inputDateDimensions) {
|
|
107
|
+
dropdownContainer.current.style.top = String(positionTop).concat('px');
|
|
108
|
+
}
|
|
109
|
+
};
|
|
70
110
|
const openCalendar = () => {
|
|
71
111
|
setShowCalendar(true);
|
|
72
|
-
if (
|
|
73
|
-
|
|
112
|
+
if (inputDateRef.current) {
|
|
113
|
+
var _inputDateRef$current5;
|
|
114
|
+
inputDateRef.current.focus();
|
|
115
|
+
setInputDimensions((_inputDateRef$current5 = inputDateRef.current) === null || _inputDateRef$current5 === void 0 ? void 0 : _inputDateRef$current5.getBoundingClientRect());
|
|
74
116
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
setInsideDropdown(false);
|
|
81
|
-
if (dropdownContainer !== undefined && dropdownContainer.current) {
|
|
82
|
-
if (target === dropdownContainer.current || dropdownContainer.current.contains(target)) {
|
|
83
|
-
setInsideDropdown(true);
|
|
84
|
-
}
|
|
117
|
+
if (showCalendarInDialog) {
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
var _currentDateButtonRef;
|
|
120
|
+
(_currentDateButtonRef = currentDateButtonRef.current) === null || _currentDateButtonRef === void 0 ? void 0 : _currentDateButtonRef.focus();
|
|
121
|
+
}, 100);
|
|
85
122
|
}
|
|
86
123
|
};
|
|
87
124
|
const onInputFocus = e => {
|
|
88
125
|
if (props.onFocus) props.onFocus(e);
|
|
89
|
-
if (openOnFocus)
|
|
126
|
+
if (openOnFocus && !showCalendar && !calendarOnDialog) {
|
|
127
|
+
openCalendar();
|
|
128
|
+
}
|
|
90
129
|
};
|
|
91
130
|
const onInputBlur = e => {
|
|
92
131
|
if (props.onBlur) props.onBlur(e);
|
|
93
|
-
if (!insideDropdown) setShowCalendar(false);
|
|
94
|
-
};
|
|
95
|
-
const onInputKeyDown = event => {
|
|
96
|
-
if (Number(event.code) === contants.keyCodes.TAB) {
|
|
97
|
-
setInsideDropdown(false);
|
|
98
|
-
setShowCalendar(false);
|
|
99
|
-
}
|
|
100
132
|
};
|
|
101
133
|
const isValidDate = date => {
|
|
102
134
|
if (typeof date === 'object' && !(date instanceof Date)) {
|
|
@@ -135,11 +167,9 @@ const DatePicker = props => {
|
|
|
135
167
|
}
|
|
136
168
|
}
|
|
137
169
|
};
|
|
138
|
-
const setValue =
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
let e = arguments.length > 1 ? arguments[1] : undefined;
|
|
142
|
-
if (showCalendar && setFocusOnSelect) (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
|
|
170
|
+
const setValue = (valueParam, e) => {
|
|
171
|
+
var _inputDateRef$current6;
|
|
172
|
+
if (showCalendar && setFocusOnSelect) (_inputDateRef$current6 = inputDateRef.current) === null || _inputDateRef$current6 === void 0 ? void 0 : _inputDateRef$current6.focus();
|
|
143
173
|
if (props.onComplete) props.onComplete(e, valueParam);
|
|
144
174
|
if (props.onChange) onInputChange({
|
|
145
175
|
target: {
|
|
@@ -154,70 +184,51 @@ const DatePicker = props => {
|
|
|
154
184
|
const getButtonOpen = () => {
|
|
155
185
|
if (!showButtonOpen) return undefined;
|
|
156
186
|
return /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
157
|
-
key: "button-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
187
|
+
key: "button-open-date-picker",
|
|
188
|
+
disabled: shouldDisable(),
|
|
189
|
+
tabIndex: -1,
|
|
190
|
+
customClass: "calendar-button",
|
|
191
|
+
iconName: "calendar",
|
|
192
|
+
title: showCalendar ? 'Fechar Calendário' : 'Abrir Calendário',
|
|
163
193
|
onClick: () => {
|
|
164
|
-
|
|
194
|
+
if (showCalendar) {
|
|
195
|
+
setShowCalendar(false);
|
|
196
|
+
} else openCalendar();
|
|
165
197
|
},
|
|
166
|
-
customClass: "calendar-button",
|
|
167
|
-
tabIndex: -1,
|
|
168
198
|
targetRef: ref => {
|
|
169
199
|
buttonOpenRef.current = ref;
|
|
170
|
-
}
|
|
171
|
-
disabled: shouldDisable()
|
|
200
|
+
}
|
|
172
201
|
});
|
|
173
202
|
};
|
|
174
203
|
const getCalendar = (valueCalendar, calendarColorStyle) => /*#__PURE__*/_react.default.createElement(_calendar.default, {
|
|
204
|
+
colorStyle: calendarColorStyle,
|
|
175
205
|
currentDate: valueCalendar !== undefined ? valueCalendar : (0, _moment.default)(),
|
|
176
206
|
onDateChange: date => {
|
|
177
207
|
setValue(date.format(_helpers.PT_BR_FORMAT), undefined);
|
|
208
|
+
if (showCalendarInDialog) setCalendarOnDialog(false);
|
|
178
209
|
},
|
|
179
|
-
|
|
210
|
+
currentDateButton: buttonElement => currentDateButtonRef.current = buttonElement,
|
|
211
|
+
calendarContainer: calendarContainer => {
|
|
212
|
+
calendarContainerRef.current = calendarContainer;
|
|
213
|
+
}
|
|
180
214
|
});
|
|
181
|
-
const
|
|
215
|
+
const getCalendarComponent = () => {
|
|
182
216
|
if (onDenied && onDenied.readOnly) return null;
|
|
183
217
|
if (showCalendarInDialog) {
|
|
184
218
|
return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
|
|
185
219
|
dialogSize: dialogSize,
|
|
186
|
-
handlerClose:
|
|
220
|
+
handlerClose: onCloseDateDialog
|
|
187
221
|
}, getCalendar(valueState, props === null || props === void 0 ? void 0 : props.calendarColorStyle));
|
|
188
222
|
}
|
|
189
223
|
return /*#__PURE__*/_react.default.createElement(_Dropdown.default, {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
width: inputDimensions ? inputDimensions.width + (showButtonOpen ? CALENDAR_BUTTON_WIDTH : 0) : '',
|
|
224
|
+
showButtonOpen: showButtonOpen,
|
|
225
|
+
inputDimensions: inputDimensions,
|
|
226
|
+
containerRef: datePickerContainerRef,
|
|
194
227
|
dropdownRef: el => {
|
|
195
228
|
dropdownContainer.current = el;
|
|
196
229
|
}
|
|
197
230
|
}, getCalendar(valueState, props === null || props === void 0 ? void 0 : props.calendarColorStyle));
|
|
198
231
|
};
|
|
199
|
-
(0, _react.useEffect)(() => {
|
|
200
|
-
const screenWidth = window.innerWidth;
|
|
201
|
-
if (inputDimensions && screenWidth < inputDimensions.left + CALENDAR_MIN_WIDTH) {
|
|
202
|
-
setFormatedLeftPosition(inputDimensions.left - (CALENDAR_MIN_WIDTH - inputDimensions.width - CALENDAR_BUTTON_WIDTH));
|
|
203
|
-
} else {
|
|
204
|
-
setFormatedLeftPosition(inputDimensions === null || inputDimensions === void 0 ? void 0 : inputDimensions.left);
|
|
205
|
-
}
|
|
206
|
-
}, [(_window = window) === null || _window === void 0 ? void 0 : _window.innerWidth, inputDimensions]);
|
|
207
|
-
(0, _react.useEffect)(() => {
|
|
208
|
-
window.addEventListener('resize', onScreenResize);
|
|
209
|
-
document.addEventListener('click', onClickOutside);
|
|
210
|
-
document.addEventListener('mousemove', onMouseMove);
|
|
211
|
-
if (inputRef.current) onScreenResize();
|
|
212
|
-
return () => {
|
|
213
|
-
window.removeEventListener('resize', onScreenResize);
|
|
214
|
-
document.removeEventListener('click', onClickOutside);
|
|
215
|
-
document.removeEventListener('mousemove', onMouseMove);
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
// TODO: Procurar solução melhor.
|
|
219
|
-
// setTimeout(() => { this.onScreenResize(); }, 300);
|
|
220
|
-
}, [inputRef.current]);
|
|
221
232
|
(0, _react.useEffect)(() => {
|
|
222
233
|
if (value && (0, _moment.default)(value, _helpers.EN_US_FORMAT).format() !== 'Invalid date' && (0, _moment.default)(valueFromProps, _helpers.EN_US_FORMAT).format() !== (0, _moment.default)(value, _helpers.EN_US_FORMAT).format()) {
|
|
223
234
|
setValueState((0, _moment.default)(value, _helpers.EN_US_FORMAT));
|
|
@@ -227,31 +238,58 @@ const DatePicker = props => {
|
|
|
227
238
|
setValueFromProps(value);
|
|
228
239
|
}
|
|
229
240
|
}, [value]);
|
|
241
|
+
(0, _react.useEffect)(() => {
|
|
242
|
+
window.addEventListener('resize', onScreenResize);
|
|
243
|
+
document.addEventListener('keydown', onKeyDownPress);
|
|
244
|
+
if (inputDateRef.current) onScreenResize();
|
|
245
|
+
if (showCalendar && showCalendarInDialog) setCalendarOnDialog(true);
|
|
246
|
+
return () => {
|
|
247
|
+
window.removeEventListener('resize', onScreenResize);
|
|
248
|
+
document.removeEventListener('keydown', onKeyDownPress);
|
|
249
|
+
};
|
|
250
|
+
}, [inputDateRef.current, showCalendar]);
|
|
251
|
+
(0, _react.useEffect)(() => {
|
|
252
|
+
var _document$getElementB;
|
|
253
|
+
document.addEventListener('scroll', keepPositionCalendarByScroll);
|
|
254
|
+
(_document$getElementB = document.getElementById('modal-dialog-content')) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.addEventListener('scroll', keepPositionCalendarByScroll);
|
|
255
|
+
return () => {
|
|
256
|
+
var _document$getElementB2;
|
|
257
|
+
document.removeEventListener('scroll', keepPositionCalendarByScroll);
|
|
258
|
+
(_document$getElementB2 = document.getElementById('modal-dialog-content')) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.removeEventListener('scroll', keepPositionCalendarByScroll);
|
|
259
|
+
};
|
|
260
|
+
}, []);
|
|
230
261
|
if (onDenied && onDenied.unvisible) return null;
|
|
231
|
-
|
|
262
|
+
const component = () => /*#__PURE__*/_react.default.createElement("div", {
|
|
263
|
+
ref: datePickerContainerRef,
|
|
264
|
+
onBlur: onCloseWithoutBlur,
|
|
265
|
+
className: "datepicker-container"
|
|
266
|
+
}, /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({}, props, {
|
|
267
|
+
gridLayout: undefined,
|
|
232
268
|
value: !valueState ? ' ' : valueState.format(_helpers.PT_BR_FORMAT),
|
|
233
269
|
mask: "00/00/0000",
|
|
234
|
-
onComplete: e => {
|
|
235
|
-
if (
|
|
236
|
-
|
|
237
|
-
setValue((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.maskedValue, e);
|
|
270
|
+
onComplete: (e, date) => {
|
|
271
|
+
if (date) {
|
|
272
|
+
setValue(date, e);
|
|
238
273
|
}
|
|
239
274
|
},
|
|
240
275
|
onBlur: onInputBlur,
|
|
241
276
|
onFocus: e => {
|
|
242
277
|
onInputFocus(e);
|
|
243
278
|
},
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
if (date) onInputChange(e, e.target.value);
|
|
279
|
+
onChange: (e, date) => {
|
|
280
|
+
if (date) onInputChange(e, date);
|
|
247
281
|
},
|
|
248
282
|
inputRef: el => {
|
|
249
|
-
|
|
283
|
+
inputDateRef.current = el;
|
|
250
284
|
if (inputRefProp) inputRefProp.current = el;
|
|
251
285
|
},
|
|
252
286
|
rightElements: getButtonOpen(),
|
|
253
287
|
required: required,
|
|
254
288
|
handlerSetOnDenied: () => setOnDenied(onDenied)
|
|
255
|
-
})), showCalendar &&
|
|
289
|
+
})), showCalendar && getCalendarComponent());
|
|
290
|
+
return !gridLayout ? component() : /*#__PURE__*/_react.default.createElement(_gridlayout.default, {
|
|
291
|
+
customClass: "-withinput",
|
|
292
|
+
cols: gridLayout
|
|
293
|
+
}, component());
|
|
256
294
|
};
|
|
257
295
|
var _default = exports.default = DatePicker;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
2
|
import { ColorStyles } from '../../@types/ColorStyles.js';
|
|
3
3
|
import { PermissionAttr } from '../../@types/PermissionAttr.js';
|
|
4
4
|
import { CustomInputEvent } from '../base/types.js';
|
|
@@ -9,10 +9,11 @@ import '../../@types/Position.js';
|
|
|
9
9
|
|
|
10
10
|
interface IDatePickerProps {
|
|
11
11
|
value?: string;
|
|
12
|
+
openOnFocus?: boolean;
|
|
12
13
|
showButtonOpen?: boolean;
|
|
14
|
+
shouldCloseOnEsc?: boolean;
|
|
13
15
|
shouldCloseOnSelect?: boolean;
|
|
14
16
|
setFocusOnSelect?: boolean;
|
|
15
|
-
openOnFocus?: boolean;
|
|
16
17
|
showCalendarInDialog?: boolean;
|
|
17
18
|
inputRef?: React.MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null>;
|
|
18
19
|
dialogSize?: {
|
|
@@ -37,18 +38,14 @@ interface IDatePickerProps {
|
|
|
37
38
|
disabled?: boolean;
|
|
38
39
|
permissionAttr?: PermissionAttr;
|
|
39
40
|
label?: string;
|
|
40
|
-
|
|
41
|
-
hintPosition?: 'below' | 'onLabelRight';
|
|
42
|
-
themePopover?: 'light' | 'dark';
|
|
43
|
-
popoverAlign?: 'right' | 'left';
|
|
41
|
+
gridLayout?: string;
|
|
44
42
|
}
|
|
45
43
|
interface IDateDropdownProps {
|
|
46
44
|
children: ReactNode | ReactNode[];
|
|
47
45
|
dropdownRef: (el: HTMLDivElement) => void;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
minWidth: number | string;
|
|
46
|
+
containerRef: RefObject<HTMLDivElement | HTMLElement>;
|
|
47
|
+
showButtonOpen: boolean;
|
|
48
|
+
inputDimensions?: DOMRect;
|
|
52
49
|
}
|
|
53
50
|
interface IDateDialogProps {
|
|
54
51
|
children: ReactNode | ReactNode[];
|
|
@@ -35,7 +35,6 @@ const DragDropFile = props => {
|
|
|
35
35
|
showSubtitle = true,
|
|
36
36
|
multiple = false,
|
|
37
37
|
hint = [],
|
|
38
|
-
hintPosition = 'below',
|
|
39
38
|
errorMessages = [],
|
|
40
39
|
skeletonize = false
|
|
41
40
|
} = props;
|
|
@@ -266,7 +265,7 @@ const DragDropFile = props => {
|
|
|
266
265
|
})), /*#__PURE__*/_react.default.createElement(_errorMessage.ErrorMessage, {
|
|
267
266
|
messages: errorMessages
|
|
268
267
|
}), /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
269
|
-
visible: !!hint
|
|
268
|
+
visible: !!hint,
|
|
270
269
|
customClass: "hint",
|
|
271
270
|
description: hint
|
|
272
271
|
}));
|
|
@@ -18,7 +18,6 @@ interface IFileProps {
|
|
|
18
18
|
label?: string;
|
|
19
19
|
defaultFiles?: CustomFile;
|
|
20
20
|
hint?: string;
|
|
21
|
-
hintPosition?: 'below' | 'onLabelRight';
|
|
22
21
|
required?: boolean;
|
|
23
22
|
readOnly?: boolean;
|
|
24
23
|
name?: string;
|
|
@@ -35,8 +34,6 @@ interface IFileProps {
|
|
|
35
34
|
errorMessages?: string[];
|
|
36
35
|
skeletonize?: boolean;
|
|
37
36
|
showSubtitle?: boolean;
|
|
38
|
-
themePopover?: 'light' | 'dark';
|
|
39
|
-
popoverAlign?: 'right' | 'left';
|
|
40
37
|
}
|
|
41
38
|
interface IDefaultFileProps extends IFileProps {
|
|
42
39
|
onBtnClickInsert: () => void;
|
|
@@ -40,10 +40,6 @@ declare const getMaskOptions: ({ isDateField, placeholderChar, min, max, lazy, p
|
|
|
40
40
|
autoCompleteMask?: "left" | "right" | undefined;
|
|
41
41
|
definitions?: any;
|
|
42
42
|
mask?: any;
|
|
43
|
-
hint?: string | string[] | undefined;
|
|
44
|
-
hintPosition?: "below" | "onLabelRight" | undefined;
|
|
45
|
-
themePopover?: "light" | "dark" | undefined;
|
|
46
|
-
popoverAlign?: "left" | "right" | undefined;
|
|
47
43
|
placeholderChar: string;
|
|
48
44
|
min: any;
|
|
49
45
|
max: any;
|
|
@@ -50,10 +50,6 @@ type IBaseMaskProps = {
|
|
|
50
50
|
mask?: any;
|
|
51
51
|
min?: any;
|
|
52
52
|
max?: any;
|
|
53
|
-
hint?: string | string[];
|
|
54
|
-
hintPosition?: 'below' | 'onLabelRight';
|
|
55
|
-
themePopover?: 'light' | 'dark';
|
|
56
|
-
popoverAlign?: 'right' | 'left';
|
|
57
53
|
pattern?: string;
|
|
58
54
|
mapToRadix?: string[];
|
|
59
55
|
normalizeZeros?: boolean;
|
|
@@ -56,10 +56,6 @@ interface IMultiSelectProps {
|
|
|
56
56
|
disabled?: boolean;
|
|
57
57
|
dropdownAlignButton?: 'left' | 'right';
|
|
58
58
|
label?: string;
|
|
59
|
-
hint?: string | string[];
|
|
60
|
-
hintPosition?: 'below' | 'onLabelRight';
|
|
61
|
-
themePopover?: 'light' | 'dark';
|
|
62
|
-
popoverAlign?: 'right' | 'left';
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
export { DescriptionKey, GetFilteredParams, IActionButtonsProps, IDropdownMultiSelectProps, IMultiSelectProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IBaseNumberProps } from './types.js';
|
|
2
|
-
import '../../@types/PermissionAttr.js';
|
|
3
2
|
import '../base/types.js';
|
|
4
3
|
import 'react';
|
|
5
4
|
import '../../@types/Align.js';
|
|
6
5
|
import '../../@types/Period.js';
|
|
6
|
+
import '../../@types/PermissionAttr.js';
|
|
7
7
|
import '../../internals/types.js';
|
|
8
8
|
import '../../@types/Position.js';
|
|
9
9
|
import '../types.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ICurrencyProps } from './types.js';
|
|
2
|
-
import '../../@types/PermissionAttr.js';
|
|
3
2
|
import '../base/types.js';
|
|
4
3
|
import 'react';
|
|
5
4
|
import '../../@types/Align.js';
|
|
6
5
|
import '../../@types/Period.js';
|
|
6
|
+
import '../../@types/PermissionAttr.js';
|
|
7
7
|
import '../../internals/types.js';
|
|
8
8
|
import '../../@types/Position.js';
|
|
9
9
|
import '../types.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IBaseNumberProps } from './types.js';
|
|
2
|
-
import '../../@types/PermissionAttr.js';
|
|
3
2
|
import '../base/types.js';
|
|
4
3
|
import 'react';
|
|
5
4
|
import '../../@types/Align.js';
|
|
6
5
|
import '../../@types/Period.js';
|
|
6
|
+
import '../../@types/PermissionAttr.js';
|
|
7
7
|
import '../../internals/types.js';
|
|
8
8
|
import '../../@types/Position.js';
|
|
9
9
|
import '../types.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { default as CurrencyField } from './Currency.js';
|
|
2
2
|
export { default as DecimalField } from './Decimal.js';
|
|
3
3
|
import { INumberFieldProps } from './types.js';
|
|
4
|
-
import '../../@types/PermissionAttr.js';
|
|
5
4
|
import '../base/types.js';
|
|
6
5
|
import 'react';
|
|
7
6
|
import '../../@types/Align.js';
|
|
8
7
|
import '../../@types/Period.js';
|
|
8
|
+
import '../../@types/PermissionAttr.js';
|
|
9
9
|
import '../../internals/types.js';
|
|
10
10
|
import '../../@types/Position.js';
|
|
11
11
|
import '../types.js';
|
|
@@ -28,12 +28,10 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
28
28
|
const NumberField = props => {
|
|
29
29
|
const {
|
|
30
30
|
textAlign = 'left',
|
|
31
|
-
value = '',
|
|
32
|
-
themePopover = 'light',
|
|
33
|
-
popoverAlign = 'left',
|
|
34
|
-
removeZeroLeft = true,
|
|
35
31
|
min,
|
|
36
|
-
max
|
|
32
|
+
max,
|
|
33
|
+
value = '',
|
|
34
|
+
removeZeroLeft = true
|
|
37
35
|
} = props;
|
|
38
36
|
const [numberValue, setNumberValue] = (0, _react.useState)();
|
|
39
37
|
const onChange = event => {
|
|
@@ -55,8 +53,6 @@ const NumberField = props => {
|
|
|
55
53
|
return /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
|
|
56
54
|
value: numberValue,
|
|
57
55
|
textAlign: textAlign,
|
|
58
|
-
themePopover: themePopover,
|
|
59
|
-
popoverAlign: popoverAlign,
|
|
60
56
|
onChange: onChange,
|
|
61
57
|
type: "number"
|
|
62
58
|
}));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PermissionAttr } from '../../@types/PermissionAttr.js';
|
|
2
1
|
import { CustomInputEvent } from '../base/types.js';
|
|
3
2
|
import { IMaskHOCProps } from '../types.js';
|
|
4
|
-
import { TextAlign } from '../../@types/Align.js';
|
|
5
3
|
import 'react';
|
|
4
|
+
import '../../@types/Align.js';
|
|
6
5
|
import '../../@types/Period.js';
|
|
6
|
+
import '../../@types/PermissionAttr.js';
|
|
7
7
|
import '../../internals/types.js';
|
|
8
8
|
import '../../@types/Position.js';
|
|
9
9
|
import '../../@types/DataCombo.js';
|
|
@@ -12,16 +12,8 @@ import '../../@types/Icon.js';
|
|
|
12
12
|
import '../../icons/helper.js';
|
|
13
13
|
|
|
14
14
|
interface INumberFieldProps extends IMaskHOCProps {
|
|
15
|
-
value?: string;
|
|
16
|
-
permissionAttr?: PermissionAttr;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
hint?: string | string[];
|
|
19
|
-
hintPosition?: 'below' | 'onLabelRight';
|
|
20
|
-
themePopover?: 'light' | 'dark';
|
|
21
|
-
popoverAlign?: 'right' | 'left';
|
|
22
15
|
onChange?: (e?: CustomInputEvent) => void;
|
|
23
16
|
removeZeroLeft?: boolean;
|
|
24
|
-
textAlign?: TextAlign;
|
|
25
17
|
}
|
|
26
18
|
interface IBaseNumberProps extends IMaskHOCProps {
|
|
27
19
|
returnFormattedValueOnBlur?: boolean;
|
|
@@ -30,10 +22,6 @@ interface IBaseNumberProps extends IMaskHOCProps {
|
|
|
30
22
|
interface ICurrencyProps extends IMaskHOCProps {
|
|
31
23
|
currencySymbol?: string;
|
|
32
24
|
displayCurrencySymbol?: boolean;
|
|
33
|
-
hint?: string | string[];
|
|
34
|
-
hintPosition?: 'below' | 'onLabelRight';
|
|
35
|
-
themePopover?: 'light' | 'dark';
|
|
36
|
-
popoverAlign?: 'right' | 'left';
|
|
37
25
|
}
|
|
38
26
|
|
|
39
27
|
export { IBaseNumberProps, ICurrencyProps, INumberFieldProps };
|
|
@@ -9,6 +9,6 @@ import '../../@types/Align.js';
|
|
|
9
9
|
import '../../internals/types.js';
|
|
10
10
|
import '../../@types/Position.js';
|
|
11
11
|
|
|
12
|
-
declare const Dialog: ({ onOpenChange, children, dialogSize }: IDialogProps) => JSX.Element;
|
|
12
|
+
declare const Dialog: ({ onOpenChange, handlerClose, children, dialogSize }: IDialogProps) => JSX.Element;
|
|
13
13
|
|
|
14
14
|
export { Dialog as default };
|
|
@@ -10,16 +10,18 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
10
10
|
const Dialog = _ref => {
|
|
11
11
|
let {
|
|
12
12
|
onOpenChange,
|
|
13
|
+
handlerClose,
|
|
13
14
|
children,
|
|
14
15
|
dialogSize
|
|
15
16
|
} = _ref;
|
|
16
17
|
return /*#__PURE__*/_react.default.createElement(_base.default, {
|
|
18
|
+
closeOnOutsideClick: true,
|
|
19
|
+
closeOnEsc: true,
|
|
20
|
+
wrapperClassName: "",
|
|
17
21
|
width: dialogSize.width,
|
|
18
22
|
height: dialogSize.height,
|
|
19
23
|
onOpenChange: onOpenChange,
|
|
20
|
-
|
|
21
|
-
closeOnEsc: true,
|
|
22
|
-
wrapperClassName: ""
|
|
24
|
+
handlerClose: () => handlerClose(false)
|
|
23
25
|
}, children);
|
|
24
26
|
};
|
|
25
27
|
var _default = exports.default = Dialog;
|
|
@@ -6,23 +6,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
9
|
-
var _helper = _interopRequireDefault(require("./helper"));
|
|
10
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const
|
|
10
|
+
const CALENDAR_MIN_WIDTH = 250;
|
|
12
11
|
const Dropdown = props => {
|
|
12
|
+
const {
|
|
13
|
+
children,
|
|
14
|
+
dropdownRef,
|
|
15
|
+
containerRef,
|
|
16
|
+
inputDimensions
|
|
17
|
+
} = props;
|
|
13
18
|
const elementRef = (0, _react.useRef)(document.createElement('div'));
|
|
19
|
+
const width = inputDimensions && inputDimensions.width || CALENDAR_MIN_WIDTH;
|
|
14
20
|
(0, _react.useEffect)(() => {
|
|
21
|
+
var _containerRef$current;
|
|
15
22
|
elementRef.current.className = 'datepicker-component';
|
|
16
|
-
elementRef.current.
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
elementRef.current.style.width = String(width).concat('px');
|
|
24
|
+
elementRef.current.style.top = String(inputDimensions === null || inputDimensions === void 0 ? void 0 : inputDimensions.bottom).concat('px');
|
|
25
|
+
(_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.appendChild(elementRef.current);
|
|
26
|
+
dropdownRef(elementRef.current);
|
|
19
27
|
return () => {
|
|
20
|
-
|
|
28
|
+
var _containerRef$current2;
|
|
29
|
+
(_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.removeChild(elementRef.current);
|
|
21
30
|
};
|
|
22
31
|
}, []);
|
|
23
32
|
(0, _react.useEffect)(() => {
|
|
24
|
-
|
|
33
|
+
var _props$inputDimension;
|
|
34
|
+
elementRef.current.style.width = String(width).concat('px');
|
|
35
|
+
elementRef.current.style.top = String((_props$inputDimension = props.inputDimensions) === null || _props$inputDimension === void 0 ? void 0 : _props$inputDimension.bottom).concat('px');
|
|
25
36
|
}, [props]);
|
|
26
|
-
return /*#__PURE__*/_reactDom.default.createPortal(
|
|
37
|
+
return /*#__PURE__*/_reactDom.default.createPortal(children, elementRef.current);
|
|
27
38
|
};
|
|
28
39
|
var _default = exports.default = Dropdown;
|