laif-ds 1.0.2-app-data-grid.82 → 1.0.2-app-data-grid.87
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/dist/CHANGELOG.md +7 -0
- package/dist/_virtual/index3.js +5 -5
- package/dist/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +4 -4
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -5
- package/dist/_virtual/index8.js +5 -2
- package/dist/agent-docs/adoption-report.json +3 -3
- package/dist/agent-docs/components/AppDataGrid.md +10 -9
- package/dist/agent-docs/components/DatePicker.md +1 -0
- package/dist/agent-docs/components/DropdownMenu.md +2 -0
- package/dist/agent-docs/manifest.json +6 -6
- package/dist/components/ui/app-data-grid/app-data-grid.js +229 -229
- package/dist/components/ui/app-data-grid/parts/grid-filter-chips.js +57 -47
- package/dist/components/ui/app-data-grid/parts/grid-filter-editor.js +48 -44
- package/dist/components/ui/app-data-grid/parts/grid-filter-row.js +134 -130
- package/dist/components/ui/app-data-grid/parts/grid-portal-container.js +14 -0
- package/dist/components/ui/date-picker.js +36 -34
- package/dist/components/ui/dropdown-menu.js +3 -3
- package/dist/components/ui/gantt/components/Chart/Chart.js +1 -1
- package/dist/index.d.ts +46 -5
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,81 +1,83 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { designTokens as
|
|
5
|
-
import { AppSelect as
|
|
6
|
-
import { Popover as
|
|
7
|
-
import { cn as
|
|
8
|
-
import { gridFilterOperatorLabel as
|
|
9
|
-
import { GRID_SELECT_COLUMN_ID as
|
|
10
|
-
import { defaultGridI18n as
|
|
11
|
-
import { gridFilterRowHeightClass as
|
|
12
|
-
import { gridColumnFilterControl as
|
|
13
|
-
import { GridFilterValueEditor as
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
import { jsxs as x, jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import { useState as I, useRef as j, useLayoutEffect as H } from "react";
|
|
4
|
+
import { designTokens as G } from "../../../design-tokens.js";
|
|
5
|
+
import { AppSelect as U } from "../../app-select.js";
|
|
6
|
+
import { Popover as X, PopoverTrigger as Z, PopoverContent as J } from "../../popover.js";
|
|
7
|
+
import { cn as C } from "../../../../lib/utils.js";
|
|
8
|
+
import { gridFilterOperatorLabel as K, getGridFilterValueArity as Q } from "../grid-filter-operators.js";
|
|
9
|
+
import { GRID_SELECT_COLUMN_ID as Y } from "../grid-header-matrix.js";
|
|
10
|
+
import { defaultGridI18n as N } from "../grid-i18n.js";
|
|
11
|
+
import { gridFilterRowHeightClass as ee, gridFilterRowPinnedZClass as V, gridCellPaddingXClass as _, gridPinnedOffsetStyle as re, gridFilterRowShortPlaceholderMaxWidth as te } from "../grid-tokens.js";
|
|
12
|
+
import { gridColumnFilterControl as le } from "../use-grid-filters.js";
|
|
13
|
+
import { GridFilterValueEditor as oe } from "./grid-filter-editor.js";
|
|
14
|
+
import { useGridPortalContainer as ie } from "./grid-portal-container.js";
|
|
15
|
+
const ae = (t, l, a) => {
|
|
16
|
+
const r = a.filters, e = N.filters, n = {
|
|
17
|
+
string: r.filterRowPlaceholderString ?? e.filterRowPlaceholderString,
|
|
18
|
+
number: r.filterRowPlaceholderNumber ?? e.filterRowPlaceholderNumber,
|
|
19
|
+
boolean: r.filterRowPlaceholderBoolean ?? e.filterRowPlaceholderBoolean,
|
|
20
|
+
date: r.filterRowPlaceholderDate ?? e.filterRowPlaceholderDate,
|
|
21
|
+
datetime: r.filterRowPlaceholderDateTime ?? e.filterRowPlaceholderDateTime,
|
|
22
|
+
list_single_select: r.filterRowPlaceholderListSingle ?? e.filterRowPlaceholderListSingle,
|
|
23
|
+
list_multi_select: r.filterRowPlaceholderListMulti ?? e.filterRowPlaceholderListMulti
|
|
23
24
|
}, f = {
|
|
24
|
-
number:
|
|
25
|
+
number: r.filterRowPlaceholderNumberShort ?? e.filterRowPlaceholderNumberShort
|
|
25
26
|
};
|
|
26
|
-
return l <
|
|
27
|
-
},
|
|
28
|
-
if (
|
|
27
|
+
return l < te ? f[t] ?? n[t] : n[t];
|
|
28
|
+
}, ne = (t, l, a, r) => {
|
|
29
|
+
if (t === void 0 || Q(l.filterType, a) === "none")
|
|
29
30
|
return "";
|
|
30
|
-
const e =
|
|
31
|
+
const e = t.value;
|
|
31
32
|
if (e === void 0) return "";
|
|
32
|
-
const
|
|
33
|
-
return Array.isArray(e) ? e.map(
|
|
34
|
-
},
|
|
35
|
-
const l =
|
|
33
|
+
const n = (f) => l.options.find((g) => g.value === f)?.label ?? String(f);
|
|
34
|
+
return Array.isArray(e) ? e.map(n).join(", ") : typeof e == "boolean" ? e ? r.booleanOperators.true : r.booleanOperators.false : n(e);
|
|
35
|
+
}, se = (t) => {
|
|
36
|
+
const l = t.querySelector(
|
|
36
37
|
"[data-grid-filter-editor-control]"
|
|
37
38
|
);
|
|
38
39
|
return l === null ? null : typeof l.focus == "function" && l.tabIndex >= 0 ? l : l.querySelector('[role="combobox"]');
|
|
39
|
-
},
|
|
40
|
-
columnId:
|
|
40
|
+
}, de = ({
|
|
41
|
+
columnId: t,
|
|
41
42
|
columnLabel: l,
|
|
42
|
-
width:
|
|
43
|
-
control:
|
|
43
|
+
width: a,
|
|
44
|
+
control: r,
|
|
44
45
|
badge: e,
|
|
45
|
-
onOperatorChange:
|
|
46
|
+
onOperatorChange: n,
|
|
46
47
|
onValueChange: f,
|
|
47
|
-
onClear:
|
|
48
|
-
i18n:
|
|
48
|
+
onClear: g,
|
|
49
|
+
i18n: s
|
|
49
50
|
}) => {
|
|
50
|
-
const [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
),
|
|
55
|
-
|
|
51
|
+
const [$, T] = I(!1), w = j(null), { anchorRef: o, container: y } = ie(), [u, v] = I(!1), h = r.operators[0].value, d = e?.operator ?? h, m = K(
|
|
52
|
+
r.filterType,
|
|
53
|
+
d,
|
|
54
|
+
s
|
|
55
|
+
), b = ne(e, r, d, s), p = b !== "", M = d === h, O = s.filters, A = O.filterBy ?? N.filters.filterBy, B = (s.table ?? N.table).expandCell, E = M ? ae(r.filterType, a, s) : m, S = p ? `${m}: ${b}` : E, F = `${l} ${m}${p ? `: ${b}` : ""}`, L = `${A} ${l} — ${m}${p ? `: ${b}` : ""}`;
|
|
56
|
+
H(() => {
|
|
56
57
|
const i = w.current;
|
|
57
58
|
if (!i) return;
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
const R = () => {
|
|
60
|
+
const D = i.scrollWidth > i.clientWidth;
|
|
61
|
+
v((k) => k === D ? k : D);
|
|
61
62
|
};
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
}, [
|
|
66
|
-
const
|
|
67
|
-
return /* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */ c(
|
|
63
|
+
if (R(), typeof ResizeObserver > "u") return;
|
|
64
|
+
const P = new ResizeObserver(R);
|
|
65
|
+
return P.observe(i), () => P.disconnect();
|
|
66
|
+
}, [S]);
|
|
67
|
+
const q = !p, z = $, W = e !== void 0;
|
|
68
|
+
return /* @__PURE__ */ x(X, { open: z, onOpenChange: T, modal: !1, children: [
|
|
69
|
+
/* @__PURE__ */ c(Z, { asChild: !0, children: /* @__PURE__ */ x(
|
|
69
70
|
"button",
|
|
70
71
|
{
|
|
72
|
+
ref: o,
|
|
71
73
|
type: "button",
|
|
72
|
-
"data-grid-filter-cell-trigger":
|
|
73
|
-
"data-filter-truncated":
|
|
74
|
-
title:
|
|
75
|
-
"aria-label":
|
|
76
|
-
className:
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
"data-grid-filter-cell-trigger": t,
|
|
75
|
+
"data-filter-truncated": u ? "true" : "false",
|
|
76
|
+
title: u ? F : void 0,
|
|
77
|
+
"aria-label": L,
|
|
78
|
+
className: C(
|
|
79
|
+
G.focusRing,
|
|
80
|
+
G.radius.default,
|
|
79
81
|
// ⚠️ `h-7` E NON `h-8` — 2026-09-10, scelta 1a del proprietario, e la
|
|
80
82
|
// ragione è una misura di RITMO e non di dimensione. La cella è alta
|
|
81
83
|
// 36px (`gridFilterRowHeightClass`): con un controllo da 32 restano
|
|
@@ -99,7 +101,7 @@ const le = (r, l, n) => {
|
|
|
99
101
|
// filtrata no, che si legge come un disallineamento e non come un
|
|
100
102
|
// segnale. La coppia sta in un ternario e non appesa in coda per
|
|
101
103
|
// `twMerge`: il ramo giusto va scelto qui, non dedotto dall'ordine.
|
|
102
|
-
|
|
104
|
+
W ? "border-d-primary" : "border-d-border"
|
|
103
105
|
),
|
|
104
106
|
children: [
|
|
105
107
|
/* @__PURE__ */ c(
|
|
@@ -107,52 +109,54 @@ const le = (r, l, n) => {
|
|
|
107
109
|
{
|
|
108
110
|
ref: w,
|
|
109
111
|
"aria-hidden": "true",
|
|
110
|
-
className:
|
|
112
|
+
className: C(
|
|
111
113
|
"min-w-0 flex-1 truncate",
|
|
112
|
-
|
|
114
|
+
q && "text-d-muted-foreground"
|
|
113
115
|
),
|
|
114
|
-
children:
|
|
116
|
+
children: S
|
|
115
117
|
}
|
|
116
118
|
),
|
|
117
|
-
|
|
119
|
+
u && // `select-none` come in `grid-cell-text.tsx`: senza, il testo intero
|
|
118
120
|
// finirebbe DUE volte in un incolla della riga.
|
|
119
|
-
/* @__PURE__ */ c("span", { className: "sr-only select-none", children: `${
|
|
121
|
+
/* @__PURE__ */ c("span", { className: "sr-only select-none", children: `${B}: ${F}` })
|
|
120
122
|
]
|
|
121
123
|
}
|
|
122
124
|
) }),
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
|
|
125
|
+
/* @__PURE__ */ x(
|
|
126
|
+
J,
|
|
125
127
|
{
|
|
126
128
|
align: "start",
|
|
127
|
-
|
|
128
|
-
"
|
|
129
|
+
container: y,
|
|
130
|
+
"data-grid-filter-cell-panel": t,
|
|
131
|
+
"aria-label": L,
|
|
129
132
|
className: "flex flex-col gap-2",
|
|
130
133
|
onOpenAutoFocus: (i) => {
|
|
131
|
-
const
|
|
132
|
-
if (!(
|
|
133
|
-
const
|
|
134
|
-
|
|
134
|
+
const R = i.currentTarget;
|
|
135
|
+
if (!(R instanceof HTMLElement)) return;
|
|
136
|
+
const P = se(R);
|
|
137
|
+
P !== null && (i.preventDefault(), P.focus());
|
|
135
138
|
},
|
|
136
139
|
children: [
|
|
137
140
|
/* @__PURE__ */ c(
|
|
138
141
|
"div",
|
|
139
142
|
{
|
|
140
|
-
"data-grid-filter-cell-operator":
|
|
141
|
-
"data-grid-filter-cell-type":
|
|
142
|
-
"data-grid-filter-cell-operator-value":
|
|
143
|
+
"data-grid-filter-cell-operator": t,
|
|
144
|
+
"data-grid-filter-cell-type": r.filterType,
|
|
145
|
+
"data-grid-filter-cell-operator-value": d,
|
|
143
146
|
className: "w-full",
|
|
144
147
|
children: /* @__PURE__ */ c(
|
|
145
|
-
|
|
148
|
+
U,
|
|
146
149
|
{
|
|
147
|
-
options:
|
|
148
|
-
value:
|
|
150
|
+
options: r.operators,
|
|
151
|
+
value: d,
|
|
149
152
|
onValueChange: (i) => {
|
|
150
|
-
i !== void 0 &&
|
|
153
|
+
i !== void 0 && n(t, i);
|
|
151
154
|
},
|
|
152
|
-
"aria-label": `${
|
|
155
|
+
"aria-label": `${O.operator}: ${l}`,
|
|
156
|
+
portalContainer: y,
|
|
153
157
|
searchable: !0,
|
|
154
|
-
searchPlaceholder:
|
|
155
|
-
emptyPlaceholder:
|
|
158
|
+
searchPlaceholder: O.searchPlaceholder,
|
|
159
|
+
emptyPlaceholder: s.notFoundMessage,
|
|
156
160
|
size: "sm",
|
|
157
161
|
className: "w-full"
|
|
158
162
|
}
|
|
@@ -160,43 +164,43 @@ const le = (r, l, n) => {
|
|
|
160
164
|
}
|
|
161
165
|
),
|
|
162
166
|
/* @__PURE__ */ c(
|
|
163
|
-
|
|
167
|
+
oe,
|
|
164
168
|
{
|
|
165
|
-
control:
|
|
166
|
-
operator:
|
|
169
|
+
control: r,
|
|
170
|
+
operator: d,
|
|
167
171
|
value: e?.value,
|
|
168
|
-
onValueChange: (i) => f(
|
|
169
|
-
name: `filter-row-${
|
|
172
|
+
onValueChange: (i) => f(t, i),
|
|
173
|
+
name: `filter-row-${t}`,
|
|
170
174
|
columnLabel: l,
|
|
171
175
|
fullWidth: !0,
|
|
172
|
-
onClear:
|
|
176
|
+
onClear: g === void 0 ? void 0 : () => g(t),
|
|
173
177
|
size: "sm",
|
|
174
|
-
i18n:
|
|
178
|
+
i18n: s
|
|
175
179
|
}
|
|
176
180
|
)
|
|
177
181
|
]
|
|
178
182
|
}
|
|
179
183
|
)
|
|
180
184
|
] });
|
|
181
|
-
},
|
|
182
|
-
headers:
|
|
185
|
+
}, ye = ({
|
|
186
|
+
headers: t,
|
|
183
187
|
checkable: l,
|
|
184
|
-
pinning:
|
|
185
|
-
pinnedSlots:
|
|
188
|
+
pinning: a,
|
|
189
|
+
pinnedSlots: r,
|
|
186
190
|
widths: e,
|
|
187
|
-
columns:
|
|
191
|
+
columns: n,
|
|
188
192
|
badges: f,
|
|
189
|
-
contentHidden:
|
|
190
|
-
onOperatorChange:
|
|
191
|
-
onValueChange:
|
|
192
|
-
onClear:
|
|
193
|
-
i18n: w =
|
|
194
|
-
}) =>
|
|
193
|
+
contentHidden: g = !1,
|
|
194
|
+
onOperatorChange: s,
|
|
195
|
+
onValueChange: $,
|
|
196
|
+
onClear: T,
|
|
197
|
+
i18n: w = N
|
|
198
|
+
}) => g ? null : /* @__PURE__ */ x(
|
|
195
199
|
"tr",
|
|
196
200
|
{
|
|
197
201
|
"data-slot": "grid-filter-row",
|
|
198
202
|
"data-grid-filter-row": "",
|
|
199
|
-
className:
|
|
203
|
+
className: ee,
|
|
200
204
|
children: [
|
|
201
205
|
l && // La colonna delle spunte non si filtra: la cella esiste per tenere
|
|
202
206
|
// l'allineamento con i `<col>` e non porta nessun controllo, quindi
|
|
@@ -206,39 +210,39 @@ const le = (r, l, n) => {
|
|
|
206
210
|
/* @__PURE__ */ c(
|
|
207
211
|
"td",
|
|
208
212
|
{
|
|
209
|
-
"data-grid-filter-cell":
|
|
210
|
-
className:
|
|
213
|
+
"data-grid-filter-cell": Y,
|
|
214
|
+
className: C(
|
|
211
215
|
_,
|
|
212
|
-
|
|
213
|
-
|
|
216
|
+
a && "bg-d-background sticky",
|
|
217
|
+
a && V
|
|
214
218
|
),
|
|
215
|
-
style:
|
|
219
|
+
style: a ? { left: "0px" } : void 0
|
|
216
220
|
}
|
|
217
221
|
),
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
(
|
|
221
|
-
),
|
|
222
|
-
(
|
|
223
|
-
),
|
|
224
|
-
return /* @__PURE__ */
|
|
222
|
+
t.map((o, y) => {
|
|
223
|
+
const u = r[o.columnId], v = u !== void 0, h = n.find(
|
|
224
|
+
(p) => p.id === o.columnId
|
|
225
|
+
), d = h === void 0 || !h.filterable ? void 0 : le(h, w), m = f.find(
|
|
226
|
+
(p) => p.columnId === o.columnId
|
|
227
|
+
), b = y > 0 && !(u?.edge === !0 && u.side === "right");
|
|
228
|
+
return /* @__PURE__ */ x(
|
|
225
229
|
"td",
|
|
226
230
|
{
|
|
227
231
|
"data-grid-filter-cell": o.columnId,
|
|
228
232
|
"data-grid-filter-cell-label": o.headerLabel,
|
|
229
|
-
"data-grid-filter-cell-applied":
|
|
230
|
-
className:
|
|
233
|
+
"data-grid-filter-cell-applied": m === void 0 ? "false" : "true",
|
|
234
|
+
className: C(
|
|
231
235
|
_,
|
|
232
236
|
// ⚠️ `relative` SOLO SE NON PINNATA: `sticky` è già un valore di
|
|
233
237
|
// `position` e ancora da sé il trattino, mentre scriverci
|
|
234
238
|
// `relative` sopra la sbloccherebbe. Le due non convivono.
|
|
235
|
-
!
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
!v && "relative",
|
|
240
|
+
v && "bg-d-background sticky",
|
|
241
|
+
v && V
|
|
238
242
|
),
|
|
239
|
-
style:
|
|
243
|
+
style: re(u),
|
|
240
244
|
children: [
|
|
241
|
-
|
|
245
|
+
b && /* @__PURE__ */ c(
|
|
242
246
|
"span",
|
|
243
247
|
{
|
|
244
248
|
"aria-hidden": "true",
|
|
@@ -246,17 +250,17 @@ const le = (r, l, n) => {
|
|
|
246
250
|
className: "bg-d-border pointer-events-none absolute top-1/2 left-0 h-3 w-px -translate-y-1/2"
|
|
247
251
|
}
|
|
248
252
|
),
|
|
249
|
-
|
|
250
|
-
|
|
253
|
+
d !== void 0 && /* @__PURE__ */ c(
|
|
254
|
+
de,
|
|
251
255
|
{
|
|
252
256
|
columnId: o.columnId,
|
|
253
257
|
columnLabel: o.headerLabel,
|
|
254
258
|
width: e[o.columnId] ?? 0,
|
|
255
|
-
control:
|
|
256
|
-
badge:
|
|
257
|
-
onOperatorChange:
|
|
258
|
-
onValueChange:
|
|
259
|
-
onClear:
|
|
259
|
+
control: d,
|
|
260
|
+
badge: m,
|
|
261
|
+
onOperatorChange: s,
|
|
262
|
+
onValueChange: $,
|
|
263
|
+
onClear: T,
|
|
260
264
|
i18n: w
|
|
261
265
|
}
|
|
262
266
|
)
|
|
@@ -269,5 +273,5 @@ const le = (r, l, n) => {
|
|
|
269
273
|
}
|
|
270
274
|
);
|
|
271
275
|
export {
|
|
272
|
-
|
|
276
|
+
ye as GridFilterRow
|
|
273
277
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as r, useCallback as l } from "react";
|
|
3
|
+
const s = (t) => t?.closest("[data-app-data-grid]") ?? null, u = () => {
|
|
4
|
+
const [t, o] = r(null);
|
|
5
|
+
return { anchorRef: l((n) => {
|
|
6
|
+
if (n === null) return;
|
|
7
|
+
const a = s(n);
|
|
8
|
+
o((e) => e === a ? e : a);
|
|
9
|
+
}, []), container: t };
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
s as gridPortalContainerOf,
|
|
13
|
+
u as useGridPortalContainer
|
|
14
|
+
};
|
|
@@ -3,13 +3,13 @@ import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
|
3
3
|
import * as c from "react";
|
|
4
4
|
import { useCallback as X, useMemo as H, useEffect as G } from "react";
|
|
5
5
|
import { designTokens as l } from "../design-tokens.js";
|
|
6
|
-
import { Calendar as J, CalendarDayButton as
|
|
6
|
+
import { Calendar as J, CalendarDayButton as xe } from "./calendar.js";
|
|
7
7
|
import { Icon as K } from "./icon.js";
|
|
8
|
-
import { Label as
|
|
9
|
-
import { Popover as
|
|
8
|
+
import { Label as be } from "./label.js";
|
|
9
|
+
import { Popover as De, PopoverTrigger as Me, PopoverContent as Se } from "./popover.js";
|
|
10
10
|
import { cn as Q } from "../../lib/utils.js";
|
|
11
11
|
import { TimePickerColumn as R } from "./app-time-picker.js";
|
|
12
|
-
import { it as
|
|
12
|
+
import { it as Ne } from "../../node_modules/date-fns/locale/it.js";
|
|
13
13
|
import { formatDate as z } from "../../node_modules/date-fns/format.js";
|
|
14
14
|
import { isSameDay as O } from "../../node_modules/date-fns/isSameDay.js";
|
|
15
15
|
const W = (o) => {
|
|
@@ -17,7 +17,7 @@ const W = (o) => {
|
|
|
17
17
|
const M = Math.trunc(o);
|
|
18
18
|
return Math.min(59, Math.max(1, M));
|
|
19
19
|
};
|
|
20
|
-
function
|
|
20
|
+
function Ae(o) {
|
|
21
21
|
const {
|
|
22
22
|
placeholder: M = "Seleziona data",
|
|
23
23
|
dateFormat: Y,
|
|
@@ -27,7 +27,7 @@ function Te(o) {
|
|
|
27
27
|
firstDate: E,
|
|
28
28
|
lastDate: F,
|
|
29
29
|
availableDates: I,
|
|
30
|
-
locale: u =
|
|
30
|
+
locale: u = Ne,
|
|
31
31
|
initialCalendarMonth: w,
|
|
32
32
|
customCalendarProps: S,
|
|
33
33
|
label: T,
|
|
@@ -39,32 +39,33 @@ function Te(o) {
|
|
|
39
39
|
maxDate: _,
|
|
40
40
|
numberOfMonths: oe,
|
|
41
41
|
clearable: ae = !1,
|
|
42
|
-
onClear: j
|
|
42
|
+
onClear: j,
|
|
43
|
+
portalContainer: re
|
|
43
44
|
} = o, a = o.mode === "range", C = !a && o.showTime === !0, N = !a && o.withSeconds === !0, p = a ? 1 : W(o.minuteStep), k = a ? 1 : W(o.secondStep), P = Y ?? (C ? N ? "dd/MM/yyyy HH:mm:ss" : "dd/MM/yyyy HH:mm" : "dd/MM/yyyy"), [i, x] = c.useState(
|
|
44
45
|
a ? void 0 : o.value
|
|
45
46
|
), [n, b] = c.useState(
|
|
46
47
|
a ? o.value : void 0
|
|
47
48
|
), [L, D] = c.useState(
|
|
48
49
|
w
|
|
49
|
-
), [B, V] = c.useState(!1),
|
|
50
|
+
), [B, V] = c.useState(!1), ie = (e) => {
|
|
50
51
|
const t = e ? new Date(e) : void 0;
|
|
51
52
|
C && t && i && t.setHours(
|
|
52
53
|
i.getHours(),
|
|
53
54
|
i.getMinutes(),
|
|
54
55
|
i.getSeconds()
|
|
55
56
|
), x(t), t && D(t), !a && o.onChange && o.onChange(t), !C && t && V(!1);
|
|
56
|
-
},
|
|
57
|
+
}, se = X(() => {
|
|
57
58
|
a ? (b(void 0), o.onChange && o.onChange(void 0)) : (x(void 0), o.onChange && o.onChange(void 0)), j?.();
|
|
58
|
-
}, [a, o.onChange, j]),
|
|
59
|
+
}, [a, o.onChange, j]), le = i?.getHours(), fe = i?.getMinutes(), de = i?.getSeconds(), me = H(
|
|
59
60
|
() => Array.from({ length: 24 }, (e, t) => t),
|
|
60
61
|
[]
|
|
61
|
-
),
|
|
62
|
+
), ce = H(
|
|
62
63
|
() => Array.from(
|
|
63
64
|
{ length: Math.floor(59 / p) + 1 },
|
|
64
65
|
(e, t) => t * p
|
|
65
66
|
),
|
|
66
67
|
[p]
|
|
67
|
-
),
|
|
68
|
+
), ue = H(
|
|
68
69
|
() => Array.from(
|
|
69
70
|
{ length: Math.floor(59 / k) + 1 },
|
|
70
71
|
(e, t) => t * k
|
|
@@ -76,7 +77,7 @@ function Te(o) {
|
|
|
76
77
|
i || s.setHours(0, 0, 0, 0), e === "hour" ? s.setHours(t) : e === "minute" ? s.setMinutes(t) : e === "second" && s.setSeconds(t), x(s), !a && o.onChange && o.onChange(s);
|
|
77
78
|
},
|
|
78
79
|
[i, a, o.onChange]
|
|
79
|
-
),
|
|
80
|
+
), he = (e, t) => {
|
|
80
81
|
let s;
|
|
81
82
|
!n || !n.from ? s = { from: t, to: void 0 } : n.from && !n.to ? t < n.from ? s = { from: t, to: void 0 } : s = { from: n.from, to: t } : n.from && n.to && (s = { from: t, to: void 0 }), b(s), s?.from && D(s.from), a && o.onChange && o.onChange(s);
|
|
82
83
|
};
|
|
@@ -104,21 +105,21 @@ function Te(o) {
|
|
|
104
105
|
};
|
|
105
106
|
return window.addEventListener("pointerup", e), () => window.removeEventListener("pointerup", e);
|
|
106
107
|
}, [h, a, o.onChange, n]);
|
|
107
|
-
const
|
|
108
|
+
const ge = (e, t) => {
|
|
108
109
|
!a || !n || !n.from || !n.to || (O(e, n.from) ? (g("from"), t.preventDefault()) : O(e, n.to) && (g("to"), t.preventDefault()));
|
|
109
|
-
},
|
|
110
|
+
}, ve = (e) => {
|
|
110
111
|
if (!h || !n || !n.from || !n.to) return;
|
|
111
112
|
let t = { ...n };
|
|
112
113
|
h === "from" ? e <= n.to ? t.from = e : (t.from = n.to, t.to = e, g("to")) : h === "to" && (e >= n.from ? t.to = e : (t.to = n.from, t.from = e, g("from"))), b(t);
|
|
113
|
-
},
|
|
114
|
+
}, we = c.useId(), q = te ?? we, U = a ? !!n?.from : !!i, Ce = () => a && n ? /* @__PURE__ */ f("span", { children: [
|
|
114
115
|
n.from && z(n.from, P, { locale: u }),
|
|
115
116
|
n.from && n.to && " - ",
|
|
116
117
|
n.to && z(n.to, P, { locale: u })
|
|
117
118
|
] }) : !a && i ? /* @__PURE__ */ r("span", { children: z(i, P, { locale: u }) }) : /* @__PURE__ */ r("span", { className: "text-d-muted-foreground", children: M });
|
|
118
119
|
return /* @__PURE__ */ f("div", { className: Q("flex flex-col gap-1.5", ee), children: [
|
|
119
|
-
T && /* @__PURE__ */ r(
|
|
120
|
-
/* @__PURE__ */ f(
|
|
121
|
-
/* @__PURE__ */ r(
|
|
120
|
+
T && /* @__PURE__ */ r(be, { htmlFor: q, className: $, children: T }),
|
|
121
|
+
/* @__PURE__ */ f(De, { open: d ? !1 : B, onOpenChange: V, modal: !0, children: [
|
|
122
|
+
/* @__PURE__ */ r(Me, { asChild: !0, children: /* @__PURE__ */ f(
|
|
122
123
|
"div",
|
|
123
124
|
{
|
|
124
125
|
id: q,
|
|
@@ -146,14 +147,14 @@ function Te(o) {
|
|
|
146
147
|
},
|
|
147
148
|
children: [
|
|
148
149
|
/* @__PURE__ */ r(K, { name: "Calendar", size: v === "lg" ? "sm" : "xs" }),
|
|
149
|
-
/* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children:
|
|
150
|
+
/* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: Ce() }),
|
|
150
151
|
ae && U && /* @__PURE__ */ r(
|
|
151
152
|
"div",
|
|
152
153
|
{
|
|
153
154
|
role: "button",
|
|
154
155
|
className: "bg-d-accent hover:bg-d-accent/80 border-d-border flex shrink-0 cursor-pointer items-center justify-center rounded-full border p-1 transition-colors",
|
|
155
156
|
onClick: (e) => {
|
|
156
|
-
e.stopPropagation(), e.preventDefault(),
|
|
157
|
+
e.stopPropagation(), e.preventDefault(), se();
|
|
157
158
|
},
|
|
158
159
|
onMouseDown: (e) => e.preventDefault(),
|
|
159
160
|
"aria-label": "Clear selection",
|
|
@@ -172,8 +173,9 @@ function Te(o) {
|
|
|
172
173
|
) }),
|
|
173
174
|
" ",
|
|
174
175
|
/* @__PURE__ */ f(
|
|
175
|
-
|
|
176
|
+
Se,
|
|
176
177
|
{
|
|
178
|
+
container: re,
|
|
177
179
|
className: "flex max-h-[500px] min-h-0 w-auto flex-row p-0 shadow",
|
|
178
180
|
align: "start",
|
|
179
181
|
children: [
|
|
@@ -183,7 +185,7 @@ function Te(o) {
|
|
|
183
185
|
...S || {},
|
|
184
186
|
mode: "range",
|
|
185
187
|
selected: n,
|
|
186
|
-
onSelect:
|
|
188
|
+
onSelect: he,
|
|
187
189
|
autoFocus: !0,
|
|
188
190
|
disabled: m,
|
|
189
191
|
locale: u,
|
|
@@ -194,14 +196,14 @@ function Te(o) {
|
|
|
194
196
|
components: {
|
|
195
197
|
...S?.components,
|
|
196
198
|
DayButton: (e) => /* @__PURE__ */ r(
|
|
197
|
-
|
|
199
|
+
xe,
|
|
198
200
|
{
|
|
199
201
|
...e,
|
|
200
202
|
onPointerDown: (t) => {
|
|
201
|
-
e.onPointerDown && e.onPointerDown(t),
|
|
203
|
+
e.onPointerDown && e.onPointerDown(t), ge(e.day.date, t);
|
|
202
204
|
},
|
|
203
205
|
onPointerEnter: (t) => {
|
|
204
|
-
e.onPointerEnter && e.onPointerEnter(t),
|
|
206
|
+
e.onPointerEnter && e.onPointerEnter(t), ve(e.day.date);
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
)
|
|
@@ -213,7 +215,7 @@ function Te(o) {
|
|
|
213
215
|
...S || {},
|
|
214
216
|
mode: "single",
|
|
215
217
|
selected: i,
|
|
216
|
-
onSelect:
|
|
218
|
+
onSelect: ie,
|
|
217
219
|
autoFocus: !0,
|
|
218
220
|
disabled: m,
|
|
219
221
|
locale: u,
|
|
@@ -240,8 +242,8 @@ function Te(o) {
|
|
|
240
242
|
R,
|
|
241
243
|
{
|
|
242
244
|
type: "hour",
|
|
243
|
-
value:
|
|
244
|
-
options:
|
|
245
|
+
value: le,
|
|
246
|
+
options: me,
|
|
245
247
|
onChange: (e) => y("hour", e),
|
|
246
248
|
className: "flex flex-1"
|
|
247
249
|
}
|
|
@@ -250,8 +252,8 @@ function Te(o) {
|
|
|
250
252
|
R,
|
|
251
253
|
{
|
|
252
254
|
type: "minute",
|
|
253
|
-
value:
|
|
254
|
-
options:
|
|
255
|
+
value: fe,
|
|
256
|
+
options: ce,
|
|
255
257
|
onChange: (e) => y("minute", e),
|
|
256
258
|
className: "flex flex-1"
|
|
257
259
|
}
|
|
@@ -260,8 +262,8 @@ function Te(o) {
|
|
|
260
262
|
R,
|
|
261
263
|
{
|
|
262
264
|
type: "second",
|
|
263
|
-
value:
|
|
264
|
-
options:
|
|
265
|
+
value: de,
|
|
266
|
+
options: ue,
|
|
265
267
|
onChange: (e) => y("second", e),
|
|
266
268
|
className: "flex flex-1"
|
|
267
269
|
}
|
|
@@ -275,5 +277,5 @@ function Te(o) {
|
|
|
275
277
|
] });
|
|
276
278
|
}
|
|
277
279
|
export {
|
|
278
|
-
|
|
280
|
+
Ae as DatePicker
|
|
279
281
|
};
|
|
@@ -35,17 +35,17 @@ const C = n.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ a(
|
|
|
35
35
|
}
|
|
36
36
|
));
|
|
37
37
|
C.displayName = w.displayName;
|
|
38
|
-
const z = n.forwardRef(({ className: e, sideOffset: t = 4,
|
|
38
|
+
const z = n.forwardRef(({ className: e, sideOffset: t = 4, container: o, ...d }, s) => /* @__PURE__ */ a(c, { container: o, children: /* @__PURE__ */ a(
|
|
39
39
|
p,
|
|
40
40
|
{
|
|
41
|
-
ref:
|
|
41
|
+
ref: s,
|
|
42
42
|
sideOffset: t,
|
|
43
43
|
className: r(
|
|
44
44
|
"bg-d-popover text-d-popover-foreground border-d-border z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
45
45
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
46
46
|
e
|
|
47
47
|
),
|
|
48
|
-
...
|
|
48
|
+
...d
|
|
49
49
|
}
|
|
50
50
|
) }));
|
|
51
51
|
z.displayName = p.displayName;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as n, jsxs as b, Fragment as G } from "react/jsx-runtime";
|
|
3
|
-
import L from "../../../../../_virtual/
|
|
3
|
+
import L from "../../../../../_virtual/index8.js";
|
|
4
4
|
import _ from "../../../../../_virtual/debounce3.js";
|
|
5
5
|
import { useContext as j, useRef as l, useState as o, useCallback as M, useMemo as N, useEffect as a } from "react";
|
|
6
6
|
import { GanttContext as O } from "../Gantt/GanttContext.js";
|