@etic-insa/ui 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +490 -52
- package/dist/components/etic/action.d.ts +16 -7
- package/dist/components/etic/action.js +25 -25
- package/dist/components/etic/action.js.map +1 -1
- package/dist/components/etic/app-shell.d.ts +20 -8
- package/dist/components/etic/app-shell.js +164 -120
- package/dist/components/etic/app-shell.js.map +1 -1
- package/dist/components/etic/auth-image.d.ts +29 -6
- package/dist/components/etic/auth-image.js +41 -18
- package/dist/components/etic/auth-image.js.map +1 -1
- package/dist/components/etic/button-link.d.ts +19 -0
- package/dist/components/etic/button-link.js +19 -0
- package/dist/components/etic/button-link.js.map +1 -0
- package/dist/components/etic/centered-screen.d.ts +13 -0
- package/dist/components/etic/centered-screen.js +13 -0
- package/dist/components/etic/centered-screen.js.map +1 -0
- package/dist/components/etic/confirm-dialog.d.ts +33 -3
- package/dist/components/etic/confirm-dialog.js +92 -67
- package/dist/components/etic/confirm-dialog.js.map +1 -1
- package/dist/components/etic/copy-button.d.ts +3 -2
- package/dist/components/etic/copy-button.js +3 -3
- package/dist/components/etic/copy-button.js.map +1 -1
- package/dist/components/etic/data-table-bulk-actions.d.ts +41 -4
- package/dist/components/etic/data-table-bulk-actions.js +114 -60
- package/dist/components/etic/data-table-bulk-actions.js.map +1 -1
- package/dist/components/etic/data-table-focus.d.ts +17 -0
- package/dist/components/etic/data-table-focus.js +29 -0
- package/dist/components/etic/data-table-focus.js.map +1 -0
- package/dist/components/etic/data-table-format.d.ts +3 -10
- package/dist/components/etic/data-table-format.js +4 -3
- package/dist/components/etic/data-table-format.js.map +1 -1
- package/dist/components/etic/data-table-pagination.d.ts +20 -6
- package/dist/components/etic/data-table-pagination.js +73 -43
- package/dist/components/etic/data-table-pagination.js.map +1 -1
- package/dist/components/etic/data-table-toolbar.d.ts +34 -13
- package/dist/components/etic/data-table-toolbar.js +66 -62
- package/dist/components/etic/data-table-toolbar.js.map +1 -1
- package/dist/components/etic/data-table-view-options.d.ts +44 -4
- package/dist/components/etic/data-table-view-options.js +145 -98
- package/dist/components/etic/data-table-view-options.js.map +1 -1
- package/dist/components/etic/data-table.d.ts +183 -17
- package/dist/components/etic/data-table.js +396 -241
- package/dist/components/etic/data-table.js.map +1 -1
- package/dist/components/etic/date-picker.d.ts +5 -1
- package/dist/components/etic/date-picker.js +97 -84
- package/dist/components/etic/date-picker.js.map +1 -1
- package/dist/components/etic/delete-button.d.ts +12 -4
- package/dist/components/etic/delete-button.js +21 -22
- package/dist/components/etic/delete-button.js.map +1 -1
- package/dist/components/etic/detail-list.d.ts +18 -4
- package/dist/components/etic/detail-list.js +30 -20
- package/dist/components/etic/detail-list.js.map +1 -1
- package/dist/components/etic/disclosure.d.ts +52 -0
- package/dist/components/etic/disclosure.js +71 -0
- package/dist/components/etic/disclosure.js.map +1 -0
- package/dist/components/etic/draft-resume-dialog.d.ts +42 -0
- package/dist/components/etic/draft-resume-dialog.js +60 -0
- package/dist/components/etic/draft-resume-dialog.js.map +1 -0
- package/dist/components/etic/error-banner.js +34 -38
- package/dist/components/etic/error-banner.js.map +1 -1
- package/dist/components/etic/error-boundary.js +4 -3
- package/dist/components/etic/error-boundary.js.map +1 -1
- package/dist/components/etic/explained-badge.d.ts +26 -0
- package/dist/components/etic/explained-badge.js +17 -0
- package/dist/components/etic/explained-badge.js.map +1 -0
- package/dist/components/etic/file-upload.js +66 -71
- package/dist/components/etic/file-upload.js.map +1 -1
- package/dist/components/etic/form-dialog.d.ts +25 -2
- package/dist/components/etic/form-dialog.js +95 -77
- package/dist/components/etic/form-dialog.js.map +1 -1
- package/dist/components/etic/icon-toggle.d.ts +27 -9
- package/dist/components/etic/icon-toggle.js +31 -19
- package/dist/components/etic/icon-toggle.js.map +1 -1
- package/dist/components/etic/lien.d.ts +34 -0
- package/dist/components/etic/lien.js +17 -0
- package/dist/components/etic/lien.js.map +1 -0
- package/dist/components/etic/loading.d.ts +0 -8
- package/dist/components/etic/loading.js +17 -25
- package/dist/components/etic/loading.js.map +1 -1
- package/dist/components/etic/page-container.d.ts +10 -0
- package/dist/components/etic/page-container.js +9 -5
- package/dist/components/etic/page-container.js.map +1 -1
- package/dist/components/etic/page-header.d.ts +19 -5
- package/dist/components/etic/page-header.js +60 -44
- package/dist/components/etic/page-header.js.map +1 -1
- package/dist/components/etic/phone-input.d.ts +16 -0
- package/dist/components/etic/phone-input.js +71 -65
- package/dist/components/etic/phone-input.js.map +1 -1
- package/dist/components/etic/query-boundary.d.ts +25 -2
- package/dist/components/etic/query-boundary.js +24 -12
- package/dist/components/etic/query-boundary.js.map +1 -1
- package/dist/components/etic/removable-badge.d.ts +30 -0
- package/dist/components/etic/removable-badge.js +39 -0
- package/dist/components/etic/removable-badge.js.map +1 -0
- package/dist/components/etic/save-bar.d.ts +32 -0
- package/dist/components/etic/save-bar.js +45 -0
- package/dist/components/etic/save-bar.js.map +1 -0
- package/dist/components/etic/search-select.js +1 -1
- package/dist/components/etic/search-select.js.map +1 -1
- package/dist/components/etic/segmented-control.d.ts +6 -2
- package/dist/components/etic/segmented-control.js +28 -27
- package/dist/components/etic/segmented-control.js.map +1 -1
- package/dist/components/etic/stat-grid.d.ts +15 -0
- package/dist/components/etic/stat-grid.js +17 -0
- package/dist/components/etic/stat-grid.js.map +1 -0
- package/dist/components/etic/stat-tile.d.ts +10 -3
- package/dist/components/etic/stat-tile.js +32 -24
- package/dist/components/etic/stat-tile.js.map +1 -1
- package/dist/components/etic/status-badge.d.ts +2 -4
- package/dist/components/etic/status-badge.js +13 -23
- package/dist/components/etic/status-badge.js.map +1 -1
- package/dist/components/etic/tailles-dialogue.d.ts +8 -0
- package/dist/components/etic/tailles-dialogue.js +10 -0
- package/dist/components/etic/tailles-dialogue.js.map +1 -0
- package/dist/components/etic/theme-menu.d.ts +29 -2
- package/dist/components/etic/theme-menu.js +75 -44
- package/dist/components/etic/theme-menu.js.map +1 -1
- package/dist/components/etic/toggletip.d.ts +36 -0
- package/dist/components/etic/toggletip.js +59 -0
- package/dist/components/etic/toggletip.js.map +1 -0
- package/dist/components/etic/tooltip-button.d.ts +17 -3
- package/dist/components/etic/tooltip-button.js +19 -19
- package/dist/components/etic/tooltip-button.js.map +1 -1
- package/dist/components/etic/unsaved-changes.d.ts +41 -0
- package/dist/components/etic/unsaved-changes.js +17 -0
- package/dist/components/etic/unsaved-changes.js.map +1 -0
- package/dist/components/etic/use-draft-autosave.d.ts +3 -1
- package/dist/components/etic/use-draft-autosave.js +74 -78
- package/dist/components/etic/use-draft-autosave.js.map +1 -1
- package/dist/components/etic/use-unsaved-changes-warning.d.ts +10 -0
- package/dist/components/etic/use-unsaved-changes-warning.js +20 -0
- package/dist/components/etic/use-unsaved-changes-warning.js.map +1 -0
- package/dist/components/ui/alert-dialog.js +2 -2
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/avatar.d.ts +5 -1
- package/dist/components/ui/avatar.js +20 -11
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/badge.d.ts +3 -2
- package/dist/components/ui/badge.js +27 -14
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/breadcrumb.js +13 -13
- package/dist/components/ui/button.d.ts +15 -2
- package/dist/components/ui/button.js +29 -17
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/combobox.d.ts +2 -2
- package/dist/components/ui/combobox.js +45 -32
- package/dist/components/ui/combobox.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +10 -1
- package/dist/components/ui/dialog.js +12 -5
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/popover.d.ts +1 -1
- package/dist/components/ui/popover.js +3 -2
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts +16 -2
- package/dist/components/ui/progress.js +34 -26
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/select.d.ts +10 -2
- package/dist/components/ui/select.js +70 -50
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +6 -1
- package/dist/components/ui/sidebar.js +92 -92
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/spinner.d.ts +7 -1
- package/dist/components/ui/spinner.js +9 -1
- package/dist/components/ui/spinner.js.map +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.js +2 -2
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts +7 -2
- package/dist/components/ui/tooltip.js +27 -19
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/hooks/use-column-prefs.d.ts +84 -0
- package/dist/hooks/use-column-prefs.js +71 -0
- package/dist/hooks/use-column-prefs.js.map +1 -0
- package/dist/hooks/use-debounced-value.d.ts +13 -0
- package/dist/hooks/use-debounced-value.js +12 -0
- package/dist/hooks/use-debounced-value.js.map +1 -0
- package/dist/hooks/use-document-title.d.ts +5 -0
- package/dist/hooks/use-document-title.js +13 -0
- package/dist/hooks/use-document-title.js.map +1 -0
- package/dist/hooks/use-persisted-state.d.ts +43 -0
- package/dist/hooks/use-persisted-state.js +40 -0
- package/dist/hooks/use-persisted-state.js.map +1 -0
- package/dist/index.d.ts +40 -16
- package/dist/index.js +99 -76
- package/dist/lib/autofill.d.ts +18 -0
- package/dist/lib/autofill.js +10 -0
- package/dist/lib/autofill.js.map +1 -0
- package/dist/lib/dates.d.ts +20 -0
- package/dist/lib/dates.js +16 -0
- package/dist/lib/dates.js.map +1 -0
- package/dist/lib/focus-rendu.d.ts +24 -0
- package/dist/lib/focus-rendu.js +14 -0
- package/dist/lib/focus-rendu.js.map +1 -0
- package/dist/lib/format.d.ts +54 -0
- package/dist/lib/format.js +80 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/normalize.d.ts +28 -0
- package/dist/lib/normalize.js +21 -0
- package/dist/lib/normalize.js.map +1 -0
- package/dist/lib/ordre-colonnes.d.ts +15 -0
- package/dist/lib/ordre-colonnes.js +14 -0
- package/dist/lib/ordre-colonnes.js.map +1 -0
- package/dist/lib/ton.d.ts +23 -0
- package/dist/lib/ton.js +51 -0
- package/dist/lib/ton.js.map +1 -0
- package/dist/styles.css +141 -56
- package/dist/theme.d.ts +34 -0
- package/dist/theme.js +45 -0
- package/dist/theme.js.map +1 -0
- package/package.json +4 -2
- package/src/theme-boot.js +22 -0
|
@@ -1,127 +1,131 @@
|
|
|
1
1
|
import { Button as e } from "../ui/button.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
2
|
+
import { nombreFr as t, participe as n, uniteAccordee as r } from "../../lib/format.js";
|
|
3
|
+
import { InputGroup as i, InputGroupAddon as a, InputGroupButton as o, InputGroupInput as s } from "../ui/input-group.js";
|
|
4
|
+
import { Tooltip as c, TooltipContent as l, TooltipTrigger as u } from "../ui/tooltip.js";
|
|
5
|
+
import { Popover as d, PopoverContent as f, PopoverTrigger as p } from "../ui/popover.js";
|
|
6
|
+
import { Select as m, SelectContent as h, SelectItem as g, SelectTrigger as _, SelectValue as v } from "../ui/select.js";
|
|
7
|
+
import { useIsMobile as y } from "../../hooks/use-mobile.js";
|
|
8
|
+
import { UNITE_PAR_DEFAUT as b } from "./data-table-format.js";
|
|
9
|
+
import { paginationDuTableau as x } from "./data-table.js";
|
|
10
|
+
import { NO_AUTOFILL as S } from "../../lib/autofill.js";
|
|
11
|
+
import { cn as C } from "cn";
|
|
12
|
+
import { useMemo as w, useRef as T } from "react";
|
|
13
|
+
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
14
|
+
import { ListFilterIcon as O, SearchIcon as k, XIcon as A } from "lucide-react";
|
|
12
15
|
// src/components/etic/data-table-toolbar.tsx
|
|
13
|
-
function
|
|
14
|
-
let o =
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
+
function j(e) {
|
|
17
|
+
let { unite: i = b, feminin: a = !1, className: o } = e, { total: s, decalage: c = 0, nombre: l } = e.table ? x(e.table) : e, u = c + 1, d = c + l;
|
|
18
|
+
return /* @__PURE__ */ D("p", {
|
|
16
19
|
"data-slot": "data-table-count",
|
|
17
20
|
role: "status",
|
|
18
21
|
"aria-atomic": "true",
|
|
19
|
-
className:
|
|
22
|
+
className: C("text-sm whitespace-nowrap text-muted-foreground", o),
|
|
20
23
|
children: [
|
|
21
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ E("strong", {
|
|
22
25
|
className: "font-medium text-foreground tabular-nums",
|
|
23
|
-
children:
|
|
26
|
+
children: t(s)
|
|
24
27
|
}),
|
|
25
28
|
" ",
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
r(s, i),
|
|
30
|
+
l > 0 ? /* @__PURE__ */ D("span", {
|
|
28
31
|
className: "tabular-nums",
|
|
29
32
|
children: [
|
|
30
33
|
" ",
|
|
31
34
|
"·",
|
|
32
35
|
" ",
|
|
33
|
-
|
|
36
|
+
d > u ? `${t(u)}–${t(d)}` : t(u),
|
|
34
37
|
" ",
|
|
35
|
-
|
|
38
|
+
n("affiché", l, a)
|
|
36
39
|
]
|
|
37
40
|
}) : null
|
|
38
41
|
]
|
|
39
42
|
});
|
|
40
43
|
}
|
|
41
|
-
function
|
|
42
|
-
let o = [{
|
|
44
|
+
function M({ libelle: e, valeur: t, onValeurChange: n, options: r, libelleTous: i, className: a }) {
|
|
45
|
+
let o = w(() => [{
|
|
43
46
|
value: null,
|
|
44
47
|
label: i
|
|
45
48
|
}, ...r.map((e) => ({
|
|
46
49
|
value: e.valeur,
|
|
47
50
|
label: e.libelle
|
|
48
|
-
}))];
|
|
49
|
-
return /* @__PURE__ */
|
|
51
|
+
}))], [i, r]);
|
|
52
|
+
return /* @__PURE__ */ D(m, {
|
|
50
53
|
items: o,
|
|
51
54
|
value: t,
|
|
52
55
|
onValueChange: n,
|
|
53
|
-
children: [/* @__PURE__ */
|
|
56
|
+
children: [/* @__PURE__ */ E(_, {
|
|
54
57
|
"aria-label": e,
|
|
55
58
|
className: a,
|
|
56
|
-
children: /* @__PURE__ */
|
|
57
|
-
}), /* @__PURE__ */
|
|
59
|
+
children: /* @__PURE__ */ E(v, {})
|
|
60
|
+
}), /* @__PURE__ */ E(h, { children: o.map((e) => /* @__PURE__ */ E(g, {
|
|
58
61
|
value: e.value,
|
|
59
62
|
children: e.label
|
|
60
63
|
}, e.value ?? "")) })]
|
|
61
64
|
});
|
|
62
65
|
}
|
|
63
|
-
function
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
+
function N({ recherche: t, filtres: n, filtresActifs: r, onReinitialiser: m, compteur: h, children: g, className: _ }) {
|
|
67
|
+
let v = y() && n != null && r !== void 0, b = T(null), x = T(null), w = () => {
|
|
68
|
+
b.current?.querySelector("input[type=\"search\"], [data-slot=\"popover-trigger\"], [data-slot=\"select-trigger\"]")?.focus(), m?.();
|
|
69
|
+
};
|
|
70
|
+
return /* @__PURE__ */ D("div", {
|
|
66
71
|
ref: b,
|
|
67
72
|
"data-slot": "data-table-toolbar",
|
|
68
|
-
className:
|
|
73
|
+
className: C("flex flex-wrap items-center gap-2", _),
|
|
69
74
|
children: [
|
|
70
|
-
|
|
75
|
+
t ? /* @__PURE__ */ D(i, {
|
|
71
76
|
className: "w-full sm:w-64",
|
|
72
77
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
78
|
+
/* @__PURE__ */ E(a, { children: /* @__PURE__ */ E(k, {}) }),
|
|
79
|
+
/* @__PURE__ */ E(s, {
|
|
80
|
+
...S,
|
|
81
|
+
...t.attributs,
|
|
82
|
+
ref: x,
|
|
76
83
|
type: "search",
|
|
77
|
-
"aria-label":
|
|
78
|
-
placeholder:
|
|
79
|
-
value:
|
|
80
|
-
onChange: (e) =>
|
|
81
|
-
|
|
82
|
-
className: "[&::-webkit-search-cancel-button]:appearance-none"
|
|
84
|
+
"aria-label": t.libelle ?? "Rechercher",
|
|
85
|
+
placeholder: t.placeholder ?? "Rechercher…",
|
|
86
|
+
value: t.valeur,
|
|
87
|
+
onChange: (e) => t.onValeurChange(e.target.value),
|
|
88
|
+
className: C("[&::-webkit-search-cancel-button]:appearance-none", t.attributs?.className)
|
|
83
89
|
}),
|
|
84
|
-
|
|
90
|
+
t.valeur ? /* @__PURE__ */ E(a, {
|
|
85
91
|
align: "inline-end",
|
|
86
|
-
children: /* @__PURE__ */
|
|
87
|
-
render: /* @__PURE__ */
|
|
92
|
+
children: /* @__PURE__ */ D(c, { children: [/* @__PURE__ */ E(u, {
|
|
93
|
+
render: /* @__PURE__ */ E(o, {
|
|
88
94
|
size: "icon-xs",
|
|
89
95
|
"aria-label": "Effacer la recherche",
|
|
90
96
|
onClick: () => {
|
|
91
|
-
|
|
97
|
+
x.current?.focus(), t.onValeurChange("");
|
|
92
98
|
}
|
|
93
99
|
}),
|
|
94
|
-
children: /* @__PURE__ */
|
|
95
|
-
}), /* @__PURE__ */
|
|
100
|
+
children: /* @__PURE__ */ E(A, {})
|
|
101
|
+
}), /* @__PURE__ */ E(l, { children: "Effacer la recherche" })] })
|
|
96
102
|
}) : null
|
|
97
103
|
]
|
|
98
104
|
}) : null,
|
|
99
|
-
|
|
100
|
-
render: /* @__PURE__ */
|
|
105
|
+
v ? /* @__PURE__ */ D(d, { children: [/* @__PURE__ */ D(p, {
|
|
106
|
+
render: /* @__PURE__ */ E(e, { variant: "outline" }),
|
|
101
107
|
children: [
|
|
102
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ E(O, { "data-icon": "inline-start" }),
|
|
103
109
|
"Filtres",
|
|
104
|
-
|
|
110
|
+
r ? ` (${r})` : ""
|
|
105
111
|
]
|
|
106
|
-
}), /* @__PURE__ */
|
|
112
|
+
}), /* @__PURE__ */ E(f, {
|
|
107
113
|
align: "start",
|
|
108
114
|
className: "w-64 *:data-[slot=select-trigger]:w-full",
|
|
109
|
-
children:
|
|
110
|
-
})] }) :
|
|
111
|
-
|
|
115
|
+
children: n
|
|
116
|
+
})] }) : n,
|
|
117
|
+
r && m ? /* @__PURE__ */ D(e, {
|
|
112
118
|
variant: "ghost",
|
|
113
|
-
onClick:
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
children: ["Réinitialiser", /* @__PURE__ */ C(D, { "data-icon": "inline-end" })]
|
|
119
|
+
onClick: w,
|
|
120
|
+
children: ["Réinitialiser", /* @__PURE__ */ E(A, { "data-icon": "inline-end" })]
|
|
117
121
|
}) : null,
|
|
118
|
-
h ||
|
|
122
|
+
h || g ? /* @__PURE__ */ D("div", {
|
|
119
123
|
className: "ml-auto flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
120
|
-
children: [h ? /* @__PURE__ */
|
|
124
|
+
children: [h ? /* @__PURE__ */ E(j, { ...h }) : null, g]
|
|
121
125
|
}) : null
|
|
122
126
|
]
|
|
123
127
|
});
|
|
124
128
|
}
|
|
125
|
-
export {
|
|
129
|
+
export { j as DataTableCount, M as DataTableSelectFilter, N as DataTableToolbar };
|
|
126
130
|
|
|
127
131
|
//# sourceMappingURL=data-table-toolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-toolbar.js","names":["DataTableCount","UNITE_PAR_DEFAUT","debut","decalage","fin","nombre","cn","className","nombreFr","total","uniteAccordee","unite","participe","feminin","DataTableSelectFilter","items","libelleTous","options","option","Select","valeur","onValeurChange","SelectTrigger","libelle","SelectValue","SelectContent","SelectItem","item","DataTableToolbar","replier","useIsMobile","filtres","filtresActifs","racineRef","useRef","rechercheRef","recherche","InputGroup","InputGroupAddon","SearchIcon","InputGroupInput","event","Tooltip","TooltipTrigger","InputGroupButton","XIcon","TooltipContent","Popover","PopoverTrigger","Button","ListFilterIcon","PopoverContent","onReinitialiser","compteur","children"],"sources":["../../../src/components/etic/data-table-toolbar.tsx"],"sourcesContent":["import { useRef, type ReactNode } from \"react\"\nimport { cn } from \"cn\"\nimport { ListFilterIcon, SearchIcon, XIcon } from \"lucide-react\"\n\nimport { Button } from \"@etic-ui/components/ui/button\"\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"@etic-ui/components/ui/input-group\"\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@etic-ui/components/ui/tooltip\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@etic-ui/components/ui/popover\"\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@etic-ui/components/ui/select\"\nimport { useIsMobile } from \"@etic-ui/hooks/use-mobile\"\nimport {\n UNITE_PAR_DEFAUT,\n nombreFr,\n participe,\n uniteAccordee,\n type DataTableUnite,\n} from \"@etic-ui/components/etic/data-table-format\"\n\nexport interface DataTableCountProps {\n /** Nombre total d'éléments, toutes pages comprises. */\n total: number\n /** Rang (à partir de 0) du premier élément affiché. 0 par défaut. */\n decalage?: number\n /** Nombre d'éléments affichés. */\n nombre: number\n /** Nom des éléments. « élément », « éléments » par défaut. */\n unite?: DataTableUnite\n /** Accorde « affichées » au féminin. */\n feminin?: boolean\n className?: string\n}\n\n/**\n * Compteur d'une liste : « 128 éléments · 26–50 affichés ». C'est une zone\n * de statut : après une recherche, un filtre ou un changement de page, le\n * nouveau compte est annoncé sans déplacer le focus.\n */\nexport function DataTableCount({\n total,\n decalage = 0,\n nombre,\n unite = UNITE_PAR_DEFAUT,\n feminin = false,\n className,\n}: DataTableCountProps) {\n const debut = decalage + 1\n const fin = decalage + nombre\n return (\n <p\n data-slot=\"data-table-count\"\n role=\"status\"\n aria-atomic=\"true\"\n className={cn(\n \"text-sm whitespace-nowrap text-muted-foreground\",\n className\n )}\n >\n <strong className=\"font-medium text-foreground tabular-nums\">\n {nombreFr(total)}\n </strong>{\" \"}\n {uniteAccordee(total, unite)}\n {nombre > 0 ? (\n <span className=\"tabular-nums\">\n {\" \"}\n ·{\" \"}\n {fin > debut\n ? `${nombreFr(debut)}–${nombreFr(fin)}`\n : nombreFr(debut)}{\" \"}\n {participe(\"affiché\", nombre, feminin)}\n </span>\n ) : null}\n </p>\n )\n}\n\nexport interface DataTableSelectFilterOption {\n valeur: string\n libelle: string\n}\n\nexport interface DataTableSelectFilterProps {\n /** Nom du filtre pour les lecteurs d'écran : « Filtrer par statut ». */\n libelle: string\n /** Valeur choisie ; `null` = pas de filtre. */\n valeur: string | null\n onValeurChange: (valeur: string | null) => void\n options: DataTableSelectFilterOption[]\n /** Entrée sans filtre : « Tous les statuts ». */\n libelleTous: string\n className?: string\n}\n\n/** Filtre d'une liste : un Select de shadcn dont la première entrée retire\n * le filtre. */\nexport function DataTableSelectFilter({\n libelle,\n valeur,\n onValeurChange,\n options,\n libelleTous,\n className,\n}: DataTableSelectFilterProps) {\n const items = [\n { value: null, label: libelleTous },\n ...options.map((option) => ({\n value: option.valeur,\n label: option.libelle,\n })),\n ]\n return (\n <Select items={items} value={valeur} onValueChange={onValeurChange}>\n <SelectTrigger aria-label={libelle} className={className}>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {items.map((item) => (\n <SelectItem key={item.value ?? \"\"} value={item.value}>\n {item.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )\n}\n\nexport interface DataTableToolbarProps {\n /** Champ de recherche, contrôlé (l'application temporise sa requête). */\n recherche?: {\n valeur: string\n onValeurChange: (valeur: string) => void\n placeholder?: string\n /** Nom du champ. « Rechercher » par défaut. */\n libelle?: string\n }\n /** Filtres : `DataTableSelectFilter`… */\n filtres?: ReactNode\n /**\n * Nombre de filtres actifs. Fourni, il replie les filtres derrière un\n * bouton « Filtres (n) » sur mobile, où ils s'empileraient sinon au-dessus\n * des résultats, et affiche « Réinitialiser » s'il y en a.\n */\n filtresActifs?: number\n /** Retire tous les filtres (bouton « Réinitialiser »). */\n onReinitialiser?: () => void\n /** Compteur « N éléments · a–b affichés ». */\n compteur?: DataTableCountProps\n /** À droite : `DataTableViewOptions`, bouton d'ajout… */\n children?: ReactNode\n className?: string\n}\n\n/**\n * Barre d'outils au-dessus d'un tableau, sur le modèle de celle de shadcn :\n * recherche et filtres à gauche, compteur et commandes (colonnes…) à droite.\n */\nexport function DataTableToolbar({\n recherche,\n filtres,\n filtresActifs,\n onReinitialiser,\n compteur,\n children,\n className,\n}: DataTableToolbarProps) {\n const mobile = useIsMobile()\n const replier = mobile && filtres != null && filtresActifs !== undefined\n const racineRef = useRef<HTMLDivElement>(null)\n const rechercheRef = useRef<HTMLInputElement>(null)\n\n // « Réinitialiser » disparaît avec les filtres : le focus passe d'abord au\n // champ de recherche, sinon au premier filtre (ou au bouton « Filtres »),\n // au lieu de tomber sur <body>.\n const reinitialiser = () => {\n racineRef.current\n ?.querySelector<HTMLElement>(\n 'input[type=\"search\"], [data-slot=\"popover-trigger\"], [data-slot=\"select-trigger\"]'\n )\n ?.focus()\n onReinitialiser?.()\n }\n\n return (\n <div\n ref={racineRef}\n data-slot=\"data-table-toolbar\"\n className={cn(\"flex flex-wrap items-center gap-2\", className)}\n >\n {recherche ? (\n <InputGroup className=\"w-full sm:w-64\">\n <InputGroupAddon>\n <SearchIcon />\n </InputGroupAddon>\n <InputGroupInput\n ref={rechercheRef}\n type=\"search\"\n aria-label={recherche.libelle ?? \"Rechercher\"}\n placeholder={recherche.placeholder ?? \"Rechercher…\"}\n value={recherche.valeur}\n onChange={(event) => recherche.onValeurChange(event.target.value)}\n autoComplete=\"off\"\n // La croix native de Chrome (bleue, 14 px, absente de Firefox)\n // cède la place au bouton ci-dessous.\n className=\"[&::-webkit-search-cancel-button]:appearance-none\"\n />\n {recherche.valeur ? (\n <InputGroupAddon align=\"inline-end\">\n <Tooltip>\n <TooltipTrigger\n render={\n <InputGroupButton\n size=\"icon-xs\"\n aria-label=\"Effacer la recherche\"\n onClick={() => {\n // Le bouton disparaît : le focus revient au champ.\n rechercheRef.current?.focus()\n recherche.onValeurChange(\"\")\n }}\n />\n }\n >\n <XIcon />\n </TooltipTrigger>\n <TooltipContent>Effacer la recherche</TooltipContent>\n </Tooltip>\n </InputGroupAddon>\n ) : null}\n </InputGroup>\n ) : null}\n {replier ? (\n <Popover>\n <PopoverTrigger render={<Button variant=\"outline\" />}>\n <ListFilterIcon data-icon=\"inline-start\" />\n Filtres{filtresActifs ? ` (${filtresActifs})` : \"\"}\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n className=\"w-64 *:data-[slot=select-trigger]:w-full\"\n >\n {filtres}\n </PopoverContent>\n </Popover>\n ) : (\n filtres\n )}\n {filtresActifs && onReinitialiser ? (\n <Button variant=\"ghost\" onClick={reinitialiser}>\n Réinitialiser\n <XIcon data-icon=\"inline-end\" />\n </Button>\n ) : null}\n {compteur || children ? (\n <div className=\"ml-auto flex flex-wrap items-center gap-x-4 gap-y-2\">\n {compteur ? <DataTableCount {...compteur} /> : null}\n {children}\n </div>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAwDA,SAAgBA,EAAe,EAC7B,UACA,cAAW,GACX,WACA,WAAQC,GACR,aAAU,IACV,gBACsB;CACtB,IAAMC,IAAQC,IAAW,GACnBC,IAAMD,IAAWE;CACvB,OACE,kBAAC,KAAD;EACE,aAAU;EACV,MAAK;EACL,eAAY;EACZ,WAAWC,EACT,mDACAC,CACF;EAPF,UAAA;GASE,kBAAC,UAAD;IAAQ,WAAU;IACf,UAAAC,EAASC,CAAK;GACT,CAAA;GAAE;GACTC,EAAcD,GAAOE,CAAK;GAC1BN,IAAS,IACR,kBAAC,QAA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_DEFAUT","props","paginationDuTableau","debut","decalage","fin","nombre","cn","className","nombreFr","total","uniteAccordee","unite","participe","feminin","DataTableSelectFilter","items","useMemo","libelleTous","options","option","Select","valeur","onValeurChange","SelectTrigger","libelle","SelectValue","SelectContent","SelectItem","item","DataTableToolbar","replier","useIsMobile","filtres","filtresActifs","racineRef","useRef","rechercheRef","reinitialiser","onReinitialiser","recherche","InputGroup","InputGroupAddon","SearchIcon","InputGroupInput","NO_AUTOFILL","event","Tooltip","TooltipTrigger","InputGroupButton","XIcon","TooltipContent","Popover","PopoverTrigger","Button","ListFilterIcon","PopoverContent","compteur","children"],"sources":["../../../src/components/etic/data-table-toolbar.tsx"],"sourcesContent":["import { useMemo, useRef, type ComponentProps, type ReactNode } from \"react\"\nimport type { RowData } from \"@tanstack/react-table\"\nimport { cn } from \"cn\"\nimport { ListFilterIcon, SearchIcon, XIcon } from \"lucide-react\"\n\nimport { Button } from \"@etic-ui/components/ui/button\"\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"@etic-ui/components/ui/input-group\"\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@etic-ui/components/ui/tooltip\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@etic-ui/components/ui/popover\"\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@etic-ui/components/ui/select\"\nimport { useIsMobile } from \"@etic-ui/hooks/use-mobile\"\nimport {\n UNITE_PAR_DEFAUT,\n nombreFr,\n participe,\n uniteAccordee,\n type DataTableUnite,\n} from \"@etic-ui/components/etic/data-table-format\"\nimport {\n paginationDuTableau,\n type DataTableInstance,\n} from \"@etic-ui/components/etic/data-table\"\nimport { NO_AUTOFILL } from \"@etic-ui/lib/autofill\"\n\ninterface DataTableCountCommun {\n /** Nom des éléments. « élément », « éléments » par défaut. */\n unite?: DataTableUnite\n /** Accorde « affichées » au féminin. */\n feminin?: boolean\n className?: string\n}\n\n/** Compteur aux nombres donnés par l'application (pagination côté serveur). */\nexport interface DataTableCountNombresProps extends DataTableCountCommun {\n table?: never\n /** Nombre total d'éléments, toutes pages comprises. */\n total: number\n /** Rang (à partir de 0) du premier élément affiché. 0 par défaut. */\n decalage?: number\n /** Nombre d'éléments affichés. */\n nombre: number\n}\n\n/** Compteur lu dans le tableau (pagination côté client de `useDataTable`) :\n * lignes filtrées, page courante. */\nexport interface DataTableCountTableProps<\n TData extends RowData = RowData,\n> extends DataTableCountCommun {\n table: DataTableInstance<TData>\n}\n\nexport type DataTableCountProps<TData extends RowData = RowData> =\n DataTableCountNombresProps | DataTableCountTableProps<TData>\n\n/**\n * Compteur d'une liste : « 128 éléments · 26–50 affichés ». C'est une zone\n * de statut : après une recherche, un filtre ou un changement de page, le\n * nouveau compte est annoncé sans déplacer le focus. Avec `table`, il lit\n * les nombres de la pagination côté client.\n */\nexport function DataTableCount<TData extends RowData>(\n props: DataTableCountProps<TData>\n) {\n const { unite = UNITE_PAR_DEFAUT, feminin = false, className } = props\n const {\n total,\n decalage = 0,\n nombre,\n } = props.table ? paginationDuTableau(props.table) : props\n const debut = decalage + 1\n const fin = decalage + nombre\n return (\n <p\n data-slot=\"data-table-count\"\n role=\"status\"\n aria-atomic=\"true\"\n className={cn(\n \"text-sm whitespace-nowrap text-muted-foreground\",\n className\n )}\n >\n <strong className=\"font-medium text-foreground tabular-nums\">\n {nombreFr(total)}\n </strong>{\" \"}\n {uniteAccordee(total, unite)}\n {nombre > 0 ? (\n <span className=\"tabular-nums\">\n {\" \"}\n ·{\" \"}\n {fin > debut\n ? `${nombreFr(debut)}–${nombreFr(fin)}`\n : nombreFr(debut)}{\" \"}\n {participe(\"affiché\", nombre, feminin)}\n </span>\n ) : null}\n </p>\n )\n}\n\nexport interface DataTableSelectFilterOption {\n valeur: string\n libelle: string\n}\n\nexport interface DataTableSelectFilterProps {\n /** Nom du filtre pour les lecteurs d'écran : « Filtrer par statut ». */\n libelle: string\n /** Valeur choisie ; `null` = pas de filtre. */\n valeur: string | null\n onValeurChange: (valeur: string | null) => void\n options: DataTableSelectFilterOption[]\n /** Entrée sans filtre : « Tous les statuts ». */\n libelleTous: string\n className?: string\n}\n\n/** Filtre d'une liste : un Select de shadcn dont la première entrée retire\n * le filtre. */\nexport function DataTableSelectFilter({\n libelle,\n valeur,\n onValeurChange,\n options,\n libelleTous,\n className,\n}: DataTableSelectFilterProps) {\n const items = useMemo(\n () => [\n { value: null, label: libelleTous },\n ...options.map((option) => ({\n value: option.valeur,\n label: option.libelle,\n })),\n ],\n [libelleTous, options]\n )\n return (\n <Select items={items} value={valeur} onValueChange={onValeurChange}>\n <SelectTrigger aria-label={libelle} className={className}>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {items.map((item) => (\n <SelectItem key={item.value ?? \"\"} value={item.value}>\n {item.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )\n}\n\n/** Attributs du champ de recherche que l'application peut ajouter. */\nexport type DataTableRechercheAttributs = Omit<\n ComponentProps<\"input\">,\n \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"ref\"\n>\n\nexport interface DataTableToolbarProps<TData extends RowData = RowData> {\n /** Champ de recherche, contrôlé (l'application temporise sa requête). */\n recherche?: {\n valeur: string\n onValeurChange: (valeur: string) => void\n placeholder?: string\n /** Nom du champ. « Rechercher » par défaut. */\n libelle?: string\n /** Attributs ajoutés au champ (`name`, `data-*`…). Le champ porte déjà\n * `autoComplete=\"off\"` et les attributs qui écartent les gestionnaires\n * de mots de passe ; ils peuvent être remplacés ici. */\n attributs?: DataTableRechercheAttributs\n }\n /** Filtres : `DataTableSelectFilter`… */\n filtres?: ReactNode\n /**\n * Nombre de filtres actifs. Fourni, il replie les filtres derrière un\n * bouton « Filtres (n) » sur mobile, où ils s'empileraient sinon au-dessus\n * des résultats, et affiche « Réinitialiser » s'il y en a.\n */\n filtresActifs?: number\n /** Retire tous les filtres (bouton « Réinitialiser »). */\n onReinitialiser?: () => void\n /** Compteur « N éléments · a–b affichés » : ses nombres, ou `{ table }`\n * pour une pagination côté client. */\n compteur?: DataTableCountProps<TData>\n /** À droite : `DataTableViewOptions`, bouton d'ajout… */\n children?: ReactNode\n className?: string\n}\n\n/**\n * Barre d'outils au-dessus d'un tableau, sur le modèle de celle de shadcn :\n * recherche et filtres à gauche, compteur et commandes (colonnes…) à droite.\n */\nexport function DataTableToolbar<TData extends RowData = RowData>({\n recherche,\n filtres,\n filtresActifs,\n onReinitialiser,\n compteur,\n children,\n className,\n}: DataTableToolbarProps<TData>) {\n const mobile = useIsMobile()\n const replier = mobile && filtres != null && filtresActifs !== undefined\n const racineRef = useRef<HTMLDivElement>(null)\n const rechercheRef = useRef<HTMLInputElement>(null)\n\n // « Réinitialiser » disparaît avec les filtres : le focus passe d'abord au\n // champ de recherche, sinon au premier filtre (ou au bouton « Filtres »),\n // au lieu de tomber sur <body>.\n const reinitialiser = () => {\n racineRef.current\n ?.querySelector<HTMLElement>(\n 'input[type=\"search\"], [data-slot=\"popover-trigger\"], [data-slot=\"select-trigger\"]'\n )\n ?.focus()\n onReinitialiser?.()\n }\n\n return (\n <div\n ref={racineRef}\n data-slot=\"data-table-toolbar\"\n className={cn(\"flex flex-wrap items-center gap-2\", className)}\n >\n {recherche ? (\n <InputGroup className=\"w-full sm:w-64\">\n <InputGroupAddon>\n <SearchIcon />\n </InputGroupAddon>\n <InputGroupInput\n // Une recherche n'est jamais un identifiant : sans ces attributs,\n // les gestionnaires de mots de passe y proposent une adresse.\n {...NO_AUTOFILL}\n {...recherche.attributs}\n ref={rechercheRef}\n type=\"search\"\n aria-label={recherche.libelle ?? \"Rechercher\"}\n placeholder={recherche.placeholder ?? \"Rechercher…\"}\n value={recherche.valeur}\n onChange={(event) => recherche.onValeurChange(event.target.value)}\n // La croix native de Chrome (bleue, 14 px, absente de Firefox)\n // cède la place au bouton ci-dessous.\n className={cn(\n \"[&::-webkit-search-cancel-button]:appearance-none\",\n recherche.attributs?.className\n )}\n />\n {recherche.valeur ? (\n <InputGroupAddon align=\"inline-end\">\n <Tooltip>\n <TooltipTrigger\n render={\n <InputGroupButton\n size=\"icon-xs\"\n aria-label=\"Effacer la recherche\"\n onClick={() => {\n // Le bouton disparaît : le focus revient au champ.\n rechercheRef.current?.focus()\n recherche.onValeurChange(\"\")\n }}\n />\n }\n >\n <XIcon />\n </TooltipTrigger>\n <TooltipContent>Effacer la recherche</TooltipContent>\n </Tooltip>\n </InputGroupAddon>\n ) : null}\n </InputGroup>\n ) : null}\n {replier ? (\n <Popover>\n <PopoverTrigger render={<Button variant=\"outline\" />}>\n <ListFilterIcon data-icon=\"inline-start\" />\n Filtres{filtresActifs ? ` (${filtresActifs})` : \"\"}\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n className=\"w-64 *:data-[slot=select-trigger]:w-full\"\n >\n {filtres}\n </PopoverContent>\n </Popover>\n ) : (\n filtres\n )}\n {filtresActifs && onReinitialiser ? (\n <Button variant=\"ghost\" onClick={reinitialiser}>\n Réinitialiser\n <XIcon data-icon=\"inline-end\" />\n </Button>\n ) : null}\n {compteur || children ? (\n <div className=\"ml-auto flex flex-wrap items-center gap-x-4 gap-y-2\">\n {compteur ? <DataTableCount {...compteur} /> : null}\n {children}\n </div>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+EA,SAAgBA,EACd,GACA;CACA,IAAM,EAAE,WAAQC,GAAkB,aAAU,IAAO,iBAAcC,GAC3D,EACJ,UACA,cAAW,GACX,cACEA,EAAM,QAAQC,EAAoBD,EAAM,KAAK,IAAIA,GAC/CE,IAAQC,IAAW,GACnBC,IAAMD,IAAWE;CACvB,OACE,kBAAC,KAAD;EACE,aAAU;EACV,MAAK;EACL,eAAY;EACZ,WAAWC,EACT,mDACAC,CACF;EAPF,UAAA;GASE,kBAAC,UAAD;IAAQ,WAAU;IACf,UAAAC,EAASC,CAAK;GACT,CAAA;GAAE;GACTC,EAAcD,GAAOE,CAAK;GAC1B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gB,GAAI0D,EAAW,CAAA,IAAI,MAC9CC,CACE;GACH,CAAA,IAAA;EACD;;AAET"}
|
|
@@ -1,16 +1,56 @@
|
|
|
1
|
-
import { RowData } from '@tanstack/react-table';
|
|
1
|
+
import { ColumnOrderState, ColumnVisibilityState, OnChangeFn, RowData } from '@tanstack/react-table';
|
|
2
2
|
import { DataTableInstance } from './data-table';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/** Une colonne du sélecteur sans `useDataTable` (tableau rendu à la main). */
|
|
4
|
+
export interface DataTableViewOptionsColonne {
|
|
5
|
+
id: string;
|
|
6
|
+
/** Nom affiché dans le panneau. */
|
|
7
|
+
libelle: string;
|
|
8
|
+
/** `false` : toujours affichée, absente du panneau, à sa place (comme
|
|
9
|
+
* `enableHiding: false`). Vrai par défaut. */
|
|
10
|
+
masquable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface DataTableViewOptionsCommun {
|
|
5
13
|
/** Texte du bouton. « Colonnes » par défaut. */
|
|
6
14
|
libelle?: string;
|
|
7
15
|
className?: string;
|
|
8
16
|
}
|
|
17
|
+
/** Sélecteur branché sur l'instance d'un `DataTable`. */
|
|
18
|
+
export interface DataTableViewOptionsTableProps<TData extends RowData> extends DataTableViewOptionsCommun {
|
|
19
|
+
table: DataTableInstance<TData>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Sélecteur d'un tableau rendu à la main (primitives `Table`), sans
|
|
23
|
+
* instance `useDataTable` : les colonnes, leur visibilité et leur ordre
|
|
24
|
+
* viennent de l'application. Les noms sont ceux des options de
|
|
25
|
+
* `useDataTable` : `{...prefs.optionsTableau}` de `useColumnPrefs` s'y
|
|
26
|
+
* étale tel quel.
|
|
27
|
+
*/
|
|
28
|
+
export interface DataTableViewOptionsColonnesProps extends DataTableViewOptionsCommun {
|
|
29
|
+
table?: never;
|
|
30
|
+
colonnes: readonly DataTableViewOptionsColonne[];
|
|
31
|
+
/** `{ [id]: false }` pour une colonne masquée ; absente = affichée. */
|
|
32
|
+
visibiliteColonnes: ColumnVisibilityState;
|
|
33
|
+
onVisibiliteColonnesChange: OnChangeFn<ColumnVisibilityState>;
|
|
34
|
+
/** Identifiants dans l'ordre d'affichage (les inconnus sont ignorés) ;
|
|
35
|
+
* l'ordre de `colonnes` sinon. */
|
|
36
|
+
ordreColonnes?: ColumnOrderState;
|
|
37
|
+
/** Ordre complet après un déplacement. Sans lui, les colonnes ne se
|
|
38
|
+
* réordonnent pas (pas de poignée). */
|
|
39
|
+
onOrdreColonnesChange?: OnChangeFn<ColumnOrderState>;
|
|
40
|
+
/** Colonnes que le panneau peut masquer et déplacer ; les autres restent
|
|
41
|
+
* fixes, à leur place. Toutes par défaut. Donné par `useColumnPrefs`. */
|
|
42
|
+
colonnesReglables?: readonly string[];
|
|
43
|
+
}
|
|
44
|
+
export type DataTableViewOptionsProps<TData extends RowData = RowData> = DataTableViewOptionsTableProps<TData> | DataTableViewOptionsColonnesProps;
|
|
9
45
|
/**
|
|
10
46
|
* Sélecteur de colonnes : le bouton « Colonnes » de shadcn, dont le panneau
|
|
11
47
|
* coche les colonnes affichées et les réordonne par glisser-déposer (dnd-kit),
|
|
12
48
|
* à la souris, au toucher ou au clavier (poignée : Espace, flèches, Espace).
|
|
13
49
|
* Les colonnes qui ne se masquent pas (`enableHiding: false`) n'y figurent
|
|
14
50
|
* pas et gardent leur place. Le panneau reste ouvert pendant les réglages.
|
|
51
|
+
*
|
|
52
|
+
* Avec `table`, il règle un `DataTable` ; avec `colonnes`, `visibilite` et
|
|
53
|
+
* `ordre`, un tableau rendu à la main, sans instance `useDataTable`.
|
|
15
54
|
*/
|
|
16
|
-
export declare function DataTableViewOptions<TData extends RowData>(
|
|
55
|
+
export declare function DataTableViewOptions<TData extends RowData>(props: DataTableViewOptionsProps<TData>): import("react").JSX.Element;
|
|
56
|
+
export {};
|
|
@@ -1,107 +1,143 @@
|
|
|
1
1
|
import { Button as e, buttonVariants as t } from "../ui/button.js";
|
|
2
2
|
import { Checkbox as n } from "../ui/checkbox.js";
|
|
3
3
|
import { Popover as r, PopoverContent as i, PopoverDescription as a, PopoverHeader as o, PopoverTitle as s, PopoverTrigger as c } from "../ui/popover.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
4
|
+
import { CASE_VERROUILLEE as l, libelleColonne as u, metaDe as d } from "./data-table.js";
|
|
5
|
+
import { ordonner as f, replacer as p } from "../../lib/ordre-colonnes.js";
|
|
6
|
+
import { cn as m } from "cn";
|
|
7
|
+
import { useId as h, useRef as g, useState as _ } from "react";
|
|
8
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
9
|
+
import { Columns3Icon as b, GripVerticalIcon as x } from "lucide-react";
|
|
10
|
+
import { DndContext as S, KeyboardSensor as C, PointerSensor as w, closestCenter as T, useSensor as E, useSensors as D } from "@dnd-kit/core";
|
|
11
|
+
import { SortableContext as O, arrayMove as k, sortableKeyboardCoordinates as A, useSortable as j, verticalListSortingStrategy as M } from "@dnd-kit/sortable";
|
|
12
|
+
import { CSS as N } from "@dnd-kit/utilities";
|
|
11
13
|
// src/components/etic/data-table-view-options.tsx
|
|
12
|
-
|
|
13
|
-
let { meta: t, header: n } = e.columnDef;
|
|
14
|
-
return t?.libelle ? t.libelle : typeof n == "string" ? n : e.id;
|
|
15
|
-
}
|
|
16
|
-
function A(e, t, n) {
|
|
17
|
-
let r = n[Symbol.iterator]();
|
|
18
|
-
return e.map((e) => t.has(e) ? r.next().value : e);
|
|
19
|
-
}
|
|
20
|
-
var j = /* @__PURE__ */ new Set([
|
|
14
|
+
var P = /* @__PURE__ */ new Set([
|
|
21
15
|
"select",
|
|
22
16
|
"expand",
|
|
23
17
|
"actions"
|
|
24
|
-
]),
|
|
18
|
+
]), F = ({ transform: e }) => ({
|
|
25
19
|
...e,
|
|
26
20
|
x: 0
|
|
27
|
-
}),
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
}), I = { draggable: "Pour déplacer une colonne, appuyez sur Espace ou Entrée, déplacez-la avec les flèches haut et bas, puis appuyez de nouveau sur Espace ou Entrée pour la déposer, ou sur Échap pour annuler." };
|
|
22
|
+
function L(e) {
|
|
23
|
+
if (!e) return () => !0;
|
|
24
|
+
let t = new Set(e);
|
|
25
|
+
return (e) => t.has(e);
|
|
26
|
+
}
|
|
27
|
+
function R(e) {
|
|
28
|
+
let t = L(d(e).colonnesReglables);
|
|
29
|
+
return {
|
|
30
|
+
toutes: e.getAllLeafColumns().map((e) => ({
|
|
31
|
+
id: e.id,
|
|
32
|
+
libelle: u(e),
|
|
33
|
+
masquable: e.getCanHide() && t(e.id),
|
|
34
|
+
visible: e.getIsVisible(),
|
|
35
|
+
donnees: !P.has(e.id) && (!!e.accessorFn || e.getCanHide())
|
|
36
|
+
})),
|
|
37
|
+
changerVisibilite: (t, n) => e.getColumn(t)?.toggleVisibility(n),
|
|
38
|
+
changerOrdre: (t) => e.setColumnOrder(t)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function z({ colonnes: e, visibiliteColonnes: t, onVisibiliteColonnesChange: n, ordreColonnes: r, onOrdreColonnesChange: i, colonnesReglables: a }) {
|
|
42
|
+
let o = new Map(e.map((e) => [e.id, e])), s = f(r, e.map((e) => e.id)), c = L(a);
|
|
43
|
+
return {
|
|
44
|
+
toutes: s.map((e) => {
|
|
45
|
+
let n = o.get(e), r = (n.masquable ?? !0) && c(e);
|
|
46
|
+
return {
|
|
47
|
+
id: e,
|
|
48
|
+
libelle: n.libelle,
|
|
49
|
+
masquable: r,
|
|
50
|
+
visible: !r || t[e] !== !1,
|
|
51
|
+
donnees: !P.has(e)
|
|
52
|
+
};
|
|
53
|
+
}),
|
|
54
|
+
changerVisibilite: (e, r) => n({
|
|
55
|
+
...t,
|
|
56
|
+
[e]: r
|
|
57
|
+
}),
|
|
58
|
+
changerOrdre: i
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function B(t) {
|
|
62
|
+
let { libelle: n = "Colonnes", className: l } = t, u = t.table ? R(t.table) : z(t), [d, f] = _(!1), x = g(!1), j = g(null), N = D(E(w, { activationConstraint: { distance: 4 } }), E(C, { coordinateGetter: A })), { toutes: P, changerVisibilite: L, changerOrdre: B } = u, U = P.filter((e) => e.masquable), W = U.map((e) => e.id), G = P.filter((e) => e.visible && e.donnees), K = G.length === 1 && G[0].masquable ? G[0].id : void 0, q = h(), J = (e) => U.find((t) => t.id === e)?.libelle ?? String(e), Y = (e) => `${W.indexOf(String(e)) + 1} sur ${W.length}`, X = {
|
|
63
|
+
onDragStart: ({ active: e }) => `Colonne ${J(e.id)} saisie, position ${Y(e.id)}.`,
|
|
64
|
+
onDragOver: ({ active: e, over: t }) => t ? `Colonne ${J(e.id)} déplacée en position ${Y(t.id)}.` : void 0,
|
|
65
|
+
onDragEnd: ({ active: e, over: t }) => t ? `Colonne ${J(e.id)} déposée en position ${Y(t.id)}.` : `Colonne ${J(e.id)} déposée.`,
|
|
66
|
+
onDragCancel: ({ active: e }) => `Déplacement annulé : la colonne ${J(e.id)} reprend sa place.`
|
|
37
67
|
};
|
|
38
|
-
function
|
|
68
|
+
function Z() {
|
|
39
69
|
setTimeout(() => {
|
|
40
|
-
|
|
70
|
+
x.current = !1;
|
|
41
71
|
});
|
|
42
72
|
}
|
|
43
|
-
function
|
|
44
|
-
if (
|
|
45
|
-
let
|
|
46
|
-
|
|
73
|
+
function Q({ active: e, over: t }) {
|
|
74
|
+
if (Z(), !B || !t || e.id === t.id) return;
|
|
75
|
+
let n = k(W, W.indexOf(String(e.id)), W.indexOf(String(t.id))), r = new Set(W);
|
|
76
|
+
B(p(P.map((e) => e.id), (e) => r.has(e), n));
|
|
47
77
|
}
|
|
48
|
-
|
|
49
|
-
|
|
78
|
+
let $ = U.map((e) => /* @__PURE__ */ v(H, {
|
|
79
|
+
id: e.id,
|
|
80
|
+
libelle: e.libelle,
|
|
81
|
+
visible: e.visible,
|
|
82
|
+
deplacable: B !== void 0,
|
|
83
|
+
onVisibleChange: (t) => L(e.id, t),
|
|
84
|
+
verrou: e.id === K ? q : void 0
|
|
85
|
+
}, e.id));
|
|
86
|
+
return /* @__PURE__ */ y(r, {
|
|
87
|
+
open: d,
|
|
50
88
|
onOpenChange: (e, t) => {
|
|
51
|
-
!e &&
|
|
89
|
+
!e && x.current ? t.allowPropagation() : f(e);
|
|
52
90
|
},
|
|
53
|
-
children: [/* @__PURE__ */
|
|
54
|
-
render: /* @__PURE__ */
|
|
91
|
+
children: [/* @__PURE__ */ y(c, {
|
|
92
|
+
render: /* @__PURE__ */ v(e, {
|
|
55
93
|
variant: "outline",
|
|
56
|
-
className:
|
|
94
|
+
className: m("h-8", l)
|
|
57
95
|
}),
|
|
58
|
-
children: [/* @__PURE__ */
|
|
59
|
-
}), /* @__PURE__ */
|
|
96
|
+
children: [/* @__PURE__ */ v(b, { "data-icon": "inline-start" }), n]
|
|
97
|
+
}), /* @__PURE__ */ y(i, {
|
|
60
98
|
align: "end",
|
|
61
99
|
className: "w-64 gap-1 p-1",
|
|
62
|
-
initialFocus: () =>
|
|
100
|
+
initialFocus: () => j.current?.querySelector("[role=\"checkbox\"]") ?? !0,
|
|
63
101
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ y(o, {
|
|
65
103
|
className: "px-2 pt-1.5 pb-1",
|
|
66
|
-
children: [/* @__PURE__ */
|
|
104
|
+
children: [/* @__PURE__ */ v(s, {
|
|
67
105
|
className: "text-sm font-medium",
|
|
68
106
|
children: "Colonnes affichées"
|
|
69
|
-
}), /* @__PURE__ */
|
|
107
|
+
}), /* @__PURE__ */ v(a, {
|
|
70
108
|
className: "text-xs",
|
|
71
|
-
children: "Cochez pour afficher, glissez pour réordonner."
|
|
109
|
+
children: B ? "Cochez pour afficher, glissez pour réordonner." : "Cochez pour afficher."
|
|
72
110
|
})]
|
|
73
111
|
}),
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
sensors:
|
|
76
|
-
collisionDetection:
|
|
77
|
-
modifiers: [
|
|
112
|
+
B ? /* @__PURE__ */ v(S, {
|
|
113
|
+
sensors: N,
|
|
114
|
+
collisionDetection: T,
|
|
115
|
+
modifiers: [F],
|
|
78
116
|
accessibility: {
|
|
79
|
-
announcements:
|
|
80
|
-
screenReaderInstructions:
|
|
117
|
+
announcements: X,
|
|
118
|
+
screenReaderInstructions: I
|
|
81
119
|
},
|
|
82
120
|
onDragStart: () => {
|
|
83
|
-
|
|
121
|
+
x.current = !0;
|
|
84
122
|
},
|
|
85
|
-
onDragEnd:
|
|
86
|
-
onDragCancel:
|
|
87
|
-
children: /* @__PURE__ */
|
|
88
|
-
items:
|
|
89
|
-
strategy:
|
|
90
|
-
children: /* @__PURE__ */
|
|
91
|
-
ref:
|
|
92
|
-
className:
|
|
93
|
-
children:
|
|
94
|
-
id: e.id,
|
|
95
|
-
libelle: k(e),
|
|
96
|
-
visible: e.getIsVisible(),
|
|
97
|
-
onVisibleChange: (t) => e.toggleVisibility(t),
|
|
98
|
-
verrou: e.id === H ? U : void 0
|
|
99
|
-
}, e.id))
|
|
123
|
+
onDragEnd: Q,
|
|
124
|
+
onDragCancel: Z,
|
|
125
|
+
children: /* @__PURE__ */ v(O, {
|
|
126
|
+
items: W,
|
|
127
|
+
strategy: M,
|
|
128
|
+
children: /* @__PURE__ */ v("ul", {
|
|
129
|
+
ref: j,
|
|
130
|
+
className: V,
|
|
131
|
+
children: $
|
|
100
132
|
})
|
|
101
133
|
})
|
|
134
|
+
}) : /* @__PURE__ */ v("ul", {
|
|
135
|
+
ref: j,
|
|
136
|
+
className: V,
|
|
137
|
+
children: $
|
|
102
138
|
}),
|
|
103
|
-
|
|
104
|
-
id:
|
|
139
|
+
K ? /* @__PURE__ */ v("p", {
|
|
140
|
+
id: q,
|
|
105
141
|
className: "px-2 pb-1 text-xs text-muted-foreground",
|
|
106
142
|
children: "Au moins une colonne reste affichée."
|
|
107
143
|
}) : null
|
|
@@ -109,43 +145,54 @@ function P({ table: t, libelle: n = "Colonnes", className: g }) {
|
|
|
109
145
|
})]
|
|
110
146
|
});
|
|
111
147
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
148
|
+
var V = "flex max-h-80 flex-col overflow-y-auto";
|
|
149
|
+
function H({ deplacable: e, ...t }) {
|
|
150
|
+
return e ? /* @__PURE__ */ v(W, { ...t }) : /* @__PURE__ */ v("li", {
|
|
151
|
+
className: m(U, "pl-2"),
|
|
152
|
+
children: /* @__PURE__ */ v(G, { ...t })
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
var U = "flex items-center gap-1 rounded-md bg-popover pr-2 hover:bg-muted data-dragging:relative data-dragging:z-10 data-dragging:shadow-md";
|
|
156
|
+
function W(e) {
|
|
157
|
+
let { attributes: n, listeners: r, setNodeRef: i, setActivatorNodeRef: a, transform: o, transition: s, isDragging: c } = j({
|
|
158
|
+
id: e.id,
|
|
115
159
|
attributes: { roleDescription: "colonne déplaçable" }
|
|
116
160
|
});
|
|
117
|
-
return /* @__PURE__ */
|
|
118
|
-
ref:
|
|
161
|
+
return /* @__PURE__ */ y("li", {
|
|
162
|
+
ref: i,
|
|
119
163
|
style: {
|
|
120
|
-
transform:
|
|
121
|
-
transition:
|
|
164
|
+
transform: N.Translate.toString(o),
|
|
165
|
+
transition: s
|
|
122
166
|
},
|
|
123
|
-
"data-dragging":
|
|
124
|
-
className:
|
|
125
|
-
children: [/* @__PURE__ */
|
|
167
|
+
"data-dragging": c || void 0,
|
|
168
|
+
className: U,
|
|
169
|
+
children: [/* @__PURE__ */ v("button", {
|
|
126
170
|
type: "button",
|
|
127
|
-
ref:
|
|
128
|
-
className:
|
|
171
|
+
ref: a,
|
|
172
|
+
className: m(t({
|
|
129
173
|
variant: "ghost",
|
|
130
174
|
size: "icon-xs"
|
|
131
175
|
}), "cursor-grab touch-none text-muted-foreground active:cursor-grabbing"),
|
|
132
|
-
"aria-label": `Déplacer la colonne ${
|
|
133
|
-
...
|
|
134
|
-
...
|
|
135
|
-
children: /* @__PURE__ */
|
|
136
|
-
}), /* @__PURE__ */
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
176
|
+
"aria-label": `Déplacer la colonne ${e.libelle}`,
|
|
177
|
+
...n,
|
|
178
|
+
...r,
|
|
179
|
+
children: /* @__PURE__ */ v(x, {})
|
|
180
|
+
}), /* @__PURE__ */ v(G, { ...e })]
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function G({ libelle: e, visible: t, onVisibleChange: r, verrou: i }) {
|
|
184
|
+
return /* @__PURE__ */ y("label", {
|
|
185
|
+
className: "flex flex-1 cursor-pointer items-center gap-2 py-1.5 text-sm has-aria-disabled:cursor-not-allowed",
|
|
186
|
+
children: [/* @__PURE__ */ v(n, {
|
|
187
|
+
checked: t,
|
|
188
|
+
onCheckedChange: r,
|
|
189
|
+
readOnly: i !== void 0,
|
|
190
|
+
"aria-disabled": i !== void 0 || void 0,
|
|
191
|
+
"aria-describedby": i,
|
|
192
|
+
className: l
|
|
193
|
+
}), e]
|
|
147
194
|
});
|
|
148
195
|
}
|
|
149
|
-
export {
|
|
196
|
+
export { B as DataTableViewOptions };
|
|
150
197
|
|
|
151
198
|
//# sourceMappingURL=data-table-view-options.js.map
|