@owp/core 2.5.17 → 2.5.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/_virtual/index10.js +2 -2
  2. package/dist/_virtual/index12.js +2 -2
  3. package/dist/_virtual/index13.js +2 -2
  4. package/dist/_virtual/index14.js +2 -2
  5. package/dist/_virtual/index15.js +2 -2
  6. package/dist/_virtual/index5.js +2 -2
  7. package/dist/components/OwpPicker/OwpTimePicker.js +149 -133
  8. package/dist/components/OwpPicker/OwpTimePicker.js.map +1 -1
  9. package/dist/components/OwpTreeGrid/OwpTreeGrid.js +273 -224
  10. package/dist/components/OwpTreeGrid/OwpTreeGrid.js.map +1 -1
  11. package/dist/components/OwpTreeGrid/internal/hooks/useOwpTreeGridDatePickerEditor.js +442 -108
  12. package/dist/components/OwpTreeGrid/internal/hooks/useOwpTreeGridDatePickerEditor.js.map +1 -1
  13. package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js +276 -195
  14. package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js.map +1 -1
  15. package/dist/components/OwpTreeGrid/internal/treeGridTheme.js +201 -117
  16. package/dist/components/OwpTreeGrid/internal/treeGridTheme.js.map +1 -1
  17. package/dist/constants/gridTheme.js +7 -6
  18. package/dist/constants/gridTheme.js.map +1 -1
  19. package/dist/constants/treeGrid.js +27 -26
  20. package/dist/constants/treeGrid.js.map +1 -1
  21. package/dist/constants.js +23 -22
  22. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/constants.js +1 -1
  23. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/index.js +1 -1
  24. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE39/index.js +1 -1
  25. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/constants.js +1 -1
  26. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/index.js +1 -1
  27. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js +1 -1
  28. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js +1 -1
  29. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/index.js +1 -1
  30. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/MSI/index.js +1 -1
  31. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/codabar/index.js +1 -1
  32. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/pharmacode/index.js +1 -1
  33. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/renderers/index.js +1 -1
  34. package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +1 -1
  35. package/dist/owp-app.css +1 -1
  36. package/dist/types/components/OwpPicker/OwpTimePicker.d.ts +3 -1
  37. package/dist/types/components/OwpTreeGrid/OwpTreeGrid.d.ts +6 -6
  38. package/dist/types/components/OwpTreeGrid/internal/hooks/useOwpTreeGridDatePickerEditor.d.ts +3 -0
  39. package/dist/types/components/OwpTreeGrid/internal/treeGridRuntime.d.ts +33 -7
  40. package/dist/types/components/OwpTreeGrid/internal/treeGridTheme.d.ts +1 -1
  41. package/dist/types/constants/gridTheme.d.ts +2 -0
  42. package/dist/types/constants/treeGrid.d.ts +2 -1
  43. package/dist/types/types/OwpGridThemeTypes.d.ts +1 -0
  44. package/dist/types/utils/index.d.ts +0 -1
  45. package/dist/types/utils/treeGridUtil.d.ts +27 -0
  46. package/dist/utils/treeGridUtil.js +163 -108
  47. package/dist/utils/treeGridUtil.js.map +1 -1
  48. package/dist/utils.js +85 -83
  49. package/dist/utils.js.map +1 -1
  50. package/package.json +1 -1
  51. package/dist/components/OwpTreeGrid/internal/treeGridColumnEditRules.js +0 -84
  52. package/dist/components/OwpTreeGrid/internal/treeGridColumnEditRules.js.map +0 -1
  53. package/dist/types/components/OwpTreeGrid/internal/treeGridColumnEditRules.d.ts +0 -60
  54. package/dist/types/utils/normalizeTimeToHourMinute.d.ts +0 -11
  55. package/dist/utils/normalizeTimeToHourMinute.js +0 -34
  56. package/dist/utils/normalizeTimeToHourMinute.js.map +0 -1
@@ -1,117 +1,344 @@
1
- var K = Object.defineProperty;
2
- var l = (e, a) => K(e, "name", { value: a, configurable: !0 });
3
- import { jsx as T } from "../../../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
4
- import { VALUE_TIME_FORMATTER as b, VALUE_DATE_FORMATTER as _ } from "../../../OwpPicker/constants/index.js";
5
- import { useOwpTranslation as U } from "../../../../hooks/useOwpTranslation.js";
6
- import $ from "@mui/material/ClickAwayListener";
7
- import j from "@mui/material/Paper";
8
- import V from "@mui/material/Popper";
9
- import { enUS as z } from "../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US.js";
10
- import { ko as H } from "../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/ko.js";
11
- import w from "dayjs";
12
- import { useState as N, useMemo as c, useEffect as y, useCallback as v } from "react";
13
- import { DatePicker as q, registerLocale as L, setDefaultLocale as J } from "../../../../node_modules/.pnpm/react-datepicker@8.7.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-datepicker/dist/index.es.js";
14
- L("ko", H);
15
- L("en", z);
16
- J("ko");
17
- const Q = `${_} ${b}`, S = "", W = "OwpTreeGridDatePickerEditor", X = /* @__PURE__ */ l((e) => (e == null ? void 0 : e.enabled) !== !1, "isDatePickerEditorEnabled"), Y = /* @__PURE__ */ l((e, a, o) => !(o != null && o.showTimeInput) && !(o != null && o.showTimeSelect) ? _ : a.size === 0 || a.has(e) ? Q : _, "getDatePickerEditorValueFormatter"), k = /* @__PURE__ */ l((e) => e === 1 || e === "1", "isTreeGridCanEditEnabled"), Z = /* @__PURE__ */ l((e) => e === 0 || e === "0" || e === !1, "isTreeGridCanEditDisabled"), f = /* @__PURE__ */ l((e) => !e || e.Fixed === "Foot" ? !1 : e.Kind === "Data" || k(e.Added), "isDisplayTreeGridRow"), g = /* @__PURE__ */ l((e, a, o, d) => {
18
- var u;
19
- if (d.size > 0 && !d.has(o))
1
+ var Ht = Object.defineProperty;
2
+ var l = (t, r) => Ht(t, "name", { value: r, configurable: !0 });
3
+ import { jsx as I, jsxs as Kt } from "../../../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
4
+ import { VALUE_TIME_FORMATTER as v, VALUE_DATE_FORMATTER as T, VALUE_MONTH_FORMATTER as A, VALUE_YEAR_FORMATTER as Y } from "../../../OwpPicker/constants/index.js";
5
+ import { useOwpTranslation as $t } from "../../../../hooks/useOwpTranslation.js";
6
+ import { ensureDayjsBrowserSetup as Bt } from "../../../../utils/dayjsBrowser.js";
7
+ import Gt from "../../../../node_modules/.pnpm/@mui_icons-material@7.3.9_@mui_material@7.3.9_@emotion_react@11.14.0_@types_react@19.2._dc2be6bc014bebdac88a574e3e02c144/node_modules/@mui/icons-material/esm/Clear.js";
8
+ import jt from "@mui/material/ClickAwayListener";
9
+ import zt from "@mui/material/IconButton";
10
+ import Ut from "@mui/material/InputAdornment";
11
+ import Vt from "@mui/material/Paper";
12
+ import Wt from "@mui/material/Popper";
13
+ import Nt from "@mui/material/TextField";
14
+ import { LocalizationProvider as gt, MultiSectionDigitalClock as qt } from "@mui/x-date-pickers";
15
+ import { AdapterDayjs as Xt } from "@mui/x-date-pickers/AdapterDayjs";
16
+ import { enUS as Jt } from "../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US.js";
17
+ import { ko as Qt } from "../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/ko.js";
18
+ import R from "dayjs";
19
+ import { useState as it, useRef as st, useMemo as M, useEffect as U, useCallback as _ } from "react";
20
+ import { DatePicker as Zt, registerLocale as mt, setDefaultLocale as te } from "../../../../node_modules/.pnpm/react-datepicker@8.7.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-datepicker/dist/index.es.js";
21
+ mt("ko", Qt);
22
+ mt("en", Jt);
23
+ te("ko");
24
+ Bt();
25
+ const H = `${T} ${v}`, O = `${v}:ss`, b = `${T} ${O}`, at = "", pt = "OwpTreeGridDatePickerEditor", ee = "OwpTreeGridTimePickerEditor", ne = '<span class="OwpTreeGridTimePickerEditorIcon" aria-hidden="true"></span>', N = "MM", g = "DD", V = 64, lt = 56, ct = /* @__PURE__ */ new Map([
26
+ ["yyyy", Y],
27
+ ["YYYY", Y],
28
+ ["mm", N],
29
+ ["MM", N],
30
+ ["dd", g],
31
+ ["DD", g],
32
+ ["yyyy-mm", A],
33
+ ["YYYY-MM", A],
34
+ ["yyyy-mm-dd", T],
35
+ ["YYYY-MM-DD", T],
36
+ ["HH:mm", v],
37
+ ["HH:mm:ss", O],
38
+ ["yyyy-mm-dd HH:mm", H],
39
+ ["YYYY-MM-DD HH:mm", H],
40
+ ["yyyy-mm-dd HH:mm:ss", b],
41
+ ["YYYY-MM-DD HH:mm:ss", b]
42
+ ]), re = {
43
+ "&:hover": {
44
+ backgroundColor: "var(--owp-datepicker-hover-bg, rgba(3, 155, 229, 0.14))"
45
+ },
46
+ "&.Mui-selected": {
47
+ backgroundColor: "var(--owp-datepicker-selected-bg, #039be5)",
48
+ color: "var(--owp-datepicker-selected-color, #fff)",
49
+ "&:focus-visible, &:hover": {
50
+ backgroundColor: "var(--owp-datepicker-selected-hover-bg, #039be5)"
51
+ }
52
+ }
53
+ }, oe = /* @__PURE__ */ l((t) => (t == null ? void 0 : t.enabled) !== !1, "isDatePickerEditorEnabled"), ie = /* @__PURE__ */ l((t) => t == null ? void 0 : t.trim().replace(/\s+/g, " "), "normalizeTreeGridDateFormat"), Et = /* @__PURE__ */ l((t) => {
54
+ const r = ie(t);
55
+ return r ? ct.get(r) ?? ct.get(r.toLowerCase()) ?? null : null;
56
+ }, "convertTreeGridDateFormatToDayjs"), q = /* @__PURE__ */ l((t) => {
57
+ switch (t) {
58
+ case Y:
59
+ return { kind: "year", valueFormat: t, inputLength: 4, digitLength: 4 };
60
+ case N:
61
+ return { kind: "month", valueFormat: t, inputLength: 2, digitLength: 2 };
62
+ case A:
63
+ return { kind: "yearMonth", valueFormat: t, inputLength: 7, digitLength: 6 };
64
+ case g:
65
+ return { kind: "day", valueFormat: t, inputLength: 2, digitLength: 2 };
66
+ case v:
67
+ return { kind: "time", valueFormat: t, inputLength: 5, digitLength: 4 };
68
+ case O:
69
+ return { kind: "time", valueFormat: t, inputLength: 8, digitLength: 6 };
70
+ case H:
71
+ return { kind: "dateTime", valueFormat: t, inputLength: 16, digitLength: 12 };
72
+ case b:
73
+ return { kind: "dateTime", valueFormat: t, inputLength: 19, digitLength: 14 };
74
+ default:
75
+ return { kind: "date", valueFormat: t, inputLength: 10, digitLength: 8 };
76
+ }
77
+ }, "getDatePickerEditorFormatMeta"), se = /* @__PURE__ */ l((t, r) => {
78
+ var e;
79
+ if (!t)
80
+ return q(T);
81
+ const o = t.row, i = (e = t.grid.Cols) == null ? void 0 : e[t.col], c = o[`${t.col}EditFormat`] ?? o[`${t.col}Format`] ?? (i == null ? void 0 : i.EditFormat) ?? (i == null ? void 0 : i.Format), s = Et(typeof c == "string" ? c : void 0) ?? (r != null && r.showTimeInput || r != null && r.showTimeSelect ? H : T);
82
+ return q(s);
83
+ }, "resolveDatePickerEditorFormatMeta"), ae = /* @__PURE__ */ l((t, r) => {
84
+ const o = t.replace(/\D/g, "").slice(0, r.digitLength), i = o.slice(0, 4), c = o.slice(4, 6), s = o.slice(6, 8), e = o.slice(8, 10), E = o.slice(10, 12), m = o.slice(12, 14);
85
+ switch (r.kind) {
86
+ case "year":
87
+ case "month":
88
+ case "day":
89
+ return o;
90
+ case "yearMonth":
91
+ return [i, c].filter(Boolean).join("-");
92
+ case "time":
93
+ return [o.slice(0, 2), o.slice(2, 4), o.slice(4, 6)].filter(Boolean).join(":");
94
+ case "dateTime":
95
+ return [i, c, s].filter(Boolean).join("-") + (e ? ` ${e}` : "") + (E ? `:${E}` : "") + (m ? `:${m}` : "");
96
+ default:
97
+ return [i, c, s].filter(Boolean).join("-");
98
+ }
99
+ }, "formatDatePickerEditorInput"), Dt = /* @__PURE__ */ l((t, r) => t.length === r.inputLength, "isCompleteDatePickerEditorInput"), kt = /* @__PURE__ */ l((t, r, o, i) => {
100
+ var c, s, e, E;
101
+ return o.kind === "month" ? `${((s = (c = i == null ? void 0 : i.columnOptions) == null ? void 0 : c[t]) == null ? void 0 : s.baseYear) ?? R().format(Y)}-${r}` : o.kind === "day" ? `${((E = (e = i == null ? void 0 : i.columnOptions) == null ? void 0 : e[t]) == null ? void 0 : E.baseYearMonth) ?? R().format(A)}-${r}` : r;
102
+ }, "resolvePartialDatePickerEditorInputValue"), yt = /* @__PURE__ */ l((t) => t.kind === "month" ? A : t.kind === "day" ? T : t.valueFormat, "resolvePartialDatePickerEditorInputFormat"), ut = /* @__PURE__ */ l((t, r, o, i) => {
103
+ if (!r)
104
+ return null;
105
+ if (o.kind === "year") {
106
+ const s = R(`${r}-01-01`, T, !0);
107
+ return s.isValid() ? s : null;
108
+ }
109
+ if (o.kind === "yearMonth") {
110
+ const s = R(`${r}-01`, T, !0);
111
+ return s.isValid() ? s : null;
112
+ }
113
+ const c = R(
114
+ kt(t, r, o, i),
115
+ yt(o),
116
+ !0
117
+ );
118
+ return c.isValid() ? c : null;
119
+ }, "parseDatePickerEditorValue"), le = /* @__PURE__ */ l((t) => {
120
+ switch (t.kind) {
121
+ case "year":
122
+ return "yyyy";
123
+ case "month":
124
+ return "MM";
125
+ case "yearMonth":
126
+ return "yyyy-MM";
127
+ case "day":
128
+ return "dd";
129
+ case "dateTime":
130
+ return t.valueFormat === b ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd HH:mm";
131
+ default:
132
+ return "yyyy-MM-dd";
133
+ }
134
+ }, "getReactDatePickerDisplayFormat"), W = /* @__PURE__ */ l((t, r, o, i) => Dt(r, o) && R(
135
+ kt(t, r, o, i),
136
+ yt(o),
137
+ !0
138
+ ).isValid(), "isValidDatePickerEditorInput"), dt = /* @__PURE__ */ l((t) => t.valueFormat === O || t.valueFormat === b, "hasDatePickerEditorSeconds"), ce = /* @__PURE__ */ l((t, r) => {
139
+ const o = (t == null ? void 0 : t.split(/\s+/).filter(Boolean)) ?? [];
140
+ return o.includes(r) ? t : [...o, r].join(" ");
141
+ }, "appendTreeGridClass"), ue = /* @__PURE__ */ l((t, r, o, i) => {
142
+ var m, C, w, k;
143
+ const c = (m = t.GetStringEdit) == null ? void 0 : m.call(t, r, o), s = (C = t.GetString) == null ? void 0 : C.call(t, r, o), e = (w = t.GetValue) == null ? void 0 : w.call(t, r, o), E = (k = i.textContent) == null ? void 0 : k.trim();
144
+ return String(c || s || E || e || "");
145
+ }, "resolveDatePickerEditorInitialValue"), de = /* @__PURE__ */ l((t, r) => {
146
+ const o = r;
147
+ return o.ctrlKey || o.altKey || o.metaKey ? !1 : /^\d$/.test(t) || /^\d$/.test(o.key) || t === "Enter" || t === "F2" || t === "Backspace" || t === "Delete" || o.key === "Enter" || o.key === "F2" || o.key === "Backspace" || o.key === "Delete";
148
+ }, "isDatePickerEditorStartKey"), me = /* @__PURE__ */ l((t) => {
149
+ const r = t.target;
150
+ return r instanceof Element && !!r.closest(`.${pt}`);
151
+ }, "isDatePickerEditorEventTarget"), K = /* @__PURE__ */ l((t) => t === 1 || t === "1", "isTreeGridCanEditEnabled"), pe = /* @__PURE__ */ l((t) => t === 0 || t === "0" || t === !1, "isTreeGridCanEditDisabled"), Ee = /* @__PURE__ */ l((t) => !t || t.Fixed === "Foot" ? !1 : t.Kind === "Data" || K(t.Added), "isDisplayTreeGridRow"), x = /* @__PURE__ */ l((t, r, o, i) => {
152
+ var m;
153
+ if (i.size > 0 && !i.has(o))
20
154
  return !1;
21
- const s = (u = e.Cols) == null ? void 0 : u[o], n = a[`${o}CanEdit`], t = n != null, p = k(t ? n : s == null ? void 0 : s.CanEdit);
22
- return (s == null ? void 0 : s.Type) === "Date" && f(a) && !Z(a.CanEdit) && p && a.Deleted !== 1;
23
- }, "isEditableDatePickerCell"), ee = /* @__PURE__ */ l((e, a) => {
24
- var d;
25
- if (!e)
155
+ const c = (m = t.Cols) == null ? void 0 : m[o], s = r[`${o}CanEdit`], e = s != null, E = K(e ? s : c == null ? void 0 : c.CanEdit);
156
+ return (c == null ? void 0 : c.Type) === "Date" && Ee(r) && !pe(r.CanEdit) && E && r.Deleted !== 1;
157
+ }, "isEditableDatePickerCell"), De = /* @__PURE__ */ l((t, r) => {
158
+ var i;
159
+ if (!t)
26
160
  return;
27
- (a.length > 0 ? a : Object.keys(e.Cols ?? {}).filter((s) => {
28
- var n, t;
29
- return ((t = (n = e.Cols) == null ? void 0 : n[s]) == null ? void 0 : t.Type) === "Date";
30
- })).forEach((s) => {
31
- var t;
32
- const n = (t = e.Cols) == null ? void 0 : t[s];
33
- !n || n.Type !== "Date" || !k(n.CanEdit) || (n.Button = "Date", n.OnClickSideDate = "Focus", n.AutoCalendar = 0, n.CalendarButtons = 0);
34
- }), (d = e.Rerender) == null || d.call(e, 1, 1);
35
- }, "configureTreeGridDatePickerColumns"), ke = /* @__PURE__ */ l(({
36
- config: e,
37
- treeGridInstanceRef: a,
161
+ (r.length > 0 ? r : Object.keys(t.Cols ?? {}).filter((c) => {
162
+ var s, e;
163
+ return ((e = (s = t.Cols) == null ? void 0 : s[c]) == null ? void 0 : e.Type) === "Date";
164
+ })).forEach((c) => {
165
+ var m;
166
+ const s = (m = t.Cols) == null ? void 0 : m[c];
167
+ if (!s || s.Type !== "Date" || !K(s.CanEdit))
168
+ return;
169
+ s.AutoCalendar = 0, s.CalendarButtons = 0;
170
+ const e = s.EditFormat ?? s.Format, E = Et(typeof e == "string" ? e : void 0) ?? T;
171
+ q(E).kind === "time" ? (s.Button = "Html", s.ButtonText = ne, s.OnClickSide = "Focus", s.Class = ce(s.Class, ee)) : (s.Button = "Date", s.OnClickSideDate = "Focus");
172
+ }), (i = t.Rerender) == null || i.call(t, 1, 1);
173
+ }, "configureTreeGridDatePickerColumns"), Ye = /* @__PURE__ */ l(({
174
+ config: t,
175
+ treeGridInstanceRef: r,
38
176
  isTreeGridReady: o,
39
- onValueChange: d
177
+ onValueChange: i
40
178
  }) => {
41
- var R;
42
- const { t: s, i18n: n } = U(), [t, p] = N(null), u = X(e), D = ((R = e == null ? void 0 : e.columns) == null ? void 0 : R.join(S)) ?? "", C = c(
43
- () => D ? D.split(S) : [],
44
- [D]
45
- ), h = c(() => new Set(C), [C]), O = (n.resolvedLanguage ?? n.language ?? "kr") === "kr" ? "ko" : "en";
46
- y(() => {
47
- !u || !o || ee(a.current, C);
48
- }, [C, u, o, a]);
49
- const m = v(() => {
50
- p(null);
51
- }, []), F = v(
52
- (r, i, E, ne, ae, A) => {
53
- if (!u || !g(r, i, E, h)) {
54
- m();
179
+ var rt;
180
+ const { t: c, i18n: s } = $t(), [e, E] = it(null), [m, C] = it(""), w = st(null), k = st(!1), y = oe(t), $ = ((rt = t == null ? void 0 : t.columns) == null ? void 0 : rt.join(at)) ?? "", S = M(
181
+ () => $ ? $.split(at) : [],
182
+ [$]
183
+ ), P = M(() => new Set(S), [S]), X = s.resolvedLanguage ?? s.language ?? "kr", Tt = X === "kr" ? "ko" : "en", ht = X === "kr" ? "ko" : "en", B = (t == null ? void 0 : t.allowInput) !== !1, u = M(
184
+ () => se(e, t),
185
+ [t, e]
186
+ );
187
+ U(() => {
188
+ !y || !o || De(r.current, S);
189
+ }, [S, y, o, r]);
190
+ const h = _(() => {
191
+ E(null);
192
+ }, []), f = _(
193
+ (n, a, d) => {
194
+ const p = n.GetCell(a, d);
195
+ if (!p)
196
+ return;
197
+ const D = {
198
+ grid: n,
199
+ row: a,
200
+ col: d,
201
+ anchorRect: p.getBoundingClientRect(),
202
+ value: ue(n, a, d, p)
203
+ };
204
+ return k.current = !1, C(D.value ?? ""), E(D), 1;
205
+ },
206
+ []
207
+ ), It = _(
208
+ (n, a, d, p, D, L) => {
209
+ var ot;
210
+ if (!y || !x(n, a, d, P)) {
211
+ h();
55
212
  return;
56
213
  }
57
- const I = r.GetCell(i, E);
58
- if (I)
59
- return A.preventDefault(), A.stopPropagation(), p({
60
- grid: r,
61
- row: i,
62
- col: E,
63
- anchorRect: I.getBoundingClientRect(),
64
- value: r.GetString(i, E) || r.GetValue(i, E)
65
- }), 1;
214
+ return (ot = n.CloseDialog) == null || ot.call(n), L.preventDefault(), L.stopPropagation(), f(n, a, d);
215
+ },
216
+ [h, P, y, f]
217
+ ), _t = _(
218
+ (n, a, d, p) => {
219
+ var D;
220
+ if (!(!y || !x(n, a, d, P)))
221
+ return (D = n.CloseDialog) == null || D.call(n), p.preventDefault(), p.stopPropagation(), f(n, a, d);
66
222
  },
67
- [m, h, u]
68
- ), M = c(() => {
69
- if (!(t != null && t.value))
223
+ [P, y, f]
224
+ ), Rt = _(
225
+ (n, a, d) => {
226
+ var L;
227
+ if (me(d))
228
+ return 1;
229
+ const p = n.FRow || n.ARow, D = n.FCol || n.ACol;
230
+ if (!(!y || !p || !D || !x(n, p, D, P) || !de(a, d)))
231
+ return (L = n.CloseDialog) == null || L.call(n), d.preventDefault(), d.stopPropagation(), f(n, p, D);
232
+ },
233
+ [P, y, f]
234
+ ), Ct = _(
235
+ (n, a, d) => {
236
+ var p;
237
+ if (!(!y || !x(n, a, d, P)))
238
+ return (p = n.CloseDialog) == null || p.call(n), f(n, a, d), !0;
239
+ },
240
+ [P, y, f]
241
+ ), Pt = M(() => {
242
+ var a;
243
+ if (!e || u.kind === "time")
244
+ return null;
245
+ const n = W(
246
+ e.col,
247
+ m,
248
+ u,
249
+ t
250
+ ) ? ut(e.col, m, u, t) : null;
251
+ return n ? n.toDate() : ((a = ut(
252
+ e.col,
253
+ e.value,
254
+ u,
255
+ t
256
+ )) == null ? void 0 : a.toDate()) ?? null;
257
+ }, [t, e, u, m]), ft = M(() => {
258
+ if (u.kind !== "time")
70
259
  return null;
71
- const r = w(t.value);
72
- return r.isValid() ? r.toDate() : null;
73
- }, [t == null ? void 0 : t.value]), x = c(() => t ? {
74
- getBoundingClientRect: /* @__PURE__ */ l(() => t.anchorRect, "getBoundingClientRect")
75
- } : null, [t]), G = c(() => {
260
+ const n = R(m, u.valueFormat, !0);
261
+ if (n.isValid())
262
+ return n;
263
+ if (!(e != null && e.value))
264
+ return null;
265
+ const a = R(e.value, u.valueFormat, !0);
266
+ return a.isValid() ? a : null;
267
+ }, [e == null ? void 0 : e.value, u, m]), Mt = M(() => e ? {
268
+ getBoundingClientRect: /* @__PURE__ */ l(() => e.anchorRect, "getBoundingClientRect")
269
+ } : null, [e]), wt = M(() => {
76
270
  if (!(typeof document > "u"))
77
271
  return document.getElementById("calendar-portal") ?? void 0;
78
- }, []), B = /* @__PURE__ */ l((r) => {
79
- if (!t)
272
+ }, []), Ft = /* @__PURE__ */ l((n) => {
273
+ if (!e)
274
+ return;
275
+ const a = n ? R(n).format(u.valueFormat) : "";
276
+ k.current = !0, C(a), e.grid.SetString(e.row, e.col, a, 1), i == null || i(e.grid, e.row, e.col, a), h();
277
+ }, "handleDateSelect"), Lt = /* @__PURE__ */ l((n, a) => {
278
+ if (!e)
80
279
  return;
81
- const i = r ? w(r).format(Y(t.col, h, e)) : "";
82
- t.grid.SetString(t.row, t.col, i, 1), d == null || d(t.grid, t.row, t.col, i), m();
83
- }, "handleSelect"), P = /* @__PURE__ */ l((r) => {
84
- r.stopPropagation();
85
- }, "handleEditorMouseEvent");
86
- return y(() => {
87
- if (!t)
280
+ const d = n != null && n.isValid() ? n.format(u.valueFormat) : "", p = a === (dt(u) ? "seconds" : "minutes");
281
+ p && (k.current = !0), C(d), e.grid.SetString(e.row, e.col, d, 1), i == null || i(e.grid, e.row, e.col, d), E((D) => D && { ...D, value: d }), p && h();
282
+ }, "handleTimeSelect"), J = _(
283
+ (n) => {
284
+ e && (e.grid.SetString(e.row, e.col, n, 1), i == null || i(e.grid, e.row, e.col, n));
285
+ },
286
+ [e, i]
287
+ ), G = _(() => !e || !W(e.col, m, u, t) ? !1 : (k.current = !0, J(m), !0), [J, t, e, u, m]), At = _(() => {
288
+ G(), h();
289
+ }, [h, G]), bt = /* @__PURE__ */ l((n) => {
290
+ e && C(ae(n.target.value, u));
291
+ }, "handleInputChange"), vt = /* @__PURE__ */ l((n) => {
292
+ n.stopPropagation(), n.nativeEvent.stopImmediatePropagation(), !(n.key !== "Enter" || !e) && G() && h();
293
+ }, "handleInputKeyDown"), Ot = /* @__PURE__ */ l((n) => {
294
+ n.preventDefault(), n.stopPropagation(), e && (k.current = !0, e.grid.SetString(e.row, e.col, "", 1), i == null || i(e.grid, e.row, e.col, ""), C(""), E((a) => a && { ...a, value: "" }));
295
+ }, "handleInputClear"), Q = /* @__PURE__ */ l((n) => {
296
+ n.stopPropagation();
297
+ }, "handleEditorMouseEvent"), Z = /* @__PURE__ */ l((n) => {
298
+ n.stopPropagation(), n.nativeEvent.stopImmediatePropagation();
299
+ }, "handleEditorKeyboardEvent"), F = m, tt = e == null ? void 0 : e.grid, et = e == null ? void 0 : e.row, nt = e == null ? void 0 : e.col, St = !k.current && !!F && Dt(F, u) && !W((e == null ? void 0 : e.col) ?? "", F, u, t), j = dt(u), z = V * (j ? 3 : 2), xt = j ? ["hours", "minutes", "seconds"] : ["hours", "minutes"], Yt = j ? O : v;
300
+ return U(() => {
301
+ if (!e)
88
302
  return;
89
- const r = /* @__PURE__ */ l((i) => {
90
- i.key === "Escape" && m();
303
+ const n = /* @__PURE__ */ l((a) => {
304
+ a.key === "Escape" && h();
91
305
  }, "handleKeyDown");
92
- return window.addEventListener("keydown", r), () => {
93
- window.removeEventListener("keydown", r);
306
+ return window.addEventListener("keydown", n), () => {
307
+ window.removeEventListener("keydown", n);
94
308
  };
95
- }, [m, t]), {
96
- datePickerEditorElement: t ? /* @__PURE__ */ T(
97
- V,
309
+ }, [h, e]), U(() => {
310
+ if (!tt || !et || !nt || !B)
311
+ return;
312
+ const n = window.requestAnimationFrame(() => {
313
+ var a;
314
+ (a = w.current) == null || a.focus();
315
+ });
316
+ return () => {
317
+ window.cancelAnimationFrame(n);
318
+ };
319
+ }, [B, nt, tt, et]), {
320
+ datePickerEditorElement: e ? /* @__PURE__ */ I(
321
+ Wt,
98
322
  {
99
323
  open: !0,
100
- anchorEl: x,
101
- container: G,
324
+ anchorEl: Mt,
325
+ container: wt,
102
326
  placement: "bottom-start",
103
327
  sx: { zIndex: 1400 },
104
- children: /* @__PURE__ */ T($, { onClickAway: m, children: /* @__PURE__ */ T(
105
- j,
328
+ children: /* @__PURE__ */ I(jt, { onClickAway: At, children: /* @__PURE__ */ Kt(
329
+ Vt,
106
330
  {
107
- className: W,
331
+ className: pt,
108
332
  elevation: 8,
109
- onClick: P,
110
- onMouseDown: P,
333
+ onClick: Q,
334
+ onKeyDown: Z,
335
+ onKeyUp: Z,
336
+ onMouseDown: Q,
111
337
  sx: {
112
338
  borderRadius: 1,
113
339
  lineHeight: 0,
114
340
  overflow: "hidden",
341
+ width: u.kind === "time" ? z : "auto",
115
342
  "& .react-datepicker": {
116
343
  border: 0,
117
344
  display: "block",
@@ -124,30 +351,137 @@ const Q = `${_} ${b}`, S = "", W = "OwpTreeGridDatePickerEditor", X = /* @__PUR
124
351
  marginBottom: 0
125
352
  }
126
353
  },
127
- children: /* @__PURE__ */ T(
128
- q,
129
- {
130
- inline: !0,
131
- locale: O,
132
- selected: M,
133
- onChange: /* @__PURE__ */ l((r) => B(r), "onChange"),
134
- showTimeInput: e == null ? void 0 : e.showTimeInput,
135
- showTimeSelect: e == null ? void 0 : e.showTimeSelect,
136
- timeIntervals: e == null ? void 0 : e.timeIntervals,
137
- dateFormat: e != null && e.showTimeInput || e != null && e.showTimeSelect ? "Pp" : "P",
138
- timeFormat: b,
139
- timeCaption: `${s("Common.시간")}: `,
140
- timeInputLabel: `${s("Common.시간")}: `
141
- }
142
- )
354
+ children: [
355
+ B && /* @__PURE__ */ I(
356
+ Nt,
357
+ {
358
+ autoFocus: !0,
359
+ inputRef: w,
360
+ fullWidth: !0,
361
+ size: "small",
362
+ value: F,
363
+ error: St,
364
+ color: k.current ? "primary" : void 0,
365
+ placeholder: u.valueFormat,
366
+ onChange: bt,
367
+ onKeyDown: vt,
368
+ slotProps: {
369
+ htmlInput: {
370
+ inputMode: "numeric",
371
+ "aria-label": u.valueFormat
372
+ },
373
+ input: {
374
+ sx: {
375
+ paddingRight: 0.5
376
+ },
377
+ endAdornment: /* @__PURE__ */ I(
378
+ Ut,
379
+ {
380
+ position: "end",
381
+ sx: {
382
+ marginLeft: 0
383
+ },
384
+ children: /* @__PURE__ */ I(
385
+ zt,
386
+ {
387
+ size: "small",
388
+ "aria-label": "clear-date-picker-editor-value",
389
+ disabled: !F,
390
+ onClick: Ot,
391
+ onMouseDown: /* @__PURE__ */ l((n) => {
392
+ n.preventDefault(), n.stopPropagation();
393
+ }, "onMouseDown"),
394
+ sx: {
395
+ margin: 0,
396
+ padding: 0.25
397
+ },
398
+ children: /* @__PURE__ */ I(Gt, { fontSize: "small" })
399
+ }
400
+ )
401
+ }
402
+ )
403
+ }
404
+ },
405
+ sx: {
406
+ boxSizing: "border-box",
407
+ width: u.kind === "time" ? z : "100%",
408
+ px: 1,
409
+ py: 1,
410
+ "& .MuiOutlinedInput-root": {
411
+ borderRadius: 0.75,
412
+ fontSize: 13
413
+ }
414
+ }
415
+ }
416
+ ),
417
+ u.kind === "time" ? /* @__PURE__ */ I(gt, { dateAdapter: Xt, adapterLocale: ht, children: /* @__PURE__ */ I(
418
+ qt,
419
+ {
420
+ ampm: !1,
421
+ value: ft,
422
+ views: xt,
423
+ onChange: /* @__PURE__ */ l((n, a, d) => Lt(n, d), "onChange"),
424
+ timeSteps: {
425
+ minutes: (t == null ? void 0 : t.timeIntervals) ?? 1,
426
+ seconds: 1
427
+ },
428
+ slotProps: {
429
+ digitalClockSectionItem: {
430
+ sx: re
431
+ }
432
+ },
433
+ sx: {
434
+ border: 0,
435
+ width: z,
436
+ "& .MuiMultiSectionDigitalClockSection-root": {
437
+ border: 0,
438
+ boxSizing: "border-box",
439
+ width: V,
440
+ flex: `0 0 ${V}px`,
441
+ display: "flex",
442
+ flexDirection: "column",
443
+ alignItems: "stretch"
444
+ },
445
+ "& .MuiMultiSectionDigitalClockSection-item": {
446
+ alignSelf: "stretch",
447
+ boxSizing: "border-box",
448
+ width: lt,
449
+ minWidth: lt,
450
+ justifyContent: "center",
451
+ marginLeft: "auto",
452
+ marginRight: "auto"
453
+ }
454
+ }
455
+ }
456
+ ) }) : /* @__PURE__ */ I(
457
+ Zt,
458
+ {
459
+ inline: !0,
460
+ locale: Tt,
461
+ selected: Pt,
462
+ onChange: /* @__PURE__ */ l((n) => Ft(n), "onChange"),
463
+ showYearPicker: u.kind === "year",
464
+ showMonthYearPicker: u.kind === "yearMonth" || u.kind === "month",
465
+ showTimeInput: u.kind === "dateTime",
466
+ timeIntervals: t == null ? void 0 : t.timeIntervals,
467
+ dateFormat: le(u),
468
+ timeFormat: Yt,
469
+ timeCaption: `${c("Common.시간")}: `,
470
+ timeInputLabel: `${c("Common.시간")}: `
471
+ }
472
+ )
473
+ ]
143
474
  }
144
475
  ) })
145
476
  }
146
477
  ) : null,
147
- handleDatePickerEditorCellClick: F
478
+ handleDatePickerEditorButtonClick: _t,
479
+ handleDatePickerEditorCellClick: It,
480
+ handleDatePickerEditorKeyDown: Rt,
481
+ handleDatePickerEditorStartEdit: Ct
148
482
  };
149
483
  }, "useOwpTreeGridDatePickerEditor");
150
484
  export {
151
- ke as useOwpTreeGridDatePickerEditor
485
+ Ye as useOwpTreeGridDatePickerEditor
152
486
  };
153
487
  //# sourceMappingURL=useOwpTreeGridDatePickerEditor.js.map