impact-nova 1.7.3 → 1.7.5
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/components/ui/ag-grid-react/headers/utils/filter-utils.js +58 -47
- package/dist/components/ui/data-table/data-table-saved-views.d.ts +2 -0
- package/dist/components/ui/data-table/data-table-saved-views.js +348 -0
- package/dist/components/ui/data-table/data-table-view-options.d.ts +8 -0
- package/dist/components/ui/data-table/index.d.ts +2 -0
- package/dist/components/ui/data-table/index.js +16 -14
- package/dist/components/ui/sidebar.js +5 -5
- package/dist/components/ui/types/data-table-saved-views.types.d.ts +71 -0
- package/dist/i18n/defaultMessages.d.ts +19 -0
- package/dist/i18n/defaultMessages.js +33 -15
- package/dist/i18n/locales/de.js +19 -1
- package/dist/i18n/locales/es.js +19 -1
- package/dist/i18n/locales/hi.js +19 -1
- package/dist/i18n/locales/kn.js +19 -1
- package/dist/icons/assets/blocks.svg.js +1 -1
- package/dist/icons/assets/createNewDocument.svg.js +2 -2
- package/dist/icons/assets/settings.svg.js +1 -1
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +91 -89
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getTodayStr as
|
|
2
|
-
const
|
|
1
|
+
import { getTodayStr as M, getYesterdayStr as F, getMonthRange as S, getYearRange as W } from "./date-utils.js";
|
|
2
|
+
const v = {
|
|
3
3
|
yes: !0,
|
|
4
4
|
true: !0,
|
|
5
5
|
"[x]": !0,
|
|
@@ -45,34 +45,34 @@ function w(a) {
|
|
|
45
45
|
date: t.findIndex((n) => (typeof n == "string" ? n : n.filter) === "agDateColumnFilter")
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function d(a) {
|
|
49
49
|
const t = a.toLowerCase().trim();
|
|
50
|
-
return t === "today" ?
|
|
50
|
+
return t === "today" ? M() : t === "yesterday" ? F() : a;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function q(a, t = !1, n = !1) {
|
|
53
53
|
const r = a.trim();
|
|
54
54
|
if (!r)
|
|
55
55
|
return { operator: "contains", value: "" };
|
|
56
56
|
if (r === '""') return { operator: "empty", value: "" };
|
|
57
57
|
if (r === '!""') return { operator: "notEmpty", value: "" };
|
|
58
58
|
if (r.startsWith("!="))
|
|
59
|
-
return { operator: "notEqual", value:
|
|
59
|
+
return { operator: "notEqual", value: d(r.slice(2)) };
|
|
60
60
|
if (r.startsWith("=="))
|
|
61
|
-
return { operator: "equals", value:
|
|
61
|
+
return { operator: "equals", value: d(r.slice(2)) };
|
|
62
62
|
if (r.startsWith("=")) {
|
|
63
63
|
const e = r.slice(1).trim(), l = e.toLowerCase();
|
|
64
|
-
return
|
|
64
|
+
return v[l] !== void 0 ? { operator: "equals", value: String(v[l]) } : { operator: "equals", value: d(e) };
|
|
65
65
|
}
|
|
66
66
|
if (r.startsWith("!"))
|
|
67
|
-
return { operator: "notContains", value:
|
|
67
|
+
return { operator: "notContains", value: d(r.slice(1)) };
|
|
68
68
|
if (r.startsWith(">="))
|
|
69
|
-
return { operator: "greaterThanOrEqual", value:
|
|
69
|
+
return { operator: "greaterThanOrEqual", value: d(r.slice(2)) };
|
|
70
70
|
if (r.startsWith(">"))
|
|
71
|
-
return { operator: "greaterThan", value:
|
|
71
|
+
return { operator: "greaterThan", value: d(r.slice(1)) };
|
|
72
72
|
if (r.startsWith("<="))
|
|
73
|
-
return { operator: "lessThanOrEqual", value:
|
|
73
|
+
return { operator: "lessThanOrEqual", value: d(r.slice(2)) };
|
|
74
74
|
if (r.startsWith("<"))
|
|
75
|
-
return { operator: "lessThan", value:
|
|
75
|
+
return { operator: "lessThan", value: d(r.slice(1)) };
|
|
76
76
|
if (r.startsWith("*") && r.length > 1 && !r.endsWith("*"))
|
|
77
77
|
return { operator: "endsWith", value: r.slice(1).trim() };
|
|
78
78
|
if (r.endsWith("*") && r.length > 1 && !r.startsWith("*"))
|
|
@@ -84,11 +84,11 @@ function v(a, t = !1, n = !1) {
|
|
|
84
84
|
if (f)
|
|
85
85
|
return { operator: "inRange", value: f[1], valueTo: f[2] };
|
|
86
86
|
const c = r.toLowerCase();
|
|
87
|
-
if (t &&
|
|
88
|
-
return { operator: "equals", value: String(
|
|
87
|
+
if (t && v[c] !== void 0)
|
|
88
|
+
return { operator: "equals", value: String(v[c]) };
|
|
89
89
|
if (n) {
|
|
90
|
-
if (c === "today") return { operator: "equals", value:
|
|
91
|
-
if (c === "yesterday") return { operator: "equals", value:
|
|
90
|
+
if (c === "today") return { operator: "equals", value: M() };
|
|
91
|
+
if (c === "yesterday") return { operator: "equals", value: F() };
|
|
92
92
|
if (/^\d{4}$/.test(r)) {
|
|
93
93
|
const l = W(Number(r));
|
|
94
94
|
return { operator: "inRange", value: l.from, valueTo: l.to };
|
|
@@ -112,18 +112,18 @@ function I(a, t = !1, n = !1, r = !1) {
|
|
|
112
112
|
return { conditions: [], logic: "OR", matchAll: !0 };
|
|
113
113
|
const f = i.includes("+") || i.includes("&"), c = i.includes(",") || i.includes(";");
|
|
114
114
|
if (f)
|
|
115
|
-
return { conditions: i.split(/\s*[+&]\s*/).filter((o) => !!o.trim()).map((o) =>
|
|
115
|
+
return { conditions: i.split(/\s*[+&]\s*/).filter((o) => !!o.trim()).map((o) => q(o, n, r)).filter((o) => !!o.value), logic: "AND" };
|
|
116
116
|
if (c)
|
|
117
|
-
return { conditions: i.split(/\s*[,;]\s*/).filter((o) => !!o.trim()).map((o) =>
|
|
117
|
+
return { conditions: i.split(/\s*[,;]\s*/).filter((o) => !!o.trim()).map((o) => q(o, n, r)).filter((o) => !!o.value), logic: "OR" };
|
|
118
118
|
if (t) {
|
|
119
119
|
const l = i.split(/\s+/).filter((u) => !!u.trim());
|
|
120
120
|
if (l.length > 1) {
|
|
121
|
-
const u = l.map((o) =>
|
|
121
|
+
const u = l.map((o) => q(o, n, r)).filter((o) => !!o.value);
|
|
122
122
|
if (u.length > 1)
|
|
123
123
|
return { conditions: u, logic: "OR" };
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
const e =
|
|
126
|
+
const e = q(i, n, r);
|
|
127
127
|
return !e.value && e.operator === "contains" ? { conditions: [], logic: "OR" } : { conditions: [e], logic: "OR" };
|
|
128
128
|
}
|
|
129
129
|
function m(a) {
|
|
@@ -174,7 +174,7 @@ function $(a) {
|
|
|
174
174
|
return t;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
const
|
|
177
|
+
const b = {
|
|
178
178
|
contains: "contains",
|
|
179
179
|
notContains: "notContains",
|
|
180
180
|
equals: "equals",
|
|
@@ -196,21 +196,21 @@ const F = {
|
|
|
196
196
|
lt: "lessThan",
|
|
197
197
|
lte: "lessThanOrEqual"
|
|
198
198
|
};
|
|
199
|
-
function
|
|
199
|
+
function O(a, t) {
|
|
200
200
|
if (!t) return "";
|
|
201
201
|
if ("filterType" in t && t.filterType === "multi" && t.filterModels)
|
|
202
|
-
return t.filterModels.map((r) =>
|
|
202
|
+
return t.filterModels.map((r) => O(a, r)).filter((r) => !!r).join(", ");
|
|
203
203
|
if ("filterType" in t && t.filterType === "set" && t.values) {
|
|
204
204
|
const i = t.values || [];
|
|
205
205
|
return i.length === 0 ? "" : i.length === 1 ? m(i[0]) : `${m(i[0])} (+${i.length - 1})`;
|
|
206
206
|
}
|
|
207
207
|
if ("conditions" in t && t.conditions && t.operator) {
|
|
208
208
|
const r = t.operator === "AND" ? " + " : ", ";
|
|
209
|
-
return t.conditions.map((i) =>
|
|
209
|
+
return t.conditions.map((i) => O(a, i)).filter((i) => !!i).join(r);
|
|
210
210
|
}
|
|
211
211
|
const n = t;
|
|
212
212
|
if ("type" in n && n.type) {
|
|
213
|
-
const r = n.type, i =
|
|
213
|
+
const r = n.type, i = b[r] || r, f = n.filter !== void 0 ? String(n.filter) : n.dateFrom !== void 0 ? String(n.dateFrom) : "", c = n.filterTo !== void 0 ? String(n.filterTo) : n.dateTo !== void 0 ? String(n.dateTo) : void 0;
|
|
214
214
|
return $({
|
|
215
215
|
operator: i,
|
|
216
216
|
value: f,
|
|
@@ -221,13 +221,13 @@ function A(a, t) {
|
|
|
221
221
|
}
|
|
222
222
|
return "";
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function A() {
|
|
225
225
|
return Math.random().toString(36).substring(2, 11);
|
|
226
226
|
}
|
|
227
227
|
function j(a = "", t) {
|
|
228
228
|
const n = t === "number" || t === "date" || t === "select" ? "equals" : "contains";
|
|
229
229
|
return {
|
|
230
|
-
id:
|
|
230
|
+
id: A(),
|
|
231
231
|
columnId: a,
|
|
232
232
|
operator: n,
|
|
233
233
|
value: "",
|
|
@@ -267,7 +267,7 @@ function h(a) {
|
|
|
267
267
|
return "contains";
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function R(a, t, n) {
|
|
271
271
|
return n === "number" ? "number" : n === "date" ? "date" : n === "select" || n === "set" || Array.isArray(t) ? a === "notEqual" || a === "notContains" ? "text" : "set" : typeof t == "string" && /^\d{4}-\d{2}-\d{2}/.test(t) ? "date" : ["greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "inRange"].includes(a) && t && !x(t) && !isNaN(Number(t)) || typeof t == "string" && t && /^-?\d+(\.\d+)?$/.test(t.trim()) ? "number" : "text";
|
|
272
272
|
}
|
|
273
273
|
function x(a) {
|
|
@@ -285,11 +285,11 @@ function D(a) {
|
|
|
285
285
|
if (f[0].columnType === "multi") {
|
|
286
286
|
const e = (s) => s.operator !== "equals" ? !1 : !!(Array.isArray(s.value) || ["select", "multi"].includes(s.columnType)), l = f.filter(e), u = f.filter((s) => !e(s)), o = [null, null];
|
|
287
287
|
if (u.length > 0) {
|
|
288
|
-
const s =
|
|
288
|
+
const s = E(u, "text", a.logic);
|
|
289
289
|
s && (o[0] = s);
|
|
290
290
|
}
|
|
291
291
|
if (l.length > 0) {
|
|
292
|
-
const s =
|
|
292
|
+
const s = E(l, "set", a.logic);
|
|
293
293
|
s && (o[1] = s);
|
|
294
294
|
}
|
|
295
295
|
(o[0] || o[1]) && (t[i] = {
|
|
@@ -297,13 +297,13 @@ function D(a) {
|
|
|
297
297
|
filterModels: o
|
|
298
298
|
});
|
|
299
299
|
} else {
|
|
300
|
-
const e =
|
|
300
|
+
const e = E(f, f[0].columnType, a.logic);
|
|
301
301
|
e && (t[i] = e);
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
return console.log("[AdvancedFilter] Converted AG Grid filter model:", t), t;
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function E(a, t, n = "OR") {
|
|
307
307
|
if (a.length === 0) return null;
|
|
308
308
|
const r = [];
|
|
309
309
|
a.forEach((e) => {
|
|
@@ -311,7 +311,7 @@ function q(a, t, n = "OR") {
|
|
|
311
311
|
r.push({
|
|
312
312
|
...e,
|
|
313
313
|
value: l,
|
|
314
|
-
id:
|
|
314
|
+
id: A()
|
|
315
315
|
// Unique ID for each condition
|
|
316
316
|
});
|
|
317
317
|
}) : r.push(e);
|
|
@@ -328,14 +328,14 @@ function q(a, t, n = "OR") {
|
|
|
328
328
|
}
|
|
329
329
|
const c = r;
|
|
330
330
|
if (c.length === 1) {
|
|
331
|
-
const e = c[0], l =
|
|
331
|
+
const e = c[0], l = R(e.operator, e.value, e.columnType);
|
|
332
332
|
if (l === "date" && typeof e.value == "string") {
|
|
333
333
|
const o = (s) => {
|
|
334
334
|
if (!s || Array.isArray(s)) return null;
|
|
335
335
|
if (/^\d{4}-\d{2}-\d{2}$/.test(s)) return s;
|
|
336
336
|
try {
|
|
337
|
-
const
|
|
338
|
-
return `${y}-${g}-${
|
|
337
|
+
const p = new Date(s), y = p.getFullYear(), g = String(p.getMonth() + 1).padStart(2, "0"), T = String(p.getDate()).padStart(2, "0");
|
|
338
|
+
return `${y}-${g}-${T}`;
|
|
339
339
|
} catch {
|
|
340
340
|
return s;
|
|
341
341
|
}
|
|
@@ -354,7 +354,11 @@ function q(a, t, n = "OR") {
|
|
|
354
354
|
const u = (o) => {
|
|
355
355
|
if (Array.isArray(o)) return o;
|
|
356
356
|
const s = e.columnType === "number";
|
|
357
|
-
|
|
357
|
+
if (l === "number" || s) {
|
|
358
|
+
const p = parseFloat(o);
|
|
359
|
+
return isNaN(p) ? o : p;
|
|
360
|
+
}
|
|
361
|
+
return o;
|
|
358
362
|
};
|
|
359
363
|
return e.operator === "inRange" ? {
|
|
360
364
|
type: h(e.operator),
|
|
@@ -373,21 +377,28 @@ function q(a, t, n = "OR") {
|
|
|
373
377
|
} else {
|
|
374
378
|
let e = "text";
|
|
375
379
|
const l = a.map((u) => {
|
|
376
|
-
const o = h(u.operator), s =
|
|
380
|
+
const o = h(u.operator), s = R(u.operator, u.value, u.columnType);
|
|
377
381
|
e === "text" && s !== "text" && s !== "set" && (e = s);
|
|
378
|
-
const
|
|
382
|
+
const p = (g) => {
|
|
383
|
+
if (Array.isArray(g)) return g;
|
|
384
|
+
if (s === "number") {
|
|
385
|
+
const T = parseFloat(g);
|
|
386
|
+
return isNaN(T) ? g : T;
|
|
387
|
+
}
|
|
388
|
+
return g;
|
|
389
|
+
};
|
|
379
390
|
let y = o;
|
|
380
391
|
return s === "number" && (["contains", "startsWith", "endsWith"].includes(o) ? y = "equals" : o === "notContains" && (y = "notEqual")), u.operator === "inRange" ? {
|
|
381
392
|
type: o,
|
|
382
|
-
filter:
|
|
383
|
-
filterTo:
|
|
393
|
+
filter: p(u.value),
|
|
394
|
+
filterTo: p(u.valueTo || ""),
|
|
384
395
|
filterType: s
|
|
385
396
|
} : u.operator === "empty" || u.operator === "notEmpty" ? {
|
|
386
397
|
type: o,
|
|
387
398
|
filterType: "text"
|
|
388
399
|
} : {
|
|
389
400
|
type: y,
|
|
390
|
-
filter:
|
|
401
|
+
filter: p(u.value),
|
|
391
402
|
filterType: s
|
|
392
403
|
};
|
|
393
404
|
});
|
|
@@ -409,9 +420,9 @@ function k(a) {
|
|
|
409
420
|
return c.conditions.flatMap((s) => i(s));
|
|
410
421
|
if ("filterType" in c && c.filterType === "multi" && c.filterModels)
|
|
411
422
|
return c.filterModels.flatMap((s) => s ? i(s) : []);
|
|
412
|
-
const e = c, l = "type" in e ? e.type : "equals", u = e.filterType === "set" ? "equals" :
|
|
423
|
+
const e = c, l = "type" in e ? e.type : "equals", u = e.filterType === "set" ? "equals" : b[l] || "contains", o = e.filter !== void 0 ? String(e.filter) : e.dateFrom !== void 0 ? String(e.dateFrom) : e.values ? e.values : "";
|
|
413
424
|
return [{
|
|
414
|
-
id:
|
|
425
|
+
id: A(),
|
|
415
426
|
columnId: n,
|
|
416
427
|
operator: u,
|
|
417
428
|
value: o,
|
|
@@ -432,8 +443,8 @@ export {
|
|
|
432
443
|
D as convertToAgGridFilterModel,
|
|
433
444
|
j as createEmptyRule,
|
|
434
445
|
$ as formatRuleForDisplay,
|
|
435
|
-
|
|
436
|
-
|
|
446
|
+
A as generateFilterId,
|
|
447
|
+
O as getDisplayStringFromFilterModel,
|
|
437
448
|
w as getMultiFilterIndices,
|
|
438
449
|
h as mapOperatorToAgGrid,
|
|
439
450
|
I as parseInputPattern
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { DataTableSavedViewsProps } from '../types/data-table-saved-views.types';
|
|
2
|
+
export declare const DataTableSavedViews: ({ isSaveViewEnabled, views, activeViewSummary, viewTypeOptions, menuOpen: menuOpenControlled, defaultMenuOpen, onMenuOpenChange, onSearch, isLoadingViews, customListContent, disableApply, className, onSaveViewClick, onApply, onCancel, onEditView, onDeleteView, onSetDefaultView, }: DataTableSavedViewsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { jsxs as l, Fragment as ne, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { ChevronDown as le, Star as w, Search as ie, Pencil as se, Trash2 as re, Bookmark as oe } from "lucide-react";
|
|
4
|
+
import { cn as T } from "../../../lib/utils.js";
|
|
5
|
+
import { Popover as de, PopoverTrigger as ce, PopoverContent as me } from "../popover.js";
|
|
6
|
+
import { Tooltip as I, TooltipTrigger as O, TooltipContent as _ } from "../tooltip.js";
|
|
7
|
+
import { Button as o } from "../button.js";
|
|
8
|
+
import { Badge as C } from "../badge.js";
|
|
9
|
+
import { Input as pe } from "../input.js";
|
|
10
|
+
import { Separator as ue } from "../separator.js";
|
|
11
|
+
import { Skeleton as fe } from "../skeleton.js";
|
|
12
|
+
import { Prompt as he } from "../prompt.js";
|
|
13
|
+
import { useImpactNovaI18n as xe } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
14
|
+
const Se = ({
|
|
15
|
+
isSaveViewEnabled: L = !0,
|
|
16
|
+
views: s,
|
|
17
|
+
activeViewSummary: F,
|
|
18
|
+
viewTypeOptions: Q,
|
|
19
|
+
menuOpen: k,
|
|
20
|
+
defaultMenuOpen: q = !1,
|
|
21
|
+
onMenuOpenChange: V,
|
|
22
|
+
onSearch: m,
|
|
23
|
+
isLoadingViews: K = !1,
|
|
24
|
+
customListContent: D,
|
|
25
|
+
disableApply: R = !1,
|
|
26
|
+
className: Y,
|
|
27
|
+
onSaveViewClick: G,
|
|
28
|
+
onApply: H,
|
|
29
|
+
onCancel: J,
|
|
30
|
+
onEditView: U,
|
|
31
|
+
onDeleteView: W,
|
|
32
|
+
onSetDefaultView: z
|
|
33
|
+
}) => {
|
|
34
|
+
const { t: a } = xe(), x = k !== void 0, [X, Z] = i.useState(
|
|
35
|
+
q
|
|
36
|
+
), p = x ? !!k : X, d = i.useCallback(
|
|
37
|
+
(e) => {
|
|
38
|
+
x || Z(e), V?.(e);
|
|
39
|
+
},
|
|
40
|
+
[x, V]
|
|
41
|
+
), [u, b] = i.useState("All"), [v, g] = i.useState(""), [f, S] = i.useState("");
|
|
42
|
+
i.useEffect(() => {
|
|
43
|
+
const e = window.setTimeout(() => S(v), 300);
|
|
44
|
+
return () => window.clearTimeout(e);
|
|
45
|
+
}, [v]), i.useEffect(() => {
|
|
46
|
+
m && m(f);
|
|
47
|
+
}, [f, m]);
|
|
48
|
+
const M = i.useMemo(
|
|
49
|
+
() => s.find((e) => e.isActive),
|
|
50
|
+
[s]
|
|
51
|
+
), r = M ?? null, P = F ?? M?.viewName ?? a("dataTable.savedViewsNotApplicable"), [y, N] = i.useState(null), [h, A] = i.useState(null);
|
|
52
|
+
i.useEffect(() => {
|
|
53
|
+
if (p) {
|
|
54
|
+
const e = s.find((c) => c.isActive);
|
|
55
|
+
N(e?.id ?? null), b("All"), g(""), S("");
|
|
56
|
+
}
|
|
57
|
+
}, [p, s]);
|
|
58
|
+
const E = i.useMemo(() => u === "All" ? s : s.filter((e) => e.viewType === u), [s, u]), j = i.useMemo(() => {
|
|
59
|
+
let e = E;
|
|
60
|
+
if (!m && f.trim()) {
|
|
61
|
+
const c = f.trim().toLowerCase();
|
|
62
|
+
e = e.filter((n) => n.viewName.toLowerCase().includes(c));
|
|
63
|
+
}
|
|
64
|
+
return e;
|
|
65
|
+
}, [E, f, m]), B = y === null ? null : s.find((e) => e.id === y) ?? null, $ = () => {
|
|
66
|
+
H?.(B, { activeView: r }), d(!1);
|
|
67
|
+
}, ee = () => {
|
|
68
|
+
J?.({ activeView: r, pendingView: B }), d(!1);
|
|
69
|
+
}, te = (e) => {
|
|
70
|
+
d(e), e || g("");
|
|
71
|
+
};
|
|
72
|
+
if (!L)
|
|
73
|
+
return null;
|
|
74
|
+
const ae = s.length > 0;
|
|
75
|
+
return /* @__PURE__ */ l(ne, { children: [
|
|
76
|
+
/* @__PURE__ */ l(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
"data-component": "data-table-saved-views",
|
|
80
|
+
className: T(
|
|
81
|
+
"mb-2 mx-4 rounded-lg bg-[linear-gradient(83.74deg,#F5F9EC_72.68%,#D7E5B2_108.88%)] flex min-w-0 flex-wrap items-center justify-between gap-2 px-2 py-3",
|
|
82
|
+
Y
|
|
83
|
+
),
|
|
84
|
+
children: [
|
|
85
|
+
ae ? /* @__PURE__ */ t("div", { className: "flex min-w-0 flex-1 items-center gap-1 sm:flex-initial", children: /* @__PURE__ */ l(de, { open: p, onOpenChange: te, children: [
|
|
86
|
+
/* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ l(
|
|
87
|
+
"button",
|
|
88
|
+
{
|
|
89
|
+
type: "button",
|
|
90
|
+
className: "flex min-w-0 max-w-full cursor-pointer items-center gap-1 rounded-md border-none bg-transparent p-0 text-left outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2",
|
|
91
|
+
"aria-expanded": p,
|
|
92
|
+
"aria-haspopup": "dialog",
|
|
93
|
+
"aria-label": a("dataTable.savedViewsOpenMenu"),
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ l(I, { children: [
|
|
96
|
+
/* @__PURE__ */ t(O, { asChild: !0, children: /* @__PURE__ */ t(
|
|
97
|
+
C,
|
|
98
|
+
{
|
|
99
|
+
color: "success",
|
|
100
|
+
variant: "outline",
|
|
101
|
+
className: "max-w-[min(100%,200px)] shrink font-['Manrope']",
|
|
102
|
+
children: /* @__PURE__ */ t("span", { className: "truncate", children: P })
|
|
103
|
+
}
|
|
104
|
+
) }),
|
|
105
|
+
/* @__PURE__ */ t(_, { variant: "tertiary", side: "top", children: P })
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ t(
|
|
108
|
+
"span",
|
|
109
|
+
{
|
|
110
|
+
className: T(
|
|
111
|
+
"flex size-6 shrink-0 items-center justify-center rounded-md bg-white transition-transform duration-200",
|
|
112
|
+
p && "rotate-180"
|
|
113
|
+
),
|
|
114
|
+
"aria-hidden": !0,
|
|
115
|
+
children: /* @__PURE__ */ t(le, { className: "size-3.5 text-content-charcoal" })
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
) }),
|
|
121
|
+
/* @__PURE__ */ t(
|
|
122
|
+
me,
|
|
123
|
+
{
|
|
124
|
+
align: "start",
|
|
125
|
+
className: "z-[110] w-[min(100vw-24px,280px)] p-0 shadow-[0_0_4px_0_rgba(0,0,0,0.12)]",
|
|
126
|
+
sideOffset: 8,
|
|
127
|
+
children: /* @__PURE__ */ l("div", { className: "flex flex-col py-2", children: [
|
|
128
|
+
/* @__PURE__ */ l("div", { className: "flex items-start justify-between gap-2 px-3 pb-2", children: [
|
|
129
|
+
/* @__PURE__ */ t("span", { className: "text-sm font-medium text-content-charcoal font-['Manrope']", children: a("dataTable.savedViewsTitle") }),
|
|
130
|
+
/* @__PURE__ */ l("div", { className: "flex shrink-0 items-center gap-1 text-xs font-medium text-content-tertiary font-['Manrope']", children: [
|
|
131
|
+
/* @__PURE__ */ t(w, { className: "size-3.5 text-badge-warning-ink" }),
|
|
132
|
+
a("dataTable.savedViewsDefault")
|
|
133
|
+
] })
|
|
134
|
+
] }),
|
|
135
|
+
/* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1.5 px-3 pb-2", children: [
|
|
136
|
+
/* @__PURE__ */ t(
|
|
137
|
+
"button",
|
|
138
|
+
{
|
|
139
|
+
type: "button",
|
|
140
|
+
className: "border-none bg-transparent p-0",
|
|
141
|
+
onClick: () => b("All"),
|
|
142
|
+
children: /* @__PURE__ */ t(
|
|
143
|
+
C,
|
|
144
|
+
{
|
|
145
|
+
color: u === "All" ? "primary" : "neutral",
|
|
146
|
+
variant: "outline",
|
|
147
|
+
size: "sm",
|
|
148
|
+
className: "cursor-pointer font-['Manrope']",
|
|
149
|
+
children: a("dataTable.savedViewsAll")
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
Q?.map((e) => /* @__PURE__ */ t(
|
|
155
|
+
"button",
|
|
156
|
+
{
|
|
157
|
+
type: "button",
|
|
158
|
+
className: "border-none bg-transparent p-0",
|
|
159
|
+
onClick: () => b(e.value),
|
|
160
|
+
children: /* @__PURE__ */ t(
|
|
161
|
+
C,
|
|
162
|
+
{
|
|
163
|
+
color: u === e.value ? "primary" : "neutral",
|
|
164
|
+
variant: "outline",
|
|
165
|
+
size: "sm",
|
|
166
|
+
className: "cursor-pointer font-['Manrope']",
|
|
167
|
+
children: e.label
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
},
|
|
171
|
+
e.value
|
|
172
|
+
))
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ t("div", { className: "px-3 pb-2", children: /* @__PURE__ */ t(
|
|
175
|
+
pe,
|
|
176
|
+
{
|
|
177
|
+
size: "sm",
|
|
178
|
+
placeholder: a("dataTable.savedViewsSearchPlaceholder"),
|
|
179
|
+
value: v,
|
|
180
|
+
onChange: (e) => g(e.target.value),
|
|
181
|
+
prefix: /* @__PURE__ */ t(
|
|
182
|
+
ie,
|
|
183
|
+
{
|
|
184
|
+
className: "size-4 shrink-0 text-content-muted",
|
|
185
|
+
"aria-hidden": !0
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
className: "border-none shadow-none my-2 rounded-none",
|
|
189
|
+
"aria-label": a("dataTable.savedViewsSearchPlaceholder")
|
|
190
|
+
}
|
|
191
|
+
) }),
|
|
192
|
+
/* @__PURE__ */ t("div", { className: "min-h-[72px] px-1", children: D || (K ? /* @__PURE__ */ t("div", { className: "flex max-h-[160px] flex-col gap-2 overflow-y-auto px-2 py-1", children: [1, 2, 3, 4, 5].map((e) => /* @__PURE__ */ t(fe, { className: "h-9 w-full rounded-lg" }, e)) }) : j.length === 0 ? /* @__PURE__ */ t("div", { className: "flex min-h-[100px] flex-col items-center justify-center px-4 py-6 text-center", children: /* @__PURE__ */ t("span", { className: "text-sm leading-relaxed text-content-tertiary font-['Manrope']", children: a("dataTable.savedViewsEmptyList") }) }) : /* @__PURE__ */ t("div", { className: "flex max-h-[160px] flex-col overflow-y-auto", children: j.map((e) => {
|
|
193
|
+
const c = y === e.id;
|
|
194
|
+
return /* @__PURE__ */ l(
|
|
195
|
+
"div",
|
|
196
|
+
{
|
|
197
|
+
role: "button",
|
|
198
|
+
tabIndex: 0,
|
|
199
|
+
className: T(
|
|
200
|
+
"mb-1 flex cursor-pointer items-center justify-between rounded-lg px-3 py-2 text-left text-sm font-medium font-['Manrope'] hover:bg-muted",
|
|
201
|
+
c && "bg-badge-info-muted text-badge-info-foreground",
|
|
202
|
+
!c && "text-foreground"
|
|
203
|
+
),
|
|
204
|
+
onClick: () => N(e.id),
|
|
205
|
+
onKeyDown: (n) => {
|
|
206
|
+
(n.key === "Enter" || n.key === " ") && (n.preventDefault(), N(e.id));
|
|
207
|
+
},
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ l(I, { children: [
|
|
210
|
+
/* @__PURE__ */ t(O, { asChild: !0, children: /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: e.viewName }) }),
|
|
211
|
+
/* @__PURE__ */ t(_, { variant: "tertiary", side: "right", children: e.viewName })
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ l("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
214
|
+
e.isEditable ? /* @__PURE__ */ t(
|
|
215
|
+
o,
|
|
216
|
+
{
|
|
217
|
+
type: "button",
|
|
218
|
+
variant: "ghost",
|
|
219
|
+
size: "iconSm",
|
|
220
|
+
className: "text-foreground hover:text-content-charcoal",
|
|
221
|
+
"aria-label": a("dataTable.savedViewsEdit"),
|
|
222
|
+
onClick: (n) => {
|
|
223
|
+
n.stopPropagation(), n.preventDefault(), d(!1), U?.(e, { activeView: r });
|
|
224
|
+
},
|
|
225
|
+
children: /* @__PURE__ */ t(se, { className: "size-3.5" })
|
|
226
|
+
}
|
|
227
|
+
) : null,
|
|
228
|
+
e.isDeletable ? /* @__PURE__ */ t(
|
|
229
|
+
o,
|
|
230
|
+
{
|
|
231
|
+
type: "button",
|
|
232
|
+
variant: "ghost",
|
|
233
|
+
size: "iconSm",
|
|
234
|
+
className: "text-foreground hover:text-destructive",
|
|
235
|
+
"aria-label": a("dataTable.savedViewsDelete"),
|
|
236
|
+
onClick: (n) => {
|
|
237
|
+
n.stopPropagation(), n.preventDefault(), d(!1), A(e);
|
|
238
|
+
},
|
|
239
|
+
children: /* @__PURE__ */ t(re, { className: "size-3.5" })
|
|
240
|
+
}
|
|
241
|
+
) : null,
|
|
242
|
+
e.hideDefaultStar ? null : e.isDefaultView ? /* @__PURE__ */ t(
|
|
243
|
+
o,
|
|
244
|
+
{
|
|
245
|
+
type: "button",
|
|
246
|
+
variant: "ghost",
|
|
247
|
+
size: "iconSm",
|
|
248
|
+
className: "text-yellow-500 hover:text-yellow-600",
|
|
249
|
+
"aria-label": a(
|
|
250
|
+
"dataTable.savedViewsDefaultAction"
|
|
251
|
+
),
|
|
252
|
+
onClick: (n) => {
|
|
253
|
+
n.stopPropagation(), n.preventDefault(), z?.(e, { activeView: r });
|
|
254
|
+
},
|
|
255
|
+
children: /* @__PURE__ */ t(w, { className: "size-3.5 fill-current" })
|
|
256
|
+
}
|
|
257
|
+
) : /* @__PURE__ */ t(
|
|
258
|
+
o,
|
|
259
|
+
{
|
|
260
|
+
type: "button",
|
|
261
|
+
variant: "ghost",
|
|
262
|
+
size: "iconSm",
|
|
263
|
+
className: "text-yellow-500 hover:text-yellow-600",
|
|
264
|
+
"aria-label": a(
|
|
265
|
+
"dataTable.savedViewsSetDefault"
|
|
266
|
+
),
|
|
267
|
+
onClick: (n) => {
|
|
268
|
+
n.stopPropagation(), n.preventDefault(), z?.(e, { activeView: r });
|
|
269
|
+
},
|
|
270
|
+
children: /* @__PURE__ */ t(w, { className: "size-3.5" })
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
] })
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
e.id
|
|
277
|
+
);
|
|
278
|
+
}) })) }),
|
|
279
|
+
/* @__PURE__ */ t(ue, { className: "my-1" }),
|
|
280
|
+
/* @__PURE__ */ l("div", { className: "flex justify-end gap-2 px-3 pt-1", children: [
|
|
281
|
+
/* @__PURE__ */ t(
|
|
282
|
+
o,
|
|
283
|
+
{
|
|
284
|
+
type: "button",
|
|
285
|
+
variant: "tertiary",
|
|
286
|
+
size: "md",
|
|
287
|
+
onClick: ee,
|
|
288
|
+
children: a("dataTable.savedViewsCancel")
|
|
289
|
+
}
|
|
290
|
+
),
|
|
291
|
+
/* @__PURE__ */ t(
|
|
292
|
+
o,
|
|
293
|
+
{
|
|
294
|
+
type: "button",
|
|
295
|
+
variant: "default",
|
|
296
|
+
size: "md",
|
|
297
|
+
disabled: R,
|
|
298
|
+
onClick: $,
|
|
299
|
+
children: a("dataTable.savedViewsApply")
|
|
300
|
+
}
|
|
301
|
+
)
|
|
302
|
+
] })
|
|
303
|
+
] })
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
] }) }) : /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-center gap-2 text-content-tertiary", children: [
|
|
307
|
+
/* @__PURE__ */ t(oe, { className: "size-4 shrink-0", "aria-hidden": !0 }),
|
|
308
|
+
/* @__PURE__ */ t("span", { className: "text-sm font-medium font-['Manrope']", children: a("dataTable.savedViewsNoneYet") })
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ t(
|
|
311
|
+
o,
|
|
312
|
+
{
|
|
313
|
+
type: "button",
|
|
314
|
+
variant: "tertiary",
|
|
315
|
+
size: "sm",
|
|
316
|
+
className: "shrink-0 font-['Manrope']",
|
|
317
|
+
onClick: () => {
|
|
318
|
+
d(!1), G?.({ activeView: r });
|
|
319
|
+
},
|
|
320
|
+
children: a("dataTable.savedViewsSave")
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
),
|
|
326
|
+
/* @__PURE__ */ t(
|
|
327
|
+
he,
|
|
328
|
+
{
|
|
329
|
+
variant: "destructive",
|
|
330
|
+
open: h !== null,
|
|
331
|
+
onOpenChange: (e) => {
|
|
332
|
+
e || A(null);
|
|
333
|
+
},
|
|
334
|
+
title: a("dataTable.savedViewsDeleteConfirmTitle"),
|
|
335
|
+
description: h ? a("dataTable.savedViewsDeleteConfirmDescription", {
|
|
336
|
+
viewName: h.viewName
|
|
337
|
+
}) : void 0,
|
|
338
|
+
confirmLabel: a("dataTable.savedViewsDeleteConfirmButton"),
|
|
339
|
+
onConfirm: () => {
|
|
340
|
+
h && W?.(h, { activeView: r });
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
] });
|
|
345
|
+
};
|
|
346
|
+
export {
|
|
347
|
+
Se as DataTableSavedViews
|
|
348
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface DataTableViewOptionsProps {
|
|
3
|
+
enableTableSettings?: boolean;
|
|
4
|
+
enableContentDensity?: boolean;
|
|
5
|
+
trigger?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const DataTableViewOptions: ({ enableTableSettings, enableContentDensity, trigger, }: DataTableViewOptionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -5,3 +5,5 @@ export * from './data-table-context';
|
|
|
5
5
|
export * from './data-table-format-options';
|
|
6
6
|
export * from './data-table-sheet';
|
|
7
7
|
export * from './data-table-view-menu';
|
|
8
|
+
export * from './data-table-saved-views';
|
|
9
|
+
export type { SavedTableViewItem, TableViewTypeOption, DataTableSavedViewsProps, DataTableSavedViewsActionContext, DataTableSavedViewsCancelContext, } from '../types/data-table-saved-views.types';
|