linear-react-components-ui 1.1.24-beta.8 → 1.1.24-rc.1
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/AlertProvider.js +1 -2
- package/lib/alerts/BaseAlert.js +1 -1
- package/lib/alerts/Message.js +2 -3
- package/lib/alerts/withAlert.js +1 -2
- package/lib/assets/styles/calendar.scss +137 -32
- package/lib/assets/styles/datepicker2.scss +4 -1
- package/lib/assets/styles/file.scss +8 -0
- package/lib/avatar/index.js +9 -11
- package/lib/badge/index.js +4 -4
- package/lib/buttons/Button.js +1 -2
- package/lib/buttons/DangerButton.js +1 -1
- package/lib/buttons/DefaultButton.js +5 -14
- 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 +2 -2
- package/lib/calendar/base/helpers.js +2 -2
- package/lib/calendar/base/index.js +123 -44
- package/lib/checkbox/index.js +2 -3
- package/lib/dialog/Custom.js +2 -3
- package/lib/dialog/Question.js +5 -4
- package/lib/dialog/base/Content.js +2 -3
- package/lib/dialog/base/Header.js +3 -4
- package/lib/dialog/base/index.js +10 -9
- package/lib/dialog/form/index.js +6 -6
- package/lib/dialog/wizard/index.js +1 -2
- package/lib/dialog/wizard/progressbar.js +1 -1
- package/lib/dialog/wizard/step.js +1 -1
- package/lib/dialog/wizard/useWizard.js +1 -2
- package/lib/drawer/Content.js +1 -2
- package/lib/drawer/Drawer.js +5 -6
- package/lib/drawer/Header.js +2 -3
- package/lib/dropdown/Popup.js +7 -7
- package/lib/dropdown/helper.js +1 -1
- package/lib/dropdown/withDropdown.js +3 -4
- package/lib/fieldset/index.js +8 -9
- package/lib/form/Field.js +2 -3
- package/lib/form/FieldArray.js +2 -3
- package/lib/form/FieldNumber.js +4 -5
- package/lib/form/FieldPeriod.js +3 -4
- package/lib/form/index.js +3 -4
- package/lib/form/withFieldHOC.js +1 -2
- package/lib/form/withFormSecurity.js +1 -2
- package/lib/form2/helpers.js +1 -1
- package/lib/form2/index.d.ts +1 -1
- package/lib/form2/types.d.ts +0 -4
- package/lib/form2/useForm/index.js +17 -13
- 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 +9 -9
- package/lib/index-4b31b471.d.ts +15 -0
- package/lib/index-8a0c7463.d.ts +41 -0
- package/lib/index-9203efed.d.ts +26 -0
- package/lib/inputs/base/InputTextBase.js +9 -8
- package/lib/inputs/base/helpers.js +3 -7
- package/lib/inputs/base/types.d.ts +1 -1
- package/lib/inputs/color/index.js +2 -3
- package/lib/inputs/date/Dropdown.js +6 -4
- package/lib/inputs/date/index.js +31 -19
- package/lib/inputs/errorMessage/index.js +2 -3
- package/lib/inputs/file/DefaultFile.js +31 -31
- package/lib/inputs/file/DragDropFile.js +18 -17
- package/lib/inputs/file/File.js +6 -5
- package/lib/inputs/file/FileButtonSettings.js +0 -1
- package/lib/inputs/inputHOC.js +1 -2
- package/lib/inputs/mask/BaseMask.js +1 -2
- package/lib/inputs/mask/Cnpj.js +1 -2
- package/lib/inputs/mask/Cpf.js +1 -2
- package/lib/inputs/multiSelect/ActionButtons.js +1 -2
- package/lib/inputs/multiSelect/Dropdown.js +11 -11
- package/lib/inputs/multiSelect/helper.js +2 -1
- package/lib/inputs/multiSelect/index.js +10 -9
- package/lib/inputs/number/BaseNumber.js +1 -1
- package/lib/inputs/number/index.js +3 -3
- package/lib/inputs/period/Dropdown.js +7 -4
- package/lib/inputs/period/PeriodList.js +1 -1
- package/lib/inputs/period/helper.js +1 -3
- package/lib/inputs/period/index.js +66 -40
- package/lib/inputs/period/types.d.ts +4 -1
- package/lib/inputs/search/index.js +2 -3
- package/lib/inputs/select/ActionButtons.js +1 -1
- package/lib/inputs/select/Dropdown.js +3 -4
- package/lib/inputs/select/helper.js +13 -10
- package/lib/inputs/select/multiple/Selecteds.js +2 -2
- package/lib/inputs/select/multiple/index.js +14 -11
- package/lib/inputs/select/simple/index.js +19 -13
- package/lib/inputs/textarea/index.js +1 -1
- package/lib/inputs2/checkboxfield/index.d.ts +1 -1
- package/lib/inputs2/checkboxfield/index.js +15 -15
- package/lib/inputs2/colorfield/index.js +5 -5
- package/lib/inputs2/date/base/constants.js +2 -1
- package/lib/inputs2/date/base/index.js +7 -7
- package/lib/inputs2/date/datefield/calendarbox.d.ts +1 -1
- package/lib/inputs2/date/datefield/calendarbox.js +3 -2
- package/lib/inputs2/date/datefield/index.js +37 -28
- package/lib/inputs2/date/datefield/triggers.js +1 -2
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +1 -1
- package/lib/inputs2/date/dateperiodfield/calendarbox.js +8 -6
- package/lib/inputs2/date/dateperiodfield/index.js +61 -44
- package/lib/inputs2/date/dateperiodfield/triggers.js +19 -14
- package/lib/inputs2/filefield/index.js +33 -27
- package/lib/inputs2/index.d.ts +3 -3
- package/lib/inputs2/index.js +1 -2
- package/lib/inputs2/mask/BaseMask.js +7 -7
- package/lib/inputs2/mask/Cnpj.js +4 -5
- package/lib/inputs2/mask/Cpf.js +4 -5
- package/lib/inputs2/mask/Phone.js +1 -2
- package/lib/inputs2/mask/ZipCode.js +1 -2
- package/lib/inputs2/numberfield/currency.js +6 -6
- package/lib/inputs2/numberfield/decimal.js +6 -6
- package/lib/inputs2/numberfield/index.js +6 -6
- package/lib/inputs2/radiofield/index.d.ts +1 -1
- package/lib/inputs2/radiofield/index.js +14 -13
- package/lib/inputs2/selectfield/index.d.ts +1 -1
- package/lib/inputs2/selectfield/index.js +71 -54
- package/lib/inputs2/selectfield/item.d.ts +1 -1
- package/lib/inputs2/selectfield/item.js +4 -4
- package/lib/inputs2/selectfield/listbox.d.ts +1 -1
- package/lib/inputs2/selectfield/listbox.js +7 -4
- package/lib/inputs2/selectfield/options.d.ts +1 -1
- package/lib/inputs2/selectfield/search.d.ts +1 -1
- package/lib/inputs2/selectfield/search.js +3 -4
- package/lib/inputs2/selectfield/selections.d.ts +1 -1
- package/lib/inputs2/selectfield/selections.js +3 -2
- package/lib/inputs2/selectfield/triggers.js +6 -5
- package/lib/inputs2/slot/index.d.ts +2 -2
- package/lib/inputs2/textareafield/index.js +21 -18
- package/lib/inputs2/textfield/index.js +15 -14
- package/lib/labelMessages/index.js +4 -6
- package/lib/labels/DefaultLabel.js +2 -6
- package/lib/labels/label_container/index.js +1 -1
- package/lib/list/Header.js +1 -1
- package/lib/list/Item.js +10 -12
- package/lib/list/index.js +2 -4
- package/lib/menus/float/MenuItem.js +3 -4
- package/lib/menus/float/SubMenuContainer.js +2 -3
- package/lib/menus/float/index.js +1 -1
- package/lib/menus/sidenav/ExpandMenu.js +1 -1
- package/lib/menus/sidenav/MenuLink.js +1 -2
- package/lib/menus/sidenav/NavMenuGroup.js +2 -3
- package/lib/menus/sidenav/NavMenuItem.js +10 -9
- package/lib/menus/sidenav/NavSubMenuItem.js +2 -3
- package/lib/menus/sidenav/helpers.js +1 -1
- package/lib/menus/sidenav/index.js +6 -7
- package/lib/menus/sidenav/popup_menu_search/index.js +1 -2
- package/lib/panel/Content.js +9 -8
- package/lib/panel/Default.js +3 -4
- package/lib/panel/Header.js +4 -5
- package/lib/permissionValidations.js +1 -1
- package/lib/popover/PopoverText.js +1 -2
- package/lib/popover/index.js +1 -1
- package/lib/progress/Bar.js +6 -6
- package/lib/radio/index.js +3 -4
- 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 +3 -4
- package/lib/split/Split.js +2 -3
- package/lib/split/SplitSide.js +4 -5
- package/lib/table/Body.js +4 -5
- package/lib/table/Header.js +9 -7
- package/lib/table/HeaderColumn.js +2 -3
- package/lib/table/Row.js +4 -5
- package/lib/table/RowColumn.js +2 -3
- package/lib/table/index.js +2 -8
- package/lib/tabs/DropdownTabs.js +2 -3
- package/lib/tabs/Menu.js +1 -1
- package/lib/tabs/MenuTabs.js +4 -9
- package/lib/tabs/Panel.js +8 -7
- package/lib/tabs/context.js +7 -5
- package/lib/tabs/index.js +1 -2
- package/lib/textContent/index.js +2 -3
- package/lib/toolbar/ButtonBar.js +2 -3
- package/lib/toolbar/LabelBar.js +1 -2
- package/lib/toolbar/index.js +1 -1
- package/lib/tooltip/TooltipContent.js +8 -9
- package/lib/tooltip/useTooltip.js +8 -8
- package/lib/treetable/Body.js +2 -3
- package/lib/treetable/Header.js +3 -4
- package/lib/treetable/Row.js +9 -10
- package/lib/treeview/Header.js +1 -1
- package/lib/treeview/Node.js +5 -6
- package/lib/treeview/index.js +5 -6
- package/lib/uitour/index.js +9 -8
- package/package.json +1 -1
- package/lib/calendar/base/Day.d.ts +0 -8
- package/lib/calendar/base/Day.js +0 -36
- package/lib/calendar/base/Month.d.ts +0 -8
- package/lib/calendar/base/Month.js +0 -39
- package/lib/calendar/base/Week.d.ts +0 -8
- package/lib/calendar/base/Week.js +0 -35
- package/lib/index-118afd58.d.ts +0 -26
- package/lib/index-8f540f57.d.ts +0 -41
- package/lib/index-b2ef36a6.d.ts +0 -15
|
@@ -2,6 +2,6 @@ import React__default from 'react';
|
|
|
2
2
|
|
|
3
3
|
interface DateFieldCalendarBoxProps extends React__default.ComponentProps<'div'> {
|
|
4
4
|
}
|
|
5
|
-
declare const CalendarBox: React__default.ForwardRefExoticComponent<Pick<DateFieldCalendarBoxProps, "
|
|
5
|
+
declare const CalendarBox: React__default.ForwardRefExoticComponent<Pick<DateFieldCalendarBoxProps, "key" | "style" | "children" | "slot" | "title" | "className" | "align" | "onClick" | "color" | "hidden" | "id" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React__default.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
|
|
7
7
|
export { CalendarBox, DateFieldCalendarBoxProps };
|
|
@@ -34,13 +34,14 @@ const CalendarBox = exports.CalendarBox = /*#__PURE__*/_react.default.forwardRef
|
|
|
34
34
|
const isInRange = day => selectedDate.inicial && selectedDate.final && day.isAfter(selectedDate.inicial, 'day') && day.isBefore(selectedDate.final, 'day');
|
|
35
35
|
const isSelected = day => selectedDate.inicial && day.isSame(selectedDate.inicial, 'day') || selectedDate.final && day.isSame(selectedDate.final, 'day');
|
|
36
36
|
const handleOnMouseDown = event => {
|
|
37
|
-
|
|
37
|
+
var _event$preventDefault;
|
|
38
|
+
event === null || event === void 0 ? void 0 : (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.call(event);
|
|
38
39
|
};
|
|
39
40
|
const handleOnClick = (___, daySelected) => {
|
|
40
41
|
const inputActive = document.activeElement;
|
|
41
42
|
let inputType = undefined;
|
|
42
|
-
if (inputActive
|
|
43
|
-
if (inputActive
|
|
43
|
+
if ((inputActive === null || inputActive === void 0 ? void 0 : inputActive.id) === initialInputId) inputType = 'initial';
|
|
44
|
+
if ((inputActive === null || inputActive === void 0 ? void 0 : inputActive.id) === finalInputId) inputType = 'final';
|
|
44
45
|
if (!_lodash.default.isUndefined(inputType)) {
|
|
45
46
|
handleChangeUpdateDateState({
|
|
46
47
|
date: daySelected,
|
|
@@ -89,7 +90,7 @@ const CalendarBox = exports.CalendarBox = /*#__PURE__*/_react.default.forwardRef
|
|
|
89
90
|
className: "date-calendar-box-days-of-week"
|
|
90
91
|
}, /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", null, _moment.default.weekdaysShort(true).map((day, idx) => /*#__PURE__*/_react.default.createElement("th", {
|
|
91
92
|
role: "columnheader",
|
|
92
|
-
key:
|
|
93
|
+
key: "day-of-week-".concat(idx + 1)
|
|
93
94
|
}, day))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
94
95
|
className: "date-calendar-box-grid-of-days"
|
|
95
96
|
}, /*#__PURE__*/_react.default.createElement("table", {
|
|
@@ -101,11 +102,12 @@ const CalendarBox = exports.CalendarBox = /*#__PURE__*/_react.default.forwardRef
|
|
|
101
102
|
role: "row",
|
|
102
103
|
key: weekIndex + 1
|
|
103
104
|
}, week.map((day, dateIndex) => {
|
|
105
|
+
var _isInRange, _isSelected;
|
|
104
106
|
const idActiveDescendant = day.format(_helpers.TOKEN_ISO_FORMAT);
|
|
105
107
|
const isToday = _lodash.default.isEqual((0, _moment.default)().format(_helpers.TOKEN_ISO_FORMAT), day.format(_helpers.TOKEN_ISO_FORMAT));
|
|
106
|
-
const inRange = isInRange(day)
|
|
108
|
+
const inRange = (_isInRange = isInRange(day)) !== null && _isInRange !== void 0 ? _isInRange : false;
|
|
107
109
|
const hasFocus = _lodash.default.isEqual(activeDescendant, day.format(_helpers.TOKEN_ISO_FORMAT));
|
|
108
|
-
const hasSelected = isSelected(day)
|
|
110
|
+
const hasSelected = (_isSelected = isSelected(day)) !== null && _isSelected !== void 0 ? _isSelected : false;
|
|
109
111
|
const isCurrentMonth = day.month() === calendarDisplayDate.month();
|
|
110
112
|
const descriptionDate = day.format('LL');
|
|
111
113
|
return /*#__PURE__*/_react.default.createElement("td", {
|
|
@@ -23,13 +23,13 @@ var _calendarbox = require("./calendarbox");
|
|
|
23
23
|
var _context = require("./context");
|
|
24
24
|
const _excluded = ["label", "errors", "initialName", "finalName", "onDeniedActions", "permissionAttr", "customClass", "customClassLabel", "customClassWrapper", "customClassInputContainer", "labelUppercase", "undigitable", "skeletonize", "hintPosition", "gridLayout", "themePopover", "popoverAlign", "showCalendarButton", "textAlign", "openCalendarOnFocus", "shouldCloseOnSelect", "showPredefinedPeriodsButton", "showClearDateButton", "placeholder", "returnValueType", "tooltip", "tooltipPosition", "tooltipWidth"];
|
|
25
25
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
26
|
-
function
|
|
27
|
-
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; }
|
|
26
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
28
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
28
|
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); }
|
|
30
29
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
31
30
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
32
31
|
const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __) => {
|
|
32
|
+
var _selectedDate$inicial, _selectedDate$final, _props$hint;
|
|
33
33
|
const {
|
|
34
34
|
label,
|
|
35
35
|
errors,
|
|
@@ -92,7 +92,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
92
92
|
placeholderChar: '_'
|
|
93
93
|
}, {
|
|
94
94
|
ref: initialInputRef,
|
|
95
|
-
defaultValue: selectedDate.inicial
|
|
95
|
+
defaultValue: (_selectedDate$inicial = selectedDate.inicial) === null || _selectedDate$inicial === void 0 ? void 0 : _selectedDate$inicial.format(_helpers2.TOKEN_PTBR_FORMAT),
|
|
96
96
|
onComplete: value => {
|
|
97
97
|
const date = (0, _moment.default)(value, _helpers2.TOKEN_PTBR_FORMAT);
|
|
98
98
|
if (date.isValid()) {
|
|
@@ -114,7 +114,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
114
114
|
placeholderChar: '_'
|
|
115
115
|
}, {
|
|
116
116
|
ref: finalInputRef,
|
|
117
|
-
defaultValue: selectedDate.final
|
|
117
|
+
defaultValue: (_selectedDate$final = selectedDate.final) === null || _selectedDate$final === void 0 ? void 0 : _selectedDate$final.format(_helpers2.TOKEN_PTBR_FORMAT),
|
|
118
118
|
onComplete: value => {
|
|
119
119
|
const date = (0, _moment.default)(value, _helpers2.TOKEN_PTBR_FORMAT);
|
|
120
120
|
if (date.isValid()) {
|
|
@@ -126,11 +126,11 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
|
-
const hasLabel = !_lodash.default.isEmpty(props
|
|
129
|
+
const hasLabel = !_lodash.default.isEmpty(props === null || props === void 0 ? void 0 : props.label);
|
|
130
130
|
const isReadOnly = Boolean(props.readOnly || onDenied.readOnly);
|
|
131
131
|
const isDisabled = Boolean(props.disabled || onDenied.disabled);
|
|
132
|
-
const hasHintMessages = Boolean(props.hint
|
|
133
|
-
const hasValidationErrors = Boolean(errors
|
|
132
|
+
const hasHintMessages = Boolean((_props$hint = props.hint) === null || _props$hint === void 0 ? void 0 : _props$hint.length);
|
|
133
|
+
const hasValidationErrors = Boolean(errors === null || errors === void 0 ? void 0 : errors.length);
|
|
134
134
|
const handleChangeSelectedDate = _react.default.useCallback(object => setSelectedDate(object), []);
|
|
135
135
|
const handleChangeCalendarBoxState = _react.default.useCallback(value => setCalendarBoxOpen(value), []);
|
|
136
136
|
const handleChangeActiveDescendant = _react.default.useCallback(value => setActiveDescendant(value), []);
|
|
@@ -154,13 +154,14 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
154
154
|
});
|
|
155
155
|
}, []);
|
|
156
156
|
const verifyPeriodSelectedIsValid = _react.default.useCallback(() => {
|
|
157
|
-
const objectValue = props
|
|
157
|
+
const objectValue = props === null || props === void 0 ? void 0 : props.value;
|
|
158
158
|
const isValidInitialValue = !_lodash.default.isEmpty(objectValue[initialName]);
|
|
159
159
|
const isValidFinalValue = !_lodash.default.isEmpty(objectValue[finalName]);
|
|
160
160
|
return isValidInitialValue && isValidFinalValue;
|
|
161
|
-
}, [props
|
|
161
|
+
}, [props === null || props === void 0 ? void 0 : props.value, initialName, finalName]);
|
|
162
162
|
const handleOnClickClearSelectedPeriod = _react.default.useCallback(() => {
|
|
163
|
-
|
|
163
|
+
var _props$onChange;
|
|
164
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
|
164
165
|
target: {
|
|
165
166
|
name: props.name,
|
|
166
167
|
value: {
|
|
@@ -185,8 +186,8 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
185
186
|
} = params;
|
|
186
187
|
const rawDate = date.clone();
|
|
187
188
|
const verifyDateRangeOrder = (initialDate, finalDate) => {
|
|
188
|
-
const inicial = initialDate
|
|
189
|
-
const final = initialDate
|
|
189
|
+
const inicial = initialDate !== null && initialDate !== void 0 && initialDate.isAfter(finalDate) ? finalDate : initialDate;
|
|
190
|
+
const final = initialDate !== null && initialDate !== void 0 && initialDate.isAfter(finalDate) ? initialDate : finalDate;
|
|
190
191
|
return {
|
|
191
192
|
inicial,
|
|
192
193
|
final
|
|
@@ -195,6 +196,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
195
196
|
switch (inputType) {
|
|
196
197
|
case 'initial':
|
|
197
198
|
{
|
|
199
|
+
var _props$onChange2;
|
|
198
200
|
setSelectedDate(prevSelectedDate => {
|
|
199
201
|
const {
|
|
200
202
|
inicial,
|
|
@@ -210,22 +212,24 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
210
212
|
inicial,
|
|
211
213
|
final
|
|
212
214
|
} = verifyDateRangeOrder(rawDate, selectedDate.final);
|
|
213
|
-
props.onChange
|
|
215
|
+
(_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 ? void 0 : _props$onChange2.call(props, {
|
|
214
216
|
target: {
|
|
215
217
|
name: props.name,
|
|
216
218
|
value: {
|
|
217
|
-
[initialName]: returnValueType === 'default' ? inicial
|
|
218
|
-
[finalName]: returnValueType === 'default' ? final
|
|
219
|
+
[initialName]: returnValueType === 'default' ? inicial === null || inicial === void 0 ? void 0 : inicial.format(_helpers2.TOKEN_ISO_FORMAT) : inicial === null || inicial === void 0 ? void 0 : inicial.toISOString(),
|
|
220
|
+
[finalName]: returnValueType === 'default' ? final === null || final === void 0 ? void 0 : final.format(_helpers2.TOKEN_ISO_FORMAT) : final === null || final === void 0 ? void 0 : final.toISOString()
|
|
219
221
|
}
|
|
220
222
|
}
|
|
221
223
|
});
|
|
222
224
|
requestAnimationFrame(() => {
|
|
223
|
-
|
|
225
|
+
var _finalInputRef$curren, _finalInputRef$curren2;
|
|
226
|
+
if (!typing) (_finalInputRef$curren = finalInputRef.current) === null || _finalInputRef$curren === void 0 ? void 0 : (_finalInputRef$curren2 = _finalInputRef$curren.focus) === null || _finalInputRef$curren2 === void 0 ? void 0 : _finalInputRef$curren2.call(_finalInputRef$curren);
|
|
224
227
|
});
|
|
225
228
|
break;
|
|
226
229
|
}
|
|
227
230
|
case 'final':
|
|
228
231
|
{
|
|
232
|
+
var _props$onChange3;
|
|
229
233
|
setSelectedDate(prevSelectedDate => {
|
|
230
234
|
const {
|
|
231
235
|
inicial,
|
|
@@ -241,12 +245,12 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
241
245
|
inicial,
|
|
242
246
|
final
|
|
243
247
|
} = verifyDateRangeOrder(selectedDate.inicial, rawDate);
|
|
244
|
-
props.onChange
|
|
248
|
+
(_props$onChange3 = props.onChange) === null || _props$onChange3 === void 0 ? void 0 : _props$onChange3.call(props, {
|
|
245
249
|
target: {
|
|
246
250
|
name: props.name,
|
|
247
251
|
value: {
|
|
248
|
-
[initialName]: returnValueType === 'default' ? inicial
|
|
249
|
-
[finalName]: returnValueType === 'default' ? final
|
|
252
|
+
[initialName]: returnValueType === 'default' ? inicial === null || inicial === void 0 ? void 0 : inicial.format(_helpers2.TOKEN_ISO_FORMAT) : inicial === null || inicial === void 0 ? void 0 : inicial.toISOString(),
|
|
253
|
+
[finalName]: returnValueType === 'default' ? final === null || final === void 0 ? void 0 : final.format(_helpers2.TOKEN_ISO_FORMAT) : final === null || final === void 0 ? void 0 : final.toISOString()
|
|
250
254
|
}
|
|
251
255
|
}
|
|
252
256
|
});
|
|
@@ -259,7 +263,9 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
259
263
|
setCalendarDisplayDate(rawDate.clone());
|
|
260
264
|
}, [props.name, props.onChange, initialName, finalName, selectedDate, shouldCloseOnSelect]);
|
|
261
265
|
const handleChangeUpdateDateStateWithPredefinedPeriod = _react.default.useCallback(period => {
|
|
266
|
+
var _finalInputRef$curren3, _finalInputRef$curren4;
|
|
262
267
|
const localOnChange = (initialDate, finalDate) => {
|
|
268
|
+
var _props$onChange4;
|
|
263
269
|
const valueToUpdate = {
|
|
264
270
|
[initialName]: returnValueType === 'default' ? initialDate.format(_helpers2.TOKEN_ISO_FORMAT) : initialDate.toISOString(),
|
|
265
271
|
[finalName]: returnValueType === 'default' ? finalDate.format(_helpers2.TOKEN_ISO_FORMAT) : finalDate.toISOString()
|
|
@@ -271,7 +277,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
271
277
|
};
|
|
272
278
|
return updatedState;
|
|
273
279
|
});
|
|
274
|
-
props.onChange
|
|
280
|
+
(_props$onChange4 = props.onChange) === null || _props$onChange4 === void 0 ? void 0 : _props$onChange4.call(props, {
|
|
275
281
|
target: {
|
|
276
282
|
name: props.name,
|
|
277
283
|
value: valueToUpdate
|
|
@@ -323,16 +329,19 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
323
329
|
default:
|
|
324
330
|
break;
|
|
325
331
|
}
|
|
326
|
-
finalInputRef
|
|
332
|
+
finalInputRef === null || finalInputRef === void 0 ? void 0 : (_finalInputRef$curren3 = finalInputRef.current) === null || _finalInputRef$curren3 === void 0 ? void 0 : (_finalInputRef$curren4 = _finalInputRef$curren3.focus) === null || _finalInputRef$curren4 === void 0 ? void 0 : _finalInputRef$curren4.call(_finalInputRef$curren3);
|
|
327
333
|
if (shouldCloseOnSelect) handleChangeCalendarBoxState(false);
|
|
328
334
|
}, [props.name, props.onChange, initialName, finalName]);
|
|
329
335
|
const handleOnBlurMaskInput = (event, inputType) => {
|
|
330
|
-
|
|
336
|
+
var _props$onBlur;
|
|
337
|
+
props === null || props === void 0 ? void 0 : (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 ? void 0 : _props$onBlur.call(props, event);
|
|
331
338
|
if (inputType === 'initial') {
|
|
332
|
-
|
|
339
|
+
var _event$relatedTarget;
|
|
340
|
+
if (((_event$relatedTarget = event.relatedTarget) === null || _event$relatedTarget === void 0 ? void 0 : _event$relatedTarget.id) !== finalInputName) handleChangeCalendarBoxState(false);
|
|
333
341
|
if (calendarBoxOpen) {
|
|
334
|
-
|
|
335
|
-
|
|
342
|
+
var _selectedDate$inicial2, _selectedDate$inicial3;
|
|
343
|
+
handleChangeActiveDescendant(((_selectedDate$inicial2 = selectedDate.inicial) !== null && _selectedDate$inicial2 !== void 0 ? _selectedDate$inicial2 : (0, _moment.default)()).format(_helpers2.TOKEN_ISO_FORMAT));
|
|
344
|
+
setCalendarDisplayDate((_selectedDate$inicial3 = selectedDate.inicial) !== null && _selectedDate$inicial3 !== void 0 ? _selectedDate$inicial3 : (0, _moment.default)());
|
|
336
345
|
}
|
|
337
346
|
if (_lodash.default.size(initialUnmaskedValue) !== 8) {
|
|
338
347
|
const date = (0, _moment.default)(selectedDate.inicial, _helpers2.TOKEN_ISO_FORMAT);
|
|
@@ -342,10 +351,12 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
342
351
|
}
|
|
343
352
|
}
|
|
344
353
|
if (inputType === 'final') {
|
|
345
|
-
|
|
354
|
+
var _event$relatedTarget2;
|
|
355
|
+
if (((_event$relatedTarget2 = event.relatedTarget) === null || _event$relatedTarget2 === void 0 ? void 0 : _event$relatedTarget2.id) !== initialInputName) handleChangeCalendarBoxState(false);
|
|
346
356
|
if (calendarBoxOpen) {
|
|
347
|
-
|
|
348
|
-
|
|
357
|
+
var _selectedDate$final2, _selectedDate$final3;
|
|
358
|
+
handleChangeActiveDescendant(((_selectedDate$final2 = selectedDate.final) !== null && _selectedDate$final2 !== void 0 ? _selectedDate$final2 : (0, _moment.default)()).format(_helpers2.TOKEN_ISO_FORMAT));
|
|
359
|
+
setCalendarDisplayDate((_selectedDate$final3 = selectedDate.final) !== null && _selectedDate$final3 !== void 0 ? _selectedDate$final3 : (0, _moment.default)());
|
|
349
360
|
}
|
|
350
361
|
if (_lodash.default.size(finalUnmaskedValue) !== 8) {
|
|
351
362
|
const date = (0, _moment.default)(selectedDate.final, _helpers2.TOKEN_ISO_FORMAT);
|
|
@@ -356,21 +367,25 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
356
367
|
}
|
|
357
368
|
};
|
|
358
369
|
const handleOnFocusMaskInput = (event, inputType) => {
|
|
359
|
-
|
|
370
|
+
var _props$onFocus;
|
|
371
|
+
props === null || props === void 0 ? void 0 : (_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props, event);
|
|
360
372
|
if (!isReadOnly && !calendarBoxOpen && openCalendarOnFocus) {
|
|
361
373
|
setCalendarBoxOpen(true);
|
|
362
374
|
}
|
|
363
375
|
if (inputType === 'initial') {
|
|
364
|
-
|
|
365
|
-
|
|
376
|
+
var _selectedDate$inicial4, _selectedDate$inicial5;
|
|
377
|
+
handleChangeActiveDescendant(((_selectedDate$inicial4 = selectedDate.inicial) !== null && _selectedDate$inicial4 !== void 0 ? _selectedDate$inicial4 : (0, _moment.default)()).format(_helpers2.TOKEN_ISO_FORMAT));
|
|
378
|
+
setCalendarDisplayDate((_selectedDate$inicial5 = selectedDate.inicial) !== null && _selectedDate$inicial5 !== void 0 ? _selectedDate$inicial5 : (0, _moment.default)());
|
|
366
379
|
}
|
|
367
380
|
if (inputType === 'final') {
|
|
368
|
-
|
|
369
|
-
|
|
381
|
+
var _selectedDate$final4, _selectedDate$final5;
|
|
382
|
+
handleChangeActiveDescendant(((_selectedDate$final4 = selectedDate.final) !== null && _selectedDate$final4 !== void 0 ? _selectedDate$final4 : (0, _moment.default)()).format(_helpers2.TOKEN_ISO_FORMAT));
|
|
383
|
+
setCalendarDisplayDate((_selectedDate$final5 = selectedDate.final) !== null && _selectedDate$final5 !== void 0 ? _selectedDate$final5 : (0, _moment.default)());
|
|
370
384
|
}
|
|
371
385
|
};
|
|
372
386
|
const handleOnKeyDownMaskInput = (event, inputType) => {
|
|
373
|
-
|
|
387
|
+
var _props$onKeyDown;
|
|
388
|
+
props === null || props === void 0 ? void 0 : (_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
|
374
389
|
if (calendarBoxOpen && event.key && !event.shiftKey && !event.altKey && event.key === _types.Keys.enter) {
|
|
375
390
|
event.preventDefault();
|
|
376
391
|
const rawDate = (0, _moment.default)(_lodash.default.toString(activeDescendant), _helpers2.TOKEN_ISO_FORMAT);
|
|
@@ -384,14 +399,16 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
384
399
|
if (undigitable) {
|
|
385
400
|
event.preventDefault();
|
|
386
401
|
} else {
|
|
387
|
-
|
|
402
|
+
var _props$onPaste;
|
|
403
|
+
(_props$onPaste = props.onPaste) === null || _props$onPaste === void 0 ? void 0 : _props$onPaste.call(props, event);
|
|
388
404
|
}
|
|
389
405
|
};
|
|
390
406
|
const handleOnBeforeInput = event => {
|
|
391
407
|
if (undigitable) {
|
|
392
408
|
event.preventDefault();
|
|
393
409
|
} else {
|
|
394
|
-
|
|
410
|
+
var _props$onBeforeInput;
|
|
411
|
+
(_props$onBeforeInput = props.onBeforeInput) === null || _props$onBeforeInput === void 0 ? void 0 : _props$onBeforeInput.call(props, event);
|
|
395
412
|
}
|
|
396
413
|
};
|
|
397
414
|
const handleOnKeyDown = event => {
|
|
@@ -431,7 +448,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
431
448
|
}
|
|
432
449
|
};
|
|
433
450
|
_react.default.useEffect(() => {
|
|
434
|
-
if (props
|
|
451
|
+
if (props !== null && props !== void 0 && props.value) {
|
|
435
452
|
const objectValue = props.value;
|
|
436
453
|
const initialDate = (0, _moment.default)(_lodash.default.toString(objectValue[initialName]), _helpers2.TOKEN_ISO_FORMAT);
|
|
437
454
|
const finalDate = (0, _moment.default)(_lodash.default.toString(objectValue[finalName]), _helpers2.TOKEN_ISO_FORMAT);
|
|
@@ -442,7 +459,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
442
459
|
setInitialMaskValue(initialDate.format(_helpers2.TOKEN_PTBR_FORMAT));
|
|
443
460
|
setFinalMaskValue(finalDate.format(_helpers2.TOKEN_PTBR_FORMAT));
|
|
444
461
|
}
|
|
445
|
-
}, [props
|
|
462
|
+
}, [props === null || props === void 0 ? void 0 : props.value]);
|
|
446
463
|
const contextValues = _react.default.useMemo(() => ({
|
|
447
464
|
isReadOnly,
|
|
448
465
|
isDisabled,
|
|
@@ -487,11 +504,11 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
487
504
|
"data-testid": "test-date-period-field-label",
|
|
488
505
|
label: label,
|
|
489
506
|
inputId: initialInputName,
|
|
490
|
-
hint: props
|
|
507
|
+
hint: props === null || props === void 0 ? void 0 : props.hint,
|
|
491
508
|
isDisabled: isDisabled,
|
|
492
509
|
isReadOnly: isReadOnly,
|
|
493
510
|
skeletonize: skeletonize,
|
|
494
|
-
required: props
|
|
511
|
+
required: props === null || props === void 0 ? void 0 : props.required,
|
|
495
512
|
hintPosition: hintPosition,
|
|
496
513
|
themePopover: themePopover,
|
|
497
514
|
popoverAlign: popoverAlign,
|
|
@@ -505,7 +522,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
505
522
|
skeletonize: skeletonize,
|
|
506
523
|
customClassInputContainer: customClassInputContainer
|
|
507
524
|
}, /*#__PURE__*/_react.default.createElement(BaseDate.Input, _extends({}, _lodash.default.omit(rest, ['initialRef', 'finalRef']), {
|
|
508
|
-
ref: (0, _helpers.mergeRefs)(initialInputRef, props
|
|
525
|
+
ref: (0, _helpers.mergeRefs)(initialInputRef, props === null || props === void 0 ? void 0 : props.initialRef),
|
|
509
526
|
id: initialInputName,
|
|
510
527
|
name: initialInputName,
|
|
511
528
|
value: initialMaskedValue,
|
|
@@ -542,7 +559,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
542
559
|
name: "arrow_right",
|
|
543
560
|
size: 10
|
|
544
561
|
})), /*#__PURE__*/_react.default.createElement(BaseDate.Input, _extends({}, _lodash.default.omit(rest, ['initialRef', 'finalRef']), {
|
|
545
|
-
ref: (0, _helpers.mergeRefs)(finalInputRef, props
|
|
562
|
+
ref: (0, _helpers.mergeRefs)(finalInputRef, props === null || props === void 0 ? void 0 : props.finalRef),
|
|
546
563
|
id: finalInputName,
|
|
547
564
|
name: finalInputName,
|
|
548
565
|
value: finalMaskedValue,
|
|
@@ -581,8 +598,8 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
581
598
|
className: "error",
|
|
582
599
|
"data-state-skeletonize": skeletonize,
|
|
583
600
|
"aria-describedby": String(label).concat('-errors')
|
|
584
|
-
}, errors
|
|
585
|
-
key:
|
|
601
|
+
}, errors === null || errors === void 0 ? void 0 : errors.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
602
|
+
key: "".concat(index + 1, "-").concat(error)
|
|
586
603
|
}, error, "\xA0")))))), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
|
|
587
604
|
targetRef: inputRootRef,
|
|
588
605
|
text: tooltip,
|
|
@@ -11,8 +11,7 @@ var BaseDate = _interopRequireWildcard(require("../base"));
|
|
|
11
11
|
var _list = _interopRequireWildcard(require("../../../list"));
|
|
12
12
|
var _context = require("./context");
|
|
13
13
|
var _helpers = require("../helpers");
|
|
14
|
-
function
|
|
15
|
-
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; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
16
|
const Triggers = () => {
|
|
18
17
|
const {
|
|
@@ -36,31 +35,36 @@ const Triggers = () => {
|
|
|
36
35
|
} = (0, _context.useDatePeriodFieldContext)();
|
|
37
36
|
const shouldHavePermitClickOnTrigger = !isReadOnly && !isDisabled;
|
|
38
37
|
const handleOnClickTriggerSelectPredefinedPeriods = (event, periodSelected) => {
|
|
39
|
-
|
|
38
|
+
var _event$preventDefault;
|
|
39
|
+
if (!shouldHavePermitClickOnTrigger) event === null || event === void 0 ? void 0 : (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.call(event);else {
|
|
40
40
|
if (periodSelected) handleChangeUpdateDateStateWithPredefinedPeriod(periodSelected);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
const handleOnClickTriggerCalendar = event => {
|
|
44
|
+
var _initialInputRef$curr, _finalInputRef$curren, _initialInputRef$curr3;
|
|
44
45
|
if (!shouldHavePermitClickOnTrigger) event.preventDefault();else {
|
|
45
46
|
handleChangeCalendarBoxState(!calendarBoxOpen);
|
|
46
47
|
if (!calendarBoxOpen) {
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
var _document$activeEleme;
|
|
49
|
+
switch ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) {
|
|
50
|
+
case (_initialInputRef$curr = initialInputRef.current) === null || _initialInputRef$curr === void 0 ? void 0 : _initialInputRef$curr.id:
|
|
49
51
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
var _selectedDate$inicial, _selectedDate$inicial2, _initialInputRef$curr2;
|
|
53
|
+
handleChangeActiveDescendant(((_selectedDate$inicial = selectedDate.inicial) !== null && _selectedDate$inicial !== void 0 ? _selectedDate$inicial : (0, _moment.default)()).format(_helpers.TOKEN_ISO_FORMAT));
|
|
54
|
+
handleChangeCalendarDisplayDate((_selectedDate$inicial2 = selectedDate.inicial) !== null && _selectedDate$inicial2 !== void 0 ? _selectedDate$inicial2 : (0, _moment.default)());
|
|
55
|
+
(_initialInputRef$curr2 = initialInputRef.current) === null || _initialInputRef$curr2 === void 0 ? void 0 : _initialInputRef$curr2.focus();
|
|
53
56
|
break;
|
|
54
57
|
}
|
|
55
|
-
case finalInputRef.current
|
|
58
|
+
case (_finalInputRef$curren = finalInputRef.current) === null || _finalInputRef$curren === void 0 ? void 0 : _finalInputRef$curren.id:
|
|
56
59
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
var _selectedDate$final, _selectedDate$final2, _finalInputRef$curren2;
|
|
61
|
+
handleChangeActiveDescendant(((_selectedDate$final = selectedDate.final) !== null && _selectedDate$final !== void 0 ? _selectedDate$final : (0, _moment.default)()).format(_helpers.TOKEN_ISO_FORMAT));
|
|
62
|
+
handleChangeCalendarDisplayDate((_selectedDate$final2 = selectedDate.final) !== null && _selectedDate$final2 !== void 0 ? _selectedDate$final2 : (0, _moment.default)());
|
|
63
|
+
(_finalInputRef$curren2 = finalInputRef.current) === null || _finalInputRef$curren2 === void 0 ? void 0 : _finalInputRef$curren2.focus();
|
|
60
64
|
break;
|
|
61
65
|
}
|
|
62
66
|
default:
|
|
63
|
-
initialInputRef.current
|
|
67
|
+
(_initialInputRef$curr3 = initialInputRef.current) === null || _initialInputRef$curr3 === void 0 ? void 0 : _initialInputRef$curr3.focus();
|
|
64
68
|
break;
|
|
65
69
|
}
|
|
66
70
|
}
|
|
@@ -109,7 +113,8 @@ const Triggers = () => {
|
|
|
109
113
|
itemId: period.id,
|
|
110
114
|
text: period.label,
|
|
111
115
|
onMouseDown: event => {
|
|
112
|
-
|
|
116
|
+
var _event$preventDefault2;
|
|
117
|
+
event === null || event === void 0 ? void 0 : (_event$preventDefault2 = event.preventDefault) === null || _event$preventDefault2 === void 0 ? void 0 : _event$preventDefault2.call(event);
|
|
113
118
|
},
|
|
114
119
|
onClick: event => {
|
|
115
120
|
handleOnClickTriggerSelectPredefinedPeriods(event, period.id);
|
|
@@ -10,31 +10,32 @@ var _lodash = _interopRequireDefault(require("lodash"));
|
|
|
10
10
|
var _buttons = _interopRequireDefault(require("../../buttons"));
|
|
11
11
|
var TextField = _interopRequireWildcard(require("../textfield"));
|
|
12
12
|
var _list = _interopRequireWildcard(require("../../list"));
|
|
13
|
-
function
|
|
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; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
15
|
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); }
|
|
17
16
|
function _objectDestructuringEmpty(t) { if (null == t) throw new TypeError("Cannot destructure " + t); }
|
|
18
17
|
const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
18
|
+
var _props$value;
|
|
19
19
|
const rest = Object.assign({}, (_objectDestructuringEmpty(props), props));
|
|
20
20
|
const inputFileRef = _react.default.useRef(null);
|
|
21
21
|
const [internalFiles, setInternalFiles] = _react.default.useState([]);
|
|
22
|
-
const files = props
|
|
23
|
-
const inputLabel = _lodash.default.isArray(files) && files.length > 0 ?
|
|
22
|
+
const files = (_props$value = props === null || props === void 0 ? void 0 : props.value) !== null && _props$value !== void 0 ? _props$value : internalFiles;
|
|
23
|
+
const inputLabel = _lodash.default.isArray(files) && files.length > 0 ? "".concat(files.length, " arquivo(s) selecionado(s)") : 'Nenhum arquivo selecionado';
|
|
24
24
|
const handleSelect = event => {
|
|
25
|
+
var _props$onChange;
|
|
25
26
|
const fileList = event.target.files;
|
|
26
27
|
if (!fileList) return;
|
|
27
28
|
let selectedFiles = Array.from(fileList);
|
|
28
|
-
if (props
|
|
29
|
+
if (props !== null && props !== void 0 && props.maxSize) {
|
|
29
30
|
selectedFiles = selectedFiles.filter(file => file.size <= _lodash.default.toNumber(props.maxSize));
|
|
30
31
|
}
|
|
31
|
-
if (!props
|
|
32
|
+
if (!(props !== null && props !== void 0 && props.multiple) && selectedFiles.length > 1) {
|
|
32
33
|
selectedFiles = [selectedFiles[0]];
|
|
33
34
|
}
|
|
34
|
-
if (_lodash.default.isNil(props
|
|
35
|
+
if (_lodash.default.isNil(props === null || props === void 0 ? void 0 : props.value)) {
|
|
35
36
|
setInternalFiles(selectedFiles);
|
|
36
37
|
}
|
|
37
|
-
props.onChange
|
|
38
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
|
38
39
|
target: {
|
|
39
40
|
name: props.name,
|
|
40
41
|
value: selectedFiles
|
|
@@ -43,10 +44,11 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
43
44
|
inputFileRef.current.value = '';
|
|
44
45
|
};
|
|
45
46
|
const handleClear = () => {
|
|
46
|
-
|
|
47
|
+
var _props$onChange2;
|
|
48
|
+
if (_lodash.default.isNil(props === null || props === void 0 ? void 0 : props.value)) {
|
|
47
49
|
setInternalFiles([]);
|
|
48
50
|
}
|
|
49
|
-
props.onChange
|
|
51
|
+
(_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 ? void 0 : _props$onChange2.call(props, {
|
|
50
52
|
target: {
|
|
51
53
|
name: props.name,
|
|
52
54
|
value: ''
|
|
@@ -55,13 +57,15 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
55
57
|
inputFileRef.current.value = '';
|
|
56
58
|
};
|
|
57
59
|
const openDialog = () => {
|
|
58
|
-
|
|
60
|
+
var _inputFileRef$current;
|
|
61
|
+
(_inputFileRef$current = inputFileRef.current) === null || _inputFileRef$current === void 0 ? void 0 : _inputFileRef$current.click();
|
|
59
62
|
};
|
|
60
63
|
const handleLockOnPaste = _react.default.useCallback(event => {
|
|
61
64
|
event.preventDefault();
|
|
62
65
|
}, []);
|
|
63
66
|
const handleLockOnBeforeInput = _react.default.useCallback(event => {
|
|
64
|
-
|
|
67
|
+
var _props$onBeforeInput;
|
|
68
|
+
(_props$onBeforeInput = props.onBeforeInput) === null || _props$onBeforeInput === void 0 ? void 0 : _props$onBeforeInput.call(props, event);
|
|
65
69
|
}, []);
|
|
66
70
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TextField.Input, _extends({}, rest, {
|
|
67
71
|
ref: ref,
|
|
@@ -75,9 +79,9 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
75
79
|
}), /*#__PURE__*/_react.default.createElement(TextField.LeftSlot, null, /*#__PURE__*/_react.default.createElement("input", {
|
|
76
80
|
ref: inputFileRef,
|
|
77
81
|
type: "file",
|
|
78
|
-
name: props
|
|
79
|
-
accept: props
|
|
80
|
-
multiple: props
|
|
82
|
+
name: props === null || props === void 0 ? void 0 : props.name,
|
|
83
|
+
accept: props === null || props === void 0 ? void 0 : props.accept,
|
|
84
|
+
multiple: props === null || props === void 0 ? void 0 : props.multiple,
|
|
81
85
|
onChange: handleSelect,
|
|
82
86
|
style: {
|
|
83
87
|
all: 'unset',
|
|
@@ -95,10 +99,10 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
95
99
|
type: "button",
|
|
96
100
|
title: "Arquivos Selecionados",
|
|
97
101
|
tabIndex: -1,
|
|
98
|
-
disabled: props
|
|
102
|
+
disabled: props === null || props === void 0 ? void 0 : props.disabled,
|
|
99
103
|
"aria-label": "Arquivos Selecionados",
|
|
100
|
-
"aria-readonly": props
|
|
101
|
-
"data-state-read-only": props
|
|
104
|
+
"aria-readonly": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
105
|
+
"data-state-read-only": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
102
106
|
iconName: "information",
|
|
103
107
|
dropdownAlign: "right",
|
|
104
108
|
onMouseDown: event => {
|
|
@@ -111,18 +115,20 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
111
115
|
itemId: "nenhum-selecionado",
|
|
112
116
|
text: "Nenhum arquivo selecionado",
|
|
113
117
|
onMouseDown: event => {
|
|
114
|
-
|
|
118
|
+
var _event$preventDefault;
|
|
119
|
+
event === null || event === void 0 ? void 0 : (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.call(event);
|
|
115
120
|
}
|
|
116
121
|
})), _lodash.default.isArray(files) && _lodash.default.size(files) > 0 && /*#__PURE__*/_react.default.createElement(_list.default, {
|
|
117
122
|
condensed: true
|
|
118
123
|
}, files.map((file, index) => {
|
|
119
|
-
const id =
|
|
124
|
+
const id = "".concat(file.name, "-").concat(index + 1);
|
|
120
125
|
return /*#__PURE__*/_react.default.createElement(_list.ListItem, {
|
|
121
126
|
key: id,
|
|
122
127
|
itemId: id,
|
|
123
128
|
text: file.name,
|
|
124
129
|
onMouseDown: event => {
|
|
125
|
-
|
|
130
|
+
var _event$preventDefault2;
|
|
131
|
+
event === null || event === void 0 ? void 0 : (_event$preventDefault2 = event.preventDefault) === null || _event$preventDefault2 === void 0 ? void 0 : _event$preventDefault2.call(event);
|
|
126
132
|
}
|
|
127
133
|
});
|
|
128
134
|
}))), /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
@@ -135,10 +141,10 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
135
141
|
type: "button",
|
|
136
142
|
title: "Limpar",
|
|
137
143
|
tabIndex: -1,
|
|
138
|
-
disabled: props
|
|
144
|
+
disabled: props === null || props === void 0 ? void 0 : props.disabled,
|
|
139
145
|
"aria-label": "Limpar",
|
|
140
|
-
"aria-readonly": props
|
|
141
|
-
"data-state-read-only": props
|
|
146
|
+
"aria-readonly": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
147
|
+
"data-state-read-only": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
142
148
|
iconName: "close",
|
|
143
149
|
onClick: handleClear,
|
|
144
150
|
onMouseDown: event => {
|
|
@@ -154,10 +160,10 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
154
160
|
title: "Selecionar",
|
|
155
161
|
label: "Selecionar",
|
|
156
162
|
tabIndex: -1,
|
|
157
|
-
disabled: props
|
|
163
|
+
disabled: props === null || props === void 0 ? void 0 : props.disabled,
|
|
158
164
|
"aria-label": "Selecionar",
|
|
159
|
-
"aria-readonly": props
|
|
160
|
-
"data-state-read-only": props
|
|
165
|
+
"aria-readonly": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
166
|
+
"data-state-read-only": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
161
167
|
iconName: "upload4",
|
|
162
168
|
onClick: openDialog,
|
|
163
169
|
onMouseDown: event => {
|