linear-react-components-ui 1.1.26-beta.24 → 1.1.26-beta.25
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/selectfield.css +1 -1
- package/lib/inputs/base/types.d.ts +2 -2
- package/lib/inputs/mask/types.d.ts +2 -1
- package/lib/inputs/period/helper.d.ts +1 -0
- package/lib/inputs/period/helper.js +27 -19
- package/lib/inputs/period/helper.js.map +1 -1
- package/lib/inputs/period/index.js +156 -152
- package/lib/inputs/period/index.js.map +1 -1
- package/lib/inputs2/selectfield/base.js +258 -381
- package/lib/inputs2/selectfield/base.js.map +1 -1
- package/lib/inputs2/selectfield/helpers.d.ts +5 -0
- package/lib/inputs2/selectfield/helpers.js +22 -13
- package/lib/inputs2/selectfield/helpers.js.map +1 -1
- package/lib/inputs2/selectfield/index.js.map +1 -1
- package/lib/inputs2/selectfield/listbox.js +17 -18
- package/lib/inputs2/selectfield/listbox.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, KeyboardEvent, MutableRefObject, RefObject, DragEvent, MouseEvent, JSX, ReactNode } from 'react';
|
|
1
|
+
import { CSSProperties, KeyboardEvent, MutableRefObject, RefObject, DragEvent, MouseEvent, JSX, ReactNode, HTMLInputAutoCompleteAttribute } from 'react';
|
|
2
2
|
import { TextAlign } from 'src/lib/@types/Align';
|
|
3
3
|
import { ITooltipCommonProps } from 'src/lib/tooltip/types';
|
|
4
4
|
import { Period } from '../../@types/Period';
|
|
@@ -80,9 +80,9 @@ export interface IBaseProps extends ITooltipCommonProps {
|
|
|
80
80
|
accept?: string;
|
|
81
81
|
multiple?: boolean;
|
|
82
82
|
readOnlyClass?: string;
|
|
83
|
-
autoComplete?: 'on' | 'off';
|
|
84
83
|
themePopover?: 'light' | 'dark';
|
|
85
84
|
popoverAlign?: 'right' | 'left';
|
|
86
85
|
tabIndex?: number;
|
|
87
86
|
defaultValue?: string | string[];
|
|
87
|
+
autoComplete?: HTMLInputAutoCompleteAttribute;
|
|
88
88
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSX, KeyboardEvent, MutableRefObject } from 'react';
|
|
1
|
+
import { JSX, KeyboardEvent, MutableRefObject, HTMLInputAutoCompleteAttribute } from 'react';
|
|
2
2
|
import { TextAlign } from 'src/lib/@types/Align';
|
|
3
3
|
import { OnDenied, PermissionAttr } from '../../@types/PermissionAttr';
|
|
4
4
|
import { CustomInputEvent } from '../base/types';
|
|
@@ -54,6 +54,7 @@ export type IBaseMaskProps = {
|
|
|
54
54
|
mapToRadix?: string[];
|
|
55
55
|
normalizeZeros?: boolean;
|
|
56
56
|
isDateTimeField?: boolean;
|
|
57
|
+
autoComplete?: HTMLInputAutoCompleteAttribute;
|
|
57
58
|
};
|
|
58
59
|
export type ICnpjFieldProps = IBaseMaskProps & {
|
|
59
60
|
value?: string;
|
|
@@ -9,3 +9,4 @@ export default getCalendarDropdownStyle;
|
|
|
9
9
|
export declare const getDropdownItemCssClass: (selected?: boolean, disabled?: boolean, striped?: boolean) => string;
|
|
10
10
|
export declare const CalcDatesByPeriod: (dateType: DateTypes) => Moment[];
|
|
11
11
|
export declare const isDateValid: (date: Moment) => boolean;
|
|
12
|
+
export declare const parseDateValue: (value?: string | Moment) => Moment | undefined;
|
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
let
|
|
4
|
-
return
|
|
5
|
-
},
|
|
6
|
-
const
|
|
1
|
+
import r from "../../node_modules/moment/dist/moment.js";
|
|
2
|
+
const d = (n = !1, t = !1, o = !1) => {
|
|
3
|
+
let e = "item";
|
|
4
|
+
return e += n && !t ? " -selected " : "", e += t ? " -disabled" : "", e += !n && !t && o ? " -striped " : "", e;
|
|
5
|
+
}, l = (n) => {
|
|
6
|
+
const t = r();
|
|
7
7
|
return {
|
|
8
|
-
today: () => [
|
|
8
|
+
today: () => [t, t],
|
|
9
9
|
week: () => {
|
|
10
|
-
const
|
|
11
|
-
return [
|
|
10
|
+
const e = t.clone().startOf("week"), s = t.clone().endOf("week");
|
|
11
|
+
return [e, s];
|
|
12
12
|
},
|
|
13
13
|
lastweek: () => {
|
|
14
|
-
const
|
|
15
|
-
return [
|
|
14
|
+
const e = t.subtract(1, "weeks"), s = e.clone().startOf("week"), a = e.clone().endOf("week");
|
|
15
|
+
return [s, a];
|
|
16
16
|
},
|
|
17
|
-
last15: () => [
|
|
17
|
+
last15: () => [r(t).subtract(15, "days"), t],
|
|
18
18
|
month: () => {
|
|
19
|
-
const
|
|
20
|
-
return [
|
|
19
|
+
const e = t.clone().startOf("month"), s = t.clone().endOf("month");
|
|
20
|
+
return [e, s];
|
|
21
21
|
},
|
|
22
22
|
lastmonth: () => {
|
|
23
|
-
const
|
|
24
|
-
return [
|
|
23
|
+
const e = t.subtract(1, "months"), s = e.clone().startOf("month"), a = e.clone().endOf("month");
|
|
24
|
+
return [s, a];
|
|
25
25
|
}
|
|
26
|
-
}[
|
|
26
|
+
}[n]();
|
|
27
|
+
}, i = (n) => {
|
|
28
|
+
if (!n) return;
|
|
29
|
+
if (r.isMoment(n)) return n.isValid() ? n : void 0;
|
|
30
|
+
const t = r(n, "YYYY-MM-DD", !0);
|
|
31
|
+
if (t.isValid()) return t;
|
|
32
|
+
const o = r(n, "DD/MM/YYYY", !0);
|
|
33
|
+
if (o.isValid()) return o;
|
|
27
34
|
};
|
|
28
35
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
l as CalcDatesByPeriod,
|
|
37
|
+
d as getDropdownItemCssClass,
|
|
38
|
+
i as parseDateValue
|
|
31
39
|
};
|
|
32
40
|
//# sourceMappingURL=helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sources":["../../../src/lib/inputs/period/helper.ts"],"sourcesContent":["import moment, { Moment } from 'moment';\nimport { DateTypes } from './types';\n\nconst getCalendarDropdownStyle = ({ topPosition, leftPosition, width }:\n{ topPosition: number | string, leftPosition: number | string, width: number | string }) => (\n `top: ${topPosition}px;\n left: ${leftPosition}px;\n width:${width}px`\n);\nexport default getCalendarDropdownStyle;\n\nexport const getDropdownItemCssClass = (selected = false, disabled = false, striped = false) => {\n let className = 'item';\n className += (selected && !disabled ? ' -selected ' : '');\n className += disabled ? ' -disabled' : '';\n className += (!selected && !disabled && striped ? ' -striped ' : '');\n return className;\n};\n\nexport const CalcDatesByPeriod = (dateType: DateTypes): Moment[] => {\n const currentDate = moment();\n const dateTypes = {\n today: () => [currentDate, currentDate],\n week: () => {\n const weekStart = currentDate.clone().startOf('week');\n const weekEnd = currentDate.clone().endOf('week');\n return [weekStart, weekEnd];\n },\n lastweek: () => {\n const lastWeek = currentDate.subtract(1, 'weeks');\n const weekStart = lastWeek.clone().startOf('week');\n const weekEnd = lastWeek.clone().endOf('week');\n return [weekStart, weekEnd];\n },\n last15: () => {\n const last15Day = moment(currentDate);\n return [last15Day.subtract(15, 'days'), currentDate];\n },\n month: () => {\n const monthStart = currentDate.clone().startOf('month');\n const monthEnd = currentDate.clone().endOf('month');\n return [monthStart, monthEnd];\n },\n lastmonth: () => {\n const lastMonth = currentDate.subtract(1, 'months');\n const monthStart = lastMonth.clone().startOf('month');\n const monthEnd = lastMonth.clone().endOf('month');\n return [monthStart, monthEnd];\n },\n };\n return dateTypes[dateType]();\n};\n\nexport const isDateValid = (date: Moment) => date && moment(date).isValid();\n"],"names":["getDropdownItemCssClass","selected","disabled","striped","className","CalcDatesByPeriod","dateType","currentDate","moment","today","week","weekStart","clone","startOf","weekEnd","endOf","lastweek","lastWeek","subtract","last15","month","monthStart","monthEnd","lastmonth","lastMonth"],"mappings":";AAWO,MAAMA,IAA0BA,CAACC,IAAW,IAAOC,IAAW,IAAOC,IAAU,OAAU;AAC9F,MAAIC,IAAY;AAChBA,SAAAA,KAAcH,KAAY,CAACC,IAAW,gBAAgB,IACtDE,KAAaF,IAAW,eAAe,IACvCE,KAAc,CAACH,KAAY,CAACC,KAAYC,IAAU,eAAe,IAC1DC;AACT,GAEaC,IAAoBA,CAACC,MAAkC;AAClE,QAAMC,IAAcC,EAAAA;AA8BpB,SA7BkB;AAAA,IAChBC,OAAOA,MAAM,CAACF,GAAaA,CAAW;AAAA,IACtCG,MAAMA,MAAM;AACV,YAAMC,IAAYJ,EAAYK,MAAAA,EAAQC,QAAQ,MAAM,GAC9CC,IAAUP,EAAYK,MAAAA,EAAQG,MAAM,MAAM;AAChD,aAAO,CAACJ,GAAWG,CAAO;AAAA,IAC5B;AAAA,IACAE,UAAUA,MAAM;AACd,YAAMC,IAAWV,EAAYW,SAAS,GAAG,OAAO,GAC1CP,IAAYM,EAASL,MAAAA,EAAQC,QAAQ,MAAM,GAC3CC,IAAUG,EAASL,MAAAA,EAAQG,MAAM,MAAM;AAC7C,aAAO,CAACJ,GAAWG,CAAO;AAAA,IAC5B;AAAA,IACAK,QAAQA,MAEC,CADWX,EAAOD,CAAW,EAClBW,SAAS,IAAI,MAAM,GAAGX,CAAW;AAAA,IAErDa,OAAOA,MAAM;AACX,YAAMC,IAAad,EAAYK,MAAAA,EAAQC,QAAQ,OAAO,GAChDS,IAAWf,EAAYK,MAAAA,EAAQG,MAAM,OAAO;AAClD,aAAO,CAACM,GAAYC,CAAQ;AAAA,IAC9B;AAAA,IACAC,WAAWA,MAAM;AACf,YAAMC,IAAYjB,EAAYW,SAAS,GAAG,QAAQ,GAC5CG,IAAaG,EAAUZ,MAAAA,EAAQC,QAAQ,OAAO,GAC9CS,IAAWE,EAAUZ,MAAAA,EAAQG,MAAM,OAAO;AAChD,aAAO,CAACM,GAAYC,CAAQ;AAAA,IAC9B;AAAA,EAAA,EAEehB,CAAQ,EAAA;AAC3B;"}
|
|
1
|
+
{"version":3,"file":"helper.js","sources":["../../../src/lib/inputs/period/helper.ts"],"sourcesContent":["import moment, { Moment } from 'moment';\nimport { DateTypes } from './types';\n\nconst getCalendarDropdownStyle = ({ topPosition, leftPosition, width }:\n{ topPosition: number | string, leftPosition: number | string, width: number | string }) => (\n `top: ${topPosition}px;\n left: ${leftPosition}px;\n width:${width}px`\n);\nexport default getCalendarDropdownStyle;\n\nexport const getDropdownItemCssClass = (selected = false, disabled = false, striped = false) => {\n let className = 'item';\n className += (selected && !disabled ? ' -selected ' : '');\n className += disabled ? ' -disabled' : '';\n className += (!selected && !disabled && striped ? ' -striped ' : '');\n return className;\n};\n\nexport const CalcDatesByPeriod = (dateType: DateTypes): Moment[] => {\n const currentDate = moment();\n const dateTypes = {\n today: () => [currentDate, currentDate],\n week: () => {\n const weekStart = currentDate.clone().startOf('week');\n const weekEnd = currentDate.clone().endOf('week');\n return [weekStart, weekEnd];\n },\n lastweek: () => {\n const lastWeek = currentDate.subtract(1, 'weeks');\n const weekStart = lastWeek.clone().startOf('week');\n const weekEnd = lastWeek.clone().endOf('week');\n return [weekStart, weekEnd];\n },\n last15: () => {\n const last15Day = moment(currentDate);\n return [last15Day.subtract(15, 'days'), currentDate];\n },\n month: () => {\n const monthStart = currentDate.clone().startOf('month');\n const monthEnd = currentDate.clone().endOf('month');\n return [monthStart, monthEnd];\n },\n lastmonth: () => {\n const lastMonth = currentDate.subtract(1, 'months');\n const monthStart = lastMonth.clone().startOf('month');\n const monthEnd = lastMonth.clone().endOf('month');\n return [monthStart, monthEnd];\n },\n };\n return dateTypes[dateType]();\n};\n\nexport const isDateValid = (date: Moment) => date && moment(date).isValid();\n\nexport const parseDateValue = (value?: string | Moment): Moment | undefined => {\n if (!value) return undefined;\n if (moment.isMoment(value)) return value.isValid() ? value : undefined;\n const iso = moment(value, 'YYYY-MM-DD', true);\n if (iso.isValid()) return iso;\n const dmy = moment(value, 'DD/MM/YYYY', true);\n if (dmy.isValid()) return dmy;\n return undefined;\n};\n"],"names":["getDropdownItemCssClass","selected","disabled","striped","className","CalcDatesByPeriod","dateType","currentDate","moment","today","week","weekStart","clone","startOf","weekEnd","endOf","lastweek","lastWeek","subtract","last15","month","monthStart","monthEnd","lastmonth","lastMonth","parseDateValue","value","isMoment","isValid","undefined","iso","dmy"],"mappings":";AAWO,MAAMA,IAA0BA,CAACC,IAAW,IAAOC,IAAW,IAAOC,IAAU,OAAU;AAC9F,MAAIC,IAAY;AAChBA,SAAAA,KAAcH,KAAY,CAACC,IAAW,gBAAgB,IACtDE,KAAaF,IAAW,eAAe,IACvCE,KAAc,CAACH,KAAY,CAACC,KAAYC,IAAU,eAAe,IAC1DC;AACT,GAEaC,IAAoBA,CAACC,MAAkC;AAClE,QAAMC,IAAcC,EAAAA;AA8BpB,SA7BkB;AAAA,IAChBC,OAAOA,MAAM,CAACF,GAAaA,CAAW;AAAA,IACtCG,MAAMA,MAAM;AACV,YAAMC,IAAYJ,EAAYK,MAAAA,EAAQC,QAAQ,MAAM,GAC9CC,IAAUP,EAAYK,MAAAA,EAAQG,MAAM,MAAM;AAChD,aAAO,CAACJ,GAAWG,CAAO;AAAA,IAC5B;AAAA,IACAE,UAAUA,MAAM;AACd,YAAMC,IAAWV,EAAYW,SAAS,GAAG,OAAO,GAC1CP,IAAYM,EAASL,MAAAA,EAAQC,QAAQ,MAAM,GAC3CC,IAAUG,EAASL,MAAAA,EAAQG,MAAM,MAAM;AAC7C,aAAO,CAACJ,GAAWG,CAAO;AAAA,IAC5B;AAAA,IACAK,QAAQA,MAEC,CADWX,EAAOD,CAAW,EAClBW,SAAS,IAAI,MAAM,GAAGX,CAAW;AAAA,IAErDa,OAAOA,MAAM;AACX,YAAMC,IAAad,EAAYK,MAAAA,EAAQC,QAAQ,OAAO,GAChDS,IAAWf,EAAYK,MAAAA,EAAQG,MAAM,OAAO;AAClD,aAAO,CAACM,GAAYC,CAAQ;AAAA,IAC9B;AAAA,IACAC,WAAWA,MAAM;AACf,YAAMC,IAAYjB,EAAYW,SAAS,GAAG,QAAQ,GAC5CG,IAAaG,EAAUZ,MAAAA,EAAQC,QAAQ,OAAO,GAC9CS,IAAWE,EAAUZ,MAAAA,EAAQG,MAAM,OAAO;AAChD,aAAO,CAACM,GAAYC,CAAQ;AAAA,IAC9B;AAAA,EAAA,EAEehB,CAAQ,EAAA;AAC3B,GAIamB,IAAiBA,CAACC,MAAgD;AAC7E,MAAI,CAACA,EAAO;AACZ,MAAIlB,EAAOmB,SAASD,CAAK,UAAUA,EAAME,QAAAA,IAAYF,IAAQG;AAC7D,QAAMC,IAAMtB,EAAOkB,GAAO,cAAc,EAAI;AAC5C,MAAII,EAAIF,QAAAA,EAAW,QAAOE;AAC1B,QAAMC,IAAMvB,EAAOkB,GAAO,cAAc,EAAI;AAC5C,MAAIK,EAAIH,QAAAA,EAAW,QAAOG;AAE5B;"}
|
|
@@ -1,199 +1,203 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
1
|
+
import { jsx as i, jsxs as L } from "react/jsx-runtime";
|
|
2
2
|
import '../../assets/styles/button.css';import '../../assets/styles/periodpicker.css';/* empty css */
|
|
3
|
-
import { useId as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import U from "./Dropdown.js";
|
|
8
|
-
import Oe from "../../calendar/base/index.js";
|
|
3
|
+
import { useId as ge, useState as h, useRef as s, useCallback as he, useEffect as V } from "react";
|
|
4
|
+
import Y from "../../node_modules/moment/dist/moment.js";
|
|
5
|
+
import pe from "../mask/BaseMask.js";
|
|
6
|
+
import Ee from "../../calendar/base/index.js";
|
|
9
7
|
import "../../_virtual/compiler-runtime.js";
|
|
10
|
-
import
|
|
8
|
+
import ve from "../../buttons/Button.js";
|
|
11
9
|
/* empty css */
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
|
|
10
|
+
import G from "../../icons/index.js";
|
|
11
|
+
import Te from "../../hint/index.js";
|
|
12
|
+
import qe from "../../gridlayout/GridCol.js";
|
|
13
|
+
import { getInputWrapperClass as Ae } from "../base/helpers.js";
|
|
14
|
+
import { ErrorMessage as ze } from "../errorMessage/index.js";
|
|
15
|
+
import Ce from "../../textContent/index.js";
|
|
16
|
+
import Ne from "../../popover/index.js";
|
|
17
|
+
import H from "./Dialog.js";
|
|
18
|
+
import K from "./Dropdown.js";
|
|
19
|
+
import je from "./PeriodList.js";
|
|
20
|
+
import { parseDateValue as E } from "./helper.js";
|
|
21
|
+
const cn = (t) => {
|
|
21
22
|
const {
|
|
22
|
-
showButtonOpen:
|
|
23
|
-
openOnFocus:
|
|
24
|
-
shouldCloseOnSelect:
|
|
25
|
-
calendarColorStyle:
|
|
23
|
+
showButtonOpen: y = !0,
|
|
24
|
+
openOnFocus: De = !0,
|
|
25
|
+
shouldCloseOnSelect: J = !0,
|
|
26
|
+
calendarColorStyle: P,
|
|
26
27
|
showCalendarInDialog: I = !1,
|
|
27
|
-
dialogSize:
|
|
28
|
+
dialogSize: T = {
|
|
28
29
|
width: "350px",
|
|
29
30
|
height: "350px"
|
|
30
31
|
},
|
|
31
|
-
hint:
|
|
32
|
-
hintPosition:
|
|
33
|
-
themePopover:
|
|
34
|
-
popoverAlign:
|
|
35
|
-
gridLayout:
|
|
36
|
-
} =
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
const
|
|
40
|
-
!I &&
|
|
41
|
-
},
|
|
32
|
+
hint: O,
|
|
33
|
+
hintPosition: Q = "below",
|
|
34
|
+
themePopover: Ye = "light",
|
|
35
|
+
popoverAlign: Ie = "left",
|
|
36
|
+
gridLayout: X
|
|
37
|
+
} = t, Se = ge(), be = ge(), [r, w] = h(() => E(t.value?.initial)), [u, F] = h(() => E(t.value?.final)), [Z, _] = h("week"), [p, d] = h(!1), [v, o] = h(!1), [M, C] = h(!1), [q, A] = h(), [m, ee] = h(), [ne, te] = h("valueInitial"), R = s(null), D = s(null), c = s(null), we = s(null), z = s(null), Fe = s(null), S = s(null), l = s(null), g = s(null), B = s(null), N = s(!1), j = () => {
|
|
38
|
+
A(D?.current?.getBoundingClientRect());
|
|
39
|
+
}, Me = (e) => {
|
|
40
|
+
const n = !R.current?.contains(e.relatedTarget);
|
|
41
|
+
!I && p && n && d(!1), !I && v && n && o(!1);
|
|
42
|
+
}, ie = (e) => {
|
|
42
43
|
const {
|
|
43
|
-
target:
|
|
44
|
-
} = e,
|
|
45
|
-
g.current && e && e.key && e.key === "Escape" && (e.preventDefault(),
|
|
46
|
-
},
|
|
47
|
-
const e =
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
e === "valueInitial" && (
|
|
51
|
-
|
|
52
|
-
}, 100), d(!0))), e === "valueFinal" && (
|
|
53
|
-
|
|
54
|
-
}, 100), o(!0))),
|
|
55
|
-
},
|
|
56
|
-
e === "valueInitial" &&
|
|
57
|
-
},
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
initial:
|
|
61
|
-
final:
|
|
44
|
+
target: n
|
|
45
|
+
} = e, a = n;
|
|
46
|
+
g.current && e && e.key && e.key === "Escape" && (e.preventDefault(), a.focus(), p && (a.id !== "valueInitial" && c.current?.focus(), d(!1)), v && (a.id !== "valueFinal" && l.current?.focus(), o(!1)), M && (C(!1), l.current?.focus(), o(!1))), e.stopPropagation();
|
|
47
|
+
}, k = () => {
|
|
48
|
+
const e = D.current?.getBoundingClientRect(), n = e && e.bottom;
|
|
49
|
+
S && S.current && e && (S.current.style.top = String(n).concat("px"));
|
|
50
|
+
}, re = (e) => {
|
|
51
|
+
e === "valueInitial" && (te("valueInitial"), o(!1), p || (c.current?.focus(), I && setTimeout(() => {
|
|
52
|
+
z.current?.focus();
|
|
53
|
+
}, 100), d(!0))), e === "valueFinal" && (te("valueFinal"), d(!1), v || (l.current?.focus(), I && setTimeout(() => {
|
|
54
|
+
z.current?.focus();
|
|
55
|
+
}, 100), o(!0))), D.current && A(D.current.getBoundingClientRect());
|
|
56
|
+
}, Re = (e) => {
|
|
57
|
+
e === "valueInitial" && c.current?.focus(), e === "valueFinal" && l.current?.focus(), d(!1), o(!1);
|
|
58
|
+
}, oe = (e) => {
|
|
59
|
+
const n = e.initial ? e.initial.format("YYYY-MM-DD") : "", a = e.final ? e.final.format("YYYY-MM-DD") : "";
|
|
60
|
+
B.current = {
|
|
61
|
+
initial: n,
|
|
62
|
+
final: a
|
|
63
|
+
}, t?.onChange?.(void 0, "", {
|
|
64
|
+
initial: n,
|
|
65
|
+
final: a
|
|
62
66
|
});
|
|
63
|
-
},
|
|
67
|
+
}, U = (e) => {
|
|
64
68
|
setTimeout(() => {
|
|
65
|
-
e === "valueInitial" && (
|
|
69
|
+
e === "valueInitial" && (c.current?.focus(), d(!1)), e === "valueFinal" && (l.current?.focus(), o(!1)), e === "periodSelection" && (C(!1), l.current?.focus(), o(!1));
|
|
66
70
|
}, 100);
|
|
67
|
-
},
|
|
71
|
+
}, le = (e) => {
|
|
68
72
|
const {
|
|
69
|
-
name:
|
|
73
|
+
name: n
|
|
70
74
|
} = e.target;
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
+
De && re(n), t.onFocus && t.onFocus(e);
|
|
76
|
+
}, ae = (e) => {
|
|
77
|
+
t.onBlur && t.onBlur(e);
|
|
78
|
+
}, ue = (e) => {
|
|
75
79
|
if (e) {
|
|
76
80
|
const {
|
|
77
|
-
name:
|
|
78
|
-
value:
|
|
81
|
+
name: n,
|
|
82
|
+
value: a
|
|
79
83
|
} = e.target;
|
|
80
|
-
String(
|
|
84
|
+
String(a).trim().length === 0 && (n === "valueInitial" ? w(void 0) : F(void 0));
|
|
81
85
|
}
|
|
82
|
-
},
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
initial:
|
|
86
|
-
final:
|
|
87
|
-
})) : (
|
|
86
|
+
}, W = (e, n, a = !0) => {
|
|
87
|
+
const f = e ? e.target.name : "", b = Y(n, "DD/MM/YYYY");
|
|
88
|
+
p && c.current?.focus(), v && l.current?.focus(), f === "valueInitial" ? (w(b), oe({
|
|
89
|
+
initial: b,
|
|
90
|
+
final: u
|
|
91
|
+
})) : (F(b), oe({
|
|
88
92
|
initial: r,
|
|
89
|
-
final:
|
|
90
|
-
})),
|
|
91
|
-
},
|
|
93
|
+
final: b
|
|
94
|
+
})), f === "valueInitial" && !u && a && (l.current?.focus(), o(!0)), J && (d(!1), o(!1));
|
|
95
|
+
}, $ = () => {
|
|
92
96
|
const {
|
|
93
97
|
disabled: e
|
|
94
|
-
} =
|
|
98
|
+
} = t;
|
|
95
99
|
return e || m && (m.disabled || m.hideContent);
|
|
96
|
-
},
|
|
97
|
-
|
|
100
|
+
}, Be = he(() => y ? /* @__PURE__ */ i(ve, { boxShadow: !1, disabled: $(), customClass: "calendar-button", icon: /* @__PURE__ */ i(G, { name: "calendar" }), onClick: () => {
|
|
101
|
+
v || p ? Re(ne) : re(ne);
|
|
98
102
|
}, tabIndex: -1, targetRef: (e) => {
|
|
99
|
-
|
|
100
|
-
} }, "button-open") : null, [
|
|
101
|
-
o(!1), d(!1),
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
} }, "button-select-period"), [
|
|
107
|
-
g.current =
|
|
108
|
-
}, onDateChange: (
|
|
103
|
+
we.current = e;
|
|
104
|
+
} }, "button-open") : null, [v, p]), se = (e, n) => /* @__PURE__ */ i(je, { selected: e, handleOnSelect: n }), ye = () => {
|
|
105
|
+
o(!1), d(!1), C(!0), D.current && A(D.current.getBoundingClientRect());
|
|
106
|
+
}, Pe = () => {
|
|
107
|
+
C(!1), l.current?.focus(), o(!1);
|
|
108
|
+
}, Oe = he(() => /* @__PURE__ */ i(ve, { disabled: $(), tabIndex: -1, customClass: "calendar-button", icon: /* @__PURE__ */ i(G, { name: "more1" }), onBlur: () => setTimeout(() => C(!1), 100), onClick: () => M ? Pe() : ye(), targetRef: (e) => {
|
|
109
|
+
Fe.current = e;
|
|
110
|
+
} }, "button-select-period"), [M]), x = (e, n, a) => /* @__PURE__ */ i(Ee, { colorStyle: n, currentDate: e !== void 0 ? Y(e) : Y(), calendarContainer: (f) => {
|
|
111
|
+
g.current = f;
|
|
112
|
+
}, onDateChange: (f) => W({
|
|
109
113
|
target: {
|
|
110
|
-
name:
|
|
114
|
+
name: a
|
|
111
115
|
}
|
|
112
|
-
},
|
|
116
|
+
}, f), currentDateButton: (f) => z.current = f }), ce = (e, n) => {
|
|
113
117
|
if (e === "custom") {
|
|
114
|
-
|
|
118
|
+
c.current?.focus(), _(e), C(!1);
|
|
115
119
|
return;
|
|
116
120
|
}
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
}, children:
|
|
121
|
-
|
|
122
|
-
}, children:
|
|
123
|
-
|
|
124
|
-
}, children:
|
|
125
|
-
|
|
126
|
-
window.removeEventListener("resize",
|
|
127
|
-
}), []),
|
|
128
|
-
document.removeEventListener("keydown",
|
|
129
|
-
}), [
|
|
130
|
-
if (
|
|
131
|
-
w(
|
|
132
|
-
else if (
|
|
133
|
-
const e = r ? r.format("YYYY-MM-DD") : "",
|
|
134
|
-
n.
|
|
121
|
+
_(e), n && (w(n[0]), F(n[1])), J && C(!1), l.current?.focus(), o(!1);
|
|
122
|
+
}, ke = () => m && m.readOnly ? null : (g && g.current && (g.current.id = "valueInitial"), I ? /* @__PURE__ */ i(H, { handlerClose: () => U("valueInitial"), dialogSize: T, onOpenChange: d, children: x(r, P, "valueInitial") }) : /* @__PURE__ */ i(K, { containerRef: R, showButtonOpen: y, inputDimensions: q, dropdownRef: (e) => {
|
|
123
|
+
S.current = e;
|
|
124
|
+
}, children: x(r, P, "valueInitial") })), xe = () => m && m.readOnly ? null : (g && g.current && (g.current.id = "valueFinal"), I ? /* @__PURE__ */ i(H, { handlerClose: () => U("valueFinal"), dialogSize: T, onOpenChange: o, children: x(u, P, "valueFinal") }) : /* @__PURE__ */ i(K, { containerRef: R, showButtonOpen: y, inputDimensions: q, dropdownRef: (e) => {
|
|
125
|
+
S.current = e;
|
|
126
|
+
}, children: x(u, P, "valueFinal") })), Le = () => I ? /* @__PURE__ */ i(H, { handlerClose: () => U("periodSelection"), dialogSize: T, onOpenChange: C, children: se(Z, ce) }) : /* @__PURE__ */ i(K, { containerRef: R, showButtonOpen: y, inputDimensions: q, dropdownRef: (e) => {
|
|
127
|
+
S.current = e;
|
|
128
|
+
}, children: se(Z, ce) });
|
|
129
|
+
V(() => (window.addEventListener("resize", j), document.addEventListener("scroll", k), document.getElementById("modal-dialog-content")?.addEventListener("scroll", k), D.current && j(), c && c.current && (c.current.id = Se), l && l.current && (l.current.id = be), () => {
|
|
130
|
+
window.removeEventListener("resize", j), document.removeEventListener("scroll", k), document.getElementById("modal-dialog-content")?.removeEventListener("scroll", k);
|
|
131
|
+
}), []), V(() => (document.addEventListener("keydown", ie), () => {
|
|
132
|
+
document.removeEventListener("keydown", ie);
|
|
133
|
+
}), [v, p, M, g.current]), V(() => {
|
|
134
|
+
if (u && r && Y(u).isBefore(Y(r)))
|
|
135
|
+
w(u), F(r);
|
|
136
|
+
else if (t.onChange && !N.current) {
|
|
137
|
+
const e = r ? r.format("YYYY-MM-DD") : "", n = u ? u.format("YYYY-MM-DD") : "";
|
|
138
|
+
(!B.current || B.current.initial !== e || B.current.final !== n) && (B.current = {
|
|
135
139
|
initial: e,
|
|
136
|
-
final:
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}, [r, s]), L(() => {
|
|
140
|
-
if (n.value && !(l(n.value.initial).isSame(r) || l(n.value.final).isSame(s))) {
|
|
141
|
-
const {
|
|
140
|
+
final: n
|
|
141
|
+
}, t.onChange(void 0, "", {
|
|
142
142
|
initial: e,
|
|
143
|
-
final:
|
|
144
|
-
}
|
|
145
|
-
let u, c;
|
|
146
|
-
l(e, "YYYY-MM-DD", !0).isValid() && (u = l(e, "YYYY-MM-DD")), l(t, "YYYY-MM-DD", !0).isValid() && (c = l(t, "YYYY-MM-DD")), w(u), M(c);
|
|
143
|
+
final: n
|
|
144
|
+
}));
|
|
147
145
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
N.current = !1;
|
|
147
|
+
}, [r, u]);
|
|
148
|
+
const fe = t.value?.initial?.toString() ?? "", de = t.value?.final?.toString() ?? "";
|
|
149
|
+
if (V(() => {
|
|
150
|
+
const e = E(fe), n = E(de), a = r?.format("YYYY-MM-DD") ?? "", f = u?.format("YYYY-MM-DD") ?? "", b = e?.format("YYYY-MM-DD") ?? "", Ve = n?.format("YYYY-MM-DD") ?? "";
|
|
151
|
+
(a !== b || f !== Ve) && (N.current = !0, w(e), F(n));
|
|
152
|
+
}, [fe, de]), m && m.unvisible) return null;
|
|
153
|
+
const me = () => /* @__PURE__ */ L("div", { ref: R, onBlur: Me, className: "input-base-component datepicker-period-container", children: [
|
|
154
|
+
t.label && /* @__PURE__ */ L("div", { className: "labelcontainer", children: [
|
|
155
|
+
/* @__PURE__ */ i(Ce, { required: t.required, className: t.customClassForLabel, labelUppercase: t.labelUppercase }),
|
|
152
156
|
/* @__PURE__ */ i("div", { className: "text-content", style: {
|
|
153
157
|
display: "flex"
|
|
154
|
-
}, children: /* @__PURE__ */
|
|
158
|
+
}, children: /* @__PURE__ */ L("div", { className: `label ${t.customClassForLabel} ${t.labelUppercase && " -uppercase"}`, style: {
|
|
155
159
|
alignSelf: "center"
|
|
156
160
|
}, children: [
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
!!
|
|
161
|
+
t.label,
|
|
162
|
+
t.required && /* @__PURE__ */ i("span", { className: "-requiredlabel", children: "*" }),
|
|
163
|
+
!!O && Q === "onLabelRight" && /* @__PURE__ */ i(Ne, { theme: Ye, align: Ie, iconColor: "#03bde2", customClass: "-hint", style: {
|
|
160
164
|
margin: "0px 5px",
|
|
161
165
|
height: "auto",
|
|
162
166
|
width: 20
|
|
163
|
-
}, children:
|
|
167
|
+
}, children: O })
|
|
164
168
|
] }) }),
|
|
165
|
-
/* @__PURE__ */ i(
|
|
169
|
+
/* @__PURE__ */ i(Ce, {})
|
|
166
170
|
] }),
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
...
|
|
169
|
-
value: r ?
|
|
170
|
-
disabled:
|
|
171
|
-
})}`, ref:
|
|
172
|
-
/* @__PURE__ */ i(
|
|
173
|
-
|
|
174
|
-
}, onFocus:
|
|
175
|
-
|
|
171
|
+
/* @__PURE__ */ L("div", { className: `periodpicker-component ${Ae({
|
|
172
|
+
...t,
|
|
173
|
+
value: r ? Y(r).format("DD/MM/YYYY") : "",
|
|
174
|
+
disabled: $()
|
|
175
|
+
})}`, ref: D, children: [
|
|
176
|
+
/* @__PURE__ */ i(pe, { autoComplete: "off", gridLayout: void 0, permissionAttr: t.permissionAttr, name: "valueInitial", value: r ? Y(r).format("DD/MM/YYYY") : "", mask: "00/00/0000", onComplete: (e) => {
|
|
177
|
+
W(e, e.target.value, !0);
|
|
178
|
+
}, onFocus: le, onBlur: (e) => ae(e), onChange: ue, inputRef: (e) => {
|
|
179
|
+
c.current = e;
|
|
176
180
|
}, handlerSetOnDenied: (e) => {
|
|
177
|
-
|
|
178
|
-
}, required:
|
|
179
|
-
/* @__PURE__ */ i(
|
|
180
|
-
/* @__PURE__ */ i(
|
|
181
|
-
|
|
182
|
-
}, onFocus:
|
|
183
|
-
|
|
184
|
-
}, handlerSetOnDenied: (e) =>
|
|
185
|
-
|
|
186
|
-
|
|
181
|
+
ee(e);
|
|
182
|
+
}, required: t.required }),
|
|
183
|
+
/* @__PURE__ */ i(G, { name: "arrow_right", customClass: "separation_icon" }),
|
|
184
|
+
/* @__PURE__ */ i(pe, { autoComplete: "off", gridLayout: void 0, permissionAttr: t.permissionAttr, name: "valueFinal", value: u ? Y(u).format("DD/MM/YYYY") : "", mask: "00/00/0000", onComplete: (e) => {
|
|
185
|
+
W(e, e.target.value, !0);
|
|
186
|
+
}, onFocus: le, onBlur: (e) => ae(e), onChange: ue, inputRef: (e) => {
|
|
187
|
+
l.current = e;
|
|
188
|
+
}, handlerSetOnDenied: (e) => ee(e), required: t.required }),
|
|
189
|
+
Be(),
|
|
190
|
+
Oe()
|
|
187
191
|
] }),
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
/* @__PURE__ */ i(
|
|
192
|
-
/* @__PURE__ */ i(
|
|
192
|
+
p && ke(),
|
|
193
|
+
v && xe(),
|
|
194
|
+
M && Le(),
|
|
195
|
+
/* @__PURE__ */ i(Te, { visible: !!O && Q === "below", customClass: "hint", description: O }),
|
|
196
|
+
/* @__PURE__ */ i(ze, { messages: t.errorMessages })
|
|
193
197
|
] });
|
|
194
|
-
return
|
|
198
|
+
return X ? /* @__PURE__ */ i(qe, { customClass: "-withinput", cols: X, children: me() }) : me();
|
|
195
199
|
};
|
|
196
200
|
export {
|
|
197
|
-
|
|
201
|
+
cn as default
|
|
198
202
|
};
|
|
199
203
|
//# sourceMappingURL=index.js.map
|