@alfadocs/ui-kit 0.23.0 → 0.24.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/dist/_chunks/{autocomplete-BxfabhZ8.js → autocomplete-C7xq06bP.js} +40 -40
- package/dist/_chunks/editable-currency-cell-renderer-DJB5MxAI.js +2349 -0
- package/dist/_chunks/locale-picker-CYBhgSHR.js +575 -0
- package/dist/_chunks/{patient-shell-DavGODt9.js → patient-shell-B164drIa.js} +40 -55
- package/dist/_chunks/settings-ca2Yi9R8.js +21 -0
- package/dist/_chunks/sun-Eweh5fvi.js +50 -0
- package/dist/_chunks/{theme-toggle-BswYl0Yp.js → theme-toggle-FrotC2VI.js} +85 -127
- package/dist/_chunks/use-locale-BkCIHujH.js +20 -0
- package/dist/_chunks/use-scroll-to-first-error-BrK7dKB_.js +55 -0
- package/dist/_chunks/{whatsapp-button-CtlLwM3M.js → whatsapp-button-DUjlWGKf.js} +26 -25
- package/dist/agent-catalog.json +59 -1
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/data-table/filters/number-filter.d.ts +56 -0
- package/dist/components/data-table/filters/text-filter.d.ts +49 -0
- package/dist/components/data-table/index.d.ts +4 -0
- package/dist/components/data-table/index.js +25 -21
- package/dist/components/header-settings/index.js +205 -0
- package/dist/components/locale-picker/index.js +7 -0
- package/dist/components/theme-toggle/index.js +1 -1
- package/dist/components/whatsapp-button/index.js +1 -1
- package/dist/components/whatsapp-button/whatsapp-button.d.ts +14 -1
- package/dist/fonts/Lexend-VF-latin-ext.woff2 +0 -0
- package/dist/fonts/Lexend-VF-latin.woff2 +0 -0
- package/dist/fonts/Lexend-VF-vietnamese.woff2 +0 -0
- package/dist/fonts/NotoSansArabic-VF-arabic.woff2 +0 -0
- package/dist/fonts/NotoSansDevanagari-VF-devanagari.woff2 +0 -0
- package/dist/hooks/index.js +29 -28
- package/dist/i18n/config.js +2726 -134
- package/dist/i18n/locales/ar.d.ts +147 -3
- package/dist/i18n/locales/de.d.ts +147 -3
- package/dist/i18n/locales/el.d.ts +147 -3
- package/dist/i18n/locales/es.d.ts +147 -3
- package/dist/i18n/locales/fr.d.ts +147 -3
- package/dist/i18n/locales/hi.d.ts +147 -3
- package/dist/i18n/locales/ja.d.ts +147 -3
- package/dist/i18n/locales/nl.d.ts +147 -3
- package/dist/i18n/locales/pl.d.ts +149 -5
- package/dist/i18n/locales/pt.d.ts +147 -3
- package/dist/i18n/locales/ro.d.ts +147 -3
- package/dist/i18n/locales/ru.d.ts +148 -4
- package/dist/i18n/locales/sq.d.ts +147 -3
- package/dist/i18n/locales/sv.d.ts +147 -3
- package/dist/i18n/locales/tr.d.ts +147 -3
- package/dist/i18n/locales/zh.d.ts +147 -3
- package/dist/i18n/resources.d.ts +294 -6
- package/dist/index.js +512 -507
- package/dist/locales/ar.json +149 -5
- package/dist/locales/de.json +149 -5
- package/dist/locales/el.json +149 -5
- package/dist/locales/en.json +147 -3
- package/dist/locales/es.json +149 -5
- package/dist/locales/fr.json +149 -5
- package/dist/locales/hi.json +149 -5
- package/dist/locales/it.json +147 -3
- package/dist/locales/ja.json +149 -5
- package/dist/locales/nl.json +149 -5
- package/dist/locales/pl.json +151 -7
- package/dist/locales/pt.json +149 -5
- package/dist/locales/ro.json +149 -5
- package/dist/locales/ru.json +150 -6
- package/dist/locales/sq.json +149 -5
- package/dist/locales/sv.json +149 -5
- package/dist/locales/tr.json +149 -5
- package/dist/locales/zh.json +149 -5
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +2 -2
- package/package.json +10 -1
- package/dist/_chunks/editable-currency-cell-renderer-1t42gENX.js +0 -1972
- package/dist/_chunks/use-locale-C5rS3Xon.js +0 -71
|
@@ -0,0 +1,2349 @@
|
|
|
1
|
+
import { jsx as s, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as I, forwardRef as j, useState as R, useCallback as M, useEffect as P, useRef as X, createContext as Ne, useContext as Se, isValidElement as we, cloneElement as Fe, useImperativeHandle as yt, useLayoutEffect as Tt } from "react";
|
|
3
|
+
import { S as xt } from "./skeleton-CZbwyJAA.js";
|
|
4
|
+
import { E as Ct } from "./empty-state-3CLJIXSj.js";
|
|
5
|
+
import { c as Nt } from "./index-D2ZczOXr.js";
|
|
6
|
+
import { useTranslation as F } from "react-i18next";
|
|
7
|
+
import { useGridFilter as J, AgGridReact as St } from "ag-grid-react";
|
|
8
|
+
import { ModuleRegistry as wt, AllCommunityModule as Ft } from "ag-grid-community";
|
|
9
|
+
import { B as _ } from "./button-DD_0Xdmr.js";
|
|
10
|
+
import { I as B } from "./icon-button-C4CGcYuz.js";
|
|
11
|
+
import { P as Z } from "./popover--derJ_wq.js";
|
|
12
|
+
import { C as Re } from "./checkbox-mwbrPZDY.js";
|
|
13
|
+
import { T as fe } from "./text-input-CakysYnD.js";
|
|
14
|
+
import { T as ae } from "./tag-CQmHRM4Y.js";
|
|
15
|
+
import { D as Y } from "./dropdown-menu-DZxwF23X.js";
|
|
16
|
+
import { X as De } from "./x-CCcI3eJp.js";
|
|
17
|
+
import { c as pe } from "./createLucideIcon-CrFbzy84.js";
|
|
18
|
+
import { S as me } from "./search-BonnQsHv.js";
|
|
19
|
+
import { G as Rt } from "./grip-vertical-Dlg0_k5C.js";
|
|
20
|
+
import { P as Dt } from "./printer-CeVEWfQq.js";
|
|
21
|
+
import { F as ke } from "./file-text-DSNuv2B8.js";
|
|
22
|
+
import { F as kt } from "./file-spreadsheet-zUkY8rJ2.js";
|
|
23
|
+
import Et from "i18next";
|
|
24
|
+
import { S as Ee } from "./select-C92AT_OZ.js";
|
|
25
|
+
import { u as It } from "./registry-C9nwlNyL.js";
|
|
26
|
+
import { D as Ie } from "./date-range-picker-9gANFNG9.js";
|
|
27
|
+
import { M as zt } from "./multi-select-CyspR5ZF.js";
|
|
28
|
+
import { A as ze } from "./autocomplete-C7xq06bP.js";
|
|
29
|
+
import { N as ee } from "./number-input-BZXu6bPY.js";
|
|
30
|
+
import { B as At } from "./badge-cLYVGlMh.js";
|
|
31
|
+
import { A as Ae } from "./avatar-BpFohgWG.js";
|
|
32
|
+
import { T as Pt } from "./tooltip-DHik5yRI.js";
|
|
33
|
+
import { T as he } from "./timestamp-BV2lC-wV.js";
|
|
34
|
+
import { S as Ot } from "./square-check-big-Jr-0202D.js";
|
|
35
|
+
import { S as Mt } from "./square-CZoGU14v.js";
|
|
36
|
+
import { c as Pe, a as Oe, b as Me, d as Le } from "./input-surface-xyERuLU_.js";
|
|
37
|
+
/**
|
|
38
|
+
* @license lucide-react v1.8.0 - ISC
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the ISC license.
|
|
41
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/
|
|
43
|
+
const Lt = [
|
|
44
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
45
|
+
["path", { d: "M12 3v18", key: "108xh3" }]
|
|
46
|
+
], _t = pe("columns-2", Lt);
|
|
47
|
+
/**
|
|
48
|
+
* @license lucide-react v1.8.0 - ISC
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the ISC license.
|
|
51
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
+
*/
|
|
53
|
+
const jt = [
|
|
54
|
+
["path", { d: "M12 15V3", key: "m9g1x1" }],
|
|
55
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
56
|
+
["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
|
|
57
|
+
], ne = pe("download", jt);
|
|
58
|
+
/**
|
|
59
|
+
* @license lucide-react v1.8.0 - ISC
|
|
60
|
+
*
|
|
61
|
+
* This source code is licensed under the ISC license.
|
|
62
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
63
|
+
*/
|
|
64
|
+
const $t = [
|
|
65
|
+
["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
|
|
66
|
+
["path", { d: "M21 3v5h-5", key: "1q7to0" }],
|
|
67
|
+
["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
|
|
68
|
+
["path", { d: "M8 16H3v5", key: "1cv678" }]
|
|
69
|
+
], qt = pe("refresh-cw", $t);
|
|
70
|
+
function Gt(t) {
|
|
71
|
+
if (!we(t)) return t;
|
|
72
|
+
const e = t, a = e.props.className ?? "", n = /\bsize-|\bw-|\bh-/.test(a) ? a : `${a} ds:size-4`.trim();
|
|
73
|
+
return Fe(e, { className: n, size: e.props.size ?? 16 });
|
|
74
|
+
}
|
|
75
|
+
const _e = Ne(null);
|
|
76
|
+
function $(t) {
|
|
77
|
+
const e = Se(_e);
|
|
78
|
+
if (!e)
|
|
79
|
+
throw new Error(
|
|
80
|
+
`${t} must be rendered inside <DataTable.Toolbar> as a descendant of <DataTable>.`
|
|
81
|
+
);
|
|
82
|
+
return e;
|
|
83
|
+
}
|
|
84
|
+
function Vt({
|
|
85
|
+
getApi: t,
|
|
86
|
+
selectionCount: e,
|
|
87
|
+
onPrint: a,
|
|
88
|
+
children: n
|
|
89
|
+
}) {
|
|
90
|
+
const r = I(
|
|
91
|
+
() => ({ getApi: t, selectionCount: e, onPrint: a }),
|
|
92
|
+
[t, e, a]
|
|
93
|
+
);
|
|
94
|
+
return /* @__PURE__ */ s(_e.Provider, { value: r, children: n });
|
|
95
|
+
}
|
|
96
|
+
const Bt = [
|
|
97
|
+
"data-table-toolbar",
|
|
98
|
+
// Mobile (<sm) keeps `flex-wrap` so a wide QuickSearch can flow above the
|
|
99
|
+
// Actions cluster on narrow screens. From `sm` (≥640px) we switch to
|
|
100
|
+
// `flex-nowrap` + `min-w-0` so the row stays single-line at every common
|
|
101
|
+
// desktop width (1024 / 1280 / 1440) — the QuickSearch slot shrinks via
|
|
102
|
+
// its own `min-w-0` instead of pushing the trailing Actions to a new row.
|
|
103
|
+
"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
104
|
+
"ds:sm:flex-nowrap ds:min-w-0",
|
|
105
|
+
// Brand-polish: give the toolbar its own card surface so it doesn't
|
|
106
|
+
// sit flush above the grid as a bare row. The `--card` token resolves to
|
|
107
|
+
// `--background` on the default light theme (white), which makes a
|
|
108
|
+
// shadow-only chrome invisible on the page — pair the card fill with the
|
|
109
|
+
// standard `--card-border` outline (same recipe as `<Card>`) so the
|
|
110
|
+
// toolbar reads as a discrete surface in both light and dark themes.
|
|
111
|
+
"ds:bg-[var(--card)] ds:rounded-[var(--radius-md)]",
|
|
112
|
+
"ds:border ds:border-[color:var(--card-border)]",
|
|
113
|
+
"ds:shadow-[var(--shadow-sm)]",
|
|
114
|
+
"ds:py-[var(--spacing-sm)] ds:px-[var(--spacing-md)]"
|
|
115
|
+
].join(" "), je = j(
|
|
116
|
+
({ className: t, children: e, ...a }, n) => /* @__PURE__ */ s(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
ref: n,
|
|
120
|
+
role: "toolbar",
|
|
121
|
+
className: [Bt, t ?? ""].join(" ").trim(),
|
|
122
|
+
...a,
|
|
123
|
+
children: e
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
);
|
|
127
|
+
je.displayName = "DataTable.Toolbar";
|
|
128
|
+
const $e = j(
|
|
129
|
+
({ className: t, children: e, ...a }, n) => /* @__PURE__ */ s(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
ref: n,
|
|
133
|
+
className: [
|
|
134
|
+
"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
135
|
+
// `grow` lets FilterBar absorb the free space; `min-w-0` lets the
|
|
136
|
+
// QuickSearch slot inside shrink below its intrinsic width when the
|
|
137
|
+
// toolbar runs `flex-nowrap` at `sm` and above, so the trailing
|
|
138
|
+
// Actions cluster stays pinned on a single row.
|
|
139
|
+
"ds:grow ds:min-w-0",
|
|
140
|
+
t ?? ""
|
|
141
|
+
].join(" ").trim(),
|
|
142
|
+
...a,
|
|
143
|
+
children: e
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
);
|
|
147
|
+
$e.displayName = "DataTable.Toolbar.FilterBar";
|
|
148
|
+
const qe = j(
|
|
149
|
+
({ className: t, children: e, ...a }, n) => /* @__PURE__ */ s(
|
|
150
|
+
"div",
|
|
151
|
+
{
|
|
152
|
+
ref: n,
|
|
153
|
+
className: [
|
|
154
|
+
"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
155
|
+
"ds:ms-auto",
|
|
156
|
+
t ?? ""
|
|
157
|
+
].join(" ").trim(),
|
|
158
|
+
...a,
|
|
159
|
+
children: e
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
);
|
|
163
|
+
qe.displayName = "DataTable.Toolbar.Actions";
|
|
164
|
+
const Ge = j(
|
|
165
|
+
({ label: t, onExport: e, intent: a = "outline", ...n }, r) => {
|
|
166
|
+
const { t: o } = F(), { getApi: l } = $("DataTable.Toolbar.ExportCsv"), u = M(() => {
|
|
167
|
+
const d = l();
|
|
168
|
+
d && (e ? e(d) : d.exportDataAsCsv());
|
|
169
|
+
}, [l, e]);
|
|
170
|
+
return /* @__PURE__ */ s(
|
|
171
|
+
B,
|
|
172
|
+
{
|
|
173
|
+
ref: r,
|
|
174
|
+
type: "button",
|
|
175
|
+
intent: a,
|
|
176
|
+
icon: /* @__PURE__ */ s(ne, { "aria-hidden": !0 }),
|
|
177
|
+
tooltip: t ?? o("dataTable.exportCsv"),
|
|
178
|
+
onClick: u,
|
|
179
|
+
...n
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
Ge.displayName = "DataTable.Toolbar.ExportCsv";
|
|
185
|
+
function K(t, e = [30, 30, 30]) {
|
|
186
|
+
if (typeof document > "u") return e;
|
|
187
|
+
const a = document.createElement("span");
|
|
188
|
+
a.style.color = `hsl(var(${t}))`, a.style.position = "absolute", a.style.visibility = "hidden", document.body.appendChild(a);
|
|
189
|
+
const n = getComputedStyle(a).color;
|
|
190
|
+
document.body.removeChild(a);
|
|
191
|
+
const r = n.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);
|
|
192
|
+
return r ? [Number(r[1]), Number(r[2]), Number(r[3])] : e;
|
|
193
|
+
}
|
|
194
|
+
async function Ve(t, e) {
|
|
195
|
+
if (!t) return;
|
|
196
|
+
const [{ jsPDF: a }, { default: n }] = await Promise.all([
|
|
197
|
+
import("./jspdf.es.min-DaapWjR1.js").then((g) => g.j),
|
|
198
|
+
import("./jspdf.plugin.autotable-CSiDNyPn.js")
|
|
199
|
+
]), o = (t.getColumns() ?? []).filter((g) => g.isVisible()), l = [
|
|
200
|
+
o.map((g) => t.getDisplayNameForColumn(g, null) ?? "")
|
|
201
|
+
], u = [];
|
|
202
|
+
t.forEachNodeAfterFilterAndSort((g) => {
|
|
203
|
+
if (!g.data) return;
|
|
204
|
+
const b = o.map((y) => {
|
|
205
|
+
const x = t.getCellValue({
|
|
206
|
+
rowNode: g,
|
|
207
|
+
colKey: y,
|
|
208
|
+
useFormatter: !0
|
|
209
|
+
});
|
|
210
|
+
return x == null ? "" : String(x);
|
|
211
|
+
});
|
|
212
|
+
u.push(b);
|
|
213
|
+
});
|
|
214
|
+
const d = K("--muted", [240, 240, 240]), i = K("--foreground", [30, 30, 30]), c = K("--card-foreground", [30, 30, 30]), p = K("--card", [250, 250, 250]), v = new a({ orientation: "landscape" });
|
|
215
|
+
n(v, {
|
|
216
|
+
head: l,
|
|
217
|
+
body: u,
|
|
218
|
+
headStyles: { fillColor: d, textColor: i },
|
|
219
|
+
bodyStyles: { textColor: c },
|
|
220
|
+
alternateRowStyles: { fillColor: p },
|
|
221
|
+
styles: {
|
|
222
|
+
font: "helvetica",
|
|
223
|
+
fontSize: 10,
|
|
224
|
+
cellPadding: 4
|
|
225
|
+
}
|
|
226
|
+
}), v.save(e.fileName);
|
|
227
|
+
}
|
|
228
|
+
const Be = j(
|
|
229
|
+
({ label: t, onClick: e, fileName: a, intent: n = "outline", ...r }, o) => {
|
|
230
|
+
const { t: l } = F(), { getApi: u } = $("DataTable.Toolbar.ExportPdf"), d = M(() => {
|
|
231
|
+
const i = u();
|
|
232
|
+
if (e) {
|
|
233
|
+
e(i);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
Ve(i, {
|
|
237
|
+
fileName: a ?? "data-table-export.pdf"
|
|
238
|
+
});
|
|
239
|
+
}, [u, e, a]);
|
|
240
|
+
return /* @__PURE__ */ s(
|
|
241
|
+
B,
|
|
242
|
+
{
|
|
243
|
+
ref: o,
|
|
244
|
+
type: "button",
|
|
245
|
+
intent: n,
|
|
246
|
+
icon: /* @__PURE__ */ s(ke, { "aria-hidden": !0 }),
|
|
247
|
+
tooltip: t ?? l("dataTable.exportPdf"),
|
|
248
|
+
onClick: d,
|
|
249
|
+
...r
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
Be.displayName = "DataTable.Toolbar.ExportPdf";
|
|
255
|
+
const Ue = j(
|
|
256
|
+
({ label: t, intent: e = "outline", ...a }, n) => {
|
|
257
|
+
const { t: r } = F(), { onPrint: o } = $("DataTable.Toolbar.Print");
|
|
258
|
+
return /* @__PURE__ */ s(
|
|
259
|
+
B,
|
|
260
|
+
{
|
|
261
|
+
ref: n,
|
|
262
|
+
type: "button",
|
|
263
|
+
intent: e,
|
|
264
|
+
icon: /* @__PURE__ */ s(Dt, { "aria-hidden": !0 }),
|
|
265
|
+
tooltip: t ?? r("dataTable.print"),
|
|
266
|
+
onClick: o,
|
|
267
|
+
...a
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
Ue.displayName = "DataTable.Toolbar.Print";
|
|
273
|
+
const He = ({ placeholder: t, debounceMs: e = 150 }) => {
|
|
274
|
+
const { t: a } = F(), { getApi: n } = $("DataTable.Toolbar.QuickSearch"), [r, o] = R(""), l = X(void 0);
|
|
275
|
+
return P(() => (l.current && window.clearTimeout(l.current), l.current = window.setTimeout(() => {
|
|
276
|
+
const u = n();
|
|
277
|
+
u && u.setGridOption("quickFilterText", r);
|
|
278
|
+
}, e), () => {
|
|
279
|
+
l.current && window.clearTimeout(l.current);
|
|
280
|
+
}), [r, e, n]), // Slot wrapper caps the search at a sensible legible width on desktop —
|
|
281
|
+
// without this, TextInput's `w-full` lets the QuickSearch absorb the
|
|
282
|
+
// entire FilterBar row and push trailing Actions onto a second line at
|
|
283
|
+
// 1024 / 1280 / 1440. `min-w-0` lets the slot shrink below `24rem` when
|
|
284
|
+
// the toolbar is squeezed on narrow viewports. There is no
|
|
285
|
+
// `--toolbar-search-max` token in the kit yet — see this component's
|
|
286
|
+
// summary for a follow-up note recommending we add one.
|
|
287
|
+
/* @__PURE__ */ s("div", { className: "ds:w-full ds:max-w-[24rem] ds:min-w-0", children: /* @__PURE__ */ s(
|
|
288
|
+
fe,
|
|
289
|
+
{
|
|
290
|
+
type: "search",
|
|
291
|
+
size: "sm",
|
|
292
|
+
value: r,
|
|
293
|
+
onChange: (u) => o(u.target.value),
|
|
294
|
+
placeholder: t ?? a("dataTable.quickSearch.placeholder", "Search…"),
|
|
295
|
+
startAdornment: /* @__PURE__ */ s(me, { "aria-hidden": !0, className: "ds:size-4" }),
|
|
296
|
+
clearable: !0,
|
|
297
|
+
onClear: () => o(""),
|
|
298
|
+
"aria-label": a("dataTable.quickSearch.label", "Quick search")
|
|
299
|
+
}
|
|
300
|
+
) });
|
|
301
|
+
};
|
|
302
|
+
He.displayName = "DataTable.Toolbar.QuickSearch";
|
|
303
|
+
const Ke = j(
|
|
304
|
+
({ onRefresh: t, label: e, intent: a = "outline", ...n }, r) => {
|
|
305
|
+
const { t: o } = F();
|
|
306
|
+
return /* @__PURE__ */ s(
|
|
307
|
+
B,
|
|
308
|
+
{
|
|
309
|
+
ref: r,
|
|
310
|
+
type: "button",
|
|
311
|
+
intent: a,
|
|
312
|
+
icon: /* @__PURE__ */ s(qt, { "aria-hidden": !0 }),
|
|
313
|
+
tooltip: e ?? o("dataTable.refresh", "Refresh"),
|
|
314
|
+
onClick: t,
|
|
315
|
+
...n
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
Ke.displayName = "DataTable.Toolbar.Refresh";
|
|
321
|
+
function Ut(t) {
|
|
322
|
+
if (!t || typeof t != "object") return "";
|
|
323
|
+
const e = t;
|
|
324
|
+
if (typeof e.filter == "string" || typeof e.filter == "number") {
|
|
325
|
+
const a = typeof e.type == "string" ? e.type : "", n = typeof e.filterTo == "string" || typeof e.filterTo == "number" ? String(e.filterTo) : "";
|
|
326
|
+
return a === "inRange" && n ? `${e.filter} – ${n}` : a ? `${a} ${e.filter}` : String(e.filter);
|
|
327
|
+
}
|
|
328
|
+
return typeof e.dateFrom == "string" ? typeof e.dateTo == "string" && e.dateTo ? `${e.dateFrom} – ${e.dateTo}` : String(e.dateFrom) : Array.isArray(e.values) ? e.values.map(String).join(", ") : "";
|
|
329
|
+
}
|
|
330
|
+
const We = () => {
|
|
331
|
+
const { t } = F(), { getApi: e } = $("DataTable.Toolbar.FilterChips"), [a, n] = R([]), [r, o] = R(""), l = M(() => {
|
|
332
|
+
const c = e();
|
|
333
|
+
if (!c) {
|
|
334
|
+
n([]), o("");
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const p = c.getFilterModel() ?? {}, v = c.getColumns() ?? [], g = [];
|
|
338
|
+
for (const y of Object.keys(p)) {
|
|
339
|
+
const x = v.find((m) => m.getColId() === y), f = c.getDisplayNameForColumn(x, null) ?? y;
|
|
340
|
+
g.push({
|
|
341
|
+
colId: y,
|
|
342
|
+
headerName: f,
|
|
343
|
+
text: Ut(p[y])
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
n(g);
|
|
347
|
+
const b = c.getGridOption("quickFilterText");
|
|
348
|
+
o(typeof b == "string" ? b : "");
|
|
349
|
+
}, [e]);
|
|
350
|
+
if (P(() => {
|
|
351
|
+
const c = e();
|
|
352
|
+
if (!c) return;
|
|
353
|
+
const p = (v) => l();
|
|
354
|
+
return c.addEventListener("filterChanged", p), l(), () => {
|
|
355
|
+
c.removeEventListener("filterChanged", p);
|
|
356
|
+
};
|
|
357
|
+
}, [e, l]), a.length + (r ? 1 : 0) === 0) return null;
|
|
358
|
+
function d(c) {
|
|
359
|
+
const p = e();
|
|
360
|
+
p && p.destroyFilter(c);
|
|
361
|
+
}
|
|
362
|
+
function i() {
|
|
363
|
+
const c = e();
|
|
364
|
+
c && (c.setFilterModel(null), c.setGridOption("quickFilterText", ""), o(""));
|
|
365
|
+
}
|
|
366
|
+
return /* @__PURE__ */ E(
|
|
367
|
+
"div",
|
|
368
|
+
{
|
|
369
|
+
role: "group",
|
|
370
|
+
"aria-label": t("dataTable.filterChips.label", "Active filters"),
|
|
371
|
+
className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
372
|
+
children: [
|
|
373
|
+
r && /* @__PURE__ */ s(
|
|
374
|
+
ae,
|
|
375
|
+
{
|
|
376
|
+
label: `${t("dataTable.quickSearch.label", "Quick search")}: ${r}`,
|
|
377
|
+
size: "sm",
|
|
378
|
+
fill: "outline",
|
|
379
|
+
onRemove: () => {
|
|
380
|
+
const c = e();
|
|
381
|
+
c == null || c.setGridOption("quickFilterText", ""), o("");
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
),
|
|
385
|
+
a.map((c) => /* @__PURE__ */ s(
|
|
386
|
+
ae,
|
|
387
|
+
{
|
|
388
|
+
label: c.text ? `${c.headerName}: ${c.text}` : c.headerName,
|
|
389
|
+
size: "sm",
|
|
390
|
+
fill: "outline",
|
|
391
|
+
onRemove: () => d(c.colId)
|
|
392
|
+
},
|
|
393
|
+
c.colId
|
|
394
|
+
)),
|
|
395
|
+
/* @__PURE__ */ s(
|
|
396
|
+
_,
|
|
397
|
+
{
|
|
398
|
+
type: "button",
|
|
399
|
+
intent: "ghost",
|
|
400
|
+
size: "sm",
|
|
401
|
+
onClick: i,
|
|
402
|
+
startIcon: /* @__PURE__ */ s(De, { "aria-hidden": !0, className: "ds:size-4" }),
|
|
403
|
+
children: t("dataTable.filterChips.clearAll", "Clear all")
|
|
404
|
+
}
|
|
405
|
+
)
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
};
|
|
410
|
+
We.displayName = "DataTable.Toolbar.FilterChips";
|
|
411
|
+
const Qe = ({
|
|
412
|
+
field: t,
|
|
413
|
+
options: e,
|
|
414
|
+
label: a
|
|
415
|
+
}) => {
|
|
416
|
+
const { t: n } = F(), { getApi: r } = $("DataTable.Toolbar.FacetFilter"), [o, l] = R(null);
|
|
417
|
+
function u(d) {
|
|
418
|
+
l(d);
|
|
419
|
+
const i = r();
|
|
420
|
+
if (i) {
|
|
421
|
+
if (d === null) {
|
|
422
|
+
i.destroyFilter(t);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
i.setColumnFilterModel(t, {
|
|
426
|
+
type: "equals",
|
|
427
|
+
filter: d
|
|
428
|
+
}), i.onFilterChanged();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return /* @__PURE__ */ s(
|
|
432
|
+
"div",
|
|
433
|
+
{
|
|
434
|
+
role: "group",
|
|
435
|
+
"aria-label": a ?? n("dataTable.facetFilter.label", "Filter"),
|
|
436
|
+
className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
437
|
+
children: e.map((d) => {
|
|
438
|
+
const i = o === d.value;
|
|
439
|
+
return /* @__PURE__ */ s(
|
|
440
|
+
_,
|
|
441
|
+
{
|
|
442
|
+
type: "button",
|
|
443
|
+
size: "sm",
|
|
444
|
+
intent: i ? "primary" : "secondary",
|
|
445
|
+
"aria-pressed": i,
|
|
446
|
+
onClick: () => u(d.value),
|
|
447
|
+
children: d.label
|
|
448
|
+
},
|
|
449
|
+
String(d.value)
|
|
450
|
+
);
|
|
451
|
+
})
|
|
452
|
+
}
|
|
453
|
+
);
|
|
454
|
+
};
|
|
455
|
+
Qe.displayName = "DataTable.Toolbar.FacetFilter";
|
|
456
|
+
const Ht = ["csv", "xlsx", "pdf"];
|
|
457
|
+
async function Kt(t, e) {
|
|
458
|
+
if (!t) return;
|
|
459
|
+
const a = await import("./exceljs.min-DUJ-5CGx.js").then((y) => y.e), n = new a.Workbook(), r = n.addWorksheet("Sheet1"), l = (t.getColumns() ?? []).filter((y) => y.isVisible());
|
|
460
|
+
r.addRow(
|
|
461
|
+
l.map(
|
|
462
|
+
(y) => t.getDisplayNameForColumn(y, null) ?? y.getColId()
|
|
463
|
+
)
|
|
464
|
+
), t.forEachNodeAfterFilterAndSort((y) => {
|
|
465
|
+
y.data && r.addRow(
|
|
466
|
+
l.map((x) => {
|
|
467
|
+
const f = t.getCellValue({
|
|
468
|
+
rowNode: y,
|
|
469
|
+
colKey: x,
|
|
470
|
+
useFormatter: !0
|
|
471
|
+
});
|
|
472
|
+
return f ?? "";
|
|
473
|
+
})
|
|
474
|
+
);
|
|
475
|
+
});
|
|
476
|
+
const u = K("--muted", [240, 240, 240]), d = K("--foreground", [30, 30, 30]), i = r.getRow(1), c = ([y, x, f]) => `${y.toString(16).padStart(2, "0")}${x.toString(16).padStart(2, "0")}${f.toString(16).padStart(2, "0")}`.toUpperCase();
|
|
477
|
+
i.eachCell((y) => {
|
|
478
|
+
y.font = { bold: !0, color: { argb: `FF${c(d)}` } }, y.fill = {
|
|
479
|
+
type: "pattern",
|
|
480
|
+
pattern: "solid",
|
|
481
|
+
fgColor: { argb: `FF${c(u)}` }
|
|
482
|
+
};
|
|
483
|
+
});
|
|
484
|
+
const p = await n.xlsx.writeBuffer(), v = new Blob([p], {
|
|
485
|
+
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
486
|
+
}), g = URL.createObjectURL(v), b = document.createElement("a");
|
|
487
|
+
b.href = g, b.download = e.fileName, document.body.appendChild(b), b.click(), document.body.removeChild(b), URL.revokeObjectURL(g);
|
|
488
|
+
}
|
|
489
|
+
const Xe = Ne(null);
|
|
490
|
+
function Wt() {
|
|
491
|
+
const t = Se(Xe);
|
|
492
|
+
if (!t)
|
|
493
|
+
throw new Error(
|
|
494
|
+
"DataTable.Toolbar.ExportMenu.Item must be rendered inside DataTable.Toolbar.ExportMenu."
|
|
495
|
+
);
|
|
496
|
+
return t;
|
|
497
|
+
}
|
|
498
|
+
const Je = ({ children: t, label: e }) => {
|
|
499
|
+
const { t: a } = F(), { getApi: n } = $("DataTable.Toolbar.ExportMenu"), r = I(() => ({ getApi: n }), [n]), o = t ?? Ht.map((l) => /* @__PURE__ */ s(ge, { format: l }, l));
|
|
500
|
+
return /* @__PURE__ */ s(Xe.Provider, { value: r, children: /* @__PURE__ */ E(Y.Root, { children: [
|
|
501
|
+
/* @__PURE__ */ s(Y.Trigger, { asChild: !0, children: /* @__PURE__ */ s(
|
|
502
|
+
B,
|
|
503
|
+
{
|
|
504
|
+
type: "button",
|
|
505
|
+
intent: "outline",
|
|
506
|
+
icon: /* @__PURE__ */ s(ne, { "aria-hidden": !0 }),
|
|
507
|
+
tooltip: e ?? a("dataTable.export.menu", "Export"),
|
|
508
|
+
"aria-label": e ?? a("dataTable.export.menu", "Export"),
|
|
509
|
+
"aria-haspopup": "menu"
|
|
510
|
+
}
|
|
511
|
+
) }),
|
|
512
|
+
/* @__PURE__ */ s(Y.Content, { align: "end", sideOffset: 4, children: o })
|
|
513
|
+
] }) });
|
|
514
|
+
};
|
|
515
|
+
Je.displayName = "DataTable.Toolbar.ExportMenu";
|
|
516
|
+
function Qt(t, e) {
|
|
517
|
+
return e === "csv" ? t("dataTable.export.csv", "Export CSV") : e === "xlsx" ? t("dataTable.export.xlsx", "Export Excel") : e === "pdf" ? t("dataTable.export.pdf", "Export PDF") : t("dataTable.export.custom", "Export");
|
|
518
|
+
}
|
|
519
|
+
function Xt(t) {
|
|
520
|
+
return t === "csv" ? /* @__PURE__ */ s(ne, { "aria-hidden": !0, className: "ds:size-4" }) : t === "xlsx" ? /* @__PURE__ */ s(kt, { "aria-hidden": !0, className: "ds:size-4" }) : t === "pdf" ? /* @__PURE__ */ s(ke, { "aria-hidden": !0, className: "ds:size-4" }) : /* @__PURE__ */ s(ne, { "aria-hidden": !0, className: "ds:size-4" });
|
|
521
|
+
}
|
|
522
|
+
const ge = ({
|
|
523
|
+
format: t,
|
|
524
|
+
label: e,
|
|
525
|
+
onClick: a,
|
|
526
|
+
fileName: n
|
|
527
|
+
}) => {
|
|
528
|
+
const { t: r } = F(), { getApi: o } = Wt(), l = M(() => {
|
|
529
|
+
const u = o();
|
|
530
|
+
if (t === "csv") {
|
|
531
|
+
u == null || u.exportDataAsCsv();
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
if (t === "pdf") {
|
|
535
|
+
Ve(u, {
|
|
536
|
+
fileName: n ?? "data-table-export.pdf"
|
|
537
|
+
});
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (t === "xlsx") {
|
|
541
|
+
Kt(u, {
|
|
542
|
+
fileName: n ?? "data-table-export.xlsx"
|
|
543
|
+
});
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
a == null || a(u);
|
|
547
|
+
}, [t, n, a, o]);
|
|
548
|
+
return /* @__PURE__ */ s(Y.Item, { onSelect: l, children: /* @__PURE__ */ E("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
|
|
549
|
+
Xt(t),
|
|
550
|
+
/* @__PURE__ */ s("span", { children: e ?? Qt(r, t) })
|
|
551
|
+
] }) });
|
|
552
|
+
};
|
|
553
|
+
ge.displayName = "DataTable.Toolbar.ExportMenu.Item";
|
|
554
|
+
function Jt(t) {
|
|
555
|
+
return t ? (t.getColumns() ?? []).map((a) => a.getColDef().hide === void 0 && a.getColId().startsWith("ag-Grid-") ? null : {
|
|
556
|
+
colId: a.getColId(),
|
|
557
|
+
displayName: t.getDisplayNameForColumn(a, null) || a.getColId(),
|
|
558
|
+
visible: a.isVisible()
|
|
559
|
+
}).filter((a) => a !== null) : [];
|
|
560
|
+
}
|
|
561
|
+
const Ze = ({ label: t }) => {
|
|
562
|
+
const { t: e } = F(), { getApi: a } = $("DataTable.Toolbar.ColumnToggle"), [n, r] = R(!1), [o, l] = R([]), [u, d] = R(null), [i, c] = R(null);
|
|
563
|
+
P(() => {
|
|
564
|
+
n && l(Jt(a()));
|
|
565
|
+
}, [n, a]);
|
|
566
|
+
const p = M(
|
|
567
|
+
(b, y) => {
|
|
568
|
+
const x = a();
|
|
569
|
+
x && (x.setColumnsVisible([b], y), l(
|
|
570
|
+
(f) => f.map(
|
|
571
|
+
(m) => m.colId === b ? { ...m, visible: y } : m
|
|
572
|
+
)
|
|
573
|
+
));
|
|
574
|
+
},
|
|
575
|
+
[a]
|
|
576
|
+
), v = M(
|
|
577
|
+
(b, y) => {
|
|
578
|
+
if (b === y) return;
|
|
579
|
+
const x = a();
|
|
580
|
+
if (!x) return;
|
|
581
|
+
l((m) => {
|
|
582
|
+
const h = m.findIndex((D) => D.colId === b), C = m.findIndex((D) => D.colId === y);
|
|
583
|
+
if (h < 0 || C < 0) return m;
|
|
584
|
+
const S = [...m], [z] = S.splice(h, 1);
|
|
585
|
+
return S.splice(C, 0, z), S;
|
|
586
|
+
});
|
|
587
|
+
const f = o.findIndex((m) => m.colId === y);
|
|
588
|
+
f >= 0 && x.moveColumns([b], f);
|
|
589
|
+
},
|
|
590
|
+
[a, o]
|
|
591
|
+
), g = t ?? e("dataTable.columnToggle");
|
|
592
|
+
return /* @__PURE__ */ E(Z.Root, { open: n, onOpenChange: r, children: [
|
|
593
|
+
/* @__PURE__ */ s(Z.Trigger, { asChild: !0, children: /* @__PURE__ */ s(
|
|
594
|
+
B,
|
|
595
|
+
{
|
|
596
|
+
type: "button",
|
|
597
|
+
intent: "outline",
|
|
598
|
+
icon: /* @__PURE__ */ s(_t, { "aria-hidden": !0 }),
|
|
599
|
+
"aria-label": g,
|
|
600
|
+
"aria-haspopup": "dialog"
|
|
601
|
+
}
|
|
602
|
+
) }),
|
|
603
|
+
/* @__PURE__ */ E(Z.Content, { size: "sm", align: "end", children: [
|
|
604
|
+
/* @__PURE__ */ s(Z.Heading, { children: g }),
|
|
605
|
+
/* @__PURE__ */ s(
|
|
606
|
+
"ul",
|
|
607
|
+
{
|
|
608
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
|
|
609
|
+
"aria-label": g,
|
|
610
|
+
children: o.map((b) => {
|
|
611
|
+
const y = u === b.colId, x = i === b.colId && u !== b.colId;
|
|
612
|
+
return /* @__PURE__ */ E(
|
|
613
|
+
"li",
|
|
614
|
+
{
|
|
615
|
+
draggable: !0,
|
|
616
|
+
onDragStart: (f) => {
|
|
617
|
+
d(b.colId), f.dataTransfer.effectAllowed = "move", f.dataTransfer.setData("text/plain", b.colId);
|
|
618
|
+
},
|
|
619
|
+
onDragOver: (f) => {
|
|
620
|
+
f.preventDefault(), f.dataTransfer.dropEffect = "move", c(b.colId);
|
|
621
|
+
},
|
|
622
|
+
onDragLeave: () => {
|
|
623
|
+
c((f) => f === b.colId ? null : f);
|
|
624
|
+
},
|
|
625
|
+
onDrop: (f) => {
|
|
626
|
+
f.preventDefault();
|
|
627
|
+
const m = f.dataTransfer.getData("text/plain");
|
|
628
|
+
m && v(m, b.colId), d(null), c(null);
|
|
629
|
+
},
|
|
630
|
+
onDragEnd: () => {
|
|
631
|
+
d(null), c(null);
|
|
632
|
+
},
|
|
633
|
+
className: [
|
|
634
|
+
"ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-xs)] ds:py-[var(--spacing-2xs,var(--spacing-xs))] ds:transition-colors",
|
|
635
|
+
y ? "ds:opacity-50" : "",
|
|
636
|
+
x ? "ds:bg-[color:color-mix(in_srgb,var(--primary)_8%,transparent)]" : ""
|
|
637
|
+
].filter(Boolean).join(" "),
|
|
638
|
+
children: [
|
|
639
|
+
/* @__PURE__ */ s(
|
|
640
|
+
"span",
|
|
641
|
+
{
|
|
642
|
+
"aria-hidden": "true",
|
|
643
|
+
className: "ds:cursor-grab ds:text-[color:var(--muted-foreground)] ds:active:cursor-grabbing",
|
|
644
|
+
children: /* @__PURE__ */ s(Rt, { className: "ds:size-4" })
|
|
645
|
+
}
|
|
646
|
+
),
|
|
647
|
+
/* @__PURE__ */ s(
|
|
648
|
+
Re,
|
|
649
|
+
{
|
|
650
|
+
label: b.displayName,
|
|
651
|
+
checked: b.visible,
|
|
652
|
+
onCheckedChange: (f) => p(b.colId, f === !0)
|
|
653
|
+
}
|
|
654
|
+
)
|
|
655
|
+
]
|
|
656
|
+
},
|
|
657
|
+
b.colId
|
|
658
|
+
);
|
|
659
|
+
})
|
|
660
|
+
}
|
|
661
|
+
)
|
|
662
|
+
] })
|
|
663
|
+
] });
|
|
664
|
+
};
|
|
665
|
+
Ze.displayName = "DataTable.Toolbar.ColumnToggle";
|
|
666
|
+
const Ye = j(
|
|
667
|
+
({ label: t, icon: e, onClick: a, variant: n = "default", size: r = "sm", ...o }, l) => {
|
|
668
|
+
const { t: u } = F(), { getApi: d, selectionCount: i } = $(
|
|
669
|
+
"DataTable.Toolbar.BulkAction"
|
|
670
|
+
);
|
|
671
|
+
return i === 0 ? null : /* @__PURE__ */ E(
|
|
672
|
+
_,
|
|
673
|
+
{
|
|
674
|
+
ref: l,
|
|
675
|
+
type: "button",
|
|
676
|
+
intent: n === "destructive" ? "destructive" : "secondary",
|
|
677
|
+
size: r,
|
|
678
|
+
startIcon: Gt(e),
|
|
679
|
+
onClick: () => a(d()),
|
|
680
|
+
"aria-label": `${t} (${u("dataTable.bulkAction", { count: i })})`,
|
|
681
|
+
...o,
|
|
682
|
+
children: [
|
|
683
|
+
/* @__PURE__ */ s("span", { children: t }),
|
|
684
|
+
/* @__PURE__ */ s(
|
|
685
|
+
"span",
|
|
686
|
+
{
|
|
687
|
+
"aria-hidden": "true",
|
|
688
|
+
className: "ds:ms-[var(--spacing-xs)] ds:opacity-80",
|
|
689
|
+
children: u("dataTable.bulkAction", { count: i })
|
|
690
|
+
}
|
|
691
|
+
)
|
|
692
|
+
]
|
|
693
|
+
}
|
|
694
|
+
);
|
|
695
|
+
}
|
|
696
|
+
);
|
|
697
|
+
Ye.displayName = "DataTable.Toolbar.BulkAction";
|
|
698
|
+
const Zt = Object.assign(Je, {
|
|
699
|
+
Item: ge
|
|
700
|
+
}), te = Object.assign(je, {
|
|
701
|
+
FilterBar: $e,
|
|
702
|
+
Actions: qe,
|
|
703
|
+
/** @deprecated Use `Toolbar.ExportMenu` with a `csv` item. */
|
|
704
|
+
ExportCsv: Ge,
|
|
705
|
+
/** @deprecated Use `Toolbar.ExportMenu` with a `pdf` item. */
|
|
706
|
+
ExportPdf: Be,
|
|
707
|
+
Print: Ue,
|
|
708
|
+
ColumnToggle: Ze,
|
|
709
|
+
BulkAction: Ye,
|
|
710
|
+
QuickSearch: He,
|
|
711
|
+
Refresh: Ke,
|
|
712
|
+
FilterChips: We,
|
|
713
|
+
FacetFilter: Qe,
|
|
714
|
+
ExportMenu: Zt
|
|
715
|
+
}), Yt = [
|
|
716
|
+
"contains",
|
|
717
|
+
"equals",
|
|
718
|
+
"startsWith",
|
|
719
|
+
"endsWith",
|
|
720
|
+
"notContains"
|
|
721
|
+
];
|
|
722
|
+
function ea(t) {
|
|
723
|
+
const e = new Intl.Collator(t, {
|
|
724
|
+
sensitivity: "base",
|
|
725
|
+
usage: "search"
|
|
726
|
+
});
|
|
727
|
+
function a(n, r) {
|
|
728
|
+
if (r.length === 0) return 0;
|
|
729
|
+
if (r.length > n.length) return -1;
|
|
730
|
+
for (let o = 0; o <= n.length - r.length; o += 1)
|
|
731
|
+
if (e.compare(n.slice(o, o + r.length), r) === 0)
|
|
732
|
+
return o;
|
|
733
|
+
return -1;
|
|
734
|
+
}
|
|
735
|
+
return {
|
|
736
|
+
equals: (n, r) => e.compare(n, r) === 0,
|
|
737
|
+
contains: (n, r) => a(n, r) !== -1,
|
|
738
|
+
startsWith: (n, r) => r.length <= n.length && e.compare(n.slice(0, r.length), r) === 0,
|
|
739
|
+
endsWith: (n, r) => r.length <= n.length && e.compare(
|
|
740
|
+
n.slice(n.length - r.length),
|
|
741
|
+
r
|
|
742
|
+
) === 0
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
function ta(t) {
|
|
746
|
+
return t == null ? null : typeof t == "string" ? t : String(t);
|
|
747
|
+
}
|
|
748
|
+
function aa(t) {
|
|
749
|
+
const { model: e, onModelChange: a, getValue: n, placeholder: r, defaultOperator: o } = t, { t: l } = F("ui"), u = (e == null ? void 0 : e.type) ?? o ?? "contains", [d, i] = R(u), [c, p] = R((e == null ? void 0 : e.filter) ?? "");
|
|
750
|
+
P(() => {
|
|
751
|
+
i((e == null ? void 0 : e.type) ?? o ?? "contains"), p((e == null ? void 0 : e.filter) ?? "");
|
|
752
|
+
}, [e, o]);
|
|
753
|
+
const v = I(() => ea(Et.language), []);
|
|
754
|
+
J({
|
|
755
|
+
doesFilterPass: (f) => {
|
|
756
|
+
const m = e;
|
|
757
|
+
if (!m || m.filter === "") return !0;
|
|
758
|
+
const h = ta(n(f.node));
|
|
759
|
+
if (h === null) return !1;
|
|
760
|
+
switch (m.type) {
|
|
761
|
+
case "equals":
|
|
762
|
+
return v.equals(h, m.filter);
|
|
763
|
+
case "contains":
|
|
764
|
+
return v.contains(h, m.filter);
|
|
765
|
+
case "startsWith":
|
|
766
|
+
return v.startsWith(h, m.filter);
|
|
767
|
+
case "endsWith":
|
|
768
|
+
return v.endsWith(h, m.filter);
|
|
769
|
+
case "notContains":
|
|
770
|
+
return !v.contains(h, m.filter);
|
|
771
|
+
default:
|
|
772
|
+
return !0;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
function g() {
|
|
777
|
+
if (c.trim() === "") {
|
|
778
|
+
a(null);
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
a({ type: d, filter: c });
|
|
782
|
+
}
|
|
783
|
+
function b() {
|
|
784
|
+
p(""), i(o ?? "contains"), a(null);
|
|
785
|
+
}
|
|
786
|
+
const y = Yt.map(
|
|
787
|
+
(f) => ({
|
|
788
|
+
value: f,
|
|
789
|
+
label: l(`dataTable.textFilter.operators.${f}`)
|
|
790
|
+
})
|
|
791
|
+
), x = r ?? l("dataTable.textFilter.placeholder");
|
|
792
|
+
return /* @__PURE__ */ E(
|
|
793
|
+
"div",
|
|
794
|
+
{
|
|
795
|
+
"data-component": "text-filter",
|
|
796
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)] ds:min-w-[240px]",
|
|
797
|
+
children: [
|
|
798
|
+
/* @__PURE__ */ s(
|
|
799
|
+
Ee,
|
|
800
|
+
{
|
|
801
|
+
size: "sm",
|
|
802
|
+
options: y,
|
|
803
|
+
value: d,
|
|
804
|
+
onValueChange: (f) => {
|
|
805
|
+
f !== "" && i(f);
|
|
806
|
+
},
|
|
807
|
+
"aria-label": l("dataTable.textFilter.operators.contains")
|
|
808
|
+
}
|
|
809
|
+
),
|
|
810
|
+
/* @__PURE__ */ s(
|
|
811
|
+
fe,
|
|
812
|
+
{
|
|
813
|
+
size: "sm",
|
|
814
|
+
value: c,
|
|
815
|
+
onChange: (f) => p(f.target.value),
|
|
816
|
+
onKeyDown: (f) => {
|
|
817
|
+
f.key === "Enter" && (f.preventDefault(), g());
|
|
818
|
+
},
|
|
819
|
+
placeholder: x,
|
|
820
|
+
"aria-label": x,
|
|
821
|
+
startAdornment: /* @__PURE__ */ s(me, { "aria-hidden": "true", className: "ds:size-4" })
|
|
822
|
+
}
|
|
823
|
+
),
|
|
824
|
+
/* @__PURE__ */ E("div", { className: "ds:flex ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)] ds:pt-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)]", children: [
|
|
825
|
+
/* @__PURE__ */ s(_, { intent: "ghost", size: "sm", onClick: b, type: "button", children: l("dataTable.textFilter.clear") }),
|
|
826
|
+
/* @__PURE__ */ s(_, { intent: "primary", size: "sm", onClick: g, type: "button", children: l("dataTable.textFilter.apply") })
|
|
827
|
+
] })
|
|
828
|
+
]
|
|
829
|
+
}
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
function na(t) {
|
|
833
|
+
var p, v;
|
|
834
|
+
const { model: e, onModelChange: a, column: n } = t, { t: r } = F("ui"), o = ((v = (p = n == null ? void 0 : n.getColDef) == null ? void 0 : p.call(n)) == null ? void 0 : v.filterParams) ?? {}, l = o.defaultOperator ?? "contains", u = o.placeholder ?? r("dataTable.textFilter.placeholder"), [d, i] = R((e == null ? void 0 : e.filter) ?? "");
|
|
835
|
+
P(() => {
|
|
836
|
+
i((e == null ? void 0 : e.filter) ?? "");
|
|
837
|
+
}, [e == null ? void 0 : e.filter]), P(() => {
|
|
838
|
+
if (d === ((e == null ? void 0 : e.filter) ?? "")) return;
|
|
839
|
+
const g = setTimeout(() => {
|
|
840
|
+
if (d === "") {
|
|
841
|
+
e && a(null);
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
a({ type: l, filter: d });
|
|
845
|
+
}, 200);
|
|
846
|
+
return () => clearTimeout(g);
|
|
847
|
+
}, [d, l, e, a]);
|
|
848
|
+
function c() {
|
|
849
|
+
i(""), e && a(null);
|
|
850
|
+
}
|
|
851
|
+
return /* @__PURE__ */ s("div", { "data-component": "text-floating-filter", className: "ds:w-full", children: /* @__PURE__ */ s(
|
|
852
|
+
fe,
|
|
853
|
+
{
|
|
854
|
+
size: "sm",
|
|
855
|
+
value: d,
|
|
856
|
+
onChange: (g) => i(g.target.value),
|
|
857
|
+
placeholder: u,
|
|
858
|
+
"aria-label": u,
|
|
859
|
+
startAdornment: /* @__PURE__ */ s(me, { "aria-hidden": "true", className: "ds:size-4" }),
|
|
860
|
+
endAdornment: d.length > 0 ? /* @__PURE__ */ s(
|
|
861
|
+
"button",
|
|
862
|
+
{
|
|
863
|
+
type: "button",
|
|
864
|
+
"aria-label": r("dataTable.textFilter.clear"),
|
|
865
|
+
onClick: c,
|
|
866
|
+
className: "ds:pointer-events-auto ds:flex ds:items-center ds:text-[var(--muted-foreground)] ds:hover:text-[var(--foreground)] ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
867
|
+
children: /* @__PURE__ */ s(De, { "aria-hidden": "true", className: "ds:size-4" })
|
|
868
|
+
}
|
|
869
|
+
) : void 0
|
|
870
|
+
}
|
|
871
|
+
) });
|
|
872
|
+
}
|
|
873
|
+
const ra = {
|
|
874
|
+
id: "data-table",
|
|
875
|
+
capabilities: [
|
|
876
|
+
"select_single",
|
|
877
|
+
"select_multiple",
|
|
878
|
+
"range_pick",
|
|
879
|
+
"filter",
|
|
880
|
+
"sort",
|
|
881
|
+
"paginate"
|
|
882
|
+
],
|
|
883
|
+
state: {
|
|
884
|
+
selection: {
|
|
885
|
+
type: "string[]",
|
|
886
|
+
descriptionKey: "ui.agent.dataTable.state.selection",
|
|
887
|
+
description: "Row ids of currently-selected rows.",
|
|
888
|
+
read: (t) => t.getSelection()
|
|
889
|
+
},
|
|
890
|
+
filter: {
|
|
891
|
+
type: "object",
|
|
892
|
+
descriptionKey: "ui.agent.dataTable.state.filter",
|
|
893
|
+
description: "Current ag-grid filter model, keyed by column id.",
|
|
894
|
+
read: (t) => t.getFilter()
|
|
895
|
+
},
|
|
896
|
+
sort: {
|
|
897
|
+
type: "Array<{ colId, sort }>",
|
|
898
|
+
descriptionKey: "ui.agent.dataTable.state.sort",
|
|
899
|
+
description: "Active sort, in priority order.",
|
|
900
|
+
read: (t) => t.getSort()
|
|
901
|
+
},
|
|
902
|
+
currentPage: {
|
|
903
|
+
type: "number",
|
|
904
|
+
descriptionKey: "ui.agent.dataTable.state.currentPage",
|
|
905
|
+
description: "Zero-indexed page number.",
|
|
906
|
+
read: (t) => t.getCurrentPage()
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
actions: {
|
|
910
|
+
select_rows: {
|
|
911
|
+
safety: "read",
|
|
912
|
+
argsType: "{ ids: string[] }",
|
|
913
|
+
descriptionKey: "ui.agent.dataTable.actions.selectRows",
|
|
914
|
+
description: "Replace the current selection with the given row ids.",
|
|
915
|
+
invoke: (t, e) => {
|
|
916
|
+
t.setSelection(e.ids);
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
select_range: {
|
|
920
|
+
safety: "read",
|
|
921
|
+
argsType: "{ fromId: string, toId: string }",
|
|
922
|
+
descriptionKey: "ui.agent.dataTable.actions.selectRange",
|
|
923
|
+
description: "Select every row between fromId and toId, inclusive, in current sort order.",
|
|
924
|
+
invoke: (t, e) => {
|
|
925
|
+
t.selectRange(e.fromId, e.toId);
|
|
926
|
+
}
|
|
927
|
+
},
|
|
928
|
+
clear_selection: {
|
|
929
|
+
safety: "read",
|
|
930
|
+
descriptionKey: "ui.agent.dataTable.actions.clearSelection",
|
|
931
|
+
description: "Deselect all rows.",
|
|
932
|
+
invoke: (t) => {
|
|
933
|
+
t.clearSelection();
|
|
934
|
+
}
|
|
935
|
+
},
|
|
936
|
+
apply_filter: {
|
|
937
|
+
safety: "read",
|
|
938
|
+
argsType: "{ model: Record<string, unknown> }",
|
|
939
|
+
descriptionKey: "ui.agent.dataTable.actions.applyFilter",
|
|
940
|
+
description: "Replace the filter model with the given object.",
|
|
941
|
+
invoke: (t, e) => {
|
|
942
|
+
t.setFilter(e.model);
|
|
943
|
+
}
|
|
944
|
+
},
|
|
945
|
+
sort_by: {
|
|
946
|
+
safety: "read",
|
|
947
|
+
argsType: "{ model: DataTableSortEntry[] }",
|
|
948
|
+
descriptionKey: "ui.agent.dataTable.actions.sortBy",
|
|
949
|
+
description: "Replace the active sort with the given list (priority order).",
|
|
950
|
+
invoke: (t, e) => {
|
|
951
|
+
t.setSort(e.model);
|
|
952
|
+
}
|
|
953
|
+
},
|
|
954
|
+
go_to_page: {
|
|
955
|
+
safety: "read",
|
|
956
|
+
argsType: "{ page: number }",
|
|
957
|
+
descriptionKey: "ui.agent.dataTable.actions.goToPage",
|
|
958
|
+
description: "Navigate to the given zero-indexed page.",
|
|
959
|
+
invoke: (t, e) => {
|
|
960
|
+
t.goToPage(e.page);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
domHooks: {
|
|
965
|
+
root: {
|
|
966
|
+
attr: "data-component",
|
|
967
|
+
value: "data-table",
|
|
968
|
+
description: "Marks the DataTable wrapper."
|
|
969
|
+
},
|
|
970
|
+
instanceId: {
|
|
971
|
+
attr: "data-component-id",
|
|
972
|
+
sourceProp: "gridId",
|
|
973
|
+
description: "Sourced from the gridId prop. Required to address a specific table from the agent."
|
|
974
|
+
},
|
|
975
|
+
item: {
|
|
976
|
+
attr: "row-id",
|
|
977
|
+
description: "Native ag-grid row-id attribute on each rendered row. Selection is performed via the curated handle, not by DOM mutation."
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
wt.registerModules([Ft]);
|
|
982
|
+
const sa = Nt("ag-theme-alfadocs ds:w-full", {
|
|
983
|
+
variants: {
|
|
984
|
+
density: {
|
|
985
|
+
default: "",
|
|
986
|
+
compact: "data-table-compact",
|
|
987
|
+
expanded: "data-table-expanded"
|
|
988
|
+
},
|
|
989
|
+
bordered: {
|
|
990
|
+
true: "",
|
|
991
|
+
false: "ds:[--ag-borders:none]"
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
defaultVariants: {
|
|
995
|
+
density: "default",
|
|
996
|
+
bordered: !0
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
function oa() {
|
|
1000
|
+
const { t } = F();
|
|
1001
|
+
return I(
|
|
1002
|
+
() => ({
|
|
1003
|
+
// Filter strings
|
|
1004
|
+
contains: t("dataTable.agGrid.contains"),
|
|
1005
|
+
notContains: t("dataTable.agGrid.notContains"),
|
|
1006
|
+
equals: t("dataTable.agGrid.equals"),
|
|
1007
|
+
notEqual: t("dataTable.agGrid.notEqual"),
|
|
1008
|
+
startsWith: t("dataTable.agGrid.startsWith"),
|
|
1009
|
+
endsWith: t("dataTable.agGrid.endsWith"),
|
|
1010
|
+
lessThan: t("dataTable.agGrid.lessThan"),
|
|
1011
|
+
greaterThan: t("dataTable.agGrid.greaterThan"),
|
|
1012
|
+
inRange: t("dataTable.agGrid.inRange"),
|
|
1013
|
+
blank: t("dataTable.agGrid.blank"),
|
|
1014
|
+
notBlank: t("dataTable.agGrid.notBlank"),
|
|
1015
|
+
filterOoo: t("dataTable.agGrid.filterOoo"),
|
|
1016
|
+
applyFilter: t("dataTable.agGrid.applyFilter"),
|
|
1017
|
+
resetFilter: t("dataTable.agGrid.resetFilter"),
|
|
1018
|
+
noRowsToShow: t("dataTable.agGrid.noRowsToShow"),
|
|
1019
|
+
selectAll: t("dataTable.agGrid.selectAll"),
|
|
1020
|
+
// Pagination
|
|
1021
|
+
page: t("dataTable.page"),
|
|
1022
|
+
of: t("dataTable.of"),
|
|
1023
|
+
to: t("dataTable.to"),
|
|
1024
|
+
nextPage: t("dataTable.nextPage"),
|
|
1025
|
+
previousPage: t("dataTable.previousPage"),
|
|
1026
|
+
firstPage: t("dataTable.firstPage"),
|
|
1027
|
+
lastPage: t("dataTable.lastPage"),
|
|
1028
|
+
pageSize: t("dataTable.pageSize")
|
|
1029
|
+
}),
|
|
1030
|
+
[t]
|
|
1031
|
+
);
|
|
1032
|
+
}
|
|
1033
|
+
function la() {
|
|
1034
|
+
return /* @__PURE__ */ s(
|
|
1035
|
+
"div",
|
|
1036
|
+
{
|
|
1037
|
+
role: "status",
|
|
1038
|
+
"aria-live": "polite",
|
|
1039
|
+
className: "ds:flex ds:w-full ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]",
|
|
1040
|
+
children: Array.from({ length: 5 }).map((t, e) => /* @__PURE__ */ s(
|
|
1041
|
+
xt,
|
|
1042
|
+
{
|
|
1043
|
+
variant: "rectangular",
|
|
1044
|
+
className: "ds:h-[var(--min-target-size)] ds:w-full"
|
|
1045
|
+
},
|
|
1046
|
+
e
|
|
1047
|
+
))
|
|
1048
|
+
}
|
|
1049
|
+
);
|
|
1050
|
+
}
|
|
1051
|
+
function ia() {
|
|
1052
|
+
const { t } = F();
|
|
1053
|
+
return /* @__PURE__ */ s(
|
|
1054
|
+
Ct,
|
|
1055
|
+
{
|
|
1056
|
+
variant: "no-results",
|
|
1057
|
+
size: "sm",
|
|
1058
|
+
title: t("dataTable.noRows"),
|
|
1059
|
+
description: t("dataTable.noRowsDescription")
|
|
1060
|
+
}
|
|
1061
|
+
);
|
|
1062
|
+
}
|
|
1063
|
+
function ca(t) {
|
|
1064
|
+
try {
|
|
1065
|
+
const e = localStorage.getItem(`data-table-col-state:${t}`);
|
|
1066
|
+
return e ? JSON.parse(e) : null;
|
|
1067
|
+
} catch {
|
|
1068
|
+
return null;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
function da(t, e) {
|
|
1072
|
+
try {
|
|
1073
|
+
localStorage.setItem(
|
|
1074
|
+
`data-table-col-state:${t}`,
|
|
1075
|
+
JSON.stringify(e.getColumnState())
|
|
1076
|
+
);
|
|
1077
|
+
} catch {
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
function ua(t, e) {
|
|
1081
|
+
const {
|
|
1082
|
+
columnDefs: a,
|
|
1083
|
+
rowData: n,
|
|
1084
|
+
rowSelection: r,
|
|
1085
|
+
pagination: o = !1,
|
|
1086
|
+
paginationPageSize: l = 25,
|
|
1087
|
+
paginationPageSizeSelector: u = [10, 25, 50, 100],
|
|
1088
|
+
gridId: d,
|
|
1089
|
+
onSelectionChanged: i,
|
|
1090
|
+
onSortChanged: c,
|
|
1091
|
+
onFilterChanged: p,
|
|
1092
|
+
noRowsOverlay: v,
|
|
1093
|
+
loadingOverlay: g,
|
|
1094
|
+
gridOptions: b,
|
|
1095
|
+
density: y,
|
|
1096
|
+
bordered: x,
|
|
1097
|
+
heightClass: f = "ds:h-[500px]",
|
|
1098
|
+
className: m,
|
|
1099
|
+
getRowClass: h,
|
|
1100
|
+
pinnedBottomRowData: C,
|
|
1101
|
+
printMode: S = !1,
|
|
1102
|
+
children: z
|
|
1103
|
+
} = t, { t: D, i18n: q } = F(), k = X(null), [G, tt] = R(0), [se, oe] = R(""), at = oa(), le = I(
|
|
1104
|
+
() => ({
|
|
1105
|
+
getSelection: () => {
|
|
1106
|
+
var w;
|
|
1107
|
+
const T = (w = k.current) == null ? void 0 : w.api;
|
|
1108
|
+
if (!T) return [];
|
|
1109
|
+
const N = [];
|
|
1110
|
+
for (const O of T.getSelectedNodes())
|
|
1111
|
+
O.id != null && N.push(O.id);
|
|
1112
|
+
return N;
|
|
1113
|
+
},
|
|
1114
|
+
setSelection: (T) => {
|
|
1115
|
+
var O;
|
|
1116
|
+
const N = (O = k.current) == null ? void 0 : O.api;
|
|
1117
|
+
if (!N) return;
|
|
1118
|
+
const w = new Set(T);
|
|
1119
|
+
N.forEachNode((A) => {
|
|
1120
|
+
A.id != null && A.setSelected(w.has(A.id));
|
|
1121
|
+
});
|
|
1122
|
+
},
|
|
1123
|
+
selectRange: (T, N) => {
|
|
1124
|
+
var be;
|
|
1125
|
+
const w = (be = k.current) == null ? void 0 : be.api;
|
|
1126
|
+
if (!w) return;
|
|
1127
|
+
const O = [];
|
|
1128
|
+
w.forEachNodeAfterFilterAndSort((U) => {
|
|
1129
|
+
U.id != null && O.push(U.id);
|
|
1130
|
+
});
|
|
1131
|
+
const A = O.indexOf(T), L = O.indexOf(N);
|
|
1132
|
+
if (A < 0 || L < 0) return;
|
|
1133
|
+
const [V, ce] = A <= L ? [A, L] : [L, A], de = new Set(O.slice(V, ce + 1));
|
|
1134
|
+
w.forEachNode((U) => {
|
|
1135
|
+
U.id != null && U.setSelected(de.has(U.id));
|
|
1136
|
+
});
|
|
1137
|
+
},
|
|
1138
|
+
clearSelection: () => {
|
|
1139
|
+
var T, N;
|
|
1140
|
+
(N = (T = k.current) == null ? void 0 : T.api) == null || N.deselectAll();
|
|
1141
|
+
},
|
|
1142
|
+
getFilter: () => {
|
|
1143
|
+
var T, N;
|
|
1144
|
+
return ((N = (T = k.current) == null ? void 0 : T.api) == null ? void 0 : N.getFilterModel()) ?? {};
|
|
1145
|
+
},
|
|
1146
|
+
setFilter: (T) => {
|
|
1147
|
+
var N, w;
|
|
1148
|
+
(w = (N = k.current) == null ? void 0 : N.api) == null || w.setFilterModel(T);
|
|
1149
|
+
},
|
|
1150
|
+
getSort: () => {
|
|
1151
|
+
var N;
|
|
1152
|
+
const T = (N = k.current) == null ? void 0 : N.api;
|
|
1153
|
+
return T ? T.getColumnState().filter((w) => w.sort === "asc" || w.sort === "desc").map((w) => ({ colId: w.colId, sort: w.sort })) : [];
|
|
1154
|
+
},
|
|
1155
|
+
setSort: (T) => {
|
|
1156
|
+
var O;
|
|
1157
|
+
const N = (O = k.current) == null ? void 0 : O.api;
|
|
1158
|
+
if (!N) return;
|
|
1159
|
+
const w = N.getColumnState().map((A) => {
|
|
1160
|
+
const L = T.find((V) => V.colId === A.colId);
|
|
1161
|
+
return { ...A, sort: L ? L.sort : null };
|
|
1162
|
+
});
|
|
1163
|
+
N.applyColumnState({ state: w, defaultState: { sort: null } });
|
|
1164
|
+
},
|
|
1165
|
+
getCurrentPage: () => {
|
|
1166
|
+
var T, N;
|
|
1167
|
+
return ((N = (T = k.current) == null ? void 0 : T.api) == null ? void 0 : N.paginationGetCurrentPage()) ?? 0;
|
|
1168
|
+
},
|
|
1169
|
+
goToPage: (T) => {
|
|
1170
|
+
var N, w;
|
|
1171
|
+
(w = (N = k.current) == null ? void 0 : N.api) == null || w.paginationGoToPage(T);
|
|
1172
|
+
},
|
|
1173
|
+
getRawApi: () => {
|
|
1174
|
+
var T;
|
|
1175
|
+
return (T = k.current) == null ? void 0 : T.api;
|
|
1176
|
+
}
|
|
1177
|
+
}),
|
|
1178
|
+
[]
|
|
1179
|
+
);
|
|
1180
|
+
yt(e, () => le, [le]), It(ra, le, d);
|
|
1181
|
+
const nt = q.dir() === "rtl", rt = n === void 0, st = I(
|
|
1182
|
+
() => window.matchMedia("(prefers-reduced-motion: reduce)").matches,
|
|
1183
|
+
[]
|
|
1184
|
+
), ot = I(
|
|
1185
|
+
() => document.documentElement.classList.contains("theme-accessible"),
|
|
1186
|
+
[]
|
|
1187
|
+
) && y === "compact" ? "default" : y, lt = I(() => {
|
|
1188
|
+
if (r)
|
|
1189
|
+
return r === "single" ? { mode: "singleRow" } : {
|
|
1190
|
+
mode: "multiRow",
|
|
1191
|
+
headerCheckbox: !0,
|
|
1192
|
+
checkboxes: !0
|
|
1193
|
+
};
|
|
1194
|
+
}, [r]), it = M(() => {
|
|
1195
|
+
var N;
|
|
1196
|
+
if (!d || !((N = k.current) != null && N.api)) return;
|
|
1197
|
+
const T = ca(d);
|
|
1198
|
+
T && k.current.api.applyColumnState({
|
|
1199
|
+
state: T,
|
|
1200
|
+
applyOrder: !0
|
|
1201
|
+
});
|
|
1202
|
+
}, [d]), ie = M(() => {
|
|
1203
|
+
var T;
|
|
1204
|
+
d && ((T = k.current) != null && T.api) && da(d, k.current.api);
|
|
1205
|
+
}, [d]), ct = M(() => {
|
|
1206
|
+
var w;
|
|
1207
|
+
const T = (w = k.current) == null ? void 0 : w.api;
|
|
1208
|
+
if (!T) return;
|
|
1209
|
+
const N = T.getSelectedRows();
|
|
1210
|
+
tt(N.length), i == null || i(N);
|
|
1211
|
+
}, [i]), dt = M(
|
|
1212
|
+
(T) => {
|
|
1213
|
+
var w;
|
|
1214
|
+
const N = (w = k.current) == null ? void 0 : w.api;
|
|
1215
|
+
if (N) {
|
|
1216
|
+
const A = N.getColumnState().find((L) => L.sort);
|
|
1217
|
+
if (A) {
|
|
1218
|
+
const L = A.colId, V = N.getColumnDef(L), ce = (V == null ? void 0 : V.headerName) ?? L, de = A.sort === "asc" ? "dataTable.sortAscending" : "dataTable.sortDescending";
|
|
1219
|
+
oe(
|
|
1220
|
+
D("dataTable.sortAnnounce", {
|
|
1221
|
+
column: ce,
|
|
1222
|
+
direction: D(de)
|
|
1223
|
+
})
|
|
1224
|
+
);
|
|
1225
|
+
} else
|
|
1226
|
+
oe("");
|
|
1227
|
+
}
|
|
1228
|
+
c == null || c(T);
|
|
1229
|
+
},
|
|
1230
|
+
[c, D]
|
|
1231
|
+
), ut = M(
|
|
1232
|
+
(T) => {
|
|
1233
|
+
p == null || p(T);
|
|
1234
|
+
},
|
|
1235
|
+
[p]
|
|
1236
|
+
);
|
|
1237
|
+
P(() => {
|
|
1238
|
+
if (!se) return;
|
|
1239
|
+
const T = setTimeout(() => oe(""), 3e3);
|
|
1240
|
+
return () => clearTimeout(T);
|
|
1241
|
+
}, [se]);
|
|
1242
|
+
const ft = v ?? ia, pt = g ?? la, mt = M(
|
|
1243
|
+
() => {
|
|
1244
|
+
var T;
|
|
1245
|
+
return (T = k.current) == null ? void 0 : T.api;
|
|
1246
|
+
},
|
|
1247
|
+
[]
|
|
1248
|
+
), gt = M(() => {
|
|
1249
|
+
typeof window < "u" && window.print();
|
|
1250
|
+
}, []), bt = sa({
|
|
1251
|
+
density: ot,
|
|
1252
|
+
bordered: x,
|
|
1253
|
+
className: m
|
|
1254
|
+
}), ht = z ?? /* @__PURE__ */ s(te, { children: /* @__PURE__ */ s(te.Actions, { children: /* @__PURE__ */ s(te.ExportMenu, {}) }) }), vt = S ? !1 : o;
|
|
1255
|
+
return /* @__PURE__ */ E(
|
|
1256
|
+
"div",
|
|
1257
|
+
{
|
|
1258
|
+
className: "ds:flex ds:w-full ds:flex-col ds:gap-[var(--spacing-sm)]",
|
|
1259
|
+
"aria-busy": rt ? "true" : void 0,
|
|
1260
|
+
"data-component": "data-table",
|
|
1261
|
+
"data-component-id": d,
|
|
1262
|
+
"data-print-mode": S ? "true" : void 0,
|
|
1263
|
+
children: [
|
|
1264
|
+
!S && /* @__PURE__ */ s(
|
|
1265
|
+
Vt,
|
|
1266
|
+
{
|
|
1267
|
+
getApi: mt,
|
|
1268
|
+
selectionCount: G,
|
|
1269
|
+
onPrint: gt,
|
|
1270
|
+
children: ht
|
|
1271
|
+
}
|
|
1272
|
+
),
|
|
1273
|
+
/* @__PURE__ */ s(
|
|
1274
|
+
"div",
|
|
1275
|
+
{
|
|
1276
|
+
className: [bt, S ? "" : f].join(" ").trim(),
|
|
1277
|
+
children: /* @__PURE__ */ s(
|
|
1278
|
+
St,
|
|
1279
|
+
{
|
|
1280
|
+
ref: k,
|
|
1281
|
+
theme: "legacy",
|
|
1282
|
+
columnDefs: a,
|
|
1283
|
+
rowData: n,
|
|
1284
|
+
defaultColDef: {
|
|
1285
|
+
sortable: !0,
|
|
1286
|
+
// Default filter = DS-styled text filter so untyped columns
|
|
1287
|
+
// (no explicit `filter:` override) inherit the kit's form
|
|
1288
|
+
// language instead of AG Grid's stock browser-skinned input.
|
|
1289
|
+
// Number / date / select columns opt into their dedicated
|
|
1290
|
+
// wrapper per-column.
|
|
1291
|
+
filter: aa,
|
|
1292
|
+
floatingFilterComponent: na,
|
|
1293
|
+
resizable: !0,
|
|
1294
|
+
floatingFilter: !0,
|
|
1295
|
+
// §13d — faint sort icon advertises which columns are
|
|
1296
|
+
// sortable. v33+ moved this from grid-level to defaultColDef.
|
|
1297
|
+
unSortIcon: !0,
|
|
1298
|
+
...b == null ? void 0 : b.defaultColDef
|
|
1299
|
+
},
|
|
1300
|
+
rowSelection: lt,
|
|
1301
|
+
pagination: vt,
|
|
1302
|
+
paginationPageSize: l,
|
|
1303
|
+
paginationPageSizeSelector: u,
|
|
1304
|
+
paginationNumberFormatter: (T) => new Intl.NumberFormat(q.language).format(T.value),
|
|
1305
|
+
animateRows: !st,
|
|
1306
|
+
enableRtl: nt,
|
|
1307
|
+
ensureDomOrder: !0,
|
|
1308
|
+
enableCellSpan: !0,
|
|
1309
|
+
enableCellTextSelection: !0,
|
|
1310
|
+
copyHeadersToClipboard: !0,
|
|
1311
|
+
accentedSort: !0,
|
|
1312
|
+
multiSortKey: "ctrl",
|
|
1313
|
+
suppressDragLeaveHidesColumns: !0,
|
|
1314
|
+
suppressRowClickSelection: r ? !0 : void 0,
|
|
1315
|
+
tooltipShowDelay: 500,
|
|
1316
|
+
tooltipHideDelay: 5e3,
|
|
1317
|
+
tooltipInteraction: !0,
|
|
1318
|
+
stopEditingWhenCellsLoseFocus: !0,
|
|
1319
|
+
maintainColumnOrder: !0,
|
|
1320
|
+
undoRedoCellEditing: !0,
|
|
1321
|
+
undoRedoCellEditingLimit: 20,
|
|
1322
|
+
suppressCellFocus: !1,
|
|
1323
|
+
rowBuffer: 10,
|
|
1324
|
+
localeText: at,
|
|
1325
|
+
noRowsOverlayComponent: ft,
|
|
1326
|
+
loadingOverlayComponent: pt,
|
|
1327
|
+
getRowClass: h,
|
|
1328
|
+
pinnedBottomRowData: C,
|
|
1329
|
+
domLayout: S ? "autoHeight" : void 0,
|
|
1330
|
+
onGridReady: it,
|
|
1331
|
+
onColumnMoved: ie,
|
|
1332
|
+
onColumnResized: ie,
|
|
1333
|
+
onColumnPinned: ie,
|
|
1334
|
+
onSortChanged: dt,
|
|
1335
|
+
onFilterChanged: ut,
|
|
1336
|
+
onSelectionChanged: ct,
|
|
1337
|
+
...b
|
|
1338
|
+
}
|
|
1339
|
+
)
|
|
1340
|
+
}
|
|
1341
|
+
),
|
|
1342
|
+
!S && /* @__PURE__ */ s("div", { className: "ds:flex ds:items-center ds:justify-between type-body-sm ds:text-[color:var(--muted-foreground)]", children: G > 0 ? /* @__PURE__ */ s("span", { children: D("dataTable.selected", { count: G }) }) : /* @__PURE__ */ s("span", {}) }),
|
|
1343
|
+
/* @__PURE__ */ s("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: se })
|
|
1344
|
+
]
|
|
1345
|
+
}
|
|
1346
|
+
);
|
|
1347
|
+
}
|
|
1348
|
+
const et = j(ua);
|
|
1349
|
+
et.displayName = "DataTable";
|
|
1350
|
+
const mn = Object.assign(et, {
|
|
1351
|
+
Toolbar: te
|
|
1352
|
+
});
|
|
1353
|
+
function gn(t, e, a) {
|
|
1354
|
+
return I(() => {
|
|
1355
|
+
const n = {};
|
|
1356
|
+
for (const r of e) {
|
|
1357
|
+
let o = 0;
|
|
1358
|
+
for (const l of t ?? []) {
|
|
1359
|
+
const u = l[r], d = typeof u == "number" ? u : Number(u);
|
|
1360
|
+
Number.isFinite(d) && (o += d);
|
|
1361
|
+
}
|
|
1362
|
+
n[r] = o;
|
|
1363
|
+
}
|
|
1364
|
+
return a != null && a.labelField && a.labelValue !== void 0 && (n[a.labelField] = a.labelValue), n;
|
|
1365
|
+
}, [t, e, a == null ? void 0 : a.labelField, a == null ? void 0 : a.labelValue]);
|
|
1366
|
+
}
|
|
1367
|
+
function re(t) {
|
|
1368
|
+
return t ? t.toISOString().slice(0, 10) : null;
|
|
1369
|
+
}
|
|
1370
|
+
function Q(t) {
|
|
1371
|
+
if (!t) return;
|
|
1372
|
+
const e = new Date(t);
|
|
1373
|
+
return Number.isNaN(e.getTime()) ? void 0 : e;
|
|
1374
|
+
}
|
|
1375
|
+
function bn(t) {
|
|
1376
|
+
const { model: e, onModelChange: a, getValue: n, doesRowPassOtherFilter: r } = t, o = {
|
|
1377
|
+
from: Q(e == null ? void 0 : e.dateFrom),
|
|
1378
|
+
to: Q(e == null ? void 0 : e.dateTo)
|
|
1379
|
+
}, [l, u] = R(o);
|
|
1380
|
+
J({
|
|
1381
|
+
doesFilterPass: (i) => {
|
|
1382
|
+
const c = n(i.node);
|
|
1383
|
+
if (!c) return !1;
|
|
1384
|
+
const p = c instanceof Date ? c : Q(String(c));
|
|
1385
|
+
return !(!p || l.from && p < l.from || l.to && p > l.to);
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
function d(i) {
|
|
1389
|
+
if (u(i), !i.from && !i.to) {
|
|
1390
|
+
a(null);
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
a({
|
|
1394
|
+
type: "inRange",
|
|
1395
|
+
dateFrom: re(i.from),
|
|
1396
|
+
dateTo: re(i.to)
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
return /* @__PURE__ */ s("div", { className: "ds:p-[var(--spacing-sm)] ds:min-w-[280px]", children: /* @__PURE__ */ s(Ie, { value: l, onChange: d, size: "sm" }) });
|
|
1400
|
+
}
|
|
1401
|
+
function hn(t) {
|
|
1402
|
+
const { model: e, onModelChange: a } = t, [n, r] = R({
|
|
1403
|
+
from: Q(e == null ? void 0 : e.dateFrom),
|
|
1404
|
+
to: Q(e == null ? void 0 : e.dateTo)
|
|
1405
|
+
});
|
|
1406
|
+
function o(l) {
|
|
1407
|
+
if (r(l), !l.from && !l.to) {
|
|
1408
|
+
a(null);
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
a({
|
|
1412
|
+
type: "inRange",
|
|
1413
|
+
dateFrom: re(l.from),
|
|
1414
|
+
dateTo: re(l.to)
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
return /* @__PURE__ */ s("div", { "data-component": "date-range-floating-filter", className: "ds:w-full", children: /* @__PURE__ */ s(Ie, { value: n, onChange: o, size: "sm" }) });
|
|
1418
|
+
}
|
|
1419
|
+
function H(t) {
|
|
1420
|
+
return typeof t == "number" ? `n:${t}` : `s:${t}`;
|
|
1421
|
+
}
|
|
1422
|
+
function vn(t) {
|
|
1423
|
+
const { model: e, onModelChange: a, getValue: n, api: r, column: o, options: l, placeholder: u } = t, { t: d } = F("ui"), i = I(() => {
|
|
1424
|
+
if (l && l.length > 0) return l;
|
|
1425
|
+
if (!r || !o) return [];
|
|
1426
|
+
const f = /* @__PURE__ */ new Map();
|
|
1427
|
+
return r.forEachNode((m) => {
|
|
1428
|
+
const h = n(m);
|
|
1429
|
+
if (h == null) return;
|
|
1430
|
+
const C = typeof h == "string" || typeof h == "number" ? h : String(h), S = H(C);
|
|
1431
|
+
f.has(S) || f.set(S, { value: C, label: String(C) });
|
|
1432
|
+
}), Array.from(f.values()).sort(
|
|
1433
|
+
(m, h) => String(m.label).localeCompare(String(h.label))
|
|
1434
|
+
);
|
|
1435
|
+
}, [l, r, o, n]), c = I(() => {
|
|
1436
|
+
const f = /* @__PURE__ */ new Set(), m = (e == null ? void 0 : e.values) ?? [];
|
|
1437
|
+
for (const h of m) f.add(H(h));
|
|
1438
|
+
return f;
|
|
1439
|
+
}, [e]), [p, v] = R(c);
|
|
1440
|
+
P(() => {
|
|
1441
|
+
v(c);
|
|
1442
|
+
}, [c]), J({
|
|
1443
|
+
doesFilterPass: (f) => {
|
|
1444
|
+
const m = e == null ? void 0 : e.values;
|
|
1445
|
+
if (!m || m.length === 0) return !0;
|
|
1446
|
+
const h = n(f.node);
|
|
1447
|
+
if (h == null) return !1;
|
|
1448
|
+
const C = typeof h == "string" || typeof h == "number" ? h : String(h), S = H(C);
|
|
1449
|
+
return m.some((z) => H(z) === S);
|
|
1450
|
+
}
|
|
1451
|
+
});
|
|
1452
|
+
function g(f) {
|
|
1453
|
+
v((m) => {
|
|
1454
|
+
const h = new Set(m);
|
|
1455
|
+
return h.has(f) ? h.delete(f) : h.add(f), h;
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
function b() {
|
|
1459
|
+
if (p.size === 0) {
|
|
1460
|
+
a(null);
|
|
1461
|
+
return;
|
|
1462
|
+
}
|
|
1463
|
+
const f = [];
|
|
1464
|
+
for (const m of i)
|
|
1465
|
+
p.has(H(m.value)) && f.push(m.value);
|
|
1466
|
+
a({ type: "set", values: f });
|
|
1467
|
+
}
|
|
1468
|
+
function y() {
|
|
1469
|
+
v(/* @__PURE__ */ new Set()), a(null);
|
|
1470
|
+
}
|
|
1471
|
+
const x = u ?? d("dataTable.selectFilter.all");
|
|
1472
|
+
return /* @__PURE__ */ E(
|
|
1473
|
+
"div",
|
|
1474
|
+
{
|
|
1475
|
+
"data-component": "select-filter",
|
|
1476
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)] ds:min-w-[200px] ds:max-w-[260px]",
|
|
1477
|
+
children: [
|
|
1478
|
+
/* @__PURE__ */ s(
|
|
1479
|
+
"div",
|
|
1480
|
+
{
|
|
1481
|
+
role: "group",
|
|
1482
|
+
"aria-label": x,
|
|
1483
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:max-h-[240px] ds:overflow-y-auto",
|
|
1484
|
+
children: i.length === 0 ? /* @__PURE__ */ s("p", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[var(--muted-foreground)] ds:py-[var(--spacing-xs)]", children: d("dataTable.agGrid.noRowsToShow") }) : i.map((f) => {
|
|
1485
|
+
const m = H(f.value);
|
|
1486
|
+
return /* @__PURE__ */ s(
|
|
1487
|
+
Re,
|
|
1488
|
+
{
|
|
1489
|
+
size: "sm",
|
|
1490
|
+
label: f.label,
|
|
1491
|
+
checked: p.has(m),
|
|
1492
|
+
onCheckedChange: () => g(m)
|
|
1493
|
+
},
|
|
1494
|
+
m
|
|
1495
|
+
);
|
|
1496
|
+
})
|
|
1497
|
+
}
|
|
1498
|
+
),
|
|
1499
|
+
/* @__PURE__ */ E("div", { className: "ds:flex ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)] ds:pt-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)]", children: [
|
|
1500
|
+
/* @__PURE__ */ s(_, { intent: "ghost", size: "sm", onClick: y, type: "button", children: d("dataTable.selectFilter.clear") }),
|
|
1501
|
+
/* @__PURE__ */ s(_, { intent: "primary", size: "sm", onClick: b, type: "button", children: d("dataTable.selectFilter.apply") })
|
|
1502
|
+
] })
|
|
1503
|
+
]
|
|
1504
|
+
}
|
|
1505
|
+
);
|
|
1506
|
+
}
|
|
1507
|
+
function yn(t) {
|
|
1508
|
+
var c, p;
|
|
1509
|
+
const { model: e, onModelChange: a, column: n } = t, r = ((p = (c = n == null ? void 0 : n.getColDef) == null ? void 0 : c.call(n)) == null ? void 0 : p.filterParams) ?? {}, o = r.options ?? [], l = I(() => {
|
|
1510
|
+
const v = /* @__PURE__ */ new Map();
|
|
1511
|
+
for (const g of o) v.set(String(g.value), g.value);
|
|
1512
|
+
return v;
|
|
1513
|
+
}, [o]), u = I(
|
|
1514
|
+
() => o.map((v) => ({
|
|
1515
|
+
value: String(v.value),
|
|
1516
|
+
label: v.label
|
|
1517
|
+
})),
|
|
1518
|
+
[o]
|
|
1519
|
+
), d = I(
|
|
1520
|
+
() => ((e == null ? void 0 : e.values) ?? []).map((v) => String(v)),
|
|
1521
|
+
[e]
|
|
1522
|
+
);
|
|
1523
|
+
function i(v) {
|
|
1524
|
+
if (v.length === 0) {
|
|
1525
|
+
a(null);
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
const g = [];
|
|
1529
|
+
for (const b of v) {
|
|
1530
|
+
const y = l.get(b);
|
|
1531
|
+
y !== void 0 && g.push(y);
|
|
1532
|
+
}
|
|
1533
|
+
a({ type: "set", values: g });
|
|
1534
|
+
}
|
|
1535
|
+
return /* @__PURE__ */ s("div", { "data-component": "select-floating-filter", className: "ds:w-full", children: /* @__PURE__ */ s(
|
|
1536
|
+
zt,
|
|
1537
|
+
{
|
|
1538
|
+
size: "sm",
|
|
1539
|
+
options: u,
|
|
1540
|
+
value: d,
|
|
1541
|
+
onChange: i,
|
|
1542
|
+
placeholder: r.placeholder,
|
|
1543
|
+
allowClear: !0
|
|
1544
|
+
}
|
|
1545
|
+
) });
|
|
1546
|
+
}
|
|
1547
|
+
function W(t) {
|
|
1548
|
+
return t.trim().toLocaleLowerCase();
|
|
1549
|
+
}
|
|
1550
|
+
function Tn(t) {
|
|
1551
|
+
const {
|
|
1552
|
+
model: e,
|
|
1553
|
+
onModelChange: a,
|
|
1554
|
+
getValue: n,
|
|
1555
|
+
api: r,
|
|
1556
|
+
column: o,
|
|
1557
|
+
options: l,
|
|
1558
|
+
loadOptions: u,
|
|
1559
|
+
placeholder: d
|
|
1560
|
+
} = t, { t: i } = F("ui"), c = I(() => {
|
|
1561
|
+
if (l && l.length > 0) return l;
|
|
1562
|
+
if (!r || !o) return [];
|
|
1563
|
+
const m = /* @__PURE__ */ new Map();
|
|
1564
|
+
return r.forEachNode((h) => {
|
|
1565
|
+
const C = n(h);
|
|
1566
|
+
if (C == null) return;
|
|
1567
|
+
const S = typeof C == "string" ? C : String(C);
|
|
1568
|
+
m.has(S) || m.set(S, { value: S, label: S });
|
|
1569
|
+
}), Array.from(m.values()).sort(
|
|
1570
|
+
(h, C) => h.label.localeCompare(C.label)
|
|
1571
|
+
);
|
|
1572
|
+
}, [l, r, o, n]), p = I(() => async (m, h) => {
|
|
1573
|
+
if (u)
|
|
1574
|
+
return (await u(m, h)).map((D) => ({ value: D.value, label: D.label }));
|
|
1575
|
+
const C = W(m);
|
|
1576
|
+
return (C ? c.filter((z) => W(z.label).includes(C)) : c).slice(0, 50).map((z) => ({ value: z.value, label: z.label }));
|
|
1577
|
+
}, [u, c]), [v, g] = R((e == null ? void 0 : e.value) ?? "");
|
|
1578
|
+
P(() => {
|
|
1579
|
+
g((e == null ? void 0 : e.value) ?? "");
|
|
1580
|
+
}, [e == null ? void 0 : e.value]), J({
|
|
1581
|
+
doesFilterPass: (m) => {
|
|
1582
|
+
const h = e == null ? void 0 : e.value;
|
|
1583
|
+
if (!h) return !0;
|
|
1584
|
+
const C = n(m.node);
|
|
1585
|
+
if (C == null) return !1;
|
|
1586
|
+
const S = typeof C == "string" ? C : String(C);
|
|
1587
|
+
return W(S) === W(h);
|
|
1588
|
+
}
|
|
1589
|
+
});
|
|
1590
|
+
function b(m) {
|
|
1591
|
+
g(m.label), a({ type: "equals", value: m.value });
|
|
1592
|
+
}
|
|
1593
|
+
function y(m) {
|
|
1594
|
+
g(m), m === "" && e && a(null);
|
|
1595
|
+
}
|
|
1596
|
+
function x() {
|
|
1597
|
+
g(""), a(null);
|
|
1598
|
+
}
|
|
1599
|
+
const f = d ?? i("dataTable.typeaheadFilter.placeholder");
|
|
1600
|
+
return /* @__PURE__ */ E(
|
|
1601
|
+
"div",
|
|
1602
|
+
{
|
|
1603
|
+
"data-component": "typeahead-filter",
|
|
1604
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)] ds:min-w-[240px]",
|
|
1605
|
+
children: [
|
|
1606
|
+
/* @__PURE__ */ s(
|
|
1607
|
+
ze,
|
|
1608
|
+
{
|
|
1609
|
+
size: "sm",
|
|
1610
|
+
value: v,
|
|
1611
|
+
onChange: y,
|
|
1612
|
+
onSelect: b,
|
|
1613
|
+
loadOptions: p,
|
|
1614
|
+
placeholder: f,
|
|
1615
|
+
"aria-label": f
|
|
1616
|
+
}
|
|
1617
|
+
),
|
|
1618
|
+
/* @__PURE__ */ s("div", { className: "ds:flex ds:items-center ds:justify-end ds:pt-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)]", children: /* @__PURE__ */ s(_, { intent: "ghost", size: "sm", onClick: x, type: "button", children: i("dataTable.typeaheadFilter.clear") }) })
|
|
1619
|
+
]
|
|
1620
|
+
}
|
|
1621
|
+
);
|
|
1622
|
+
}
|
|
1623
|
+
function xn(t) {
|
|
1624
|
+
var b, y;
|
|
1625
|
+
const { model: e, onModelChange: a, column: n } = t, { t: r } = F("ui"), o = ((y = (b = n == null ? void 0 : n.getColDef) == null ? void 0 : b.call(n)) == null ? void 0 : y.filterParams) ?? {}, l = o.options ?? [], u = o.loadOptions, d = o.placeholder ?? r("dataTable.typeaheadFilter.placeholder"), i = I(() => async (x, f) => {
|
|
1626
|
+
if (u)
|
|
1627
|
+
return (await u(x, f)).map((S) => ({ value: S.value, label: S.label }));
|
|
1628
|
+
const m = W(x);
|
|
1629
|
+
return (m ? l.filter((C) => W(C.label).includes(m)) : l).slice(0, 50).map((C) => ({ value: C.value, label: C.label }));
|
|
1630
|
+
}, [u, l]), [c, p] = R((e == null ? void 0 : e.value) ?? "");
|
|
1631
|
+
P(() => {
|
|
1632
|
+
p((e == null ? void 0 : e.value) ?? "");
|
|
1633
|
+
}, [e == null ? void 0 : e.value]);
|
|
1634
|
+
function v(x) {
|
|
1635
|
+
p(x.label), a({ type: "equals", value: x.value });
|
|
1636
|
+
}
|
|
1637
|
+
function g(x) {
|
|
1638
|
+
p(x), x === "" && e && a(null);
|
|
1639
|
+
}
|
|
1640
|
+
return /* @__PURE__ */ s("div", { "data-component": "typeahead-floating-filter", className: "ds:w-full", children: /* @__PURE__ */ s(
|
|
1641
|
+
ze,
|
|
1642
|
+
{
|
|
1643
|
+
size: "sm",
|
|
1644
|
+
value: c,
|
|
1645
|
+
onChange: g,
|
|
1646
|
+
onSelect: v,
|
|
1647
|
+
loadOptions: i,
|
|
1648
|
+
placeholder: d,
|
|
1649
|
+
"aria-label": d
|
|
1650
|
+
}
|
|
1651
|
+
) });
|
|
1652
|
+
}
|
|
1653
|
+
const fa = [
|
|
1654
|
+
"equals",
|
|
1655
|
+
"notEqual",
|
|
1656
|
+
"greaterThan",
|
|
1657
|
+
"greaterThanOrEqual",
|
|
1658
|
+
"lessThan",
|
|
1659
|
+
"lessThanOrEqual",
|
|
1660
|
+
"inRange",
|
|
1661
|
+
"blank",
|
|
1662
|
+
"notBlank"
|
|
1663
|
+
];
|
|
1664
|
+
function ve(t) {
|
|
1665
|
+
return t !== "blank" && t !== "notBlank";
|
|
1666
|
+
}
|
|
1667
|
+
function ye(t) {
|
|
1668
|
+
return t === "inRange";
|
|
1669
|
+
}
|
|
1670
|
+
function pa(t, e, a, n) {
|
|
1671
|
+
if (t === "blank") return e === null;
|
|
1672
|
+
if (t === "notBlank") return e !== null;
|
|
1673
|
+
if (e === null) return !1;
|
|
1674
|
+
if (a === null) return !0;
|
|
1675
|
+
switch (t) {
|
|
1676
|
+
case "equals":
|
|
1677
|
+
return e === a;
|
|
1678
|
+
case "notEqual":
|
|
1679
|
+
return e !== a;
|
|
1680
|
+
case "greaterThan":
|
|
1681
|
+
return e > a;
|
|
1682
|
+
case "greaterThanOrEqual":
|
|
1683
|
+
return e >= a;
|
|
1684
|
+
case "lessThan":
|
|
1685
|
+
return e < a;
|
|
1686
|
+
case "lessThanOrEqual":
|
|
1687
|
+
return e <= a;
|
|
1688
|
+
case "inRange": {
|
|
1689
|
+
if (n === null) return e >= a;
|
|
1690
|
+
const r = Math.min(a, n), o = Math.max(a, n);
|
|
1691
|
+
return e >= r && e <= o;
|
|
1692
|
+
}
|
|
1693
|
+
default:
|
|
1694
|
+
return !0;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
function ma(t) {
|
|
1698
|
+
if (t == null || t === "") return null;
|
|
1699
|
+
const e = typeof t == "number" ? t : Number(t);
|
|
1700
|
+
return Number.isNaN(e) ? null : e;
|
|
1701
|
+
}
|
|
1702
|
+
function Cn(t) {
|
|
1703
|
+
const {
|
|
1704
|
+
model: e,
|
|
1705
|
+
onModelChange: a,
|
|
1706
|
+
getValue: n,
|
|
1707
|
+
defaultOperator: r,
|
|
1708
|
+
min: o,
|
|
1709
|
+
max: l,
|
|
1710
|
+
step: u,
|
|
1711
|
+
placeholder: d
|
|
1712
|
+
} = t, { t: i } = F("ui"), c = (e == null ? void 0 : e.type) ?? r ?? "equals", [p, v] = R(c), [g, b] = R((e == null ? void 0 : e.filter) ?? null), [y, x] = R(
|
|
1713
|
+
(e == null ? void 0 : e.filterTo) ?? null
|
|
1714
|
+
);
|
|
1715
|
+
P(() => {
|
|
1716
|
+
if (e === null) {
|
|
1717
|
+
v(r ?? "equals"), b(null), x(null);
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
v(e.type), b(e.filter ?? null), x(e.filterTo ?? null);
|
|
1721
|
+
}, [e, r]), J({
|
|
1722
|
+
doesFilterPass: (D) => {
|
|
1723
|
+
if (!e) return !0;
|
|
1724
|
+
const q = ma(n(D.node));
|
|
1725
|
+
return pa(
|
|
1726
|
+
e.type,
|
|
1727
|
+
q,
|
|
1728
|
+
e.filter ?? null,
|
|
1729
|
+
e.filterTo ?? null
|
|
1730
|
+
);
|
|
1731
|
+
}
|
|
1732
|
+
});
|
|
1733
|
+
const f = I(
|
|
1734
|
+
() => fa.map((D) => ({
|
|
1735
|
+
value: D,
|
|
1736
|
+
label: i(`dataTable.numberFilter.operators.${D}`)
|
|
1737
|
+
})),
|
|
1738
|
+
[i]
|
|
1739
|
+
), m = d ?? i("dataTable.numberFilter.placeholder");
|
|
1740
|
+
function h() {
|
|
1741
|
+
if (!ve(p)) {
|
|
1742
|
+
a({ type: p, filter: 0 });
|
|
1743
|
+
return;
|
|
1744
|
+
}
|
|
1745
|
+
if (g === null) {
|
|
1746
|
+
a(null);
|
|
1747
|
+
return;
|
|
1748
|
+
}
|
|
1749
|
+
if (ye(p)) {
|
|
1750
|
+
a({
|
|
1751
|
+
type: p,
|
|
1752
|
+
filter: g,
|
|
1753
|
+
filterTo: y ?? void 0
|
|
1754
|
+
});
|
|
1755
|
+
return;
|
|
1756
|
+
}
|
|
1757
|
+
a({ type: p, filter: g });
|
|
1758
|
+
}
|
|
1759
|
+
function C() {
|
|
1760
|
+
v(r ?? "equals"), b(null), x(null), a(null);
|
|
1761
|
+
}
|
|
1762
|
+
const S = ve(p), z = ye(p);
|
|
1763
|
+
return /* @__PURE__ */ E(
|
|
1764
|
+
"div",
|
|
1765
|
+
{
|
|
1766
|
+
"data-component": "number-filter",
|
|
1767
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)] ds:min-w-[240px]",
|
|
1768
|
+
children: [
|
|
1769
|
+
/* @__PURE__ */ s(
|
|
1770
|
+
Ee,
|
|
1771
|
+
{
|
|
1772
|
+
size: "sm",
|
|
1773
|
+
options: f,
|
|
1774
|
+
value: p,
|
|
1775
|
+
onValueChange: (D) => {
|
|
1776
|
+
D !== "" && v(D);
|
|
1777
|
+
},
|
|
1778
|
+
"aria-label": i("dataTable.numberFilter.operators.equals")
|
|
1779
|
+
}
|
|
1780
|
+
),
|
|
1781
|
+
S && !z && /* @__PURE__ */ s(
|
|
1782
|
+
ee,
|
|
1783
|
+
{
|
|
1784
|
+
size: "sm",
|
|
1785
|
+
value: g,
|
|
1786
|
+
onChange: b,
|
|
1787
|
+
min: o,
|
|
1788
|
+
max: l,
|
|
1789
|
+
step: u,
|
|
1790
|
+
placeholder: m,
|
|
1791
|
+
"aria-label": m
|
|
1792
|
+
}
|
|
1793
|
+
),
|
|
1794
|
+
z && /* @__PURE__ */ E("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
|
|
1795
|
+
/* @__PURE__ */ s(
|
|
1796
|
+
ee,
|
|
1797
|
+
{
|
|
1798
|
+
size: "sm",
|
|
1799
|
+
value: g,
|
|
1800
|
+
onChange: b,
|
|
1801
|
+
min: o,
|
|
1802
|
+
max: l,
|
|
1803
|
+
step: u,
|
|
1804
|
+
placeholder: i("dataTable.numberFilter.from"),
|
|
1805
|
+
"aria-label": i("dataTable.numberFilter.from")
|
|
1806
|
+
}
|
|
1807
|
+
),
|
|
1808
|
+
/* @__PURE__ */ s(
|
|
1809
|
+
ee,
|
|
1810
|
+
{
|
|
1811
|
+
size: "sm",
|
|
1812
|
+
value: y,
|
|
1813
|
+
onChange: x,
|
|
1814
|
+
min: o,
|
|
1815
|
+
max: l,
|
|
1816
|
+
step: u,
|
|
1817
|
+
placeholder: i("dataTable.numberFilter.to"),
|
|
1818
|
+
"aria-label": i("dataTable.numberFilter.to")
|
|
1819
|
+
}
|
|
1820
|
+
)
|
|
1821
|
+
] }),
|
|
1822
|
+
/* @__PURE__ */ E("div", { className: "ds:flex ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)] ds:pt-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)]", children: [
|
|
1823
|
+
/* @__PURE__ */ s(_, { intent: "ghost", size: "sm", onClick: C, type: "button", children: i("dataTable.numberFilter.clear") }),
|
|
1824
|
+
/* @__PURE__ */ s(_, { intent: "primary", size: "sm", onClick: h, type: "button", children: i("dataTable.numberFilter.apply") })
|
|
1825
|
+
] })
|
|
1826
|
+
]
|
|
1827
|
+
}
|
|
1828
|
+
);
|
|
1829
|
+
}
|
|
1830
|
+
function Nn(t) {
|
|
1831
|
+
var c, p;
|
|
1832
|
+
const { model: e, onModelChange: a, column: n } = t, { t: r } = F("ui"), o = ((p = (c = n == null ? void 0 : n.getColDef) == null ? void 0 : c.call(n)) == null ? void 0 : p.filterParams) ?? {}, l = o.defaultOperator ?? "equals", u = o.placeholder ?? r("dataTable.numberFilter.placeholder"), [d, i] = R((e == null ? void 0 : e.filter) ?? null);
|
|
1833
|
+
return P(() => {
|
|
1834
|
+
i((e == null ? void 0 : e.filter) ?? null);
|
|
1835
|
+
}, [e == null ? void 0 : e.filter]), P(() => {
|
|
1836
|
+
if (d === ((e == null ? void 0 : e.filter) ?? null)) return;
|
|
1837
|
+
const v = setTimeout(() => {
|
|
1838
|
+
if (d === null || Number.isNaN(d)) {
|
|
1839
|
+
a(null);
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
a({ type: l, filter: d });
|
|
1843
|
+
}, 200);
|
|
1844
|
+
return () => clearTimeout(v);
|
|
1845
|
+
}, [d, l]), /* @__PURE__ */ s("div", { "data-component": "number-floating-filter", className: "ds:w-full", children: /* @__PURE__ */ s(
|
|
1846
|
+
ee,
|
|
1847
|
+
{
|
|
1848
|
+
size: "sm",
|
|
1849
|
+
value: d,
|
|
1850
|
+
onChange: i,
|
|
1851
|
+
min: o.min,
|
|
1852
|
+
max: o.max,
|
|
1853
|
+
step: o.step,
|
|
1854
|
+
placeholder: u,
|
|
1855
|
+
"aria-label": u
|
|
1856
|
+
}
|
|
1857
|
+
) });
|
|
1858
|
+
}
|
|
1859
|
+
function Sn(t) {
|
|
1860
|
+
const { value: e, variantMap: a } = t, n = (a == null ? void 0 : a[e]) ?? "neutral";
|
|
1861
|
+
return /* @__PURE__ */ s(At, { variant: n, withDot: !0, size: "sm", children: String(e ?? "") });
|
|
1862
|
+
}
|
|
1863
|
+
function wn(t) {
|
|
1864
|
+
const { value: e } = t;
|
|
1865
|
+
return e ? /* @__PURE__ */ E("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
|
|
1866
|
+
/* @__PURE__ */ s(Ae, { name: e.name, src: e.src, size: "sm" }),
|
|
1867
|
+
/* @__PURE__ */ s("span", { children: e.name })
|
|
1868
|
+
] }) : null;
|
|
1869
|
+
}
|
|
1870
|
+
const ga = {
|
|
1871
|
+
sm: "ds:size-8",
|
|
1872
|
+
md: "ds:size-10",
|
|
1873
|
+
lg: "ds:size-12"
|
|
1874
|
+
}, ba = {
|
|
1875
|
+
square: "ds:rounded-none",
|
|
1876
|
+
rounded: "ds:rounded-[var(--radius-md)]",
|
|
1877
|
+
circle: "ds:rounded-[var(--radius-full)]"
|
|
1878
|
+
};
|
|
1879
|
+
function ue(t, e) {
|
|
1880
|
+
if (!t || typeof t != "object") return;
|
|
1881
|
+
const a = t[e];
|
|
1882
|
+
return typeof a == "string" ? a : void 0;
|
|
1883
|
+
}
|
|
1884
|
+
const ha = /^(?:https?:|data:image\/)/i;
|
|
1885
|
+
function va(t) {
|
|
1886
|
+
if (!t) return;
|
|
1887
|
+
const e = t.trim();
|
|
1888
|
+
if (e.length !== 0)
|
|
1889
|
+
return ha.test(e) ? e : void 0;
|
|
1890
|
+
}
|
|
1891
|
+
function Fn(t) {
|
|
1892
|
+
const {
|
|
1893
|
+
data: e,
|
|
1894
|
+
srcField: a,
|
|
1895
|
+
altField: n,
|
|
1896
|
+
fallbackField: r,
|
|
1897
|
+
size: o = "md",
|
|
1898
|
+
shape: l = "rounded"
|
|
1899
|
+
} = t;
|
|
1900
|
+
if (!e) return null;
|
|
1901
|
+
const u = ue(e, a), d = va(u), i = n ? ue(e, n) ?? "" : "", c = r ? ue(e, r) : void 0;
|
|
1902
|
+
return d ? /* @__PURE__ */ s(
|
|
1903
|
+
"img",
|
|
1904
|
+
{
|
|
1905
|
+
src: d,
|
|
1906
|
+
alt: i,
|
|
1907
|
+
loading: "lazy",
|
|
1908
|
+
decoding: "async",
|
|
1909
|
+
className: ["ds:object-cover", ga[o], ba[l]].join(
|
|
1910
|
+
" "
|
|
1911
|
+
)
|
|
1912
|
+
}
|
|
1913
|
+
) : c ? /* @__PURE__ */ s(Ae, { name: c, size: o }) : null;
|
|
1914
|
+
}
|
|
1915
|
+
function Rn(t) {
|
|
1916
|
+
const { value: e, maxVisible: a = 3 } = t, { t: n } = F();
|
|
1917
|
+
if (!Array.isArray(e) || e.length === 0) return null;
|
|
1918
|
+
const r = e.slice(0, a), o = e.length - a;
|
|
1919
|
+
return /* @__PURE__ */ E("span", { className: "ds:inline-flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
|
|
1920
|
+
r.map((l) => /* @__PURE__ */ s(ae, { label: l, size: "sm" }, l)),
|
|
1921
|
+
o > 0 && /* @__PURE__ */ s(Pt, { label: e.slice(a).join(", "), children: /* @__PURE__ */ s(
|
|
1922
|
+
ae,
|
|
1923
|
+
{
|
|
1924
|
+
label: n("inputs.multiSelect.overflow", { count: o }),
|
|
1925
|
+
size: "sm",
|
|
1926
|
+
variant: "neutral",
|
|
1927
|
+
fill: "outline"
|
|
1928
|
+
}
|
|
1929
|
+
) })
|
|
1930
|
+
] });
|
|
1931
|
+
}
|
|
1932
|
+
const ya = {
|
|
1933
|
+
date: { year: "numeric", month: "short", day: "numeric" },
|
|
1934
|
+
time: { hour: "2-digit", minute: "2-digit" },
|
|
1935
|
+
datetime: {
|
|
1936
|
+
year: "numeric",
|
|
1937
|
+
month: "short",
|
|
1938
|
+
day: "numeric",
|
|
1939
|
+
hour: "2-digit",
|
|
1940
|
+
minute: "2-digit"
|
|
1941
|
+
}
|
|
1942
|
+
};
|
|
1943
|
+
function Dn(t) {
|
|
1944
|
+
const { value: e, format: a = "date", options: n } = t;
|
|
1945
|
+
return e == null || e === "" ? null : a === "relative" && !n ? /* @__PURE__ */ s(he, { value: e, shape: "bare" }) : /* @__PURE__ */ s(
|
|
1946
|
+
he,
|
|
1947
|
+
{
|
|
1948
|
+
value: e,
|
|
1949
|
+
format: "absolute",
|
|
1950
|
+
shape: "bare",
|
|
1951
|
+
absoluteFormat: n ?? ya[a === "relative" ? "date" : a]
|
|
1952
|
+
}
|
|
1953
|
+
);
|
|
1954
|
+
}
|
|
1955
|
+
function Ta(t) {
|
|
1956
|
+
if (t == null || t === "") return null;
|
|
1957
|
+
const e = typeof t == "number" ? t : Number(t);
|
|
1958
|
+
return Number.isFinite(e) ? e : null;
|
|
1959
|
+
}
|
|
1960
|
+
function kn(t) {
|
|
1961
|
+
const {
|
|
1962
|
+
value: e,
|
|
1963
|
+
currency: a = "EUR",
|
|
1964
|
+
colorNegative: n,
|
|
1965
|
+
strikethrough: r,
|
|
1966
|
+
options: o
|
|
1967
|
+
} = t, { i18n: l } = F(), u = Ta(e);
|
|
1968
|
+
if (u === null) return null;
|
|
1969
|
+
const d = l.language || "en", i = new Intl.NumberFormat(d, {
|
|
1970
|
+
style: "currency",
|
|
1971
|
+
currency: a,
|
|
1972
|
+
...o
|
|
1973
|
+
}).format(u), c = ["ds:tabular-nums"];
|
|
1974
|
+
return n && u < 0 && c.push("ds:text-[color:var(--destructive)]"), r && c.push("line-through"), /* @__PURE__ */ s("span", { className: c.join(" "), children: i });
|
|
1975
|
+
}
|
|
1976
|
+
function xa(t) {
|
|
1977
|
+
if (!we(t)) return t;
|
|
1978
|
+
const e = t, a = e.props.className ?? "", n = /\bsize-|\bw-|\bh-/.test(a) ? a : `${a} size-4`.trim();
|
|
1979
|
+
return Fe(e, { className: n, size: e.props.size ?? 16 });
|
|
1980
|
+
}
|
|
1981
|
+
function Te(t, e) {
|
|
1982
|
+
return typeof t == "function" ? t(e) : !!t;
|
|
1983
|
+
}
|
|
1984
|
+
function En(t) {
|
|
1985
|
+
const { data: e, actions: a } = t;
|
|
1986
|
+
return e ? /* @__PURE__ */ s("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: a.map((n, r) => {
|
|
1987
|
+
if (Te(n.hidden, e)) return null;
|
|
1988
|
+
const o = Te(n.disabled, e), l = o && n.disabledReason ? n.disabledReason : n.label, u = n.variant === "destructive";
|
|
1989
|
+
return /* @__PURE__ */ s(
|
|
1990
|
+
B,
|
|
1991
|
+
{
|
|
1992
|
+
size: "sm",
|
|
1993
|
+
intent: "ghost",
|
|
1994
|
+
icon: xa(n.icon),
|
|
1995
|
+
tooltip: l,
|
|
1996
|
+
"aria-label": n.label,
|
|
1997
|
+
disabled: o,
|
|
1998
|
+
onClick: (d) => {
|
|
1999
|
+
d.stopPropagation(), n.onClick(e);
|
|
2000
|
+
},
|
|
2001
|
+
className: u ? "ds:text-[color:var(--destructive)] ds:hover:text-[color:var(--destructive-hover)]" : void 0
|
|
2002
|
+
},
|
|
2003
|
+
r
|
|
2004
|
+
);
|
|
2005
|
+
}) }) : null;
|
|
2006
|
+
}
|
|
2007
|
+
function xe(t, e) {
|
|
2008
|
+
return typeof t == "function" ? t(e) : t;
|
|
2009
|
+
}
|
|
2010
|
+
function Ca(t) {
|
|
2011
|
+
return /^(https?:\/\/|\/|#|mailto:|tel:)/i.test(t) ? t : "#";
|
|
2012
|
+
}
|
|
2013
|
+
function In(t) {
|
|
2014
|
+
const { value: e, data: a, href: n, onClick: r, secondary: o } = t;
|
|
2015
|
+
if (!a) return null;
|
|
2016
|
+
const l = xe(n, a), u = xe(o, a), d = e == null || e === "" ? "" : String(e), i = [
|
|
2017
|
+
"ds:text-[color:var(--primary)]",
|
|
2018
|
+
"ds:hover:underline",
|
|
2019
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
2020
|
+
"ds:focus-visible:outline-solid",
|
|
2021
|
+
"ds:focus-visible:outline-[color:var(--ring)]",
|
|
2022
|
+
"ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
2023
|
+
"ds:rounded-[var(--radius-sm)]"
|
|
2024
|
+
].join(" "), c = (p) => {
|
|
2025
|
+
r && (l || p.preventDefault(), p.stopPropagation(), r(a));
|
|
2026
|
+
};
|
|
2027
|
+
return /* @__PURE__ */ E("span", { className: "ds:flex ds:flex-col ds:leading-tight", children: [
|
|
2028
|
+
l ? /* @__PURE__ */ s(
|
|
2029
|
+
"a",
|
|
2030
|
+
{
|
|
2031
|
+
href: Ca(l),
|
|
2032
|
+
onClick: c,
|
|
2033
|
+
className: i,
|
|
2034
|
+
children: d
|
|
2035
|
+
}
|
|
2036
|
+
) : /* @__PURE__ */ s(
|
|
2037
|
+
"button",
|
|
2038
|
+
{
|
|
2039
|
+
type: "button",
|
|
2040
|
+
onClick: c,
|
|
2041
|
+
className: [
|
|
2042
|
+
"ds:appearance-none ds:bg-transparent ds:p-0 ds:text-start",
|
|
2043
|
+
i
|
|
2044
|
+
].join(" "),
|
|
2045
|
+
children: d
|
|
2046
|
+
}
|
|
2047
|
+
),
|
|
2048
|
+
u ? /* @__PURE__ */ s("span", { className: "type-meta ds:text-[color:var(--muted-foreground)]", children: u }) : null
|
|
2049
|
+
] });
|
|
2050
|
+
}
|
|
2051
|
+
function zn(t) {
|
|
2052
|
+
const {
|
|
2053
|
+
value: e,
|
|
2054
|
+
data: a,
|
|
2055
|
+
onToggle: n,
|
|
2056
|
+
onError: r,
|
|
2057
|
+
trueIcon: o,
|
|
2058
|
+
falseIcon: l,
|
|
2059
|
+
trueClass: u = "ds:text-[color:var(--success)]",
|
|
2060
|
+
falseClass: d = "ds:text-[color:var(--muted-foreground)]",
|
|
2061
|
+
label: i
|
|
2062
|
+
} = t, { t: c } = F(), [p, v] = R(!1);
|
|
2063
|
+
if (!a) return null;
|
|
2064
|
+
const g = !!e, b = g ? o ?? /* @__PURE__ */ s(Ot, { "aria-hidden": !0, className: "ds:size-4" }) : l ?? /* @__PURE__ */ s(Mt, { "aria-hidden": !0, className: "ds:size-4" }), y = g ? u : d, x = i ?? c(g ? "inputs.switch.on" : "inputs.switch.off");
|
|
2065
|
+
async function f(m) {
|
|
2066
|
+
if (m.stopPropagation(), p || !a) return;
|
|
2067
|
+
const C = n(a, !g);
|
|
2068
|
+
if (C && typeof C.then == "function") {
|
|
2069
|
+
v(!0);
|
|
2070
|
+
try {
|
|
2071
|
+
await C;
|
|
2072
|
+
} catch (S) {
|
|
2073
|
+
r == null || r(a, S);
|
|
2074
|
+
} finally {
|
|
2075
|
+
v(!1);
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
return /* @__PURE__ */ s(
|
|
2080
|
+
"button",
|
|
2081
|
+
{
|
|
2082
|
+
type: "button",
|
|
2083
|
+
role: "switch",
|
|
2084
|
+
"aria-checked": g,
|
|
2085
|
+
"aria-busy": p,
|
|
2086
|
+
"aria-label": x,
|
|
2087
|
+
disabled: p,
|
|
2088
|
+
onClick: f,
|
|
2089
|
+
className: [
|
|
2090
|
+
"ds:inline-flex ds:items-center ds:justify-center",
|
|
2091
|
+
"ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
|
|
2092
|
+
"ds:appearance-none ds:bg-transparent ds:p-[var(--spacing-xs)]",
|
|
2093
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
2094
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
2095
|
+
"ds:focus-visible:outline-solid",
|
|
2096
|
+
"ds:focus-visible:outline-[color:var(--ring)]",
|
|
2097
|
+
"ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
2098
|
+
"ds:disabled:opacity-50",
|
|
2099
|
+
y
|
|
2100
|
+
].join(" "),
|
|
2101
|
+
children: b
|
|
2102
|
+
}
|
|
2103
|
+
);
|
|
2104
|
+
}
|
|
2105
|
+
const Na = {
|
|
2106
|
+
sm: "ds:size-[var(--icon-size-sm)]",
|
|
2107
|
+
md: "ds:size-[var(--icon-size-md)]",
|
|
2108
|
+
lg: "ds:size-[var(--icon-size-lg)]"
|
|
2109
|
+
};
|
|
2110
|
+
function Ce(t, e) {
|
|
2111
|
+
if (!t || typeof t != "object") return;
|
|
2112
|
+
const a = t[e];
|
|
2113
|
+
return typeof a == "string" ? a : void 0;
|
|
2114
|
+
}
|
|
2115
|
+
const Sa = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, wa = /^rgba?\(\s*[\d.\s,%/]+\)$/i, Fa = /^hsla?\(\s*[\d.\s,%/]+\)$/i, Ra = /^var\(--[a-z0-9-]+(?:,\s*[^)]+)?\)$/i;
|
|
2116
|
+
function Da(t) {
|
|
2117
|
+
if (!t) return;
|
|
2118
|
+
const e = t.trim();
|
|
2119
|
+
if (Sa.test(e) || wa.test(e) || Fa.test(e) || Ra.test(e))
|
|
2120
|
+
return e;
|
|
2121
|
+
}
|
|
2122
|
+
function An(t) {
|
|
2123
|
+
const { data: e, colorField: a, size: n = "md", labelField: r } = t, o = X(null), l = e ? Ce(e, a) : void 0, u = Da(l), d = e && r ? Ce(e, r) : void 0;
|
|
2124
|
+
return Tt(() => {
|
|
2125
|
+
const i = o.current;
|
|
2126
|
+
i && (u ? i.style.setProperty("--data-table-dot-color", u) : i.style.removeProperty("--data-table-dot-color"));
|
|
2127
|
+
}, [u]), u ? /* @__PURE__ */ E("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
|
|
2128
|
+
/* @__PURE__ */ s(
|
|
2129
|
+
"span",
|
|
2130
|
+
{
|
|
2131
|
+
ref: o,
|
|
2132
|
+
"aria-hidden": "true",
|
|
2133
|
+
className: [
|
|
2134
|
+
"ds:inline-block ds:shrink-0 ds:rounded-[var(--radius-full)]",
|
|
2135
|
+
"ds:bg-[var(--data-table-dot-color)]",
|
|
2136
|
+
"ds:border ds:border-[color:var(--border)]",
|
|
2137
|
+
Na[n]
|
|
2138
|
+
].join(" ")
|
|
2139
|
+
}
|
|
2140
|
+
),
|
|
2141
|
+
d ? /* @__PURE__ */ s("span", { children: d }) : null
|
|
2142
|
+
] }) : null;
|
|
2143
|
+
}
|
|
2144
|
+
function ka(t, e) {
|
|
2145
|
+
if (!t || typeof t != "object") return null;
|
|
2146
|
+
const a = t[e], n = typeof a == "number" ? a : Number(a);
|
|
2147
|
+
return Number.isFinite(n) ? n : null;
|
|
2148
|
+
}
|
|
2149
|
+
function Pn(t) {
|
|
2150
|
+
const { data: e, lines: a, currency: n = "EUR", highlightNegative: r } = t, { i18n: o } = F();
|
|
2151
|
+
if (!e) return null;
|
|
2152
|
+
const l = o.language || "en", u = (i) => {
|
|
2153
|
+
const c = ka(e, i.valueField);
|
|
2154
|
+
if (c === null) return null;
|
|
2155
|
+
let p;
|
|
2156
|
+
switch (i.format ?? "number") {
|
|
2157
|
+
case "currency":
|
|
2158
|
+
p = new Intl.NumberFormat(l, {
|
|
2159
|
+
style: "currency",
|
|
2160
|
+
currency: n
|
|
2161
|
+
}).format(c);
|
|
2162
|
+
break;
|
|
2163
|
+
case "percent":
|
|
2164
|
+
p = new Intl.NumberFormat(l, {
|
|
2165
|
+
style: "percent",
|
|
2166
|
+
maximumFractionDigits: 1
|
|
2167
|
+
}).format(c / 100);
|
|
2168
|
+
break;
|
|
2169
|
+
default:
|
|
2170
|
+
p = new Intl.NumberFormat(l).format(c);
|
|
2171
|
+
}
|
|
2172
|
+
return {
|
|
2173
|
+
label: i.label,
|
|
2174
|
+
formatted: p,
|
|
2175
|
+
negative: !!r && c < 0
|
|
2176
|
+
};
|
|
2177
|
+
}, d = a.map(u).filter(
|
|
2178
|
+
(i) => i !== null
|
|
2179
|
+
);
|
|
2180
|
+
return d.length === 0 ? null : /* @__PURE__ */ s(
|
|
2181
|
+
"div",
|
|
2182
|
+
{
|
|
2183
|
+
className: [
|
|
2184
|
+
"ds:flex",
|
|
2185
|
+
"ds:flex-wrap",
|
|
2186
|
+
"ds:items-center",
|
|
2187
|
+
"ds:gap-x-[var(--spacing-sm)]",
|
|
2188
|
+
"ds:gap-y-0",
|
|
2189
|
+
"type-meta",
|
|
2190
|
+
"ds:leading-tight"
|
|
2191
|
+
].join(" "),
|
|
2192
|
+
children: d.map((i, c) => /* @__PURE__ */ E(
|
|
2193
|
+
"span",
|
|
2194
|
+
{
|
|
2195
|
+
className: "ds:inline-flex ds:items-baseline ds:gap-x-[var(--spacing-xs)]",
|
|
2196
|
+
children: [
|
|
2197
|
+
c > 0 ? /* @__PURE__ */ s(
|
|
2198
|
+
"span",
|
|
2199
|
+
{
|
|
2200
|
+
"aria-hidden": "true",
|
|
2201
|
+
className: "ds:me-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]",
|
|
2202
|
+
children: "·"
|
|
2203
|
+
}
|
|
2204
|
+
) : null,
|
|
2205
|
+
/* @__PURE__ */ s("span", { className: "ds:text-[color:var(--muted-foreground)]", children: i.label }),
|
|
2206
|
+
/* @__PURE__ */ s(
|
|
2207
|
+
"span",
|
|
2208
|
+
{
|
|
2209
|
+
className: [
|
|
2210
|
+
"ds:tabular-nums",
|
|
2211
|
+
"ds:font-medium",
|
|
2212
|
+
i.negative ? "ds:text-[color:var(--destructive)]" : ""
|
|
2213
|
+
].filter(Boolean).join(" "),
|
|
2214
|
+
children: i.formatted
|
|
2215
|
+
}
|
|
2216
|
+
)
|
|
2217
|
+
]
|
|
2218
|
+
},
|
|
2219
|
+
`${i.label}-${c}`
|
|
2220
|
+
))
|
|
2221
|
+
}
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
2224
|
+
function On(t) {
|
|
2225
|
+
var i, c;
|
|
2226
|
+
const { initialValue: e, onValueChange: a, stopEditing: n, column: r } = t, [o, l] = R(e ?? ""), u = X(null);
|
|
2227
|
+
P(() => {
|
|
2228
|
+
const p = u.current;
|
|
2229
|
+
p && (p.focus(), p.select());
|
|
2230
|
+
}, []);
|
|
2231
|
+
const d = ((c = (i = r == null ? void 0 : r.getColDef) == null ? void 0 : i.call(r)) == null ? void 0 : c.headerName) ?? void 0;
|
|
2232
|
+
return /* @__PURE__ */ s(
|
|
2233
|
+
"input",
|
|
2234
|
+
{
|
|
2235
|
+
ref: u,
|
|
2236
|
+
type: "text",
|
|
2237
|
+
value: o,
|
|
2238
|
+
"aria-label": d,
|
|
2239
|
+
onChange: (p) => {
|
|
2240
|
+
const v = p.target.value;
|
|
2241
|
+
l(v), a(v);
|
|
2242
|
+
},
|
|
2243
|
+
onKeyDown: (p) => {
|
|
2244
|
+
p.key === "Enter" && (p.preventDefault(), n());
|
|
2245
|
+
},
|
|
2246
|
+
className: [
|
|
2247
|
+
"ds:block ds:w-full ds:appearance-none",
|
|
2248
|
+
// Input surface chrome: rounded border + bg + focus halo.
|
|
2249
|
+
Pe,
|
|
2250
|
+
// Use the `md` height (`--min-target-size`) so the input
|
|
2251
|
+
// auto-lifts to 48px under `.theme-accessible` to satisfy
|
|
2252
|
+
// WCAG 2.5.5 target size.
|
|
2253
|
+
Oe.md,
|
|
2254
|
+
Me.sm,
|
|
2255
|
+
Le.sm
|
|
2256
|
+
].join(" ")
|
|
2257
|
+
}
|
|
2258
|
+
);
|
|
2259
|
+
}
|
|
2260
|
+
function Mn(t) {
|
|
2261
|
+
var y, x;
|
|
2262
|
+
const {
|
|
2263
|
+
initialValue: e,
|
|
2264
|
+
onValueChange: a,
|
|
2265
|
+
stopEditing: n,
|
|
2266
|
+
column: r,
|
|
2267
|
+
decimals: o = 2,
|
|
2268
|
+
min: l,
|
|
2269
|
+
max: u
|
|
2270
|
+
} = t, { i18n: d } = F(), i = X(null), c = ((x = (y = r == null ? void 0 : r.getColDef) == null ? void 0 : y.call(r)) == null ? void 0 : x.headerName) ?? void 0, [p, v] = R(() => e == null || Number.isNaN(e) ? "" : String(e));
|
|
2271
|
+
P(() => {
|
|
2272
|
+
const f = i.current;
|
|
2273
|
+
f && (f.focus(), f.select());
|
|
2274
|
+
}, []);
|
|
2275
|
+
function g(f) {
|
|
2276
|
+
var q, k;
|
|
2277
|
+
if (f.trim().length === 0) return null;
|
|
2278
|
+
const m = d.language || "en", h = new Intl.NumberFormat(m).formatToParts(12345.6), C = ((q = h.find((G) => G.type === "group")) == null ? void 0 : q.value) ?? "", S = ((k = h.find((G) => G.type === "decimal")) == null ? void 0 : k.value) ?? ".", z = f.replace(new RegExp(`\\${C}`, "g"), "").replace(S, ".").replace(/[^\d.-]/g, ""), D = Number(z);
|
|
2279
|
+
return Number.isFinite(D) ? D : null;
|
|
2280
|
+
}
|
|
2281
|
+
function b(f) {
|
|
2282
|
+
const m = g(f);
|
|
2283
|
+
if (m == null) {
|
|
2284
|
+
a(null);
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2287
|
+
let h = m;
|
|
2288
|
+
typeof l == "number" && (h = Math.max(l, h)), typeof u == "number" && (h = Math.min(u, h));
|
|
2289
|
+
const C = 10 ** o;
|
|
2290
|
+
a(Math.round(h * C) / C);
|
|
2291
|
+
}
|
|
2292
|
+
return /* @__PURE__ */ s(
|
|
2293
|
+
"input",
|
|
2294
|
+
{
|
|
2295
|
+
ref: i,
|
|
2296
|
+
type: "text",
|
|
2297
|
+
inputMode: "decimal",
|
|
2298
|
+
value: p,
|
|
2299
|
+
"aria-label": c,
|
|
2300
|
+
onChange: (f) => {
|
|
2301
|
+
const m = f.target.value;
|
|
2302
|
+
v(m), b(m);
|
|
2303
|
+
},
|
|
2304
|
+
onKeyDown: (f) => {
|
|
2305
|
+
f.key === "Enter" && (f.preventDefault(), n());
|
|
2306
|
+
},
|
|
2307
|
+
className: [
|
|
2308
|
+
"ds:block ds:w-full ds:appearance-none ds:text-end ds:tabular-nums",
|
|
2309
|
+
Pe,
|
|
2310
|
+
// Use `md` height — see editable-text-cell-renderer for rationale.
|
|
2311
|
+
Oe.md,
|
|
2312
|
+
Me.sm,
|
|
2313
|
+
Le.sm
|
|
2314
|
+
].join(" ")
|
|
2315
|
+
}
|
|
2316
|
+
);
|
|
2317
|
+
}
|
|
2318
|
+
export {
|
|
2319
|
+
En as A,
|
|
2320
|
+
Pn as B,
|
|
2321
|
+
An as C,
|
|
2322
|
+
mn as D,
|
|
2323
|
+
Mn as E,
|
|
2324
|
+
Fn as I,
|
|
2325
|
+
In as L,
|
|
2326
|
+
Cn as N,
|
|
2327
|
+
vn as S,
|
|
2328
|
+
Rn as T,
|
|
2329
|
+
wn as U,
|
|
2330
|
+
kn as a,
|
|
2331
|
+
Dn as b,
|
|
2332
|
+
bn as c,
|
|
2333
|
+
hn as d,
|
|
2334
|
+
On as e,
|
|
2335
|
+
Nn as f,
|
|
2336
|
+
yn as g,
|
|
2337
|
+
Sn as h,
|
|
2338
|
+
aa as i,
|
|
2339
|
+
na as j,
|
|
2340
|
+
zn as k,
|
|
2341
|
+
te as l,
|
|
2342
|
+
Vt as m,
|
|
2343
|
+
Tn as n,
|
|
2344
|
+
xn as o,
|
|
2345
|
+
ra as p,
|
|
2346
|
+
Ve as q,
|
|
2347
|
+
gn as u
|
|
2348
|
+
};
|
|
2349
|
+
//# sourceMappingURL=editable-currency-cell-renderer-DJB5MxAI.js.map
|