linear-react-components-ui 2.1.0-beta.5 → 2.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assets/styles/datepicker2.css +11 -81
- package/lib/form2/useForm/index.js +1 -0
- package/lib/form2/useForm/index.js.map +1 -1
- package/lib/inputs2/date/{hooks/useCalendarPosition.d.ts → base/constants.d.ts} +1 -1
- package/lib/inputs2/date/base/constants.js +69 -0
- package/lib/inputs2/date/base/constants.js.map +1 -0
- package/lib/inputs2/date/datefield/base.js +214 -691
- package/lib/inputs2/date/datefield/base.js.map +1 -1
- package/lib/inputs2/date/datefield/calendarbox.d.ts +6 -0
- package/lib/inputs2/date/datefield/calendarbox.js +228 -0
- package/lib/inputs2/date/datefield/calendarbox.js.map +1 -0
- package/lib/inputs2/date/datefield/triggers.js +4 -4
- package/lib/inputs2/date/datefield/triggers.js.map +1 -1
- package/lib/inputs2/date/datefield/types.d.ts +12 -5
- package/lib/inputs2/date/dateperiodfield/base.js +809 -694
- package/lib/inputs2/date/dateperiodfield/base.js.map +1 -1
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +6 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.js +282 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.js.map +1 -0
- package/lib/inputs2/date/dateperiodfield/triggers.js +9 -21
- package/lib/inputs2/date/dateperiodfield/triggers.js.map +1 -1
- package/lib/inputs2/date/dateperiodfield/types.d.ts +23 -13
- package/lib/inputs2/date/helpers.d.ts +4 -44
- package/lib/inputs2/date/helpers.js +4 -200
- package/lib/inputs2/date/helpers.js.map +1 -1
- package/lib/inputs2/date/types.d.ts +1 -22
- package/lib/inputs2/date/types.js.map +1 -1
- package/lib/node_modules/lodash/lodash.js +2 -2
- package/lib/node_modules/lodash/lodash.js.map +1 -1
- package/package.json +1 -1
- package/lib/inputs2/date/calendarbox.d.ts +0 -23
- package/lib/inputs2/date/calendarbox.js +0 -254
- package/lib/inputs2/date/calendarbox.js.map +0 -1
- package/lib/inputs2/date/hooks/useCalendarPosition.js +0 -93
- package/lib/inputs2/date/hooks/useCalendarPosition.js.map +0 -1
- package/lib/inputs2/date/hooks/useDateCalendarState.d.ts +0 -14
- package/lib/inputs2/date/hooks/useDateCalendarState.js +0 -250
- package/lib/inputs2/date/hooks/useDateCalendarState.js.map +0 -1
- package/lib/inputs2/date/hooks/useDateMask.d.ts +0 -22
- package/lib/inputs2/date/hooks/useDateMask.js +0 -143
- package/lib/inputs2/date/hooks/useDateMask.js.map +0 -1
- package/lib/inputs2/date/timeselector.d.ts +0 -17
- package/lib/inputs2/date/timeselector.js +0 -226
- package/lib/inputs2/date/timeselector.js.map +0 -1
- package/lib/node_modules/moment/dist/locale/pt-br.js +0 -54
- package/lib/node_modules/moment/dist/locale/pt-br.js.map +0 -1
|
@@ -6,7 +6,7 @@ import '../../../assets/styles/button.css';/* empty css
|
|
|
6
6
|
import { Triggers as Triggers$1 } from "../base/index.js";
|
|
7
7
|
import List from "../../../list/index.js";
|
|
8
8
|
import { useDatePeriodFieldContext } from "./context.js";
|
|
9
|
-
import { PERIOD_OPTIONS_LIST, TOKEN_ISO_FORMAT
|
|
9
|
+
import { PERIOD_OPTIONS_LIST, TOKEN_ISO_FORMAT } from "../helpers.js";
|
|
10
10
|
import Item from "../../../list/Item.js";
|
|
11
11
|
const Triggers = () => {
|
|
12
12
|
const {
|
|
@@ -22,35 +22,23 @@ const Triggers = () => {
|
|
|
22
22
|
showPredefinedPeriodsButton,
|
|
23
23
|
showClearDateButton,
|
|
24
24
|
hasValidPeriodSelected,
|
|
25
|
-
|
|
26
|
-
minDate,
|
|
27
|
-
maxDate,
|
|
25
|
+
handleChangeCalendarBoxState,
|
|
28
26
|
handleChangeActiveDescendant,
|
|
29
27
|
handleChangeCalendarDisplayDate,
|
|
30
28
|
handleOnClickClearSelectedPeriod,
|
|
31
29
|
handleChangeUpdateDateStateWithPredefinedPeriod
|
|
32
30
|
} = useDatePeriodFieldContext();
|
|
33
31
|
const shouldHavePermitClickOnTrigger = !isReadOnly && !isDisabled;
|
|
34
|
-
const isPeriodOutOfBounds = (period) => {
|
|
35
|
-
const {
|
|
36
|
-
initialDate,
|
|
37
|
-
finalDate
|
|
38
|
-
} = getPredefinedPeriodRange(period);
|
|
39
|
-
if (minDate && finalDate.isBefore(minDate)) return true;
|
|
40
|
-
return Boolean(maxDate && initialDate.isAfter(maxDate));
|
|
41
|
-
};
|
|
42
32
|
const handleOnClickTriggerSelectPredefinedPeriods = (event, periodSelected) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} else if (periodSelected) {
|
|
47
|
-
handleChangeUpdateDateStateWithPredefinedPeriod(periodSelected);
|
|
33
|
+
if (!shouldHavePermitClickOnTrigger) event?.preventDefault?.();
|
|
34
|
+
else {
|
|
35
|
+
if (periodSelected) handleChangeUpdateDateStateWithPredefinedPeriod(periodSelected);
|
|
48
36
|
}
|
|
49
37
|
};
|
|
50
38
|
const handleOnClickTriggerCalendar = (event_0) => {
|
|
51
39
|
if (!shouldHavePermitClickOnTrigger) event_0.preventDefault();
|
|
52
40
|
else {
|
|
53
|
-
|
|
41
|
+
handleChangeCalendarBoxState(!calendarBoxOpen);
|
|
54
42
|
if (!calendarBoxOpen) {
|
|
55
43
|
switch (document.activeElement?.id) {
|
|
56
44
|
case initialInputRef.current?.id: {
|
|
@@ -74,11 +62,11 @@ const Triggers = () => {
|
|
|
74
62
|
};
|
|
75
63
|
return /* @__PURE__ */ jsx(Triggers$1, { clearButtonTestId: "test-date-period-field-trigger-clean-selected-period", calendarButtonTestId: "test-date-period-field-trigger-open-calendar", isDisabled, isReadOnly, skeletonize, inputFieldId: initialInputId, calendarBoxOpen, showClearButton: showClearDateButton, showCalendarButton, hasValidDateSelection: false, hasValidPeriodSelected, onClearSelectedDate: handleOnClickClearSelectedPeriod, onClickTriggerCalendar: handleOnClickTriggerCalendar, children: /* @__PURE__ */ jsx(Button, { "data-testid": "test-date-period-field-trigger-select-predefined-periods", className: "select-predefined-periods", dropdown: true, transparent: true, boxShadow: false, showIconDropdown: false, visible: showPredefinedPeriodsButton, type: "button", title: "Selecionar Periodos Pré Definidos", tabIndex: -1, disabled: isDisabled, "aria-label": "Selecionar Periodos Pré Definidos", "aria-controls": initialInputId, "aria-readonly": isReadOnly, "data-state-read-only": isReadOnly, "data-state-visible": showPredefinedPeriodsButton, iconName: "more1", dropdownAlign: "right", onMouseDown: (event_1) => {
|
|
76
64
|
event_1.preventDefault();
|
|
77
|
-
}, children: /* @__PURE__ */ jsx(List, { condensed: true, children: PERIOD_OPTIONS_LIST.map((
|
|
65
|
+
}, children: /* @__PURE__ */ jsx(List, { condensed: true, children: PERIOD_OPTIONS_LIST.map((period) => /* @__PURE__ */ jsx(Item, { itemId: period.id, text: period.label, onMouseDown: (event_2) => {
|
|
78
66
|
event_2?.preventDefault?.();
|
|
79
67
|
}, onClick: (event_3) => {
|
|
80
|
-
handleOnClickTriggerSelectPredefinedPeriods(event_3,
|
|
81
|
-
} },
|
|
68
|
+
handleOnClickTriggerSelectPredefinedPeriods(event_3, period.id);
|
|
69
|
+
} }, period.id)) }) }) });
|
|
82
70
|
};
|
|
83
71
|
Triggers.displayName = "DatePeriodFieldTriggers";
|
|
84
72
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triggers.js","sources":["../../../../src/lib/inputs2/date/dateperiodfield/triggers.tsx"],"sourcesContent":["import moment from 'moment';\nimport { MouseEvent } from 'react';\nimport Button from '../../../buttons';\nimport * as BaseDate from '../base';\nimport List, { ListItem } from '../../../list';\nimport type { DatePeriodTypes } from './types';\nimport { useDatePeriodFieldContext } from './context';\nimport {
|
|
1
|
+
{"version":3,"file":"triggers.js","sources":["../../../../src/lib/inputs2/date/dateperiodfield/triggers.tsx"],"sourcesContent":["import moment from 'moment';\nimport { MouseEvent } from 'react';\nimport Button from '../../../buttons';\nimport * as BaseDate from '../base';\nimport List, { ListItem } from '../../../list';\nimport type { DatePeriodTypes } from './types';\nimport { useDatePeriodFieldContext } from './context';\nimport { PERIOD_OPTIONS_LIST, TOKEN_ISO_FORMAT } from '../helpers';\n\nconst Triggers = () => {\n const {\n initialInputId, initialInputRef, finalInputRef, isReadOnly, isDisabled, selectedDate, \n calendarBoxOpen, showCalendarButton, skeletonize, showPredefinedPeriodsButton,\n showClearDateButton, hasValidPeriodSelected, handleChangeCalendarBoxState,\n handleChangeActiveDescendant, handleChangeCalendarDisplayDate, handleOnClickClearSelectedPeriod,\n handleChangeUpdateDateStateWithPredefinedPeriod,\n } = useDatePeriodFieldContext();\n const shouldHavePermitClickOnTrigger = !isReadOnly && !isDisabled;\n\n const handleOnClickTriggerSelectPredefinedPeriods = (\n event: any, periodSelected?: DatePeriodTypes,\n ) => {\n if (!shouldHavePermitClickOnTrigger) event?.preventDefault?.();\n else {\n if (periodSelected) handleChangeUpdateDateStateWithPredefinedPeriod(periodSelected);\n }\n };\n\n const handleOnClickTriggerCalendar = (event: MouseEvent<HTMLButtonElement>) => {\n if (!shouldHavePermitClickOnTrigger) event.preventDefault();\n else {\n handleChangeCalendarBoxState(!calendarBoxOpen);\n if (!calendarBoxOpen) {\n switch (document.activeElement?.id) {\n case initialInputRef.current?.id: {\n handleChangeActiveDescendant(\n (selectedDate.inicial ?? moment()).format(TOKEN_ISO_FORMAT),\n );\n handleChangeCalendarDisplayDate(selectedDate.inicial ?? moment());\n initialInputRef.current?.focus();\n break;\n }\n case finalInputRef.current?.id: {\n handleChangeActiveDescendant((selectedDate.final ?? moment()).format(TOKEN_ISO_FORMAT));\n handleChangeCalendarDisplayDate(selectedDate.final ?? moment());\n finalInputRef.current?.focus();\n break;\n }\n default: initialInputRef.current?.focus();\n break;\n }\n }\n }\n };\n\n return (\n <BaseDate.Triggers\n clearButtonTestId=\"test-date-period-field-trigger-clean-selected-period\"\n calendarButtonTestId=\"test-date-period-field-trigger-open-calendar\"\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n skeletonize={skeletonize}\n inputFieldId={initialInputId}\n calendarBoxOpen={calendarBoxOpen}\n showClearButton={showClearDateButton}\n showCalendarButton={showCalendarButton}\n hasValidDateSelection={false}\n hasValidPeriodSelected={hasValidPeriodSelected}\n onClearSelectedDate={handleOnClickClearSelectedPeriod}\n onClickTriggerCalendar={handleOnClickTriggerCalendar}>\n <Button\n data-testid=\"test-date-period-field-trigger-select-predefined-periods\"\n className=\"select-predefined-periods\"\n dropdown\n transparent\n boxShadow={false}\n showIconDropdown={false}\n visible={showPredefinedPeriodsButton}\n type=\"button\"\n title=\"Selecionar Periodos Pré Definidos\"\n tabIndex={-1}\n disabled={isDisabled}\n aria-label=\"Selecionar Periodos Pré Definidos\"\n aria-controls={initialInputId}\n aria-readonly={isReadOnly}\n data-state-read-only={isReadOnly}\n data-state-visible={showPredefinedPeriodsButton}\n iconName=\"more1\"\n dropdownAlign=\"right\"\n onMouseDown={(event) => { event.preventDefault(); }}>\n <List condensed>\n {PERIOD_OPTIONS_LIST.map(period => (\n <ListItem\n key={period.id}\n itemId={period.id}\n text={period.label}\n onMouseDown={(event) => { event?.preventDefault?.(); }}\n onClick={(event) => {\n handleOnClickTriggerSelectPredefinedPeriods(event, period.id); \n }} />\n ))}\n </List>\n </Button>\n </BaseDate.Triggers>\n );\n};\n\nTriggers.displayName = 'DatePeriodFieldTriggers';\n\nexport { Triggers };\n"],"names":["Triggers","initialInputId","initialInputRef","finalInputRef","isReadOnly","isDisabled","selectedDate","calendarBoxOpen","showCalendarButton","skeletonize","showPredefinedPeriodsButton","showClearDateButton","hasValidPeriodSelected","handleChangeCalendarBoxState","handleChangeActiveDescendant","handleChangeCalendarDisplayDate","handleOnClickClearSelectedPeriod","handleChangeUpdateDateStateWithPredefinedPeriod","useDatePeriodFieldContext","shouldHavePermitClickOnTrigger","handleOnClickTriggerSelectPredefinedPeriods","event","periodSelected","preventDefault","handleOnClickTriggerCalendar","document","activeElement","id","current","inicial","moment","format","TOKEN_ISO_FORMAT","focus","final","BaseDate.Triggers","PERIOD_OPTIONS_LIST","map","period","ListItem","label","displayName"],"mappings":";;;;;;;;;;AASA,MAAMA,WAAWA,MAAM;AACrB,QAAM;AAAA,IACJC;AAAAA,IAAgBC;AAAAA,IAAiBC;AAAAA,IAAeC;AAAAA,IAAYC;AAAAA,IAAYC;AAAAA,IACxEC;AAAAA,IAAiBC;AAAAA,IAAoBC;AAAAA,IAAaC;AAAAA,IAClDC;AAAAA,IAAqBC;AAAAA,IAAwBC;AAAAA,IAC7CC;AAAAA,IAA8BC;AAAAA,IAAiCC;AAAAA,IAC/DC;AAAAA,EAAAA,IACEC,0BAAAA;AACJ,QAAMC,iCAAiC,CAACf,cAAc,CAACC;AAEvD,QAAMe,8CAA8CA,CAClDC,OAAYC,mBACT;AACH,QAAI,CAACH,+BAAgCE,QAAOE,iBAAAA;AAAAA,SACvC;AACH,UAAID,gEAAgEA,cAAc;AAAA,IACpF;AAAA,EACF;AAEA,QAAME,+BAA+BA,CAACH,YAAyC;AAC7E,QAAI,CAACF,+BAAgCE,SAAME,eAAAA;AAAAA,SACtC;AACHV,mCAA6B,CAACN,eAAe;AAC7C,UAAI,CAACA,iBAAiB;AACpB,gBAAQkB,SAASC,eAAeC,IAAAA;AAAAA,UAC9B,KAAKzB,gBAAgB0B,SAASD,IAAI;AAChCb,0CACGR,aAAauB,WAAWC,MAAAA,GAAUC,OAAOC,gBAAgB,CAC5D;AACAjB,4CAAgCT,aAAauB,WAAWC,OAAQ;AAChE5B,4BAAgB0B,SAASK,MAAAA;AACzB;AAAA,UACF;AAAA,UACA,KAAK9B,cAAcyB,SAASD,IAAI;AAC9Bb,0CAA8BR,aAAa4B,SAASJ,MAAAA,GAAUC,OAAOC,gBAAgB,CAAC;AACtFjB,4CAAgCT,aAAa4B,SAASJ,OAAQ;AAC9D3B,0BAAcyB,SAASK,MAAAA;AACvB;AAAA,UACF;AAAA,UACA;AAAS/B,4BAAgB0B,SAASK,MAAAA;AAChC;AAAA,QAAA;AAAA,MAEN;AAAA,IACF;AAAA,EACF;AAEA,SACE,oBAACE,YAAA,EACC,mBAAkB,wDAClB,sBAAqB,gDACrB,YACA,YACA,aACA,cAAclC,gBACd,iBACA,iBAAiBU,qBACjB,oBACA,uBAAuB,OACvB,wBACA,qBAAqBK,kCACrB,wBAAwBQ,8BACxB,UAAA,oBAAC,QAAA,EACC,eAAY,4DACZ,WAAU,6BACV,UAAQ,MACR,aAAW,MACX,WAAW,OACX,kBAAkB,OAClB,SAASd,6BACT,MAAK,UACL,OAAM,qCACN,UAAU,IACV,UAAUL,YACV,cAAW,qCACX,iBAAeJ,gBACf,iBAAeG,YACf,wBAAsBA,YACtB,sBAAoBM,6BACpB,UAAS,SACT,eAAc,SACd,aAAcW,CAAAA,YAAU;AAAEA,YAAME,eAAAA;AAAAA,EAAkB,GAClD,UAAA,oBAAC,MAAA,EAAK,WAAS,MACZa,8BAAoBC,IAAIC,CAAAA,WACvB,oBAACC,MAAA,EAEC,QAAQD,OAAOX,IACf,MAAMW,OAAOE,OACb,aAAcnB,CAAAA,YAAU;AAAEA,aAAOE,iBAAAA;AAAAA,EAAoB,GACrD,SAAUF,CAAAA,YAAU;AAClBD,gDAA4CC,SAAOiB,OAAOX,EAAE;AAAA,EAC9D,KANKW,OAAOX,GAOf,EAAA,CACH,GACF,GACF;AAEJ;AAEA3B,SAASyC,cAAc;"}
|
|
@@ -5,7 +5,7 @@ import { ColorTheme } from '../../../@types/ColorStyles';
|
|
|
5
5
|
import { ITooltipCommonProps } from '../../../tooltip/types';
|
|
6
6
|
import { Position, HintPosition } from '../../../@types/Position';
|
|
7
7
|
import { OnDenied, PermissionAttr } from '../../../@types/PermissionAttr';
|
|
8
|
-
import { DateValueReturnType
|
|
8
|
+
import { DateValueReturnType } from '../types';
|
|
9
9
|
export type DatePeriodTypes = 'today' | 'week' | 'lastweek' | 'last15' | 'month' | 'lastmonth';
|
|
10
10
|
export type PeriodOptions = {
|
|
11
11
|
id: DatePeriodTypes;
|
|
@@ -21,12 +21,6 @@ export type UpdateDateStateParams = {
|
|
|
21
21
|
inputType: InputType;
|
|
22
22
|
typing?: boolean;
|
|
23
23
|
};
|
|
24
|
-
export type UpdateDraftStateParams = {
|
|
25
|
-
date: Moment;
|
|
26
|
-
inputType: InputType;
|
|
27
|
-
hour: number | null;
|
|
28
|
-
minute: number | null;
|
|
29
|
-
};
|
|
30
24
|
type InputHTMLProps = Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'multiple' | 'value'>;
|
|
31
25
|
export interface DatePeriodFieldBaseProps extends InputHTMLProps, ITooltipCommonProps {
|
|
32
26
|
value?: any;
|
|
@@ -53,9 +47,6 @@ export interface DatePeriodFieldBaseProps extends InputHTMLProps, ITooltipCommon
|
|
|
53
47
|
showClearDateButton?: boolean;
|
|
54
48
|
showPredefinedPeriodsButton?: boolean;
|
|
55
49
|
returnValueType?: DateValueReturnType;
|
|
56
|
-
variant?: DateVariant;
|
|
57
|
-
min?: string;
|
|
58
|
-
max?: string;
|
|
59
50
|
textAlign?: TextAlign;
|
|
60
51
|
hintPosition?: HintPosition;
|
|
61
52
|
themePopover?: ColorTheme;
|
|
@@ -66,13 +57,15 @@ export interface DatePeriodFieldProps extends DatePeriodFieldBaseProps {
|
|
|
66
57
|
permissionAttr?: PermissionAttr;
|
|
67
58
|
onDeniedActions?: OnDenied;
|
|
68
59
|
}
|
|
69
|
-
export interface DatePeriodContextProps
|
|
60
|
+
export interface DatePeriodContextProps {
|
|
70
61
|
initialInputId: string;
|
|
71
62
|
finalInputId: string;
|
|
63
|
+
activeDescendant: string;
|
|
72
64
|
isReadOnly: boolean;
|
|
73
65
|
isDisabled: boolean;
|
|
74
66
|
undigitable: boolean;
|
|
75
67
|
skeletonize: boolean;
|
|
68
|
+
calendarBoxOpen: boolean;
|
|
76
69
|
showCalendarButton: boolean;
|
|
77
70
|
openCalendarOnFocus: boolean;
|
|
78
71
|
hasValidationErrors: boolean;
|
|
@@ -80,12 +73,29 @@ export interface DatePeriodContextProps extends DateSharedContextProps {
|
|
|
80
73
|
hasValidPeriodSelected: boolean;
|
|
81
74
|
showPredefinedPeriodsButton: boolean;
|
|
82
75
|
selectedDate: SelectedDateType;
|
|
83
|
-
|
|
84
|
-
maxDate?: Moment;
|
|
76
|
+
calendarDisplayDate: Moment;
|
|
85
77
|
initialInputRef: RefObject<HTMLInputElement | null>;
|
|
86
78
|
finalInputRef: RefObject<HTMLInputElement | null>;
|
|
79
|
+
dateContainerRef: RefObject<HTMLDivElement | null>;
|
|
87
80
|
handleChangeUpdateDateState: (params: UpdateDateStateParams) => void;
|
|
81
|
+
handleChangeNextMonth: () => void;
|
|
82
|
+
handleChangePreviousMonth: () => void;
|
|
83
|
+
handleChangeCalendarBoxState: (value: boolean) => void;
|
|
84
|
+
handleChangeActiveDescendant: (value: string) => void;
|
|
85
|
+
handleChangeCalendarDisplayDate: (value: Moment) => void;
|
|
88
86
|
handleOnClickClearSelectedPeriod: () => void;
|
|
89
87
|
handleChangeUpdateDateStateWithPredefinedPeriod: (period: DatePeriodTypes) => void;
|
|
90
88
|
}
|
|
89
|
+
export declare enum Keys {
|
|
90
|
+
arrowLeft = "ArrowLeft",
|
|
91
|
+
arrowRight = "ArrowRight",
|
|
92
|
+
arrowUp = "ArrowUp",
|
|
93
|
+
arrowDown = "ArrowDown",
|
|
94
|
+
pageUp = "PageUp",
|
|
95
|
+
pageDown = "PageDown",
|
|
96
|
+
home = "Home",
|
|
97
|
+
end = "End",
|
|
98
|
+
escape = "Escape",
|
|
99
|
+
enter = "Enter"
|
|
100
|
+
}
|
|
91
101
|
export {};
|
|
@@ -1,50 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { default as moment, Moment } from 'moment';
|
|
1
|
+
import { Moment } from 'moment';
|
|
3
2
|
import { PeriodOptions } from './dateperiodfield/types';
|
|
4
|
-
|
|
3
|
+
export declare const TOKEN_MASK = "00/00/0000";
|
|
5
4
|
export declare const TOKEN_ISO_FORMAT = "YYYY-MM-DD";
|
|
6
5
|
export declare const TOKEN_PTBR_FORMAT = "DD/MM/YYYY";
|
|
7
|
-
export declare const TOKEN_ISO_DATETIME_FORMAT = "YYYY-MM-DDTHH:mm";
|
|
8
|
-
export declare const TOKEN_PTBR_DATETIME_FORMAT = "DD/MM/YYYY HH:mm";
|
|
9
|
-
export declare const ACCEPTED_BOUNDARY_FORMATS: string[];
|
|
10
|
-
export declare const ACCEPTED_VALUE_FORMATS: (string | moment.MomentBuiltinFormat)[];
|
|
11
|
-
export declare const getDateFormats: (variant: DateVariant) => {
|
|
12
|
-
isoFormat: string;
|
|
13
|
-
ptbrFormat: string;
|
|
14
|
-
digits: number;
|
|
15
|
-
};
|
|
16
|
-
export declare const parseDateValue: (value: unknown, variant: DateVariant) => Moment;
|
|
17
|
-
export interface MaskSegment {
|
|
18
|
-
start: number;
|
|
19
|
-
end: number;
|
|
20
|
-
key: string;
|
|
21
|
-
}
|
|
22
|
-
export declare const getMaskSegments: ((format: string) => MaskSegment[]) & _.MemoizedFunction;
|
|
23
|
-
export declare const canSegmentAcceptDigits: (digits: string, key: string) => boolean;
|
|
24
|
-
export declare const getTimeSelection: (unmaskedValue: string, variant: DateVariant) => TimeSelection;
|
|
25
|
-
export declare const formatPartialDateTime: (date: Moment, hour: number | null, minute: number | null) => string;
|
|
26
|
-
export declare const parseBoundary: (value?: string) => Moment | undefined;
|
|
27
|
-
export declare const clampDateToBounds: (date: Moment, min?: Moment, max?: Moment) => Moment;
|
|
28
|
-
export interface AssumedTimeParams {
|
|
29
|
-
date: Moment;
|
|
30
|
-
hour: number | null;
|
|
31
|
-
minute: number | null;
|
|
32
|
-
min?: Moment;
|
|
33
|
-
max?: Moment;
|
|
34
|
-
}
|
|
35
|
-
export declare const resolveAssumedTime: (params: AssumedTimeParams) => Moment;
|
|
36
|
-
export declare const completePartialDateTime: (params: {
|
|
37
|
-
unmaskedValue: string;
|
|
38
|
-
variant: DateVariant;
|
|
39
|
-
min?: Moment;
|
|
40
|
-
max?: Moment;
|
|
41
|
-
}) => Moment | null;
|
|
42
|
-
export declare const isDayOutOfBounds: (day: Moment, min?: Moment, max?: Moment) => boolean;
|
|
43
|
-
export declare const getPredefinedPeriodRange: (period: PeriodOptions["id"]) => {
|
|
44
|
-
initialDate: moment.Moment;
|
|
45
|
-
finalDate: moment.Moment;
|
|
46
|
-
};
|
|
47
6
|
export declare const options: string[];
|
|
48
7
|
export declare const NAVIGATION_KEYS: string[];
|
|
49
8
|
export declare const PERIOD_OPTIONS_LIST: PeriodOptions[];
|
|
50
|
-
export declare const
|
|
9
|
+
export declare const isWithinBounds: (date: Moment, minDate?: string, maxDate?: string) => boolean;
|
|
10
|
+
export declare const generateCalendarWeeks: ((monthSelected: Moment) => Moment[][]) & import('lodash').MemoizedFunction;
|
|
@@ -1,191 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import hooks from "../../node_modules/moment/dist/moment.js";
|
|
1
|
+
import "../../node_modules/moment/dist/moment.js";
|
|
3
2
|
import memoize from "../../_virtual/memoize.js";
|
|
4
3
|
import { OPTIONS_ON_DENIED } from "../../permissionValidations.js";
|
|
5
4
|
import { Keys } from "./types.js";
|
|
6
|
-
|
|
7
|
-
hooks.locale("pt-br");
|
|
5
|
+
const TOKEN_MASK = "00/00/0000";
|
|
8
6
|
const TOKEN_ISO_FORMAT = "YYYY-MM-DD";
|
|
9
7
|
const TOKEN_PTBR_FORMAT = "DD/MM/YYYY";
|
|
10
|
-
const TOKEN_ISO_DATETIME_FORMAT = "YYYY-MM-DDTHH:mm";
|
|
11
|
-
const TOKEN_PTBR_DATETIME_FORMAT = "DD/MM/YYYY HH:mm";
|
|
12
|
-
const ACCEPTED_BOUNDARY_FORMATS = [TOKEN_ISO_FORMAT, TOKEN_ISO_DATETIME_FORMAT];
|
|
13
|
-
const ACCEPTED_VALUE_FORMATS = [...ACCEPTED_BOUNDARY_FORMATS, hooks.ISO_8601];
|
|
14
|
-
const getDateFormats = (variant) => variant === "datetime" ? {
|
|
15
|
-
isoFormat: TOKEN_ISO_DATETIME_FORMAT,
|
|
16
|
-
ptbrFormat: TOKEN_PTBR_DATETIME_FORMAT,
|
|
17
|
-
digits: 12
|
|
18
|
-
} : {
|
|
19
|
-
isoFormat: TOKEN_ISO_FORMAT,
|
|
20
|
-
ptbrFormat: TOKEN_PTBR_FORMAT,
|
|
21
|
-
digits: 8
|
|
22
|
-
};
|
|
23
|
-
const parseDateValue = (value, variant) => variant === "datetime" ? hooks(_.toString(value), ACCEPTED_VALUE_FORMATS, true) : hooks(_.toString(value), TOKEN_ISO_FORMAT);
|
|
24
|
-
const getMaskSegments = memoize((format) => {
|
|
25
|
-
const segments = [];
|
|
26
|
-
let start = 0;
|
|
27
|
-
while (start < format.length) {
|
|
28
|
-
let end = start;
|
|
29
|
-
while (end < format.length && format[end] === format[start]) end++;
|
|
30
|
-
if (/[a-z]/i.test(format[start])) segments.push({
|
|
31
|
-
start,
|
|
32
|
-
end,
|
|
33
|
-
key: format[start]
|
|
34
|
-
});
|
|
35
|
-
start = end;
|
|
36
|
-
}
|
|
37
|
-
return segments;
|
|
38
|
-
});
|
|
39
|
-
const MASK_BLOCK_RANGES = {
|
|
40
|
-
D: {
|
|
41
|
-
from: 1,
|
|
42
|
-
to: 31,
|
|
43
|
-
length: 2,
|
|
44
|
-
pad: true
|
|
45
|
-
},
|
|
46
|
-
M: {
|
|
47
|
-
from: 1,
|
|
48
|
-
to: 12,
|
|
49
|
-
length: 2,
|
|
50
|
-
pad: true
|
|
51
|
-
},
|
|
52
|
-
Y: {
|
|
53
|
-
from: 1900,
|
|
54
|
-
to: 2099,
|
|
55
|
-
length: 4,
|
|
56
|
-
pad: false
|
|
57
|
-
},
|
|
58
|
-
H: {
|
|
59
|
-
from: 0,
|
|
60
|
-
to: 23,
|
|
61
|
-
length: 2,
|
|
62
|
-
pad: true
|
|
63
|
-
},
|
|
64
|
-
m: {
|
|
65
|
-
from: 0,
|
|
66
|
-
to: 59,
|
|
67
|
-
length: 2,
|
|
68
|
-
pad: true
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const fitsBlockRange = (digits, block) => {
|
|
72
|
-
if (!digits) return true;
|
|
73
|
-
if (digits.length > block.length) return false;
|
|
74
|
-
const lowest = Number(digits.padEnd(block.length, "0"));
|
|
75
|
-
const highest = Number(digits.padEnd(block.length, "9"));
|
|
76
|
-
return highest >= block.from && lowest <= block.to;
|
|
77
|
-
};
|
|
78
|
-
const canSegmentAcceptDigits = (digits, key) => {
|
|
79
|
-
const block = MASK_BLOCK_RANGES[key];
|
|
80
|
-
if (!block) return true;
|
|
81
|
-
if (fitsBlockRange(digits, block)) return true;
|
|
82
|
-
const padDigit = String(block.from).padStart(block.length, "0")[0];
|
|
83
|
-
return block.pad && digits.length < block.length && fitsBlockRange(`${padDigit}${digits}`, block);
|
|
84
|
-
};
|
|
85
|
-
const getTimeSelection = (unmaskedValue, variant) => {
|
|
86
|
-
const digits = _.toString(unmaskedValue).replace(/\D/g, "");
|
|
87
|
-
const hasDate = _.size(digits) >= 8;
|
|
88
|
-
if (variant !== "datetime") return {
|
|
89
|
-
hour: null,
|
|
90
|
-
minute: null,
|
|
91
|
-
hasDate,
|
|
92
|
-
isComplete: hasDate
|
|
93
|
-
};
|
|
94
|
-
const hour = _.size(digits) >= 10 ? Number(digits.slice(8, 10)) : null;
|
|
95
|
-
const minute = _.size(digits) >= 12 ? Number(digits.slice(10, 12)) : null;
|
|
96
|
-
return {
|
|
97
|
-
hour,
|
|
98
|
-
minute,
|
|
99
|
-
hasDate,
|
|
100
|
-
isComplete: hasDate && !_.isNull(hour) && !_.isNull(minute)
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
const padTimeUnit = (unit) => _.padStart(String(unit), 2, "0");
|
|
104
|
-
const formatPartialDateTime = (date, hour, minute) => {
|
|
105
|
-
const datePart = date.format(TOKEN_PTBR_FORMAT);
|
|
106
|
-
if (_.isNull(hour)) return datePart;
|
|
107
|
-
if (_.isNull(minute)) return `${datePart} ${padTimeUnit(hour)}`;
|
|
108
|
-
return `${datePart} ${padTimeUnit(hour)}:${padTimeUnit(minute)}`;
|
|
109
|
-
};
|
|
110
|
-
const parseBoundary = (value) => {
|
|
111
|
-
if (!value) return void 0;
|
|
112
|
-
const boundary = hooks(value, ACCEPTED_BOUNDARY_FORMATS, true);
|
|
113
|
-
return boundary.isValid() ? boundary : void 0;
|
|
114
|
-
};
|
|
115
|
-
const clampDateToBounds = (date, min, max) => {
|
|
116
|
-
if (min && date.isBefore(min)) return min.clone();
|
|
117
|
-
if (max && date.isAfter(max)) return max.clone();
|
|
118
|
-
return date;
|
|
119
|
-
};
|
|
120
|
-
const resolveAssumedTime = (params) => {
|
|
121
|
-
const {
|
|
122
|
-
date,
|
|
123
|
-
hour,
|
|
124
|
-
minute,
|
|
125
|
-
min,
|
|
126
|
-
max
|
|
127
|
-
} = params;
|
|
128
|
-
const assumedDate = date.clone().hour(hour ?? 0).minute(minute ?? 0).second(0);
|
|
129
|
-
const fitToBoundary = (boundary) => {
|
|
130
|
-
if (_.isNull(hour)) assumedDate.hour(boundary.hour());
|
|
131
|
-
if (_.isNull(minute) && assumedDate.hour() === boundary.hour()) {
|
|
132
|
-
assumedDate.minute(boundary.minute());
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
if (min && assumedDate.isSame(min, "day") && assumedDate.isBefore(min)) fitToBoundary(min);
|
|
136
|
-
if (max && assumedDate.isSame(max, "day") && assumedDate.isAfter(max)) fitToBoundary(max);
|
|
137
|
-
return assumedDate;
|
|
138
|
-
};
|
|
139
|
-
const completePartialDateTime = (params) => {
|
|
140
|
-
const {
|
|
141
|
-
unmaskedValue,
|
|
142
|
-
variant,
|
|
143
|
-
min,
|
|
144
|
-
max
|
|
145
|
-
} = params;
|
|
146
|
-
if (variant !== "datetime") return null;
|
|
147
|
-
const {
|
|
148
|
-
hasDate,
|
|
149
|
-
isComplete,
|
|
150
|
-
hour,
|
|
151
|
-
minute
|
|
152
|
-
} = getTimeSelection(unmaskedValue, variant);
|
|
153
|
-
if (!hasDate || isComplete) return null;
|
|
154
|
-
const date = hooks(_.toString(unmaskedValue).replace(/\D/g, "").slice(0, 8), "DDMMYYYY", true);
|
|
155
|
-
if (!date.isValid()) return null;
|
|
156
|
-
return resolveAssumedTime({
|
|
157
|
-
date,
|
|
158
|
-
hour,
|
|
159
|
-
minute,
|
|
160
|
-
min,
|
|
161
|
-
max
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
const isDayOutOfBounds = (day, min, max) => {
|
|
165
|
-
if (min && day.isBefore(min, "day")) return true;
|
|
166
|
-
return Boolean(max && day.isAfter(max, "day"));
|
|
167
|
-
};
|
|
168
|
-
const getPredefinedPeriodRange = (period) => {
|
|
169
|
-
const range = (start, end) => ({
|
|
170
|
-
initialDate: start.startOf("day"),
|
|
171
|
-
finalDate: end.endOf("day")
|
|
172
|
-
});
|
|
173
|
-
switch (period) {
|
|
174
|
-
case "today":
|
|
175
|
-
return range(hooks(), hooks());
|
|
176
|
-
case "week":
|
|
177
|
-
return range(hooks().startOf("week"), hooks().endOf("week"));
|
|
178
|
-
case "lastweek":
|
|
179
|
-
return range(hooks().add(-1, "week").startOf("week"), hooks().add(-1, "week").endOf("week"));
|
|
180
|
-
case "last15":
|
|
181
|
-
return range(hooks().add(-14, "d"), hooks());
|
|
182
|
-
case "month":
|
|
183
|
-
return range(hooks().startOf("month"), hooks().endOf("month"));
|
|
184
|
-
case "lastmonth":
|
|
185
|
-
default:
|
|
186
|
-
return range(hooks().add(-1, "month").startOf("month"), hooks().add(-1, "month").endOf("month"));
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
8
|
const options = [OPTIONS_ON_DENIED.disabled, OPTIONS_ON_DENIED.unvisible, OPTIONS_ON_DENIED.readOnly, OPTIONS_ON_DENIED.hideContent];
|
|
190
9
|
const NAVIGATION_KEYS = [Keys.arrowLeft, Keys.arrowRight, Keys.arrowUp, Keys.arrowDown, Keys.pageUp, Keys.pageDown, Keys.home, Keys.end, Keys.escape, Keys.enter];
|
|
191
10
|
const PERIOD_OPTIONS_LIST = [{
|
|
@@ -223,27 +42,12 @@ const generateCalendarWeeks = memoize((monthSelected) => {
|
|
|
223
42
|
return weeks;
|
|
224
43
|
}, (monthSelected) => monthSelected.format("YYYY-MM"));
|
|
225
44
|
export {
|
|
226
|
-
ACCEPTED_BOUNDARY_FORMATS,
|
|
227
|
-
ACCEPTED_VALUE_FORMATS,
|
|
228
45
|
NAVIGATION_KEYS,
|
|
229
46
|
PERIOD_OPTIONS_LIST,
|
|
230
|
-
TOKEN_ISO_DATETIME_FORMAT,
|
|
231
47
|
TOKEN_ISO_FORMAT,
|
|
232
|
-
|
|
48
|
+
TOKEN_MASK,
|
|
233
49
|
TOKEN_PTBR_FORMAT,
|
|
234
|
-
canSegmentAcceptDigits,
|
|
235
|
-
clampDateToBounds,
|
|
236
|
-
completePartialDateTime,
|
|
237
|
-
formatPartialDateTime,
|
|
238
50
|
generateCalendarWeeks,
|
|
239
|
-
|
|
240
|
-
getMaskSegments,
|
|
241
|
-
getPredefinedPeriodRange,
|
|
242
|
-
getTimeSelection,
|
|
243
|
-
isDayOutOfBounds,
|
|
244
|
-
options,
|
|
245
|
-
parseBoundary,
|
|
246
|
-
parseDateValue,
|
|
247
|
-
resolveAssumedTime
|
|
51
|
+
options
|
|
248
52
|
};
|
|
249
53
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../src/lib/inputs2/date/helpers.ts"],"sourcesContent":["import _ from 'lodash';\nimport moment, { type Moment } from 'moment';\nimport memoize from 'lodash/memoize';\nimport { OPTIONS_ON_DENIED } from '../../permissionValidations';\nimport type { PeriodOptions } from './dateperiodfield/types';\nimport { Keys, type DateVariant, type TimeSelection } from './types';\n\n// Sem o import explícito o bundler não inclui o locale e o calendário cai em inglês.\nimport 'moment/dist/locale/pt-br';\n\nmoment.locale('pt-br');\n\nexport const TOKEN_ISO_FORMAT = 'YYYY-MM-DD';\nexport const TOKEN_PTBR_FORMAT = 'DD/MM/YYYY';\nexport const TOKEN_ISO_DATETIME_FORMAT = 'YYYY-MM-DDTHH:mm';\nexport const TOKEN_PTBR_DATETIME_FORMAT = 'DD/MM/YYYY HH:mm';\nexport const ACCEPTED_BOUNDARY_FORMATS = [TOKEN_ISO_FORMAT, TOKEN_ISO_DATETIME_FORMAT];\nexport const ACCEPTED_VALUE_FORMATS = [...ACCEPTED_BOUNDARY_FORMATS, moment.ISO_8601];\n\nexport const getDateFormats = (variant: DateVariant) => (variant === 'datetime'\n ? { isoFormat: TOKEN_ISO_DATETIME_FORMAT, ptbrFormat: TOKEN_PTBR_DATETIME_FORMAT, digits: 12 }\n : { isoFormat: TOKEN_ISO_FORMAT, ptbrFormat: TOKEN_PTBR_FORMAT, digits: 8 });\nexport const parseDateValue = (value: unknown, variant: DateVariant): Moment => (\n variant === 'datetime'\n ? moment(_.toString(value), ACCEPTED_VALUE_FORMATS, true)\n : moment(_.toString(value), TOKEN_ISO_FORMAT)\n);\n\nexport interface MaskSegment { start: number; end: number; key: string }\nexport const getMaskSegments = memoize((format: string): MaskSegment[] => {\n const segments: MaskSegment[] = [];\n let start = 0;\n while (start < format.length) {\n let end = start;\n while (end < format.length && format[end] === format[start]) end++;\n if (/[a-z]/i.test(format[start])) segments.push({ start, end, key: format[start] });\n start = end;\n }\n return segments;\n});\n\ninterface MaskBlockRange { from: number; to: number; length: number; pad: boolean }\nconst MASK_BLOCK_RANGES: Record<string, MaskBlockRange> = {\n D: { from: 1, to: 31, length: 2, pad: true },\n M: { from: 1, to: 12, length: 2, pad: true },\n Y: { from: 1900, to: 2099, length: 4, pad: false },\n H: { from: 0, to: 23, length: 2, pad: true },\n m: { from: 0, to: 59, length: 2, pad: true },\n};\n\nconst fitsBlockRange = (digits: string, block: MaskBlockRange): boolean => {\n if (!digits) return true;\n if (digits.length > block.length) return false;\n const lowest = Number(digits.padEnd(block.length, '0'));\n const highest = Number(digits.padEnd(block.length, '9'));\n return highest >= block.from && lowest <= block.to;\n};\n\nexport const canSegmentAcceptDigits = (digits: string, key: string): boolean => {\n const block = MASK_BLOCK_RANGES[key];\n if (!block) return true;\n if (fitsBlockRange(digits, block)) return true;\n const padDigit = String(block.from).padStart(block.length, '0')[0];\n return block.pad && digits.length < block.length\n && fitsBlockRange(`${padDigit}${digits}`, block);\n};\n\nexport const getTimeSelection = (unmaskedValue: string, variant: DateVariant): TimeSelection => {\n const digits = _.toString(unmaskedValue).replace(/\\D/g, '');\n const hasDate = _.size(digits) >= 8;\n if (variant !== 'datetime') return { hour: null, minute: null, hasDate, isComplete: hasDate };\n const hour = _.size(digits) >= 10 ? Number(digits.slice(8, 10)) : null;\n const minute = _.size(digits) >= 12 ? Number(digits.slice(10, 12)) : null;\n return { hour, minute, hasDate, isComplete: hasDate && !_.isNull(hour) && !_.isNull(minute) };\n};\n\nconst padTimeUnit = (unit: number) => _.padStart(String(unit), 2, '0');\n\nexport const formatPartialDateTime = (\n date: Moment, hour: number | null, minute: number | null,\n): string => {\n const datePart = date.format(TOKEN_PTBR_FORMAT);\n if (_.isNull(hour)) return datePart;\n if (_.isNull(minute)) return `${datePart} ${padTimeUnit(hour)}`;\n return `${datePart} ${padTimeUnit(hour)}:${padTimeUnit(minute)}`;\n};\n\nexport const parseBoundary = (value?: string): Moment | undefined => {\n if (!value) return undefined;\n const boundary = moment(value, ACCEPTED_BOUNDARY_FORMATS, true);\n return boundary.isValid() ? boundary : undefined;\n};\n\nexport const clampDateToBounds = (date: Moment, min?: Moment, max?: Moment): Moment => {\n if (min && date.isBefore(min)) return min.clone();\n if (max && date.isAfter(max)) return max.clone();\n return date;\n};\n\n// O que a pessoa não escolheu vira zero — e só o que ela não escolheu é puxado para a borda de\n// `min`/`max`. O dia e as unidades que ela mesma definiu ficam como estão, mesmo fora do intervalo.\nexport interface AssumedTimeParams {\n date: Moment;\n hour: number | null;\n minute: number | null;\n min?: Moment;\n max?: Moment;\n}\n\nexport const resolveAssumedTime = (params: AssumedTimeParams): Moment => {\n const { date, hour, minute, min, max } = params;\n const assumedDate = date.clone().hour(hour ?? 0).minute(minute ?? 0).second(0);\n const fitToBoundary = (boundary: Moment) => {\n if (_.isNull(hour)) assumedDate.hour(boundary.hour());\n if (_.isNull(minute) && assumedDate.hour() === boundary.hour()) {\n assumedDate.minute(boundary.minute());\n }\n };\n if (min && assumedDate.isSame(min, 'day') && assumedDate.isBefore(min)) fitToBoundary(min);\n if (max && assumedDate.isSame(max, 'day') && assumedDate.isAfter(max)) fitToBoundary(max);\n return assumedDate;\n};\n\n// Sair do campo com a data fechada e a hora em aberto.\nexport const completePartialDateTime = (\n params: { unmaskedValue: string, variant: DateVariant, min?: Moment, max?: Moment },\n): Moment | null => {\n const { unmaskedValue, variant, min, max } = params;\n if (variant !== 'datetime') return null;\n const { hasDate, isComplete, hour, minute } = getTimeSelection(unmaskedValue, variant);\n if (!hasDate || isComplete) return null;\n const date = moment(_.toString(unmaskedValue).replace(/\\D/g, '').slice(0, 8), 'DDMMYYYY', true);\n if (!date.isValid()) return null;\n return resolveAssumedTime({ date, hour, minute, min, max });\n};\n\nexport const isDayOutOfBounds = (day: Moment, min?: Moment, max?: Moment): boolean => {\n if (min && day.isBefore(min, 'day')) return true;\n return Boolean(max && day.isAfter(max, 'day'));\n};\n\nexport const getPredefinedPeriodRange = (period: PeriodOptions['id']) => {\n const range = (start: Moment, end: Moment) => ({\n initialDate: start.startOf('day'), finalDate: end.endOf('day'),\n });\n switch (period) {\n case 'today': return range(moment(), moment());\n case 'week': return range(moment().startOf('week'), moment().endOf('week'));\n case 'lastweek': return range(\n moment().add(-1, 'week').startOf('week'), moment().add(-1, 'week').endOf('week'),\n );\n case 'last15': return range(moment().add(-14, 'd'), moment());\n case 'month': return range(moment().startOf('month'), moment().endOf('month'));\n case 'lastmonth':\n default: return range(\n moment().add(-1, 'month').startOf('month'), moment().add(-1, 'month').endOf('month'),\n );\n }\n};\n\nexport const options = [\n OPTIONS_ON_DENIED.disabled,\n OPTIONS_ON_DENIED.unvisible,\n OPTIONS_ON_DENIED.readOnly,\n OPTIONS_ON_DENIED.hideContent,\n];\nexport const NAVIGATION_KEYS: string[] = [\n Keys.arrowLeft, Keys.arrowRight, Keys.arrowUp, Keys.arrowDown,\n Keys.pageUp, Keys.pageDown, Keys.home, Keys.end, Keys.escape,\n Keys.enter,\n];\nexport const PERIOD_OPTIONS_LIST: PeriodOptions[] = [\n { id: 'today', label: 'Hoje' },\n { id: 'week', label: 'Semana Atual' },\n { id: 'lastweek', label: 'Última Semana' },\n { id: 'last15', label: 'Últimos 15 dias' },\n { id: 'month', label: 'Mês atual' },\n { id: 'lastmonth', label: 'Último Mês' },\n];\n\nexport const generateCalendarWeeks = memoize((monthSelected: Moment): Moment[][] => {\n const startOfCalendar = monthSelected.clone().startOf('month').startOf('week');\n const endOfCalendar = monthSelected.clone().endOf('month').endOf('week');\n const weeks: Moment[][] = [];\n const currentWeek = startOfCalendar.clone();\n while (currentWeek.isSameOrBefore(endOfCalendar, 'day')) {\n const week: Moment[] = [];\n for (let days = 0; days < 7; days++) {\n week.push(currentWeek.clone());\n currentWeek.add(1, 'day');\n }\n weeks.push(week);\n }\n return weeks;\n}, (monthSelected: Moment) => monthSelected.format('YYYY-MM'));\n"],"names":["moment","locale","TOKEN_ISO_FORMAT","TOKEN_PTBR_FORMAT","TOKEN_ISO_DATETIME_FORMAT","TOKEN_PTBR_DATETIME_FORMAT","ACCEPTED_BOUNDARY_FORMATS","ACCEPTED_VALUE_FORMATS","ISO_8601","getDateFormats","variant","isoFormat","ptbrFormat","digits","parseDateValue","value","_","toString","getMaskSegments","memoize","format","segments","start","length","end","test","push","key","MASK_BLOCK_RANGES","D","from","to","pad","M","Y","H","m","fitsBlockRange","block","lowest","Number","padEnd","highest","canSegmentAcceptDigits","padDigit","String","padStart","getTimeSelection","unmaskedValue","replace","hasDate","size","hour","minute","isComplete","slice","isNull","padTimeUnit","unit","formatPartialDateTime","date","datePart","parseBoundary","undefined","boundary","isValid","clampDateToBounds","min","max","isBefore","clone","isAfter","resolveAssumedTime","params","assumedDate","second","fitToBoundary","isSame","completePartialDateTime","isDayOutOfBounds","day","Boolean","getPredefinedPeriodRange","period","range","initialDate","startOf","finalDate","endOf","add","options","OPTIONS_ON_DENIED","disabled","unvisible","readOnly","hideContent","NAVIGATION_KEYS","Keys","arrowLeft","arrowRight","arrowUp","arrowDown","pageUp","pageDown","home","escape","enter","PERIOD_OPTIONS_LIST","id","label","generateCalendarWeeks","monthSelected","startOfCalendar","endOfCalendar","weeks","currentWeek","isSameOrBefore","week","days"],"mappings":";;;;;;AAUAA,MAAOC,OAAO,OAAO;AAEd,MAAMC,mBAAmB;AACzB,MAAMC,oBAAoB;AAC1B,MAAMC,4BAA4B;AAClC,MAAMC,6BAA6B;AACnC,MAAMC,4BAA4B,CAACJ,kBAAkBE,yBAAyB;AAC9E,MAAMG,yBAAyB,CAAC,GAAGD,2BAA2BN,MAAOQ,QAAQ;AAE7E,MAAMC,iBAAiBA,CAACC,YAA0BA,YAAY,aACjE;AAAA,EAAEC,WAAWP;AAAAA,EAA2BQ,YAAYP;AAAAA,EAA4BQ,QAAQ;AAAG,IAC3F;AAAA,EAAEF,WAAWT;AAAAA,EAAkBU,YAAYT;AAAAA,EAAmBU,QAAQ;AAAE;AACrE,MAAMC,iBAAiBA,CAACC,OAAgBL,YAC7CA,YAAY,aACRV,MAAOgB,EAAEC,SAASF,KAAK,GAAGR,wBAAwB,IAAI,IACtDP,MAAOgB,EAAEC,SAASF,KAAK,GAAGb,gBAAgB;AAIzC,MAAMgB,kBAAkBC,QAAQ,CAACC,WAAkC;AACxE,QAAMC,WAA0B,CAAA;AAChC,MAAIC,QAAQ;AACZ,SAAOA,QAAQF,OAAOG,QAAQ;AAC5B,QAAIC,MAAMF;AACV,WAAOE,MAAMJ,OAAOG,UAAUH,OAAOI,GAAG,MAAMJ,OAAOE,KAAK,EAAGE;AAC7D,QAAI,SAASC,KAAKL,OAAOE,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vD,UAAMI,OAAiB,CAAA;AACvB,aAASC,OAAO,GAAGA,OAAO,GAAGA,QAAQ;AACnCD,WAAK3F,KAAKyF,YAAY7C,OAAO;AAC7B6C,kBAAY1B,IAAI,GAAG,KAAK;AAAA,IAC1B;AACAyB,UAAMxF,KAAK2F,IAAI;AAAA,EACjB;AACA,SAAOH;AACT,GAAG,CAACH,kBAA0BA,cAAc3F,OAAO,SAAS,CAAC;"}
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../src/lib/inputs2/date/helpers.ts"],"sourcesContent":["import moment, { type Moment } from 'moment';\nimport memoize from 'lodash/memoize';\nimport { OPTIONS_ON_DENIED } from '../../permissionValidations';\nimport type { PeriodOptions } from './dateperiodfield/types';\nimport { Keys } from './types';\n\nexport const TOKEN_MASK = '00/00/0000';\nexport const TOKEN_ISO_FORMAT = 'YYYY-MM-DD';\nexport const TOKEN_PTBR_FORMAT = 'DD/MM/YYYY';\nexport const options = [\n OPTIONS_ON_DENIED.disabled,\n OPTIONS_ON_DENIED.unvisible,\n OPTIONS_ON_DENIED.readOnly,\n OPTIONS_ON_DENIED.hideContent,\n];\nexport const NAVIGATION_KEYS: string[] = [\n Keys.arrowLeft, Keys.arrowRight, Keys.arrowUp, Keys.arrowDown,\n Keys.pageUp, Keys.pageDown, Keys.home, Keys.end, Keys.escape,\n Keys.enter,\n];\nexport const PERIOD_OPTIONS_LIST: PeriodOptions[] = [\n { id: 'today', label: 'Hoje' },\n { id: 'week', label: 'Semana Atual' },\n { id: 'lastweek', label: 'Última Semana' },\n { id: 'last15', label: 'Últimos 15 dias' },\n { id: 'month', label: 'Mês atual' },\n { id: 'lastmonth', label: 'Último Mês' },\n];\nexport const isWithinBounds = (date: Moment, minDate?: string, maxDate?: string): boolean => {\n if (minDate) {\n const min = moment(minDate, TOKEN_ISO_FORMAT);\n if (date.isBefore(min, 'day')) return false;\n }\n if (maxDate) {\n const max = moment(maxDate, TOKEN_ISO_FORMAT);\n if (date.isAfter(max, 'day')) return false;\n }\n return true;\n};\nexport const generateCalendarWeeks = memoize((monthSelected: Moment): Moment[][] => {\n const startOfCalendar = monthSelected.clone().startOf('month').startOf('week');\n const endOfCalendar = monthSelected.clone().endOf('month').endOf('week');\n const weeks: Moment[][] = [];\n const currentWeek = startOfCalendar.clone();\n while (currentWeek.isSameOrBefore(endOfCalendar, 'day')) {\n const week: Moment[] = [];\n for (let days = 0; days < 7; days++) {\n week.push(currentWeek.clone());\n currentWeek.add(1, 'day');\n }\n weeks.push(week);\n }\n return weeks;\n}, (monthSelected: Moment) => monthSelected.format('YYYY-MM'));\n"],"names":["TOKEN_MASK","TOKEN_ISO_FORMAT","TOKEN_PTBR_FORMAT","options","OPTIONS_ON_DENIED","disabled","unvisible","readOnly","hideContent","NAVIGATION_KEYS","Keys","arrowLeft","arrowRight","arrowUp","arrowDown","pageUp","pageDown","home","end","escape","enter","PERIOD_OPTIONS_LIST","id","label","generateCalendarWeeks","memoize","monthSelected","startOfCalendar","clone","startOf","endOfCalendar","endOf","weeks","currentWeek","isSameOrBefore","week","days","push","add","format"],"mappings":";;;;AAMO,MAAMA,aAAa;AACnB,MAAMC,mBAAmB;AACzB,MAAMC,oBAAoB;AAC1B,MAAMC,UAAU,CACrBC,kBAAkBC,UAClBD,kBAAkBE,WAClBF,kBAAkBG,UAClBH,kBAAkBI,WAAW;AAExB,MAAMC,kBAA4B,CACvCC,KAAKC,WAAWD,KAAKE,YAAYF,KAAKG,SAASH,KAAKI,WACpDJ,KAAKK,QAAQL,KAAKM,UAAUN,KAAKO,MAAMP,KAAKQ,KAAKR,KAAKS,QACtDT,KAAKU,KAAK;AAEL,MAAMC,sBAAuC,CAClD;AAAA,EAAEC,IAAI;AAAA,EAASC,OAAO;AAAO,GAC7B;AAAA,EAAED,IAAI;AAAA,EAAQC,OAAO;AAAe,GACpC;AAAA,EAAED,IAAI;AAAA,EAAYC,OAAO;AAAgB,GACzC;AAAA,EAAED,IAAI;AAAA,EAAUC,OAAO;AAAkB,GACzC;AAAA,EAAED,IAAI;AAAA,EAASC,OAAO;AAAY,GAClC;AAAA,EAAED,IAAI;AAAA,EAAaC,OAAO;AAAa,CAAC;AAanC,MAAMC,wBAAwBC,QAAQ,CAACC,kBAAsC;AAClF,QAAMC,kBAAkBD,cAAcE,MAAAA,EAAQC,QAAQ,OAAO,EAAEA,QAAQ,MAAM;AAC7E,QAAMC,gBAAgBJ,cAAcE,MAAAA,EAAQG,MAAM,OAAO,EAAEA,MAAM,MAAM;AACvE,QAAMC,QAAoB,CAAA;AAC1B,QAAMC,cAAcN,gBAAgBC,MAAAA;AACpC,SAAOK,YAAYC,eAAeJ,eAAe,KAAK,GAAG;AACvD,UAAMK,OAAiB,CAAA;AACvB,aAASC,OAAO,GAAGA,OAAO,GAAGA,QAAQ;AACnCD,WAAKE,KAAKJ,YAAYL,OAAO;AAC7BK,kBAAYK,IAAI,GAAG,KAAK;AAAA,IAC1B;AACAN,UAAMK,KAAKF,IAAI;AAAA,EACjB;AACA,SAAOH;AACT,GAAG,CAACN,kBAA0BA,cAAca,OAAO,SAAS,CAAC;"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ComponentPropsWithoutRef, MouseEvent, RefObject } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, MouseEvent } from 'react';
|
|
3
2
|
import { ColorTheme } from '../../@types/ColorStyles';
|
|
4
3
|
import { Position, HintPosition } from '../../@types/Position';
|
|
5
4
|
export type DateValueReturnType = 'default' | 'iso';
|
|
6
|
-
export type DateVariant = 'date' | 'datetime';
|
|
7
5
|
export declare enum Keys {
|
|
8
6
|
arrowLeft = "ArrowLeft",
|
|
9
7
|
arrowRight = "ArrowRight",
|
|
@@ -16,25 +14,6 @@ export declare enum Keys {
|
|
|
16
14
|
escape = "Escape",
|
|
17
15
|
enter = "Enter"
|
|
18
16
|
}
|
|
19
|
-
export interface DateSharedContextProps {
|
|
20
|
-
calendarBoxOpen: boolean;
|
|
21
|
-
activeDescendant: string;
|
|
22
|
-
calendarDisplayDate: Moment;
|
|
23
|
-
calendarRef: RefObject<HTMLDivElement | null>;
|
|
24
|
-
dateContainerRef: RefObject<HTMLDivElement | null>;
|
|
25
|
-
handleNextMonth: () => void;
|
|
26
|
-
handlePreviousMonth: () => void;
|
|
27
|
-
handleToggleCalendarBox: () => void;
|
|
28
|
-
handleSetCalendarBoxOpen: (value: boolean) => void;
|
|
29
|
-
handleChangeActiveDescendant: (value: string) => void;
|
|
30
|
-
handleChangeCalendarDisplayDate: (value: Moment) => void;
|
|
31
|
-
}
|
|
32
|
-
export interface TimeSelection {
|
|
33
|
-
hour: number | null;
|
|
34
|
-
minute: number | null;
|
|
35
|
-
hasDate: boolean;
|
|
36
|
-
isComplete: boolean;
|
|
37
|
-
}
|
|
38
17
|
export interface BaseDateInputRootProps extends ComponentPropsWithoutRef<'div'> {
|
|
39
18
|
customClassWrapper?: string;
|
|
40
19
|
hasValidationErrors?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/lib/inputs2/date/types.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/lib/inputs2/date/types.ts"],"sourcesContent":["import { ComponentPropsWithoutRef, MouseEvent } from 'react';\nimport type { ColorTheme } from '../../@types/ColorStyles';\nimport type { Position, HintPosition } from '../../@types/Position';\n\nexport type DateValueReturnType = 'default' | 'iso';\nexport enum Keys {\n arrowLeft = 'ArrowLeft',\n arrowRight = 'ArrowRight',\n arrowUp = 'ArrowUp',\n arrowDown = 'ArrowDown',\n pageUp = 'PageUp',\n pageDown = 'PageDown',\n home = 'Home',\n end = 'End',\n escape = 'Escape',\n enter = 'Enter'\n}\nexport interface BaseDateInputRootProps extends ComponentPropsWithoutRef<'div'> {\n customClassWrapper?: string;\n hasValidationErrors?: boolean;\n}\nexport interface BaseDateInputLabelProps extends ComponentPropsWithoutRef<'span'> {\n hint?: string;\n customClassLabel?: string;\n skeletonize?: boolean;\n label?: string;\n inputId?: string;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n required?: boolean;\n labelUppercase?: boolean;\n hasHintMessages?: boolean;\n hintPosition?: HintPosition;\n themePopover?: ColorTheme;\n popoverAlign?: Extract<Position, 'left' | 'right'>;\n}\nexport interface BaseDateInputContainerProps extends ComponentPropsWithoutRef<'div'> {\n skeletonize?: boolean;\n customClassInputContainer?: string;\n}\ntype InputHTMLProps = Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'multiple'>;\nexport interface BaseDateInputProps extends InputHTMLProps {\n customClass?: string;\n}\nexport interface BaseDateInputTriggersProps extends ComponentPropsWithoutRef<'div'> {\n isDisabled?: boolean;\n isReadOnly?: boolean;\n skeletonize?: boolean;\n inputFieldId?: string;\n calendarBoxOpen?: boolean;\n showClearButton?: boolean;\n showCalendarButton?: boolean;\n hasValidDateSelection?: boolean;\n hasValidPeriodSelected?: boolean;\n clearButtonTestId?: string;\n calendarButtonTestId?: string;\n onClearSelectedDate: () => void,\n onClickTriggerCalendar: (event: MouseEvent<HTMLButtonElement>) => void,\n}\n"],"names":["Keys","arrowLeft","arrowRight","arrowUp","arrowDown","pageUp","pageDown","home","end","escape","enter"],"mappings":"AAKO,IAAKA,yBAAAA,UAAL;AACLC,QAAAA,WAAAA,IAAY;AACZC,QAAAA,YAAAA,IAAa;AACbC,QAAAA,SAAAA,IAAU;AACVC,QAAAA,WAAAA,IAAY;AACZC,QAAAA,QAAAA,IAAS;AACTC,QAAAA,UAAAA,IAAW;AACXC,QAAAA,MAAAA,IAAO;AACPC,QAAAA,KAAAA,IAAM;AACNC,QAAAA,QAAAA,IAAS;AACTC,QAAAA,OAAAA,IAAQ;AAVEV,SAAAA;AAAAA,GAAAA,QAAAA,CAAAA,CAAAA;"}
|
|
@@ -13,7 +13,7 @@ var hasRequiredLodash;
|
|
|
13
13
|
function requireLodash() {
|
|
14
14
|
if (hasRequiredLodash) return lodash$1.exports;
|
|
15
15
|
hasRequiredLodash = 1;
|
|
16
|
-
(function(module, exports) {
|
|
16
|
+
(function(module, exports$1) {
|
|
17
17
|
(function() {
|
|
18
18
|
var undefined$1;
|
|
19
19
|
var VERSION = "4.17.21";
|
|
@@ -341,7 +341,7 @@ function requireLodash() {
|
|
|
341
341
|
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
342
342
|
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
343
343
|
var root = freeGlobal || freeSelf || Function("return this")();
|
|
344
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
344
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
345
345
|
var freeModule = freeExports && true && module && !module.nodeType && module;
|
|
346
346
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
347
347
|
var freeProcess = moduleExports && freeGlobal.process;
|