@krak-stack/registry 0.1.56 → 0.1.58
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/CHANGELOG.md +19 -0
- package/dist/components/ui/data-table.d.ts +85 -2
- package/dist/components/ui/data-table.js +1407 -622
- package/dist/lib/query.d.ts +216 -0
- package/dist/lib/query.js +50 -2
- package/dist/services/events/browser.js +54 -1
- package/dist/services/events/client/audit-log-table.js +1444 -677
- package/dist/services/events/index.d.ts +48 -0
- package/dist/services/events/index.js +93 -10
- package/dist/services/events/schema.d.ts +218 -0
- package/dist/services/events/schema.js +56 -1
- package/package.json +1 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
// ../../src/services/events/client/audit-log-table.tsx
|
|
2
|
-
import { ListFilterIcon } from "lucide-react";
|
|
3
|
-
|
|
4
1
|
// ../../src/components/ui/data-table.tsx
|
|
5
2
|
import { useAtom, useAtomSet } from "@effect/atom-react";
|
|
6
3
|
import { BrowserKeyValueStore } from "@effect/platform-browser";
|
|
7
|
-
import { DateTime, Option, Schema } from "effect";
|
|
4
|
+
import { DateTime as DateTime2, Effect as Effect2, Option as Option2, Schema as Schema2, Stream } from "effect";
|
|
5
|
+
import { Csv } from "effect/encoding";
|
|
8
6
|
import { AsyncResult, Atom } from "effect/reactivity";
|
|
9
7
|
import {
|
|
10
8
|
ArrowDown,
|
|
11
9
|
ArrowUp,
|
|
10
|
+
Check,
|
|
12
11
|
ChevronDown,
|
|
13
12
|
ChevronRight as ChevronRight2,
|
|
14
13
|
ChevronsUpDown,
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
18
17
|
FileText,
|
|
19
18
|
GripVertical,
|
|
20
19
|
LayoutGrid,
|
|
20
|
+
ListFilter,
|
|
21
21
|
MoreHorizontal,
|
|
22
22
|
Plus,
|
|
23
23
|
RefreshCw,
|
|
@@ -32,8 +32,9 @@ import {
|
|
|
32
32
|
isValidElement,
|
|
33
33
|
useCallback,
|
|
34
34
|
useContext,
|
|
35
|
+
useId as useId2,
|
|
35
36
|
useLayoutEffect,
|
|
36
|
-
useMemo,
|
|
37
|
+
useMemo as useMemo2,
|
|
37
38
|
useRef,
|
|
38
39
|
useState
|
|
39
40
|
} from "react";
|
|
@@ -315,10 +316,196 @@ function Input({ className, type, ...props }) {
|
|
|
315
316
|
});
|
|
316
317
|
}
|
|
317
318
|
|
|
319
|
+
// ../../src/components/ui/field.tsx
|
|
320
|
+
import { useMemo } from "react";
|
|
321
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
322
|
+
|
|
323
|
+
// ../../src/components/ui/label.tsx
|
|
324
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
325
|
+
"use client";
|
|
326
|
+
function Label({ className, ...props }) {
|
|
327
|
+
return /* @__PURE__ */ jsx6("label", {
|
|
328
|
+
"data-slot": "label",
|
|
329
|
+
className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
330
|
+
...props
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// ../../src/components/ui/separator.tsx
|
|
335
|
+
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
336
|
+
|
|
337
|
+
// ../../src/components/ui/field.tsx
|
|
338
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
339
|
+
function FieldGroup({ className, ...props }) {
|
|
340
|
+
return /* @__PURE__ */ jsx7("div", {
|
|
341
|
+
"data-slot": "field-group",
|
|
342
|
+
className: cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4", className),
|
|
343
|
+
...props
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
var fieldVariants = cva3("group/field flex w-full gap-3 data-[invalid=true]:text-destructive", {
|
|
347
|
+
variants: {
|
|
348
|
+
orientation: {
|
|
349
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
350
|
+
horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
351
|
+
responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
defaultVariants: {
|
|
355
|
+
orientation: "vertical"
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
function Field({
|
|
359
|
+
className,
|
|
360
|
+
orientation = "vertical",
|
|
361
|
+
...props
|
|
362
|
+
}) {
|
|
363
|
+
return /* @__PURE__ */ jsx7("div", {
|
|
364
|
+
role: "group",
|
|
365
|
+
"data-slot": "field",
|
|
366
|
+
"data-orientation": orientation,
|
|
367
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
368
|
+
...props
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
function FieldLabel({
|
|
372
|
+
className,
|
|
373
|
+
...props
|
|
374
|
+
}) {
|
|
375
|
+
return /* @__PURE__ */ jsx7(Label, {
|
|
376
|
+
"data-slot": "field-label",
|
|
377
|
+
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className),
|
|
378
|
+
...props
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// ../../src/components/ui/select.tsx
|
|
383
|
+
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
384
|
+
import { ChevronDownIcon, CheckIcon as CheckIcon3, ChevronUpIcon } from "lucide-react";
|
|
385
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
386
|
+
"use client";
|
|
387
|
+
var Select = SelectPrimitive.Root;
|
|
388
|
+
function SelectGroup({ className, ...props }) {
|
|
389
|
+
return /* @__PURE__ */ jsx8(SelectPrimitive.Group, {
|
|
390
|
+
"data-slot": "select-group",
|
|
391
|
+
className: cn("scroll-my-1 p-1", className),
|
|
392
|
+
...props
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function SelectValue({ className, ...props }) {
|
|
396
|
+
return /* @__PURE__ */ jsx8(SelectPrimitive.Value, {
|
|
397
|
+
"data-slot": "select-value",
|
|
398
|
+
className: cn("flex flex-1 text-left", className),
|
|
399
|
+
...props
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
function SelectTrigger({
|
|
403
|
+
className,
|
|
404
|
+
size = "default",
|
|
405
|
+
children,
|
|
406
|
+
...props
|
|
407
|
+
}) {
|
|
408
|
+
return /* @__PURE__ */ jsxs3(SelectPrimitive.Trigger, {
|
|
409
|
+
"data-slot": "select-trigger",
|
|
410
|
+
"data-size": size,
|
|
411
|
+
className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
412
|
+
...props,
|
|
413
|
+
children: [
|
|
414
|
+
children,
|
|
415
|
+
/* @__PURE__ */ jsx8(SelectPrimitive.Icon, {
|
|
416
|
+
render: /* @__PURE__ */ jsx8(ChevronDownIcon, {
|
|
417
|
+
className: "text-muted-foreground pointer-events-none size-4"
|
|
418
|
+
})
|
|
419
|
+
})
|
|
420
|
+
]
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
function SelectContent({
|
|
424
|
+
className,
|
|
425
|
+
children,
|
|
426
|
+
side = "bottom",
|
|
427
|
+
sideOffset = 4,
|
|
428
|
+
align = "center",
|
|
429
|
+
alignOffset = 0,
|
|
430
|
+
alignItemWithTrigger = true,
|
|
431
|
+
...props
|
|
432
|
+
}) {
|
|
433
|
+
return /* @__PURE__ */ jsx8(SelectPrimitive.Portal, {
|
|
434
|
+
children: /* @__PURE__ */ jsx8(SelectPrimitive.Positioner, {
|
|
435
|
+
side,
|
|
436
|
+
sideOffset,
|
|
437
|
+
align,
|
|
438
|
+
alignOffset,
|
|
439
|
+
alignItemWithTrigger,
|
|
440
|
+
className: "isolate z-50",
|
|
441
|
+
children: /* @__PURE__ */ jsxs3(SelectPrimitive.Popup, {
|
|
442
|
+
"data-slot": "select-content",
|
|
443
|
+
"data-align-trigger": alignItemWithTrigger,
|
|
444
|
+
className: cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
445
|
+
...props,
|
|
446
|
+
children: [
|
|
447
|
+
/* @__PURE__ */ jsx8(SelectScrollUpButton, {}),
|
|
448
|
+
/* @__PURE__ */ jsx8(SelectPrimitive.List, {
|
|
449
|
+
children
|
|
450
|
+
}),
|
|
451
|
+
/* @__PURE__ */ jsx8(SelectScrollDownButton, {})
|
|
452
|
+
]
|
|
453
|
+
})
|
|
454
|
+
})
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
function SelectItem({
|
|
458
|
+
className,
|
|
459
|
+
children,
|
|
460
|
+
...props
|
|
461
|
+
}) {
|
|
462
|
+
return /* @__PURE__ */ jsxs3(SelectPrimitive.Item, {
|
|
463
|
+
"data-slot": "select-item",
|
|
464
|
+
className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
|
|
465
|
+
...props,
|
|
466
|
+
children: [
|
|
467
|
+
/* @__PURE__ */ jsx8(SelectPrimitive.ItemText, {
|
|
468
|
+
className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
|
|
469
|
+
children
|
|
470
|
+
}),
|
|
471
|
+
/* @__PURE__ */ jsx8(SelectPrimitive.ItemIndicator, {
|
|
472
|
+
render: /* @__PURE__ */ jsx8("span", {
|
|
473
|
+
className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center"
|
|
474
|
+
}),
|
|
475
|
+
children: /* @__PURE__ */ jsx8(CheckIcon3, {
|
|
476
|
+
className: "pointer-events-none"
|
|
477
|
+
})
|
|
478
|
+
})
|
|
479
|
+
]
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
function SelectScrollUpButton({
|
|
483
|
+
className,
|
|
484
|
+
...props
|
|
485
|
+
}) {
|
|
486
|
+
return /* @__PURE__ */ jsx8(SelectPrimitive.ScrollUpArrow, {
|
|
487
|
+
"data-slot": "select-scroll-up-button",
|
|
488
|
+
className: cn("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
489
|
+
...props,
|
|
490
|
+
children: /* @__PURE__ */ jsx8(ChevronUpIcon, {})
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
function SelectScrollDownButton({
|
|
494
|
+
className,
|
|
495
|
+
...props
|
|
496
|
+
}) {
|
|
497
|
+
return /* @__PURE__ */ jsx8(SelectPrimitive.ScrollDownArrow, {
|
|
498
|
+
"data-slot": "select-scroll-down-button",
|
|
499
|
+
className: cn("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
500
|
+
...props,
|
|
501
|
+
children: /* @__PURE__ */ jsx8(ChevronDownIcon, {})
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
|
|
318
505
|
// ../../src/components/ui/loading.tsx
|
|
319
506
|
import { Loader2 } from "lucide-react";
|
|
320
507
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
321
|
-
import { jsx as
|
|
508
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
322
509
|
var labels = {
|
|
323
510
|
en: {
|
|
324
511
|
loading: "Loading..."
|
|
@@ -336,10 +523,10 @@ function Loading({
|
|
|
336
523
|
variant = "inline"
|
|
337
524
|
}) {
|
|
338
525
|
const locale = useKrakstackLocale(localeOverride);
|
|
339
|
-
return /* @__PURE__ */
|
|
526
|
+
return /* @__PURE__ */ jsxs4("div", {
|
|
340
527
|
className: cn("text-muted-foreground flex items-center justify-center gap-2 text-sm", variant === "centered" && "min-h-[50svh] w-full", className),
|
|
341
528
|
children: [
|
|
342
|
-
/* @__PURE__ */
|
|
529
|
+
/* @__PURE__ */ jsx9(Loader2, {
|
|
343
530
|
className: "size-4 animate-spin"
|
|
344
531
|
}),
|
|
345
532
|
label ?? loadingLabel(locale, messages)
|
|
@@ -350,18 +537,18 @@ function Loading({
|
|
|
350
537
|
// ../../src/components/ui/menubar.tsx
|
|
351
538
|
import { Menu as MenuPrimitive2 } from "@base-ui/react/menu";
|
|
352
539
|
import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar";
|
|
353
|
-
import { CheckIcon as
|
|
354
|
-
import { jsx as
|
|
540
|
+
import { CheckIcon as CheckIcon4 } from "lucide-react";
|
|
541
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
355
542
|
"use client";
|
|
356
543
|
function Menubar({ className, ...props }) {
|
|
357
|
-
return /* @__PURE__ */
|
|
544
|
+
return /* @__PURE__ */ jsx10(MenubarPrimitive, {
|
|
358
545
|
"data-slot": "menubar",
|
|
359
546
|
className: cn("flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs", className),
|
|
360
547
|
...props
|
|
361
548
|
});
|
|
362
549
|
}
|
|
363
550
|
function MenubarMenu({ ...props }) {
|
|
364
|
-
return /* @__PURE__ */
|
|
551
|
+
return /* @__PURE__ */ jsx10(DropdownMenu, {
|
|
365
552
|
"data-slot": "menubar-menu",
|
|
366
553
|
...props
|
|
367
554
|
});
|
|
@@ -369,7 +556,7 @@ function MenubarMenu({ ...props }) {
|
|
|
369
556
|
function MenubarGroup({
|
|
370
557
|
...props
|
|
371
558
|
}) {
|
|
372
|
-
return /* @__PURE__ */
|
|
559
|
+
return /* @__PURE__ */ jsx10(DropdownMenuGroup, {
|
|
373
560
|
"data-slot": "menubar-group",
|
|
374
561
|
...props
|
|
375
562
|
});
|
|
@@ -378,7 +565,7 @@ function MenubarTrigger({
|
|
|
378
565
|
className,
|
|
379
566
|
...props
|
|
380
567
|
}) {
|
|
381
|
-
return /* @__PURE__ */
|
|
568
|
+
return /* @__PURE__ */ jsx10(DropdownMenuTrigger, {
|
|
382
569
|
"data-slot": "menubar-trigger",
|
|
383
570
|
className: cn("flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted", className),
|
|
384
571
|
...props
|
|
@@ -391,7 +578,7 @@ function MenubarContent({
|
|
|
391
578
|
sideOffset = 8,
|
|
392
579
|
...props
|
|
393
580
|
}) {
|
|
394
|
-
return /* @__PURE__ */
|
|
581
|
+
return /* @__PURE__ */ jsx10(DropdownMenuContent, {
|
|
395
582
|
"data-slot": "menubar-content",
|
|
396
583
|
align,
|
|
397
584
|
alignOffset,
|
|
@@ -406,7 +593,7 @@ function MenubarItem({
|
|
|
406
593
|
variant = "default",
|
|
407
594
|
...props
|
|
408
595
|
}) {
|
|
409
|
-
return /* @__PURE__ */
|
|
596
|
+
return /* @__PURE__ */ jsx10(DropdownMenuItem, {
|
|
410
597
|
"data-slot": "menubar-item",
|
|
411
598
|
"data-inset": inset,
|
|
412
599
|
"data-variant": variant,
|
|
@@ -421,17 +608,17 @@ function MenubarCheckboxItem({
|
|
|
421
608
|
inset,
|
|
422
609
|
...props
|
|
423
610
|
}) {
|
|
424
|
-
return /* @__PURE__ */
|
|
611
|
+
return /* @__PURE__ */ jsxs5(MenuPrimitive2.CheckboxItem, {
|
|
425
612
|
"data-slot": "menubar-checkbox-item",
|
|
426
613
|
"data-inset": inset,
|
|
427
614
|
className: cn("relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
428
615
|
checked,
|
|
429
616
|
...props,
|
|
430
617
|
children: [
|
|
431
|
-
/* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ jsx10("span", {
|
|
432
619
|
className: "pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
|
|
433
|
-
children: /* @__PURE__ */
|
|
434
|
-
children: /* @__PURE__ */
|
|
620
|
+
children: /* @__PURE__ */ jsx10(MenuPrimitive2.CheckboxItemIndicator, {
|
|
621
|
+
children: /* @__PURE__ */ jsx10(CheckIcon4, {})
|
|
435
622
|
})
|
|
436
623
|
}),
|
|
437
624
|
children
|
|
@@ -441,7 +628,7 @@ function MenubarCheckboxItem({
|
|
|
441
628
|
function MenubarRadioGroup({
|
|
442
629
|
...props
|
|
443
630
|
}) {
|
|
444
|
-
return /* @__PURE__ */
|
|
631
|
+
return /* @__PURE__ */ jsx10(DropdownMenuRadioGroup, {
|
|
445
632
|
"data-slot": "menubar-radio-group",
|
|
446
633
|
...props
|
|
447
634
|
});
|
|
@@ -452,16 +639,16 @@ function MenubarRadioItem({
|
|
|
452
639
|
inset,
|
|
453
640
|
...props
|
|
454
641
|
}) {
|
|
455
|
-
return /* @__PURE__ */
|
|
642
|
+
return /* @__PURE__ */ jsxs5(MenuPrimitive2.RadioItem, {
|
|
456
643
|
"data-slot": "menubar-radio-item",
|
|
457
644
|
"data-inset": inset,
|
|
458
645
|
className: cn("relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
459
646
|
...props,
|
|
460
647
|
children: [
|
|
461
|
-
/* @__PURE__ */
|
|
648
|
+
/* @__PURE__ */ jsx10("span", {
|
|
462
649
|
className: "pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
|
|
463
|
-
children: /* @__PURE__ */
|
|
464
|
-
children: /* @__PURE__ */
|
|
650
|
+
children: /* @__PURE__ */ jsx10(MenuPrimitive2.RadioItemIndicator, {
|
|
651
|
+
children: /* @__PURE__ */ jsx10(CheckIcon4, {})
|
|
465
652
|
})
|
|
466
653
|
}),
|
|
467
654
|
children
|
|
@@ -473,7 +660,7 @@ function MenubarLabel({
|
|
|
473
660
|
inset,
|
|
474
661
|
...props
|
|
475
662
|
}) {
|
|
476
|
-
return /* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ jsx10(DropdownMenuLabel, {
|
|
477
664
|
"data-slot": "menubar-label",
|
|
478
665
|
"data-inset": inset,
|
|
479
666
|
className: cn("px-2 py-1.5 text-sm font-medium data-inset:pl-8", className),
|
|
@@ -484,7 +671,7 @@ function MenubarSeparator({
|
|
|
484
671
|
className,
|
|
485
672
|
...props
|
|
486
673
|
}) {
|
|
487
|
-
return /* @__PURE__ */
|
|
674
|
+
return /* @__PURE__ */ jsx10(DropdownMenuSeparator, {
|
|
488
675
|
"data-slot": "menubar-separator",
|
|
489
676
|
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
490
677
|
...props
|
|
@@ -493,7 +680,7 @@ function MenubarSeparator({
|
|
|
493
680
|
function MenubarSub({
|
|
494
681
|
...props
|
|
495
682
|
}) {
|
|
496
|
-
return /* @__PURE__ */
|
|
683
|
+
return /* @__PURE__ */ jsx10(DropdownMenuSub, {
|
|
497
684
|
"data-slot": "menubar-sub",
|
|
498
685
|
...props
|
|
499
686
|
});
|
|
@@ -503,7 +690,7 @@ function MenubarSubTrigger({
|
|
|
503
690
|
inset,
|
|
504
691
|
...props
|
|
505
692
|
}) {
|
|
506
|
-
return /* @__PURE__ */
|
|
693
|
+
return /* @__PURE__ */ jsx10(DropdownMenuSubTrigger, {
|
|
507
694
|
"data-slot": "menubar-sub-trigger",
|
|
508
695
|
"data-inset": inset,
|
|
509
696
|
className: cn("gap-2 rounded-sm px-2 py-1.5 text-sm focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4", className),
|
|
@@ -514,7 +701,7 @@ function MenubarSubContent({
|
|
|
514
701
|
className,
|
|
515
702
|
...props
|
|
516
703
|
}) {
|
|
517
|
-
return /* @__PURE__ */
|
|
704
|
+
return /* @__PURE__ */ jsx10(DropdownMenuSubContent, {
|
|
518
705
|
"data-slot": "menubar-sub-content",
|
|
519
706
|
className: cn("min-w-32 rounded-md bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
520
707
|
...props
|
|
@@ -529,137 +716,8 @@ import {
|
|
|
529
716
|
ChevronsRight
|
|
530
717
|
} from "lucide-react";
|
|
531
718
|
import { useId } from "react";
|
|
532
|
-
|
|
533
|
-
// ../../src/components/ui/label.tsx
|
|
534
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
535
|
-
"use client";
|
|
536
|
-
function Label({ className, ...props }) {
|
|
537
|
-
return /* @__PURE__ */ jsx8("label", {
|
|
538
|
-
"data-slot": "label",
|
|
539
|
-
className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
540
|
-
...props
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
// ../../src/components/ui/select.tsx
|
|
545
|
-
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
546
|
-
import { ChevronDownIcon, CheckIcon as CheckIcon4, ChevronUpIcon } from "lucide-react";
|
|
547
|
-
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
548
|
-
"use client";
|
|
549
|
-
var Select = SelectPrimitive.Root;
|
|
550
|
-
function SelectValue({ className, ...props }) {
|
|
551
|
-
return /* @__PURE__ */ jsx9(SelectPrimitive.Value, {
|
|
552
|
-
"data-slot": "select-value",
|
|
553
|
-
className: cn("flex flex-1 text-left", className),
|
|
554
|
-
...props
|
|
555
|
-
});
|
|
556
|
-
}
|
|
557
|
-
function SelectTrigger({
|
|
558
|
-
className,
|
|
559
|
-
size = "default",
|
|
560
|
-
children,
|
|
561
|
-
...props
|
|
562
|
-
}) {
|
|
563
|
-
return /* @__PURE__ */ jsxs4(SelectPrimitive.Trigger, {
|
|
564
|
-
"data-slot": "select-trigger",
|
|
565
|
-
"data-size": size,
|
|
566
|
-
className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
567
|
-
...props,
|
|
568
|
-
children: [
|
|
569
|
-
children,
|
|
570
|
-
/* @__PURE__ */ jsx9(SelectPrimitive.Icon, {
|
|
571
|
-
render: /* @__PURE__ */ jsx9(ChevronDownIcon, {
|
|
572
|
-
className: "text-muted-foreground pointer-events-none size-4"
|
|
573
|
-
})
|
|
574
|
-
})
|
|
575
|
-
]
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
function SelectContent({
|
|
579
|
-
className,
|
|
580
|
-
children,
|
|
581
|
-
side = "bottom",
|
|
582
|
-
sideOffset = 4,
|
|
583
|
-
align = "center",
|
|
584
|
-
alignOffset = 0,
|
|
585
|
-
alignItemWithTrigger = true,
|
|
586
|
-
...props
|
|
587
|
-
}) {
|
|
588
|
-
return /* @__PURE__ */ jsx9(SelectPrimitive.Portal, {
|
|
589
|
-
children: /* @__PURE__ */ jsx9(SelectPrimitive.Positioner, {
|
|
590
|
-
side,
|
|
591
|
-
sideOffset,
|
|
592
|
-
align,
|
|
593
|
-
alignOffset,
|
|
594
|
-
alignItemWithTrigger,
|
|
595
|
-
className: "isolate z-50",
|
|
596
|
-
children: /* @__PURE__ */ jsxs4(SelectPrimitive.Popup, {
|
|
597
|
-
"data-slot": "select-content",
|
|
598
|
-
"data-align-trigger": alignItemWithTrigger,
|
|
599
|
-
className: cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
600
|
-
...props,
|
|
601
|
-
children: [
|
|
602
|
-
/* @__PURE__ */ jsx9(SelectScrollUpButton, {}),
|
|
603
|
-
/* @__PURE__ */ jsx9(SelectPrimitive.List, {
|
|
604
|
-
children
|
|
605
|
-
}),
|
|
606
|
-
/* @__PURE__ */ jsx9(SelectScrollDownButton, {})
|
|
607
|
-
]
|
|
608
|
-
})
|
|
609
|
-
})
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
function SelectItem({
|
|
613
|
-
className,
|
|
614
|
-
children,
|
|
615
|
-
...props
|
|
616
|
-
}) {
|
|
617
|
-
return /* @__PURE__ */ jsxs4(SelectPrimitive.Item, {
|
|
618
|
-
"data-slot": "select-item",
|
|
619
|
-
className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
|
|
620
|
-
...props,
|
|
621
|
-
children: [
|
|
622
|
-
/* @__PURE__ */ jsx9(SelectPrimitive.ItemText, {
|
|
623
|
-
className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
|
|
624
|
-
children
|
|
625
|
-
}),
|
|
626
|
-
/* @__PURE__ */ jsx9(SelectPrimitive.ItemIndicator, {
|
|
627
|
-
render: /* @__PURE__ */ jsx9("span", {
|
|
628
|
-
className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center"
|
|
629
|
-
}),
|
|
630
|
-
children: /* @__PURE__ */ jsx9(CheckIcon4, {
|
|
631
|
-
className: "pointer-events-none"
|
|
632
|
-
})
|
|
633
|
-
})
|
|
634
|
-
]
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
function SelectScrollUpButton({
|
|
638
|
-
className,
|
|
639
|
-
...props
|
|
640
|
-
}) {
|
|
641
|
-
return /* @__PURE__ */ jsx9(SelectPrimitive.ScrollUpArrow, {
|
|
642
|
-
"data-slot": "select-scroll-up-button",
|
|
643
|
-
className: cn("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
644
|
-
...props,
|
|
645
|
-
children: /* @__PURE__ */ jsx9(ChevronUpIcon, {})
|
|
646
|
-
});
|
|
647
|
-
}
|
|
648
|
-
function SelectScrollDownButton({
|
|
649
|
-
className,
|
|
650
|
-
...props
|
|
651
|
-
}) {
|
|
652
|
-
return /* @__PURE__ */ jsx9(SelectPrimitive.ScrollDownArrow, {
|
|
653
|
-
"data-slot": "select-scroll-down-button",
|
|
654
|
-
className: cn("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
655
|
-
...props,
|
|
656
|
-
children: /* @__PURE__ */ jsx9(ChevronDownIcon, {})
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
// ../../src/components/ui/pagination.tsx
|
|
661
719
|
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
|
|
662
|
-
import { jsx as
|
|
720
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
663
721
|
var messages = {
|
|
664
722
|
en: {
|
|
665
723
|
pageSize: "Page size",
|
|
@@ -706,32 +764,32 @@ function Pagination({
|
|
|
706
764
|
const pageSizeId = useId();
|
|
707
765
|
const canGoBack = page > 0;
|
|
708
766
|
const canGoForward = page + 1 < pageCount;
|
|
709
|
-
return /* @__PURE__ */
|
|
767
|
+
return /* @__PURE__ */ jsxs6("div", {
|
|
710
768
|
className: cn("flex flex-col gap-3 px-2 sm:flex-row sm:items-center sm:justify-between", compact && "gap-2 px-0 sm:flex-col sm:items-stretch"),
|
|
711
769
|
children: [
|
|
712
|
-
showResults ? /* @__PURE__ */
|
|
770
|
+
showResults ? /* @__PURE__ */ jsxs6("div", {
|
|
713
771
|
className: "text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",
|
|
714
772
|
children: [
|
|
715
|
-
/* @__PURE__ */
|
|
773
|
+
/* @__PURE__ */ jsx11("span", {
|
|
716
774
|
children: labels.results(totalRows)
|
|
717
775
|
}),
|
|
718
|
-
selectedRows > 0 ? /* @__PURE__ */
|
|
776
|
+
selectedRows > 0 ? /* @__PURE__ */ jsx11("span", {
|
|
719
777
|
children: labels.selectedOf(selectedRows, totalRows)
|
|
720
778
|
}) : null
|
|
721
779
|
]
|
|
722
780
|
}) : null,
|
|
723
|
-
/* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
724
782
|
className: cn("flex items-center gap-4 sm:justify-end", compact && "flex-wrap justify-between gap-2 sm:justify-between"),
|
|
725
783
|
children: [
|
|
726
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
727
785
|
className: "flex items-center gap-2",
|
|
728
786
|
children: [
|
|
729
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ jsx11(Label, {
|
|
730
788
|
htmlFor: pageSizeId,
|
|
731
789
|
className: cn("hidden text-sm sm:block", compact && "block"),
|
|
732
790
|
children: labels.pageSize
|
|
733
791
|
}),
|
|
734
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ jsxs6(Select, {
|
|
735
793
|
items: pageSizes.map((size) => ({
|
|
736
794
|
label: size.toString(),
|
|
737
795
|
value: size.toString()
|
|
@@ -739,16 +797,16 @@ function Pagination({
|
|
|
739
797
|
value: `${pageSize}`,
|
|
740
798
|
onValueChange: (value) => onPageSizeChange(Number(value)),
|
|
741
799
|
children: [
|
|
742
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ jsx11(SelectTrigger, {
|
|
743
801
|
className: "h-8 w-[70px]",
|
|
744
802
|
id: pageSizeId,
|
|
745
|
-
children: /* @__PURE__ */
|
|
803
|
+
children: /* @__PURE__ */ jsx11(SelectValue, {
|
|
746
804
|
placeholder: pageSize
|
|
747
805
|
})
|
|
748
806
|
}),
|
|
749
|
-
/* @__PURE__ */
|
|
807
|
+
/* @__PURE__ */ jsx11(SelectContent, {
|
|
750
808
|
side: "top",
|
|
751
|
-
children: pageSizes.map((size) => /* @__PURE__ */
|
|
809
|
+
children: pageSizes.map((size) => /* @__PURE__ */ jsx11(SelectItem, {
|
|
752
810
|
value: `${size}`,
|
|
753
811
|
children: size
|
|
754
812
|
}, size))
|
|
@@ -757,66 +815,66 @@ function Pagination({
|
|
|
757
815
|
})
|
|
758
816
|
]
|
|
759
817
|
}),
|
|
760
|
-
/* @__PURE__ */
|
|
818
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
761
819
|
className: "flex items-center gap-2",
|
|
762
820
|
children: [
|
|
763
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ jsx11("div", {
|
|
764
822
|
className: "flex items-center justify-center text-sm font-medium sm:block",
|
|
765
823
|
children: labels.pageOf(page + 1, pageCount)
|
|
766
824
|
}),
|
|
767
|
-
/* @__PURE__ */
|
|
825
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
768
826
|
className: "flex items-center gap-1",
|
|
769
827
|
children: [
|
|
770
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ jsxs6(Button, {
|
|
771
829
|
className: cn("hidden h-8 w-8 p-0 lg:flex", compact && "!hidden"),
|
|
772
830
|
disabled: !canGoBack,
|
|
773
831
|
onClick: () => onPageChange(0),
|
|
774
832
|
type: "button",
|
|
775
833
|
children: [
|
|
776
|
-
/* @__PURE__ */
|
|
834
|
+
/* @__PURE__ */ jsx11("span", {
|
|
777
835
|
className: "sr-only",
|
|
778
836
|
children: labels.goToFirstPage
|
|
779
837
|
}),
|
|
780
|
-
/* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ jsx11(ChevronsLeft, {})
|
|
781
839
|
]
|
|
782
840
|
}),
|
|
783
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ jsxs6(Button, {
|
|
784
842
|
className: "h-8 w-8 p-0",
|
|
785
843
|
disabled: !canGoBack,
|
|
786
844
|
onClick: () => onPageChange(page - 1),
|
|
787
845
|
type: "button",
|
|
788
846
|
children: [
|
|
789
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ jsx11("span", {
|
|
790
848
|
className: "sr-only",
|
|
791
849
|
children: labels.goToPreviousPage
|
|
792
850
|
}),
|
|
793
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ jsx11(ChevronLeft, {})
|
|
794
852
|
]
|
|
795
853
|
}),
|
|
796
|
-
/* @__PURE__ */
|
|
854
|
+
/* @__PURE__ */ jsxs6(Button, {
|
|
797
855
|
className: "h-8 w-8 p-0",
|
|
798
856
|
disabled: !canGoForward,
|
|
799
857
|
onClick: () => onPageChange(page + 1),
|
|
800
858
|
type: "button",
|
|
801
859
|
children: [
|
|
802
|
-
/* @__PURE__ */
|
|
860
|
+
/* @__PURE__ */ jsx11("span", {
|
|
803
861
|
className: "sr-only",
|
|
804
862
|
children: labels.goToNextPage
|
|
805
863
|
}),
|
|
806
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ jsx11(ChevronRight, {})
|
|
807
865
|
]
|
|
808
866
|
}),
|
|
809
|
-
/* @__PURE__ */
|
|
867
|
+
/* @__PURE__ */ jsxs6(Button, {
|
|
810
868
|
className: cn("hidden h-8 w-8 p-0 lg:flex", compact && "!hidden"),
|
|
811
869
|
disabled: !canGoForward,
|
|
812
870
|
onClick: () => onPageChange(pageCount - 1),
|
|
813
871
|
type: "button",
|
|
814
872
|
children: [
|
|
815
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ jsx11("span", {
|
|
816
874
|
className: "sr-only",
|
|
817
875
|
children: labels.goToLastPage
|
|
818
876
|
}),
|
|
819
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ jsx11(ChevronsRight, {})
|
|
820
878
|
]
|
|
821
879
|
})
|
|
822
880
|
]
|
|
@@ -831,24 +889,24 @@ function Pagination({
|
|
|
831
889
|
|
|
832
890
|
// ../../src/components/ui/scroll-area.tsx
|
|
833
891
|
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
|
|
834
|
-
import { jsx as
|
|
892
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
835
893
|
function ScrollArea({
|
|
836
894
|
className,
|
|
837
895
|
children,
|
|
838
896
|
...props
|
|
839
897
|
}) {
|
|
840
|
-
return /* @__PURE__ */
|
|
898
|
+
return /* @__PURE__ */ jsxs7(ScrollAreaPrimitive.Root, {
|
|
841
899
|
"data-slot": "scroll-area",
|
|
842
900
|
className: cn("relative", className),
|
|
843
901
|
...props,
|
|
844
902
|
children: [
|
|
845
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__PURE__ */ jsx12(ScrollAreaPrimitive.Viewport, {
|
|
846
904
|
"data-slot": "scroll-area-viewport",
|
|
847
905
|
className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",
|
|
848
906
|
children
|
|
849
907
|
}),
|
|
850
|
-
/* @__PURE__ */
|
|
851
|
-
/* @__PURE__ */
|
|
908
|
+
/* @__PURE__ */ jsx12(ScrollBar, {}),
|
|
909
|
+
/* @__PURE__ */ jsx12(ScrollAreaPrimitive.Corner, {})
|
|
852
910
|
]
|
|
853
911
|
});
|
|
854
912
|
}
|
|
@@ -857,13 +915,13 @@ function ScrollBar({
|
|
|
857
915
|
orientation = "vertical",
|
|
858
916
|
...props
|
|
859
917
|
}) {
|
|
860
|
-
return /* @__PURE__ */
|
|
918
|
+
return /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Scrollbar, {
|
|
861
919
|
"data-slot": "scroll-area-scrollbar",
|
|
862
920
|
"data-orientation": orientation,
|
|
863
921
|
orientation,
|
|
864
922
|
className: cn("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent", className),
|
|
865
923
|
...props,
|
|
866
|
-
children: /* @__PURE__ */
|
|
924
|
+
children: /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Thumb, {
|
|
867
925
|
"data-slot": "scroll-area-thumb",
|
|
868
926
|
className: "bg-border relative flex-1 rounded-full"
|
|
869
927
|
})
|
|
@@ -871,12 +929,12 @@ function ScrollBar({
|
|
|
871
929
|
}
|
|
872
930
|
|
|
873
931
|
// ../../src/components/ui/table.tsx
|
|
874
|
-
import { jsx as
|
|
932
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
875
933
|
function Table({ className, ...props }) {
|
|
876
|
-
return /* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ jsx13("div", {
|
|
877
935
|
"data-slot": "table-container",
|
|
878
936
|
className: "relative w-full overflow-x-auto",
|
|
879
|
-
children: /* @__PURE__ */
|
|
937
|
+
children: /* @__PURE__ */ jsx13("table", {
|
|
880
938
|
"data-slot": "table",
|
|
881
939
|
className: cn("w-full caption-bottom text-sm", className),
|
|
882
940
|
...props
|
|
@@ -884,35 +942,35 @@ function Table({ className, ...props }) {
|
|
|
884
942
|
});
|
|
885
943
|
}
|
|
886
944
|
function TableHeader({ className, ...props }) {
|
|
887
|
-
return /* @__PURE__ */
|
|
945
|
+
return /* @__PURE__ */ jsx13("thead", {
|
|
888
946
|
"data-slot": "table-header",
|
|
889
947
|
className: cn("[&_tr]:border-b", className),
|
|
890
948
|
...props
|
|
891
949
|
});
|
|
892
950
|
}
|
|
893
951
|
function TableBody({ className, ...props }) {
|
|
894
|
-
return /* @__PURE__ */
|
|
952
|
+
return /* @__PURE__ */ jsx13("tbody", {
|
|
895
953
|
"data-slot": "table-body",
|
|
896
954
|
className: cn("[&_tr:last-child]:border-0", className),
|
|
897
955
|
...props
|
|
898
956
|
});
|
|
899
957
|
}
|
|
900
958
|
function TableRow({ className, ...props }) {
|
|
901
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ jsx13("tr", {
|
|
902
960
|
"data-slot": "table-row",
|
|
903
961
|
className: cn("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
904
962
|
...props
|
|
905
963
|
});
|
|
906
964
|
}
|
|
907
965
|
function TableHead({ className, ...props }) {
|
|
908
|
-
return /* @__PURE__ */
|
|
966
|
+
return /* @__PURE__ */ jsx13("th", {
|
|
909
967
|
"data-slot": "table-head",
|
|
910
968
|
className: cn("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0", className),
|
|
911
969
|
...props
|
|
912
970
|
});
|
|
913
971
|
}
|
|
914
972
|
function TableCell({ className, ...props }) {
|
|
915
|
-
return /* @__PURE__ */
|
|
973
|
+
return /* @__PURE__ */ jsx13("td", {
|
|
916
974
|
"data-slot": "table-cell",
|
|
917
975
|
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0", className),
|
|
918
976
|
...props
|
|
@@ -921,26 +979,26 @@ function TableCell({ className, ...props }) {
|
|
|
921
979
|
|
|
922
980
|
// ../../src/components/ui/tooltip.tsx
|
|
923
981
|
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
924
|
-
import { jsx as
|
|
982
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
925
983
|
"use client";
|
|
926
984
|
function TooltipProvider({
|
|
927
985
|
delay = 0,
|
|
928
986
|
...props
|
|
929
987
|
}) {
|
|
930
|
-
return /* @__PURE__ */
|
|
988
|
+
return /* @__PURE__ */ jsx14(TooltipPrimitive.Provider, {
|
|
931
989
|
"data-slot": "tooltip-provider",
|
|
932
990
|
delay,
|
|
933
991
|
...props
|
|
934
992
|
});
|
|
935
993
|
}
|
|
936
994
|
function Tooltip({ ...props }) {
|
|
937
|
-
return /* @__PURE__ */
|
|
995
|
+
return /* @__PURE__ */ jsx14(TooltipPrimitive.Root, {
|
|
938
996
|
"data-slot": "tooltip",
|
|
939
997
|
...props
|
|
940
998
|
});
|
|
941
999
|
}
|
|
942
1000
|
function TooltipTrigger({ ...props }) {
|
|
943
|
-
return /* @__PURE__ */
|
|
1001
|
+
return /* @__PURE__ */ jsx14(TooltipPrimitive.Trigger, {
|
|
944
1002
|
"data-slot": "tooltip-trigger",
|
|
945
1003
|
...props
|
|
946
1004
|
});
|
|
@@ -954,20 +1012,20 @@ function TooltipContent({
|
|
|
954
1012
|
children,
|
|
955
1013
|
...props
|
|
956
1014
|
}) {
|
|
957
|
-
return /* @__PURE__ */
|
|
958
|
-
children: /* @__PURE__ */
|
|
1015
|
+
return /* @__PURE__ */ jsx14(TooltipPrimitive.Portal, {
|
|
1016
|
+
children: /* @__PURE__ */ jsx14(TooltipPrimitive.Positioner, {
|
|
959
1017
|
align,
|
|
960
1018
|
alignOffset,
|
|
961
1019
|
side,
|
|
962
1020
|
sideOffset,
|
|
963
1021
|
className: "isolate z-50",
|
|
964
|
-
children: /* @__PURE__ */
|
|
1022
|
+
children: /* @__PURE__ */ jsxs8(TooltipPrimitive.Popup, {
|
|
965
1023
|
"data-slot": "tooltip-content",
|
|
966
1024
|
className: cn("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
967
1025
|
...props,
|
|
968
1026
|
children: [
|
|
969
1027
|
children,
|
|
970
|
-
/* @__PURE__ */
|
|
1028
|
+
/* @__PURE__ */ jsx14(TooltipPrimitive.Arrow, {
|
|
971
1029
|
className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"
|
|
972
1030
|
})
|
|
973
1031
|
]
|
|
@@ -976,14 +1034,181 @@ function TooltipContent({
|
|
|
976
1034
|
});
|
|
977
1035
|
}
|
|
978
1036
|
|
|
1037
|
+
// ../../src/lib/query.ts
|
|
1038
|
+
import {
|
|
1039
|
+
DateTime,
|
|
1040
|
+
Effect,
|
|
1041
|
+
Option,
|
|
1042
|
+
Schema,
|
|
1043
|
+
SchemaGetter,
|
|
1044
|
+
SchemaIssue,
|
|
1045
|
+
SchemaTransformation
|
|
1046
|
+
} from "effect";
|
|
1047
|
+
var parseSortParam = (sort) => {
|
|
1048
|
+
const id = sort.startsWith("-") ? sort.slice(1) : sort;
|
|
1049
|
+
if (!id || id.includes(",") || id.includes(":")) {
|
|
1050
|
+
return null;
|
|
1051
|
+
}
|
|
1052
|
+
return { id, direction: sort.startsWith("-") ? "desc" : "asc" };
|
|
1053
|
+
};
|
|
1054
|
+
var SortDirection = Schema.Union([
|
|
1055
|
+
Schema.Literal("asc"),
|
|
1056
|
+
Schema.Literal("desc")
|
|
1057
|
+
]).pipe(Schema.annotate({
|
|
1058
|
+
identifier: "SortDirection",
|
|
1059
|
+
title: "Sort Direction",
|
|
1060
|
+
description: "Sort direction for list query results.",
|
|
1061
|
+
examples: ["asc", "desc"]
|
|
1062
|
+
}));
|
|
1063
|
+
var SortParam = Schema.Struct({
|
|
1064
|
+
id: Schema.NonEmptyString,
|
|
1065
|
+
direction: SortDirection
|
|
1066
|
+
}).pipe(Schema.annotate({
|
|
1067
|
+
identifier: "SortParam",
|
|
1068
|
+
title: "Sort Parameter",
|
|
1069
|
+
description: "Decoded sort parameter with a field id and direction.",
|
|
1070
|
+
examples: [{ id: "publicName", direction: "asc" }]
|
|
1071
|
+
}));
|
|
1072
|
+
var SortParamFromString = Schema.String.pipe(Schema.decodeTo(SortParam, SchemaTransformation.transformEffect({
|
|
1073
|
+
decode: (sort) => {
|
|
1074
|
+
const sortParam = parseSortParam(sort);
|
|
1075
|
+
if (!sortParam) {
|
|
1076
|
+
return Effect.fail(new SchemaIssue.InvalidValue({ message: 'Expected sort in the format "field" or "-field"' }, sort));
|
|
1077
|
+
}
|
|
1078
|
+
return Effect.succeed(sortParam);
|
|
1079
|
+
},
|
|
1080
|
+
encode: (sort) => Effect.succeed(sort.direction === "desc" ? `-${sort.id}` : sort.id)
|
|
1081
|
+
})), Schema.annotate({
|
|
1082
|
+
identifier: "SortParamFromString",
|
|
1083
|
+
title: "Sort Parameter From String",
|
|
1084
|
+
description: 'URL encoded single sort parameter where descending fields are prefixed with "-".',
|
|
1085
|
+
examples: [{ id: "publicName", direction: "asc" }]
|
|
1086
|
+
}));
|
|
1087
|
+
var SortParamsFromString = Schema.String.pipe(Schema.decodeTo(Schema.Array(SortParam), SchemaTransformation.transformEffect({
|
|
1088
|
+
decode: (sort) => {
|
|
1089
|
+
if (sort === "")
|
|
1090
|
+
return Effect.succeed([]);
|
|
1091
|
+
const parts = sort.split(",");
|
|
1092
|
+
const sortParams = [];
|
|
1093
|
+
for (const part of parts) {
|
|
1094
|
+
const sortParam = parseSortParam(part);
|
|
1095
|
+
if (!sortParam) {
|
|
1096
|
+
return Effect.fail(new SchemaIssue.InvalidValue({ message: 'Expected sort in the format "field,-otherField"' }, sort));
|
|
1097
|
+
}
|
|
1098
|
+
sortParams.push(sortParam);
|
|
1099
|
+
}
|
|
1100
|
+
return Effect.succeed(sortParams);
|
|
1101
|
+
},
|
|
1102
|
+
encode: (sort) => Effect.succeed(sort.map((part) => Schema.encodeSync(SortParamFromString)(part)).join(","))
|
|
1103
|
+
})), Schema.annotate({
|
|
1104
|
+
identifier: "SortParamsFromString",
|
|
1105
|
+
title: "Sort Parameters From String",
|
|
1106
|
+
description: 'URL encoded sort parameters where descending fields are prefixed with "-" and multiple fields are comma-separated.',
|
|
1107
|
+
examples: [
|
|
1108
|
+
[
|
|
1109
|
+
{ id: "name", direction: "desc" },
|
|
1110
|
+
{ id: "age", direction: "asc" }
|
|
1111
|
+
]
|
|
1112
|
+
]
|
|
1113
|
+
}));
|
|
1114
|
+
var SortParamsArray = Schema.Array(SortParam);
|
|
1115
|
+
var SortParams = Schema.declare(Schema.is(SortParamsArray), {
|
|
1116
|
+
identifier: "SortParams",
|
|
1117
|
+
toCodec: () => Schema.link()(SortParamsArray, SchemaTransformation.passthrough()),
|
|
1118
|
+
toCodecStringTree: () => Schema.link()(SortParamsFromString, SchemaTransformation.passthrough())
|
|
1119
|
+
});
|
|
1120
|
+
var TextFilterOperator = Schema.Literals([
|
|
1121
|
+
"contains",
|
|
1122
|
+
"equals",
|
|
1123
|
+
"startsWith",
|
|
1124
|
+
"endsWith"
|
|
1125
|
+
]).annotate({ identifier: "TextFilterOperator" });
|
|
1126
|
+
var FilterCalendarDate = Schema.String.check(Schema.isPattern(/^\d{4}-\d{2}-\d{2}$/), Schema.makeFilter((value) => Option.exists(DateTime.make(value), (date) => DateTime.formatIsoDateUtc(date) === value))).annotate({ identifier: "FilterCalendarDate" });
|
|
1127
|
+
var ColumnFilter = Schema.Union([
|
|
1128
|
+
Schema.Struct({
|
|
1129
|
+
id: Schema.NonEmptyString,
|
|
1130
|
+
kind: Schema.Literal("text"),
|
|
1131
|
+
operator: TextFilterOperator,
|
|
1132
|
+
value: Schema.NonEmptyString
|
|
1133
|
+
}),
|
|
1134
|
+
Schema.Struct({
|
|
1135
|
+
id: Schema.NonEmptyString,
|
|
1136
|
+
kind: Schema.Literal("number"),
|
|
1137
|
+
min: Schema.optional(Schema.Finite),
|
|
1138
|
+
max: Schema.optional(Schema.Finite)
|
|
1139
|
+
}).check(Schema.makeFilter((range) => (range.min !== undefined || range.max !== undefined) && (range.min === undefined || range.max === undefined || range.min <= range.max))),
|
|
1140
|
+
Schema.Struct({
|
|
1141
|
+
id: Schema.NonEmptyString,
|
|
1142
|
+
kind: Schema.Literal("date"),
|
|
1143
|
+
from: Schema.optional(FilterCalendarDate),
|
|
1144
|
+
to: Schema.optional(FilterCalendarDate)
|
|
1145
|
+
}).check(Schema.makeFilter((range) => (range.from !== undefined || range.to !== undefined) && (range.from === undefined || range.to === undefined || range.from <= range.to))),
|
|
1146
|
+
Schema.Struct({
|
|
1147
|
+
id: Schema.NonEmptyString,
|
|
1148
|
+
kind: Schema.Literal("boolean"),
|
|
1149
|
+
value: Schema.Boolean
|
|
1150
|
+
}),
|
|
1151
|
+
Schema.Struct({
|
|
1152
|
+
id: Schema.NonEmptyString,
|
|
1153
|
+
kind: Schema.Literal("values"),
|
|
1154
|
+
values: Schema.NonEmptyArray(Schema.String)
|
|
1155
|
+
})
|
|
1156
|
+
]).annotate({ identifier: "ColumnFilter" });
|
|
1157
|
+
var ColumnFiltersArray = Schema.Array(ColumnFilter);
|
|
1158
|
+
var ColumnFilters = Schema.declare(Schema.is(ColumnFiltersArray), {
|
|
1159
|
+
identifier: "ColumnFilters",
|
|
1160
|
+
toCodec: () => Schema.link()(ColumnFiltersArray, SchemaTransformation.passthrough()),
|
|
1161
|
+
toCodecStringTree: () => Schema.link()(Schema.fromJsonString(ColumnFiltersArray), SchemaTransformation.passthrough())
|
|
1162
|
+
});
|
|
1163
|
+
var Query = Schema.Struct({
|
|
1164
|
+
page: Schema.optional(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), {
|
|
1165
|
+
decode: SchemaGetter.withDefault(Effect.succeed(0)),
|
|
1166
|
+
encode: SchemaGetter.transformOptional(Option.filter((page) => page !== 0))
|
|
1167
|
+
})),
|
|
1168
|
+
pageSize: Schema.optional(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isBetween({ minimum: 1, maximum: 100 }))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })), {
|
|
1169
|
+
decode: SchemaGetter.withDefault(Effect.succeed(20)),
|
|
1170
|
+
encode: SchemaGetter.transformOptional(Option.filter((pageSize) => pageSize !== 20))
|
|
1171
|
+
})),
|
|
1172
|
+
globalFilter: Schema.optional(Schema.String),
|
|
1173
|
+
sort: Schema.optional(SortParams),
|
|
1174
|
+
filters: Schema.optional(ColumnFilters)
|
|
1175
|
+
}).annotate({
|
|
1176
|
+
identifier: "Query",
|
|
1177
|
+
title: "Query",
|
|
1178
|
+
description: "Zero-based page request parameters with optional filtering and sorting for list endpoints.",
|
|
1179
|
+
examples: [
|
|
1180
|
+
{
|
|
1181
|
+
page: 0,
|
|
1182
|
+
pageSize: 20,
|
|
1183
|
+
globalFilter: "housing",
|
|
1184
|
+
sort: [
|
|
1185
|
+
{ id: "publicName", direction: "desc" },
|
|
1186
|
+
{ id: "createdAt", direction: "asc" }
|
|
1187
|
+
]
|
|
1188
|
+
}
|
|
1189
|
+
]
|
|
1190
|
+
});
|
|
1191
|
+
var QueryStandard = Schema.toStandardSchemaV1(Query);
|
|
1192
|
+
var PaginationMeta = Schema.Struct({
|
|
1193
|
+
page: Schema.Int,
|
|
1194
|
+
pageSize: Schema.Int,
|
|
1195
|
+
total: Schema.Int,
|
|
1196
|
+
pageCount: Schema.Int
|
|
1197
|
+
}).pipe(Schema.annotate({
|
|
1198
|
+
identifier: "PaginationMeta",
|
|
1199
|
+
title: "Pagination Metadata",
|
|
1200
|
+
description: "Pagination metadata returned with a paginated list response.",
|
|
1201
|
+
examples: [{ page: 0, pageSize: 20, total: 125, pageCount: 7 }]
|
|
1202
|
+
}));
|
|
1203
|
+
|
|
979
1204
|
// ../../src/components/ui/data-table.tsx
|
|
980
1205
|
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider";
|
|
981
|
-
import { jsx as
|
|
982
|
-
var DataTablePersistedUiStateSchema =
|
|
983
|
-
columnVisibility:
|
|
984
|
-
columnSizing:
|
|
985
|
-
grouping:
|
|
986
|
-
view:
|
|
1206
|
+
import { jsx as jsx15, jsxs as jsxs9, Fragment } from "react/jsx-runtime";
|
|
1207
|
+
var DataTablePersistedUiStateSchema = Schema2.Struct({
|
|
1208
|
+
columnVisibility: Schema2.Record(Schema2.String, Schema2.Boolean),
|
|
1209
|
+
columnSizing: Schema2.Record(Schema2.String, Schema2.Number),
|
|
1210
|
+
grouping: Schema2.optionalKey(Schema2.Array(Schema2.String)),
|
|
1211
|
+
view: Schema2.Literals(["table", "gallery"])
|
|
987
1212
|
}).annotate({ identifier: "DataTablePersistedUiState" });
|
|
988
1213
|
var dataTableStorageRuntime = Atom.runtime(BrowserKeyValueStore.layerLocalStorage);
|
|
989
1214
|
var DataTableReferenceCell = ({
|
|
@@ -995,29 +1220,29 @@ var DataTableReferenceCell = ({
|
|
|
995
1220
|
if (!item)
|
|
996
1221
|
return emptyLabel;
|
|
997
1222
|
const initials = item.label.trim().split(/\s+/).slice(0, 2).map((word) => word.slice(0, 1)).join("").toLocaleUpperCase();
|
|
998
|
-
return /* @__PURE__ */
|
|
1223
|
+
return /* @__PURE__ */ jsxs9("div", {
|
|
999
1224
|
className: "flex min-w-0 items-center gap-2",
|
|
1000
1225
|
children: [
|
|
1001
|
-
/* @__PURE__ */
|
|
1226
|
+
/* @__PURE__ */ jsx15("div", {
|
|
1002
1227
|
className: cn("bg-muted flex size-8 shrink-0 items-center justify-center overflow-hidden text-xs font-medium", imageVariant === "circle" ? "rounded-full" : "rounded-md"),
|
|
1003
|
-
children: item.imageSrc && item.imageSrc !== failedImage ? /* @__PURE__ */
|
|
1228
|
+
children: item.imageSrc && item.imageSrc !== failedImage ? /* @__PURE__ */ jsx15("img", {
|
|
1004
1229
|
src: item.imageSrc,
|
|
1005
1230
|
alt: item.label,
|
|
1006
1231
|
className: "size-full object-cover",
|
|
1007
1232
|
onError: () => setFailedImage(item.imageSrc ?? undefined)
|
|
1008
|
-
}) : /* @__PURE__ */
|
|
1233
|
+
}) : /* @__PURE__ */ jsx15("span", {
|
|
1009
1234
|
"aria-hidden": "true",
|
|
1010
1235
|
children: initials
|
|
1011
1236
|
})
|
|
1012
1237
|
}),
|
|
1013
|
-
/* @__PURE__ */
|
|
1238
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
1014
1239
|
className: "flex min-w-0 flex-col leading-tight",
|
|
1015
1240
|
children: [
|
|
1016
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1017
1242
|
className: "truncate font-medium",
|
|
1018
1243
|
children: item.label
|
|
1019
1244
|
}),
|
|
1020
|
-
item.description ? /* @__PURE__ */
|
|
1245
|
+
item.description ? /* @__PURE__ */ jsx15("span", {
|
|
1021
1246
|
className: "text-muted-foreground truncate text-xs",
|
|
1022
1247
|
children: item.description
|
|
1023
1248
|
}) : null
|
|
@@ -1035,6 +1260,23 @@ var messages2 = {
|
|
|
1035
1260
|
empty: "No results.",
|
|
1036
1261
|
loading: "Loading...",
|
|
1037
1262
|
filter: "Filter results...",
|
|
1263
|
+
filters: "Filters",
|
|
1264
|
+
filtersClear: "Clear all filters",
|
|
1265
|
+
filterClear: "Clear filter",
|
|
1266
|
+
filterApply: "Apply filter",
|
|
1267
|
+
filterValue: "Value",
|
|
1268
|
+
filterOperator: "Operator",
|
|
1269
|
+
filterContains: "Contains",
|
|
1270
|
+
filterEquals: "Equals",
|
|
1271
|
+
filterStartsWith: "Starts with",
|
|
1272
|
+
filterEndsWith: "Ends with",
|
|
1273
|
+
filterMin: "Minimum",
|
|
1274
|
+
filterMax: "Maximum",
|
|
1275
|
+
filterFrom: "From (UTC)",
|
|
1276
|
+
filterTo: "To (UTC)",
|
|
1277
|
+
filterTrue: "True",
|
|
1278
|
+
filterFalse: "False",
|
|
1279
|
+
filterInvalid: "Enter a valid filter. Ranges must be in ascending order.",
|
|
1038
1280
|
export: "Export",
|
|
1039
1281
|
exportCsv: "CSV",
|
|
1040
1282
|
exportJson: "JSON",
|
|
@@ -1067,6 +1309,23 @@ var messages2 = {
|
|
|
1067
1309
|
empty: "Aucun résultat.",
|
|
1068
1310
|
loading: "Chargement...",
|
|
1069
1311
|
filter: "Filtrer les résultats...",
|
|
1312
|
+
filters: "Filtres",
|
|
1313
|
+
filtersClear: "Effacer tous les filtres",
|
|
1314
|
+
filterClear: "Effacer le filtre",
|
|
1315
|
+
filterApply: "Appliquer le filtre",
|
|
1316
|
+
filterValue: "Valeur",
|
|
1317
|
+
filterOperator: "Opérateur",
|
|
1318
|
+
filterContains: "Contient",
|
|
1319
|
+
filterEquals: "Égal à",
|
|
1320
|
+
filterStartsWith: "Commence par",
|
|
1321
|
+
filterEndsWith: "Se termine par",
|
|
1322
|
+
filterMin: "Minimum",
|
|
1323
|
+
filterMax: "Maximum",
|
|
1324
|
+
filterFrom: "Du (UTC)",
|
|
1325
|
+
filterTo: "Au (UTC)",
|
|
1326
|
+
filterTrue: "Vrai",
|
|
1327
|
+
filterFalse: "Faux",
|
|
1328
|
+
filterInvalid: "Saisissez un filtre valide. Les bornes doivent être dans l’ordre croissant.",
|
|
1070
1329
|
export: "Exporter",
|
|
1071
1330
|
exportCsv: "CSV",
|
|
1072
1331
|
exportJson: "JSON",
|
|
@@ -1126,7 +1385,7 @@ var transientUiFromState = (state) => ({
|
|
|
1126
1385
|
var clampWidth = (column, width) => Math.min(column.maxWidth ?? DEFAULT_MAX_WIDTH, Math.max(column.minWidth ?? DEFAULT_MIN_WIDTH, width));
|
|
1127
1386
|
var normalizeDataTableColumns = (columnDefs, columnSizing = {}) => {
|
|
1128
1387
|
const ids = new Set;
|
|
1129
|
-
|
|
1388
|
+
const columns = columnDefs.map((colDef) => {
|
|
1130
1389
|
const id = colDef.field ?? colDef.colId;
|
|
1131
1390
|
if (!id) {
|
|
1132
1391
|
throw new Error("DataTable columns require a field or colId");
|
|
@@ -1141,7 +1400,24 @@ var normalizeDataTableColumns = (columnDefs, columnSizing = {}) => {
|
|
|
1141
1400
|
width: clampWidth(colDef, columnSizing[id] ?? colDef.width ?? DEFAULT_WIDTH)
|
|
1142
1401
|
};
|
|
1143
1402
|
});
|
|
1403
|
+
for (const column of columns) {
|
|
1404
|
+
for (const field of column.colDef.fields ?? []) {
|
|
1405
|
+
const id = `${column.id}.${field.id}`;
|
|
1406
|
+
if (!field.id || ids.has(id)) {
|
|
1407
|
+
throw new Error(`DataTable field IDs must be nonempty and unique: ${id}`);
|
|
1408
|
+
}
|
|
1409
|
+
ids.add(id);
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
return columns;
|
|
1144
1413
|
};
|
|
1414
|
+
var getDataTableFieldColumns = (column) => (column.colDef.fields ?? []).map(({ id, export: _export, ...colDef }) => ({
|
|
1415
|
+
id: `${column.id}.${id}`,
|
|
1416
|
+
colDef: { ...colDef, colId: `${column.id}.${id}` },
|
|
1417
|
+
width: column.width
|
|
1418
|
+
}));
|
|
1419
|
+
var getDataTableSortColumns = (columns) => columns.flatMap((column) => column.colDef.sortable === false ? [] : ((column.colDef.fields?.length) ? getDataTableFieldColumns(column) : [column]).filter(({ colDef }) => colDef.sortable !== false));
|
|
1420
|
+
var getDataTableExportColumns = (visibleColumns) => visibleColumns.flatMap((column) => column.colDef.fields?.length ? getDataTableFieldColumns(column).filter((_field, index) => column.colDef.fields?.[index]?.export !== false) : [column]);
|
|
1145
1421
|
var getDataTableWidth = (columns, utilityColumns = 0) => columns.reduce((total, column) => total + column.width, 0) + utilityColumns * 40;
|
|
1146
1422
|
var buildDataTableRows = (rowData, columns, getRowId) => {
|
|
1147
1423
|
const ids = new Set;
|
|
@@ -1154,7 +1430,7 @@ var buildDataTableRows = (rowData, columns, getRowId) => {
|
|
|
1154
1430
|
id,
|
|
1155
1431
|
data,
|
|
1156
1432
|
index,
|
|
1157
|
-
values: new Map(columns.map((column) => {
|
|
1433
|
+
values: new Map(columns.flatMap((column) => [column, ...getDataTableFieldColumns(column)]).map((column) => {
|
|
1158
1434
|
const { colDef } = column;
|
|
1159
1435
|
const value = colDef.valueGetter ? colDef.valueGetter({ data, rowId: id, rowIndex: index, colDef }) : colDef.type === "list" ? colDef.typeOptions.getItems(data).map((item) => item.label).join(", ") : colDef.type === "reference" ? referenceText(colDef.typeOptions.getItem(data)) : colDef.field ? data[colDef.field] : undefined;
|
|
1160
1436
|
return [column.id, value];
|
|
@@ -1162,40 +1438,40 @@ var buildDataTableRows = (rowData, columns, getRowId) => {
|
|
|
1162
1438
|
};
|
|
1163
1439
|
});
|
|
1164
1440
|
};
|
|
1165
|
-
var CalendarDate =
|
|
1166
|
-
var InstantString =
|
|
1167
|
-
var DateInput =
|
|
1168
|
-
|
|
1169
|
-
|
|
1441
|
+
var CalendarDate = Schema2.String.check(Schema2.isPattern(/^\d{4}-\d{2}-\d{2}$/), Schema2.makeFilter((value) => Option2.exists(DateTime2.make(value), (date) => DateTime2.formatIsoDateUtc(date) === value))).annotate({ identifier: "DataTableCalendarDate" });
|
|
1442
|
+
var InstantString = Schema2.String.check(Schema2.isPattern(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/), Schema2.makeFilter((value) => Schema2.is(CalendarDate)(value.slice(0, 10)))).annotate({ identifier: "DataTableInstantString" });
|
|
1443
|
+
var DateInput = Schema2.Union([
|
|
1444
|
+
Schema2.Date,
|
|
1445
|
+
Schema2.Int,
|
|
1170
1446
|
CalendarDate,
|
|
1171
1447
|
InstantString
|
|
1172
1448
|
]).annotate({ identifier: "DataTableDateInput" });
|
|
1173
|
-
var decodeDateInput =
|
|
1174
|
-
var resolveDate = (value, type) =>
|
|
1175
|
-
const calendarOnly =
|
|
1449
|
+
var decodeDateInput = Schema2.decodeUnknownOption(DateInput);
|
|
1450
|
+
var resolveDate = (value, type) => Option2.getOrUndefined(Option2.flatMap(decodeDateInput(value), (input) => {
|
|
1451
|
+
const calendarOnly = Schema2.is(CalendarDate)(input);
|
|
1176
1452
|
if (calendarOnly && type === "dateTime")
|
|
1177
|
-
return
|
|
1178
|
-
return
|
|
1453
|
+
return Option2.none();
|
|
1454
|
+
return Option2.map(DateTime2.make(input), (instant) => ({
|
|
1179
1455
|
instant,
|
|
1180
1456
|
calendarOnly
|
|
1181
1457
|
}));
|
|
1182
1458
|
}));
|
|
1183
|
-
var formatDateValue = (date, column, locale = "en") =>
|
|
1459
|
+
var formatDateValue = (date, column, locale = "en") => DateTime2.format(date.instant, {
|
|
1184
1460
|
locale: column.typeOptions?.locale ?? locale,
|
|
1185
1461
|
timeZone: date.calendarOnly ? "UTC" : column.typeOptions?.timeZone ?? "UTC",
|
|
1186
1462
|
dateStyle: column.typeOptions?.dateStyle ?? "medium",
|
|
1187
1463
|
timeStyle: column.type === "dateTime" ? column.typeOptions?.timeStyle ?? "short" : undefined,
|
|
1188
1464
|
hour12: column.type === "dateTime" ? column.typeOptions?.hour12 : undefined
|
|
1189
1465
|
});
|
|
1190
|
-
var dateIsoValue = (date) => date.calendarOnly ?
|
|
1191
|
-
var NumberValue =
|
|
1466
|
+
var dateIsoValue = (date) => date.calendarOnly ? DateTime2.formatIsoDateUtc(date.instant) : DateTime2.formatIso(date.instant);
|
|
1467
|
+
var NumberValue = Schema2.Finite.annotate({
|
|
1192
1468
|
identifier: "DataTableNumberValue"
|
|
1193
1469
|
});
|
|
1194
|
-
var BooleanValue =
|
|
1470
|
+
var BooleanValue = Schema2.Boolean.annotate({
|
|
1195
1471
|
identifier: "DataTableBooleanValue"
|
|
1196
1472
|
});
|
|
1197
|
-
var decodeNumberValue =
|
|
1198
|
-
var decodeBooleanValue =
|
|
1473
|
+
var decodeNumberValue = Schema2.decodeUnknownOption(NumberValue);
|
|
1474
|
+
var decodeBooleanValue = Schema2.decodeUnknownOption(BooleanValue);
|
|
1199
1475
|
var formatNumberValue = (value, options = {}, defaultLocale = "en") => {
|
|
1200
1476
|
const {
|
|
1201
1477
|
locale,
|
|
@@ -1211,13 +1487,13 @@ var getDataTableExportValue = (row, column, locale = "en") => {
|
|
|
1211
1487
|
const value = row.values.get(column.id);
|
|
1212
1488
|
const colDef = column.colDef;
|
|
1213
1489
|
if (colDef.type === "number") {
|
|
1214
|
-
const number =
|
|
1490
|
+
const number = Option2.getOrUndefined(decodeNumberValue(value));
|
|
1215
1491
|
if (number === undefined)
|
|
1216
1492
|
return null;
|
|
1217
1493
|
return colDef.typeOptions?.exportFormat === "formatted" ? formatNumberValue(number, colDef.typeOptions, locale) : number;
|
|
1218
1494
|
}
|
|
1219
1495
|
if (colDef.type === "boolean") {
|
|
1220
|
-
const boolean =
|
|
1496
|
+
const boolean = Option2.getOrUndefined(decodeBooleanValue(value));
|
|
1221
1497
|
if (boolean === undefined)
|
|
1222
1498
|
return null;
|
|
1223
1499
|
return colDef.typeOptions?.exportFormat === "formatted" ? booleanLabel(boolean, colDef.typeOptions) ?? String(boolean) : boolean;
|
|
@@ -1233,7 +1509,7 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
|
|
|
1233
1509
|
const query = globalFilter.trim().toLocaleLowerCase();
|
|
1234
1510
|
if (!query)
|
|
1235
1511
|
return [...rows];
|
|
1236
|
-
const searchable = columns.filter(({ colDef }) => colDef.searchable !== false);
|
|
1512
|
+
const searchable = columns.flatMap((column) => column.colDef.searchable === false ? [] : ((column.colDef.fields?.length) ? getDataTableFieldColumns(column) : [column]).filter(({ colDef }) => colDef.searchable !== false));
|
|
1237
1513
|
return rows.filter((row) => searchable.some((column) => {
|
|
1238
1514
|
const value = row.values.get(column.id);
|
|
1239
1515
|
const colDef = column.colDef;
|
|
@@ -1242,17 +1518,86 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
|
|
|
1242
1518
|
const date = resolveDate(value, colDef.type);
|
|
1243
1519
|
text = date ? `${formatDateValue(date, colDef, locale)} ${dateIsoValue(date)}` : "";
|
|
1244
1520
|
} else if (colDef.type === "number") {
|
|
1245
|
-
const number =
|
|
1521
|
+
const number = Option2.getOrUndefined(decodeNumberValue(value));
|
|
1246
1522
|
text = number === undefined ? "" : `${formatNumberValue(number, colDef.typeOptions, locale)} ${number}`;
|
|
1247
1523
|
} else if (colDef.type === "boolean") {
|
|
1248
|
-
const boolean =
|
|
1524
|
+
const boolean = Option2.getOrUndefined(decodeBooleanValue(value));
|
|
1249
1525
|
text = boolean === undefined ? "" : `${booleanLabel(boolean, colDef.typeOptions) ?? ""} ${boolean}`;
|
|
1250
1526
|
}
|
|
1251
1527
|
return text.toLocaleLowerCase().includes(query);
|
|
1252
1528
|
}));
|
|
1253
1529
|
};
|
|
1530
|
+
var getDataTableFilterColumns = (columns) => columns.flatMap((column) => column.colDef.filterable === false ? [] : ((column.colDef.fields?.length) ? getDataTableFieldColumns(column) : [column]).filter(({ colDef }) => colDef.filterable !== false));
|
|
1531
|
+
var getDataTableFilterKind = ({
|
|
1532
|
+
colDef
|
|
1533
|
+
}) => colDef.filterOptions || colDef.type === "list" ? "values" : colDef.type === "number" ? "number" : colDef.type === "date" || colDef.type === "dateTime" ? "date" : colDef.type === "boolean" ? "boolean" : "text";
|
|
1534
|
+
var getDataTableFilterOptions = (rows, column) => {
|
|
1535
|
+
const { colDef } = column;
|
|
1536
|
+
if (colDef.filterOptions)
|
|
1537
|
+
return colDef.filterOptions;
|
|
1538
|
+
const options = new Map;
|
|
1539
|
+
if (colDef.type === "list") {
|
|
1540
|
+
for (const row of rows) {
|
|
1541
|
+
for (const item of colDef.typeOptions.getItems(row.data)) {
|
|
1542
|
+
const value = item.value ?? item.label;
|
|
1543
|
+
options.set(value, { value, label: item.label });
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
return [...options.values()].sort((left, right) => left.label.localeCompare(right.label));
|
|
1548
|
+
};
|
|
1549
|
+
var filterDataTableColumnRows = (rows, columns, filters) => {
|
|
1550
|
+
const byId = new Map(getDataTableFilterColumns(columns).map((column) => [column.id, column]));
|
|
1551
|
+
return rows.filter((row) => filters.every((filter) => {
|
|
1552
|
+
const column = byId.get(filter.id);
|
|
1553
|
+
if (!column || getDataTableFilterKind(column) !== filter.kind)
|
|
1554
|
+
return true;
|
|
1555
|
+
const value = column.colDef.filterValueGetter ? column.colDef.filterValueGetter({
|
|
1556
|
+
data: row.data,
|
|
1557
|
+
rowId: row.id,
|
|
1558
|
+
rowIndex: row.index,
|
|
1559
|
+
colDef: column.colDef
|
|
1560
|
+
}) : row.values.get(column.id);
|
|
1561
|
+
switch (filter.kind) {
|
|
1562
|
+
case "text": {
|
|
1563
|
+
const text = String(value ?? "").toLocaleLowerCase();
|
|
1564
|
+
const query = filter.value.toLocaleLowerCase();
|
|
1565
|
+
switch (filter.operator) {
|
|
1566
|
+
case "contains":
|
|
1567
|
+
return text.includes(query);
|
|
1568
|
+
case "equals":
|
|
1569
|
+
return text === query;
|
|
1570
|
+
case "startsWith":
|
|
1571
|
+
return text.startsWith(query);
|
|
1572
|
+
case "endsWith":
|
|
1573
|
+
return text.endsWith(query);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
case "number": {
|
|
1577
|
+
const number = Option2.getOrUndefined(decodeNumberValue(value));
|
|
1578
|
+
return number !== undefined && (filter.min === undefined || number >= filter.min) && (filter.max === undefined || number <= filter.max);
|
|
1579
|
+
}
|
|
1580
|
+
case "date": {
|
|
1581
|
+
const date = resolveDate(value, column.colDef.type === "dateTime" ? "dateTime" : "date");
|
|
1582
|
+
if (!date)
|
|
1583
|
+
return false;
|
|
1584
|
+
const day = DateTime2.formatIsoDateUtc(date.instant);
|
|
1585
|
+
return (filter.from === undefined || day >= filter.from) && (filter.to === undefined || day <= filter.to);
|
|
1586
|
+
}
|
|
1587
|
+
case "boolean":
|
|
1588
|
+
return Option2.getOrUndefined(decodeBooleanValue(value)) === filter.value;
|
|
1589
|
+
case "values": {
|
|
1590
|
+
const values = column.colDef.type === "list" ? column.colDef.typeOptions.getItems(row.data).map((item) => item.value ?? item.label) : [String(value ?? "")];
|
|
1591
|
+
return filter.values.some((selected) => values.includes(selected));
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
}));
|
|
1595
|
+
};
|
|
1254
1596
|
var sortDataTableRows = (rows, columns, sorting) => {
|
|
1255
|
-
const byId = new Map(columns.map((column) => [
|
|
1597
|
+
const byId = new Map([...columns, ...getDataTableSortColumns(columns)].map((column) => [
|
|
1598
|
+
column.id,
|
|
1599
|
+
column
|
|
1600
|
+
]));
|
|
1256
1601
|
return rows.map((row, stableIndex) => ({ row, stableIndex })).sort((left, right) => {
|
|
1257
1602
|
for (const sort of sorting) {
|
|
1258
1603
|
const column = byId.get(sort.id);
|
|
@@ -1262,8 +1607,8 @@ var sortDataTableRows = (rows, columns, sorting) => {
|
|
|
1262
1607
|
const rightValue = right.row.values.get(sort.id);
|
|
1263
1608
|
const colDef = column.colDef;
|
|
1264
1609
|
if (!colDef.comparator && (colDef.type === "number" || colDef.type === "boolean")) {
|
|
1265
|
-
const leftScalar = colDef.type === "number" ?
|
|
1266
|
-
const rightScalar = colDef.type === "number" ?
|
|
1610
|
+
const leftScalar = colDef.type === "number" ? Option2.getOrUndefined(decodeNumberValue(leftValue)) : Option2.getOrUndefined(Option2.map(decodeBooleanValue(leftValue), Number));
|
|
1611
|
+
const rightScalar = colDef.type === "number" ? Option2.getOrUndefined(decodeNumberValue(rightValue)) : Option2.getOrUndefined(Option2.map(decodeBooleanValue(rightValue), Number));
|
|
1267
1612
|
if (leftScalar === undefined || rightScalar === undefined) {
|
|
1268
1613
|
if (leftScalar === undefined && rightScalar === undefined)
|
|
1269
1614
|
continue;
|
|
@@ -1284,12 +1629,12 @@ var sortDataTableRows = (rows, columns, sorting) => {
|
|
|
1284
1629
|
const nullOrder = colDef.typeOptions?.nulls === "first" ? -1 : 1;
|
|
1285
1630
|
return !leftDate ? nullOrder : -nullOrder;
|
|
1286
1631
|
}
|
|
1287
|
-
const comparison =
|
|
1632
|
+
const comparison = DateTime2.toEpochMillis(leftDate.instant) - DateTime2.toEpochMillis(rightDate.instant);
|
|
1288
1633
|
if (comparison !== 0)
|
|
1289
1634
|
return sort.direction === "desc" ? -comparison : comparison;
|
|
1290
1635
|
continue;
|
|
1291
1636
|
}
|
|
1292
|
-
const comparison = column.colDef.comparator ? column.colDef.comparator(leftValue, rightValue, left.row.data, right.row.data) : Object.is(leftValue, rightValue) ? 0 : leftValue === null || leftValue === undefined ? 1 : rightValue === null || rightValue === undefined ? -1 :
|
|
1637
|
+
const comparison = column.colDef.comparator ? column.colDef.comparator(leftValue, rightValue, left.row.data, right.row.data) : Object.is(leftValue, rightValue) ? 0 : leftValue === null || leftValue === undefined ? 1 : rightValue === null || rightValue === undefined ? -1 : Schema2.is(Schema2.Number)(leftValue) && Schema2.is(Schema2.Number)(rightValue) ? leftValue - rightValue : String(leftValue).localeCompare(String(rightValue), undefined, { numeric: true, sensitivity: "base" });
|
|
1293
1638
|
if (comparison !== 0)
|
|
1294
1639
|
return sort.direction === "desc" ? -comparison : comparison;
|
|
1295
1640
|
}
|
|
@@ -1303,7 +1648,7 @@ var paginateDataTableRows = (rows, pagination) => {
|
|
|
1303
1648
|
const start = pageIndex * pageSize;
|
|
1304
1649
|
return rows.slice(start, start + pageSize);
|
|
1305
1650
|
};
|
|
1306
|
-
var sameDataTableState = (left, right) => left.page === right.page && left.pageSize === right.pageSize && left.globalFilter === right.globalFilter && left.sort === right.sort && left.columnVisibility === right.columnVisibility && left.columnSizing === right.columnSizing && left.rowSelection === right.rowSelection && left.grouping === right.grouping && left.collapsedGroups === right.collapsedGroups && left.view === right.view;
|
|
1651
|
+
var sameDataTableState = (left, right) => left.page === right.page && left.pageSize === right.pageSize && left.globalFilter === right.globalFilter && left.filters === right.filters && left.sort === right.sort && left.columnVisibility === right.columnVisibility && left.columnSizing === right.columnSizing && left.rowSelection === right.rowSelection && left.grouping === right.grouping && left.collapsedGroups === right.collapsedGroups && left.view === right.view;
|
|
1307
1652
|
var reorderDataTableRows = (rows, sourceRowId, targetRowId) => {
|
|
1308
1653
|
const sourceIndex = rows.findIndex((row) => row.id === sourceRowId);
|
|
1309
1654
|
const targetIndex = rows.findIndex((row) => row.id === targetRowId);
|
|
@@ -1371,6 +1716,7 @@ var queryFromState = (state) => ({
|
|
|
1371
1716
|
page: state.page,
|
|
1372
1717
|
pageSize: state.pageSize,
|
|
1373
1718
|
globalFilter: state.globalFilter,
|
|
1719
|
+
filters: state.filters,
|
|
1374
1720
|
sort: state.sort
|
|
1375
1721
|
});
|
|
1376
1722
|
var uiFromState = (state) => ({
|
|
@@ -1382,7 +1728,7 @@ var uiFromState = (state) => ({
|
|
|
1382
1728
|
view: state.view
|
|
1383
1729
|
});
|
|
1384
1730
|
var sameUiState = (left, right) => left.columnVisibility === right.columnVisibility && left.columnSizing === right.columnSizing && left.rowSelection === right.rowSelection && left.grouping === right.grouping && left.collapsedGroups === right.collapsedGroups && left.view === right.view;
|
|
1385
|
-
var sameQueryState = (left, right) => left.page === right.page && left.pageSize === right.pageSize && left.globalFilter === right.globalFilter && left.sort === right.sort;
|
|
1731
|
+
var sameQueryState = (left, right) => left.page === right.page && left.pageSize === right.pageSize && left.globalFilter === right.globalFilter && left.filters === right.filters && left.sort === right.sort;
|
|
1386
1732
|
var initialPublicState = (props, uiState) => ({
|
|
1387
1733
|
...queryFromState(props.state ?? { ...DEFAULT_QUERY, ...props.initialState }),
|
|
1388
1734
|
...uiState
|
|
@@ -1394,7 +1740,7 @@ var buildDataTableModel = (store) => {
|
|
|
1394
1740
|
const rows = buildDataTableRows(store.rowData, columns, rowId);
|
|
1395
1741
|
const pagination = store.config.features.pagination ?? { mode: "client" };
|
|
1396
1742
|
const server = pagination !== false && pagination.mode === "server";
|
|
1397
|
-
const filteredRows = server ? [...rows] : filterDataTableRows(rows, columns, store.state.globalFilter ?? "", store.config.locale);
|
|
1743
|
+
const filteredRows = server ? [...rows] : filterDataTableColumnRows(filterDataTableRows(rows, columns, store.state.globalFilter ?? "", store.config.locale), columns, store.state.filters ?? []);
|
|
1398
1744
|
const sortedRows = server ? filteredRows : sortDataTableRows(filteredRows, columns, store.state.sort ?? []);
|
|
1399
1745
|
const pageRows = pagination === false || server ? sortedRows : paginateDataTableRows(sortedRows, store.state);
|
|
1400
1746
|
const totalRows = server ? pagination.rowCount : sortedRows.length;
|
|
@@ -1466,7 +1812,7 @@ var getActiveGrouping = (store) => {
|
|
|
1466
1812
|
};
|
|
1467
1813
|
var canReorderRows = (store) => {
|
|
1468
1814
|
const pagination = store.config.features.pagination;
|
|
1469
|
-
return !!store.config.features.reordering && !getActiveGrouping(store).length && !store.state.globalFilter && !store.state.sort?.length && !(pagination && pagination.mode === "server");
|
|
1815
|
+
return !!store.config.features.reordering && !getActiveGrouping(store).length && !store.state.globalFilter && !store.state.filters?.length && !store.state.sort?.length && !(pagination && pagination.mode === "server");
|
|
1470
1816
|
};
|
|
1471
1817
|
var canMoveRowsToGroups = (store) => getActiveGrouping(store).some((field) => !!field.onMoveToGroup);
|
|
1472
1818
|
var canDragRows = (store) => getActiveGrouping(store).length ? canMoveRowsToGroups(store) : canReorderRows(store);
|
|
@@ -1483,14 +1829,14 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1483
1829
|
};
|
|
1484
1830
|
const CellRenderer = column.colDef.cellRenderer;
|
|
1485
1831
|
if (CellRenderer)
|
|
1486
|
-
return /* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ jsx15(CellRenderer, {
|
|
1487
1833
|
...params
|
|
1488
1834
|
});
|
|
1489
1835
|
const colDef = column.colDef;
|
|
1490
1836
|
if (colDef.type === "reference") {
|
|
1491
1837
|
if (colDef.valueFormatter)
|
|
1492
1838
|
return colDef.valueFormatter(params);
|
|
1493
|
-
return /* @__PURE__ */
|
|
1839
|
+
return /* @__PURE__ */ jsx15(DataTableReferenceCell, {
|
|
1494
1840
|
item: colDef.typeOptions.getItem(row.data),
|
|
1495
1841
|
emptyLabel: colDef.typeOptions.emptyLabel,
|
|
1496
1842
|
imageVariant: colDef.typeOptions.imageVariant
|
|
@@ -1499,8 +1845,8 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1499
1845
|
if (colDef.type === "number") {
|
|
1500
1846
|
if (colDef.valueFormatter)
|
|
1501
1847
|
return colDef.valueFormatter(params);
|
|
1502
|
-
const number =
|
|
1503
|
-
return /* @__PURE__ */
|
|
1848
|
+
const number = Option2.getOrUndefined(decodeNumberValue(value));
|
|
1849
|
+
return /* @__PURE__ */ jsx15("span", {
|
|
1504
1850
|
className: "block text-left tabular-nums",
|
|
1505
1851
|
children: number === undefined ? colDef.typeOptions?.emptyLabel ?? "—" : formatNumberValue(number, colDef.typeOptions, locale)
|
|
1506
1852
|
});
|
|
@@ -1508,16 +1854,16 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1508
1854
|
if (colDef.type === "boolean") {
|
|
1509
1855
|
if (colDef.valueFormatter)
|
|
1510
1856
|
return colDef.valueFormatter(params);
|
|
1511
|
-
const boolean =
|
|
1857
|
+
const boolean = Option2.getOrUndefined(decodeBooleanValue(value));
|
|
1512
1858
|
if (boolean === undefined)
|
|
1513
1859
|
return colDef.typeOptions?.emptyLabel ?? "—";
|
|
1514
1860
|
const options = colDef.typeOptions;
|
|
1515
|
-
return /* @__PURE__ */
|
|
1861
|
+
return /* @__PURE__ */ jsx15("label", {
|
|
1516
1862
|
"data-slot": "data-table-boolean-cell",
|
|
1517
|
-
className: cn("flex min-h-16 w-full items-center justify-start border border-transparent px-2 outline-none focus-within:
|
|
1863
|
+
className: cn("focus-within:border-ring focus-within:ring-ring/50 flex min-h-16 w-full items-center justify-start border border-transparent px-2 outline-none focus-within:ring-3 focus-within:ring-inset in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0", options?.onChange && !options.disabled?.(row.data) && "hover:bg-muted/50 cursor-pointer"),
|
|
1518
1864
|
onClick: (event) => event.stopPropagation(),
|
|
1519
1865
|
onPointerDown: (event) => event.stopPropagation(),
|
|
1520
|
-
children: /* @__PURE__ */
|
|
1866
|
+
children: /* @__PURE__ */ jsx15(Checkbox, {
|
|
1521
1867
|
"aria-label": options?.getAriaLabel?.(row.data) ?? columnLabel(column),
|
|
1522
1868
|
className: "focus-visible:ring-0 focus-visible:outline-none",
|
|
1523
1869
|
checked: boolean,
|
|
@@ -1531,7 +1877,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1531
1877
|
if (colDef.valueFormatter)
|
|
1532
1878
|
return colDef.valueFormatter(params);
|
|
1533
1879
|
const date = resolveDate(value, colDef.type);
|
|
1534
|
-
return date ? /* @__PURE__ */
|
|
1880
|
+
return date ? /* @__PURE__ */ jsx15("time", {
|
|
1535
1881
|
dateTime: dateIsoValue(date),
|
|
1536
1882
|
children: formatDateValue(date, colDef, locale)
|
|
1537
1883
|
}) : colDef.typeOptions?.emptyLabel ?? "—";
|
|
@@ -1545,7 +1891,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1545
1891
|
disabled: (item) => action.disabled?.({ item, row: row.data }) ?? false
|
|
1546
1892
|
}));
|
|
1547
1893
|
if (config.getOptions) {
|
|
1548
|
-
return /* @__PURE__ */
|
|
1894
|
+
return /* @__PURE__ */ jsx15(DataTableListCell, {
|
|
1549
1895
|
...config,
|
|
1550
1896
|
itemActions,
|
|
1551
1897
|
onItemClick: config.onItemClick ? (item) => config.onItemClick?.({ item, row: row.data }) : undefined,
|
|
@@ -1558,7 +1904,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1558
1904
|
onRemove: config.onRemove ? (value) => config.onRemove?.({ value, row: row.data }) : undefined
|
|
1559
1905
|
});
|
|
1560
1906
|
}
|
|
1561
|
-
return /* @__PURE__ */
|
|
1907
|
+
return /* @__PURE__ */ jsx15(DataTableListCell, {
|
|
1562
1908
|
...config,
|
|
1563
1909
|
itemActions,
|
|
1564
1910
|
onItemClick: config.onItemClick ? (item) => config.onItemClick?.({ item, row: row.data }) : undefined,
|
|
@@ -1571,25 +1917,19 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1571
1917
|
return column.colDef.valueFormatter?.(params) ?? (value === null || value === undefined ? null : String(value));
|
|
1572
1918
|
};
|
|
1573
1919
|
var nodeText = (node) => {
|
|
1574
|
-
if (
|
|
1920
|
+
if (Schema2.is(Schema2.String)(node) || Schema2.is(Schema2.Number)(node))
|
|
1575
1921
|
return String(node);
|
|
1576
1922
|
if (!isValidElement(node))
|
|
1577
1923
|
return "";
|
|
1578
|
-
if (
|
|
1924
|
+
if (Schema2.is(Schema2.String)(node.props.title))
|
|
1579
1925
|
return node.props.title;
|
|
1580
1926
|
return nodeText(node.props.children);
|
|
1581
1927
|
};
|
|
1582
1928
|
var columnLabel = (column) => nodeText(column.colDef.headerName) || column.id;
|
|
1583
1929
|
var withExtension = (fileName, extension) => fileName.includes(".") ? fileName.replace(/\.[^/.]+$/, `.${extension}`) : `${fileName}.${extension}`;
|
|
1584
|
-
var escapeCsvValue = (value) => {
|
|
1585
|
-
if (value === null || value === undefined)
|
|
1586
|
-
return "";
|
|
1587
|
-
const text = String(value);
|
|
1588
|
-
return /[",\n]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text;
|
|
1589
|
-
};
|
|
1590
1930
|
var downloadCsv = (headers, data, fileName = "data.csv") => {
|
|
1591
|
-
const content = [headers, ...data].map((row) => row.map(
|
|
1592
|
-
`);
|
|
1931
|
+
const content = Effect2.runSync(Stream.fromIterable([headers, ...data]).pipe(Stream.map((row) => row.map((value) => value == null ? "" : String(value))), Stream.pipeThroughChannel(Csv.encodeString({ newline: `
|
|
1932
|
+
` })), Stream.runCollect, Effect2.map((parts) => parts.join("").slice(0, -1))));
|
|
1593
1933
|
downloadBlob(content, "text/csv;charset=utf-8", withExtension(fileName, "csv"));
|
|
1594
1934
|
};
|
|
1595
1935
|
var downloadJson = (data, fileName = "data.json") => downloadBlob(JSON.stringify(data, null, 2), "application/json;charset=utf-8", withExtension(fileName, "json"));
|
|
@@ -1611,33 +1951,33 @@ var DataTableRowActions = ({
|
|
|
1611
1951
|
const visible = actions.filter((action) => !action.visible || action.visible(row));
|
|
1612
1952
|
if (!visible.length)
|
|
1613
1953
|
return null;
|
|
1614
|
-
return /* @__PURE__ */
|
|
1954
|
+
return /* @__PURE__ */ jsxs9(DropdownMenu, {
|
|
1615
1955
|
children: [
|
|
1616
|
-
/* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger, {
|
|
1617
1957
|
onClick: (event) => event.stopPropagation(),
|
|
1618
|
-
render: /* @__PURE__ */
|
|
1958
|
+
render: /* @__PURE__ */ jsxs9(Button, {
|
|
1619
1959
|
className: "size-8 focus-visible:ring-inset [&_svg:not([class*='size-'])]:size-4",
|
|
1620
1960
|
size: "icon",
|
|
1621
1961
|
variant: "ghost",
|
|
1622
1962
|
children: [
|
|
1623
|
-
/* @__PURE__ */
|
|
1963
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1624
1964
|
className: "sr-only",
|
|
1625
1965
|
children: title
|
|
1626
1966
|
}),
|
|
1627
|
-
/* @__PURE__ */
|
|
1967
|
+
/* @__PURE__ */ jsx15(MoreHorizontal, {})
|
|
1628
1968
|
]
|
|
1629
1969
|
})
|
|
1630
1970
|
}),
|
|
1631
|
-
/* @__PURE__ */
|
|
1971
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent, {
|
|
1632
1972
|
align: "end",
|
|
1633
1973
|
className: "w-max",
|
|
1634
|
-
children: /* @__PURE__ */
|
|
1974
|
+
children: /* @__PURE__ */ jsxs9(DropdownMenuGroup, {
|
|
1635
1975
|
children: [
|
|
1636
|
-
/* @__PURE__ */
|
|
1976
|
+
/* @__PURE__ */ jsx15(DropdownMenuLabel, {
|
|
1637
1977
|
children: title
|
|
1638
1978
|
}),
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
visible.map((action) => /* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
|
|
1980
|
+
visible.map((action) => /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
1641
1981
|
onClick: (event) => {
|
|
1642
1982
|
event.stopPropagation();
|
|
1643
1983
|
action.onClick(row);
|
|
@@ -1674,7 +2014,7 @@ var DataTableRowActionMenu = ({
|
|
|
1674
2014
|
reorderActions.push({
|
|
1675
2015
|
id: "data-table-move-up",
|
|
1676
2016
|
name: store.config.labels.moveUp,
|
|
1677
|
-
icon: /* @__PURE__ */
|
|
2017
|
+
icon: /* @__PURE__ */ jsx15(ArrowUp, {}),
|
|
1678
2018
|
onClick: () => move(rowIndex - 1)
|
|
1679
2019
|
});
|
|
1680
2020
|
}
|
|
@@ -1682,12 +2022,12 @@ var DataTableRowActionMenu = ({
|
|
|
1682
2022
|
reorderActions.push({
|
|
1683
2023
|
id: "data-table-move-down",
|
|
1684
2024
|
name: store.config.labels.moveDown,
|
|
1685
|
-
icon: /* @__PURE__ */
|
|
2025
|
+
icon: /* @__PURE__ */ jsx15(ArrowDown, {}),
|
|
1686
2026
|
onClick: () => move(rowIndex + 1)
|
|
1687
2027
|
});
|
|
1688
2028
|
}
|
|
1689
2029
|
}
|
|
1690
|
-
return /* @__PURE__ */
|
|
2030
|
+
return /* @__PURE__ */ jsx15(DataTableRowActions, {
|
|
1691
2031
|
actions: [...reorderActions, ...rowActions ? rowActions.items : []],
|
|
1692
2032
|
row: row.data,
|
|
1693
2033
|
title: rowActions?.label ?? store.config.labels.actions
|
|
@@ -1706,12 +2046,13 @@ var DataTableToolbar = ({
|
|
|
1706
2046
|
const grouping = features.grouping;
|
|
1707
2047
|
const toolbar = features.toolbar;
|
|
1708
2048
|
const bulkActions = features.selection && features.selection.bulkActions;
|
|
1709
|
-
const hasToolbar = !!toolbar || features.search !== false || features.sorting !== false || features.columnVisibility !== false || !!features.export || !!features.gallery || !!grouping || !!features.refresh || !!bulkActions && selectedRows.length > 0;
|
|
2049
|
+
const hasToolbar = !!toolbar || features.search !== false || features.filtering !== false || features.sorting !== false || features.columnVisibility !== false || !!features.export || !!features.gallery || !!grouping || !!features.refresh || !!bulkActions && selectedRows.length > 0;
|
|
1710
2050
|
if (!hasToolbar)
|
|
1711
2051
|
return null;
|
|
1712
2052
|
const update = (next) => changeState(setStore, next);
|
|
1713
2053
|
const visibleBulkActions = bulkActions ? bulkActions.items.filter((action) => !action.visible || action.visible(selectedRows)) : [];
|
|
1714
|
-
const exportRows = features.export && features.export.scope === "
|
|
2054
|
+
const exportRows = features.export && features.export.scope === "currentPage" ? model.pageRows : model.sortedRows;
|
|
2055
|
+
const exportColumns = getDataTableExportColumns(model.visibleColumns);
|
|
1715
2056
|
const exportFeature = features.export;
|
|
1716
2057
|
const exportActions = exportFeature ? exportFeature.actions ?? [] : [];
|
|
1717
2058
|
const builtInExport = exportFeature && exportFeature.builtIn !== false;
|
|
@@ -1733,16 +2074,16 @@ var DataTableToolbar = ({
|
|
|
1733
2074
|
setExporting(false);
|
|
1734
2075
|
}
|
|
1735
2076
|
};
|
|
1736
|
-
return /* @__PURE__ */
|
|
2077
|
+
return /* @__PURE__ */ jsxs9("div", {
|
|
1737
2078
|
className: "flex flex-col gap-2 pb-4",
|
|
1738
2079
|
children: [
|
|
1739
|
-
features.search !== false ? /* @__PURE__ */
|
|
2080
|
+
features.search !== false ? /* @__PURE__ */ jsxs9("div", {
|
|
1740
2081
|
className: "relative min-w-0",
|
|
1741
2082
|
children: [
|
|
1742
|
-
/* @__PURE__ */
|
|
2083
|
+
/* @__PURE__ */ jsx15(Search, {
|
|
1743
2084
|
className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2"
|
|
1744
2085
|
}),
|
|
1745
|
-
/* @__PURE__ */
|
|
2086
|
+
/* @__PURE__ */ jsx15(Input, {
|
|
1746
2087
|
className: "px-9",
|
|
1747
2088
|
onChange: (event) => update((state) => ({
|
|
1748
2089
|
...state,
|
|
@@ -1752,7 +2093,7 @@ var DataTableToolbar = ({
|
|
|
1752
2093
|
placeholder: labels.filter,
|
|
1753
2094
|
value: store.state.globalFilter ?? ""
|
|
1754
2095
|
}),
|
|
1755
|
-
store.state.globalFilter ? /* @__PURE__ */
|
|
2096
|
+
store.state.globalFilter ? /* @__PURE__ */ jsx15(Button, {
|
|
1756
2097
|
"aria-label": labels.filter,
|
|
1757
2098
|
className: "absolute top-1/2 right-1 size-7 -translate-y-1/2 active:not-aria-[haspopup]:-translate-y-1/2",
|
|
1758
2099
|
onClick: () => update((state) => ({
|
|
@@ -1762,39 +2103,38 @@ var DataTableToolbar = ({
|
|
|
1762
2103
|
})),
|
|
1763
2104
|
size: "icon",
|
|
1764
2105
|
variant: "ghost",
|
|
1765
|
-
children: /* @__PURE__ */
|
|
2106
|
+
children: /* @__PURE__ */ jsx15(X, {})
|
|
1766
2107
|
}) : null
|
|
1767
2108
|
]
|
|
1768
2109
|
}) : null,
|
|
1769
|
-
/* @__PURE__ */
|
|
2110
|
+
/* @__PURE__ */ jsx15("div", {
|
|
1770
2111
|
className: "-m-1 flex overflow-x-auto p-1",
|
|
1771
|
-
children: /* @__PURE__ */
|
|
2112
|
+
children: /* @__PURE__ */ jsxs9(Menubar, {
|
|
1772
2113
|
className: "h-auto w-max min-w-full justify-start bg-transparent shadow-none [&_[data-slot=menubar-trigger]]:gap-2 [&_[data-slot=menubar-trigger]_svg]:size-4",
|
|
1773
2114
|
children: [
|
|
1774
|
-
|
|
1775
|
-
visibleBulkActions.length ? /* @__PURE__ */ jsxs8(MenubarMenu, {
|
|
2115
|
+
visibleBulkActions.length ? /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
1776
2116
|
children: [
|
|
1777
|
-
/* @__PURE__ */
|
|
2117
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
1778
2118
|
className: "bg-primary text-primary-foreground hover:bg-primary/90 aria-expanded:bg-primary/90",
|
|
1779
2119
|
children: [
|
|
1780
2120
|
labels.selected,
|
|
1781
|
-
/* @__PURE__ */
|
|
2121
|
+
/* @__PURE__ */ jsx15(Badge, {
|
|
1782
2122
|
variant: "secondary",
|
|
1783
2123
|
children: selectedRows.length
|
|
1784
2124
|
}),
|
|
1785
|
-
/* @__PURE__ */
|
|
2125
|
+
/* @__PURE__ */ jsx15(ChevronDown, {})
|
|
1786
2126
|
]
|
|
1787
2127
|
}),
|
|
1788
|
-
/* @__PURE__ */
|
|
2128
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
1789
2129
|
align: "end",
|
|
1790
2130
|
className: "w-max",
|
|
1791
|
-
children: /* @__PURE__ */
|
|
2131
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
1792
2132
|
children: [
|
|
1793
|
-
/* @__PURE__ */
|
|
2133
|
+
/* @__PURE__ */ jsx15(MenubarLabel, {
|
|
1794
2134
|
children: bulkActions && bulkActions.label ? bulkActions.label : labels.actions
|
|
1795
2135
|
}),
|
|
1796
|
-
/* @__PURE__ */
|
|
1797
|
-
visibleBulkActions.map((action) => /* @__PURE__ */
|
|
2136
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2137
|
+
visibleBulkActions.map((action) => /* @__PURE__ */ jsxs9(MenubarItem, {
|
|
1798
2138
|
onClick: () => action.onClick(selectedRows),
|
|
1799
2139
|
variant: action.variant ?? "default",
|
|
1800
2140
|
children: [
|
|
@@ -1807,27 +2147,31 @@ var DataTableToolbar = ({
|
|
|
1807
2147
|
})
|
|
1808
2148
|
]
|
|
1809
2149
|
}) : null,
|
|
1810
|
-
|
|
2150
|
+
toolbar && toolbar.items,
|
|
2151
|
+
features.filtering !== false ? /* @__PURE__ */ jsx15(FilterMenu, {
|
|
2152
|
+
tableAtom
|
|
2153
|
+
}) : null,
|
|
2154
|
+
grouping ? /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
1811
2155
|
children: [
|
|
1812
|
-
/* @__PURE__ */
|
|
2156
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
1813
2157
|
"aria-label": labels.groupBy,
|
|
1814
2158
|
children: [
|
|
1815
|
-
/* @__PURE__ */
|
|
1816
|
-
/* @__PURE__ */
|
|
2159
|
+
/* @__PURE__ */ jsx15(Rows3, {}),
|
|
2160
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1817
2161
|
className: "hidden sm:inline",
|
|
1818
2162
|
children: labels.groupBy
|
|
1819
2163
|
})
|
|
1820
2164
|
]
|
|
1821
2165
|
}),
|
|
1822
|
-
/* @__PURE__ */
|
|
2166
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
1823
2167
|
align: "end",
|
|
1824
|
-
children: /* @__PURE__ */
|
|
2168
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
1825
2169
|
children: [
|
|
1826
|
-
/* @__PURE__ */
|
|
2170
|
+
/* @__PURE__ */ jsx15(MenubarLabel, {
|
|
1827
2171
|
children: labels.groupBy
|
|
1828
2172
|
}),
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
grouping.fields.map((field) => /* @__PURE__ */
|
|
2173
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2174
|
+
grouping.fields.map((field) => /* @__PURE__ */ jsx15(MenubarCheckboxItem, {
|
|
1831
2175
|
checked: store.state.grouping.includes(field.id),
|
|
1832
2176
|
onCheckedChange: (checked) => update((state) => ({
|
|
1833
2177
|
...state,
|
|
@@ -1840,77 +2184,77 @@ var DataTableToolbar = ({
|
|
|
1840
2184
|
})
|
|
1841
2185
|
]
|
|
1842
2186
|
}) : null,
|
|
1843
|
-
features.sorting !== false ? /* @__PURE__ */
|
|
2187
|
+
features.sorting !== false ? /* @__PURE__ */ jsx15(SortMenu, {
|
|
1844
2188
|
tableAtom
|
|
1845
2189
|
}) : null,
|
|
1846
|
-
features.gallery ? /* @__PURE__ */
|
|
2190
|
+
features.gallery ? /* @__PURE__ */ jsx15(ViewMenu, {
|
|
1847
2191
|
tableAtom
|
|
1848
2192
|
}) : null,
|
|
1849
|
-
features.columnVisibility !== false ? /* @__PURE__ */
|
|
2193
|
+
features.columnVisibility !== false ? /* @__PURE__ */ jsx15(ColumnMenu, {
|
|
1850
2194
|
tableAtom
|
|
1851
2195
|
}) : null,
|
|
1852
|
-
features.refresh ? /* @__PURE__ */
|
|
1853
|
-
children: /* @__PURE__ */
|
|
2196
|
+
features.refresh ? /* @__PURE__ */ jsx15(MenubarMenu, {
|
|
2197
|
+
children: /* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
1854
2198
|
"aria-label": labels.refresh,
|
|
1855
2199
|
onClick: features.refresh,
|
|
1856
2200
|
children: [
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsx15(RefreshCw, {}),
|
|
2202
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1859
2203
|
className: "hidden sm:inline",
|
|
1860
2204
|
children: labels.refresh
|
|
1861
2205
|
})
|
|
1862
2206
|
]
|
|
1863
2207
|
})
|
|
1864
2208
|
}) : null,
|
|
1865
|
-
features.export ? /* @__PURE__ */
|
|
2209
|
+
features.export ? /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
1866
2210
|
children: [
|
|
1867
|
-
/* @__PURE__ */
|
|
2211
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
1868
2212
|
"aria-label": labels.export,
|
|
1869
2213
|
"aria-busy": exporting,
|
|
1870
2214
|
disabled: exporting || !canExport,
|
|
1871
2215
|
children: [
|
|
1872
|
-
exporting ? /* @__PURE__ */
|
|
2216
|
+
exporting ? /* @__PURE__ */ jsx15(RefreshCw, {
|
|
1873
2217
|
className: "animate-spin"
|
|
1874
|
-
}) : /* @__PURE__ */
|
|
1875
|
-
/* @__PURE__ */
|
|
2218
|
+
}) : /* @__PURE__ */ jsx15(Download, {}),
|
|
2219
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1876
2220
|
className: "hidden sm:inline",
|
|
1877
2221
|
children: exporting ? labels.loading : labels.export
|
|
1878
2222
|
})
|
|
1879
2223
|
]
|
|
1880
2224
|
}),
|
|
1881
|
-
/* @__PURE__ */
|
|
2225
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
1882
2226
|
align: "end",
|
|
1883
|
-
children: /* @__PURE__ */
|
|
2227
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
1884
2228
|
children: [
|
|
1885
|
-
/* @__PURE__ */
|
|
2229
|
+
/* @__PURE__ */ jsx15(MenubarLabel, {
|
|
1886
2230
|
children: labels.export
|
|
1887
2231
|
}),
|
|
1888
|
-
/* @__PURE__ */
|
|
1889
|
-
builtInExport ? /* @__PURE__ */
|
|
2232
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2233
|
+
builtInExport ? /* @__PURE__ */ jsxs9(Fragment, {
|
|
1890
2234
|
children: [
|
|
1891
|
-
/* @__PURE__ */
|
|
2235
|
+
/* @__PURE__ */ jsxs9(MenubarItem, {
|
|
1892
2236
|
disabled: exporting || !exportRows.length,
|
|
1893
|
-
onClick: () => downloadCsv(
|
|
2237
|
+
onClick: () => downloadCsv(exportColumns.map(columnLabel), exportRows.map((row) => exportColumns.map((column) => String(getDataTableExportValue(row, column, store.config.locale) ?? ""))), features.export ? features.export.baseName : "table"),
|
|
1894
2238
|
children: [
|
|
1895
|
-
/* @__PURE__ */
|
|
2239
|
+
/* @__PURE__ */ jsx15(FileText, {}),
|
|
1896
2240
|
labels.exportCsv
|
|
1897
2241
|
]
|
|
1898
2242
|
}),
|
|
1899
|
-
/* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ jsxs9(MenubarItem, {
|
|
1900
2244
|
disabled: exporting || !exportRows.length,
|
|
1901
|
-
onClick: () => downloadJson(exportRows.map((row) => Object.fromEntries(
|
|
2245
|
+
onClick: () => downloadJson(exportRows.map((row) => Object.fromEntries(exportColumns.map((column) => [
|
|
1902
2246
|
column.id,
|
|
1903
2247
|
getDataTableExportValue(row, column, store.config.locale)
|
|
1904
2248
|
]))), features.export ? features.export.baseName : "table"),
|
|
1905
2249
|
children: [
|
|
1906
|
-
/* @__PURE__ */
|
|
2250
|
+
/* @__PURE__ */ jsx15(FileJson, {}),
|
|
1907
2251
|
labels.exportJson
|
|
1908
2252
|
]
|
|
1909
2253
|
})
|
|
1910
2254
|
]
|
|
1911
2255
|
}) : null,
|
|
1912
|
-
builtInExport && exportActions.length ? /* @__PURE__ */
|
|
1913
|
-
exportActions.map((action) => /* @__PURE__ */
|
|
2256
|
+
builtInExport && exportActions.length ? /* @__PURE__ */ jsx15(MenubarSeparator, {}) : null,
|
|
2257
|
+
exportActions.map((action) => /* @__PURE__ */ jsxs9(MenubarItem, {
|
|
1914
2258
|
disabled: exporting || action.disabled,
|
|
1915
2259
|
onClick: () => void runExport(action),
|
|
1916
2260
|
children: [
|
|
@@ -1926,7 +2270,7 @@ var DataTableToolbar = ({
|
|
|
1926
2270
|
]
|
|
1927
2271
|
})
|
|
1928
2272
|
}),
|
|
1929
|
-
exportFeature && exportFailed ? /* @__PURE__ */
|
|
2273
|
+
exportFeature && exportFailed ? /* @__PURE__ */ jsx15("p", {
|
|
1930
2274
|
role: "alert",
|
|
1931
2275
|
className: "text-destructive text-sm",
|
|
1932
2276
|
children: labels.exportFailed ?? dataTableMessages(store.config.locale).exportFailed
|
|
@@ -1934,11 +2278,349 @@ var DataTableToolbar = ({
|
|
|
1934
2278
|
]
|
|
1935
2279
|
});
|
|
1936
2280
|
};
|
|
2281
|
+
var withColumnFilter = (state, id, filter) => {
|
|
2282
|
+
const filters = (state.filters ?? []).filter((current) => current.id !== id);
|
|
2283
|
+
if (filter)
|
|
2284
|
+
filters.push(filter);
|
|
2285
|
+
return { ...state, page: 0, filters: filters.length ? filters : undefined };
|
|
2286
|
+
};
|
|
2287
|
+
var FilterEditor = ({
|
|
2288
|
+
column,
|
|
2289
|
+
rows,
|
|
2290
|
+
current,
|
|
2291
|
+
labels,
|
|
2292
|
+
onChange
|
|
2293
|
+
}) => {
|
|
2294
|
+
const inputId = useId2();
|
|
2295
|
+
const kind = getDataTableFilterKind(column);
|
|
2296
|
+
const [primary, setPrimary] = useState(current?.kind === "text" ? current.value : current?.kind === "number" ? String(current.min ?? "") : current?.kind === "date" ? current.from ?? "" : "");
|
|
2297
|
+
const [secondary, setSecondary] = useState(current?.kind === "number" ? String(current.max ?? "") : current?.kind === "date" ? current.to ?? "" : "");
|
|
2298
|
+
const [operator, setOperator] = useState(current?.kind === "text" ? current.operator : "contains");
|
|
2299
|
+
const operatorOptions = [
|
|
2300
|
+
{ value: "contains", label: labels.filterContains },
|
|
2301
|
+
{ value: "equals", label: labels.filterEquals },
|
|
2302
|
+
{ value: "startsWith", label: labels.filterStartsWith },
|
|
2303
|
+
{ value: "endsWith", label: labels.filterEndsWith }
|
|
2304
|
+
];
|
|
2305
|
+
const [invalid, setInvalid] = useState(false);
|
|
2306
|
+
const [optionSearch, setOptionSearch] = useState("");
|
|
2307
|
+
const apply = (candidate) => {
|
|
2308
|
+
const decoded = Schema2.decodeUnknownOption(ColumnFilter)(candidate);
|
|
2309
|
+
if (Option2.isNone(decoded)) {
|
|
2310
|
+
setInvalid(true);
|
|
2311
|
+
return;
|
|
2312
|
+
}
|
|
2313
|
+
setInvalid(false);
|
|
2314
|
+
onChange(decoded.value);
|
|
2315
|
+
};
|
|
2316
|
+
if (kind === "boolean") {
|
|
2317
|
+
return /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
2318
|
+
children: [
|
|
2319
|
+
/* @__PURE__ */ jsxs9(MenubarRadioGroup, {
|
|
2320
|
+
value: current?.kind === "boolean" ? String(current.value) : "",
|
|
2321
|
+
onValueChange: (value) => apply({ id: column.id, kind, value: value === "true" }),
|
|
2322
|
+
children: [
|
|
2323
|
+
/* @__PURE__ */ jsx15(MenubarRadioItem, {
|
|
2324
|
+
value: "true",
|
|
2325
|
+
closeOnClick: false,
|
|
2326
|
+
children: column.colDef.type === "boolean" ? column.colDef.typeOptions?.trueLabel ?? labels.filterTrue : labels.filterTrue
|
|
2327
|
+
}),
|
|
2328
|
+
/* @__PURE__ */ jsx15(MenubarRadioItem, {
|
|
2329
|
+
value: "false",
|
|
2330
|
+
closeOnClick: false,
|
|
2331
|
+
children: column.colDef.type === "boolean" ? column.colDef.typeOptions?.falseLabel ?? labels.filterFalse : labels.filterFalse
|
|
2332
|
+
})
|
|
2333
|
+
]
|
|
2334
|
+
}),
|
|
2335
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2336
|
+
/* @__PURE__ */ jsx15(MenubarItem, {
|
|
2337
|
+
closeOnClick: false,
|
|
2338
|
+
onClick: () => onChange(undefined),
|
|
2339
|
+
children: labels.filterClear
|
|
2340
|
+
})
|
|
2341
|
+
]
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
if (kind === "values") {
|
|
2345
|
+
const selected = current?.kind === "values" ? current.values : [];
|
|
2346
|
+
const options = getDataTableFilterOptions(rows, column);
|
|
2347
|
+
const filteredOptions = options.filter((option) => option.label.toLocaleLowerCase().includes(optionSearch.trim().toLocaleLowerCase()));
|
|
2348
|
+
return /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
2349
|
+
children: [
|
|
2350
|
+
options.length > 8 ? /* @__PURE__ */ jsx15("div", {
|
|
2351
|
+
className: "p-1",
|
|
2352
|
+
children: /* @__PURE__ */ jsx15(Input, {
|
|
2353
|
+
"aria-label": labels.filter,
|
|
2354
|
+
placeholder: labels.filter,
|
|
2355
|
+
value: optionSearch,
|
|
2356
|
+
onChange: (event) => setOptionSearch(event.target.value),
|
|
2357
|
+
onKeyDown: (event) => {
|
|
2358
|
+
if (event.key !== "Escape")
|
|
2359
|
+
event.stopPropagation();
|
|
2360
|
+
}
|
|
2361
|
+
})
|
|
2362
|
+
}) : null,
|
|
2363
|
+
filteredOptions.map((option) => /* @__PURE__ */ jsxs9(MenubarCheckboxItem, {
|
|
2364
|
+
checked: selected.includes(option.value),
|
|
2365
|
+
closeOnClick: false,
|
|
2366
|
+
onCheckedChange: (checked) => {
|
|
2367
|
+
const values = checked ? [...selected, option.value] : selected.filter((value) => value !== option.value);
|
|
2368
|
+
if (values.length)
|
|
2369
|
+
apply({ id: column.id, kind, values });
|
|
2370
|
+
else
|
|
2371
|
+
onChange(undefined);
|
|
2372
|
+
},
|
|
2373
|
+
children: [
|
|
2374
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2375
|
+
className: "min-w-0 flex-1 truncate",
|
|
2376
|
+
children: option.label
|
|
2377
|
+
}),
|
|
2378
|
+
option.count !== undefined ? /* @__PURE__ */ jsx15(Badge, {
|
|
2379
|
+
variant: "secondary",
|
|
2380
|
+
className: "ml-auto shrink-0",
|
|
2381
|
+
children: option.count
|
|
2382
|
+
}) : null
|
|
2383
|
+
]
|
|
2384
|
+
}, option.value)),
|
|
2385
|
+
!filteredOptions.length ? /* @__PURE__ */ jsx15("div", {
|
|
2386
|
+
className: "text-muted-foreground px-2 py-1.5 text-sm",
|
|
2387
|
+
children: labels.empty
|
|
2388
|
+
}) : null,
|
|
2389
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2390
|
+
/* @__PURE__ */ jsx15(MenubarItem, {
|
|
2391
|
+
closeOnClick: false,
|
|
2392
|
+
onClick: () => onChange(undefined),
|
|
2393
|
+
children: labels.filterClear
|
|
2394
|
+
})
|
|
2395
|
+
]
|
|
2396
|
+
});
|
|
2397
|
+
}
|
|
2398
|
+
return /* @__PURE__ */ jsxs9("form", {
|
|
2399
|
+
className: "flex flex-col gap-3 p-2",
|
|
2400
|
+
onKeyDown: (event) => {
|
|
2401
|
+
if (event.key !== "Escape")
|
|
2402
|
+
event.stopPropagation();
|
|
2403
|
+
},
|
|
2404
|
+
onSubmit: (event) => {
|
|
2405
|
+
event.preventDefault();
|
|
2406
|
+
if (kind === "text")
|
|
2407
|
+
apply({ id: column.id, kind, operator, value: primary.trim() });
|
|
2408
|
+
else if (kind === "date")
|
|
2409
|
+
apply({
|
|
2410
|
+
id: column.id,
|
|
2411
|
+
kind,
|
|
2412
|
+
from: primary || undefined,
|
|
2413
|
+
to: secondary || undefined
|
|
2414
|
+
});
|
|
2415
|
+
else {
|
|
2416
|
+
const min = primary ? Schema2.decodeUnknownOption(Schema2.FiniteFromString)(primary) : Option2.some(undefined);
|
|
2417
|
+
const max = secondary ? Schema2.decodeUnknownOption(Schema2.FiniteFromString)(secondary) : Option2.some(undefined);
|
|
2418
|
+
if (Option2.isNone(min) || Option2.isNone(max)) {
|
|
2419
|
+
setInvalid(true);
|
|
2420
|
+
return;
|
|
2421
|
+
}
|
|
2422
|
+
apply({ id: column.id, kind, min: min.value, max: max.value });
|
|
2423
|
+
}
|
|
2424
|
+
},
|
|
2425
|
+
children: [
|
|
2426
|
+
/* @__PURE__ */ jsxs9(FieldGroup, {
|
|
2427
|
+
children: [
|
|
2428
|
+
kind === "text" ? /* @__PURE__ */ jsxs9(Field, {
|
|
2429
|
+
children: [
|
|
2430
|
+
/* @__PURE__ */ jsx15(FieldLabel, {
|
|
2431
|
+
htmlFor: `${inputId}-operator`,
|
|
2432
|
+
children: labels.filterOperator
|
|
2433
|
+
}),
|
|
2434
|
+
/* @__PURE__ */ jsxs9(Select, {
|
|
2435
|
+
items: operatorOptions,
|
|
2436
|
+
value: operator,
|
|
2437
|
+
onValueChange: (value) => {
|
|
2438
|
+
const decoded = Schema2.decodeUnknownOption(TextFilterOperator)(value);
|
|
2439
|
+
if (Option2.isSome(decoded))
|
|
2440
|
+
setOperator(decoded.value);
|
|
2441
|
+
},
|
|
2442
|
+
children: [
|
|
2443
|
+
/* @__PURE__ */ jsx15(SelectTrigger, {
|
|
2444
|
+
id: `${inputId}-operator`,
|
|
2445
|
+
children: /* @__PURE__ */ jsx15(SelectValue, {})
|
|
2446
|
+
}),
|
|
2447
|
+
/* @__PURE__ */ jsx15(SelectContent, {
|
|
2448
|
+
children: /* @__PURE__ */ jsx15(SelectGroup, {
|
|
2449
|
+
children: operatorOptions.map((option) => /* @__PURE__ */ jsx15(SelectItem, {
|
|
2450
|
+
value: option.value,
|
|
2451
|
+
children: option.label
|
|
2452
|
+
}, option.value))
|
|
2453
|
+
})
|
|
2454
|
+
})
|
|
2455
|
+
]
|
|
2456
|
+
})
|
|
2457
|
+
]
|
|
2458
|
+
}) : null,
|
|
2459
|
+
/* @__PURE__ */ jsxs9(Field, {
|
|
2460
|
+
"data-invalid": invalid || undefined,
|
|
2461
|
+
children: [
|
|
2462
|
+
/* @__PURE__ */ jsx15(FieldLabel, {
|
|
2463
|
+
htmlFor: `${inputId}-primary`,
|
|
2464
|
+
children: kind === "text" ? labels.filterValue : kind === "date" ? labels.filterFrom : labels.filterMin
|
|
2465
|
+
}),
|
|
2466
|
+
/* @__PURE__ */ jsx15(Input, {
|
|
2467
|
+
id: `${inputId}-primary`,
|
|
2468
|
+
type: kind === "text" ? "text" : kind === "date" ? "date" : "number",
|
|
2469
|
+
step: kind === "number" ? "any" : undefined,
|
|
2470
|
+
value: primary,
|
|
2471
|
+
"aria-invalid": invalid || undefined,
|
|
2472
|
+
onChange: (event) => {
|
|
2473
|
+
setPrimary(event.target.value);
|
|
2474
|
+
setInvalid(false);
|
|
2475
|
+
}
|
|
2476
|
+
})
|
|
2477
|
+
]
|
|
2478
|
+
}),
|
|
2479
|
+
kind !== "text" ? /* @__PURE__ */ jsxs9(Field, {
|
|
2480
|
+
"data-invalid": invalid || undefined,
|
|
2481
|
+
children: [
|
|
2482
|
+
/* @__PURE__ */ jsx15(FieldLabel, {
|
|
2483
|
+
htmlFor: `${inputId}-secondary`,
|
|
2484
|
+
children: kind === "date" ? labels.filterTo : labels.filterMax
|
|
2485
|
+
}),
|
|
2486
|
+
/* @__PURE__ */ jsx15(Input, {
|
|
2487
|
+
id: `${inputId}-secondary`,
|
|
2488
|
+
type: kind === "date" ? "date" : "number",
|
|
2489
|
+
step: kind === "number" ? "any" : undefined,
|
|
2490
|
+
value: secondary,
|
|
2491
|
+
"aria-invalid": invalid || undefined,
|
|
2492
|
+
onChange: (event) => {
|
|
2493
|
+
setSecondary(event.target.value);
|
|
2494
|
+
setInvalid(false);
|
|
2495
|
+
}
|
|
2496
|
+
})
|
|
2497
|
+
]
|
|
2498
|
+
}) : null
|
|
2499
|
+
]
|
|
2500
|
+
}),
|
|
2501
|
+
invalid ? /* @__PURE__ */ jsx15("p", {
|
|
2502
|
+
role: "alert",
|
|
2503
|
+
className: "text-destructive text-sm",
|
|
2504
|
+
children: labels.filterInvalid
|
|
2505
|
+
}) : null,
|
|
2506
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
2507
|
+
className: "flex gap-2",
|
|
2508
|
+
children: [
|
|
2509
|
+
/* @__PURE__ */ jsx15(Button, {
|
|
2510
|
+
type: "submit",
|
|
2511
|
+
size: "sm",
|
|
2512
|
+
children: labels.filterApply
|
|
2513
|
+
}),
|
|
2514
|
+
/* @__PURE__ */ jsx15(Button, {
|
|
2515
|
+
type: "button",
|
|
2516
|
+
size: "sm",
|
|
2517
|
+
variant: "outline",
|
|
2518
|
+
onClick: () => {
|
|
2519
|
+
setPrimary("");
|
|
2520
|
+
setSecondary("");
|
|
2521
|
+
setInvalid(false);
|
|
2522
|
+
onChange(undefined);
|
|
2523
|
+
},
|
|
2524
|
+
children: labels.filterClear
|
|
2525
|
+
})
|
|
2526
|
+
]
|
|
2527
|
+
})
|
|
2528
|
+
]
|
|
2529
|
+
});
|
|
2530
|
+
};
|
|
2531
|
+
var FilterMenu = ({
|
|
2532
|
+
tableAtom
|
|
2533
|
+
}) => {
|
|
2534
|
+
const [store, setStore] = useTableAtom(tableAtom);
|
|
2535
|
+
const model = deriveModel(store);
|
|
2536
|
+
const columns = model.columns.flatMap((parent) => getDataTableFilterColumns([parent]).map((column) => ({
|
|
2537
|
+
column,
|
|
2538
|
+
label: column.id === parent.id ? columnLabel(column) : `${columnLabel(parent)} / ${columnLabel(column)}`
|
|
2539
|
+
})));
|
|
2540
|
+
if (!columns.length)
|
|
2541
|
+
return null;
|
|
2542
|
+
const filters = store.state.filters ?? [];
|
|
2543
|
+
const update = (id, filter) => changeState(setStore, (state) => withColumnFilter(state, id, filter));
|
|
2544
|
+
return /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
2545
|
+
children: [
|
|
2546
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
2547
|
+
"aria-label": store.config.labels.filters,
|
|
2548
|
+
children: [
|
|
2549
|
+
/* @__PURE__ */ jsx15(ListFilter, {}),
|
|
2550
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2551
|
+
children: store.config.labels.filters
|
|
2552
|
+
}),
|
|
2553
|
+
filters.length ? /* @__PURE__ */ jsx15(Badge, {
|
|
2554
|
+
variant: "secondary",
|
|
2555
|
+
children: filters.length
|
|
2556
|
+
}) : null
|
|
2557
|
+
]
|
|
2558
|
+
}),
|
|
2559
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
2560
|
+
align: "end",
|
|
2561
|
+
className: "w-80 max-w-[calc(100vw-2rem)]",
|
|
2562
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
2563
|
+
children: [
|
|
2564
|
+
/* @__PURE__ */ jsx15(MenubarLabel, {
|
|
2565
|
+
children: store.config.labels.filters
|
|
2566
|
+
}),
|
|
2567
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2568
|
+
columns.map(({ column, label }) => /* @__PURE__ */ jsxs9(MenubarSub, {
|
|
2569
|
+
children: [
|
|
2570
|
+
/* @__PURE__ */ jsxs9(MenubarSubTrigger, {
|
|
2571
|
+
children: [
|
|
2572
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2573
|
+
className: "min-w-0 flex-1 truncate",
|
|
2574
|
+
children: label
|
|
2575
|
+
}),
|
|
2576
|
+
filters.some((filter) => filter.id === column.id) ? /* @__PURE__ */ jsx15(Check, {}) : null
|
|
2577
|
+
]
|
|
2578
|
+
}),
|
|
2579
|
+
/* @__PURE__ */ jsx15(MenubarSubContent, {
|
|
2580
|
+
className: "w-80 max-w-[calc(100vw-2rem)]",
|
|
2581
|
+
children: /* @__PURE__ */ jsx15(FilterEditor, {
|
|
2582
|
+
column,
|
|
2583
|
+
rows: model.rows,
|
|
2584
|
+
current: filters.find((filter) => filter.id === column.id),
|
|
2585
|
+
labels: store.config.labels,
|
|
2586
|
+
onChange: (filter) => update(column.id, filter)
|
|
2587
|
+
})
|
|
2588
|
+
})
|
|
2589
|
+
]
|
|
2590
|
+
}, column.id)),
|
|
2591
|
+
filters.length ? /* @__PURE__ */ jsxs9(Fragment, {
|
|
2592
|
+
children: [
|
|
2593
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2594
|
+
/* @__PURE__ */ jsxs9(MenubarItem, {
|
|
2595
|
+
onClick: () => changeState(setStore, (state) => ({
|
|
2596
|
+
...state,
|
|
2597
|
+
page: 0,
|
|
2598
|
+
filters: undefined
|
|
2599
|
+
})),
|
|
2600
|
+
children: [
|
|
2601
|
+
/* @__PURE__ */ jsx15(X, {}),
|
|
2602
|
+
store.config.labels.filtersClear
|
|
2603
|
+
]
|
|
2604
|
+
})
|
|
2605
|
+
]
|
|
2606
|
+
}) : null
|
|
2607
|
+
]
|
|
2608
|
+
})
|
|
2609
|
+
})
|
|
2610
|
+
]
|
|
2611
|
+
});
|
|
2612
|
+
};
|
|
1937
2613
|
var SortMenu = ({
|
|
1938
2614
|
tableAtom
|
|
1939
2615
|
}) => {
|
|
1940
2616
|
const [store, setStore] = useTableAtom(tableAtom);
|
|
1941
|
-
const columns = deriveModel(store).columns.
|
|
2617
|
+
const columns = deriveModel(store).columns.flatMap((column) => getDataTableSortColumns([column]).map((field) => field.id === column.id ? field : {
|
|
2618
|
+
...field,
|
|
2619
|
+
colDef: {
|
|
2620
|
+
...field.colDef,
|
|
2621
|
+
headerName: `${columnLabel(column)} / ${columnLabel(field)}`
|
|
2622
|
+
}
|
|
2623
|
+
}));
|
|
1942
2624
|
if (!columns.length)
|
|
1943
2625
|
return null;
|
|
1944
2626
|
const current = store.state.sort?.[0];
|
|
@@ -1947,69 +2629,77 @@ var SortMenu = ({
|
|
|
1947
2629
|
sort: [{ id, direction }],
|
|
1948
2630
|
page: 0
|
|
1949
2631
|
}));
|
|
1950
|
-
return /* @__PURE__ */
|
|
2632
|
+
return /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
1951
2633
|
children: [
|
|
1952
|
-
/* @__PURE__ */
|
|
2634
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
1953
2635
|
"aria-label": store.config.labels.sortBy,
|
|
1954
2636
|
children: [
|
|
1955
|
-
current ? current.direction === "desc" ? /* @__PURE__ */
|
|
1956
|
-
/* @__PURE__ */
|
|
2637
|
+
current ? current.direction === "desc" ? /* @__PURE__ */ jsx15(ArrowDown, {}) : /* @__PURE__ */ jsx15(ArrowUp, {}) : /* @__PURE__ */ jsx15(ChevronsUpDown, {}),
|
|
2638
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1957
2639
|
className: "hidden sm:inline",
|
|
1958
2640
|
children: store.config.labels.sortBy
|
|
1959
2641
|
})
|
|
1960
2642
|
]
|
|
1961
2643
|
}),
|
|
1962
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
1963
2645
|
align: "end",
|
|
1964
2646
|
className: "w-52",
|
|
1965
|
-
children:
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
}),
|
|
1975
|
-
/* @__PURE__ */ jsxs8(MenubarSubContent, {
|
|
2647
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
2648
|
+
children: [
|
|
2649
|
+
/* @__PURE__ */ jsx15(MenubarLabel, {
|
|
2650
|
+
children: store.config.labels.sortBy
|
|
2651
|
+
}),
|
|
2652
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2653
|
+
columns.map((column) => {
|
|
2654
|
+
const sortState = store.state.sort?.find(({ id }) => id === column.id);
|
|
2655
|
+
return /* @__PURE__ */ jsxs9(MenubarSub, {
|
|
1976
2656
|
children: [
|
|
1977
|
-
/* @__PURE__ */
|
|
1978
|
-
onClick: () => sort(column.id, "asc"),
|
|
2657
|
+
/* @__PURE__ */ jsxs9(MenubarSubTrigger, {
|
|
1979
2658
|
children: [
|
|
1980
|
-
/* @__PURE__ */
|
|
1981
|
-
|
|
1982
|
-
store.config.labels.sortAsc
|
|
2659
|
+
sortState ? sortState.direction === "desc" ? /* @__PURE__ */ jsx15(ArrowDown, {}) : /* @__PURE__ */ jsx15(ArrowUp, {}) : null,
|
|
2660
|
+
columnLabel(column)
|
|
1983
2661
|
]
|
|
1984
2662
|
}),
|
|
1985
|
-
/* @__PURE__ */
|
|
1986
|
-
onClick: () => sort(column.id, "desc"),
|
|
2663
|
+
/* @__PURE__ */ jsxs9(MenubarSubContent, {
|
|
1987
2664
|
children: [
|
|
1988
|
-
/* @__PURE__ */
|
|
1989
|
-
|
|
1990
|
-
store.config.labels.sortDesc
|
|
1991
|
-
]
|
|
1992
|
-
}),
|
|
1993
|
-
sortState ? /* @__PURE__ */ jsxs8(Fragment, {
|
|
1994
|
-
children: [
|
|
1995
|
-
/* @__PURE__ */ jsx14(MenubarSeparator, {}),
|
|
1996
|
-
/* @__PURE__ */ jsxs8(MenubarItem, {
|
|
1997
|
-
onClick: () => changeState(setStore, (state) => ({
|
|
1998
|
-
...state,
|
|
1999
|
-
sort: state.sort?.filter(({ id }) => id !== column.id)
|
|
2000
|
-
})),
|
|
2665
|
+
/* @__PURE__ */ jsxs9(MenubarItem, {
|
|
2666
|
+
onClick: () => sort(column.id, "asc"),
|
|
2001
2667
|
children: [
|
|
2002
|
-
/* @__PURE__ */
|
|
2668
|
+
/* @__PURE__ */ jsx15(ArrowUp, {}),
|
|
2003
2669
|
" ",
|
|
2004
|
-
store.config.labels.
|
|
2670
|
+
store.config.labels.sortAsc
|
|
2005
2671
|
]
|
|
2006
|
-
})
|
|
2672
|
+
}),
|
|
2673
|
+
/* @__PURE__ */ jsxs9(MenubarItem, {
|
|
2674
|
+
onClick: () => sort(column.id, "desc"),
|
|
2675
|
+
children: [
|
|
2676
|
+
/* @__PURE__ */ jsx15(ArrowDown, {}),
|
|
2677
|
+
" ",
|
|
2678
|
+
store.config.labels.sortDesc
|
|
2679
|
+
]
|
|
2680
|
+
}),
|
|
2681
|
+
sortState ? /* @__PURE__ */ jsxs9(Fragment, {
|
|
2682
|
+
children: [
|
|
2683
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2684
|
+
/* @__PURE__ */ jsxs9(MenubarItem, {
|
|
2685
|
+
onClick: () => changeState(setStore, (state) => ({
|
|
2686
|
+
...state,
|
|
2687
|
+
sort: state.sort?.filter(({ id }) => id !== column.id)
|
|
2688
|
+
})),
|
|
2689
|
+
children: [
|
|
2690
|
+
/* @__PURE__ */ jsx15(X, {}),
|
|
2691
|
+
" ",
|
|
2692
|
+
store.config.labels.sortClear
|
|
2693
|
+
]
|
|
2694
|
+
})
|
|
2695
|
+
]
|
|
2696
|
+
}) : null
|
|
2007
2697
|
]
|
|
2008
|
-
})
|
|
2698
|
+
})
|
|
2009
2699
|
]
|
|
2010
|
-
})
|
|
2011
|
-
|
|
2012
|
-
|
|
2700
|
+
}, column.id);
|
|
2701
|
+
})
|
|
2702
|
+
]
|
|
2013
2703
|
})
|
|
2014
2704
|
})
|
|
2015
2705
|
]
|
|
@@ -2019,42 +2709,50 @@ var ViewMenu = ({
|
|
|
2019
2709
|
tableAtom
|
|
2020
2710
|
}) => {
|
|
2021
2711
|
const [store, setStore] = useTableAtom(tableAtom);
|
|
2022
|
-
return /* @__PURE__ */
|
|
2712
|
+
return /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
2023
2713
|
children: [
|
|
2024
|
-
/* @__PURE__ */
|
|
2714
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
2025
2715
|
"aria-label": store.config.labels.view,
|
|
2026
2716
|
children: [
|
|
2027
|
-
store.state.view === "gallery" ? /* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2717
|
+
store.state.view === "gallery" ? /* @__PURE__ */ jsx15(LayoutGrid, {}) : /* @__PURE__ */ jsx15(Rows3, {}),
|
|
2718
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2029
2719
|
className: "hidden sm:inline",
|
|
2030
2720
|
children: store.config.labels.view
|
|
2031
2721
|
})
|
|
2032
2722
|
]
|
|
2033
2723
|
}),
|
|
2034
|
-
/* @__PURE__ */
|
|
2724
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
2035
2725
|
align: "end",
|
|
2036
|
-
children: /* @__PURE__ */
|
|
2037
|
-
onValueChange: (view) => {
|
|
2038
|
-
if (view === "table" || view === "gallery") {
|
|
2039
|
-
changeState(setStore, (state) => ({ ...state, view }));
|
|
2040
|
-
}
|
|
2041
|
-
},
|
|
2042
|
-
value: store.state.view,
|
|
2726
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
2043
2727
|
children: [
|
|
2044
|
-
/* @__PURE__ */
|
|
2045
|
-
|
|
2046
|
-
children: [
|
|
2047
|
-
/* @__PURE__ */ jsx14(Rows3, {}),
|
|
2048
|
-
" ",
|
|
2049
|
-
store.config.labels.tableView
|
|
2050
|
-
]
|
|
2728
|
+
/* @__PURE__ */ jsx15(MenubarLabel, {
|
|
2729
|
+
children: store.config.labels.view
|
|
2051
2730
|
}),
|
|
2052
|
-
/* @__PURE__ */
|
|
2053
|
-
|
|
2731
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2732
|
+
/* @__PURE__ */ jsxs9(MenubarRadioGroup, {
|
|
2733
|
+
onValueChange: (view) => {
|
|
2734
|
+
if (view === "table" || view === "gallery") {
|
|
2735
|
+
changeState(setStore, (state) => ({ ...state, view }));
|
|
2736
|
+
}
|
|
2737
|
+
},
|
|
2738
|
+
value: store.state.view,
|
|
2054
2739
|
children: [
|
|
2055
|
-
/* @__PURE__ */
|
|
2056
|
-
|
|
2057
|
-
|
|
2740
|
+
/* @__PURE__ */ jsxs9(MenubarRadioItem, {
|
|
2741
|
+
value: "table",
|
|
2742
|
+
children: [
|
|
2743
|
+
/* @__PURE__ */ jsx15(Rows3, {}),
|
|
2744
|
+
" ",
|
|
2745
|
+
store.config.labels.tableView
|
|
2746
|
+
]
|
|
2747
|
+
}),
|
|
2748
|
+
/* @__PURE__ */ jsxs9(MenubarRadioItem, {
|
|
2749
|
+
value: "gallery",
|
|
2750
|
+
children: [
|
|
2751
|
+
/* @__PURE__ */ jsx15(LayoutGrid, {}),
|
|
2752
|
+
" ",
|
|
2753
|
+
store.config.labels.galleryView
|
|
2754
|
+
]
|
|
2755
|
+
})
|
|
2058
2756
|
]
|
|
2059
2757
|
})
|
|
2060
2758
|
]
|
|
@@ -2070,27 +2768,27 @@ var ColumnMenu = ({
|
|
|
2070
2768
|
const columns = deriveModel(store).columns.filter(({ colDef }) => colDef.hideable !== false);
|
|
2071
2769
|
if (!columns.length)
|
|
2072
2770
|
return null;
|
|
2073
|
-
return /* @__PURE__ */
|
|
2771
|
+
return /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
2074
2772
|
children: [
|
|
2075
|
-
/* @__PURE__ */
|
|
2773
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
2076
2774
|
"aria-label": store.config.labels.columns,
|
|
2077
2775
|
children: [
|
|
2078
|
-
/* @__PURE__ */
|
|
2079
|
-
/* @__PURE__ */
|
|
2776
|
+
/* @__PURE__ */ jsx15(Settings2, {}),
|
|
2777
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2080
2778
|
className: "hidden sm:inline",
|
|
2081
2779
|
children: store.config.labels.columns
|
|
2082
2780
|
})
|
|
2083
2781
|
]
|
|
2084
2782
|
}),
|
|
2085
|
-
/* @__PURE__ */
|
|
2783
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
2086
2784
|
align: "end",
|
|
2087
|
-
children: /* @__PURE__ */
|
|
2785
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
2088
2786
|
children: [
|
|
2089
|
-
/* @__PURE__ */
|
|
2787
|
+
/* @__PURE__ */ jsx15(MenubarLabel, {
|
|
2090
2788
|
children: store.config.labels.columns
|
|
2091
2789
|
}),
|
|
2092
|
-
/* @__PURE__ */
|
|
2093
|
-
columns.map((column) => /* @__PURE__ */
|
|
2790
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2791
|
+
columns.map((column) => /* @__PURE__ */ jsx15(MenubarCheckboxItem, {
|
|
2094
2792
|
checked: store.state.columnVisibility[column.id] !== false,
|
|
2095
2793
|
onCheckedChange: (visible) => changeState(setStore, (state) => ({
|
|
2096
2794
|
...state,
|
|
@@ -2143,7 +2841,7 @@ var ResizeHandle = ({
|
|
|
2143
2841
|
const reset = () => {
|
|
2144
2842
|
resizeRef.current = null;
|
|
2145
2843
|
};
|
|
2146
|
-
return /* @__PURE__ */
|
|
2844
|
+
return /* @__PURE__ */ jsx15("button", {
|
|
2147
2845
|
"aria-label": store.config.labels.resizeColumn(columnLabel(column)),
|
|
2148
2846
|
"aria-orientation": "vertical",
|
|
2149
2847
|
"aria-valuemax": column.colDef.maxWidth ?? DEFAULT_MAX_WIDTH,
|
|
@@ -2265,9 +2963,9 @@ var DragHandle = ({
|
|
|
2265
2963
|
reordering.onReorder(reorderDataTableRows(model.rows, rowId, target.id));
|
|
2266
2964
|
}
|
|
2267
2965
|
};
|
|
2268
|
-
return /* @__PURE__ */
|
|
2966
|
+
return /* @__PURE__ */ jsxs9(Fragment, {
|
|
2269
2967
|
children: [
|
|
2270
|
-
/* @__PURE__ */
|
|
2968
|
+
/* @__PURE__ */ jsx15(Button, {
|
|
2271
2969
|
"aria-label": store.config.features.reordering && store.config.features.reordering.handleLabel ? store.config.features.reordering.handleLabel : store.config.labels.reorder,
|
|
2272
2970
|
className: "size-8 cursor-grab touch-none active:cursor-grabbing",
|
|
2273
2971
|
onClick: (event) => event.stopPropagation(),
|
|
@@ -2285,9 +2983,9 @@ var DragHandle = ({
|
|
|
2285
2983
|
onPointerUp: finish,
|
|
2286
2984
|
size: "icon",
|
|
2287
2985
|
variant: "ghost",
|
|
2288
|
-
children: /* @__PURE__ */
|
|
2986
|
+
children: /* @__PURE__ */ jsx15(GripVertical, {})
|
|
2289
2987
|
}),
|
|
2290
|
-
overlay ? createPortal(/* @__PURE__ */
|
|
2988
|
+
overlay ? createPortal(/* @__PURE__ */ jsx15("div", {
|
|
2291
2989
|
"aria-hidden": "true",
|
|
2292
2990
|
className: "bg-background pointer-events-none fixed z-[100] rounded-md border px-3 py-2 text-sm shadow-lg",
|
|
2293
2991
|
style: { left: overlay.x + 12, top: overlay.y + 12 },
|
|
@@ -2317,8 +3015,8 @@ var TableDataRow = ({
|
|
|
2317
3015
|
const selection = store.config.features.selection;
|
|
2318
3016
|
const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
|
|
2319
3017
|
const draggable = canDragRows(store);
|
|
2320
|
-
return /* @__PURE__ */
|
|
2321
|
-
className: cn("group/row
|
|
3018
|
+
return /* @__PURE__ */ jsxs9(TableRow, {
|
|
3019
|
+
className: cn("group/row data-[drop-position=before]:[&>td]:border-primary data-[drop-position=after]:[&>td]:border-primary h-16 data-[drag-source=true]:opacity-40 data-[drop-position=after]:[&>td]:border-b-2 data-[drop-position=before]:[&>td]:border-t-2", store.config.onRowClicked && "cursor-pointer"),
|
|
2322
3020
|
"data-state": store.state.rowSelection[row.id] && "selected",
|
|
2323
3021
|
"data-table-row": row.id,
|
|
2324
3022
|
onClick: () => store.config.onRowClicked?.(row.data),
|
|
@@ -2330,36 +3028,36 @@ var TableDataRow = ({
|
|
|
2330
3028
|
},
|
|
2331
3029
|
tabIndex: store.config.onRowClicked ? 0 : undefined,
|
|
2332
3030
|
children: [
|
|
2333
|
-
selection ? /* @__PURE__ */
|
|
3031
|
+
selection ? /* @__PURE__ */ jsx15(TableCell, {
|
|
2334
3032
|
className: "w-10 pr-0",
|
|
2335
3033
|
onClick: (event) => event.stopPropagation(),
|
|
2336
|
-
children: /* @__PURE__ */
|
|
3034
|
+
children: /* @__PURE__ */ jsx15(Checkbox, {
|
|
2337
3035
|
"aria-label": store.config.labels.selectRow,
|
|
2338
3036
|
checked: !!store.state.rowSelection[row.id],
|
|
2339
3037
|
disabled: !selectable,
|
|
2340
3038
|
onCheckedChange: (checked) => toggleRow(store, setStore, row.id, checked)
|
|
2341
3039
|
})
|
|
2342
3040
|
}) : null,
|
|
2343
|
-
draggable ? /* @__PURE__ */
|
|
3041
|
+
draggable ? /* @__PURE__ */ jsx15(TableCell, {
|
|
2344
3042
|
className: "w-10 pr-0",
|
|
2345
|
-
children: /* @__PURE__ */
|
|
3043
|
+
children: /* @__PURE__ */ jsx15(DragHandle, {
|
|
2346
3044
|
tableAtom
|
|
2347
3045
|
})
|
|
2348
3046
|
}) : null,
|
|
2349
|
-
model.visibleColumns.map((column) => /* @__PURE__ */
|
|
2350
|
-
className: cn("min-w-24 overflow-hidden has-[[data-slot=data-table-
|
|
3047
|
+
model.visibleColumns.map((column) => /* @__PURE__ */ jsx15(TableCell, {
|
|
3048
|
+
className: cn("min-w-24 overflow-hidden has-[[data-slot=data-table-boolean-cell]]:relative has-[[data-slot=data-table-boolean-cell]]:p-0 has-[[data-slot=data-table-list-cell]]:relative has-[[data-slot=data-table-list-cell]]:p-0", column.colDef.truncate ? "whitespace-nowrap" : "whitespace-normal"),
|
|
2351
3049
|
style: { width: column.width },
|
|
2352
|
-
children: /* @__PURE__ */
|
|
3050
|
+
children: /* @__PURE__ */ jsx15("div", {
|
|
2353
3051
|
className: cn("min-w-0", column.colDef.truncate && "truncate"),
|
|
2354
3052
|
children: renderCell(row, column, store.config.locale, store.config.labels)
|
|
2355
3053
|
})
|
|
2356
3054
|
}, column.id)),
|
|
2357
|
-
hasRowActionMenu(store) ? /* @__PURE__ */
|
|
3055
|
+
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15(TableCell, {
|
|
2358
3056
|
className: "bg-background group-data-[state=selected]/row:bg-muted sticky right-0 z-20 w-10 min-w-10 cursor-default p-0 transition-colors group-hover/row:bg-[color-mix(in_oklab,var(--muted)_50%,var(--background))]",
|
|
2359
3057
|
onClick: (event) => event.stopPropagation(),
|
|
2360
|
-
children: /* @__PURE__ */
|
|
3058
|
+
children: /* @__PURE__ */ jsx15("div", {
|
|
2361
3059
|
className: "flex h-16 items-center justify-center",
|
|
2362
|
-
children: /* @__PURE__ */
|
|
3060
|
+
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
2363
3061
|
tableAtom
|
|
2364
3062
|
})
|
|
2365
3063
|
})
|
|
@@ -2375,26 +3073,26 @@ var GroupActions = ({
|
|
|
2375
3073
|
const visible = actions?.filter((action) => !action.visible || action.visible(groupId));
|
|
2376
3074
|
if (!visible?.length)
|
|
2377
3075
|
return null;
|
|
2378
|
-
return /* @__PURE__ */
|
|
3076
|
+
return /* @__PURE__ */ jsxs9(DropdownMenu, {
|
|
2379
3077
|
children: [
|
|
2380
|
-
/* @__PURE__ */
|
|
3078
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger, {
|
|
2381
3079
|
onClick: (event) => event.stopPropagation(),
|
|
2382
|
-
render: /* @__PURE__ */
|
|
3080
|
+
render: /* @__PURE__ */ jsxs9(Button, {
|
|
2383
3081
|
size: "icon",
|
|
2384
3082
|
variant: "ghost",
|
|
2385
3083
|
children: [
|
|
2386
|
-
/* @__PURE__ */
|
|
3084
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2387
3085
|
className: "sr-only",
|
|
2388
3086
|
children: title
|
|
2389
3087
|
}),
|
|
2390
|
-
/* @__PURE__ */
|
|
3088
|
+
/* @__PURE__ */ jsx15(MoreHorizontal, {})
|
|
2391
3089
|
]
|
|
2392
3090
|
})
|
|
2393
3091
|
}),
|
|
2394
|
-
/* @__PURE__ */
|
|
3092
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent, {
|
|
2395
3093
|
align: "end",
|
|
2396
|
-
children: /* @__PURE__ */
|
|
2397
|
-
children: visible.map((action) => /* @__PURE__ */
|
|
3094
|
+
children: /* @__PURE__ */ jsx15(DropdownMenuGroup, {
|
|
3095
|
+
children: visible.map((action) => /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
2398
3096
|
onClick: () => action.onClick(groupId),
|
|
2399
3097
|
variant: action.variant ?? "default",
|
|
2400
3098
|
children: [
|
|
@@ -2425,40 +3123,40 @@ var GroupedTable = ({
|
|
|
2425
3123
|
[section.key]: !collapsed
|
|
2426
3124
|
}
|
|
2427
3125
|
}));
|
|
2428
|
-
const body = /* @__PURE__ */
|
|
3126
|
+
const body = /* @__PURE__ */ jsxs9(TableBody, {
|
|
2429
3127
|
className: "data-[drop-target=true]:outline-primary relative data-[drop-target=true]:z-30 data-[drop-target=true]:outline-2 data-[drop-target=true]:-outline-offset-2 data-[drop-target=true]:[&>tr]:border-transparent data-[drop-target=true]:[&>tr>td:last-child]:z-0",
|
|
2430
3128
|
"data-table-group": section.field.onMoveToGroup ? targetKey : undefined,
|
|
2431
3129
|
children: [
|
|
2432
|
-
/* @__PURE__ */
|
|
3130
|
+
/* @__PURE__ */ jsx15(TableRow, {
|
|
2433
3131
|
className: "bg-muted/40 hover:bg-accent! cursor-pointer",
|
|
2434
3132
|
onClick: toggleCollapsed,
|
|
2435
|
-
children: /* @__PURE__ */
|
|
3133
|
+
children: /* @__PURE__ */ jsx15(TableCell, {
|
|
2436
3134
|
colSpan: model.visibleColumns.length + extra,
|
|
2437
|
-
children: /* @__PURE__ */
|
|
3135
|
+
children: /* @__PURE__ */ jsxs9("div", {
|
|
2438
3136
|
className: "flex items-center gap-2",
|
|
2439
3137
|
style: { paddingLeft: section.depth * 20 },
|
|
2440
3138
|
children: [
|
|
2441
|
-
/* @__PURE__ */
|
|
3139
|
+
/* @__PURE__ */ jsxs9("button", {
|
|
2442
3140
|
"aria-expanded": !collapsed,
|
|
2443
3141
|
className: "flex flex-1 cursor-pointer items-center gap-2 text-left font-medium",
|
|
2444
3142
|
type: "button",
|
|
2445
3143
|
children: [
|
|
2446
|
-
collapsed ? /* @__PURE__ */
|
|
3144
|
+
collapsed ? /* @__PURE__ */ jsx15(ChevronRight2, {
|
|
2447
3145
|
className: "size-4"
|
|
2448
|
-
}) : /* @__PURE__ */
|
|
3146
|
+
}) : /* @__PURE__ */ jsx15(ChevronDown, {
|
|
2449
3147
|
className: "size-4"
|
|
2450
3148
|
}),
|
|
2451
|
-
/* @__PURE__ */
|
|
3149
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2452
3150
|
className: "flex-1",
|
|
2453
3151
|
children: section.field.renderGroupLabel?.(section.groupId, section.rows.map((row) => row.data)) ?? section.groupId
|
|
2454
3152
|
})
|
|
2455
3153
|
]
|
|
2456
3154
|
}),
|
|
2457
|
-
/* @__PURE__ */
|
|
3155
|
+
/* @__PURE__ */ jsx15(Badge, {
|
|
2458
3156
|
variant: "secondary",
|
|
2459
3157
|
children: section.rows.length
|
|
2460
3158
|
}),
|
|
2461
|
-
/* @__PURE__ */
|
|
3159
|
+
/* @__PURE__ */ jsx15(GroupActions, {
|
|
2462
3160
|
actions: section.field.actions,
|
|
2463
3161
|
groupId: section.groupId,
|
|
2464
3162
|
title: section.field.actionsLabel ?? store.config.labels.actions
|
|
@@ -2467,14 +3165,14 @@ var GroupedTable = ({
|
|
|
2467
3165
|
})
|
|
2468
3166
|
})
|
|
2469
3167
|
}),
|
|
2470
|
-
!collapsed && !section.children.length ? section.rows.length ? section.rows.map((row) => /* @__PURE__ */
|
|
3168
|
+
!collapsed && !section.children.length ? section.rows.length ? section.rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
|
|
2471
3169
|
value: row.id,
|
|
2472
|
-
children: /* @__PURE__ */
|
|
3170
|
+
children: /* @__PURE__ */ jsx15(TableDataRow, {
|
|
2473
3171
|
tableAtom
|
|
2474
3172
|
})
|
|
2475
3173
|
}, `${section.key}:${row.id}`)) : [
|
|
2476
|
-
/* @__PURE__ */
|
|
2477
|
-
children: /* @__PURE__ */
|
|
3174
|
+
/* @__PURE__ */ jsx15(TableRow, {
|
|
3175
|
+
children: /* @__PURE__ */ jsx15(TableCell, {
|
|
2478
3176
|
className: "text-muted-foreground h-16",
|
|
2479
3177
|
colSpan: model.visibleColumns.length + extra,
|
|
2480
3178
|
children: section.field.renderEmptyGroup?.(section.groupId) ?? store.config.labels.empty
|
|
@@ -2485,7 +3183,7 @@ var GroupedTable = ({
|
|
|
2485
3183
|
}, section.key);
|
|
2486
3184
|
return !collapsed && section.children.length ? [body, renderSections(section.children)] : [body];
|
|
2487
3185
|
});
|
|
2488
|
-
return /* @__PURE__ */
|
|
3186
|
+
return /* @__PURE__ */ jsx15(Fragment, {
|
|
2489
3187
|
children: renderSections(sections)
|
|
2490
3188
|
});
|
|
2491
3189
|
};
|
|
@@ -2494,79 +3192,159 @@ var ColumnHeaderMenu = ({
|
|
|
2494
3192
|
}) => {
|
|
2495
3193
|
const [store, setStore] = useTableAtom(tableAtom);
|
|
2496
3194
|
const columnId = useRequiredId(ColumnIdContext);
|
|
2497
|
-
const
|
|
3195
|
+
const model = deriveModel(store);
|
|
3196
|
+
const column = model.columns.find(({ id }) => id === columnId);
|
|
2498
3197
|
if (!column)
|
|
2499
3198
|
return null;
|
|
2500
|
-
const
|
|
3199
|
+
const sortColumns = getDataTableSortColumns([column]);
|
|
3200
|
+
const filterColumns = getDataTableFilterColumns([column]);
|
|
3201
|
+
const filteringEnabled = store.config.features.filtering !== false && filterColumns.length > 0;
|
|
3202
|
+
const ownsFilter = (id) => id === column.id || getDataTableFieldColumns(column).some((field) => field.id === id);
|
|
3203
|
+
const activeFilters = (store.state.filters ?? []).filter(({ id }) => ownsFilter(id));
|
|
3204
|
+
const filterEditor = (field) => /* @__PURE__ */ jsx15(FilterEditor, {
|
|
3205
|
+
column: field,
|
|
3206
|
+
rows: model.rows,
|
|
3207
|
+
current: store.state.filters?.find((filter) => filter.id === field.id),
|
|
3208
|
+
labels: store.config.labels,
|
|
3209
|
+
onChange: (filter) => changeState(setStore, (state) => withColumnFilter(state, field.id, filter))
|
|
3210
|
+
});
|
|
3211
|
+
const sortingEnabled = store.config.features.sorting !== false && sortColumns.length > 0;
|
|
2501
3212
|
const hidingEnabled = store.config.features.columnVisibility !== false && column.colDef.hideable !== false;
|
|
2502
|
-
const
|
|
3213
|
+
const ownsSort = (id) => id === column.id || sortColumns.some((field) => field.id === id);
|
|
3214
|
+
const sort = store.state.sort?.find(({ id }) => ownsSort(id));
|
|
2503
3215
|
const update = (next) => changeState(setStore, next);
|
|
2504
|
-
const setSort = (direction) => update((state) => ({
|
|
3216
|
+
const setSort = (id, direction) => update((state) => ({
|
|
2505
3217
|
...state,
|
|
2506
|
-
sort: [{ id
|
|
3218
|
+
sort: [{ id, direction }],
|
|
2507
3219
|
page: 0
|
|
2508
3220
|
}));
|
|
2509
3221
|
const label = columnLabel(column);
|
|
2510
|
-
|
|
2511
|
-
|
|
3222
|
+
const sortItems = (field) => /* @__PURE__ */ jsxs9(Fragment, {
|
|
3223
|
+
children: [
|
|
3224
|
+
/* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
3225
|
+
onClick: () => setSort(field.id, "asc"),
|
|
3226
|
+
children: [
|
|
3227
|
+
/* @__PURE__ */ jsx15(ArrowUp, {}),
|
|
3228
|
+
" ",
|
|
3229
|
+
store.config.labels.sortAsc
|
|
3230
|
+
]
|
|
3231
|
+
}),
|
|
3232
|
+
/* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
3233
|
+
onClick: () => setSort(field.id, "desc"),
|
|
3234
|
+
children: [
|
|
3235
|
+
/* @__PURE__ */ jsx15(ArrowDown, {}),
|
|
3236
|
+
" ",
|
|
3237
|
+
store.config.labels.sortDesc
|
|
3238
|
+
]
|
|
3239
|
+
})
|
|
3240
|
+
]
|
|
3241
|
+
});
|
|
3242
|
+
if (!sortingEnabled && !hidingEnabled && !filteringEnabled) {
|
|
3243
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2512
3244
|
className: "truncate px-2",
|
|
2513
3245
|
children: column.colDef.headerName
|
|
2514
3246
|
});
|
|
2515
3247
|
}
|
|
2516
|
-
return /* @__PURE__ */
|
|
3248
|
+
return /* @__PURE__ */ jsxs9(DropdownMenu, {
|
|
2517
3249
|
children: [
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
render: /* @__PURE__ */
|
|
3250
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger, {
|
|
3251
|
+
render: /* @__PURE__ */ jsxs9(Button, {
|
|
2520
3252
|
"aria-label": label,
|
|
3253
|
+
"aria-description": activeFilters.length ? `${store.config.labels.filters}: ${activeFilters.length}` : undefined,
|
|
2521
3254
|
className: "absolute inset-0 h-full w-full min-w-0 justify-start rounded-none px-2 pr-4 focus-visible:ring-inset",
|
|
2522
3255
|
variant: "ghost",
|
|
2523
3256
|
children: [
|
|
2524
|
-
/* @__PURE__ */
|
|
3257
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2525
3258
|
className: "truncate",
|
|
2526
3259
|
children: column.colDef.headerName
|
|
2527
3260
|
}),
|
|
2528
|
-
|
|
3261
|
+
activeFilters.length ? /* @__PURE__ */ jsx15(ListFilter, {}) : null,
|
|
3262
|
+
sort ? sort.direction === "desc" ? /* @__PURE__ */ jsx15(ArrowDown, {}) : /* @__PURE__ */ jsx15(ArrowUp, {}) : null
|
|
2529
3263
|
]
|
|
2530
3264
|
})
|
|
2531
3265
|
}),
|
|
2532
|
-
/* @__PURE__ */
|
|
3266
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent, {
|
|
2533
3267
|
align: "start",
|
|
2534
3268
|
className: "w-48",
|
|
2535
|
-
children: /* @__PURE__ */
|
|
3269
|
+
children: /* @__PURE__ */ jsxs9(DropdownMenuGroup, {
|
|
2536
3270
|
children: [
|
|
2537
|
-
sortingEnabled ? /* @__PURE__ */
|
|
3271
|
+
sortingEnabled ? /* @__PURE__ */ jsxs9(Fragment, {
|
|
2538
3272
|
children: [
|
|
2539
|
-
/* @__PURE__ */
|
|
2540
|
-
onClick: () => setSort("asc"),
|
|
3273
|
+
column.colDef.fields?.length ? sortColumns.map((field) => /* @__PURE__ */ jsxs9(DropdownMenuSub, {
|
|
2541
3274
|
children: [
|
|
2542
|
-
/* @__PURE__ */
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
/* @__PURE__ */ jsx14(ArrowDown, {}),
|
|
2551
|
-
" ",
|
|
2552
|
-
store.config.labels.sortDesc
|
|
3275
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubTrigger, {
|
|
3276
|
+
children: columnLabel(field)
|
|
3277
|
+
}),
|
|
3278
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubContent, {
|
|
3279
|
+
children: /* @__PURE__ */ jsx15(DropdownMenuGroup, {
|
|
3280
|
+
children: sortItems(field)
|
|
3281
|
+
})
|
|
3282
|
+
})
|
|
2553
3283
|
]
|
|
2554
|
-
}),
|
|
2555
|
-
sort ? /* @__PURE__ */
|
|
3284
|
+
}, field.id)) : sortItems(column),
|
|
3285
|
+
sort ? /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
2556
3286
|
onClick: () => update((state) => ({
|
|
2557
3287
|
...state,
|
|
2558
|
-
sort: state.sort?.filter(({ id }) => id
|
|
3288
|
+
sort: state.sort?.filter(({ id }) => !ownsSort(id))
|
|
2559
3289
|
})),
|
|
2560
3290
|
children: [
|
|
2561
|
-
/* @__PURE__ */
|
|
3291
|
+
/* @__PURE__ */ jsx15(X, {}),
|
|
2562
3292
|
" ",
|
|
2563
3293
|
store.config.labels.sortClear
|
|
2564
3294
|
]
|
|
2565
3295
|
}) : null
|
|
2566
3296
|
]
|
|
2567
3297
|
}) : null,
|
|
2568
|
-
sortingEnabled &&
|
|
2569
|
-
|
|
3298
|
+
sortingEnabled && filteringEnabled ? /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}) : null,
|
|
3299
|
+
filteringEnabled ? /* @__PURE__ */ jsxs9(Fragment, {
|
|
3300
|
+
children: [
|
|
3301
|
+
/* @__PURE__ */ jsxs9(DropdownMenuSub, {
|
|
3302
|
+
children: [
|
|
3303
|
+
/* @__PURE__ */ jsxs9(DropdownMenuSubTrigger, {
|
|
3304
|
+
children: [
|
|
3305
|
+
/* @__PURE__ */ jsx15(ListFilter, {}),
|
|
3306
|
+
store.config.labels.filters
|
|
3307
|
+
]
|
|
3308
|
+
}),
|
|
3309
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubContent, {
|
|
3310
|
+
className: "w-80 max-w-[calc(100vw-2rem)]",
|
|
3311
|
+
children: column.colDef.fields?.length ? /* @__PURE__ */ jsx15(DropdownMenuGroup, {
|
|
3312
|
+
children: filterColumns.map((field) => /* @__PURE__ */ jsxs9(DropdownMenuSub, {
|
|
3313
|
+
children: [
|
|
3314
|
+
/* @__PURE__ */ jsxs9(DropdownMenuSubTrigger, {
|
|
3315
|
+
children: [
|
|
3316
|
+
columnLabel(field),
|
|
3317
|
+
activeFilters.some((filter) => filter.id === field.id) ? /* @__PURE__ */ jsx15(Check, {}) : null
|
|
3318
|
+
]
|
|
3319
|
+
}),
|
|
3320
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubContent, {
|
|
3321
|
+
className: "w-80 max-w-[calc(100vw-2rem)]",
|
|
3322
|
+
children: filterEditor(field)
|
|
3323
|
+
})
|
|
3324
|
+
]
|
|
3325
|
+
}, field.id))
|
|
3326
|
+
}) : filterEditor(column)
|
|
3327
|
+
})
|
|
3328
|
+
]
|
|
3329
|
+
}),
|
|
3330
|
+
activeFilters.length ? /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
3331
|
+
onClick: () => update((state) => {
|
|
3332
|
+
const filters = state.filters?.filter(({ id }) => !ownsFilter(id));
|
|
3333
|
+
return {
|
|
3334
|
+
...state,
|
|
3335
|
+
page: 0,
|
|
3336
|
+
filters: filters?.length ? filters : undefined
|
|
3337
|
+
};
|
|
3338
|
+
}),
|
|
3339
|
+
children: [
|
|
3340
|
+
/* @__PURE__ */ jsx15(X, {}),
|
|
3341
|
+
store.config.labels.filterClear
|
|
3342
|
+
]
|
|
3343
|
+
}) : null
|
|
3344
|
+
]
|
|
3345
|
+
}) : null,
|
|
3346
|
+
(sortingEnabled || filteringEnabled) && hidingEnabled ? /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}) : null,
|
|
3347
|
+
hidingEnabled ? /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
2570
3348
|
onClick: () => update((state) => ({
|
|
2571
3349
|
...state,
|
|
2572
3350
|
columnVisibility: {
|
|
@@ -2575,7 +3353,7 @@ var ColumnHeaderMenu = ({
|
|
|
2575
3353
|
}
|
|
2576
3354
|
})),
|
|
2577
3355
|
children: [
|
|
2578
|
-
/* @__PURE__ */
|
|
3356
|
+
/* @__PURE__ */ jsx15(EyeOff, {}),
|
|
2579
3357
|
" ",
|
|
2580
3358
|
store.config.labels.hideColumn
|
|
2581
3359
|
]
|
|
@@ -2597,12 +3375,12 @@ var DataTableHeader = ({
|
|
|
2597
3375
|
const selectableRows = getDataTableSelectableRows(model, grouped, selection ? selection.isRowSelectable : undefined);
|
|
2598
3376
|
const allSelected = selectableRows.length > 0 && selectableRows.every((row) => store.state.rowSelection[row.id]);
|
|
2599
3377
|
const someSelected = selectableRows.some((row) => store.state.rowSelection[row.id]);
|
|
2600
|
-
return /* @__PURE__ */
|
|
2601
|
-
children: /* @__PURE__ */
|
|
3378
|
+
return /* @__PURE__ */ jsx15(TableHeader, {
|
|
3379
|
+
children: /* @__PURE__ */ jsxs9(TableRow, {
|
|
2602
3380
|
children: [
|
|
2603
|
-
selection ? /* @__PURE__ */
|
|
3381
|
+
selection ? /* @__PURE__ */ jsx15(TableHead, {
|
|
2604
3382
|
className: "w-10 pr-0",
|
|
2605
|
-
children: /* @__PURE__ */
|
|
3383
|
+
children: /* @__PURE__ */ jsx15(Checkbox, {
|
|
2606
3384
|
"aria-label": store.config.labels.selectAllRows,
|
|
2607
3385
|
checked: allSelected,
|
|
2608
3386
|
indeterminate: someSelected && !allSelected,
|
|
@@ -2616,30 +3394,30 @@ var DataTableHeader = ({
|
|
|
2616
3394
|
}
|
|
2617
3395
|
})
|
|
2618
3396
|
}) : null,
|
|
2619
|
-
draggable ? /* @__PURE__ */
|
|
3397
|
+
draggable ? /* @__PURE__ */ jsx15(TableHead, {
|
|
2620
3398
|
className: "w-10"
|
|
2621
3399
|
}) : null,
|
|
2622
3400
|
model.visibleColumns.map((column) => {
|
|
2623
3401
|
const direction = store.state.sort?.find(({ id }) => id === column.id)?.direction;
|
|
2624
|
-
return /* @__PURE__ */
|
|
3402
|
+
return /* @__PURE__ */ jsx15(TableHead, {
|
|
2625
3403
|
"aria-sort": direction === "asc" ? "ascending" : direction === "desc" ? "descending" : undefined,
|
|
2626
3404
|
className: "relative h-12 p-0",
|
|
2627
3405
|
scope: "col",
|
|
2628
3406
|
style: { width: column.width },
|
|
2629
|
-
children: /* @__PURE__ */
|
|
3407
|
+
children: /* @__PURE__ */ jsxs9(ColumnIdContext.Provider, {
|
|
2630
3408
|
value: column.id,
|
|
2631
3409
|
children: [
|
|
2632
|
-
/* @__PURE__ */
|
|
3410
|
+
/* @__PURE__ */ jsx15(ColumnHeaderMenu, {
|
|
2633
3411
|
tableAtom
|
|
2634
3412
|
}),
|
|
2635
|
-
/* @__PURE__ */
|
|
3413
|
+
/* @__PURE__ */ jsx15(ResizeHandle, {
|
|
2636
3414
|
tableAtom
|
|
2637
3415
|
})
|
|
2638
3416
|
]
|
|
2639
3417
|
})
|
|
2640
3418
|
}, column.id);
|
|
2641
3419
|
}),
|
|
2642
|
-
hasRowActionMenu(store) ? /* @__PURE__ */
|
|
3420
|
+
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15(TableHead, {
|
|
2643
3421
|
className: "w-10"
|
|
2644
3422
|
}) : null
|
|
2645
3423
|
]
|
|
@@ -2657,29 +3435,29 @@ var DataTableBody = ({
|
|
|
2657
3435
|
const sections = groupDataTableRows(rows, fields);
|
|
2658
3436
|
const colSpan = model.visibleColumns.length + (store.config.features.selection ? 1 : 0) + (hasRowActionMenu(store) ? 1 : 0) + (canDragRows(store) ? 1 : 0);
|
|
2659
3437
|
if (sections.length && (rows.length || !store.config.status.loading) && !store.config.status.error) {
|
|
2660
|
-
return /* @__PURE__ */
|
|
3438
|
+
return /* @__PURE__ */ jsx15(GroupedTable, {
|
|
2661
3439
|
tableAtom,
|
|
2662
3440
|
sections
|
|
2663
3441
|
});
|
|
2664
3442
|
}
|
|
2665
|
-
return /* @__PURE__ */
|
|
2666
|
-
children: store.config.status.error || !rows.length && !store.config.status.loading ? /* @__PURE__ */
|
|
2667
|
-
children: /* @__PURE__ */
|
|
3443
|
+
return /* @__PURE__ */ jsx15(TableBody, {
|
|
3444
|
+
children: store.config.status.error || !rows.length && !store.config.status.loading ? /* @__PURE__ */ jsx15(TableRow, {
|
|
3445
|
+
children: /* @__PURE__ */ jsx15(TableCell, {
|
|
2668
3446
|
className: "h-24 text-center",
|
|
2669
3447
|
colSpan: Math.max(colSpan, 1),
|
|
2670
3448
|
children: store.config.status.error ?? store.config.status.empty ?? store.config.labels.empty
|
|
2671
3449
|
})
|
|
2672
|
-
}) : store.config.status.loading && !rows.length ? /* @__PURE__ */
|
|
2673
|
-
children: /* @__PURE__ */
|
|
3450
|
+
}) : store.config.status.loading && !rows.length ? /* @__PURE__ */ jsx15(TableRow, {
|
|
3451
|
+
children: /* @__PURE__ */ jsx15(TableCell, {
|
|
2674
3452
|
className: "h-24 text-center",
|
|
2675
3453
|
colSpan: Math.max(colSpan, 1),
|
|
2676
|
-
children: /* @__PURE__ */
|
|
3454
|
+
children: /* @__PURE__ */ jsx15(Loading, {
|
|
2677
3455
|
label: store.config.labels.loading
|
|
2678
3456
|
})
|
|
2679
3457
|
})
|
|
2680
|
-
}) : rows.map((row) => /* @__PURE__ */
|
|
3458
|
+
}) : rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
|
|
2681
3459
|
value: row.id,
|
|
2682
|
-
children: /* @__PURE__ */
|
|
3460
|
+
children: /* @__PURE__ */ jsx15(TableDataRow, {
|
|
2683
3461
|
tableAtom
|
|
2684
3462
|
})
|
|
2685
3463
|
}, row.id))
|
|
@@ -2702,8 +3480,8 @@ var GalleryCard = ({
|
|
|
2702
3480
|
const selection = store.config.features.selection;
|
|
2703
3481
|
const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
|
|
2704
3482
|
const draggable = canDragRows(store);
|
|
2705
|
-
return /* @__PURE__ */
|
|
2706
|
-
className: cn("
|
|
3483
|
+
return /* @__PURE__ */ jsx15(Card, {
|
|
3484
|
+
className: cn("data-[drop-position=before]:border-t-primary data-[drop-position=after]:border-b-primary relative gap-3 data-[drag-source=true]:opacity-40 data-[drop-position=after]:border-b-2 data-[drop-position=before]:border-t-2", store.config.onRowClicked && "cursor-pointer"),
|
|
2707
3485
|
"data-table-row": row.id,
|
|
2708
3486
|
onClick: () => store.config.onRowClicked?.(row.data),
|
|
2709
3487
|
onKeyDown: (event) => {
|
|
@@ -2713,23 +3491,23 @@ var GalleryCard = ({
|
|
|
2713
3491
|
}
|
|
2714
3492
|
},
|
|
2715
3493
|
tabIndex: store.config.onRowClicked ? 0 : undefined,
|
|
2716
|
-
children: /* @__PURE__ */
|
|
3494
|
+
children: /* @__PURE__ */ jsxs9(CardHeader, {
|
|
2717
3495
|
className: "pr-12",
|
|
2718
3496
|
children: [
|
|
2719
|
-
/* @__PURE__ */
|
|
3497
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
2720
3498
|
className: "flex items-center gap-2",
|
|
2721
3499
|
children: [
|
|
2722
|
-
selection ? /* @__PURE__ */
|
|
3500
|
+
selection ? /* @__PURE__ */ jsx15(Checkbox, {
|
|
2723
3501
|
"aria-label": store.config.labels.selectRow,
|
|
2724
3502
|
checked: !!store.state.rowSelection[row.id],
|
|
2725
3503
|
disabled: !selectable,
|
|
2726
3504
|
onCheckedChange: (checked) => toggleRow(store, setStore, row.id, checked),
|
|
2727
3505
|
onClick: (event) => event.stopPropagation()
|
|
2728
3506
|
}) : null,
|
|
2729
|
-
draggable ? /* @__PURE__ */
|
|
3507
|
+
draggable ? /* @__PURE__ */ jsx15(DragHandle, {
|
|
2730
3508
|
tableAtom
|
|
2731
3509
|
}) : null,
|
|
2732
|
-
tag ? /* @__PURE__ */
|
|
3510
|
+
tag ? /* @__PURE__ */ jsxs9(Badge, {
|
|
2733
3511
|
variant: "secondary",
|
|
2734
3512
|
children: [
|
|
2735
3513
|
gallery.tagIcon,
|
|
@@ -2738,17 +3516,17 @@ var GalleryCard = ({
|
|
|
2738
3516
|
}) : null
|
|
2739
3517
|
]
|
|
2740
3518
|
}),
|
|
2741
|
-
/* @__PURE__ */
|
|
3519
|
+
/* @__PURE__ */ jsx15(CardTitle, {
|
|
2742
3520
|
children: name ? renderCell(row, name, store.config.locale, store.config.labels) : row.id
|
|
2743
3521
|
}),
|
|
2744
|
-
description ? /* @__PURE__ */
|
|
3522
|
+
description ? /* @__PURE__ */ jsx15("div", {
|
|
2745
3523
|
className: "text-muted-foreground line-clamp-3 text-sm",
|
|
2746
3524
|
children: renderCell(row, description, store.config.locale, store.config.labels)
|
|
2747
3525
|
}) : null,
|
|
2748
|
-
hasRowActionMenu(store) ? /* @__PURE__ */
|
|
3526
|
+
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15("div", {
|
|
2749
3527
|
className: "absolute top-4 right-4",
|
|
2750
3528
|
onClick: (event) => event.stopPropagation(),
|
|
2751
|
-
children: /* @__PURE__ */
|
|
3529
|
+
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
2752
3530
|
tableAtom
|
|
2753
3531
|
})
|
|
2754
3532
|
}) : null
|
|
@@ -2765,31 +3543,31 @@ var DataTableGallery = ({
|
|
|
2765
3543
|
const rows = fields.length ? model.sortedRows : model.pageRows;
|
|
2766
3544
|
const sections = groupDataTableRows(rows, fields);
|
|
2767
3545
|
if (store.config.status.error) {
|
|
2768
|
-
return /* @__PURE__ */
|
|
3546
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2769
3547
|
className: "text-destructive rounded-lg border border-dashed p-10 text-center",
|
|
2770
3548
|
children: store.config.status.error
|
|
2771
3549
|
});
|
|
2772
3550
|
}
|
|
2773
3551
|
if (store.config.status.loading && !rows.length) {
|
|
2774
|
-
return /* @__PURE__ */
|
|
3552
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2775
3553
|
className: "rounded-lg border border-dashed p-10 text-center",
|
|
2776
|
-
children: /* @__PURE__ */
|
|
3554
|
+
children: /* @__PURE__ */ jsx15(Loading, {
|
|
2777
3555
|
label: store.config.labels.loading
|
|
2778
3556
|
})
|
|
2779
3557
|
});
|
|
2780
3558
|
}
|
|
2781
3559
|
if (!rows.length && !sections.length) {
|
|
2782
|
-
return /* @__PURE__ */
|
|
3560
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2783
3561
|
className: "text-muted-foreground rounded-lg border border-dashed p-10 text-center",
|
|
2784
3562
|
children: store.config.status.empty ?? store.config.labels.empty
|
|
2785
3563
|
});
|
|
2786
3564
|
}
|
|
2787
3565
|
if (!fields.length) {
|
|
2788
|
-
return /* @__PURE__ */
|
|
3566
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2789
3567
|
className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
|
|
2790
|
-
children: rows.map((row) => /* @__PURE__ */
|
|
3568
|
+
children: rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
|
|
2791
3569
|
value: row.id,
|
|
2792
|
-
children: /* @__PURE__ */
|
|
3570
|
+
children: /* @__PURE__ */ jsx15(GalleryCard, {
|
|
2793
3571
|
tableAtom
|
|
2794
3572
|
})
|
|
2795
3573
|
}, row.id))
|
|
@@ -2805,57 +3583,57 @@ var DataTableGallery = ({
|
|
|
2805
3583
|
[section.key]: !collapsed
|
|
2806
3584
|
}
|
|
2807
3585
|
}));
|
|
2808
|
-
return /* @__PURE__ */
|
|
3586
|
+
return /* @__PURE__ */ jsxs9("section", {
|
|
2809
3587
|
className: "data-[drop-target=true]:ring-primary space-y-3 rounded-lg transition-shadow data-[drop-target=true]:ring-2",
|
|
2810
3588
|
"data-table-group": section.field.onMoveToGroup ? targetKey : undefined,
|
|
2811
3589
|
children: [
|
|
2812
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
2813
3591
|
className: "hover:bg-accent flex cursor-pointer items-center gap-2 rounded-lg border p-3 transition-colors",
|
|
2814
3592
|
onClick: toggleCollapsed,
|
|
2815
3593
|
children: [
|
|
2816
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsxs9("button", {
|
|
2817
3595
|
"aria-expanded": !collapsed,
|
|
2818
3596
|
className: "flex flex-1 cursor-pointer items-center gap-2 text-left font-medium",
|
|
2819
3597
|
type: "button",
|
|
2820
3598
|
children: [
|
|
2821
|
-
collapsed ? /* @__PURE__ */
|
|
3599
|
+
collapsed ? /* @__PURE__ */ jsx15(ChevronRight2, {
|
|
2822
3600
|
className: "size-4"
|
|
2823
|
-
}) : /* @__PURE__ */
|
|
3601
|
+
}) : /* @__PURE__ */ jsx15(ChevronDown, {
|
|
2824
3602
|
className: "size-4"
|
|
2825
3603
|
}),
|
|
2826
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2827
3605
|
className: "flex-1",
|
|
2828
3606
|
children: section.field.renderGroupLabel?.(section.groupId, section.rows.map((row) => row.data)) ?? section.groupId
|
|
2829
3607
|
}),
|
|
2830
|
-
/* @__PURE__ */
|
|
3608
|
+
/* @__PURE__ */ jsx15(Badge, {
|
|
2831
3609
|
variant: "secondary",
|
|
2832
3610
|
children: section.rows.length
|
|
2833
3611
|
})
|
|
2834
3612
|
]
|
|
2835
3613
|
}),
|
|
2836
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ jsx15(GroupActions, {
|
|
2837
3615
|
actions: section.field.actions,
|
|
2838
3616
|
groupId: section.groupId,
|
|
2839
3617
|
title: section.field.actionsLabel ?? store.config.labels.actions
|
|
2840
3618
|
})
|
|
2841
3619
|
]
|
|
2842
3620
|
}),
|
|
2843
|
-
!collapsed ? section.children.length ? renderSections(section.children) : section.rows.length ? /* @__PURE__ */
|
|
3621
|
+
!collapsed ? section.children.length ? renderSections(section.children) : section.rows.length ? /* @__PURE__ */ jsx15("div", {
|
|
2844
3622
|
className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
|
|
2845
|
-
children: section.rows.map((row) => /* @__PURE__ */
|
|
3623
|
+
children: section.rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
|
|
2846
3624
|
value: row.id,
|
|
2847
|
-
children: /* @__PURE__ */
|
|
3625
|
+
children: /* @__PURE__ */ jsx15(GalleryCard, {
|
|
2848
3626
|
tableAtom
|
|
2849
3627
|
})
|
|
2850
3628
|
}, `${section.key}:${row.id}`))
|
|
2851
|
-
}) : /* @__PURE__ */
|
|
3629
|
+
}) : /* @__PURE__ */ jsx15("div", {
|
|
2852
3630
|
className: "text-muted-foreground rounded-lg border border-dashed p-8 text-center",
|
|
2853
3631
|
children: section.field.renderEmptyGroup?.(section.groupId) ?? store.config.labels.empty
|
|
2854
3632
|
}) : null
|
|
2855
3633
|
]
|
|
2856
3634
|
}, section.key);
|
|
2857
3635
|
});
|
|
2858
|
-
return /* @__PURE__ */
|
|
3636
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2859
3637
|
className: "space-y-4",
|
|
2860
3638
|
children: renderSections(sections)
|
|
2861
3639
|
});
|
|
@@ -2882,9 +3660,9 @@ var DataTablePagination = ({
|
|
|
2882
3660
|
return null;
|
|
2883
3661
|
const selected = model.rows.filter((row) => store.state.rowSelection[row.id]).length;
|
|
2884
3662
|
const setPagination = (next) => changeState(setStore, (state) => ({ ...state, ...next }));
|
|
2885
|
-
return /* @__PURE__ */
|
|
3663
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2886
3664
|
className: "pt-4",
|
|
2887
|
-
children: /* @__PURE__ */
|
|
3665
|
+
children: /* @__PURE__ */ jsx15(Pagination, {
|
|
2888
3666
|
locale: store.config.locale,
|
|
2889
3667
|
messages: { [store.config.locale]: store.config.labels },
|
|
2890
3668
|
onPageChange: (page) => setPagination({ page, pageSize: store.state.pageSize }),
|
|
@@ -2909,7 +3687,7 @@ var HydratedDataTable = ({
|
|
|
2909
3687
|
});
|
|
2910
3688
|
const [transientUiAtom] = useState(() => Atom.make(transientUiFromState(DEFAULT_UI_STATE)));
|
|
2911
3689
|
const [transientUiState, setTransientUiState] = useAtom(transientUiAtom);
|
|
2912
|
-
const uiState =
|
|
3690
|
+
const uiState = useMemo2(() => ({
|
|
2913
3691
|
...persistedUiState,
|
|
2914
3692
|
...transientUiState,
|
|
2915
3693
|
grouping: persistedUiState.grouping ?? initialGrouping
|
|
@@ -2978,17 +3756,17 @@ var HydratedDataTable = ({
|
|
|
2978
3756
|
setUiState,
|
|
2979
3757
|
uiState
|
|
2980
3758
|
]);
|
|
2981
|
-
return /* @__PURE__ */
|
|
3759
|
+
return /* @__PURE__ */ jsxs9("div", {
|
|
2982
3760
|
className: "w-full max-w-full min-w-0 rounded-md",
|
|
2983
3761
|
"data-table-root": "",
|
|
2984
3762
|
children: [
|
|
2985
|
-
/* @__PURE__ */
|
|
3763
|
+
/* @__PURE__ */ jsx15(DataTableToolbar, {
|
|
2986
3764
|
tableAtom
|
|
2987
3765
|
}),
|
|
2988
|
-
/* @__PURE__ */
|
|
3766
|
+
/* @__PURE__ */ jsx15(DataTableContent, {
|
|
2989
3767
|
tableAtom
|
|
2990
3768
|
}),
|
|
2991
|
-
/* @__PURE__ */
|
|
3769
|
+
/* @__PURE__ */ jsx15(DataTablePagination, {
|
|
2992
3770
|
tableAtom
|
|
2993
3771
|
})
|
|
2994
3772
|
]
|
|
@@ -3013,7 +3791,7 @@ var DataTable = (props) => {
|
|
|
3013
3791
|
});
|
|
3014
3792
|
});
|
|
3015
3793
|
const [persistedUiResult, setPersistedUiState] = useAtom(persistedUiAtom);
|
|
3016
|
-
const persistedUiState =
|
|
3794
|
+
const persistedUiState = useMemo2(() => AsyncResult.isSuccess(persistedUiResult) ? {
|
|
3017
3795
|
...persistedUiResult.value,
|
|
3018
3796
|
columnVisibility: {
|
|
3019
3797
|
...initialColumnVisibility,
|
|
@@ -3021,13 +3799,13 @@ var DataTable = (props) => {
|
|
|
3021
3799
|
}
|
|
3022
3800
|
} : undefined, [initialColumnVisibility, persistedUiResult]);
|
|
3023
3801
|
if (!persistedUiState || AsyncResult.isWaiting(persistedUiResult)) {
|
|
3024
|
-
return /* @__PURE__ */
|
|
3802
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
3025
3803
|
"aria-busy": "true",
|
|
3026
3804
|
className: "invisible w-full max-w-full min-w-0 rounded-md",
|
|
3027
3805
|
"data-table-root": ""
|
|
3028
3806
|
});
|
|
3029
3807
|
}
|
|
3030
|
-
return /* @__PURE__ */
|
|
3808
|
+
return /* @__PURE__ */ jsx15(HydratedDataTable, {
|
|
3031
3809
|
...props,
|
|
3032
3810
|
locale,
|
|
3033
3811
|
persistedUiState,
|
|
@@ -3039,28 +3817,28 @@ var DataTableContent = ({
|
|
|
3039
3817
|
}) => {
|
|
3040
3818
|
const [store] = useTableAtom(tableAtom);
|
|
3041
3819
|
if (store.config.features.gallery && store.state.view === "gallery") {
|
|
3042
|
-
return /* @__PURE__ */
|
|
3820
|
+
return /* @__PURE__ */ jsx15(DataTableGallery, {
|
|
3043
3821
|
tableAtom
|
|
3044
3822
|
});
|
|
3045
3823
|
}
|
|
3046
3824
|
const model = deriveModel(store);
|
|
3047
3825
|
const width = getDataTableWidth(model.visibleColumns, (store.config.features.selection ? 1 : 0) + (hasRowActionMenu(store) ? 1 : 0) + (canDragRows(store) ? 1 : 0));
|
|
3048
|
-
return /* @__PURE__ */
|
|
3826
|
+
return /* @__PURE__ */ jsxs9(ScrollArea, {
|
|
3049
3827
|
className: "max-w-full min-w-0",
|
|
3050
3828
|
children: [
|
|
3051
|
-
/* @__PURE__ */
|
|
3829
|
+
/* @__PURE__ */ jsxs9(Table, {
|
|
3052
3830
|
className: "table-fixed",
|
|
3053
3831
|
style: { width: `max(100%, ${width}px)` },
|
|
3054
3832
|
children: [
|
|
3055
|
-
/* @__PURE__ */
|
|
3833
|
+
/* @__PURE__ */ jsx15(DataTableHeader, {
|
|
3056
3834
|
tableAtom
|
|
3057
3835
|
}),
|
|
3058
|
-
/* @__PURE__ */
|
|
3836
|
+
/* @__PURE__ */ jsx15(DataTableBody, {
|
|
3059
3837
|
tableAtom
|
|
3060
3838
|
})
|
|
3061
3839
|
]
|
|
3062
3840
|
}),
|
|
3063
|
-
/* @__PURE__ */
|
|
3841
|
+
/* @__PURE__ */ jsx15(ScrollBar, {
|
|
3064
3842
|
orientation: "horizontal"
|
|
3065
3843
|
})
|
|
3066
3844
|
]
|
|
@@ -3070,7 +3848,7 @@ var DataTableListCell = (props) => {
|
|
|
3070
3848
|
const locale = useKrakstackLocale3(props.locale);
|
|
3071
3849
|
const resolvedProps = { ...props, locale };
|
|
3072
3850
|
if (resolvedProps.options && (resolvedProps.onAdd || resolvedProps.onRemove)) {
|
|
3073
|
-
return /* @__PURE__ */
|
|
3851
|
+
return /* @__PURE__ */ jsx15(EditableDataTableListCell, {
|
|
3074
3852
|
...resolvedProps
|
|
3075
3853
|
});
|
|
3076
3854
|
}
|
|
@@ -3078,17 +3856,17 @@ var DataTableListCell = (props) => {
|
|
|
3078
3856
|
const labels = dataTableMessages(locale, resolvedProps.messages);
|
|
3079
3857
|
const hasItems = resolvedProps.items.length > 0;
|
|
3080
3858
|
if (!itemActions?.length && !hasItems) {
|
|
3081
|
-
return /* @__PURE__ */
|
|
3859
|
+
return /* @__PURE__ */ jsx15(DataTableListSummary, {
|
|
3082
3860
|
...summaryProps
|
|
3083
3861
|
});
|
|
3084
3862
|
}
|
|
3085
3863
|
const menuLabel = actionsLabel ?? (itemActions?.length ? labels.actions : labels.listDetails);
|
|
3086
|
-
return /* @__PURE__ */
|
|
3864
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
3087
3865
|
className: "grid min-h-16 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0",
|
|
3088
3866
|
"data-slot": "data-table-list-cell",
|
|
3089
3867
|
onClick: (event) => event.stopPropagation(),
|
|
3090
3868
|
onPointerDown: (event) => event.stopPropagation(),
|
|
3091
|
-
children: /* @__PURE__ */
|
|
3869
|
+
children: /* @__PURE__ */ jsx15(DataTableListMenu, {
|
|
3092
3870
|
actions: itemActions ?? [],
|
|
3093
3871
|
display: resolvedProps.display,
|
|
3094
3872
|
force: hasItems,
|
|
@@ -3097,16 +3875,16 @@ var DataTableListCell = (props) => {
|
|
|
3097
3875
|
locale,
|
|
3098
3876
|
messages: resolvedProps.messages,
|
|
3099
3877
|
onItemClick,
|
|
3100
|
-
trigger: /* @__PURE__ */
|
|
3878
|
+
trigger: /* @__PURE__ */ jsxs9(Button, {
|
|
3101
3879
|
"aria-label": menuLabel,
|
|
3102
3880
|
className: "h-full w-full min-w-0 justify-between rounded-none px-2 focus-visible:ring-inset",
|
|
3103
3881
|
variant: "ghost",
|
|
3104
3882
|
children: [
|
|
3105
|
-
/* @__PURE__ */
|
|
3883
|
+
/* @__PURE__ */ jsx15(DataTableListSummaryContent, {
|
|
3106
3884
|
...summaryProps,
|
|
3107
3885
|
showMenu: false
|
|
3108
3886
|
}),
|
|
3109
|
-
/* @__PURE__ */
|
|
3887
|
+
/* @__PURE__ */ jsx15(ChevronDown, {})
|
|
3110
3888
|
]
|
|
3111
3889
|
})
|
|
3112
3890
|
})
|
|
@@ -3142,7 +3920,7 @@ var EditableDataTableListCell = ({
|
|
|
3142
3920
|
id: "data-table-list-remove",
|
|
3143
3921
|
closeOnClick: false,
|
|
3144
3922
|
name: labels.removeItem,
|
|
3145
|
-
icon: /* @__PURE__ */
|
|
3923
|
+
icon: /* @__PURE__ */ jsx15(Trash2, {}),
|
|
3146
3924
|
variant: "destructive",
|
|
3147
3925
|
onClick: (item) => {
|
|
3148
3926
|
if (item.value === undefined)
|
|
@@ -3153,12 +3931,12 @@ var EditableDataTableListCell = ({
|
|
|
3153
3931
|
}
|
|
3154
3932
|
] : []
|
|
3155
3933
|
];
|
|
3156
|
-
return /* @__PURE__ */
|
|
3934
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
3157
3935
|
"data-slot": "data-table-list-cell",
|
|
3158
3936
|
className: "grid min-h-16 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0",
|
|
3159
3937
|
onClick: (event) => event.stopPropagation(),
|
|
3160
3938
|
onPointerDown: (event) => event.stopPropagation(),
|
|
3161
|
-
children: /* @__PURE__ */
|
|
3939
|
+
children: /* @__PURE__ */ jsx15(DataTableListMenu, {
|
|
3162
3940
|
actions,
|
|
3163
3941
|
addEmptyLabel: emptyLabel,
|
|
3164
3942
|
addLabel: labels.addItem,
|
|
@@ -3175,12 +3953,12 @@ var EditableDataTableListCell = ({
|
|
|
3175
3953
|
onAdd(item.value);
|
|
3176
3954
|
setSelected((current) => [...current, item]);
|
|
3177
3955
|
} : undefined,
|
|
3178
|
-
trigger: /* @__PURE__ */
|
|
3956
|
+
trigger: /* @__PURE__ */ jsxs9(Button, {
|
|
3179
3957
|
"aria-label": manageLabel,
|
|
3180
3958
|
className: "h-full w-full min-w-0 justify-between rounded-none px-2 focus-visible:ring-inset",
|
|
3181
3959
|
variant: "ghost",
|
|
3182
3960
|
children: [
|
|
3183
|
-
/* @__PURE__ */
|
|
3961
|
+
/* @__PURE__ */ jsx15(DataTableListSummaryContent, {
|
|
3184
3962
|
emptyLabel,
|
|
3185
3963
|
items: selected,
|
|
3186
3964
|
display,
|
|
@@ -3188,7 +3966,7 @@ var EditableDataTableListCell = ({
|
|
|
3188
3966
|
visibleCount,
|
|
3189
3967
|
totalCount: selectedTotal
|
|
3190
3968
|
}),
|
|
3191
|
-
/* @__PURE__ */
|
|
3969
|
+
/* @__PURE__ */ jsx15(ChevronDown, {})
|
|
3192
3970
|
]
|
|
3193
3971
|
})
|
|
3194
3972
|
})
|
|
@@ -3212,7 +3990,7 @@ var DataTableListMenu = ({
|
|
|
3212
3990
|
trigger
|
|
3213
3991
|
}) => {
|
|
3214
3992
|
const entries = items.map((item) => {
|
|
3215
|
-
const normalized =
|
|
3993
|
+
const normalized = Schema2.is(Schema2.String)(item) ? { label: item } : item;
|
|
3216
3994
|
const visibleActions = actions.filter((action) => action.visible?.(normalized) ?? true);
|
|
3217
3995
|
return { item: normalized, visibleActions };
|
|
3218
3996
|
});
|
|
@@ -3221,41 +3999,41 @@ var DataTableListMenu = ({
|
|
|
3221
3999
|
return null;
|
|
3222
4000
|
const labels = dataTableMessages(locale, messages);
|
|
3223
4001
|
const resolvedLabel = label ?? (hasActions ? labels.actions : labels.listDetails);
|
|
3224
|
-
return /* @__PURE__ */
|
|
4002
|
+
return /* @__PURE__ */ jsxs9(DropdownMenu, {
|
|
3225
4003
|
children: [
|
|
3226
|
-
/* @__PURE__ */
|
|
4004
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger, {
|
|
3227
4005
|
onClick: (event) => event.stopPropagation(),
|
|
3228
4006
|
onPointerDown: (event) => event.stopPropagation(),
|
|
3229
|
-
render: trigger ?? /* @__PURE__ */
|
|
4007
|
+
render: trigger ?? /* @__PURE__ */ jsx15(Button, {
|
|
3230
4008
|
"aria-label": resolvedLabel,
|
|
3231
4009
|
className: cn("size-8 shrink-0", className),
|
|
3232
4010
|
size: "icon",
|
|
3233
4011
|
variant: "ghost",
|
|
3234
|
-
children: /* @__PURE__ */
|
|
4012
|
+
children: /* @__PURE__ */ jsx15(MoreHorizontal, {})
|
|
3235
4013
|
})
|
|
3236
4014
|
}),
|
|
3237
|
-
/* @__PURE__ */
|
|
4015
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent, {
|
|
3238
4016
|
align: "end",
|
|
3239
4017
|
className: "max-h-[min(18rem,var(--available-height))] w-72 max-w-[calc(100vw-2rem)]",
|
|
3240
4018
|
onClick: (event) => event.stopPropagation(),
|
|
3241
4019
|
onPointerDown: (event) => event.stopPropagation(),
|
|
3242
|
-
children: /* @__PURE__ */
|
|
4020
|
+
children: /* @__PURE__ */ jsxs9(DropdownMenuGroup, {
|
|
3243
4021
|
children: [
|
|
3244
|
-
/* @__PURE__ */
|
|
4022
|
+
/* @__PURE__ */ jsx15(DropdownMenuLabel, {
|
|
3245
4023
|
children: resolvedLabel
|
|
3246
4024
|
}),
|
|
3247
|
-
/* @__PURE__ */
|
|
3248
|
-
entries.map(({ item, visibleActions }, index) => visibleActions.length ? /* @__PURE__ */
|
|
4025
|
+
/* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
|
|
4026
|
+
entries.map(({ item, visibleActions }, index) => visibleActions.length ? /* @__PURE__ */ jsxs9(DropdownMenuSub, {
|
|
3249
4027
|
children: [
|
|
3250
|
-
/* @__PURE__ */
|
|
3251
|
-
children: /* @__PURE__ */
|
|
4028
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubTrigger, {
|
|
4029
|
+
children: /* @__PURE__ */ jsx15(DataTableListEntry, {
|
|
3252
4030
|
item,
|
|
3253
4031
|
appearance: display === "icon" ? "detail" : "list"
|
|
3254
4032
|
})
|
|
3255
4033
|
}),
|
|
3256
|
-
/* @__PURE__ */
|
|
4034
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubContent, {
|
|
3257
4035
|
className: "w-max",
|
|
3258
|
-
children: visibleActions.map((action) => /* @__PURE__ */
|
|
4036
|
+
children: visibleActions.map((action) => /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
3259
4037
|
closeOnClick: action.closeOnClick,
|
|
3260
4038
|
disabled: action.disabled?.(item),
|
|
3261
4039
|
onClick: (event) => {
|
|
@@ -3270,21 +4048,21 @@ var DataTableListMenu = ({
|
|
|
3270
4048
|
}, action.id ?? action.name))
|
|
3271
4049
|
})
|
|
3272
4050
|
]
|
|
3273
|
-
}, item.value ?? `${item.label}-${index}`) : /* @__PURE__ */
|
|
4051
|
+
}, item.value ?? `${item.label}-${index}`) : /* @__PURE__ */ jsx15(DropdownMenuItem, {
|
|
3274
4052
|
closeOnClick: Boolean(onItemClick),
|
|
3275
4053
|
onClick: (event) => {
|
|
3276
4054
|
event.stopPropagation();
|
|
3277
4055
|
onItemClick?.(item);
|
|
3278
4056
|
},
|
|
3279
|
-
children: /* @__PURE__ */
|
|
4057
|
+
children: /* @__PURE__ */ jsx15(DataTableListEntry, {
|
|
3280
4058
|
item,
|
|
3281
4059
|
appearance: display === "icon" ? "detail" : "list"
|
|
3282
4060
|
})
|
|
3283
4061
|
}, item.value ?? `${item.label}-${index}`)),
|
|
3284
|
-
onAdd && addOptions?.length ? /* @__PURE__ */
|
|
4062
|
+
onAdd && addOptions?.length ? /* @__PURE__ */ jsxs9(Fragment, {
|
|
3285
4063
|
children: [
|
|
3286
|
-
entries.length ? /* @__PURE__ */
|
|
3287
|
-
/* @__PURE__ */
|
|
4064
|
+
entries.length ? /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}) : null,
|
|
4065
|
+
/* @__PURE__ */ jsx15(DataTableListAddMenu, {
|
|
3288
4066
|
emptyLabel: addEmptyLabel,
|
|
3289
4067
|
label: addLabel ?? labels.addItem,
|
|
3290
4068
|
locale,
|
|
@@ -3319,28 +4097,28 @@ var DataTableListAddMenu = ({
|
|
|
3319
4097
|
const labels = dataTableMessages(locale, messages);
|
|
3320
4098
|
const normalizedSearch = search.trim().toLocaleLowerCase(locale);
|
|
3321
4099
|
const filtered = normalizedSearch ? options.filter((item) => item.label.toLocaleLowerCase(locale).includes(normalizedSearch)) : options;
|
|
3322
|
-
return /* @__PURE__ */
|
|
4100
|
+
return /* @__PURE__ */ jsxs9(DropdownMenuSub, {
|
|
3323
4101
|
onOpenChange: (open) => {
|
|
3324
4102
|
if (!open)
|
|
3325
4103
|
setSearch("");
|
|
3326
4104
|
},
|
|
3327
4105
|
children: [
|
|
3328
|
-
/* @__PURE__ */
|
|
4106
|
+
/* @__PURE__ */ jsxs9(DropdownMenuSubTrigger, {
|
|
3329
4107
|
children: [
|
|
3330
|
-
/* @__PURE__ */
|
|
4108
|
+
/* @__PURE__ */ jsx15(Plus, {}),
|
|
3331
4109
|
label
|
|
3332
4110
|
]
|
|
3333
4111
|
}),
|
|
3334
|
-
/* @__PURE__ */
|
|
4112
|
+
/* @__PURE__ */ jsxs9(DropdownMenuSubContent, {
|
|
3335
4113
|
className: "w-64",
|
|
3336
4114
|
children: [
|
|
3337
|
-
/* @__PURE__ */
|
|
4115
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
3338
4116
|
className: "relative p-1",
|
|
3339
4117
|
children: [
|
|
3340
|
-
/* @__PURE__ */
|
|
4118
|
+
/* @__PURE__ */ jsx15(Search, {
|
|
3341
4119
|
className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2"
|
|
3342
4120
|
}),
|
|
3343
|
-
/* @__PURE__ */
|
|
4121
|
+
/* @__PURE__ */ jsx15(Input, {
|
|
3344
4122
|
"aria-label": searchLabel,
|
|
3345
4123
|
className: "h-8 pl-8",
|
|
3346
4124
|
onChange: (event) => setSearch(event.target.value),
|
|
@@ -3354,15 +4132,15 @@ var DataTableListAddMenu = ({
|
|
|
3354
4132
|
})
|
|
3355
4133
|
]
|
|
3356
4134
|
}),
|
|
3357
|
-
/* @__PURE__ */
|
|
3358
|
-
filtered.length ? filtered.map((item) => /* @__PURE__ */
|
|
4135
|
+
/* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
|
|
4136
|
+
filtered.length ? filtered.map((item) => /* @__PURE__ */ jsx15(DropdownMenuItem, {
|
|
3359
4137
|
closeOnClick: false,
|
|
3360
4138
|
onClick: () => onAdd(item),
|
|
3361
|
-
children: /* @__PURE__ */
|
|
4139
|
+
children: /* @__PURE__ */ jsx15(DataTableListEntry, {
|
|
3362
4140
|
item,
|
|
3363
4141
|
appearance: display === "icon" ? "detail" : "list"
|
|
3364
4142
|
})
|
|
3365
|
-
}, item.value)) : /* @__PURE__ */
|
|
4143
|
+
}, item.value)) : /* @__PURE__ */ jsx15("div", {
|
|
3366
4144
|
className: "text-muted-foreground px-2 py-1.5 text-sm",
|
|
3367
4145
|
children: emptyLabel
|
|
3368
4146
|
})
|
|
@@ -3381,31 +4159,31 @@ var DataTableListSummaryContent = ({
|
|
|
3381
4159
|
showMenu,
|
|
3382
4160
|
visibleCount = 3
|
|
3383
4161
|
}) => {
|
|
3384
|
-
const normalized = items.map((item) =>
|
|
4162
|
+
const normalized = items.map((item) => Schema2.is(Schema2.String)(item) ? { label: item } : item);
|
|
3385
4163
|
if (!normalized.length)
|
|
3386
|
-
return /* @__PURE__ */
|
|
4164
|
+
return /* @__PURE__ */ jsx15("span", {
|
|
3387
4165
|
className: "text-muted-foreground",
|
|
3388
4166
|
children: emptyLabel
|
|
3389
4167
|
});
|
|
3390
4168
|
const visible = normalized.slice(0, Math.max(0, visibleCount));
|
|
3391
4169
|
const remaining = Math.max(totalCount - visible.length, 0);
|
|
3392
4170
|
if (display === "icon") {
|
|
3393
|
-
return /* @__PURE__ */
|
|
3394
|
-
children: /* @__PURE__ */
|
|
4171
|
+
return /* @__PURE__ */ jsx15(TooltipProvider, {
|
|
4172
|
+
children: /* @__PURE__ */ jsxs9("span", {
|
|
3395
4173
|
className: "flex items-center",
|
|
3396
4174
|
children: [
|
|
3397
|
-
visible.map((item, index) => /* @__PURE__ */
|
|
4175
|
+
visible.map((item, index) => /* @__PURE__ */ jsx15(DataTableListEntry, {
|
|
3398
4176
|
item,
|
|
3399
4177
|
appearance: "icon"
|
|
3400
4178
|
}, item.value ?? `${item.label}-${index}`)),
|
|
3401
|
-
remaining ? /* @__PURE__ */
|
|
4179
|
+
remaining ? /* @__PURE__ */ jsxs9("span", {
|
|
3402
4180
|
className: "bg-secondary text-secondary-foreground -ml-1 flex size-8 items-center justify-center rounded-full",
|
|
3403
4181
|
children: [
|
|
3404
4182
|
"+",
|
|
3405
4183
|
remaining
|
|
3406
4184
|
]
|
|
3407
4185
|
}) : null,
|
|
3408
|
-
remaining && showMenu ? /* @__PURE__ */
|
|
4186
|
+
remaining && showMenu ? /* @__PURE__ */ jsx15(DataTableListMenu, {
|
|
3409
4187
|
actions: [],
|
|
3410
4188
|
display,
|
|
3411
4189
|
force: true,
|
|
@@ -3417,17 +4195,17 @@ var DataTableListSummaryContent = ({
|
|
|
3417
4195
|
})
|
|
3418
4196
|
});
|
|
3419
4197
|
}
|
|
3420
|
-
return /* @__PURE__ */
|
|
4198
|
+
return /* @__PURE__ */ jsxs9("span", {
|
|
3421
4199
|
className: "inline-flex min-w-0 items-center gap-2 text-sm",
|
|
3422
4200
|
children: [
|
|
3423
|
-
/* @__PURE__ */
|
|
4201
|
+
/* @__PURE__ */ jsxs9("span", {
|
|
3424
4202
|
className: "truncate",
|
|
3425
4203
|
children: [
|
|
3426
4204
|
visible.map((item) => item.label).join(", "),
|
|
3427
4205
|
remaining ? ` +${remaining}` : ""
|
|
3428
4206
|
]
|
|
3429
4207
|
}),
|
|
3430
|
-
remaining && showMenu ? /* @__PURE__ */
|
|
4208
|
+
remaining && showMenu ? /* @__PURE__ */ jsx15(DataTableListMenu, {
|
|
3431
4209
|
actions: [],
|
|
3432
4210
|
display,
|
|
3433
4211
|
force: true,
|
|
@@ -3438,7 +4216,7 @@ var DataTableListSummaryContent = ({
|
|
|
3438
4216
|
]
|
|
3439
4217
|
});
|
|
3440
4218
|
};
|
|
3441
|
-
var DataTableListSummary = (props) => /* @__PURE__ */
|
|
4219
|
+
var DataTableListSummary = (props) => /* @__PURE__ */ jsx15(DataTableListSummaryContent, {
|
|
3442
4220
|
...props,
|
|
3443
4221
|
showMenu: true
|
|
3444
4222
|
});
|
|
@@ -3446,40 +4224,40 @@ var DataTableListEntry = ({
|
|
|
3446
4224
|
item,
|
|
3447
4225
|
appearance
|
|
3448
4226
|
}) => {
|
|
3449
|
-
const icon = /* @__PURE__ */
|
|
4227
|
+
const icon = /* @__PURE__ */ jsx15("span", {
|
|
3450
4228
|
"aria-hidden": "true",
|
|
3451
4229
|
className: "bg-secondary text-secondary-foreground flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full",
|
|
3452
|
-
children: item.imageSrc ? /* @__PURE__ */
|
|
4230
|
+
children: item.imageSrc ? /* @__PURE__ */ jsx15("img", {
|
|
3453
4231
|
alt: "",
|
|
3454
4232
|
src: item.imageSrc,
|
|
3455
4233
|
className: "size-full object-cover"
|
|
3456
4234
|
}) : item.icon ?? item.label.slice(0, 2).toUpperCase()
|
|
3457
4235
|
});
|
|
3458
4236
|
if (appearance === "list") {
|
|
3459
|
-
return /* @__PURE__ */
|
|
4237
|
+
return /* @__PURE__ */ jsx15("span", {
|
|
3460
4238
|
className: "min-w-0 flex-1 truncate",
|
|
3461
4239
|
title: item.label,
|
|
3462
4240
|
children: item.label
|
|
3463
4241
|
});
|
|
3464
4242
|
}
|
|
3465
|
-
return appearance === "icon" ? /* @__PURE__ */
|
|
4243
|
+
return appearance === "icon" ? /* @__PURE__ */ jsxs9(Tooltip, {
|
|
3466
4244
|
children: [
|
|
3467
|
-
/* @__PURE__ */
|
|
3468
|
-
render: /* @__PURE__ */
|
|
4245
|
+
/* @__PURE__ */ jsx15(TooltipTrigger, {
|
|
4246
|
+
render: /* @__PURE__ */ jsx15("span", {
|
|
3469
4247
|
className: "-ml-1 inline-flex rounded-full",
|
|
3470
4248
|
"aria-label": item.label
|
|
3471
4249
|
}),
|
|
3472
4250
|
children: icon
|
|
3473
4251
|
}),
|
|
3474
|
-
/* @__PURE__ */
|
|
4252
|
+
/* @__PURE__ */ jsx15(TooltipContent, {
|
|
3475
4253
|
children: item.label
|
|
3476
4254
|
})
|
|
3477
4255
|
]
|
|
3478
|
-
}) : /* @__PURE__ */
|
|
4256
|
+
}) : /* @__PURE__ */ jsxs9("span", {
|
|
3479
4257
|
className: "flex min-w-0 flex-1 items-center gap-2 text-left",
|
|
3480
4258
|
children: [
|
|
3481
4259
|
icon,
|
|
3482
|
-
/* @__PURE__ */
|
|
4260
|
+
/* @__PURE__ */ jsx15("span", {
|
|
3483
4261
|
className: "truncate",
|
|
3484
4262
|
children: item.label
|
|
3485
4263
|
})
|
|
@@ -3491,17 +4269,17 @@ var DataTableListEntry = ({
|
|
|
3491
4269
|
import { useKrakstackLocale as useKrakstackLocale4 } from "@krak-stack/registry/krakstack-provider";
|
|
3492
4270
|
|
|
3493
4271
|
// ../../src/services/events/record.ts
|
|
3494
|
-
import { Option as
|
|
3495
|
-
var TextValue =
|
|
4272
|
+
import { Option as Option3, Schema as Schema3 } from "effect";
|
|
4273
|
+
var TextValue = Schema3.Struct({ stringValue: Schema3.String }).annotate({
|
|
3496
4274
|
identifier: "EventTextValue"
|
|
3497
4275
|
});
|
|
3498
|
-
var TextArrayValue =
|
|
3499
|
-
arrayValue:
|
|
4276
|
+
var TextArrayValue = Schema3.Struct({
|
|
4277
|
+
arrayValue: Schema3.Struct({ values: Schema3.Array(TextValue) })
|
|
3500
4278
|
}).annotate({ identifier: "EventTextArrayValue" });
|
|
3501
|
-
var eventTextAttribute = (record, key) =>
|
|
4279
|
+
var eventTextAttribute = (record, key) => Schema3.decodeUnknownOption(TextValue)(record.attributes.find((attribute) => attribute.key === key)?.value).pipe(Option3.map((value) => value.stringValue), Option3.getOrNull);
|
|
3502
4280
|
|
|
3503
4281
|
// ../../src/services/events/client/audit-log-table.tsx
|
|
3504
|
-
import { jsx as
|
|
4282
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3505
4283
|
var translations = {
|
|
3506
4284
|
en: {
|
|
3507
4285
|
title: "Activity history",
|
|
@@ -3560,6 +4338,13 @@ var AuditLogTable = ({
|
|
|
3560
4338
|
["session", labels.methodSession],
|
|
3561
4339
|
["api_key", labels.methodApiKey]
|
|
3562
4340
|
]);
|
|
4341
|
+
const tableState = state?.eventName && !state.filters?.some((filter) => filter.id === "eventName") ? {
|
|
4342
|
+
...state,
|
|
4343
|
+
filters: [
|
|
4344
|
+
...state.filters ?? [],
|
|
4345
|
+
{ id: "eventName", kind: "values", values: [state.eventName] }
|
|
4346
|
+
]
|
|
4347
|
+
} : state;
|
|
3563
4348
|
const getActor = (entry) => {
|
|
3564
4349
|
const type = eventTextAttribute(entry, "app.actor.type");
|
|
3565
4350
|
const id = eventTextAttribute(entry, "app.actor.id") ?? eventTextAttribute(entry, "user.id");
|
|
@@ -3588,11 +4373,17 @@ var AuditLogTable = ({
|
|
|
3588
4373
|
{
|
|
3589
4374
|
field: "eventName",
|
|
3590
4375
|
headerName: labels.action,
|
|
4376
|
+
filterOptions: events,
|
|
3591
4377
|
cellRenderer: ({ data }) => renderAction?.(data) ?? events.find((event) => event.value === data.eventName)?.label ?? data.eventName
|
|
3592
4378
|
},
|
|
3593
4379
|
{
|
|
3594
4380
|
colId: "record",
|
|
3595
4381
|
headerName: labels.target,
|
|
4382
|
+
filterValueGetter: ({ data }) => [
|
|
4383
|
+
eventTextAttribute(data, "app.audit.target.name") ?? "",
|
|
4384
|
+
eventTextAttribute(data, "app.audit.target.type") ?? "",
|
|
4385
|
+
eventTextAttribute(data, "app.audit.target.id") ?? ""
|
|
4386
|
+
].join(" "),
|
|
3596
4387
|
type: "reference",
|
|
3597
4388
|
typeOptions: {
|
|
3598
4389
|
imageVariant: "square",
|
|
@@ -3610,6 +4401,11 @@ var AuditLogTable = ({
|
|
|
3610
4401
|
{
|
|
3611
4402
|
colId: "actor",
|
|
3612
4403
|
headerName: labels.actor,
|
|
4404
|
+
filterValueGetter: ({ data }) => [
|
|
4405
|
+
eventTextAttribute(data, "user.full_name") || eventTextAttribute(data, "user.name") || eventTextAttribute(data, "user.email") || eventTextAttribute(data, "app.actor.type") || "",
|
|
4406
|
+
eventTextAttribute(data, "user.email") ?? "",
|
|
4407
|
+
eventTextAttribute(data, "app.actor.id") ?? eventTextAttribute(data, "user.id") ?? ""
|
|
4408
|
+
].join(" "),
|
|
3613
4409
|
sortable: false,
|
|
3614
4410
|
type: "reference",
|
|
3615
4411
|
typeOptions: {
|
|
@@ -3617,13 +4413,13 @@ var AuditLogTable = ({
|
|
|
3617
4413
|
},
|
|
3618
4414
|
cellRenderer: ({ data }) => {
|
|
3619
4415
|
const impersonatorId = eventTextAttribute(data, "app.auth.impersonator.id");
|
|
3620
|
-
return /* @__PURE__ */
|
|
4416
|
+
return /* @__PURE__ */ jsxs10("div", {
|
|
3621
4417
|
className: "flex min-w-0 flex-col gap-1",
|
|
3622
4418
|
children: [
|
|
3623
|
-
/* @__PURE__ */
|
|
4419
|
+
/* @__PURE__ */ jsx16(DataTableReferenceCell, {
|
|
3624
4420
|
item: getActor(data)
|
|
3625
4421
|
}),
|
|
3626
|
-
impersonatorId !== null ? /* @__PURE__ */
|
|
4422
|
+
impersonatorId !== null ? /* @__PURE__ */ jsxs10("span", {
|
|
3627
4423
|
className: "text-muted-foreground text-xs",
|
|
3628
4424
|
children: [
|
|
3629
4425
|
labels.impersonatedBy,
|
|
@@ -3638,6 +4434,15 @@ var AuditLogTable = ({
|
|
|
3638
4434
|
{
|
|
3639
4435
|
colId: "method",
|
|
3640
4436
|
headerName: labels.method,
|
|
4437
|
+
filterOptions: [
|
|
4438
|
+
{ value: "session", label: labels.methodSession },
|
|
4439
|
+
{ value: "api_key", label: labels.methodApiKey },
|
|
4440
|
+
{ value: "unknown", label: labels.methodUnknown }
|
|
4441
|
+
],
|
|
4442
|
+
filterValueGetter: ({ data }) => {
|
|
4443
|
+
const method = eventTextAttribute(data, "app.auth.method");
|
|
4444
|
+
return method === "session" || method === "api_key" ? method : "unknown";
|
|
4445
|
+
},
|
|
3641
4446
|
sortable: false,
|
|
3642
4447
|
valueGetter: ({ data }) => {
|
|
3643
4448
|
const method = eventTextAttribute(data, "app.auth.method");
|
|
@@ -3645,57 +4450,19 @@ var AuditLogTable = ({
|
|
|
3645
4450
|
}
|
|
3646
4451
|
}
|
|
3647
4452
|
];
|
|
3648
|
-
return /* @__PURE__ */
|
|
4453
|
+
return /* @__PURE__ */ jsx16("section", {
|
|
3649
4454
|
"aria-label": labels.title,
|
|
3650
4455
|
className: "flex flex-col gap-4",
|
|
3651
|
-
children: /* @__PURE__ */
|
|
4456
|
+
children: /* @__PURE__ */ jsx16(DataTable, {
|
|
3652
4457
|
locale,
|
|
3653
4458
|
status,
|
|
3654
|
-
state,
|
|
4459
|
+
state: tableState,
|
|
3655
4460
|
onStateChange: onStateChange ? (next) => onStateChange({
|
|
3656
4461
|
...next,
|
|
3657
|
-
eventName:
|
|
4462
|
+
eventName: undefined
|
|
3658
4463
|
}) : undefined,
|
|
3659
4464
|
features: {
|
|
3660
|
-
|
|
3661
|
-
items: /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
3662
|
-
children: [
|
|
3663
|
-
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
3664
|
-
children: [
|
|
3665
|
-
/* @__PURE__ */ jsx15(ListFilterIcon, {
|
|
3666
|
-
"aria-hidden": "true",
|
|
3667
|
-
"data-icon": "inline-start"
|
|
3668
|
-
}),
|
|
3669
|
-
labels.event,
|
|
3670
|
-
state.eventName ? `: ${events.find((event) => event.value === state.eventName)?.label ?? state.eventName}` : ""
|
|
3671
|
-
]
|
|
3672
|
-
}),
|
|
3673
|
-
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
3674
|
-
className: "w-80",
|
|
3675
|
-
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
3676
|
-
children: [
|
|
3677
|
-
/* @__PURE__ */ jsx15(MenubarItem, {
|
|
3678
|
-
onClick: () => onStateChange({
|
|
3679
|
-
...state,
|
|
3680
|
-
eventName: undefined,
|
|
3681
|
-
page: 0
|
|
3682
|
-
}),
|
|
3683
|
-
children: labels.allEvents
|
|
3684
|
-
}),
|
|
3685
|
-
events.map((event) => /* @__PURE__ */ jsx15(MenubarItem, {
|
|
3686
|
-
onClick: () => onStateChange({
|
|
3687
|
-
...state,
|
|
3688
|
-
eventName: event.value,
|
|
3689
|
-
page: 0
|
|
3690
|
-
}),
|
|
3691
|
-
children: event.label
|
|
3692
|
-
}, event.value))
|
|
3693
|
-
]
|
|
3694
|
-
})
|
|
3695
|
-
})
|
|
3696
|
-
]
|
|
3697
|
-
})
|
|
3698
|
-
} : false,
|
|
4465
|
+
filtering: !!onStateChange,
|
|
3699
4466
|
pagination: { mode: "server", rowCount }
|
|
3700
4467
|
},
|
|
3701
4468
|
columnDefs: columns,
|