@krak-stack/registry 0.1.56 → 0.1.57
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 +12 -0
- package/dist/components/ui/data-table.d.ts +85 -2
- package/dist/components/ui/data-table.js +1385 -608
- package/dist/lib/query.d.ts +216 -0
- package/dist/lib/query.js +50 -2
- package/dist/services/events/browser.js +46 -1
- package/dist/services/events/client/audit-log-table.js +1399 -626
- package/dist/services/events/index.d.ts +48 -0
- package/dist/services/events/index.js +54 -9
- package/dist/services/events/schema.d.ts +189 -0
- package/dist/services/events/schema.js +46 -1
- package/package.json +1 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// ../../src/components/ui/data-table.tsx
|
|
2
2
|
import { useAtom, useAtomSet } from "@effect/atom-react";
|
|
3
3
|
import { BrowserKeyValueStore } from "@effect/platform-browser";
|
|
4
|
-
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";
|
|
5
6
|
import { AsyncResult, Atom } from "effect/reactivity";
|
|
6
7
|
import {
|
|
7
8
|
ArrowDown,
|
|
8
9
|
ArrowUp,
|
|
10
|
+
Check,
|
|
9
11
|
ChevronDown,
|
|
10
12
|
ChevronRight as ChevronRight2,
|
|
11
13
|
ChevronsUpDown,
|
|
@@ -15,6 +17,7 @@ import {
|
|
|
15
17
|
FileText,
|
|
16
18
|
GripVertical,
|
|
17
19
|
LayoutGrid,
|
|
20
|
+
ListFilter,
|
|
18
21
|
MoreHorizontal,
|
|
19
22
|
Plus,
|
|
20
23
|
RefreshCw,
|
|
@@ -29,8 +32,9 @@ import {
|
|
|
29
32
|
isValidElement,
|
|
30
33
|
useCallback,
|
|
31
34
|
useContext,
|
|
35
|
+
useId as useId2,
|
|
32
36
|
useLayoutEffect,
|
|
33
|
-
useMemo,
|
|
37
|
+
useMemo as useMemo2,
|
|
34
38
|
useRef,
|
|
35
39
|
useState
|
|
36
40
|
} from "react";
|
|
@@ -312,10 +316,196 @@ function Input({ className, type, ...props }) {
|
|
|
312
316
|
});
|
|
313
317
|
}
|
|
314
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
|
+
|
|
315
505
|
// ../../src/components/ui/loading.tsx
|
|
316
506
|
import { Loader2 } from "lucide-react";
|
|
317
507
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
318
|
-
import { jsx as
|
|
508
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
319
509
|
var labels = {
|
|
320
510
|
en: {
|
|
321
511
|
loading: "Loading..."
|
|
@@ -333,10 +523,10 @@ function Loading({
|
|
|
333
523
|
variant = "inline"
|
|
334
524
|
}) {
|
|
335
525
|
const locale = useKrakstackLocale(localeOverride);
|
|
336
|
-
return /* @__PURE__ */
|
|
526
|
+
return /* @__PURE__ */ jsxs4("div", {
|
|
337
527
|
className: cn("text-muted-foreground flex items-center justify-center gap-2 text-sm", variant === "centered" && "min-h-[50svh] w-full", className),
|
|
338
528
|
children: [
|
|
339
|
-
/* @__PURE__ */
|
|
529
|
+
/* @__PURE__ */ jsx9(Loader2, {
|
|
340
530
|
className: "size-4 animate-spin"
|
|
341
531
|
}),
|
|
342
532
|
label ?? loadingLabel(locale, messages)
|
|
@@ -347,18 +537,18 @@ function Loading({
|
|
|
347
537
|
// ../../src/components/ui/menubar.tsx
|
|
348
538
|
import { Menu as MenuPrimitive2 } from "@base-ui/react/menu";
|
|
349
539
|
import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar";
|
|
350
|
-
import { CheckIcon as
|
|
351
|
-
import { jsx as
|
|
540
|
+
import { CheckIcon as CheckIcon4 } from "lucide-react";
|
|
541
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
352
542
|
"use client";
|
|
353
543
|
function Menubar({ className, ...props }) {
|
|
354
|
-
return /* @__PURE__ */
|
|
544
|
+
return /* @__PURE__ */ jsx10(MenubarPrimitive, {
|
|
355
545
|
"data-slot": "menubar",
|
|
356
546
|
className: cn("flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs", className),
|
|
357
547
|
...props
|
|
358
548
|
});
|
|
359
549
|
}
|
|
360
550
|
function MenubarMenu({ ...props }) {
|
|
361
|
-
return /* @__PURE__ */
|
|
551
|
+
return /* @__PURE__ */ jsx10(DropdownMenu, {
|
|
362
552
|
"data-slot": "menubar-menu",
|
|
363
553
|
...props
|
|
364
554
|
});
|
|
@@ -366,7 +556,7 @@ function MenubarMenu({ ...props }) {
|
|
|
366
556
|
function MenubarGroup({
|
|
367
557
|
...props
|
|
368
558
|
}) {
|
|
369
|
-
return /* @__PURE__ */
|
|
559
|
+
return /* @__PURE__ */ jsx10(DropdownMenuGroup, {
|
|
370
560
|
"data-slot": "menubar-group",
|
|
371
561
|
...props
|
|
372
562
|
});
|
|
@@ -375,7 +565,7 @@ function MenubarTrigger({
|
|
|
375
565
|
className,
|
|
376
566
|
...props
|
|
377
567
|
}) {
|
|
378
|
-
return /* @__PURE__ */
|
|
568
|
+
return /* @__PURE__ */ jsx10(DropdownMenuTrigger, {
|
|
379
569
|
"data-slot": "menubar-trigger",
|
|
380
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),
|
|
381
571
|
...props
|
|
@@ -388,7 +578,7 @@ function MenubarContent({
|
|
|
388
578
|
sideOffset = 8,
|
|
389
579
|
...props
|
|
390
580
|
}) {
|
|
391
|
-
return /* @__PURE__ */
|
|
581
|
+
return /* @__PURE__ */ jsx10(DropdownMenuContent, {
|
|
392
582
|
"data-slot": "menubar-content",
|
|
393
583
|
align,
|
|
394
584
|
alignOffset,
|
|
@@ -403,7 +593,7 @@ function MenubarItem({
|
|
|
403
593
|
variant = "default",
|
|
404
594
|
...props
|
|
405
595
|
}) {
|
|
406
|
-
return /* @__PURE__ */
|
|
596
|
+
return /* @__PURE__ */ jsx10(DropdownMenuItem, {
|
|
407
597
|
"data-slot": "menubar-item",
|
|
408
598
|
"data-inset": inset,
|
|
409
599
|
"data-variant": variant,
|
|
@@ -418,17 +608,17 @@ function MenubarCheckboxItem({
|
|
|
418
608
|
inset,
|
|
419
609
|
...props
|
|
420
610
|
}) {
|
|
421
|
-
return /* @__PURE__ */
|
|
611
|
+
return /* @__PURE__ */ jsxs5(MenuPrimitive2.CheckboxItem, {
|
|
422
612
|
"data-slot": "menubar-checkbox-item",
|
|
423
613
|
"data-inset": inset,
|
|
424
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),
|
|
425
615
|
checked,
|
|
426
616
|
...props,
|
|
427
617
|
children: [
|
|
428
|
-
/* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ jsx10("span", {
|
|
429
619
|
className: "pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
|
|
430
|
-
children: /* @__PURE__ */
|
|
431
|
-
children: /* @__PURE__ */
|
|
620
|
+
children: /* @__PURE__ */ jsx10(MenuPrimitive2.CheckboxItemIndicator, {
|
|
621
|
+
children: /* @__PURE__ */ jsx10(CheckIcon4, {})
|
|
432
622
|
})
|
|
433
623
|
}),
|
|
434
624
|
children
|
|
@@ -438,7 +628,7 @@ function MenubarCheckboxItem({
|
|
|
438
628
|
function MenubarRadioGroup({
|
|
439
629
|
...props
|
|
440
630
|
}) {
|
|
441
|
-
return /* @__PURE__ */
|
|
631
|
+
return /* @__PURE__ */ jsx10(DropdownMenuRadioGroup, {
|
|
442
632
|
"data-slot": "menubar-radio-group",
|
|
443
633
|
...props
|
|
444
634
|
});
|
|
@@ -449,16 +639,16 @@ function MenubarRadioItem({
|
|
|
449
639
|
inset,
|
|
450
640
|
...props
|
|
451
641
|
}) {
|
|
452
|
-
return /* @__PURE__ */
|
|
642
|
+
return /* @__PURE__ */ jsxs5(MenuPrimitive2.RadioItem, {
|
|
453
643
|
"data-slot": "menubar-radio-item",
|
|
454
644
|
"data-inset": inset,
|
|
455
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),
|
|
456
646
|
...props,
|
|
457
647
|
children: [
|
|
458
|
-
/* @__PURE__ */
|
|
648
|
+
/* @__PURE__ */ jsx10("span", {
|
|
459
649
|
className: "pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
|
|
460
|
-
children: /* @__PURE__ */
|
|
461
|
-
children: /* @__PURE__ */
|
|
650
|
+
children: /* @__PURE__ */ jsx10(MenuPrimitive2.RadioItemIndicator, {
|
|
651
|
+
children: /* @__PURE__ */ jsx10(CheckIcon4, {})
|
|
462
652
|
})
|
|
463
653
|
}),
|
|
464
654
|
children
|
|
@@ -470,7 +660,7 @@ function MenubarLabel({
|
|
|
470
660
|
inset,
|
|
471
661
|
...props
|
|
472
662
|
}) {
|
|
473
|
-
return /* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ jsx10(DropdownMenuLabel, {
|
|
474
664
|
"data-slot": "menubar-label",
|
|
475
665
|
"data-inset": inset,
|
|
476
666
|
className: cn("px-2 py-1.5 text-sm font-medium data-inset:pl-8", className),
|
|
@@ -481,7 +671,7 @@ function MenubarSeparator({
|
|
|
481
671
|
className,
|
|
482
672
|
...props
|
|
483
673
|
}) {
|
|
484
|
-
return /* @__PURE__ */
|
|
674
|
+
return /* @__PURE__ */ jsx10(DropdownMenuSeparator, {
|
|
485
675
|
"data-slot": "menubar-separator",
|
|
486
676
|
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
487
677
|
...props
|
|
@@ -490,7 +680,7 @@ function MenubarSeparator({
|
|
|
490
680
|
function MenubarSub({
|
|
491
681
|
...props
|
|
492
682
|
}) {
|
|
493
|
-
return /* @__PURE__ */
|
|
683
|
+
return /* @__PURE__ */ jsx10(DropdownMenuSub, {
|
|
494
684
|
"data-slot": "menubar-sub",
|
|
495
685
|
...props
|
|
496
686
|
});
|
|
@@ -500,7 +690,7 @@ function MenubarSubTrigger({
|
|
|
500
690
|
inset,
|
|
501
691
|
...props
|
|
502
692
|
}) {
|
|
503
|
-
return /* @__PURE__ */
|
|
693
|
+
return /* @__PURE__ */ jsx10(DropdownMenuSubTrigger, {
|
|
504
694
|
"data-slot": "menubar-sub-trigger",
|
|
505
695
|
"data-inset": inset,
|
|
506
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),
|
|
@@ -511,7 +701,7 @@ function MenubarSubContent({
|
|
|
511
701
|
className,
|
|
512
702
|
...props
|
|
513
703
|
}) {
|
|
514
|
-
return /* @__PURE__ */
|
|
704
|
+
return /* @__PURE__ */ jsx10(DropdownMenuSubContent, {
|
|
515
705
|
"data-slot": "menubar-sub-content",
|
|
516
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),
|
|
517
707
|
...props
|
|
@@ -526,137 +716,8 @@ import {
|
|
|
526
716
|
ChevronsRight
|
|
527
717
|
} from "lucide-react";
|
|
528
718
|
import { useId } from "react";
|
|
529
|
-
|
|
530
|
-
// ../../src/components/ui/label.tsx
|
|
531
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
532
|
-
"use client";
|
|
533
|
-
function Label({ className, ...props }) {
|
|
534
|
-
return /* @__PURE__ */ jsx8("label", {
|
|
535
|
-
"data-slot": "label",
|
|
536
|
-
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),
|
|
537
|
-
...props
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
// ../../src/components/ui/select.tsx
|
|
542
|
-
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
543
|
-
import { ChevronDownIcon, CheckIcon as CheckIcon4, ChevronUpIcon } from "lucide-react";
|
|
544
|
-
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
545
|
-
"use client";
|
|
546
|
-
var Select = SelectPrimitive.Root;
|
|
547
|
-
function SelectValue({ className, ...props }) {
|
|
548
|
-
return /* @__PURE__ */ jsx9(SelectPrimitive.Value, {
|
|
549
|
-
"data-slot": "select-value",
|
|
550
|
-
className: cn("flex flex-1 text-left", className),
|
|
551
|
-
...props
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
function SelectTrigger({
|
|
555
|
-
className,
|
|
556
|
-
size = "default",
|
|
557
|
-
children,
|
|
558
|
-
...props
|
|
559
|
-
}) {
|
|
560
|
-
return /* @__PURE__ */ jsxs4(SelectPrimitive.Trigger, {
|
|
561
|
-
"data-slot": "select-trigger",
|
|
562
|
-
"data-size": size,
|
|
563
|
-
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),
|
|
564
|
-
...props,
|
|
565
|
-
children: [
|
|
566
|
-
children,
|
|
567
|
-
/* @__PURE__ */ jsx9(SelectPrimitive.Icon, {
|
|
568
|
-
render: /* @__PURE__ */ jsx9(ChevronDownIcon, {
|
|
569
|
-
className: "text-muted-foreground pointer-events-none size-4"
|
|
570
|
-
})
|
|
571
|
-
})
|
|
572
|
-
]
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
function SelectContent({
|
|
576
|
-
className,
|
|
577
|
-
children,
|
|
578
|
-
side = "bottom",
|
|
579
|
-
sideOffset = 4,
|
|
580
|
-
align = "center",
|
|
581
|
-
alignOffset = 0,
|
|
582
|
-
alignItemWithTrigger = true,
|
|
583
|
-
...props
|
|
584
|
-
}) {
|
|
585
|
-
return /* @__PURE__ */ jsx9(SelectPrimitive.Portal, {
|
|
586
|
-
children: /* @__PURE__ */ jsx9(SelectPrimitive.Positioner, {
|
|
587
|
-
side,
|
|
588
|
-
sideOffset,
|
|
589
|
-
align,
|
|
590
|
-
alignOffset,
|
|
591
|
-
alignItemWithTrigger,
|
|
592
|
-
className: "isolate z-50",
|
|
593
|
-
children: /* @__PURE__ */ jsxs4(SelectPrimitive.Popup, {
|
|
594
|
-
"data-slot": "select-content",
|
|
595
|
-
"data-align-trigger": alignItemWithTrigger,
|
|
596
|
-
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),
|
|
597
|
-
...props,
|
|
598
|
-
children: [
|
|
599
|
-
/* @__PURE__ */ jsx9(SelectScrollUpButton, {}),
|
|
600
|
-
/* @__PURE__ */ jsx9(SelectPrimitive.List, {
|
|
601
|
-
children
|
|
602
|
-
}),
|
|
603
|
-
/* @__PURE__ */ jsx9(SelectScrollDownButton, {})
|
|
604
|
-
]
|
|
605
|
-
})
|
|
606
|
-
})
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
function SelectItem({
|
|
610
|
-
className,
|
|
611
|
-
children,
|
|
612
|
-
...props
|
|
613
|
-
}) {
|
|
614
|
-
return /* @__PURE__ */ jsxs4(SelectPrimitive.Item, {
|
|
615
|
-
"data-slot": "select-item",
|
|
616
|
-
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),
|
|
617
|
-
...props,
|
|
618
|
-
children: [
|
|
619
|
-
/* @__PURE__ */ jsx9(SelectPrimitive.ItemText, {
|
|
620
|
-
className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
|
|
621
|
-
children
|
|
622
|
-
}),
|
|
623
|
-
/* @__PURE__ */ jsx9(SelectPrimitive.ItemIndicator, {
|
|
624
|
-
render: /* @__PURE__ */ jsx9("span", {
|
|
625
|
-
className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center"
|
|
626
|
-
}),
|
|
627
|
-
children: /* @__PURE__ */ jsx9(CheckIcon4, {
|
|
628
|
-
className: "pointer-events-none"
|
|
629
|
-
})
|
|
630
|
-
})
|
|
631
|
-
]
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
function SelectScrollUpButton({
|
|
635
|
-
className,
|
|
636
|
-
...props
|
|
637
|
-
}) {
|
|
638
|
-
return /* @__PURE__ */ jsx9(SelectPrimitive.ScrollUpArrow, {
|
|
639
|
-
"data-slot": "select-scroll-up-button",
|
|
640
|
-
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),
|
|
641
|
-
...props,
|
|
642
|
-
children: /* @__PURE__ */ jsx9(ChevronUpIcon, {})
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
function SelectScrollDownButton({
|
|
646
|
-
className,
|
|
647
|
-
...props
|
|
648
|
-
}) {
|
|
649
|
-
return /* @__PURE__ */ jsx9(SelectPrimitive.ScrollDownArrow, {
|
|
650
|
-
"data-slot": "select-scroll-down-button",
|
|
651
|
-
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),
|
|
652
|
-
...props,
|
|
653
|
-
children: /* @__PURE__ */ jsx9(ChevronDownIcon, {})
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
// ../../src/components/ui/pagination.tsx
|
|
658
719
|
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
|
|
659
|
-
import { jsx as
|
|
720
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
660
721
|
var messages = {
|
|
661
722
|
en: {
|
|
662
723
|
pageSize: "Page size",
|
|
@@ -703,32 +764,32 @@ function Pagination({
|
|
|
703
764
|
const pageSizeId = useId();
|
|
704
765
|
const canGoBack = page > 0;
|
|
705
766
|
const canGoForward = page + 1 < pageCount;
|
|
706
|
-
return /* @__PURE__ */
|
|
767
|
+
return /* @__PURE__ */ jsxs6("div", {
|
|
707
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"),
|
|
708
769
|
children: [
|
|
709
|
-
showResults ? /* @__PURE__ */
|
|
770
|
+
showResults ? /* @__PURE__ */ jsxs6("div", {
|
|
710
771
|
className: "text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",
|
|
711
772
|
children: [
|
|
712
|
-
/* @__PURE__ */
|
|
773
|
+
/* @__PURE__ */ jsx11("span", {
|
|
713
774
|
children: labels.results(totalRows)
|
|
714
775
|
}),
|
|
715
|
-
selectedRows > 0 ? /* @__PURE__ */
|
|
776
|
+
selectedRows > 0 ? /* @__PURE__ */ jsx11("span", {
|
|
716
777
|
children: labels.selectedOf(selectedRows, totalRows)
|
|
717
778
|
}) : null
|
|
718
779
|
]
|
|
719
780
|
}) : null,
|
|
720
|
-
/* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
721
782
|
className: cn("flex items-center gap-4 sm:justify-end", compact && "flex-wrap justify-between gap-2 sm:justify-between"),
|
|
722
783
|
children: [
|
|
723
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
724
785
|
className: "flex items-center gap-2",
|
|
725
786
|
children: [
|
|
726
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ jsx11(Label, {
|
|
727
788
|
htmlFor: pageSizeId,
|
|
728
789
|
className: cn("hidden text-sm sm:block", compact && "block"),
|
|
729
790
|
children: labels.pageSize
|
|
730
791
|
}),
|
|
731
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ jsxs6(Select, {
|
|
732
793
|
items: pageSizes.map((size) => ({
|
|
733
794
|
label: size.toString(),
|
|
734
795
|
value: size.toString()
|
|
@@ -736,16 +797,16 @@ function Pagination({
|
|
|
736
797
|
value: `${pageSize}`,
|
|
737
798
|
onValueChange: (value) => onPageSizeChange(Number(value)),
|
|
738
799
|
children: [
|
|
739
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ jsx11(SelectTrigger, {
|
|
740
801
|
className: "h-8 w-[70px]",
|
|
741
802
|
id: pageSizeId,
|
|
742
|
-
children: /* @__PURE__ */
|
|
803
|
+
children: /* @__PURE__ */ jsx11(SelectValue, {
|
|
743
804
|
placeholder: pageSize
|
|
744
805
|
})
|
|
745
806
|
}),
|
|
746
|
-
/* @__PURE__ */
|
|
807
|
+
/* @__PURE__ */ jsx11(SelectContent, {
|
|
747
808
|
side: "top",
|
|
748
|
-
children: pageSizes.map((size) => /* @__PURE__ */
|
|
809
|
+
children: pageSizes.map((size) => /* @__PURE__ */ jsx11(SelectItem, {
|
|
749
810
|
value: `${size}`,
|
|
750
811
|
children: size
|
|
751
812
|
}, size))
|
|
@@ -754,66 +815,66 @@ function Pagination({
|
|
|
754
815
|
})
|
|
755
816
|
]
|
|
756
817
|
}),
|
|
757
|
-
/* @__PURE__ */
|
|
818
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
758
819
|
className: "flex items-center gap-2",
|
|
759
820
|
children: [
|
|
760
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ jsx11("div", {
|
|
761
822
|
className: "flex items-center justify-center text-sm font-medium sm:block",
|
|
762
823
|
children: labels.pageOf(page + 1, pageCount)
|
|
763
824
|
}),
|
|
764
|
-
/* @__PURE__ */
|
|
825
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
765
826
|
className: "flex items-center gap-1",
|
|
766
827
|
children: [
|
|
767
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ jsxs6(Button, {
|
|
768
829
|
className: cn("hidden h-8 w-8 p-0 lg:flex", compact && "!hidden"),
|
|
769
830
|
disabled: !canGoBack,
|
|
770
831
|
onClick: () => onPageChange(0),
|
|
771
832
|
type: "button",
|
|
772
833
|
children: [
|
|
773
|
-
/* @__PURE__ */
|
|
834
|
+
/* @__PURE__ */ jsx11("span", {
|
|
774
835
|
className: "sr-only",
|
|
775
836
|
children: labels.goToFirstPage
|
|
776
837
|
}),
|
|
777
|
-
/* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ jsx11(ChevronsLeft, {})
|
|
778
839
|
]
|
|
779
840
|
}),
|
|
780
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ jsxs6(Button, {
|
|
781
842
|
className: "h-8 w-8 p-0",
|
|
782
843
|
disabled: !canGoBack,
|
|
783
844
|
onClick: () => onPageChange(page - 1),
|
|
784
845
|
type: "button",
|
|
785
846
|
children: [
|
|
786
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ jsx11("span", {
|
|
787
848
|
className: "sr-only",
|
|
788
849
|
children: labels.goToPreviousPage
|
|
789
850
|
}),
|
|
790
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ jsx11(ChevronLeft, {})
|
|
791
852
|
]
|
|
792
853
|
}),
|
|
793
|
-
/* @__PURE__ */
|
|
854
|
+
/* @__PURE__ */ jsxs6(Button, {
|
|
794
855
|
className: "h-8 w-8 p-0",
|
|
795
856
|
disabled: !canGoForward,
|
|
796
857
|
onClick: () => onPageChange(page + 1),
|
|
797
858
|
type: "button",
|
|
798
859
|
children: [
|
|
799
|
-
/* @__PURE__ */
|
|
860
|
+
/* @__PURE__ */ jsx11("span", {
|
|
800
861
|
className: "sr-only",
|
|
801
862
|
children: labels.goToNextPage
|
|
802
863
|
}),
|
|
803
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ jsx11(ChevronRight, {})
|
|
804
865
|
]
|
|
805
866
|
}),
|
|
806
|
-
/* @__PURE__ */
|
|
867
|
+
/* @__PURE__ */ jsxs6(Button, {
|
|
807
868
|
className: cn("hidden h-8 w-8 p-0 lg:flex", compact && "!hidden"),
|
|
808
869
|
disabled: !canGoForward,
|
|
809
870
|
onClick: () => onPageChange(pageCount - 1),
|
|
810
871
|
type: "button",
|
|
811
872
|
children: [
|
|
812
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ jsx11("span", {
|
|
813
874
|
className: "sr-only",
|
|
814
875
|
children: labels.goToLastPage
|
|
815
876
|
}),
|
|
816
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ jsx11(ChevronsRight, {})
|
|
817
878
|
]
|
|
818
879
|
})
|
|
819
880
|
]
|
|
@@ -828,24 +889,24 @@ function Pagination({
|
|
|
828
889
|
|
|
829
890
|
// ../../src/components/ui/scroll-area.tsx
|
|
830
891
|
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
|
|
831
|
-
import { jsx as
|
|
892
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
832
893
|
function ScrollArea({
|
|
833
894
|
className,
|
|
834
895
|
children,
|
|
835
896
|
...props
|
|
836
897
|
}) {
|
|
837
|
-
return /* @__PURE__ */
|
|
898
|
+
return /* @__PURE__ */ jsxs7(ScrollAreaPrimitive.Root, {
|
|
838
899
|
"data-slot": "scroll-area",
|
|
839
900
|
className: cn("relative", className),
|
|
840
901
|
...props,
|
|
841
902
|
children: [
|
|
842
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__PURE__ */ jsx12(ScrollAreaPrimitive.Viewport, {
|
|
843
904
|
"data-slot": "scroll-area-viewport",
|
|
844
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",
|
|
845
906
|
children
|
|
846
907
|
}),
|
|
847
|
-
/* @__PURE__ */
|
|
848
|
-
/* @__PURE__ */
|
|
908
|
+
/* @__PURE__ */ jsx12(ScrollBar, {}),
|
|
909
|
+
/* @__PURE__ */ jsx12(ScrollAreaPrimitive.Corner, {})
|
|
849
910
|
]
|
|
850
911
|
});
|
|
851
912
|
}
|
|
@@ -854,13 +915,13 @@ function ScrollBar({
|
|
|
854
915
|
orientation = "vertical",
|
|
855
916
|
...props
|
|
856
917
|
}) {
|
|
857
|
-
return /* @__PURE__ */
|
|
918
|
+
return /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Scrollbar, {
|
|
858
919
|
"data-slot": "scroll-area-scrollbar",
|
|
859
920
|
"data-orientation": orientation,
|
|
860
921
|
orientation,
|
|
861
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),
|
|
862
923
|
...props,
|
|
863
|
-
children: /* @__PURE__ */
|
|
924
|
+
children: /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Thumb, {
|
|
864
925
|
"data-slot": "scroll-area-thumb",
|
|
865
926
|
className: "bg-border relative flex-1 rounded-full"
|
|
866
927
|
})
|
|
@@ -868,12 +929,12 @@ function ScrollBar({
|
|
|
868
929
|
}
|
|
869
930
|
|
|
870
931
|
// ../../src/components/ui/table.tsx
|
|
871
|
-
import { jsx as
|
|
932
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
872
933
|
function Table({ className, ...props }) {
|
|
873
|
-
return /* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ jsx13("div", {
|
|
874
935
|
"data-slot": "table-container",
|
|
875
936
|
className: "relative w-full overflow-x-auto",
|
|
876
|
-
children: /* @__PURE__ */
|
|
937
|
+
children: /* @__PURE__ */ jsx13("table", {
|
|
877
938
|
"data-slot": "table",
|
|
878
939
|
className: cn("w-full caption-bottom text-sm", className),
|
|
879
940
|
...props
|
|
@@ -881,35 +942,35 @@ function Table({ className, ...props }) {
|
|
|
881
942
|
});
|
|
882
943
|
}
|
|
883
944
|
function TableHeader({ className, ...props }) {
|
|
884
|
-
return /* @__PURE__ */
|
|
945
|
+
return /* @__PURE__ */ jsx13("thead", {
|
|
885
946
|
"data-slot": "table-header",
|
|
886
947
|
className: cn("[&_tr]:border-b", className),
|
|
887
948
|
...props
|
|
888
949
|
});
|
|
889
950
|
}
|
|
890
951
|
function TableBody({ className, ...props }) {
|
|
891
|
-
return /* @__PURE__ */
|
|
952
|
+
return /* @__PURE__ */ jsx13("tbody", {
|
|
892
953
|
"data-slot": "table-body",
|
|
893
954
|
className: cn("[&_tr:last-child]:border-0", className),
|
|
894
955
|
...props
|
|
895
956
|
});
|
|
896
957
|
}
|
|
897
958
|
function TableRow({ className, ...props }) {
|
|
898
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ jsx13("tr", {
|
|
899
960
|
"data-slot": "table-row",
|
|
900
961
|
className: cn("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
901
962
|
...props
|
|
902
963
|
});
|
|
903
964
|
}
|
|
904
965
|
function TableHead({ className, ...props }) {
|
|
905
|
-
return /* @__PURE__ */
|
|
966
|
+
return /* @__PURE__ */ jsx13("th", {
|
|
906
967
|
"data-slot": "table-head",
|
|
907
968
|
className: cn("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0", className),
|
|
908
969
|
...props
|
|
909
970
|
});
|
|
910
971
|
}
|
|
911
972
|
function TableCell({ className, ...props }) {
|
|
912
|
-
return /* @__PURE__ */
|
|
973
|
+
return /* @__PURE__ */ jsx13("td", {
|
|
913
974
|
"data-slot": "table-cell",
|
|
914
975
|
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0", className),
|
|
915
976
|
...props
|
|
@@ -918,26 +979,26 @@ function TableCell({ className, ...props }) {
|
|
|
918
979
|
|
|
919
980
|
// ../../src/components/ui/tooltip.tsx
|
|
920
981
|
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
921
|
-
import { jsx as
|
|
982
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
922
983
|
"use client";
|
|
923
984
|
function TooltipProvider({
|
|
924
985
|
delay = 0,
|
|
925
986
|
...props
|
|
926
987
|
}) {
|
|
927
|
-
return /* @__PURE__ */
|
|
988
|
+
return /* @__PURE__ */ jsx14(TooltipPrimitive.Provider, {
|
|
928
989
|
"data-slot": "tooltip-provider",
|
|
929
990
|
delay,
|
|
930
991
|
...props
|
|
931
992
|
});
|
|
932
993
|
}
|
|
933
994
|
function Tooltip({ ...props }) {
|
|
934
|
-
return /* @__PURE__ */
|
|
995
|
+
return /* @__PURE__ */ jsx14(TooltipPrimitive.Root, {
|
|
935
996
|
"data-slot": "tooltip",
|
|
936
997
|
...props
|
|
937
998
|
});
|
|
938
999
|
}
|
|
939
1000
|
function TooltipTrigger({ ...props }) {
|
|
940
|
-
return /* @__PURE__ */
|
|
1001
|
+
return /* @__PURE__ */ jsx14(TooltipPrimitive.Trigger, {
|
|
941
1002
|
"data-slot": "tooltip-trigger",
|
|
942
1003
|
...props
|
|
943
1004
|
});
|
|
@@ -951,20 +1012,20 @@ function TooltipContent({
|
|
|
951
1012
|
children,
|
|
952
1013
|
...props
|
|
953
1014
|
}) {
|
|
954
|
-
return /* @__PURE__ */
|
|
955
|
-
children: /* @__PURE__ */
|
|
1015
|
+
return /* @__PURE__ */ jsx14(TooltipPrimitive.Portal, {
|
|
1016
|
+
children: /* @__PURE__ */ jsx14(TooltipPrimitive.Positioner, {
|
|
956
1017
|
align,
|
|
957
1018
|
alignOffset,
|
|
958
1019
|
side,
|
|
959
1020
|
sideOffset,
|
|
960
1021
|
className: "isolate z-50",
|
|
961
|
-
children: /* @__PURE__ */
|
|
1022
|
+
children: /* @__PURE__ */ jsxs8(TooltipPrimitive.Popup, {
|
|
962
1023
|
"data-slot": "tooltip-content",
|
|
963
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),
|
|
964
1025
|
...props,
|
|
965
1026
|
children: [
|
|
966
1027
|
children,
|
|
967
|
-
/* @__PURE__ */
|
|
1028
|
+
/* @__PURE__ */ jsx14(TooltipPrimitive.Arrow, {
|
|
968
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"
|
|
969
1030
|
})
|
|
970
1031
|
]
|
|
@@ -973,14 +1034,181 @@ function TooltipContent({
|
|
|
973
1034
|
});
|
|
974
1035
|
}
|
|
975
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
|
+
|
|
976
1204
|
// ../../src/components/ui/data-table.tsx
|
|
977
1205
|
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider";
|
|
978
|
-
import { jsx as
|
|
979
|
-
var DataTablePersistedUiStateSchema =
|
|
980
|
-
columnVisibility:
|
|
981
|
-
columnSizing:
|
|
982
|
-
grouping:
|
|
983
|
-
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"])
|
|
984
1212
|
}).annotate({ identifier: "DataTablePersistedUiState" });
|
|
985
1213
|
var dataTableStorageRuntime = Atom.runtime(BrowserKeyValueStore.layerLocalStorage);
|
|
986
1214
|
var DataTableReferenceCell = ({
|
|
@@ -992,29 +1220,29 @@ var DataTableReferenceCell = ({
|
|
|
992
1220
|
if (!item)
|
|
993
1221
|
return emptyLabel;
|
|
994
1222
|
const initials = item.label.trim().split(/\s+/).slice(0, 2).map((word) => word.slice(0, 1)).join("").toLocaleUpperCase();
|
|
995
|
-
return /* @__PURE__ */
|
|
1223
|
+
return /* @__PURE__ */ jsxs9("div", {
|
|
996
1224
|
className: "flex min-w-0 items-center gap-2",
|
|
997
1225
|
children: [
|
|
998
|
-
/* @__PURE__ */
|
|
1226
|
+
/* @__PURE__ */ jsx15("div", {
|
|
999
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"),
|
|
1000
|
-
children: item.imageSrc && item.imageSrc !== failedImage ? /* @__PURE__ */
|
|
1228
|
+
children: item.imageSrc && item.imageSrc !== failedImage ? /* @__PURE__ */ jsx15("img", {
|
|
1001
1229
|
src: item.imageSrc,
|
|
1002
1230
|
alt: item.label,
|
|
1003
1231
|
className: "size-full object-cover",
|
|
1004
1232
|
onError: () => setFailedImage(item.imageSrc ?? undefined)
|
|
1005
|
-
}) : /* @__PURE__ */
|
|
1233
|
+
}) : /* @__PURE__ */ jsx15("span", {
|
|
1006
1234
|
"aria-hidden": "true",
|
|
1007
1235
|
children: initials
|
|
1008
1236
|
})
|
|
1009
1237
|
}),
|
|
1010
|
-
/* @__PURE__ */
|
|
1238
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
1011
1239
|
className: "flex min-w-0 flex-col leading-tight",
|
|
1012
1240
|
children: [
|
|
1013
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1014
1242
|
className: "truncate font-medium",
|
|
1015
1243
|
children: item.label
|
|
1016
1244
|
}),
|
|
1017
|
-
item.description ? /* @__PURE__ */
|
|
1245
|
+
item.description ? /* @__PURE__ */ jsx15("span", {
|
|
1018
1246
|
className: "text-muted-foreground truncate text-xs",
|
|
1019
1247
|
children: item.description
|
|
1020
1248
|
}) : null
|
|
@@ -1032,6 +1260,23 @@ var messages2 = {
|
|
|
1032
1260
|
empty: "No results.",
|
|
1033
1261
|
loading: "Loading...",
|
|
1034
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.",
|
|
1035
1280
|
export: "Export",
|
|
1036
1281
|
exportCsv: "CSV",
|
|
1037
1282
|
exportJson: "JSON",
|
|
@@ -1064,6 +1309,23 @@ var messages2 = {
|
|
|
1064
1309
|
empty: "Aucun résultat.",
|
|
1065
1310
|
loading: "Chargement...",
|
|
1066
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.",
|
|
1067
1329
|
export: "Exporter",
|
|
1068
1330
|
exportCsv: "CSV",
|
|
1069
1331
|
exportJson: "JSON",
|
|
@@ -1123,7 +1385,7 @@ var transientUiFromState = (state) => ({
|
|
|
1123
1385
|
var clampWidth = (column, width) => Math.min(column.maxWidth ?? DEFAULT_MAX_WIDTH, Math.max(column.minWidth ?? DEFAULT_MIN_WIDTH, width));
|
|
1124
1386
|
var normalizeDataTableColumns = (columnDefs, columnSizing = {}) => {
|
|
1125
1387
|
const ids = new Set;
|
|
1126
|
-
|
|
1388
|
+
const columns = columnDefs.map((colDef) => {
|
|
1127
1389
|
const id = colDef.field ?? colDef.colId;
|
|
1128
1390
|
if (!id) {
|
|
1129
1391
|
throw new Error("DataTable columns require a field or colId");
|
|
@@ -1138,7 +1400,24 @@ var normalizeDataTableColumns = (columnDefs, columnSizing = {}) => {
|
|
|
1138
1400
|
width: clampWidth(colDef, columnSizing[id] ?? colDef.width ?? DEFAULT_WIDTH)
|
|
1139
1401
|
};
|
|
1140
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;
|
|
1141
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]);
|
|
1142
1421
|
var getDataTableWidth = (columns, utilityColumns = 0) => columns.reduce((total, column) => total + column.width, 0) + utilityColumns * 40;
|
|
1143
1422
|
var buildDataTableRows = (rowData, columns, getRowId) => {
|
|
1144
1423
|
const ids = new Set;
|
|
@@ -1151,7 +1430,7 @@ var buildDataTableRows = (rowData, columns, getRowId) => {
|
|
|
1151
1430
|
id,
|
|
1152
1431
|
data,
|
|
1153
1432
|
index,
|
|
1154
|
-
values: new Map(columns.map((column) => {
|
|
1433
|
+
values: new Map(columns.flatMap((column) => [column, ...getDataTableFieldColumns(column)]).map((column) => {
|
|
1155
1434
|
const { colDef } = column;
|
|
1156
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;
|
|
1157
1436
|
return [column.id, value];
|
|
@@ -1159,40 +1438,40 @@ var buildDataTableRows = (rowData, columns, getRowId) => {
|
|
|
1159
1438
|
};
|
|
1160
1439
|
});
|
|
1161
1440
|
};
|
|
1162
|
-
var CalendarDate =
|
|
1163
|
-
var InstantString =
|
|
1164
|
-
var DateInput =
|
|
1165
|
-
|
|
1166
|
-
|
|
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,
|
|
1167
1446
|
CalendarDate,
|
|
1168
1447
|
InstantString
|
|
1169
1448
|
]).annotate({ identifier: "DataTableDateInput" });
|
|
1170
|
-
var decodeDateInput =
|
|
1171
|
-
var resolveDate = (value, type) =>
|
|
1172
|
-
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);
|
|
1173
1452
|
if (calendarOnly && type === "dateTime")
|
|
1174
|
-
return
|
|
1175
|
-
return
|
|
1453
|
+
return Option2.none();
|
|
1454
|
+
return Option2.map(DateTime2.make(input), (instant) => ({
|
|
1176
1455
|
instant,
|
|
1177
1456
|
calendarOnly
|
|
1178
1457
|
}));
|
|
1179
1458
|
}));
|
|
1180
|
-
var formatDateValue = (date, column, locale = "en") =>
|
|
1459
|
+
var formatDateValue = (date, column, locale = "en") => DateTime2.format(date.instant, {
|
|
1181
1460
|
locale: column.typeOptions?.locale ?? locale,
|
|
1182
1461
|
timeZone: date.calendarOnly ? "UTC" : column.typeOptions?.timeZone ?? "UTC",
|
|
1183
1462
|
dateStyle: column.typeOptions?.dateStyle ?? "medium",
|
|
1184
1463
|
timeStyle: column.type === "dateTime" ? column.typeOptions?.timeStyle ?? "short" : undefined,
|
|
1185
1464
|
hour12: column.type === "dateTime" ? column.typeOptions?.hour12 : undefined
|
|
1186
1465
|
});
|
|
1187
|
-
var dateIsoValue = (date) => date.calendarOnly ?
|
|
1188
|
-
var NumberValue =
|
|
1466
|
+
var dateIsoValue = (date) => date.calendarOnly ? DateTime2.formatIsoDateUtc(date.instant) : DateTime2.formatIso(date.instant);
|
|
1467
|
+
var NumberValue = Schema2.Finite.annotate({
|
|
1189
1468
|
identifier: "DataTableNumberValue"
|
|
1190
1469
|
});
|
|
1191
|
-
var BooleanValue =
|
|
1470
|
+
var BooleanValue = Schema2.Boolean.annotate({
|
|
1192
1471
|
identifier: "DataTableBooleanValue"
|
|
1193
1472
|
});
|
|
1194
|
-
var decodeNumberValue =
|
|
1195
|
-
var decodeBooleanValue =
|
|
1473
|
+
var decodeNumberValue = Schema2.decodeUnknownOption(NumberValue);
|
|
1474
|
+
var decodeBooleanValue = Schema2.decodeUnknownOption(BooleanValue);
|
|
1196
1475
|
var formatNumberValue = (value, options = {}, defaultLocale = "en") => {
|
|
1197
1476
|
const {
|
|
1198
1477
|
locale,
|
|
@@ -1208,13 +1487,13 @@ var getDataTableExportValue = (row, column, locale = "en") => {
|
|
|
1208
1487
|
const value = row.values.get(column.id);
|
|
1209
1488
|
const colDef = column.colDef;
|
|
1210
1489
|
if (colDef.type === "number") {
|
|
1211
|
-
const number =
|
|
1490
|
+
const number = Option2.getOrUndefined(decodeNumberValue(value));
|
|
1212
1491
|
if (number === undefined)
|
|
1213
1492
|
return null;
|
|
1214
1493
|
return colDef.typeOptions?.exportFormat === "formatted" ? formatNumberValue(number, colDef.typeOptions, locale) : number;
|
|
1215
1494
|
}
|
|
1216
1495
|
if (colDef.type === "boolean") {
|
|
1217
|
-
const boolean =
|
|
1496
|
+
const boolean = Option2.getOrUndefined(decodeBooleanValue(value));
|
|
1218
1497
|
if (boolean === undefined)
|
|
1219
1498
|
return null;
|
|
1220
1499
|
return colDef.typeOptions?.exportFormat === "formatted" ? booleanLabel(boolean, colDef.typeOptions) ?? String(boolean) : boolean;
|
|
@@ -1230,7 +1509,7 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
|
|
|
1230
1509
|
const query = globalFilter.trim().toLocaleLowerCase();
|
|
1231
1510
|
if (!query)
|
|
1232
1511
|
return [...rows];
|
|
1233
|
-
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));
|
|
1234
1513
|
return rows.filter((row) => searchable.some((column) => {
|
|
1235
1514
|
const value = row.values.get(column.id);
|
|
1236
1515
|
const colDef = column.colDef;
|
|
@@ -1239,17 +1518,86 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
|
|
|
1239
1518
|
const date = resolveDate(value, colDef.type);
|
|
1240
1519
|
text = date ? `${formatDateValue(date, colDef, locale)} ${dateIsoValue(date)}` : "";
|
|
1241
1520
|
} else if (colDef.type === "number") {
|
|
1242
|
-
const number =
|
|
1521
|
+
const number = Option2.getOrUndefined(decodeNumberValue(value));
|
|
1243
1522
|
text = number === undefined ? "" : `${formatNumberValue(number, colDef.typeOptions, locale)} ${number}`;
|
|
1244
1523
|
} else if (colDef.type === "boolean") {
|
|
1245
|
-
const boolean =
|
|
1524
|
+
const boolean = Option2.getOrUndefined(decodeBooleanValue(value));
|
|
1246
1525
|
text = boolean === undefined ? "" : `${booleanLabel(boolean, colDef.typeOptions) ?? ""} ${boolean}`;
|
|
1247
1526
|
}
|
|
1248
1527
|
return text.toLocaleLowerCase().includes(query);
|
|
1249
1528
|
}));
|
|
1250
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
|
+
};
|
|
1251
1596
|
var sortDataTableRows = (rows, columns, sorting) => {
|
|
1252
|
-
const byId = new Map(columns.map((column) => [
|
|
1597
|
+
const byId = new Map([...columns, ...getDataTableSortColumns(columns)].map((column) => [
|
|
1598
|
+
column.id,
|
|
1599
|
+
column
|
|
1600
|
+
]));
|
|
1253
1601
|
return rows.map((row, stableIndex) => ({ row, stableIndex })).sort((left, right) => {
|
|
1254
1602
|
for (const sort of sorting) {
|
|
1255
1603
|
const column = byId.get(sort.id);
|
|
@@ -1259,8 +1607,8 @@ var sortDataTableRows = (rows, columns, sorting) => {
|
|
|
1259
1607
|
const rightValue = right.row.values.get(sort.id);
|
|
1260
1608
|
const colDef = column.colDef;
|
|
1261
1609
|
if (!colDef.comparator && (colDef.type === "number" || colDef.type === "boolean")) {
|
|
1262
|
-
const leftScalar = colDef.type === "number" ?
|
|
1263
|
-
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));
|
|
1264
1612
|
if (leftScalar === undefined || rightScalar === undefined) {
|
|
1265
1613
|
if (leftScalar === undefined && rightScalar === undefined)
|
|
1266
1614
|
continue;
|
|
@@ -1281,12 +1629,12 @@ var sortDataTableRows = (rows, columns, sorting) => {
|
|
|
1281
1629
|
const nullOrder = colDef.typeOptions?.nulls === "first" ? -1 : 1;
|
|
1282
1630
|
return !leftDate ? nullOrder : -nullOrder;
|
|
1283
1631
|
}
|
|
1284
|
-
const comparison =
|
|
1632
|
+
const comparison = DateTime2.toEpochMillis(leftDate.instant) - DateTime2.toEpochMillis(rightDate.instant);
|
|
1285
1633
|
if (comparison !== 0)
|
|
1286
1634
|
return sort.direction === "desc" ? -comparison : comparison;
|
|
1287
1635
|
continue;
|
|
1288
1636
|
}
|
|
1289
|
-
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" });
|
|
1290
1638
|
if (comparison !== 0)
|
|
1291
1639
|
return sort.direction === "desc" ? -comparison : comparison;
|
|
1292
1640
|
}
|
|
@@ -1300,7 +1648,7 @@ var paginateDataTableRows = (rows, pagination) => {
|
|
|
1300
1648
|
const start = pageIndex * pageSize;
|
|
1301
1649
|
return rows.slice(start, start + pageSize);
|
|
1302
1650
|
};
|
|
1303
|
-
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;
|
|
1304
1652
|
var reorderDataTableRows = (rows, sourceRowId, targetRowId) => {
|
|
1305
1653
|
const sourceIndex = rows.findIndex((row) => row.id === sourceRowId);
|
|
1306
1654
|
const targetIndex = rows.findIndex((row) => row.id === targetRowId);
|
|
@@ -1368,6 +1716,7 @@ var queryFromState = (state) => ({
|
|
|
1368
1716
|
page: state.page,
|
|
1369
1717
|
pageSize: state.pageSize,
|
|
1370
1718
|
globalFilter: state.globalFilter,
|
|
1719
|
+
filters: state.filters,
|
|
1371
1720
|
sort: state.sort
|
|
1372
1721
|
});
|
|
1373
1722
|
var uiFromState = (state) => ({
|
|
@@ -1379,7 +1728,7 @@ var uiFromState = (state) => ({
|
|
|
1379
1728
|
view: state.view
|
|
1380
1729
|
});
|
|
1381
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;
|
|
1382
|
-
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;
|
|
1383
1732
|
var initialPublicState = (props, uiState) => ({
|
|
1384
1733
|
...queryFromState(props.state ?? { ...DEFAULT_QUERY, ...props.initialState }),
|
|
1385
1734
|
...uiState
|
|
@@ -1391,7 +1740,7 @@ var buildDataTableModel = (store) => {
|
|
|
1391
1740
|
const rows = buildDataTableRows(store.rowData, columns, rowId);
|
|
1392
1741
|
const pagination = store.config.features.pagination ?? { mode: "client" };
|
|
1393
1742
|
const server = pagination !== false && pagination.mode === "server";
|
|
1394
|
-
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 ?? []);
|
|
1395
1744
|
const sortedRows = server ? filteredRows : sortDataTableRows(filteredRows, columns, store.state.sort ?? []);
|
|
1396
1745
|
const pageRows = pagination === false || server ? sortedRows : paginateDataTableRows(sortedRows, store.state);
|
|
1397
1746
|
const totalRows = server ? pagination.rowCount : sortedRows.length;
|
|
@@ -1463,7 +1812,7 @@ var getActiveGrouping = (store) => {
|
|
|
1463
1812
|
};
|
|
1464
1813
|
var canReorderRows = (store) => {
|
|
1465
1814
|
const pagination = store.config.features.pagination;
|
|
1466
|
-
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");
|
|
1467
1816
|
};
|
|
1468
1817
|
var canMoveRowsToGroups = (store) => getActiveGrouping(store).some((field) => !!field.onMoveToGroup);
|
|
1469
1818
|
var canDragRows = (store) => getActiveGrouping(store).length ? canMoveRowsToGroups(store) : canReorderRows(store);
|
|
@@ -1480,14 +1829,14 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1480
1829
|
};
|
|
1481
1830
|
const CellRenderer = column.colDef.cellRenderer;
|
|
1482
1831
|
if (CellRenderer)
|
|
1483
|
-
return /* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ jsx15(CellRenderer, {
|
|
1484
1833
|
...params
|
|
1485
1834
|
});
|
|
1486
1835
|
const colDef = column.colDef;
|
|
1487
1836
|
if (colDef.type === "reference") {
|
|
1488
1837
|
if (colDef.valueFormatter)
|
|
1489
1838
|
return colDef.valueFormatter(params);
|
|
1490
|
-
return /* @__PURE__ */
|
|
1839
|
+
return /* @__PURE__ */ jsx15(DataTableReferenceCell, {
|
|
1491
1840
|
item: colDef.typeOptions.getItem(row.data),
|
|
1492
1841
|
emptyLabel: colDef.typeOptions.emptyLabel,
|
|
1493
1842
|
imageVariant: colDef.typeOptions.imageVariant
|
|
@@ -1496,8 +1845,8 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1496
1845
|
if (colDef.type === "number") {
|
|
1497
1846
|
if (colDef.valueFormatter)
|
|
1498
1847
|
return colDef.valueFormatter(params);
|
|
1499
|
-
const number =
|
|
1500
|
-
return /* @__PURE__ */
|
|
1848
|
+
const number = Option2.getOrUndefined(decodeNumberValue(value));
|
|
1849
|
+
return /* @__PURE__ */ jsx15("span", {
|
|
1501
1850
|
className: "block text-left tabular-nums",
|
|
1502
1851
|
children: number === undefined ? colDef.typeOptions?.emptyLabel ?? "—" : formatNumberValue(number, colDef.typeOptions, locale)
|
|
1503
1852
|
});
|
|
@@ -1505,16 +1854,16 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1505
1854
|
if (colDef.type === "boolean") {
|
|
1506
1855
|
if (colDef.valueFormatter)
|
|
1507
1856
|
return colDef.valueFormatter(params);
|
|
1508
|
-
const boolean =
|
|
1857
|
+
const boolean = Option2.getOrUndefined(decodeBooleanValue(value));
|
|
1509
1858
|
if (boolean === undefined)
|
|
1510
1859
|
return colDef.typeOptions?.emptyLabel ?? "—";
|
|
1511
1860
|
const options = colDef.typeOptions;
|
|
1512
|
-
return /* @__PURE__ */
|
|
1861
|
+
return /* @__PURE__ */ jsx15("label", {
|
|
1513
1862
|
"data-slot": "data-table-boolean-cell",
|
|
1514
|
-
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"),
|
|
1515
1864
|
onClick: (event) => event.stopPropagation(),
|
|
1516
1865
|
onPointerDown: (event) => event.stopPropagation(),
|
|
1517
|
-
children: /* @__PURE__ */
|
|
1866
|
+
children: /* @__PURE__ */ jsx15(Checkbox, {
|
|
1518
1867
|
"aria-label": options?.getAriaLabel?.(row.data) ?? columnLabel(column),
|
|
1519
1868
|
className: "focus-visible:ring-0 focus-visible:outline-none",
|
|
1520
1869
|
checked: boolean,
|
|
@@ -1528,7 +1877,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1528
1877
|
if (colDef.valueFormatter)
|
|
1529
1878
|
return colDef.valueFormatter(params);
|
|
1530
1879
|
const date = resolveDate(value, colDef.type);
|
|
1531
|
-
return date ? /* @__PURE__ */
|
|
1880
|
+
return date ? /* @__PURE__ */ jsx15("time", {
|
|
1532
1881
|
dateTime: dateIsoValue(date),
|
|
1533
1882
|
children: formatDateValue(date, colDef, locale)
|
|
1534
1883
|
}) : colDef.typeOptions?.emptyLabel ?? "—";
|
|
@@ -1542,7 +1891,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1542
1891
|
disabled: (item) => action.disabled?.({ item, row: row.data }) ?? false
|
|
1543
1892
|
}));
|
|
1544
1893
|
if (config.getOptions) {
|
|
1545
|
-
return /* @__PURE__ */
|
|
1894
|
+
return /* @__PURE__ */ jsx15(DataTableListCell, {
|
|
1546
1895
|
...config,
|
|
1547
1896
|
itemActions,
|
|
1548
1897
|
onItemClick: config.onItemClick ? (item) => config.onItemClick?.({ item, row: row.data }) : undefined,
|
|
@@ -1555,7 +1904,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1555
1904
|
onRemove: config.onRemove ? (value) => config.onRemove?.({ value, row: row.data }) : undefined
|
|
1556
1905
|
});
|
|
1557
1906
|
}
|
|
1558
|
-
return /* @__PURE__ */
|
|
1907
|
+
return /* @__PURE__ */ jsx15(DataTableListCell, {
|
|
1559
1908
|
...config,
|
|
1560
1909
|
itemActions,
|
|
1561
1910
|
onItemClick: config.onItemClick ? (item) => config.onItemClick?.({ item, row: row.data }) : undefined,
|
|
@@ -1568,25 +1917,19 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1568
1917
|
return column.colDef.valueFormatter?.(params) ?? (value === null || value === undefined ? null : String(value));
|
|
1569
1918
|
};
|
|
1570
1919
|
var nodeText = (node) => {
|
|
1571
|
-
if (
|
|
1920
|
+
if (Schema2.is(Schema2.String)(node) || Schema2.is(Schema2.Number)(node))
|
|
1572
1921
|
return String(node);
|
|
1573
1922
|
if (!isValidElement(node))
|
|
1574
1923
|
return "";
|
|
1575
|
-
if (
|
|
1924
|
+
if (Schema2.is(Schema2.String)(node.props.title))
|
|
1576
1925
|
return node.props.title;
|
|
1577
1926
|
return nodeText(node.props.children);
|
|
1578
1927
|
};
|
|
1579
1928
|
var columnLabel = (column) => nodeText(column.colDef.headerName) || column.id;
|
|
1580
1929
|
var withExtension = (fileName, extension) => fileName.includes(".") ? fileName.replace(/\.[^/.]+$/, `.${extension}`) : `${fileName}.${extension}`;
|
|
1581
|
-
var escapeCsvValue = (value) => {
|
|
1582
|
-
if (value === null || value === undefined)
|
|
1583
|
-
return "";
|
|
1584
|
-
const text = String(value);
|
|
1585
|
-
return /[",\n]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text;
|
|
1586
|
-
};
|
|
1587
1930
|
var downloadCsv = (headers, data, fileName = "data.csv") => {
|
|
1588
|
-
const content = [headers, ...data].map((row) => row.map(
|
|
1589
|
-
`);
|
|
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))));
|
|
1590
1933
|
downloadBlob(content, "text/csv;charset=utf-8", withExtension(fileName, "csv"));
|
|
1591
1934
|
};
|
|
1592
1935
|
var downloadJson = (data, fileName = "data.json") => downloadBlob(JSON.stringify(data, null, 2), "application/json;charset=utf-8", withExtension(fileName, "json"));
|
|
@@ -1608,33 +1951,33 @@ var DataTableRowActions = ({
|
|
|
1608
1951
|
const visible = actions.filter((action) => !action.visible || action.visible(row));
|
|
1609
1952
|
if (!visible.length)
|
|
1610
1953
|
return null;
|
|
1611
|
-
return /* @__PURE__ */
|
|
1954
|
+
return /* @__PURE__ */ jsxs9(DropdownMenu, {
|
|
1612
1955
|
children: [
|
|
1613
|
-
/* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger, {
|
|
1614
1957
|
onClick: (event) => event.stopPropagation(),
|
|
1615
|
-
render: /* @__PURE__ */
|
|
1958
|
+
render: /* @__PURE__ */ jsxs9(Button, {
|
|
1616
1959
|
className: "size-8 focus-visible:ring-inset [&_svg:not([class*='size-'])]:size-4",
|
|
1617
1960
|
size: "icon",
|
|
1618
1961
|
variant: "ghost",
|
|
1619
1962
|
children: [
|
|
1620
|
-
/* @__PURE__ */
|
|
1963
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1621
1964
|
className: "sr-only",
|
|
1622
1965
|
children: title
|
|
1623
1966
|
}),
|
|
1624
|
-
/* @__PURE__ */
|
|
1967
|
+
/* @__PURE__ */ jsx15(MoreHorizontal, {})
|
|
1625
1968
|
]
|
|
1626
1969
|
})
|
|
1627
1970
|
}),
|
|
1628
|
-
/* @__PURE__ */
|
|
1971
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent, {
|
|
1629
1972
|
align: "end",
|
|
1630
1973
|
className: "w-max",
|
|
1631
|
-
children: /* @__PURE__ */
|
|
1974
|
+
children: /* @__PURE__ */ jsxs9(DropdownMenuGroup, {
|
|
1632
1975
|
children: [
|
|
1633
|
-
/* @__PURE__ */
|
|
1976
|
+
/* @__PURE__ */ jsx15(DropdownMenuLabel, {
|
|
1634
1977
|
children: title
|
|
1635
1978
|
}),
|
|
1636
|
-
/* @__PURE__ */
|
|
1637
|
-
visible.map((action) => /* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
|
|
1980
|
+
visible.map((action) => /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
1638
1981
|
onClick: (event) => {
|
|
1639
1982
|
event.stopPropagation();
|
|
1640
1983
|
action.onClick(row);
|
|
@@ -1671,7 +2014,7 @@ var DataTableRowActionMenu = ({
|
|
|
1671
2014
|
reorderActions.push({
|
|
1672
2015
|
id: "data-table-move-up",
|
|
1673
2016
|
name: store.config.labels.moveUp,
|
|
1674
|
-
icon: /* @__PURE__ */
|
|
2017
|
+
icon: /* @__PURE__ */ jsx15(ArrowUp, {}),
|
|
1675
2018
|
onClick: () => move(rowIndex - 1)
|
|
1676
2019
|
});
|
|
1677
2020
|
}
|
|
@@ -1679,12 +2022,12 @@ var DataTableRowActionMenu = ({
|
|
|
1679
2022
|
reorderActions.push({
|
|
1680
2023
|
id: "data-table-move-down",
|
|
1681
2024
|
name: store.config.labels.moveDown,
|
|
1682
|
-
icon: /* @__PURE__ */
|
|
2025
|
+
icon: /* @__PURE__ */ jsx15(ArrowDown, {}),
|
|
1683
2026
|
onClick: () => move(rowIndex + 1)
|
|
1684
2027
|
});
|
|
1685
2028
|
}
|
|
1686
2029
|
}
|
|
1687
|
-
return /* @__PURE__ */
|
|
2030
|
+
return /* @__PURE__ */ jsx15(DataTableRowActions, {
|
|
1688
2031
|
actions: [...reorderActions, ...rowActions ? rowActions.items : []],
|
|
1689
2032
|
row: row.data,
|
|
1690
2033
|
title: rowActions?.label ?? store.config.labels.actions
|
|
@@ -1703,12 +2046,13 @@ var DataTableToolbar = ({
|
|
|
1703
2046
|
const grouping = features.grouping;
|
|
1704
2047
|
const toolbar = features.toolbar;
|
|
1705
2048
|
const bulkActions = features.selection && features.selection.bulkActions;
|
|
1706
|
-
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;
|
|
1707
2050
|
if (!hasToolbar)
|
|
1708
2051
|
return null;
|
|
1709
2052
|
const update = (next) => changeState(setStore, next);
|
|
1710
2053
|
const visibleBulkActions = bulkActions ? bulkActions.items.filter((action) => !action.visible || action.visible(selectedRows)) : [];
|
|
1711
|
-
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);
|
|
1712
2056
|
const exportFeature = features.export;
|
|
1713
2057
|
const exportActions = exportFeature ? exportFeature.actions ?? [] : [];
|
|
1714
2058
|
const builtInExport = exportFeature && exportFeature.builtIn !== false;
|
|
@@ -1730,16 +2074,16 @@ var DataTableToolbar = ({
|
|
|
1730
2074
|
setExporting(false);
|
|
1731
2075
|
}
|
|
1732
2076
|
};
|
|
1733
|
-
return /* @__PURE__ */
|
|
2077
|
+
return /* @__PURE__ */ jsxs9("div", {
|
|
1734
2078
|
className: "flex flex-col gap-2 pb-4",
|
|
1735
2079
|
children: [
|
|
1736
|
-
features.search !== false ? /* @__PURE__ */
|
|
2080
|
+
features.search !== false ? /* @__PURE__ */ jsxs9("div", {
|
|
1737
2081
|
className: "relative min-w-0",
|
|
1738
2082
|
children: [
|
|
1739
|
-
/* @__PURE__ */
|
|
2083
|
+
/* @__PURE__ */ jsx15(Search, {
|
|
1740
2084
|
className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2"
|
|
1741
2085
|
}),
|
|
1742
|
-
/* @__PURE__ */
|
|
2086
|
+
/* @__PURE__ */ jsx15(Input, {
|
|
1743
2087
|
className: "px-9",
|
|
1744
2088
|
onChange: (event) => update((state) => ({
|
|
1745
2089
|
...state,
|
|
@@ -1749,7 +2093,7 @@ var DataTableToolbar = ({
|
|
|
1749
2093
|
placeholder: labels.filter,
|
|
1750
2094
|
value: store.state.globalFilter ?? ""
|
|
1751
2095
|
}),
|
|
1752
|
-
store.state.globalFilter ? /* @__PURE__ */
|
|
2096
|
+
store.state.globalFilter ? /* @__PURE__ */ jsx15(Button, {
|
|
1753
2097
|
"aria-label": labels.filter,
|
|
1754
2098
|
className: "absolute top-1/2 right-1 size-7 -translate-y-1/2 active:not-aria-[haspopup]:-translate-y-1/2",
|
|
1755
2099
|
onClick: () => update((state) => ({
|
|
@@ -1759,39 +2103,38 @@ var DataTableToolbar = ({
|
|
|
1759
2103
|
})),
|
|
1760
2104
|
size: "icon",
|
|
1761
2105
|
variant: "ghost",
|
|
1762
|
-
children: /* @__PURE__ */
|
|
2106
|
+
children: /* @__PURE__ */ jsx15(X, {})
|
|
1763
2107
|
}) : null
|
|
1764
2108
|
]
|
|
1765
2109
|
}) : null,
|
|
1766
|
-
/* @__PURE__ */
|
|
2110
|
+
/* @__PURE__ */ jsx15("div", {
|
|
1767
2111
|
className: "-m-1 flex overflow-x-auto p-1",
|
|
1768
|
-
children: /* @__PURE__ */
|
|
2112
|
+
children: /* @__PURE__ */ jsxs9(Menubar, {
|
|
1769
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",
|
|
1770
2114
|
children: [
|
|
1771
|
-
|
|
1772
|
-
visibleBulkActions.length ? /* @__PURE__ */ jsxs8(MenubarMenu, {
|
|
2115
|
+
visibleBulkActions.length ? /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
1773
2116
|
children: [
|
|
1774
|
-
/* @__PURE__ */
|
|
2117
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
1775
2118
|
className: "bg-primary text-primary-foreground hover:bg-primary/90 aria-expanded:bg-primary/90",
|
|
1776
2119
|
children: [
|
|
1777
2120
|
labels.selected,
|
|
1778
|
-
/* @__PURE__ */
|
|
2121
|
+
/* @__PURE__ */ jsx15(Badge, {
|
|
1779
2122
|
variant: "secondary",
|
|
1780
2123
|
children: selectedRows.length
|
|
1781
2124
|
}),
|
|
1782
|
-
/* @__PURE__ */
|
|
2125
|
+
/* @__PURE__ */ jsx15(ChevronDown, {})
|
|
1783
2126
|
]
|
|
1784
2127
|
}),
|
|
1785
|
-
/* @__PURE__ */
|
|
2128
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
1786
2129
|
align: "end",
|
|
1787
2130
|
className: "w-max",
|
|
1788
|
-
children: /* @__PURE__ */
|
|
2131
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
1789
2132
|
children: [
|
|
1790
|
-
/* @__PURE__ */
|
|
2133
|
+
/* @__PURE__ */ jsx15(MenubarLabel, {
|
|
1791
2134
|
children: bulkActions && bulkActions.label ? bulkActions.label : labels.actions
|
|
1792
2135
|
}),
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
visibleBulkActions.map((action) => /* @__PURE__ */
|
|
2136
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2137
|
+
visibleBulkActions.map((action) => /* @__PURE__ */ jsxs9(MenubarItem, {
|
|
1795
2138
|
onClick: () => action.onClick(selectedRows),
|
|
1796
2139
|
variant: action.variant ?? "default",
|
|
1797
2140
|
children: [
|
|
@@ -1804,27 +2147,31 @@ var DataTableToolbar = ({
|
|
|
1804
2147
|
})
|
|
1805
2148
|
]
|
|
1806
2149
|
}) : null,
|
|
1807
|
-
|
|
2150
|
+
toolbar && toolbar.items,
|
|
2151
|
+
features.filtering !== false ? /* @__PURE__ */ jsx15(FilterMenu, {
|
|
2152
|
+
tableAtom
|
|
2153
|
+
}) : null,
|
|
2154
|
+
grouping ? /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
1808
2155
|
children: [
|
|
1809
|
-
/* @__PURE__ */
|
|
2156
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
1810
2157
|
"aria-label": labels.groupBy,
|
|
1811
2158
|
children: [
|
|
1812
|
-
/* @__PURE__ */
|
|
1813
|
-
/* @__PURE__ */
|
|
2159
|
+
/* @__PURE__ */ jsx15(Rows3, {}),
|
|
2160
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1814
2161
|
className: "hidden sm:inline",
|
|
1815
2162
|
children: labels.groupBy
|
|
1816
2163
|
})
|
|
1817
2164
|
]
|
|
1818
2165
|
}),
|
|
1819
|
-
/* @__PURE__ */
|
|
2166
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
1820
2167
|
align: "end",
|
|
1821
|
-
children: /* @__PURE__ */
|
|
2168
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
1822
2169
|
children: [
|
|
1823
|
-
/* @__PURE__ */
|
|
2170
|
+
/* @__PURE__ */ jsx15(MenubarLabel, {
|
|
1824
2171
|
children: labels.groupBy
|
|
1825
2172
|
}),
|
|
1826
|
-
/* @__PURE__ */
|
|
1827
|
-
grouping.fields.map((field) => /* @__PURE__ */
|
|
2173
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2174
|
+
grouping.fields.map((field) => /* @__PURE__ */ jsx15(MenubarCheckboxItem, {
|
|
1828
2175
|
checked: store.state.grouping.includes(field.id),
|
|
1829
2176
|
onCheckedChange: (checked) => update((state) => ({
|
|
1830
2177
|
...state,
|
|
@@ -1837,77 +2184,77 @@ var DataTableToolbar = ({
|
|
|
1837
2184
|
})
|
|
1838
2185
|
]
|
|
1839
2186
|
}) : null,
|
|
1840
|
-
features.sorting !== false ? /* @__PURE__ */
|
|
2187
|
+
features.sorting !== false ? /* @__PURE__ */ jsx15(SortMenu, {
|
|
1841
2188
|
tableAtom
|
|
1842
2189
|
}) : null,
|
|
1843
|
-
features.gallery ? /* @__PURE__ */
|
|
2190
|
+
features.gallery ? /* @__PURE__ */ jsx15(ViewMenu, {
|
|
1844
2191
|
tableAtom
|
|
1845
2192
|
}) : null,
|
|
1846
|
-
features.columnVisibility !== false ? /* @__PURE__ */
|
|
2193
|
+
features.columnVisibility !== false ? /* @__PURE__ */ jsx15(ColumnMenu, {
|
|
1847
2194
|
tableAtom
|
|
1848
2195
|
}) : null,
|
|
1849
|
-
features.refresh ? /* @__PURE__ */
|
|
1850
|
-
children: /* @__PURE__ */
|
|
2196
|
+
features.refresh ? /* @__PURE__ */ jsx15(MenubarMenu, {
|
|
2197
|
+
children: /* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
1851
2198
|
"aria-label": labels.refresh,
|
|
1852
2199
|
onClick: features.refresh,
|
|
1853
2200
|
children: [
|
|
1854
|
-
/* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsx15(RefreshCw, {}),
|
|
2202
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1856
2203
|
className: "hidden sm:inline",
|
|
1857
2204
|
children: labels.refresh
|
|
1858
2205
|
})
|
|
1859
2206
|
]
|
|
1860
2207
|
})
|
|
1861
2208
|
}) : null,
|
|
1862
|
-
features.export ? /* @__PURE__ */
|
|
2209
|
+
features.export ? /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
1863
2210
|
children: [
|
|
1864
|
-
/* @__PURE__ */
|
|
2211
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
1865
2212
|
"aria-label": labels.export,
|
|
1866
2213
|
"aria-busy": exporting,
|
|
1867
2214
|
disabled: exporting || !canExport,
|
|
1868
2215
|
children: [
|
|
1869
|
-
exporting ? /* @__PURE__ */
|
|
2216
|
+
exporting ? /* @__PURE__ */ jsx15(RefreshCw, {
|
|
1870
2217
|
className: "animate-spin"
|
|
1871
|
-
}) : /* @__PURE__ */
|
|
1872
|
-
/* @__PURE__ */
|
|
2218
|
+
}) : /* @__PURE__ */ jsx15(Download, {}),
|
|
2219
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1873
2220
|
className: "hidden sm:inline",
|
|
1874
2221
|
children: exporting ? labels.loading : labels.export
|
|
1875
2222
|
})
|
|
1876
2223
|
]
|
|
1877
2224
|
}),
|
|
1878
|
-
/* @__PURE__ */
|
|
2225
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
1879
2226
|
align: "end",
|
|
1880
|
-
children: /* @__PURE__ */
|
|
2227
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
1881
2228
|
children: [
|
|
1882
|
-
/* @__PURE__ */
|
|
2229
|
+
/* @__PURE__ */ jsx15(MenubarLabel, {
|
|
1883
2230
|
children: labels.export
|
|
1884
2231
|
}),
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
-
builtInExport ? /* @__PURE__ */
|
|
2232
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2233
|
+
builtInExport ? /* @__PURE__ */ jsxs9(Fragment, {
|
|
1887
2234
|
children: [
|
|
1888
|
-
/* @__PURE__ */
|
|
2235
|
+
/* @__PURE__ */ jsxs9(MenubarItem, {
|
|
1889
2236
|
disabled: exporting || !exportRows.length,
|
|
1890
|
-
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"),
|
|
1891
2238
|
children: [
|
|
1892
|
-
/* @__PURE__ */
|
|
2239
|
+
/* @__PURE__ */ jsx15(FileText, {}),
|
|
1893
2240
|
labels.exportCsv
|
|
1894
2241
|
]
|
|
1895
2242
|
}),
|
|
1896
|
-
/* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ jsxs9(MenubarItem, {
|
|
1897
2244
|
disabled: exporting || !exportRows.length,
|
|
1898
|
-
onClick: () => downloadJson(exportRows.map((row) => Object.fromEntries(
|
|
2245
|
+
onClick: () => downloadJson(exportRows.map((row) => Object.fromEntries(exportColumns.map((column) => [
|
|
1899
2246
|
column.id,
|
|
1900
2247
|
getDataTableExportValue(row, column, store.config.locale)
|
|
1901
2248
|
]))), features.export ? features.export.baseName : "table"),
|
|
1902
2249
|
children: [
|
|
1903
|
-
/* @__PURE__ */
|
|
2250
|
+
/* @__PURE__ */ jsx15(FileJson, {}),
|
|
1904
2251
|
labels.exportJson
|
|
1905
2252
|
]
|
|
1906
2253
|
})
|
|
1907
2254
|
]
|
|
1908
2255
|
}) : null,
|
|
1909
|
-
builtInExport && exportActions.length ? /* @__PURE__ */
|
|
1910
|
-
exportActions.map((action) => /* @__PURE__ */
|
|
2256
|
+
builtInExport && exportActions.length ? /* @__PURE__ */ jsx15(MenubarSeparator, {}) : null,
|
|
2257
|
+
exportActions.map((action) => /* @__PURE__ */ jsxs9(MenubarItem, {
|
|
1911
2258
|
disabled: exporting || action.disabled,
|
|
1912
2259
|
onClick: () => void runExport(action),
|
|
1913
2260
|
children: [
|
|
@@ -1923,7 +2270,7 @@ var DataTableToolbar = ({
|
|
|
1923
2270
|
]
|
|
1924
2271
|
})
|
|
1925
2272
|
}),
|
|
1926
|
-
exportFeature && exportFailed ? /* @__PURE__ */
|
|
2273
|
+
exportFeature && exportFailed ? /* @__PURE__ */ jsx15("p", {
|
|
1927
2274
|
role: "alert",
|
|
1928
2275
|
className: "text-destructive text-sm",
|
|
1929
2276
|
children: labels.exportFailed ?? dataTableMessages(store.config.locale).exportFailed
|
|
@@ -1931,11 +2278,349 @@ var DataTableToolbar = ({
|
|
|
1931
2278
|
]
|
|
1932
2279
|
});
|
|
1933
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
|
+
};
|
|
1934
2613
|
var SortMenu = ({
|
|
1935
2614
|
tableAtom
|
|
1936
2615
|
}) => {
|
|
1937
2616
|
const [store, setStore] = useTableAtom(tableAtom);
|
|
1938
|
-
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
|
+
}));
|
|
1939
2624
|
if (!columns.length)
|
|
1940
2625
|
return null;
|
|
1941
2626
|
const current = store.state.sort?.[0];
|
|
@@ -1944,69 +2629,77 @@ var SortMenu = ({
|
|
|
1944
2629
|
sort: [{ id, direction }],
|
|
1945
2630
|
page: 0
|
|
1946
2631
|
}));
|
|
1947
|
-
return /* @__PURE__ */
|
|
2632
|
+
return /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
1948
2633
|
children: [
|
|
1949
|
-
/* @__PURE__ */
|
|
2634
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
1950
2635
|
"aria-label": store.config.labels.sortBy,
|
|
1951
2636
|
children: [
|
|
1952
|
-
current ? current.direction === "desc" ? /* @__PURE__ */
|
|
1953
|
-
/* @__PURE__ */
|
|
2637
|
+
current ? current.direction === "desc" ? /* @__PURE__ */ jsx15(ArrowDown, {}) : /* @__PURE__ */ jsx15(ArrowUp, {}) : /* @__PURE__ */ jsx15(ChevronsUpDown, {}),
|
|
2638
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1954
2639
|
className: "hidden sm:inline",
|
|
1955
2640
|
children: store.config.labels.sortBy
|
|
1956
2641
|
})
|
|
1957
2642
|
]
|
|
1958
2643
|
}),
|
|
1959
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
1960
2645
|
align: "end",
|
|
1961
2646
|
className: "w-52",
|
|
1962
|
-
children:
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
}),
|
|
1972
|
-
/* @__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, {
|
|
1973
2656
|
children: [
|
|
1974
|
-
/* @__PURE__ */
|
|
1975
|
-
onClick: () => sort(column.id, "asc"),
|
|
1976
|
-
children: [
|
|
1977
|
-
/* @__PURE__ */ jsx14(ArrowUp, {}),
|
|
1978
|
-
" ",
|
|
1979
|
-
store.config.labels.sortAsc
|
|
1980
|
-
]
|
|
1981
|
-
}),
|
|
1982
|
-
/* @__PURE__ */ jsxs8(MenubarItem, {
|
|
1983
|
-
onClick: () => sort(column.id, "desc"),
|
|
2657
|
+
/* @__PURE__ */ jsxs9(MenubarSubTrigger, {
|
|
1984
2658
|
children: [
|
|
1985
|
-
/* @__PURE__ */
|
|
1986
|
-
|
|
1987
|
-
store.config.labels.sortDesc
|
|
2659
|
+
sortState ? sortState.direction === "desc" ? /* @__PURE__ */ jsx15(ArrowDown, {}) : /* @__PURE__ */ jsx15(ArrowUp, {}) : null,
|
|
2660
|
+
columnLabel(column)
|
|
1988
2661
|
]
|
|
1989
2662
|
}),
|
|
1990
|
-
|
|
2663
|
+
/* @__PURE__ */ jsxs9(MenubarSubContent, {
|
|
1991
2664
|
children: [
|
|
1992
|
-
/* @__PURE__ */
|
|
1993
|
-
|
|
1994
|
-
onClick: () => changeState(setStore, (state) => ({
|
|
1995
|
-
...state,
|
|
1996
|
-
sort: state.sort?.filter(({ id }) => id !== column.id)
|
|
1997
|
-
})),
|
|
2665
|
+
/* @__PURE__ */ jsxs9(MenubarItem, {
|
|
2666
|
+
onClick: () => sort(column.id, "asc"),
|
|
1998
2667
|
children: [
|
|
1999
|
-
/* @__PURE__ */
|
|
2668
|
+
/* @__PURE__ */ jsx15(ArrowUp, {}),
|
|
2000
2669
|
" ",
|
|
2001
|
-
store.config.labels.
|
|
2670
|
+
store.config.labels.sortAsc
|
|
2002
2671
|
]
|
|
2003
|
-
})
|
|
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
|
|
2004
2697
|
]
|
|
2005
|
-
})
|
|
2698
|
+
})
|
|
2006
2699
|
]
|
|
2007
|
-
})
|
|
2008
|
-
|
|
2009
|
-
|
|
2700
|
+
}, column.id);
|
|
2701
|
+
})
|
|
2702
|
+
]
|
|
2010
2703
|
})
|
|
2011
2704
|
})
|
|
2012
2705
|
]
|
|
@@ -2016,21 +2709,21 @@ var ViewMenu = ({
|
|
|
2016
2709
|
tableAtom
|
|
2017
2710
|
}) => {
|
|
2018
2711
|
const [store, setStore] = useTableAtom(tableAtom);
|
|
2019
|
-
return /* @__PURE__ */
|
|
2712
|
+
return /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
2020
2713
|
children: [
|
|
2021
|
-
/* @__PURE__ */
|
|
2714
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
2022
2715
|
"aria-label": store.config.labels.view,
|
|
2023
2716
|
children: [
|
|
2024
|
-
store.state.view === "gallery" ? /* @__PURE__ */
|
|
2025
|
-
/* @__PURE__ */
|
|
2717
|
+
store.state.view === "gallery" ? /* @__PURE__ */ jsx15(LayoutGrid, {}) : /* @__PURE__ */ jsx15(Rows3, {}),
|
|
2718
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2026
2719
|
className: "hidden sm:inline",
|
|
2027
2720
|
children: store.config.labels.view
|
|
2028
2721
|
})
|
|
2029
2722
|
]
|
|
2030
2723
|
}),
|
|
2031
|
-
/* @__PURE__ */
|
|
2724
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
2032
2725
|
align: "end",
|
|
2033
|
-
children: /* @__PURE__ */
|
|
2726
|
+
children: /* @__PURE__ */ jsxs9(MenubarRadioGroup, {
|
|
2034
2727
|
onValueChange: (view) => {
|
|
2035
2728
|
if (view === "table" || view === "gallery") {
|
|
2036
2729
|
changeState(setStore, (state) => ({ ...state, view }));
|
|
@@ -2038,18 +2731,18 @@ var ViewMenu = ({
|
|
|
2038
2731
|
},
|
|
2039
2732
|
value: store.state.view,
|
|
2040
2733
|
children: [
|
|
2041
|
-
/* @__PURE__ */
|
|
2734
|
+
/* @__PURE__ */ jsxs9(MenubarRadioItem, {
|
|
2042
2735
|
value: "table",
|
|
2043
2736
|
children: [
|
|
2044
|
-
/* @__PURE__ */
|
|
2737
|
+
/* @__PURE__ */ jsx15(Rows3, {}),
|
|
2045
2738
|
" ",
|
|
2046
2739
|
store.config.labels.tableView
|
|
2047
2740
|
]
|
|
2048
2741
|
}),
|
|
2049
|
-
/* @__PURE__ */
|
|
2742
|
+
/* @__PURE__ */ jsxs9(MenubarRadioItem, {
|
|
2050
2743
|
value: "gallery",
|
|
2051
2744
|
children: [
|
|
2052
|
-
/* @__PURE__ */
|
|
2745
|
+
/* @__PURE__ */ jsx15(LayoutGrid, {}),
|
|
2053
2746
|
" ",
|
|
2054
2747
|
store.config.labels.galleryView
|
|
2055
2748
|
]
|
|
@@ -2067,27 +2760,27 @@ var ColumnMenu = ({
|
|
|
2067
2760
|
const columns = deriveModel(store).columns.filter(({ colDef }) => colDef.hideable !== false);
|
|
2068
2761
|
if (!columns.length)
|
|
2069
2762
|
return null;
|
|
2070
|
-
return /* @__PURE__ */
|
|
2763
|
+
return /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
2071
2764
|
children: [
|
|
2072
|
-
/* @__PURE__ */
|
|
2765
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
2073
2766
|
"aria-label": store.config.labels.columns,
|
|
2074
2767
|
children: [
|
|
2075
|
-
/* @__PURE__ */
|
|
2076
|
-
/* @__PURE__ */
|
|
2768
|
+
/* @__PURE__ */ jsx15(Settings2, {}),
|
|
2769
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2077
2770
|
className: "hidden sm:inline",
|
|
2078
2771
|
children: store.config.labels.columns
|
|
2079
2772
|
})
|
|
2080
2773
|
]
|
|
2081
2774
|
}),
|
|
2082
|
-
/* @__PURE__ */
|
|
2775
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
2083
2776
|
align: "end",
|
|
2084
|
-
children: /* @__PURE__ */
|
|
2777
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
2085
2778
|
children: [
|
|
2086
|
-
/* @__PURE__ */
|
|
2779
|
+
/* @__PURE__ */ jsx15(MenubarLabel, {
|
|
2087
2780
|
children: store.config.labels.columns
|
|
2088
2781
|
}),
|
|
2089
|
-
/* @__PURE__ */
|
|
2090
|
-
columns.map((column) => /* @__PURE__ */
|
|
2782
|
+
/* @__PURE__ */ jsx15(MenubarSeparator, {}),
|
|
2783
|
+
columns.map((column) => /* @__PURE__ */ jsx15(MenubarCheckboxItem, {
|
|
2091
2784
|
checked: store.state.columnVisibility[column.id] !== false,
|
|
2092
2785
|
onCheckedChange: (visible) => changeState(setStore, (state) => ({
|
|
2093
2786
|
...state,
|
|
@@ -2140,7 +2833,7 @@ var ResizeHandle = ({
|
|
|
2140
2833
|
const reset = () => {
|
|
2141
2834
|
resizeRef.current = null;
|
|
2142
2835
|
};
|
|
2143
|
-
return /* @__PURE__ */
|
|
2836
|
+
return /* @__PURE__ */ jsx15("button", {
|
|
2144
2837
|
"aria-label": store.config.labels.resizeColumn(columnLabel(column)),
|
|
2145
2838
|
"aria-orientation": "vertical",
|
|
2146
2839
|
"aria-valuemax": column.colDef.maxWidth ?? DEFAULT_MAX_WIDTH,
|
|
@@ -2262,9 +2955,9 @@ var DragHandle = ({
|
|
|
2262
2955
|
reordering.onReorder(reorderDataTableRows(model.rows, rowId, target.id));
|
|
2263
2956
|
}
|
|
2264
2957
|
};
|
|
2265
|
-
return /* @__PURE__ */
|
|
2958
|
+
return /* @__PURE__ */ jsxs9(Fragment, {
|
|
2266
2959
|
children: [
|
|
2267
|
-
/* @__PURE__ */
|
|
2960
|
+
/* @__PURE__ */ jsx15(Button, {
|
|
2268
2961
|
"aria-label": store.config.features.reordering && store.config.features.reordering.handleLabel ? store.config.features.reordering.handleLabel : store.config.labels.reorder,
|
|
2269
2962
|
className: "size-8 cursor-grab touch-none active:cursor-grabbing",
|
|
2270
2963
|
onClick: (event) => event.stopPropagation(),
|
|
@@ -2282,9 +2975,9 @@ var DragHandle = ({
|
|
|
2282
2975
|
onPointerUp: finish,
|
|
2283
2976
|
size: "icon",
|
|
2284
2977
|
variant: "ghost",
|
|
2285
|
-
children: /* @__PURE__ */
|
|
2978
|
+
children: /* @__PURE__ */ jsx15(GripVertical, {})
|
|
2286
2979
|
}),
|
|
2287
|
-
overlay ? createPortal(/* @__PURE__ */
|
|
2980
|
+
overlay ? createPortal(/* @__PURE__ */ jsx15("div", {
|
|
2288
2981
|
"aria-hidden": "true",
|
|
2289
2982
|
className: "bg-background pointer-events-none fixed z-[100] rounded-md border px-3 py-2 text-sm shadow-lg",
|
|
2290
2983
|
style: { left: overlay.x + 12, top: overlay.y + 12 },
|
|
@@ -2314,8 +3007,8 @@ var TableDataRow = ({
|
|
|
2314
3007
|
const selection = store.config.features.selection;
|
|
2315
3008
|
const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
|
|
2316
3009
|
const draggable = canDragRows(store);
|
|
2317
|
-
return /* @__PURE__ */
|
|
2318
|
-
className: cn("group/row
|
|
3010
|
+
return /* @__PURE__ */ jsxs9(TableRow, {
|
|
3011
|
+
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"),
|
|
2319
3012
|
"data-state": store.state.rowSelection[row.id] && "selected",
|
|
2320
3013
|
"data-table-row": row.id,
|
|
2321
3014
|
onClick: () => store.config.onRowClicked?.(row.data),
|
|
@@ -2327,36 +3020,36 @@ var TableDataRow = ({
|
|
|
2327
3020
|
},
|
|
2328
3021
|
tabIndex: store.config.onRowClicked ? 0 : undefined,
|
|
2329
3022
|
children: [
|
|
2330
|
-
selection ? /* @__PURE__ */
|
|
3023
|
+
selection ? /* @__PURE__ */ jsx15(TableCell, {
|
|
2331
3024
|
className: "w-10 pr-0",
|
|
2332
3025
|
onClick: (event) => event.stopPropagation(),
|
|
2333
|
-
children: /* @__PURE__ */
|
|
3026
|
+
children: /* @__PURE__ */ jsx15(Checkbox, {
|
|
2334
3027
|
"aria-label": store.config.labels.selectRow,
|
|
2335
3028
|
checked: !!store.state.rowSelection[row.id],
|
|
2336
3029
|
disabled: !selectable,
|
|
2337
3030
|
onCheckedChange: (checked) => toggleRow(store, setStore, row.id, checked)
|
|
2338
3031
|
})
|
|
2339
3032
|
}) : null,
|
|
2340
|
-
draggable ? /* @__PURE__ */
|
|
3033
|
+
draggable ? /* @__PURE__ */ jsx15(TableCell, {
|
|
2341
3034
|
className: "w-10 pr-0",
|
|
2342
|
-
children: /* @__PURE__ */
|
|
3035
|
+
children: /* @__PURE__ */ jsx15(DragHandle, {
|
|
2343
3036
|
tableAtom
|
|
2344
3037
|
})
|
|
2345
3038
|
}) : null,
|
|
2346
|
-
model.visibleColumns.map((column) => /* @__PURE__ */
|
|
2347
|
-
className: cn("min-w-24 overflow-hidden has-[[data-slot=data-table-
|
|
3039
|
+
model.visibleColumns.map((column) => /* @__PURE__ */ jsx15(TableCell, {
|
|
3040
|
+
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"),
|
|
2348
3041
|
style: { width: column.width },
|
|
2349
|
-
children: /* @__PURE__ */
|
|
3042
|
+
children: /* @__PURE__ */ jsx15("div", {
|
|
2350
3043
|
className: cn("min-w-0", column.colDef.truncate && "truncate"),
|
|
2351
3044
|
children: renderCell(row, column, store.config.locale, store.config.labels)
|
|
2352
3045
|
})
|
|
2353
3046
|
}, column.id)),
|
|
2354
|
-
hasRowActionMenu(store) ? /* @__PURE__ */
|
|
3047
|
+
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15(TableCell, {
|
|
2355
3048
|
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))]",
|
|
2356
3049
|
onClick: (event) => event.stopPropagation(),
|
|
2357
|
-
children: /* @__PURE__ */
|
|
3050
|
+
children: /* @__PURE__ */ jsx15("div", {
|
|
2358
3051
|
className: "flex h-16 items-center justify-center",
|
|
2359
|
-
children: /* @__PURE__ */
|
|
3052
|
+
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
2360
3053
|
tableAtom
|
|
2361
3054
|
})
|
|
2362
3055
|
})
|
|
@@ -2372,26 +3065,26 @@ var GroupActions = ({
|
|
|
2372
3065
|
const visible = actions?.filter((action) => !action.visible || action.visible(groupId));
|
|
2373
3066
|
if (!visible?.length)
|
|
2374
3067
|
return null;
|
|
2375
|
-
return /* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ jsxs9(DropdownMenu, {
|
|
2376
3069
|
children: [
|
|
2377
|
-
/* @__PURE__ */
|
|
3070
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger, {
|
|
2378
3071
|
onClick: (event) => event.stopPropagation(),
|
|
2379
|
-
render: /* @__PURE__ */
|
|
3072
|
+
render: /* @__PURE__ */ jsxs9(Button, {
|
|
2380
3073
|
size: "icon",
|
|
2381
3074
|
variant: "ghost",
|
|
2382
3075
|
children: [
|
|
2383
|
-
/* @__PURE__ */
|
|
3076
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2384
3077
|
className: "sr-only",
|
|
2385
3078
|
children: title
|
|
2386
3079
|
}),
|
|
2387
|
-
/* @__PURE__ */
|
|
3080
|
+
/* @__PURE__ */ jsx15(MoreHorizontal, {})
|
|
2388
3081
|
]
|
|
2389
3082
|
})
|
|
2390
3083
|
}),
|
|
2391
|
-
/* @__PURE__ */
|
|
3084
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent, {
|
|
2392
3085
|
align: "end",
|
|
2393
|
-
children: /* @__PURE__ */
|
|
2394
|
-
children: visible.map((action) => /* @__PURE__ */
|
|
3086
|
+
children: /* @__PURE__ */ jsx15(DropdownMenuGroup, {
|
|
3087
|
+
children: visible.map((action) => /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
2395
3088
|
onClick: () => action.onClick(groupId),
|
|
2396
3089
|
variant: action.variant ?? "default",
|
|
2397
3090
|
children: [
|
|
@@ -2422,40 +3115,40 @@ var GroupedTable = ({
|
|
|
2422
3115
|
[section.key]: !collapsed
|
|
2423
3116
|
}
|
|
2424
3117
|
}));
|
|
2425
|
-
const body = /* @__PURE__ */
|
|
3118
|
+
const body = /* @__PURE__ */ jsxs9(TableBody, {
|
|
2426
3119
|
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",
|
|
2427
3120
|
"data-table-group": section.field.onMoveToGroup ? targetKey : undefined,
|
|
2428
3121
|
children: [
|
|
2429
|
-
/* @__PURE__ */
|
|
3122
|
+
/* @__PURE__ */ jsx15(TableRow, {
|
|
2430
3123
|
className: "bg-muted/40 hover:bg-accent! cursor-pointer",
|
|
2431
3124
|
onClick: toggleCollapsed,
|
|
2432
|
-
children: /* @__PURE__ */
|
|
3125
|
+
children: /* @__PURE__ */ jsx15(TableCell, {
|
|
2433
3126
|
colSpan: model.visibleColumns.length + extra,
|
|
2434
|
-
children: /* @__PURE__ */
|
|
3127
|
+
children: /* @__PURE__ */ jsxs9("div", {
|
|
2435
3128
|
className: "flex items-center gap-2",
|
|
2436
3129
|
style: { paddingLeft: section.depth * 20 },
|
|
2437
3130
|
children: [
|
|
2438
|
-
/* @__PURE__ */
|
|
3131
|
+
/* @__PURE__ */ jsxs9("button", {
|
|
2439
3132
|
"aria-expanded": !collapsed,
|
|
2440
3133
|
className: "flex flex-1 cursor-pointer items-center gap-2 text-left font-medium",
|
|
2441
3134
|
type: "button",
|
|
2442
3135
|
children: [
|
|
2443
|
-
collapsed ? /* @__PURE__ */
|
|
3136
|
+
collapsed ? /* @__PURE__ */ jsx15(ChevronRight2, {
|
|
2444
3137
|
className: "size-4"
|
|
2445
|
-
}) : /* @__PURE__ */
|
|
3138
|
+
}) : /* @__PURE__ */ jsx15(ChevronDown, {
|
|
2446
3139
|
className: "size-4"
|
|
2447
3140
|
}),
|
|
2448
|
-
/* @__PURE__ */
|
|
3141
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2449
3142
|
className: "flex-1",
|
|
2450
3143
|
children: section.field.renderGroupLabel?.(section.groupId, section.rows.map((row) => row.data)) ?? section.groupId
|
|
2451
3144
|
})
|
|
2452
3145
|
]
|
|
2453
3146
|
}),
|
|
2454
|
-
/* @__PURE__ */
|
|
3147
|
+
/* @__PURE__ */ jsx15(Badge, {
|
|
2455
3148
|
variant: "secondary",
|
|
2456
3149
|
children: section.rows.length
|
|
2457
3150
|
}),
|
|
2458
|
-
/* @__PURE__ */
|
|
3151
|
+
/* @__PURE__ */ jsx15(GroupActions, {
|
|
2459
3152
|
actions: section.field.actions,
|
|
2460
3153
|
groupId: section.groupId,
|
|
2461
3154
|
title: section.field.actionsLabel ?? store.config.labels.actions
|
|
@@ -2464,14 +3157,14 @@ var GroupedTable = ({
|
|
|
2464
3157
|
})
|
|
2465
3158
|
})
|
|
2466
3159
|
}),
|
|
2467
|
-
!collapsed && !section.children.length ? section.rows.length ? section.rows.map((row) => /* @__PURE__ */
|
|
3160
|
+
!collapsed && !section.children.length ? section.rows.length ? section.rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
|
|
2468
3161
|
value: row.id,
|
|
2469
|
-
children: /* @__PURE__ */
|
|
3162
|
+
children: /* @__PURE__ */ jsx15(TableDataRow, {
|
|
2470
3163
|
tableAtom
|
|
2471
3164
|
})
|
|
2472
3165
|
}, `${section.key}:${row.id}`)) : [
|
|
2473
|
-
/* @__PURE__ */
|
|
2474
|
-
children: /* @__PURE__ */
|
|
3166
|
+
/* @__PURE__ */ jsx15(TableRow, {
|
|
3167
|
+
children: /* @__PURE__ */ jsx15(TableCell, {
|
|
2475
3168
|
className: "text-muted-foreground h-16",
|
|
2476
3169
|
colSpan: model.visibleColumns.length + extra,
|
|
2477
3170
|
children: section.field.renderEmptyGroup?.(section.groupId) ?? store.config.labels.empty
|
|
@@ -2482,7 +3175,7 @@ var GroupedTable = ({
|
|
|
2482
3175
|
}, section.key);
|
|
2483
3176
|
return !collapsed && section.children.length ? [body, renderSections(section.children)] : [body];
|
|
2484
3177
|
});
|
|
2485
|
-
return /* @__PURE__ */
|
|
3178
|
+
return /* @__PURE__ */ jsx15(Fragment, {
|
|
2486
3179
|
children: renderSections(sections)
|
|
2487
3180
|
});
|
|
2488
3181
|
};
|
|
@@ -2491,79 +3184,159 @@ var ColumnHeaderMenu = ({
|
|
|
2491
3184
|
}) => {
|
|
2492
3185
|
const [store, setStore] = useTableAtom(tableAtom);
|
|
2493
3186
|
const columnId = useRequiredId(ColumnIdContext);
|
|
2494
|
-
const
|
|
3187
|
+
const model = deriveModel(store);
|
|
3188
|
+
const column = model.columns.find(({ id }) => id === columnId);
|
|
2495
3189
|
if (!column)
|
|
2496
3190
|
return null;
|
|
2497
|
-
const
|
|
3191
|
+
const sortColumns = getDataTableSortColumns([column]);
|
|
3192
|
+
const filterColumns = getDataTableFilterColumns([column]);
|
|
3193
|
+
const filteringEnabled = store.config.features.filtering !== false && filterColumns.length > 0;
|
|
3194
|
+
const ownsFilter = (id) => id === column.id || getDataTableFieldColumns(column).some((field) => field.id === id);
|
|
3195
|
+
const activeFilters = (store.state.filters ?? []).filter(({ id }) => ownsFilter(id));
|
|
3196
|
+
const filterEditor = (field) => /* @__PURE__ */ jsx15(FilterEditor, {
|
|
3197
|
+
column: field,
|
|
3198
|
+
rows: model.rows,
|
|
3199
|
+
current: store.state.filters?.find((filter) => filter.id === field.id),
|
|
3200
|
+
labels: store.config.labels,
|
|
3201
|
+
onChange: (filter) => changeState(setStore, (state) => withColumnFilter(state, field.id, filter))
|
|
3202
|
+
});
|
|
3203
|
+
const sortingEnabled = store.config.features.sorting !== false && sortColumns.length > 0;
|
|
2498
3204
|
const hidingEnabled = store.config.features.columnVisibility !== false && column.colDef.hideable !== false;
|
|
2499
|
-
const
|
|
3205
|
+
const ownsSort = (id) => id === column.id || sortColumns.some((field) => field.id === id);
|
|
3206
|
+
const sort = store.state.sort?.find(({ id }) => ownsSort(id));
|
|
2500
3207
|
const update = (next) => changeState(setStore, next);
|
|
2501
|
-
const setSort = (direction) => update((state) => ({
|
|
3208
|
+
const setSort = (id, direction) => update((state) => ({
|
|
2502
3209
|
...state,
|
|
2503
|
-
sort: [{ id
|
|
3210
|
+
sort: [{ id, direction }],
|
|
2504
3211
|
page: 0
|
|
2505
3212
|
}));
|
|
2506
3213
|
const label = columnLabel(column);
|
|
2507
|
-
|
|
2508
|
-
|
|
3214
|
+
const sortItems = (field) => /* @__PURE__ */ jsxs9(Fragment, {
|
|
3215
|
+
children: [
|
|
3216
|
+
/* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
3217
|
+
onClick: () => setSort(field.id, "asc"),
|
|
3218
|
+
children: [
|
|
3219
|
+
/* @__PURE__ */ jsx15(ArrowUp, {}),
|
|
3220
|
+
" ",
|
|
3221
|
+
store.config.labels.sortAsc
|
|
3222
|
+
]
|
|
3223
|
+
}),
|
|
3224
|
+
/* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
3225
|
+
onClick: () => setSort(field.id, "desc"),
|
|
3226
|
+
children: [
|
|
3227
|
+
/* @__PURE__ */ jsx15(ArrowDown, {}),
|
|
3228
|
+
" ",
|
|
3229
|
+
store.config.labels.sortDesc
|
|
3230
|
+
]
|
|
3231
|
+
})
|
|
3232
|
+
]
|
|
3233
|
+
});
|
|
3234
|
+
if (!sortingEnabled && !hidingEnabled && !filteringEnabled) {
|
|
3235
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2509
3236
|
className: "truncate px-2",
|
|
2510
3237
|
children: column.colDef.headerName
|
|
2511
3238
|
});
|
|
2512
3239
|
}
|
|
2513
|
-
return /* @__PURE__ */
|
|
3240
|
+
return /* @__PURE__ */ jsxs9(DropdownMenu, {
|
|
2514
3241
|
children: [
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
render: /* @__PURE__ */
|
|
3242
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger, {
|
|
3243
|
+
render: /* @__PURE__ */ jsxs9(Button, {
|
|
2517
3244
|
"aria-label": label,
|
|
3245
|
+
"aria-description": activeFilters.length ? `${store.config.labels.filters}: ${activeFilters.length}` : undefined,
|
|
2518
3246
|
className: "absolute inset-0 h-full w-full min-w-0 justify-start rounded-none px-2 pr-4 focus-visible:ring-inset",
|
|
2519
3247
|
variant: "ghost",
|
|
2520
3248
|
children: [
|
|
2521
|
-
/* @__PURE__ */
|
|
3249
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2522
3250
|
className: "truncate",
|
|
2523
3251
|
children: column.colDef.headerName
|
|
2524
3252
|
}),
|
|
2525
|
-
|
|
3253
|
+
activeFilters.length ? /* @__PURE__ */ jsx15(ListFilter, {}) : null,
|
|
3254
|
+
sort ? sort.direction === "desc" ? /* @__PURE__ */ jsx15(ArrowDown, {}) : /* @__PURE__ */ jsx15(ArrowUp, {}) : null
|
|
2526
3255
|
]
|
|
2527
3256
|
})
|
|
2528
3257
|
}),
|
|
2529
|
-
/* @__PURE__ */
|
|
3258
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent, {
|
|
2530
3259
|
align: "start",
|
|
2531
3260
|
className: "w-48",
|
|
2532
|
-
children: /* @__PURE__ */
|
|
3261
|
+
children: /* @__PURE__ */ jsxs9(DropdownMenuGroup, {
|
|
2533
3262
|
children: [
|
|
2534
|
-
sortingEnabled ? /* @__PURE__ */
|
|
3263
|
+
sortingEnabled ? /* @__PURE__ */ jsxs9(Fragment, {
|
|
2535
3264
|
children: [
|
|
2536
|
-
/* @__PURE__ */
|
|
2537
|
-
onClick: () => setSort("asc"),
|
|
3265
|
+
column.colDef.fields?.length ? sortColumns.map((field) => /* @__PURE__ */ jsxs9(DropdownMenuSub, {
|
|
2538
3266
|
children: [
|
|
2539
|
-
/* @__PURE__ */
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
/* @__PURE__ */ jsx14(ArrowDown, {}),
|
|
2548
|
-
" ",
|
|
2549
|
-
store.config.labels.sortDesc
|
|
3267
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubTrigger, {
|
|
3268
|
+
children: columnLabel(field)
|
|
3269
|
+
}),
|
|
3270
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubContent, {
|
|
3271
|
+
children: /* @__PURE__ */ jsx15(DropdownMenuGroup, {
|
|
3272
|
+
children: sortItems(field)
|
|
3273
|
+
})
|
|
3274
|
+
})
|
|
2550
3275
|
]
|
|
2551
|
-
}),
|
|
2552
|
-
sort ? /* @__PURE__ */
|
|
3276
|
+
}, field.id)) : sortItems(column),
|
|
3277
|
+
sort ? /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
2553
3278
|
onClick: () => update((state) => ({
|
|
2554
3279
|
...state,
|
|
2555
|
-
sort: state.sort?.filter(({ id }) => id
|
|
3280
|
+
sort: state.sort?.filter(({ id }) => !ownsSort(id))
|
|
2556
3281
|
})),
|
|
2557
3282
|
children: [
|
|
2558
|
-
/* @__PURE__ */
|
|
3283
|
+
/* @__PURE__ */ jsx15(X, {}),
|
|
2559
3284
|
" ",
|
|
2560
3285
|
store.config.labels.sortClear
|
|
2561
3286
|
]
|
|
2562
3287
|
}) : null
|
|
2563
3288
|
]
|
|
2564
3289
|
}) : null,
|
|
2565
|
-
sortingEnabled &&
|
|
2566
|
-
|
|
3290
|
+
sortingEnabled && filteringEnabled ? /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}) : null,
|
|
3291
|
+
filteringEnabled ? /* @__PURE__ */ jsxs9(Fragment, {
|
|
3292
|
+
children: [
|
|
3293
|
+
/* @__PURE__ */ jsxs9(DropdownMenuSub, {
|
|
3294
|
+
children: [
|
|
3295
|
+
/* @__PURE__ */ jsxs9(DropdownMenuSubTrigger, {
|
|
3296
|
+
children: [
|
|
3297
|
+
/* @__PURE__ */ jsx15(ListFilter, {}),
|
|
3298
|
+
store.config.labels.filters
|
|
3299
|
+
]
|
|
3300
|
+
}),
|
|
3301
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubContent, {
|
|
3302
|
+
className: "w-80 max-w-[calc(100vw-2rem)]",
|
|
3303
|
+
children: column.colDef.fields?.length ? /* @__PURE__ */ jsx15(DropdownMenuGroup, {
|
|
3304
|
+
children: filterColumns.map((field) => /* @__PURE__ */ jsxs9(DropdownMenuSub, {
|
|
3305
|
+
children: [
|
|
3306
|
+
/* @__PURE__ */ jsxs9(DropdownMenuSubTrigger, {
|
|
3307
|
+
children: [
|
|
3308
|
+
columnLabel(field),
|
|
3309
|
+
activeFilters.some((filter) => filter.id === field.id) ? /* @__PURE__ */ jsx15(Check, {}) : null
|
|
3310
|
+
]
|
|
3311
|
+
}),
|
|
3312
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubContent, {
|
|
3313
|
+
className: "w-80 max-w-[calc(100vw-2rem)]",
|
|
3314
|
+
children: filterEditor(field)
|
|
3315
|
+
})
|
|
3316
|
+
]
|
|
3317
|
+
}, field.id))
|
|
3318
|
+
}) : filterEditor(column)
|
|
3319
|
+
})
|
|
3320
|
+
]
|
|
3321
|
+
}),
|
|
3322
|
+
activeFilters.length ? /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
3323
|
+
onClick: () => update((state) => {
|
|
3324
|
+
const filters = state.filters?.filter(({ id }) => !ownsFilter(id));
|
|
3325
|
+
return {
|
|
3326
|
+
...state,
|
|
3327
|
+
page: 0,
|
|
3328
|
+
filters: filters?.length ? filters : undefined
|
|
3329
|
+
};
|
|
3330
|
+
}),
|
|
3331
|
+
children: [
|
|
3332
|
+
/* @__PURE__ */ jsx15(X, {}),
|
|
3333
|
+
store.config.labels.filterClear
|
|
3334
|
+
]
|
|
3335
|
+
}) : null
|
|
3336
|
+
]
|
|
3337
|
+
}) : null,
|
|
3338
|
+
(sortingEnabled || filteringEnabled) && hidingEnabled ? /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}) : null,
|
|
3339
|
+
hidingEnabled ? /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
2567
3340
|
onClick: () => update((state) => ({
|
|
2568
3341
|
...state,
|
|
2569
3342
|
columnVisibility: {
|
|
@@ -2572,7 +3345,7 @@ var ColumnHeaderMenu = ({
|
|
|
2572
3345
|
}
|
|
2573
3346
|
})),
|
|
2574
3347
|
children: [
|
|
2575
|
-
/* @__PURE__ */
|
|
3348
|
+
/* @__PURE__ */ jsx15(EyeOff, {}),
|
|
2576
3349
|
" ",
|
|
2577
3350
|
store.config.labels.hideColumn
|
|
2578
3351
|
]
|
|
@@ -2594,12 +3367,12 @@ var DataTableHeader = ({
|
|
|
2594
3367
|
const selectableRows = getDataTableSelectableRows(model, grouped, selection ? selection.isRowSelectable : undefined);
|
|
2595
3368
|
const allSelected = selectableRows.length > 0 && selectableRows.every((row) => store.state.rowSelection[row.id]);
|
|
2596
3369
|
const someSelected = selectableRows.some((row) => store.state.rowSelection[row.id]);
|
|
2597
|
-
return /* @__PURE__ */
|
|
2598
|
-
children: /* @__PURE__ */
|
|
3370
|
+
return /* @__PURE__ */ jsx15(TableHeader, {
|
|
3371
|
+
children: /* @__PURE__ */ jsxs9(TableRow, {
|
|
2599
3372
|
children: [
|
|
2600
|
-
selection ? /* @__PURE__ */
|
|
3373
|
+
selection ? /* @__PURE__ */ jsx15(TableHead, {
|
|
2601
3374
|
className: "w-10 pr-0",
|
|
2602
|
-
children: /* @__PURE__ */
|
|
3375
|
+
children: /* @__PURE__ */ jsx15(Checkbox, {
|
|
2603
3376
|
"aria-label": store.config.labels.selectAllRows,
|
|
2604
3377
|
checked: allSelected,
|
|
2605
3378
|
indeterminate: someSelected && !allSelected,
|
|
@@ -2613,30 +3386,30 @@ var DataTableHeader = ({
|
|
|
2613
3386
|
}
|
|
2614
3387
|
})
|
|
2615
3388
|
}) : null,
|
|
2616
|
-
draggable ? /* @__PURE__ */
|
|
3389
|
+
draggable ? /* @__PURE__ */ jsx15(TableHead, {
|
|
2617
3390
|
className: "w-10"
|
|
2618
3391
|
}) : null,
|
|
2619
3392
|
model.visibleColumns.map((column) => {
|
|
2620
3393
|
const direction = store.state.sort?.find(({ id }) => id === column.id)?.direction;
|
|
2621
|
-
return /* @__PURE__ */
|
|
3394
|
+
return /* @__PURE__ */ jsx15(TableHead, {
|
|
2622
3395
|
"aria-sort": direction === "asc" ? "ascending" : direction === "desc" ? "descending" : undefined,
|
|
2623
3396
|
className: "relative h-12 p-0",
|
|
2624
3397
|
scope: "col",
|
|
2625
3398
|
style: { width: column.width },
|
|
2626
|
-
children: /* @__PURE__ */
|
|
3399
|
+
children: /* @__PURE__ */ jsxs9(ColumnIdContext.Provider, {
|
|
2627
3400
|
value: column.id,
|
|
2628
3401
|
children: [
|
|
2629
|
-
/* @__PURE__ */
|
|
3402
|
+
/* @__PURE__ */ jsx15(ColumnHeaderMenu, {
|
|
2630
3403
|
tableAtom
|
|
2631
3404
|
}),
|
|
2632
|
-
/* @__PURE__ */
|
|
3405
|
+
/* @__PURE__ */ jsx15(ResizeHandle, {
|
|
2633
3406
|
tableAtom
|
|
2634
3407
|
})
|
|
2635
3408
|
]
|
|
2636
3409
|
})
|
|
2637
3410
|
}, column.id);
|
|
2638
3411
|
}),
|
|
2639
|
-
hasRowActionMenu(store) ? /* @__PURE__ */
|
|
3412
|
+
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15(TableHead, {
|
|
2640
3413
|
className: "w-10"
|
|
2641
3414
|
}) : null
|
|
2642
3415
|
]
|
|
@@ -2654,29 +3427,29 @@ var DataTableBody = ({
|
|
|
2654
3427
|
const sections = groupDataTableRows(rows, fields);
|
|
2655
3428
|
const colSpan = model.visibleColumns.length + (store.config.features.selection ? 1 : 0) + (hasRowActionMenu(store) ? 1 : 0) + (canDragRows(store) ? 1 : 0);
|
|
2656
3429
|
if (sections.length && (rows.length || !store.config.status.loading) && !store.config.status.error) {
|
|
2657
|
-
return /* @__PURE__ */
|
|
3430
|
+
return /* @__PURE__ */ jsx15(GroupedTable, {
|
|
2658
3431
|
tableAtom,
|
|
2659
3432
|
sections
|
|
2660
3433
|
});
|
|
2661
3434
|
}
|
|
2662
|
-
return /* @__PURE__ */
|
|
2663
|
-
children: store.config.status.error || !rows.length && !store.config.status.loading ? /* @__PURE__ */
|
|
2664
|
-
children: /* @__PURE__ */
|
|
3435
|
+
return /* @__PURE__ */ jsx15(TableBody, {
|
|
3436
|
+
children: store.config.status.error || !rows.length && !store.config.status.loading ? /* @__PURE__ */ jsx15(TableRow, {
|
|
3437
|
+
children: /* @__PURE__ */ jsx15(TableCell, {
|
|
2665
3438
|
className: "h-24 text-center",
|
|
2666
3439
|
colSpan: Math.max(colSpan, 1),
|
|
2667
3440
|
children: store.config.status.error ?? store.config.status.empty ?? store.config.labels.empty
|
|
2668
3441
|
})
|
|
2669
|
-
}) : store.config.status.loading && !rows.length ? /* @__PURE__ */
|
|
2670
|
-
children: /* @__PURE__ */
|
|
3442
|
+
}) : store.config.status.loading && !rows.length ? /* @__PURE__ */ jsx15(TableRow, {
|
|
3443
|
+
children: /* @__PURE__ */ jsx15(TableCell, {
|
|
2671
3444
|
className: "h-24 text-center",
|
|
2672
3445
|
colSpan: Math.max(colSpan, 1),
|
|
2673
|
-
children: /* @__PURE__ */
|
|
3446
|
+
children: /* @__PURE__ */ jsx15(Loading, {
|
|
2674
3447
|
label: store.config.labels.loading
|
|
2675
3448
|
})
|
|
2676
3449
|
})
|
|
2677
|
-
}) : rows.map((row) => /* @__PURE__ */
|
|
3450
|
+
}) : rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
|
|
2678
3451
|
value: row.id,
|
|
2679
|
-
children: /* @__PURE__ */
|
|
3452
|
+
children: /* @__PURE__ */ jsx15(TableDataRow, {
|
|
2680
3453
|
tableAtom
|
|
2681
3454
|
})
|
|
2682
3455
|
}, row.id))
|
|
@@ -2699,8 +3472,8 @@ var GalleryCard = ({
|
|
|
2699
3472
|
const selection = store.config.features.selection;
|
|
2700
3473
|
const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
|
|
2701
3474
|
const draggable = canDragRows(store);
|
|
2702
|
-
return /* @__PURE__ */
|
|
2703
|
-
className: cn("
|
|
3475
|
+
return /* @__PURE__ */ jsx15(Card, {
|
|
3476
|
+
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"),
|
|
2704
3477
|
"data-table-row": row.id,
|
|
2705
3478
|
onClick: () => store.config.onRowClicked?.(row.data),
|
|
2706
3479
|
onKeyDown: (event) => {
|
|
@@ -2710,23 +3483,23 @@ var GalleryCard = ({
|
|
|
2710
3483
|
}
|
|
2711
3484
|
},
|
|
2712
3485
|
tabIndex: store.config.onRowClicked ? 0 : undefined,
|
|
2713
|
-
children: /* @__PURE__ */
|
|
3486
|
+
children: /* @__PURE__ */ jsxs9(CardHeader, {
|
|
2714
3487
|
className: "pr-12",
|
|
2715
3488
|
children: [
|
|
2716
|
-
/* @__PURE__ */
|
|
3489
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
2717
3490
|
className: "flex items-center gap-2",
|
|
2718
3491
|
children: [
|
|
2719
|
-
selection ? /* @__PURE__ */
|
|
3492
|
+
selection ? /* @__PURE__ */ jsx15(Checkbox, {
|
|
2720
3493
|
"aria-label": store.config.labels.selectRow,
|
|
2721
3494
|
checked: !!store.state.rowSelection[row.id],
|
|
2722
3495
|
disabled: !selectable,
|
|
2723
3496
|
onCheckedChange: (checked) => toggleRow(store, setStore, row.id, checked),
|
|
2724
3497
|
onClick: (event) => event.stopPropagation()
|
|
2725
3498
|
}) : null,
|
|
2726
|
-
draggable ? /* @__PURE__ */
|
|
3499
|
+
draggable ? /* @__PURE__ */ jsx15(DragHandle, {
|
|
2727
3500
|
tableAtom
|
|
2728
3501
|
}) : null,
|
|
2729
|
-
tag ? /* @__PURE__ */
|
|
3502
|
+
tag ? /* @__PURE__ */ jsxs9(Badge, {
|
|
2730
3503
|
variant: "secondary",
|
|
2731
3504
|
children: [
|
|
2732
3505
|
gallery.tagIcon,
|
|
@@ -2735,17 +3508,17 @@ var GalleryCard = ({
|
|
|
2735
3508
|
}) : null
|
|
2736
3509
|
]
|
|
2737
3510
|
}),
|
|
2738
|
-
/* @__PURE__ */
|
|
3511
|
+
/* @__PURE__ */ jsx15(CardTitle, {
|
|
2739
3512
|
children: name ? renderCell(row, name, store.config.locale, store.config.labels) : row.id
|
|
2740
3513
|
}),
|
|
2741
|
-
description ? /* @__PURE__ */
|
|
3514
|
+
description ? /* @__PURE__ */ jsx15("div", {
|
|
2742
3515
|
className: "text-muted-foreground line-clamp-3 text-sm",
|
|
2743
3516
|
children: renderCell(row, description, store.config.locale, store.config.labels)
|
|
2744
3517
|
}) : null,
|
|
2745
|
-
hasRowActionMenu(store) ? /* @__PURE__ */
|
|
3518
|
+
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15("div", {
|
|
2746
3519
|
className: "absolute top-4 right-4",
|
|
2747
3520
|
onClick: (event) => event.stopPropagation(),
|
|
2748
|
-
children: /* @__PURE__ */
|
|
3521
|
+
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
2749
3522
|
tableAtom
|
|
2750
3523
|
})
|
|
2751
3524
|
}) : null
|
|
@@ -2762,31 +3535,31 @@ var DataTableGallery = ({
|
|
|
2762
3535
|
const rows = fields.length ? model.sortedRows : model.pageRows;
|
|
2763
3536
|
const sections = groupDataTableRows(rows, fields);
|
|
2764
3537
|
if (store.config.status.error) {
|
|
2765
|
-
return /* @__PURE__ */
|
|
3538
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2766
3539
|
className: "text-destructive rounded-lg border border-dashed p-10 text-center",
|
|
2767
3540
|
children: store.config.status.error
|
|
2768
3541
|
});
|
|
2769
3542
|
}
|
|
2770
3543
|
if (store.config.status.loading && !rows.length) {
|
|
2771
|
-
return /* @__PURE__ */
|
|
3544
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2772
3545
|
className: "rounded-lg border border-dashed p-10 text-center",
|
|
2773
|
-
children: /* @__PURE__ */
|
|
3546
|
+
children: /* @__PURE__ */ jsx15(Loading, {
|
|
2774
3547
|
label: store.config.labels.loading
|
|
2775
3548
|
})
|
|
2776
3549
|
});
|
|
2777
3550
|
}
|
|
2778
3551
|
if (!rows.length && !sections.length) {
|
|
2779
|
-
return /* @__PURE__ */
|
|
3552
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2780
3553
|
className: "text-muted-foreground rounded-lg border border-dashed p-10 text-center",
|
|
2781
3554
|
children: store.config.status.empty ?? store.config.labels.empty
|
|
2782
3555
|
});
|
|
2783
3556
|
}
|
|
2784
3557
|
if (!fields.length) {
|
|
2785
|
-
return /* @__PURE__ */
|
|
3558
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2786
3559
|
className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
|
|
2787
|
-
children: rows.map((row) => /* @__PURE__ */
|
|
3560
|
+
children: rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
|
|
2788
3561
|
value: row.id,
|
|
2789
|
-
children: /* @__PURE__ */
|
|
3562
|
+
children: /* @__PURE__ */ jsx15(GalleryCard, {
|
|
2790
3563
|
tableAtom
|
|
2791
3564
|
})
|
|
2792
3565
|
}, row.id))
|
|
@@ -2802,57 +3575,57 @@ var DataTableGallery = ({
|
|
|
2802
3575
|
[section.key]: !collapsed
|
|
2803
3576
|
}
|
|
2804
3577
|
}));
|
|
2805
|
-
return /* @__PURE__ */
|
|
3578
|
+
return /* @__PURE__ */ jsxs9("section", {
|
|
2806
3579
|
className: "data-[drop-target=true]:ring-primary space-y-3 rounded-lg transition-shadow data-[drop-target=true]:ring-2",
|
|
2807
3580
|
"data-table-group": section.field.onMoveToGroup ? targetKey : undefined,
|
|
2808
3581
|
children: [
|
|
2809
|
-
/* @__PURE__ */
|
|
3582
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
2810
3583
|
className: "hover:bg-accent flex cursor-pointer items-center gap-2 rounded-lg border p-3 transition-colors",
|
|
2811
3584
|
onClick: toggleCollapsed,
|
|
2812
3585
|
children: [
|
|
2813
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsxs9("button", {
|
|
2814
3587
|
"aria-expanded": !collapsed,
|
|
2815
3588
|
className: "flex flex-1 cursor-pointer items-center gap-2 text-left font-medium",
|
|
2816
3589
|
type: "button",
|
|
2817
3590
|
children: [
|
|
2818
|
-
collapsed ? /* @__PURE__ */
|
|
3591
|
+
collapsed ? /* @__PURE__ */ jsx15(ChevronRight2, {
|
|
2819
3592
|
className: "size-4"
|
|
2820
|
-
}) : /* @__PURE__ */
|
|
3593
|
+
}) : /* @__PURE__ */ jsx15(ChevronDown, {
|
|
2821
3594
|
className: "size-4"
|
|
2822
3595
|
}),
|
|
2823
|
-
/* @__PURE__ */
|
|
3596
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2824
3597
|
className: "flex-1",
|
|
2825
3598
|
children: section.field.renderGroupLabel?.(section.groupId, section.rows.map((row) => row.data)) ?? section.groupId
|
|
2826
3599
|
}),
|
|
2827
|
-
/* @__PURE__ */
|
|
3600
|
+
/* @__PURE__ */ jsx15(Badge, {
|
|
2828
3601
|
variant: "secondary",
|
|
2829
3602
|
children: section.rows.length
|
|
2830
3603
|
})
|
|
2831
3604
|
]
|
|
2832
3605
|
}),
|
|
2833
|
-
/* @__PURE__ */
|
|
3606
|
+
/* @__PURE__ */ jsx15(GroupActions, {
|
|
2834
3607
|
actions: section.field.actions,
|
|
2835
3608
|
groupId: section.groupId,
|
|
2836
3609
|
title: section.field.actionsLabel ?? store.config.labels.actions
|
|
2837
3610
|
})
|
|
2838
3611
|
]
|
|
2839
3612
|
}),
|
|
2840
|
-
!collapsed ? section.children.length ? renderSections(section.children) : section.rows.length ? /* @__PURE__ */
|
|
3613
|
+
!collapsed ? section.children.length ? renderSections(section.children) : section.rows.length ? /* @__PURE__ */ jsx15("div", {
|
|
2841
3614
|
className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
|
|
2842
|
-
children: section.rows.map((row) => /* @__PURE__ */
|
|
3615
|
+
children: section.rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
|
|
2843
3616
|
value: row.id,
|
|
2844
|
-
children: /* @__PURE__ */
|
|
3617
|
+
children: /* @__PURE__ */ jsx15(GalleryCard, {
|
|
2845
3618
|
tableAtom
|
|
2846
3619
|
})
|
|
2847
3620
|
}, `${section.key}:${row.id}`))
|
|
2848
|
-
}) : /* @__PURE__ */
|
|
3621
|
+
}) : /* @__PURE__ */ jsx15("div", {
|
|
2849
3622
|
className: "text-muted-foreground rounded-lg border border-dashed p-8 text-center",
|
|
2850
3623
|
children: section.field.renderEmptyGroup?.(section.groupId) ?? store.config.labels.empty
|
|
2851
3624
|
}) : null
|
|
2852
3625
|
]
|
|
2853
3626
|
}, section.key);
|
|
2854
3627
|
});
|
|
2855
|
-
return /* @__PURE__ */
|
|
3628
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2856
3629
|
className: "space-y-4",
|
|
2857
3630
|
children: renderSections(sections)
|
|
2858
3631
|
});
|
|
@@ -2879,9 +3652,9 @@ var DataTablePagination = ({
|
|
|
2879
3652
|
return null;
|
|
2880
3653
|
const selected = model.rows.filter((row) => store.state.rowSelection[row.id]).length;
|
|
2881
3654
|
const setPagination = (next) => changeState(setStore, (state) => ({ ...state, ...next }));
|
|
2882
|
-
return /* @__PURE__ */
|
|
3655
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
2883
3656
|
className: "pt-4",
|
|
2884
|
-
children: /* @__PURE__ */
|
|
3657
|
+
children: /* @__PURE__ */ jsx15(Pagination, {
|
|
2885
3658
|
locale: store.config.locale,
|
|
2886
3659
|
messages: { [store.config.locale]: store.config.labels },
|
|
2887
3660
|
onPageChange: (page) => setPagination({ page, pageSize: store.state.pageSize }),
|
|
@@ -2906,7 +3679,7 @@ var HydratedDataTable = ({
|
|
|
2906
3679
|
});
|
|
2907
3680
|
const [transientUiAtom] = useState(() => Atom.make(transientUiFromState(DEFAULT_UI_STATE)));
|
|
2908
3681
|
const [transientUiState, setTransientUiState] = useAtom(transientUiAtom);
|
|
2909
|
-
const uiState =
|
|
3682
|
+
const uiState = useMemo2(() => ({
|
|
2910
3683
|
...persistedUiState,
|
|
2911
3684
|
...transientUiState,
|
|
2912
3685
|
grouping: persistedUiState.grouping ?? initialGrouping
|
|
@@ -2975,17 +3748,17 @@ var HydratedDataTable = ({
|
|
|
2975
3748
|
setUiState,
|
|
2976
3749
|
uiState
|
|
2977
3750
|
]);
|
|
2978
|
-
return /* @__PURE__ */
|
|
3751
|
+
return /* @__PURE__ */ jsxs9("div", {
|
|
2979
3752
|
className: "w-full max-w-full min-w-0 rounded-md",
|
|
2980
3753
|
"data-table-root": "",
|
|
2981
3754
|
children: [
|
|
2982
|
-
/* @__PURE__ */
|
|
3755
|
+
/* @__PURE__ */ jsx15(DataTableToolbar, {
|
|
2983
3756
|
tableAtom
|
|
2984
3757
|
}),
|
|
2985
|
-
/* @__PURE__ */
|
|
3758
|
+
/* @__PURE__ */ jsx15(DataTableContent, {
|
|
2986
3759
|
tableAtom
|
|
2987
3760
|
}),
|
|
2988
|
-
/* @__PURE__ */
|
|
3761
|
+
/* @__PURE__ */ jsx15(DataTablePagination, {
|
|
2989
3762
|
tableAtom
|
|
2990
3763
|
})
|
|
2991
3764
|
]
|
|
@@ -3010,7 +3783,7 @@ var DataTable = (props) => {
|
|
|
3010
3783
|
});
|
|
3011
3784
|
});
|
|
3012
3785
|
const [persistedUiResult, setPersistedUiState] = useAtom(persistedUiAtom);
|
|
3013
|
-
const persistedUiState =
|
|
3786
|
+
const persistedUiState = useMemo2(() => AsyncResult.isSuccess(persistedUiResult) ? {
|
|
3014
3787
|
...persistedUiResult.value,
|
|
3015
3788
|
columnVisibility: {
|
|
3016
3789
|
...initialColumnVisibility,
|
|
@@ -3018,13 +3791,13 @@ var DataTable = (props) => {
|
|
|
3018
3791
|
}
|
|
3019
3792
|
} : undefined, [initialColumnVisibility, persistedUiResult]);
|
|
3020
3793
|
if (!persistedUiState || AsyncResult.isWaiting(persistedUiResult)) {
|
|
3021
|
-
return /* @__PURE__ */
|
|
3794
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
3022
3795
|
"aria-busy": "true",
|
|
3023
3796
|
className: "invisible w-full max-w-full min-w-0 rounded-md",
|
|
3024
3797
|
"data-table-root": ""
|
|
3025
3798
|
});
|
|
3026
3799
|
}
|
|
3027
|
-
return /* @__PURE__ */
|
|
3800
|
+
return /* @__PURE__ */ jsx15(HydratedDataTable, {
|
|
3028
3801
|
...props,
|
|
3029
3802
|
locale,
|
|
3030
3803
|
persistedUiState,
|
|
@@ -3036,28 +3809,28 @@ var DataTableContent = ({
|
|
|
3036
3809
|
}) => {
|
|
3037
3810
|
const [store] = useTableAtom(tableAtom);
|
|
3038
3811
|
if (store.config.features.gallery && store.state.view === "gallery") {
|
|
3039
|
-
return /* @__PURE__ */
|
|
3812
|
+
return /* @__PURE__ */ jsx15(DataTableGallery, {
|
|
3040
3813
|
tableAtom
|
|
3041
3814
|
});
|
|
3042
3815
|
}
|
|
3043
3816
|
const model = deriveModel(store);
|
|
3044
3817
|
const width = getDataTableWidth(model.visibleColumns, (store.config.features.selection ? 1 : 0) + (hasRowActionMenu(store) ? 1 : 0) + (canDragRows(store) ? 1 : 0));
|
|
3045
|
-
return /* @__PURE__ */
|
|
3818
|
+
return /* @__PURE__ */ jsxs9(ScrollArea, {
|
|
3046
3819
|
className: "max-w-full min-w-0",
|
|
3047
3820
|
children: [
|
|
3048
|
-
/* @__PURE__ */
|
|
3821
|
+
/* @__PURE__ */ jsxs9(Table, {
|
|
3049
3822
|
className: "table-fixed",
|
|
3050
3823
|
style: { width: `max(100%, ${width}px)` },
|
|
3051
3824
|
children: [
|
|
3052
|
-
/* @__PURE__ */
|
|
3825
|
+
/* @__PURE__ */ jsx15(DataTableHeader, {
|
|
3053
3826
|
tableAtom
|
|
3054
3827
|
}),
|
|
3055
|
-
/* @__PURE__ */
|
|
3828
|
+
/* @__PURE__ */ jsx15(DataTableBody, {
|
|
3056
3829
|
tableAtom
|
|
3057
3830
|
})
|
|
3058
3831
|
]
|
|
3059
3832
|
}),
|
|
3060
|
-
/* @__PURE__ */
|
|
3833
|
+
/* @__PURE__ */ jsx15(ScrollBar, {
|
|
3061
3834
|
orientation: "horizontal"
|
|
3062
3835
|
})
|
|
3063
3836
|
]
|
|
@@ -3067,7 +3840,7 @@ var DataTableListCell = (props) => {
|
|
|
3067
3840
|
const locale = useKrakstackLocale3(props.locale);
|
|
3068
3841
|
const resolvedProps = { ...props, locale };
|
|
3069
3842
|
if (resolvedProps.options && (resolvedProps.onAdd || resolvedProps.onRemove)) {
|
|
3070
|
-
return /* @__PURE__ */
|
|
3843
|
+
return /* @__PURE__ */ jsx15(EditableDataTableListCell, {
|
|
3071
3844
|
...resolvedProps
|
|
3072
3845
|
});
|
|
3073
3846
|
}
|
|
@@ -3075,17 +3848,17 @@ var DataTableListCell = (props) => {
|
|
|
3075
3848
|
const labels = dataTableMessages(locale, resolvedProps.messages);
|
|
3076
3849
|
const hasItems = resolvedProps.items.length > 0;
|
|
3077
3850
|
if (!itemActions?.length && !hasItems) {
|
|
3078
|
-
return /* @__PURE__ */
|
|
3851
|
+
return /* @__PURE__ */ jsx15(DataTableListSummary, {
|
|
3079
3852
|
...summaryProps
|
|
3080
3853
|
});
|
|
3081
3854
|
}
|
|
3082
3855
|
const menuLabel = actionsLabel ?? (itemActions?.length ? labels.actions : labels.listDetails);
|
|
3083
|
-
return /* @__PURE__ */
|
|
3856
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
3084
3857
|
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",
|
|
3085
3858
|
"data-slot": "data-table-list-cell",
|
|
3086
3859
|
onClick: (event) => event.stopPropagation(),
|
|
3087
3860
|
onPointerDown: (event) => event.stopPropagation(),
|
|
3088
|
-
children: /* @__PURE__ */
|
|
3861
|
+
children: /* @__PURE__ */ jsx15(DataTableListMenu, {
|
|
3089
3862
|
actions: itemActions ?? [],
|
|
3090
3863
|
display: resolvedProps.display,
|
|
3091
3864
|
force: hasItems,
|
|
@@ -3094,16 +3867,16 @@ var DataTableListCell = (props) => {
|
|
|
3094
3867
|
locale,
|
|
3095
3868
|
messages: resolvedProps.messages,
|
|
3096
3869
|
onItemClick,
|
|
3097
|
-
trigger: /* @__PURE__ */
|
|
3870
|
+
trigger: /* @__PURE__ */ jsxs9(Button, {
|
|
3098
3871
|
"aria-label": menuLabel,
|
|
3099
3872
|
className: "h-full w-full min-w-0 justify-between rounded-none px-2 focus-visible:ring-inset",
|
|
3100
3873
|
variant: "ghost",
|
|
3101
3874
|
children: [
|
|
3102
|
-
/* @__PURE__ */
|
|
3875
|
+
/* @__PURE__ */ jsx15(DataTableListSummaryContent, {
|
|
3103
3876
|
...summaryProps,
|
|
3104
3877
|
showMenu: false
|
|
3105
3878
|
}),
|
|
3106
|
-
/* @__PURE__ */
|
|
3879
|
+
/* @__PURE__ */ jsx15(ChevronDown, {})
|
|
3107
3880
|
]
|
|
3108
3881
|
})
|
|
3109
3882
|
})
|
|
@@ -3139,7 +3912,7 @@ var EditableDataTableListCell = ({
|
|
|
3139
3912
|
id: "data-table-list-remove",
|
|
3140
3913
|
closeOnClick: false,
|
|
3141
3914
|
name: labels.removeItem,
|
|
3142
|
-
icon: /* @__PURE__ */
|
|
3915
|
+
icon: /* @__PURE__ */ jsx15(Trash2, {}),
|
|
3143
3916
|
variant: "destructive",
|
|
3144
3917
|
onClick: (item) => {
|
|
3145
3918
|
if (item.value === undefined)
|
|
@@ -3150,12 +3923,12 @@ var EditableDataTableListCell = ({
|
|
|
3150
3923
|
}
|
|
3151
3924
|
] : []
|
|
3152
3925
|
];
|
|
3153
|
-
return /* @__PURE__ */
|
|
3926
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
3154
3927
|
"data-slot": "data-table-list-cell",
|
|
3155
3928
|
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",
|
|
3156
3929
|
onClick: (event) => event.stopPropagation(),
|
|
3157
3930
|
onPointerDown: (event) => event.stopPropagation(),
|
|
3158
|
-
children: /* @__PURE__ */
|
|
3931
|
+
children: /* @__PURE__ */ jsx15(DataTableListMenu, {
|
|
3159
3932
|
actions,
|
|
3160
3933
|
addEmptyLabel: emptyLabel,
|
|
3161
3934
|
addLabel: labels.addItem,
|
|
@@ -3172,12 +3945,12 @@ var EditableDataTableListCell = ({
|
|
|
3172
3945
|
onAdd(item.value);
|
|
3173
3946
|
setSelected((current) => [...current, item]);
|
|
3174
3947
|
} : undefined,
|
|
3175
|
-
trigger: /* @__PURE__ */
|
|
3948
|
+
trigger: /* @__PURE__ */ jsxs9(Button, {
|
|
3176
3949
|
"aria-label": manageLabel,
|
|
3177
3950
|
className: "h-full w-full min-w-0 justify-between rounded-none px-2 focus-visible:ring-inset",
|
|
3178
3951
|
variant: "ghost",
|
|
3179
3952
|
children: [
|
|
3180
|
-
/* @__PURE__ */
|
|
3953
|
+
/* @__PURE__ */ jsx15(DataTableListSummaryContent, {
|
|
3181
3954
|
emptyLabel,
|
|
3182
3955
|
items: selected,
|
|
3183
3956
|
display,
|
|
@@ -3185,7 +3958,7 @@ var EditableDataTableListCell = ({
|
|
|
3185
3958
|
visibleCount,
|
|
3186
3959
|
totalCount: selectedTotal
|
|
3187
3960
|
}),
|
|
3188
|
-
/* @__PURE__ */
|
|
3961
|
+
/* @__PURE__ */ jsx15(ChevronDown, {})
|
|
3189
3962
|
]
|
|
3190
3963
|
})
|
|
3191
3964
|
})
|
|
@@ -3209,7 +3982,7 @@ var DataTableListMenu = ({
|
|
|
3209
3982
|
trigger
|
|
3210
3983
|
}) => {
|
|
3211
3984
|
const entries = items.map((item) => {
|
|
3212
|
-
const normalized =
|
|
3985
|
+
const normalized = Schema2.is(Schema2.String)(item) ? { label: item } : item;
|
|
3213
3986
|
const visibleActions = actions.filter((action) => action.visible?.(normalized) ?? true);
|
|
3214
3987
|
return { item: normalized, visibleActions };
|
|
3215
3988
|
});
|
|
@@ -3218,41 +3991,41 @@ var DataTableListMenu = ({
|
|
|
3218
3991
|
return null;
|
|
3219
3992
|
const labels = dataTableMessages(locale, messages);
|
|
3220
3993
|
const resolvedLabel = label ?? (hasActions ? labels.actions : labels.listDetails);
|
|
3221
|
-
return /* @__PURE__ */
|
|
3994
|
+
return /* @__PURE__ */ jsxs9(DropdownMenu, {
|
|
3222
3995
|
children: [
|
|
3223
|
-
/* @__PURE__ */
|
|
3996
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger, {
|
|
3224
3997
|
onClick: (event) => event.stopPropagation(),
|
|
3225
3998
|
onPointerDown: (event) => event.stopPropagation(),
|
|
3226
|
-
render: trigger ?? /* @__PURE__ */
|
|
3999
|
+
render: trigger ?? /* @__PURE__ */ jsx15(Button, {
|
|
3227
4000
|
"aria-label": resolvedLabel,
|
|
3228
4001
|
className: cn("size-8 shrink-0", className),
|
|
3229
4002
|
size: "icon",
|
|
3230
4003
|
variant: "ghost",
|
|
3231
|
-
children: /* @__PURE__ */
|
|
4004
|
+
children: /* @__PURE__ */ jsx15(MoreHorizontal, {})
|
|
3232
4005
|
})
|
|
3233
4006
|
}),
|
|
3234
|
-
/* @__PURE__ */
|
|
4007
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent, {
|
|
3235
4008
|
align: "end",
|
|
3236
4009
|
className: "max-h-[min(18rem,var(--available-height))] w-72 max-w-[calc(100vw-2rem)]",
|
|
3237
4010
|
onClick: (event) => event.stopPropagation(),
|
|
3238
4011
|
onPointerDown: (event) => event.stopPropagation(),
|
|
3239
|
-
children: /* @__PURE__ */
|
|
4012
|
+
children: /* @__PURE__ */ jsxs9(DropdownMenuGroup, {
|
|
3240
4013
|
children: [
|
|
3241
|
-
/* @__PURE__ */
|
|
4014
|
+
/* @__PURE__ */ jsx15(DropdownMenuLabel, {
|
|
3242
4015
|
children: resolvedLabel
|
|
3243
4016
|
}),
|
|
3244
|
-
/* @__PURE__ */
|
|
3245
|
-
entries.map(({ item, visibleActions }, index) => visibleActions.length ? /* @__PURE__ */
|
|
4017
|
+
/* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
|
|
4018
|
+
entries.map(({ item, visibleActions }, index) => visibleActions.length ? /* @__PURE__ */ jsxs9(DropdownMenuSub, {
|
|
3246
4019
|
children: [
|
|
3247
|
-
/* @__PURE__ */
|
|
3248
|
-
children: /* @__PURE__ */
|
|
4020
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubTrigger, {
|
|
4021
|
+
children: /* @__PURE__ */ jsx15(DataTableListEntry, {
|
|
3249
4022
|
item,
|
|
3250
4023
|
appearance: display === "icon" ? "detail" : "list"
|
|
3251
4024
|
})
|
|
3252
4025
|
}),
|
|
3253
|
-
/* @__PURE__ */
|
|
4026
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubContent, {
|
|
3254
4027
|
className: "w-max",
|
|
3255
|
-
children: visibleActions.map((action) => /* @__PURE__ */
|
|
4028
|
+
children: visibleActions.map((action) => /* @__PURE__ */ jsxs9(DropdownMenuItem, {
|
|
3256
4029
|
closeOnClick: action.closeOnClick,
|
|
3257
4030
|
disabled: action.disabled?.(item),
|
|
3258
4031
|
onClick: (event) => {
|
|
@@ -3267,21 +4040,21 @@ var DataTableListMenu = ({
|
|
|
3267
4040
|
}, action.id ?? action.name))
|
|
3268
4041
|
})
|
|
3269
4042
|
]
|
|
3270
|
-
}, item.value ?? `${item.label}-${index}`) : /* @__PURE__ */
|
|
4043
|
+
}, item.value ?? `${item.label}-${index}`) : /* @__PURE__ */ jsx15(DropdownMenuItem, {
|
|
3271
4044
|
closeOnClick: Boolean(onItemClick),
|
|
3272
4045
|
onClick: (event) => {
|
|
3273
4046
|
event.stopPropagation();
|
|
3274
4047
|
onItemClick?.(item);
|
|
3275
4048
|
},
|
|
3276
|
-
children: /* @__PURE__ */
|
|
4049
|
+
children: /* @__PURE__ */ jsx15(DataTableListEntry, {
|
|
3277
4050
|
item,
|
|
3278
4051
|
appearance: display === "icon" ? "detail" : "list"
|
|
3279
4052
|
})
|
|
3280
4053
|
}, item.value ?? `${item.label}-${index}`)),
|
|
3281
|
-
onAdd && addOptions?.length ? /* @__PURE__ */
|
|
4054
|
+
onAdd && addOptions?.length ? /* @__PURE__ */ jsxs9(Fragment, {
|
|
3282
4055
|
children: [
|
|
3283
|
-
entries.length ? /* @__PURE__ */
|
|
3284
|
-
/* @__PURE__ */
|
|
4056
|
+
entries.length ? /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}) : null,
|
|
4057
|
+
/* @__PURE__ */ jsx15(DataTableListAddMenu, {
|
|
3285
4058
|
emptyLabel: addEmptyLabel,
|
|
3286
4059
|
label: addLabel ?? labels.addItem,
|
|
3287
4060
|
locale,
|
|
@@ -3316,28 +4089,28 @@ var DataTableListAddMenu = ({
|
|
|
3316
4089
|
const labels = dataTableMessages(locale, messages);
|
|
3317
4090
|
const normalizedSearch = search.trim().toLocaleLowerCase(locale);
|
|
3318
4091
|
const filtered = normalizedSearch ? options.filter((item) => item.label.toLocaleLowerCase(locale).includes(normalizedSearch)) : options;
|
|
3319
|
-
return /* @__PURE__ */
|
|
4092
|
+
return /* @__PURE__ */ jsxs9(DropdownMenuSub, {
|
|
3320
4093
|
onOpenChange: (open) => {
|
|
3321
4094
|
if (!open)
|
|
3322
4095
|
setSearch("");
|
|
3323
4096
|
},
|
|
3324
4097
|
children: [
|
|
3325
|
-
/* @__PURE__ */
|
|
4098
|
+
/* @__PURE__ */ jsxs9(DropdownMenuSubTrigger, {
|
|
3326
4099
|
children: [
|
|
3327
|
-
/* @__PURE__ */
|
|
4100
|
+
/* @__PURE__ */ jsx15(Plus, {}),
|
|
3328
4101
|
label
|
|
3329
4102
|
]
|
|
3330
4103
|
}),
|
|
3331
|
-
/* @__PURE__ */
|
|
4104
|
+
/* @__PURE__ */ jsxs9(DropdownMenuSubContent, {
|
|
3332
4105
|
className: "w-64",
|
|
3333
4106
|
children: [
|
|
3334
|
-
/* @__PURE__ */
|
|
4107
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
3335
4108
|
className: "relative p-1",
|
|
3336
4109
|
children: [
|
|
3337
|
-
/* @__PURE__ */
|
|
4110
|
+
/* @__PURE__ */ jsx15(Search, {
|
|
3338
4111
|
className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2"
|
|
3339
4112
|
}),
|
|
3340
|
-
/* @__PURE__ */
|
|
4113
|
+
/* @__PURE__ */ jsx15(Input, {
|
|
3341
4114
|
"aria-label": searchLabel,
|
|
3342
4115
|
className: "h-8 pl-8",
|
|
3343
4116
|
onChange: (event) => setSearch(event.target.value),
|
|
@@ -3351,15 +4124,15 @@ var DataTableListAddMenu = ({
|
|
|
3351
4124
|
})
|
|
3352
4125
|
]
|
|
3353
4126
|
}),
|
|
3354
|
-
/* @__PURE__ */
|
|
3355
|
-
filtered.length ? filtered.map((item) => /* @__PURE__ */
|
|
4127
|
+
/* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
|
|
4128
|
+
filtered.length ? filtered.map((item) => /* @__PURE__ */ jsx15(DropdownMenuItem, {
|
|
3356
4129
|
closeOnClick: false,
|
|
3357
4130
|
onClick: () => onAdd(item),
|
|
3358
|
-
children: /* @__PURE__ */
|
|
4131
|
+
children: /* @__PURE__ */ jsx15(DataTableListEntry, {
|
|
3359
4132
|
item,
|
|
3360
4133
|
appearance: display === "icon" ? "detail" : "list"
|
|
3361
4134
|
})
|
|
3362
|
-
}, item.value)) : /* @__PURE__ */
|
|
4135
|
+
}, item.value)) : /* @__PURE__ */ jsx15("div", {
|
|
3363
4136
|
className: "text-muted-foreground px-2 py-1.5 text-sm",
|
|
3364
4137
|
children: emptyLabel
|
|
3365
4138
|
})
|
|
@@ -3378,31 +4151,31 @@ var DataTableListSummaryContent = ({
|
|
|
3378
4151
|
showMenu,
|
|
3379
4152
|
visibleCount = 3
|
|
3380
4153
|
}) => {
|
|
3381
|
-
const normalized = items.map((item) =>
|
|
4154
|
+
const normalized = items.map((item) => Schema2.is(Schema2.String)(item) ? { label: item } : item);
|
|
3382
4155
|
if (!normalized.length)
|
|
3383
|
-
return /* @__PURE__ */
|
|
4156
|
+
return /* @__PURE__ */ jsx15("span", {
|
|
3384
4157
|
className: "text-muted-foreground",
|
|
3385
4158
|
children: emptyLabel
|
|
3386
4159
|
});
|
|
3387
4160
|
const visible = normalized.slice(0, Math.max(0, visibleCount));
|
|
3388
4161
|
const remaining = Math.max(totalCount - visible.length, 0);
|
|
3389
4162
|
if (display === "icon") {
|
|
3390
|
-
return /* @__PURE__ */
|
|
3391
|
-
children: /* @__PURE__ */
|
|
4163
|
+
return /* @__PURE__ */ jsx15(TooltipProvider, {
|
|
4164
|
+
children: /* @__PURE__ */ jsxs9("span", {
|
|
3392
4165
|
className: "flex items-center",
|
|
3393
4166
|
children: [
|
|
3394
|
-
visible.map((item, index) => /* @__PURE__ */
|
|
4167
|
+
visible.map((item, index) => /* @__PURE__ */ jsx15(DataTableListEntry, {
|
|
3395
4168
|
item,
|
|
3396
4169
|
appearance: "icon"
|
|
3397
4170
|
}, item.value ?? `${item.label}-${index}`)),
|
|
3398
|
-
remaining ? /* @__PURE__ */
|
|
4171
|
+
remaining ? /* @__PURE__ */ jsxs9("span", {
|
|
3399
4172
|
className: "bg-secondary text-secondary-foreground -ml-1 flex size-8 items-center justify-center rounded-full",
|
|
3400
4173
|
children: [
|
|
3401
4174
|
"+",
|
|
3402
4175
|
remaining
|
|
3403
4176
|
]
|
|
3404
4177
|
}) : null,
|
|
3405
|
-
remaining && showMenu ? /* @__PURE__ */
|
|
4178
|
+
remaining && showMenu ? /* @__PURE__ */ jsx15(DataTableListMenu, {
|
|
3406
4179
|
actions: [],
|
|
3407
4180
|
display,
|
|
3408
4181
|
force: true,
|
|
@@ -3414,17 +4187,17 @@ var DataTableListSummaryContent = ({
|
|
|
3414
4187
|
})
|
|
3415
4188
|
});
|
|
3416
4189
|
}
|
|
3417
|
-
return /* @__PURE__ */
|
|
4190
|
+
return /* @__PURE__ */ jsxs9("span", {
|
|
3418
4191
|
className: "inline-flex min-w-0 items-center gap-2 text-sm",
|
|
3419
4192
|
children: [
|
|
3420
|
-
/* @__PURE__ */
|
|
4193
|
+
/* @__PURE__ */ jsxs9("span", {
|
|
3421
4194
|
className: "truncate",
|
|
3422
4195
|
children: [
|
|
3423
4196
|
visible.map((item) => item.label).join(", "),
|
|
3424
4197
|
remaining ? ` +${remaining}` : ""
|
|
3425
4198
|
]
|
|
3426
4199
|
}),
|
|
3427
|
-
remaining && showMenu ? /* @__PURE__ */
|
|
4200
|
+
remaining && showMenu ? /* @__PURE__ */ jsx15(DataTableListMenu, {
|
|
3428
4201
|
actions: [],
|
|
3429
4202
|
display,
|
|
3430
4203
|
force: true,
|
|
@@ -3435,7 +4208,7 @@ var DataTableListSummaryContent = ({
|
|
|
3435
4208
|
]
|
|
3436
4209
|
});
|
|
3437
4210
|
};
|
|
3438
|
-
var DataTableListSummary = (props) => /* @__PURE__ */
|
|
4211
|
+
var DataTableListSummary = (props) => /* @__PURE__ */ jsx15(DataTableListSummaryContent, {
|
|
3439
4212
|
...props,
|
|
3440
4213
|
showMenu: true
|
|
3441
4214
|
});
|
|
@@ -3443,40 +4216,40 @@ var DataTableListEntry = ({
|
|
|
3443
4216
|
item,
|
|
3444
4217
|
appearance
|
|
3445
4218
|
}) => {
|
|
3446
|
-
const icon = /* @__PURE__ */
|
|
4219
|
+
const icon = /* @__PURE__ */ jsx15("span", {
|
|
3447
4220
|
"aria-hidden": "true",
|
|
3448
4221
|
className: "bg-secondary text-secondary-foreground flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full",
|
|
3449
|
-
children: item.imageSrc ? /* @__PURE__ */
|
|
4222
|
+
children: item.imageSrc ? /* @__PURE__ */ jsx15("img", {
|
|
3450
4223
|
alt: "",
|
|
3451
4224
|
src: item.imageSrc,
|
|
3452
4225
|
className: "size-full object-cover"
|
|
3453
4226
|
}) : item.icon ?? item.label.slice(0, 2).toUpperCase()
|
|
3454
4227
|
});
|
|
3455
4228
|
if (appearance === "list") {
|
|
3456
|
-
return /* @__PURE__ */
|
|
4229
|
+
return /* @__PURE__ */ jsx15("span", {
|
|
3457
4230
|
className: "min-w-0 flex-1 truncate",
|
|
3458
4231
|
title: item.label,
|
|
3459
4232
|
children: item.label
|
|
3460
4233
|
});
|
|
3461
4234
|
}
|
|
3462
|
-
return appearance === "icon" ? /* @__PURE__ */
|
|
4235
|
+
return appearance === "icon" ? /* @__PURE__ */ jsxs9(Tooltip, {
|
|
3463
4236
|
children: [
|
|
3464
|
-
/* @__PURE__ */
|
|
3465
|
-
render: /* @__PURE__ */
|
|
4237
|
+
/* @__PURE__ */ jsx15(TooltipTrigger, {
|
|
4238
|
+
render: /* @__PURE__ */ jsx15("span", {
|
|
3466
4239
|
className: "-ml-1 inline-flex rounded-full",
|
|
3467
4240
|
"aria-label": item.label
|
|
3468
4241
|
}),
|
|
3469
4242
|
children: icon
|
|
3470
4243
|
}),
|
|
3471
|
-
/* @__PURE__ */
|
|
4244
|
+
/* @__PURE__ */ jsx15(TooltipContent, {
|
|
3472
4245
|
children: item.label
|
|
3473
4246
|
})
|
|
3474
4247
|
]
|
|
3475
|
-
}) : /* @__PURE__ */
|
|
4248
|
+
}) : /* @__PURE__ */ jsxs9("span", {
|
|
3476
4249
|
className: "flex min-w-0 flex-1 items-center gap-2 text-left",
|
|
3477
4250
|
children: [
|
|
3478
4251
|
icon,
|
|
3479
|
-
/* @__PURE__ */
|
|
4252
|
+
/* @__PURE__ */ jsx15("span", {
|
|
3480
4253
|
className: "truncate",
|
|
3481
4254
|
children: item.label
|
|
3482
4255
|
})
|
|
@@ -3493,9 +4266,13 @@ export {
|
|
|
3493
4266
|
dataTableMessages,
|
|
3494
4267
|
downloadCsv,
|
|
3495
4268
|
downloadJson,
|
|
4269
|
+
filterDataTableColumnRows,
|
|
3496
4270
|
filterDataTableRows,
|
|
4271
|
+
getDataTableExportColumns,
|
|
3497
4272
|
getDataTableExportValue,
|
|
4273
|
+
getDataTableFilterColumns,
|
|
3498
4274
|
getDataTableSelectableRows,
|
|
4275
|
+
getDataTableSortColumns,
|
|
3499
4276
|
getDataTableWidth,
|
|
3500
4277
|
groupDataTableRows,
|
|
3501
4278
|
normalizeDataTableColumns,
|