zaravand-ui 7.0.1 → 7.1.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.
Files changed (90) hide show
  1. package/dist/components/Dialog/Dialog.cjs +1 -1
  2. package/dist/components/Dialog/Dialog.js +1 -1
  3. package/dist/components/Input/Input.formatting.cjs +1 -1
  4. package/dist/components/Input/Input.formatting.js +35 -17
  5. package/dist/components/Input/Input.interface.d.cts +5 -1
  6. package/dist/components/Input/Input.interface.d.ts +5 -1
  7. package/dist/components/OtpInput/OtpInput.cjs +1 -0
  8. package/dist/components/OtpInput/OtpInput.d.cts +10 -0
  9. package/dist/components/OtpInput/OtpInput.d.ts +10 -0
  10. package/dist/components/OtpInput/OtpInput.interface.d.cts +49 -0
  11. package/dist/components/OtpInput/OtpInput.interface.d.ts +49 -0
  12. package/dist/components/OtpInput/OtpInput.js +150 -0
  13. package/dist/components/OtpInput/OtpInput.variant.cjs +1 -0
  14. package/dist/components/OtpInput/OtpInput.variant.d.cts +6 -0
  15. package/dist/components/OtpInput/OtpInput.variant.d.ts +6 -0
  16. package/dist/components/OtpInput/OtpInput.variant.js +15 -0
  17. package/dist/components/Select/Select.cjs +1 -1
  18. package/dist/components/Select/Select.d.cts +4 -1
  19. package/dist/components/Select/Select.d.ts +4 -1
  20. package/dist/components/Select/Select.interface.d.cts +15 -1
  21. package/dist/components/Select/Select.interface.d.ts +15 -1
  22. package/dist/components/Select/Select.js +697 -566
  23. package/dist/components/Table/Table.cjs +1 -1
  24. package/dist/components/Table/Table.constants.cjs +1 -1
  25. package/dist/components/Table/Table.constants.d.cts +1 -0
  26. package/dist/components/Table/Table.constants.d.ts +1 -0
  27. package/dist/components/Table/Table.constants.js +2 -2
  28. package/dist/components/Table/Table.interface.d.cts +39 -0
  29. package/dist/components/Table/Table.interface.d.ts +39 -0
  30. package/dist/components/Table/Table.js +522 -421
  31. package/dist/components/Table/Table.utils.cjs +1 -1
  32. package/dist/components/Table/Table.utils.d.cts +10 -1
  33. package/dist/components/Table/Table.utils.d.ts +10 -1
  34. package/dist/components/Table/Table.utils.js +23 -1
  35. package/dist/components/Table/Table.variant.cjs +1 -1
  36. package/dist/components/Table/Table.variant.d.cts +5 -0
  37. package/dist/components/Table/Table.variant.d.ts +5 -0
  38. package/dist/components/Table/Table.variant.js +17 -11
  39. package/dist/components/Table/TableActiveFilters.cjs +1 -0
  40. package/dist/components/Table/TableActiveFilters.d.cts +12 -0
  41. package/dist/components/Table/TableActiveFilters.d.ts +12 -0
  42. package/dist/components/Table/TableActiveFilters.js +55 -0
  43. package/dist/components/Table/TableColumnFilter.cjs +1 -0
  44. package/dist/components/Table/TableColumnFilter.d.cts +20 -0
  45. package/dist/components/Table/TableColumnFilter.d.ts +20 -0
  46. package/dist/components/Table/TableColumnFilter.js +100 -0
  47. package/dist/components/Table/TableEmptyState.cjs +1 -1
  48. package/dist/components/Table/TableEmptyState.d.cts +1 -1
  49. package/dist/components/Table/TableEmptyState.d.ts +1 -1
  50. package/dist/components/Table/TableEmptyState.js +16 -7
  51. package/dist/components/Table/TableFilterRegistry.cjs +1 -0
  52. package/dist/components/Table/TableFilterRegistry.d.cts +13 -0
  53. package/dist/components/Table/TableFilterRegistry.d.ts +13 -0
  54. package/dist/components/Table/TableFilterRegistry.js +5 -0
  55. package/dist/components/Table/TableSkeletonRows.cjs +1 -1
  56. package/dist/components/Table/TableSkeletonRows.js +7 -7
  57. package/dist/components/Table/TableSortToggle.cjs +1 -1
  58. package/dist/components/Table/TableSortToggle.js +8 -8
  59. package/dist/components/Table/hooks/useTableFilter.cjs +1 -0
  60. package/dist/components/Table/hooks/useTableFilter.d.cts +18 -0
  61. package/dist/components/Table/hooks/useTableFilter.d.ts +18 -0
  62. package/dist/components/Table/hooks/useTableFilter.js +49 -0
  63. package/dist/components/Uploader/Uploader.variant.cjs +1 -1
  64. package/dist/components/Uploader/Uploader.variant.d.cts +1 -1
  65. package/dist/components/Uploader/Uploader.variant.d.ts +1 -1
  66. package/dist/components/Uploader/Uploader.variant.js +1 -1
  67. package/dist/components/VerticalTabs/VerticalTabs.cjs +1 -0
  68. package/dist/components/VerticalTabs/VerticalTabs.d.cts +4 -0
  69. package/dist/components/VerticalTabs/VerticalTabs.d.ts +4 -0
  70. package/dist/components/VerticalTabs/VerticalTabs.interface.d.cts +41 -0
  71. package/dist/components/VerticalTabs/VerticalTabs.interface.d.ts +41 -0
  72. package/dist/components/VerticalTabs/VerticalTabs.js +196 -0
  73. package/dist/components/VerticalTabs/VerticalTabs.variant.cjs +1 -0
  74. package/dist/components/VerticalTabs/VerticalTabs.variant.d.cts +19 -0
  75. package/dist/components/VerticalTabs/VerticalTabs.variant.d.ts +19 -0
  76. package/dist/components/VerticalTabs/VerticalTabs.variant.js +48 -0
  77. package/dist/components/shared/responsiveScale.cjs +1 -1
  78. package/dist/components/shared/responsiveScale.d.cts +3 -1
  79. package/dist/components/shared/responsiveScale.d.ts +3 -1
  80. package/dist/components/shared/responsiveScale.js +2 -2
  81. package/dist/config/messages.cjs +1 -1
  82. package/dist/config/messages.d.cts +8 -0
  83. package/dist/config/messages.d.ts +8 -0
  84. package/dist/config/messages.js +12 -2
  85. package/dist/index.cjs +1 -1
  86. package/dist/index.css +1 -1
  87. package/dist/index.d.cts +6 -1
  88. package/dist/index.d.ts +6 -1
  89. package/dist/index.js +19 -16
  90. package/package.json +2 -1
@@ -3,47 +3,60 @@ import { useZuiConfig as e } from "../../config/useZuiConfig.js";
3
3
  import { localizeDigits as t } from "../../services/localizeDigits/localizeDigits.js";
4
4
  import { cn as n, mergeRefs as r } from "../../lib/utils.js";
5
5
  import { CONTROL_HEIGHT_SM as i } from "../shared/responsiveScale.js";
6
- import a from "../Button/Button.js";
7
- import o from "../shared/ActionSheet.js";
8
- import { CLEAR_ICON_CLASS as s } from "../shared/FieldClearButton.js";
9
- import { IconActionButton as c, ListToolbar as ee, ToolbarIconButton as l } from "../shared/IconActionButton.js";
10
- import { useExclusiveAction as te } from "../shared/useExclusiveAction.js";
11
- import { useStickyToolbar as ne } from "../shared/useStickyToolbar.js";
12
- import { useIsMobileViewport as re } from "../shared/viewport.js";
13
- import ie from "../Select/Select.js";
14
- import { tableContainerVariants as ae, tableVariants as oe } from "./Table.variant.js";
15
- import se from "./TableEmptyState.js";
16
- import ce from "./TablePaginationControls.js";
17
- import { actionIconClassName as le, actionsColumnClassName as ue, actionsColumnStickyClassName as de, pagingToggleIconClassName as fe, rowActionButtonClassName as pe, rowNumberColumnClassName as me, stickyHeaderCellClassName as he } from "./Table.constants.js";
18
- import { TableBody as ge, TableCell as u, TableHead as d, TableHeader as _e, TableRow as ve } from "./TableParts.js";
19
- import { formatCellValue as ye, replaceRowByIdentifier as be, resolveAriaSort as xe, resolveColumnWidthPercentages as Se, resolveLoadingRowsCount as Ce, resolvePlaceholder as we, resolveSafeRowId as Te } from "./Table.utils.js";
20
- import Ee from "./TableSkeletonRows.js";
21
- import De from "./TableSortToggle.js";
22
- import { useTablePagination as Oe } from "./hooks/useTablePagination.js";
23
- import { useTableCardLabels as ke } from "./hooks/useTableCardLabels.js";
24
- import { useTableSearch as Ae } from "./hooks/useTableSearch.js";
25
- import { useTableSort as je } from "./hooks/useTableSort.js";
26
- import * as f from "react";
27
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
28
- import { ArrowDown as Me, ArrowUp as Ne, ArrowUpDown as Pe, EllipsisVertical as Fe, Eye as Ie, FileSpreadsheet as Le, Infinity as Re, Pencil as ze, Plus as Be, Printer as Ve, RotateCcw as He, Rows3 as Ue, Trash2 as We } from "lucide-react";
6
+ import a from "../shared/ActionSheet.js";
7
+ import { CLEAR_ICON_CLASS as o } from "../shared/FieldClearButton.js";
8
+ import { IconActionButton as s, ListToolbar as c, ToolbarIconButton as l } from "../shared/IconActionButton.js";
9
+ import { useExclusiveAction as ee } from "../shared/useExclusiveAction.js";
10
+ import { useStickyToolbar as te } from "../shared/useStickyToolbar.js";
11
+ import { useIsMobileViewport as ne } from "../shared/viewport.js";
12
+ import re from "../Select/Select.js";
13
+ import { actionIconClassName as ie, actionsColumnClassName as ae, actionsColumnStickyClassName as oe, pagingToggleIconClassName as se, rowActionButtonClassName as ce, rowNumberColumnClassName as le, stickyHeaderCellClassName as ue } from "./Table.constants.js";
14
+ import { formatCellValue as de, isEmptyFilterValue as fe, replaceRowByIdentifier as pe, resolveAriaSort as me, resolveColumnWidthPercentages as he, resolveFilterOptions as ge, resolveFilterText as _e, resolveLoadingRowsCount as ve, resolvePlaceholder as ye, resolveSafeRowId as be } from "./Table.utils.js";
15
+ import { tableContainerVariants as xe, tableVariants as Se } from "./Table.variant.js";
16
+ import Ce from "./TableActiveFilters.js";
17
+ import { TableFilterRegistryContext as we } from "./TableFilterRegistry.js";
18
+ import Te, { TableColumnFilterSheet as Ee } from "./TableColumnFilter.js";
19
+ import De from "./TableEmptyState.js";
20
+ import Oe from "./TablePaginationControls.js";
21
+ import { TableBody as ke, TableCell as u, TableHead as Ae, TableHeader as je, TableRow as Me } from "./TableParts.js";
22
+ import Ne from "./TableSkeletonRows.js";
23
+ import Pe from "./TableSortToggle.js";
24
+ import { useTablePagination as Fe } from "./hooks/useTablePagination.js";
25
+ import { useTableCardLabels as Ie } from "./hooks/useTableCardLabels.js";
26
+ import { useTableFilter as Le } from "./hooks/useTableFilter.js";
27
+ import { useTableSearch as Re } from "./hooks/useTableSearch.js";
28
+ import { useTableSort as ze } from "./hooks/useTableSort.js";
29
+ import * as d from "react";
30
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
31
+ import { ArrowDown as Be, ArrowUp as Ve, ArrowUpDown as He, EllipsisVertical as Ue, Eye as We, FileSpreadsheet as Ge, Funnel as Ke, Infinity as qe, Pencil as Je, Plus as Ye, Printer as Xe, RotateCcw as Ze, Rows3 as Qe, Trash2 as $e } from "lucide-react";
29
32
  //#region src/components/Table/Table.tsx
30
- var Ge = f.forwardRef(function({ className: Ge, containerClassName: Ke, loading: g = !1, isMutating: _ = !1, stickyHeaderOnScroll: qe = !0, maxVisibleRowsBeforeScroll: Je, allowInfiniteMode: Ye = !0, stickyToolbar: Xe = !0, schema: v, data: y, setData: Ze, onAdd: b, onImportExcel: x, onEdit: S, onDelete: C, onPrint: w, onPreviewPrint: T, actions: Qe, onCellSelectChange: $e, getRowId: E, showNumberRow: et = !1, showColumnBorder: tt = !1, showRowBorder: nt = !1, toolbarExtra: rt, children: it }, at) {
31
- let { messages: D, digits: O, dir: ot } = e(), st = f.useMemo(() => ({
32
- digits: O,
33
- messages: D
34
- }), [O, D]), k = f.Children.count(it) > 0, A = re(), ct = f.useRef(null), lt = f.useMemo(() => r(at, ct), [at]);
35
- ke(ct, k);
36
- let j = f.useMemo(() => v.columns.filter((e) => e.view), [v.columns]), ut = f.useMemo(() => j.filter((e) => e.sortable), [j]), M = typeof b == "function", N = typeof x == "function", P = typeof S == "function", F = typeof C == "function", I = typeof w == "function", L = typeof T == "function", R = Qe ?? [], dt = R.length > 0, z = v.searchable ?? !1, B = et && !k, ft = rt != null && rt !== !1, pt = v.pagination, mt = pt?.onSearchChange, ht = typeof mt == "function", V = P || F || dt, { rowNumberColumnStyle: gt, columnStyleByKey: _t, actionsColumnStyle: vt } = f.useMemo(() => Se(j, B, V), [
37
- V,
38
- B,
39
- j
40
- ]), yt = f.useMemo(() => {
41
- let e = v.columns.map((e) => {
33
+ function et(e) {
34
+ let t = e.target.closest("button, a, input, textarea, select, label, [role=\"button\"], [role=\"combobox\"], [role=\"checkbox\"]");
35
+ return t !== null && e.currentTarget.contains(t);
36
+ }
37
+ var tt = d.forwardRef(function({ className: tt, containerClassName: nt, loading: h = !1, isMutating: g = !1, stickyHeaderOnScroll: rt = !0, maxVisibleRowsBeforeScroll: it, allowInfiniteMode: at = !0, stickyToolbar: ot = !0, schema: _, data: v, setData: st, onAdd: y, onImportExcel: b, onEdit: x, onDelete: ct, onPrint: lt, onPreviewPrint: ut, actions: dt, onCellSelectChange: ft, getRowId: S, showNumberRow: pt = !1, showColumnBorder: mt = !1, showRowBorder: ht = !1, toolbarExtra: gt, children: _t }, vt) {
38
+ let { messages: C, digits: w, dir: T } = e(), E = d.useMemo(() => ({
39
+ digits: w,
40
+ messages: C
41
+ }), [w, C]), D = d.Children.count(_t) > 0, [yt, bt] = d.useState({}), xt = d.useMemo(() => ({
42
+ register: (e) => bt((t) => ({
43
+ ...t,
44
+ [e.column.key]: e
45
+ })),
46
+ unregister: (e) => bt((t) => Object.fromEntries(Object.entries(t).filter(([t]) => t !== e)))
47
+ }), []), St = Object.values(yt), O = ne(), Ct = d.useRef(null), wt = d.useMemo(() => r(vt, Ct), [vt]);
48
+ Ie(Ct, D);
49
+ let k = d.useMemo(() => _.columns.filter((e) => e.view), [_.columns]), Tt = d.useMemo(() => k.filter((e) => e.sortable), [k]), A = d.useMemo(() => k.filter((e) => e.filterable), [k]), Et = typeof y == "function", j = typeof b == "function", M = typeof x == "function", N = typeof ct == "function", P = typeof lt == "function", F = typeof ut == "function", I = dt ?? [], Dt = I.length > 0, L = _.searchable ?? !1, R = pt && !D, Ot = gt != null && gt !== !1, kt = _.pagination, At = kt?.onSearchChange, jt = typeof At == "function", Mt = M || N || Dt, z = Mt && !O, { rowNumberColumnStyle: Nt, columnStyleByKey: Pt, actionsColumnStyle: Ft } = d.useMemo(() => he(k, R, z), [
50
+ z,
51
+ R,
52
+ k
53
+ ]), It = d.useMemo(() => {
54
+ let e = _.columns.map((e) => {
42
55
  if (e.type !== "select" && e.type !== "radio") return [e.key, []];
43
56
  if (Array.isArray(e.options) && e.options.length > 0) return [e.key, e.options];
44
57
  if (e.optionsSource) return [e.key, []];
45
58
  let t = /* @__PURE__ */ new Set();
46
- return y.forEach((n) => {
59
+ return v.forEach((n) => {
47
60
  let r = n[e.key];
48
61
  if (typeof r == "string" || typeof r == "number") {
49
62
  let e = String(r).trim();
@@ -55,48 +68,48 @@ var Ge = f.forwardRef(function({ className: Ge, containerClassName: Ke, loading:
55
68
  }))];
56
69
  });
57
70
  return Object.fromEntries(e);
58
- }, [y, v.columns]), [bt, H] = te(), [xt, St] = f.useState(!1), [Ct, wt] = f.useState(!1), [Tt, Et] = f.useState({
71
+ }, [v, _.columns]), [Lt, B] = ee(), [Rt, zt] = d.useState(!1), [Bt, Vt] = d.useState(!1), [Ht, Ut] = d.useState(!1), [Wt, Gt] = d.useState(null), [Kt, qt] = d.useState(!1), [Jt, Yt] = d.useState({
59
72
  open: !1,
60
73
  actions: []
61
- }), U = _ || bt, Dt = f.useCallback(async () => {
62
- _ || !b || await H(b);
74
+ }), V = g || Lt, Xt = d.useCallback(async () => {
75
+ g || !y || await B(y);
63
76
  }, [
64
- _,
65
- b,
66
- H
67
- ]), Ot = f.useCallback(async () => {
68
- _ || !x || await H(x);
77
+ g,
78
+ y,
79
+ B
80
+ ]), Zt = d.useCallback(async () => {
81
+ g || !b || await B(b);
69
82
  }, [
70
- _,
71
- x,
72
- H
73
- ]), W = f.useCallback(async (e, t, n, r) => {
74
- _ || await H(() => e({
83
+ g,
84
+ b,
85
+ B
86
+ ]), H = d.useCallback(async (e, t, n, r) => {
87
+ g || await B(() => e({
75
88
  row: t,
76
89
  rowIndex: n,
77
- rowId: r ?? Te(t, n, E)
90
+ rowId: r ?? be(t, n, S)
78
91
  }));
79
92
  }, [
80
- E,
81
- _,
82
- H
83
- ]), kt = f.useCallback(async (e, t, n) => {
84
- S && await W(S, e, t, n);
85
- }, [S, W]), At = f.useCallback(async (e, t, n) => {
86
- C && await W(C, e, t, n);
87
- }, [C, W]), jt = f.useCallback(async (e, t, n, r) => {
88
- await W(e.onClick, t, n, r);
89
- }, [W]), Mt = f.useCallback(async (e, t, n, r, i) => {
90
- if (_) return;
93
+ S,
94
+ g,
95
+ B
96
+ ]), Qt = d.useCallback(async (e, t, n) => {
97
+ x && await H(x, e, t, n);
98
+ }, [x, H]), $t = d.useCallback(async (e, t, n) => {
99
+ ct && await H(ct, e, t, n);
100
+ }, [ct, H]), en = d.useCallback(async (e, t, n, r) => {
101
+ await H(e.onClick, t, n, r);
102
+ }, [H]), tn = d.useCallback(async (e, t, n, r, i) => {
103
+ if (g) return;
91
104
  let a = i.trim(), o = a.length > 0 ? a : null;
92
105
  if (e[r] === o) return;
93
- let s = n ?? Te(e, t, E), c = {
106
+ let s = n ?? be(e, t, S), c = {
94
107
  ...e,
95
108
  [r]: o
96
109
  };
97
- await H(async () => {
110
+ await B(async () => {
98
111
  try {
99
- if ($e && await $e({
112
+ if (ft && await ft({
100
113
  row: c,
101
114
  previousRow: e,
102
115
  rowIndex: t,
@@ -104,475 +117,563 @@ var Ge = f.forwardRef(function({ className: Ge, containerClassName: Ke, loading:
104
117
  columnKey: r,
105
118
  value: a
106
119
  }) === !1) return;
107
- Ze((e) => be(e, t, s, E, c));
120
+ st((e) => pe(e, t, s, S, c));
108
121
  } catch {
109
122
  return;
110
123
  }
111
124
  });
112
125
  }, [
113
- E,
114
- _,
115
- $e,
116
- H,
117
- Ze
118
- ]), Nt = f.useCallback((e, t, r) => {
119
- let i = (e) => /* @__PURE__ */ m("span", {
120
- className: n("zui:inline-flex", s, "zui:[&>svg]:size-full"),
126
+ S,
127
+ g,
128
+ ft,
129
+ B,
130
+ st
131
+ ]), nn = d.useCallback((e, t, r) => {
132
+ let i = (e) => /* @__PURE__ */ p("span", {
133
+ className: n("zui:inline-flex", o, "zui:[&>svg]:size-full"),
121
134
  children: e
122
135
  }), a = [];
123
- P && a.push({
136
+ M && a.push({
124
137
  key: "edit",
125
- label: D.common.edit,
126
- icon: i(/* @__PURE__ */ m(ze, { "aria-hidden": "true" })),
127
- onSelect: () => void kt(e, t, r)
128
- }), R.forEach((n, o) => {
138
+ label: C.common.edit,
139
+ icon: i(/* @__PURE__ */ p(Je, { "aria-hidden": "true" })),
140
+ onSelect: () => void Qt(e, t, r)
141
+ }), I.forEach((n, o) => {
129
142
  a.push({
130
143
  key: `custom-${o}`,
131
144
  label: n.tooltip,
132
145
  icon: i(n.icon),
133
- onSelect: () => void jt(n, e, t, r)
146
+ onSelect: () => void en(n, e, t, r)
134
147
  });
135
- }), F && a.push({
148
+ }), N && a.push({
136
149
  key: "delete",
137
- label: D.common.delete,
138
- icon: i(/* @__PURE__ */ m(We, { "aria-hidden": "true" })),
150
+ label: C.common.delete,
151
+ icon: i(/* @__PURE__ */ p($e, { "aria-hidden": "true" })),
139
152
  danger: !0,
140
- onSelect: () => void At(e, t, r)
141
- }), Et({
153
+ onSelect: () => void $t(e, t, r)
154
+ }), Yt({
142
155
  open: !0,
143
156
  actions: a
144
157
  });
145
158
  }, [
146
- jt,
147
- At,
148
- kt,
149
- D.common.delete,
150
- D.common.edit,
151
- R,
152
- F,
153
- P
154
- ]), { searchTerm: Pt, normalizedSearchTerm: Ft, filteredRows: It, handleSearchInputChange: Lt } = Ae({
155
- data: y,
156
- visibleColumns: j,
157
- showSearchInput: z,
158
- hasRemoteSearchHandler: ht,
159
- onSearchChange: mt,
160
- getRowId: E,
161
- cellFormatOptions: st
162
- }), { sortedRows: G, activeSort: K, handleSortToggle: Rt, handleSortClear: zt } = je({
163
- rows: It,
164
- columns: v.columns,
165
- sortConfig: v.sort
166
- }), Bt = f.useCallback(async () => {
167
- w && await w({
159
+ en,
160
+ $t,
161
+ Qt,
162
+ C.common.delete,
163
+ C.common.edit,
164
+ I,
165
+ N,
166
+ M
167
+ ]), { searchTerm: rn, normalizedSearchTerm: an, filteredRows: on, handleSearchInputChange: sn } = Re({
168
+ data: v,
169
+ visibleColumns: k,
170
+ showSearchInput: L,
171
+ hasRemoteSearchHandler: jt,
172
+ onSearchChange: At,
173
+ getRowId: S,
174
+ cellFormatOptions: E
175
+ }), { filteredRows: cn, filterValues: U, activeFilterCount: ln, filterKey: un, handleFilterChange: dn, handleFilterClear: fn } = Le({
176
+ rows: on,
177
+ columns: _.columns,
178
+ filterConfig: _.filter
179
+ }), W = d.useMemo(() => Object.fromEntries(A.map((e) => [e.key, ge(e, v, E)])), [
180
+ E,
181
+ v,
182
+ A
183
+ ]), { sortedRows: G, activeSort: K, handleSortToggle: pn, handleSortClear: mn } = ze({
184
+ rows: cn,
185
+ columns: _.columns,
186
+ sortConfig: _.sort
187
+ }), hn = d.useCallback(async () => {
188
+ lt && await lt({
168
189
  rows: G.map(({ row: e }) => e),
169
- columns: j
190
+ columns: k
170
191
  });
171
192
  }, [
172
- w,
193
+ lt,
173
194
  G,
174
- j
175
- ]), Vt = f.useCallback(async () => {
176
- T && await T({
195
+ k
196
+ ]), gn = d.useCallback(async () => {
197
+ ut && await ut({
177
198
  rows: G.map(({ row: e }) => e),
178
- columns: j
199
+ columns: k
179
200
  });
180
201
  }, [
181
- T,
202
+ ut,
182
203
  G,
183
- j
184
- ]), { pagingMode: q, currentPage: Ht, totalPages: Ut, resolvedPageSize: Wt, visibleRows: J, showPagingModeToggle: Y, shouldRenderPagination: Gt, shouldRenderInfiniteMode: Kt, canLoadMoreInInfiniteMode: qt, shouldUseRemotePaging: Jt, shouldUseScrollableRows: Yt, tableScrollViewportRef: Xt, tableScrollViewportStyle: Zt, handlePageChange: Qt, handlePagingModeToggle: $t, handleTableScrollViewport: en, isInfiniteRequestPending: tn } = Oe({
185
- hasChildren: k,
204
+ k
205
+ ]), { pagingMode: q, currentPage: _n, totalPages: vn, resolvedPageSize: yn, visibleRows: J, showPagingModeToggle: bn, shouldRenderPagination: xn, shouldRenderInfiniteMode: Sn, canLoadMoreInInfiniteMode: Cn, shouldUseRemotePaging: wn, shouldUseScrollableRows: Tn, tableScrollViewportRef: En, tableScrollViewportStyle: Dn, handlePageChange: On, handlePagingModeToggle: kn, handleTableScrollViewport: An, isInfiniteRequestPending: jn } = Fe({
206
+ hasChildren: D,
186
207
  filteredRows: G,
187
- paginationConfig: pt,
188
- loading: g,
189
- isRowActionBusy: U,
190
- searchKey: Ft,
208
+ paginationConfig: kt,
209
+ loading: h,
210
+ isRowActionBusy: V,
211
+ searchKey: `${an}|${un}`,
191
212
  sortKey: K ? `${K.sortKey}:${K.direction}` : "",
192
- maxVisibleRowsBeforeScroll: Je,
193
- allowInfiniteMode: Ye
194
- }), X = Yt && qe, nn = f.useMemo(() => Ce(v.pagination?.pageSize, y.length), [y.length, v.pagination?.pageSize]), rn = g && (J.length === 0 || Jt && q === "pagination"), an = Kt && g && J.length > 0, on = Kt && J.length > 0, sn = on && (g || tn), cn = on && qt && !g && !tn, ln = on && !qt && !g && !tn, un = Math.min(nn, Math.max(1, Math.min(Wt, 3))), Z = g || U, dn = +!!P + R.length + +!!F, fn = q === "pagination" ? D.table.switchToInfinite : D.table.switchToPagination, pn = M || N || Y || I || L, Q = A && !k && ut.length > 0, $ = !k && (z || pn || Q), mn = f.useRef(null), hn = f.useRef(null);
195
- ne(mn, hn, A && Xe && $);
196
- let gn = f.useMemo(() => {
197
- let e = (e) => /* @__PURE__ */ m(e, {
198
- className: s,
213
+ maxVisibleRowsBeforeScroll: it,
214
+ allowInfiniteMode: at
215
+ }), Mn = Tn && rt, Nn = d.useMemo(() => ve(_.pagination?.pageSize, v.length), [v.length, _.pagination?.pageSize]), Pn = h && (J.length === 0 || wn && q === "pagination"), Fn = Sn && h && J.length > 0, In = Sn && J.length > 0, Ln = In && (h || jn), Rn = In && Cn && !h && !jn, zn = In && !Cn && !h && !jn, Bn = Math.min(Nn, Math.max(1, Math.min(yn, 3))), Y = h || V, Vn = O ? 0 : +!!M + I.length + +!!N, Hn = q === "pagination" ? C.table.switchToInfinite : C.table.switchToPagination, Un = Et || j || bn || P || F, X = O && !D && Tt.length > 0, Z = O && !D && A.length > 0, Q = !D && (L || Un || X || Z), Wn = d.useRef(null), Gn = d.useRef(null);
216
+ te(Wn, Gn, O && ot && Q);
217
+ let Kn = d.useMemo(() => {
218
+ let e = (e) => /* @__PURE__ */ p(e, {
219
+ className: o,
199
220
  "aria-hidden": "true"
200
- }), n = ut.map((n) => {
201
- let r = K?.sortKey === n.key ? K.direction : void 0, i = t(n.label, O);
221
+ }), n = Tt.map((n) => {
222
+ let r = K?.sortKey === n.key ? K.direction : void 0, i = t(n.label, w);
202
223
  return {
203
224
  key: n.key,
204
- label: r === void 0 ? i : `${i} (${r === "asc" ? D.table.sortAscending : D.table.sortDescending})`,
205
- icon: e(r === "asc" ? Ne : r === "desc" ? Me : Pe),
225
+ label: r === void 0 ? i : `${i} (${r === "asc" ? C.table.sortAscending : C.table.sortDescending})`,
226
+ icon: e(r === "asc" ? Ve : r === "desc" ? Be : He),
206
227
  active: r !== void 0,
207
- onSelect: () => Rt(n.key)
228
+ onSelect: () => pn(n.key)
208
229
  };
209
230
  });
210
231
  return K && n.push({
211
232
  key: "clear-sort",
212
- label: D.table.sortDefault,
213
- icon: e(He),
214
- onSelect: zt
233
+ label: C.table.sortDefault,
234
+ icon: e(Ze),
235
+ onSelect: mn
215
236
  }), n;
216
237
  }, [
217
238
  K,
218
- O,
219
- zt,
220
- Rt,
221
- D.table.sortAscending,
222
- D.table.sortDefault,
223
- D.table.sortDescending,
224
- ut
225
- ]), _n = f.useMemo(() => {
226
- let e = (e) => /* @__PURE__ */ m(e, {
227
- className: s,
239
+ w,
240
+ mn,
241
+ pn,
242
+ C.table.sortAscending,
243
+ C.table.sortDefault,
244
+ C.table.sortDescending,
245
+ Tt
246
+ ]), qn = d.useCallback((e) => {
247
+ Gt(e), qt(!0);
248
+ }, []), Jn = d.useMemo(() => A.map((e) => {
249
+ let n = U[e.key], r = n !== void 0 && !fe(n), i = t(e.label, w), a = r ? t(_e(n, W[e.key] ?? []), w) : "";
250
+ return {
251
+ key: e.key,
252
+ label: r ? `${i}: ${a}` : i,
253
+ icon: /* @__PURE__ */ p(Ke, {
254
+ className: o,
255
+ fill: r ? "currentColor" : "none",
256
+ "aria-hidden": "true"
257
+ }),
258
+ active: r,
259
+ onSelect: () => qn(e.key)
260
+ };
261
+ }), [
262
+ w,
263
+ W,
264
+ U,
265
+ A,
266
+ qn
267
+ ]), $ = A.find((e) => e.key === Wt), Yn = d.useMemo(() => {
268
+ let e = (e) => /* @__PURE__ */ p(e, {
269
+ className: o,
228
270
  "aria-hidden": "true"
229
271
  });
230
272
  return [
231
- M ? {
273
+ Et ? {
232
274
  key: "add",
233
- label: D.common.add,
234
- icon: e(Be),
235
- onSelect: () => void Dt()
275
+ label: C.common.add,
276
+ icon: e(Ye),
277
+ onSelect: () => void Xt()
236
278
  } : null,
237
- N ? {
279
+ j ? {
238
280
  key: "import",
239
- label: D.table.importExcel,
240
- icon: e(Le),
241
- onSelect: () => void Ot()
281
+ label: C.table.importExcel,
282
+ icon: e(Ge),
283
+ onSelect: () => void Zt()
242
284
  } : null,
243
- I ? {
285
+ P ? {
244
286
  key: "print",
245
- label: D.table.print,
246
- icon: e(Ve),
247
- onSelect: () => void Bt()
287
+ label: C.table.print,
288
+ icon: e(Xe),
289
+ onSelect: () => void hn()
248
290
  } : null,
249
- L ? {
291
+ F ? {
250
292
  key: "preview-print",
251
- label: D.table.printPreview,
252
- icon: e(Ie),
253
- onSelect: () => void Vt()
293
+ label: C.table.printPreview,
294
+ icon: e(We),
295
+ onSelect: () => void gn()
254
296
  } : null,
255
- Y ? {
297
+ bn ? {
256
298
  key: "paging-mode",
257
- label: fn,
258
- icon: e(q === "pagination" ? Re : Ue),
259
- onSelect: $t
299
+ label: Hn,
300
+ icon: e(q === "pagination" ? qe : Qe),
301
+ onSelect: kn
260
302
  } : null
261
303
  ].filter((e) => e !== null);
262
304
  }, [
263
- Dt,
264
- Ot,
265
- $t,
266
- Vt,
267
- Bt,
268
- D.common.add,
269
- D.table.importExcel,
270
- D.table.print,
271
- D.table.printPreview,
305
+ Xt,
306
+ Zt,
307
+ kn,
308
+ gn,
309
+ hn,
310
+ C.common.add,
311
+ C.table.importExcel,
312
+ C.table.print,
313
+ C.table.printPreview,
272
314
  q,
273
- fn,
274
- M,
275
- N,
276
- Y,
277
- L,
278
- I
279
- ]), vn = A && (_n.length > 0 || Q), yn = A && _n.length > 1, bn = ft && $ && z, xn = ft && $ && !z, Sn = ft && !$, Cn = /* @__PURE__ */ m("div", {
315
+ Hn,
316
+ Et,
317
+ j,
318
+ bn,
319
+ F,
320
+ P
321
+ ]), Xn = O && (Yn.length > 0 || X || Z), Zn = O && Yn.length > 1, Qn = Ot && Q && L, $n = Ot && Q && !L, er = Ot && !Q, tr = /* @__PURE__ */ p("div", {
280
322
  "data-slot": "table-toolbar-extra",
281
323
  className: n("zui:flex zui:w-full zui:items-center", i),
282
- children: rt
324
+ children: gt
283
325
  });
284
- return /* @__PURE__ */ h("div", {
326
+ return /* @__PURE__ */ m("div", {
285
327
  "data-slot": "table-container",
286
- dir: ot,
287
- className: n(ae(), Ke),
328
+ dir: T,
329
+ className: n(xe(), nt),
288
330
  children: [
289
- Sn ? /* @__PURE__ */ m("div", {
331
+ D ? /* @__PURE__ */ p(Ce, {
332
+ columns: St.map((e) => e.column),
333
+ values: Object.fromEntries(St.flatMap((e) => e.value ? [[e.column.key, e.value]] : [])),
334
+ optionsByColumn: Object.fromEntries(St.map((e) => [e.column.key, e.options])),
335
+ onRemove: (e) => yt[e]?.onChange(void 0)
336
+ }) : /* @__PURE__ */ p(Ce, {
337
+ columns: k,
338
+ values: U,
339
+ optionsByColumn: W,
340
+ onRemove: (e) => dn(e, void 0),
341
+ onSelect: O ? qn : void 0
342
+ }),
343
+ er ? /* @__PURE__ */ p("div", {
290
344
  "data-slot": "table-toolbar-extra-row",
291
345
  className: "zui:mb-3",
292
- children: Cn
346
+ children: tr
293
347
  }) : null,
294
- $ ? /* @__PURE__ */ h(p, { children: [
295
- /* @__PURE__ */ m("div", {
296
- ref: hn,
348
+ Q ? /* @__PURE__ */ m(f, { children: [
349
+ /* @__PURE__ */ p("div", {
350
+ ref: Gn,
297
351
  "aria-hidden": "true",
298
352
  "data-slot": "table-sticky-sentinel"
299
353
  }),
300
- /* @__PURE__ */ h("div", {
301
- ref: mn,
354
+ /* @__PURE__ */ m("div", {
355
+ ref: Wn,
302
356
  "data-slot": "table-sticky-toolbar",
303
- "data-sticky-toolbar": A && Xe ? "true" : void 0,
357
+ "data-sticky-toolbar": O && ot ? "true" : void 0,
304
358
  className: "zui:mb-3",
305
- children: [bn ? /* @__PURE__ */ m("div", {
359
+ children: [Qn ? /* @__PURE__ */ p("div", {
306
360
  "data-slot": "table-toolbar-extra-row",
307
361
  className: "zui:mb-2",
308
- children: Cn
309
- }) : null, /* @__PURE__ */ m(ee, {
362
+ children: tr
363
+ }) : null, /* @__PURE__ */ p(c, {
310
364
  "data-slot": "table-controls",
311
365
  searchSlot: "table-search-input",
312
366
  actionsSlot: "table-add-action",
313
- inlineActionsOnMobile: vn,
314
- search: z ? {
315
- value: Pt,
316
- onChange: Lt,
317
- placeholder: D.common.searchPlaceholder,
318
- ariaLabel: D.table.searchAriaLabel,
319
- disabled: U
367
+ inlineActionsOnMobile: Xn,
368
+ search: L ? {
369
+ value: rn,
370
+ onChange: sn,
371
+ placeholder: C.common.searchPlaceholder,
372
+ ariaLabel: C.table.searchAriaLabel,
373
+ disabled: V
320
374
  } : void 0,
321
- leading: xn ? Cn : void 0,
322
- actions: Q || yn || pn ? /* @__PURE__ */ h(p, { children: [Q ? /* @__PURE__ */ m(l, {
323
- "data-slot": "table-sort-button",
324
- label: D.table.sortBy,
325
- disabled: Z,
326
- onClick: () => wt(!0),
327
- icon: /* @__PURE__ */ m(Pe, { "aria-hidden": "true" })
328
- }) : null, yn ? /* @__PURE__ */ m(l, {
329
- "data-slot": "table-toolbar-menu-button",
330
- label: D.table.actions,
331
- disabled: Z,
332
- onClick: () => St(!0),
333
- icon: /* @__PURE__ */ m(Fe, { "aria-hidden": "true" })
334
- }) : pn ? /* @__PURE__ */ h(p, { children: [
335
- Y ? /* @__PURE__ */ m(l, {
336
- "data-slot": "table-paging-mode-toggle-button",
337
- label: fn,
338
- disabled: Z,
339
- onClick: $t,
340
- icon: m(q === "pagination" ? Re : Ue, {
341
- className: fe,
342
- "aria-hidden": "true"
343
- })
344
- }) : null,
345
- L ? /* @__PURE__ */ m(l, {
346
- "data-slot": "table-action-preview-print-button",
347
- label: D.table.printPreview,
348
- disabled: Z,
349
- onClick: () => void Vt(),
350
- icon: /* @__PURE__ */ m(Ie, {})
351
- }) : null,
352
- I ? /* @__PURE__ */ m(l, {
353
- "data-slot": "table-action-print-button",
354
- label: D.table.print,
355
- disabled: Z,
356
- onClick: () => void Bt(),
357
- icon: /* @__PURE__ */ m(Ve, {})
375
+ leading: $n ? tr : void 0,
376
+ actions: X || Z || Zn || Un ? /* @__PURE__ */ m(f, { children: [
377
+ X ? /* @__PURE__ */ p(l, {
378
+ "data-slot": "table-sort-button",
379
+ label: C.table.sortBy,
380
+ disabled: Y,
381
+ onClick: () => Vt(!0),
382
+ icon: /* @__PURE__ */ p(He, { "aria-hidden": "true" })
358
383
  }) : null,
359
- N ? /* @__PURE__ */ m(l, {
360
- "data-slot": "table-action-import-excel-button",
361
- label: D.table.importExcel,
362
- disabled: Z,
363
- onClick: () => void Ot(),
364
- icon: /* @__PURE__ */ m(Le, {})
384
+ Z ? /* @__PURE__ */ p(l, {
385
+ "data-slot": "table-filter-button",
386
+ label: C.table.filterBy,
387
+ disabled: Y,
388
+ onClick: () => Ut(!0),
389
+ icon: /* @__PURE__ */ m("span", {
390
+ className: "zui:relative zui:inline-flex",
391
+ children: [/* @__PURE__ */ p(Ke, {
392
+ fill: ln > 0 ? "currentColor" : "none",
393
+ "aria-hidden": "true"
394
+ }), ln > 0 ? /* @__PURE__ */ p("span", {
395
+ "aria-hidden": "true",
396
+ "data-slot": "table-filter-active-dot",
397
+ className: "zui:absolute zui:-end-1 zui:-top-1 zui:size-2 zui:rounded-full zui:bg-[var(--zui-theme-action-primary)] zui:ring-2 zui:ring-[var(--zui-color-surface)]"
398
+ }) : null]
399
+ })
365
400
  }) : null,
366
- M ? /* @__PURE__ */ m(l, {
367
- "data-slot": "table-action-add-button",
368
- label: D.common.add,
369
- disabled: Z,
370
- onClick: () => void Dt(),
371
- icon: /* @__PURE__ */ m(Be, {})
372
- }) : null
373
- ] }) : null] }) : void 0
401
+ Zn ? /* @__PURE__ */ p(l, {
402
+ "data-slot": "table-toolbar-menu-button",
403
+ label: C.table.actions,
404
+ disabled: Y,
405
+ onClick: () => zt(!0),
406
+ icon: /* @__PURE__ */ p(Ue, { "aria-hidden": "true" })
407
+ }) : Un ? /* @__PURE__ */ m(f, { children: [
408
+ bn ? /* @__PURE__ */ p(l, {
409
+ "data-slot": "table-paging-mode-toggle-button",
410
+ label: Hn,
411
+ disabled: Y,
412
+ onClick: kn,
413
+ icon: p(q === "pagination" ? qe : Qe, {
414
+ className: se,
415
+ "aria-hidden": "true"
416
+ })
417
+ }) : null,
418
+ F ? /* @__PURE__ */ p(l, {
419
+ "data-slot": "table-action-preview-print-button",
420
+ label: C.table.printPreview,
421
+ disabled: Y,
422
+ onClick: () => void gn(),
423
+ icon: /* @__PURE__ */ p(We, {})
424
+ }) : null,
425
+ P ? /* @__PURE__ */ p(l, {
426
+ "data-slot": "table-action-print-button",
427
+ label: C.table.print,
428
+ disabled: Y,
429
+ onClick: () => void hn(),
430
+ icon: /* @__PURE__ */ p(Xe, {})
431
+ }) : null,
432
+ j ? /* @__PURE__ */ p(l, {
433
+ "data-slot": "table-action-import-excel-button",
434
+ label: C.table.importExcel,
435
+ disabled: Y,
436
+ onClick: () => void Zt(),
437
+ icon: /* @__PURE__ */ p(Ge, {})
438
+ }) : null,
439
+ Et ? /* @__PURE__ */ p(l, {
440
+ "data-slot": "table-action-add-button",
441
+ label: C.common.add,
442
+ disabled: Y,
443
+ onClick: () => void Xt(),
444
+ icon: /* @__PURE__ */ p(Ye, {})
445
+ }) : null
446
+ ] }) : null
447
+ ] }) : void 0
374
448
  })]
375
449
  }),
376
- Q ? /* @__PURE__ */ m(o, {
377
- open: Ct,
378
- onOpenChange: wt,
379
- actions: gn,
380
- label: D.table.sortBy
450
+ X ? /* @__PURE__ */ p(a, {
451
+ open: Bt,
452
+ onOpenChange: Vt,
453
+ actions: Kn,
454
+ label: C.table.sortBy
381
455
  }) : null,
382
- yn ? /* @__PURE__ */ m(o, {
383
- open: xt,
384
- onOpenChange: St,
385
- actions: _n.map((e) => ({
456
+ Z ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(a, {
457
+ open: Ht,
458
+ onOpenChange: Ut,
459
+ actions: Jn,
460
+ label: C.table.filterBy
461
+ }), $ ? /* @__PURE__ */ p(Ee, {
462
+ column: $,
463
+ value: U[$.key],
464
+ onChange: (e) => dn($.key, e),
465
+ options: W[$.key] ?? [],
466
+ open: Kt,
467
+ onOpenChange: qt
468
+ }, $.key) : null] }) : null,
469
+ Zn ? /* @__PURE__ */ p(a, {
470
+ open: Rt,
471
+ onOpenChange: zt,
472
+ actions: Yn.map((e) => ({
386
473
  ...e,
387
- disabled: Z
474
+ disabled: Y
388
475
  })),
389
- label: D.table.actions
476
+ label: C.table.actions
390
477
  }) : null
391
478
  ] }) : null,
392
- /* @__PURE__ */ m("div", {
393
- ref: Xt,
479
+ /* @__PURE__ */ p("div", {
480
+ ref: En,
394
481
  "data-slot": "table-scroll-viewport",
395
- className: n("zui:relative zui:w-full zui:min-w-0 zui:overflow-x-auto zui-radius-xs zui:bg-[var(--zui-color-surface)] zui:shadow-[0_4px_14px_-12px_var(--zui-effect-shadow-ink-35)]", Yt ? "zui:overflow-y-auto" : void 0),
396
- style: Zt,
397
- onScroll: en,
398
- children: /* @__PURE__ */ m("table", {
399
- ref: lt,
482
+ className: n("zui:relative zui:w-full zui:min-w-0 zui:overflow-x-auto zui-radius-xs zui:bg-[var(--zui-color-surface)] zui:shadow-[0_4px_14px_-12px_var(--zui-effect-shadow-ink-35)]", Tn ? "zui:overflow-y-auto" : void 0),
483
+ style: Dn,
484
+ onScroll: An,
485
+ children: /* @__PURE__ */ p("table", {
486
+ ref: wt,
400
487
  "data-slot": "table",
401
- className: n(oe({
402
- showColumnBorder: tt,
403
- showRowBorder: nt
404
- }), Ge),
405
- dir: ot,
406
- children: k ? it : j.length === 0 ? /* @__PURE__ */ m(ge, { children: /* @__PURE__ */ m(ve, { children: /* @__PURE__ */ m(u, {
488
+ className: n(Se({
489
+ showColumnBorder: mt,
490
+ showRowBorder: ht
491
+ }), tt),
492
+ dir: T,
493
+ children: D ? /* @__PURE__ */ p(we.Provider, {
494
+ value: xt,
495
+ children: _t
496
+ }) : k.length === 0 ? /* @__PURE__ */ p(ke, { children: /* @__PURE__ */ p(Me, { children: /* @__PURE__ */ p(u, {
407
497
  className: "zui:py-7 zui:text-center zui:text-[var(--zui-color-text)]",
408
- children: D.table.noColumns
409
- }) }) }) : /* @__PURE__ */ h(p, { children: [
410
- /* @__PURE__ */ h("colgroup", { children: [
411
- B ? /* @__PURE__ */ m("col", { style: gt }) : null,
412
- j.map((e) => /* @__PURE__ */ m("col", { style: _t[e.key] }, `col-${e.key}`)),
413
- V ? /* @__PURE__ */ m("col", { style: vt }) : null
498
+ children: C.table.noColumns
499
+ }) }) }) : /* @__PURE__ */ m(f, { children: [
500
+ /* @__PURE__ */ m("colgroup", { children: [
501
+ R ? /* @__PURE__ */ p("col", { style: Nt }) : null,
502
+ k.map((e) => /* @__PURE__ */ p("col", { style: Pt[e.key] }, `col-${e.key}`)),
503
+ z ? /* @__PURE__ */ p("col", { style: Ft }) : null
414
504
  ] }),
415
- /* @__PURE__ */ m(_e, { children: /* @__PURE__ */ h(ve, { children: [
416
- B ? /* @__PURE__ */ m(d, {
505
+ /* @__PURE__ */ p(je, { children: /* @__PURE__ */ m(Me, { children: [
506
+ R ? /* @__PURE__ */ p(Ae, {
417
507
  align: "center",
418
- className: n(me, X ? he : void 0),
419
- children: D.table.rowNumber
508
+ className: n(le, Mn ? ue : void 0),
509
+ children: C.table.rowNumber
420
510
  }) : null,
421
- j.map((e) => {
422
- if (!e.sortable) return /* @__PURE__ */ m(d, {
511
+ k.map((e) => {
512
+ let n = e.sortable && K?.sortKey === e.key ? K.direction : void 0, r = e.sortable ? /* @__PURE__ */ p(Pe, {
513
+ columnLabel: e.label,
514
+ direction: n,
515
+ onToggle: () => pn(e.key)
516
+ }) : null, i = e.filterable ? /* @__PURE__ */ p(Te, {
517
+ column: e,
518
+ value: U[e.key],
519
+ onChange: (t) => dn(e.key, t),
520
+ options: W[e.key] ?? []
521
+ }) : null;
522
+ return /* @__PURE__ */ p(Ae, {
423
523
  align: e.align,
424
- className: X ? he : void 0,
425
- children: t(e.label, O)
426
- }, `head-${e.key}`);
427
- let n = K?.sortKey === e.key ? K.direction : void 0;
428
- return /* @__PURE__ */ m(d, {
429
- align: e.align,
430
- className: X ? he : void 0,
431
- "aria-sort": xe(n),
432
- children: /* @__PURE__ */ h("span", {
524
+ className: Mn ? ue : void 0,
525
+ "aria-sort": e.sortable ? me(n) : void 0,
526
+ children: e.sortable || e.filterable ? /* @__PURE__ */ m("span", {
433
527
  className: "zui:inline-flex zui:items-center zui:gap-2",
434
- children: [t(e.label, O), /* @__PURE__ */ m(De, {
435
- columnLabel: e.label,
436
- direction: n,
437
- onToggle: () => Rt(e.key)
528
+ children: [t(e.label, w), /* @__PURE__ */ m("span", {
529
+ className: "zui:inline-flex zui:items-center",
530
+ children: [T === "rtl" ? r : i, T === "rtl" ? i : r]
438
531
  })]
439
- })
532
+ }) : t(e.label, w)
440
533
  }, `head-${e.key}`);
441
534
  }),
442
- V ? /* @__PURE__ */ m(d, {
535
+ z ? /* @__PURE__ */ p(Ae, {
443
536
  align: "center",
444
- className: n(ue, de, X ? he : void 0),
445
- children: D.table.actions
537
+ className: n(ae, oe, Mn ? ue : void 0),
538
+ children: C.table.actions
446
539
  }) : null
447
540
  ] }) }),
448
- /* @__PURE__ */ m(ge, { children: rn ? /* @__PURE__ */ m(Ee, {
449
- count: nn,
541
+ /* @__PURE__ */ p(ke, { children: Pn ? /* @__PURE__ */ p(Ne, {
542
+ count: Nn,
450
543
  keyPrefix: "loading",
451
- showRowNumbers: B,
452
- columns: j,
453
- actionsCount: dn
454
- }) : J.length === 0 ? /* @__PURE__ */ m(se, {
455
- colSpan: j.length + +!!V + +!!B,
456
- showSearchInput: z,
457
- normalizedSearchTerm: Ft
458
- }) : /* @__PURE__ */ h(p, { children: [J.map(({ row: e, rowIndex: r, rowId: i }, o) => {
459
- let s = i === void 0 ? `row-${r}` : `row-id-${String(i)}`, ee = Gt ? (Ht - 1) * Wt + o + 1 : o + 1;
460
- return /* @__PURE__ */ h(ve, { children: [
461
- B ? /* @__PURE__ */ m(u, {
462
- align: "center",
463
- className: me,
464
- "data-label": D.table.rowNumber,
465
- children: t(String(ee), O)
466
- }) : null,
467
- j.map((n) => {
468
- let a = `cell-${n.key}-${s}`;
469
- if (n.viewType === "select") {
470
- let o = yt[n.key] ?? [], s = e[n.key], c = typeof s == "string" || typeof s == "number" ? String(s) : "";
471
- return /* @__PURE__ */ m(u, {
544
+ showRowNumbers: R,
545
+ columns: k,
546
+ actionsCount: Vn
547
+ }) : J.length === 0 ? /* @__PURE__ */ p(De, {
548
+ colSpan: k.length + +!!z + +!!R,
549
+ showSearchInput: L,
550
+ normalizedSearchTerm: an,
551
+ hasActiveFilters: ln > 0,
552
+ onClearFilters: fn
553
+ }) : /* @__PURE__ */ m(f, { children: [J.map(({ row: e, rowIndex: r, rowId: i }, a) => {
554
+ let o = i === void 0 ? `row-${r}` : `row-id-${String(i)}`, c = xn ? (_n - 1) * yn + a + 1 : a + 1;
555
+ return /* @__PURE__ */ m(Me, {
556
+ ...O && Mt ? {
557
+ tabIndex: 0,
558
+ "aria-haspopup": "dialog",
559
+ "data-actionable": "true",
560
+ onClick: (t) => {
561
+ et(t) || nn(e, r, i);
562
+ },
563
+ onKeyDown: (t) => {
564
+ t.target === t.currentTarget && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), nn(e, r, i));
565
+ }
566
+ } : {},
567
+ children: [
568
+ R ? /* @__PURE__ */ p(u, {
569
+ align: "center",
570
+ className: le,
571
+ "data-label": C.table.rowNumber,
572
+ children: t(String(c), w)
573
+ }) : null,
574
+ k.map((n) => {
575
+ let a = `cell-${n.key}-${o}`;
576
+ if (n.viewType === "select") {
577
+ let o = It[n.key] ?? [], s = e[n.key], c = typeof s == "string" || typeof s == "number" ? String(s) : "";
578
+ return /* @__PURE__ */ p(u, {
579
+ align: n.align,
580
+ "data-label": t(n.label, w),
581
+ children: /* @__PURE__ */ p(re, {
582
+ disabled: V || o.length === 0 && !n.optionsSource,
583
+ placeholder: ye(n),
584
+ options: o,
585
+ remoteOptions: n.optionsSource,
586
+ value: c,
587
+ onValueChange: (t) => {
588
+ let a = Array.isArray(t) ? t[0] ?? "" : t;
589
+ tn(e, r, i, n.key, a);
590
+ }
591
+ })
592
+ }, a);
593
+ }
594
+ return /* @__PURE__ */ p(u, {
472
595
  align: n.align,
473
- "data-label": t(n.label, O),
474
- children: /* @__PURE__ */ m(ie, {
475
- disabled: U || o.length === 0 && !n.optionsSource,
476
- placeholder: we(n),
477
- options: o,
478
- remoteOptions: n.optionsSource,
479
- value: c,
480
- onValueChange: (t) => {
481
- let a = Array.isArray(t) ? t[0] ?? "" : t;
482
- Mt(e, r, i, n.key, a);
483
- }
484
- })
596
+ "data-label": t(n.label, w),
597
+ children: de(e[n.key], n, E)
485
598
  }, a);
486
- }
487
- return /* @__PURE__ */ m(u, {
488
- align: n.align,
489
- "data-label": t(n.label, O),
490
- children: ye(e[n.key], n, st)
491
- }, a);
492
- }),
493
- V ? /* @__PURE__ */ m(u, {
494
- align: "center",
495
- "data-cell": "actions",
496
- className: n(ue, de),
497
- children: A ? /* @__PURE__ */ m(a, {
498
- "data-slot": "table-row-actions-button",
499
- kind: "cancel",
500
- fullWidth: !0,
501
- label: D.table.actions,
502
- disabled: U,
503
- onClick: () => Nt(e, r, i)
504
- }) : /* @__PURE__ */ h("div", {
505
- "data-slot": "table-row-actions",
506
- className: "zui:flex zui:items-center zui:justify-center zui:gap-0.5",
507
- children: [
508
- P ? /* @__PURE__ */ m(c, {
509
- "data-slot": "table-action-edit-button",
510
- label: D.common.edit,
511
- icon: /* @__PURE__ */ m(ze, {
512
- className: le,
513
- "aria-hidden": "true"
514
- }),
515
- disabled: U,
516
- className: n(pe, "zui:text-[var(--zui-theme-text-primary)]"),
517
- onClick: () => void kt(e, r, i)
518
- }) : null,
519
- R.map((t, a) => /* @__PURE__ */ m(c, {
520
- "data-slot": "table-action-custom-button",
521
- label: t.tooltip,
522
- icon: t.icon,
523
- disabled: U,
524
- className: n(pe, "zui:text-[var(--zui-theme-text-primary)]"),
525
- onClick: () => void jt(t, e, r, i)
526
- }, `${t.tooltip}-${a}`)),
527
- F ? /* @__PURE__ */ m(c, {
528
- "data-slot": "table-action-delete-button",
529
- label: D.common.delete,
530
- icon: /* @__PURE__ */ m(We, {
531
- className: le,
532
- "aria-hidden": "true"
533
- }),
534
- disabled: U,
535
- className: n(pe, "zui:text-[var(--zui-theme-status-danger)]"),
536
- onClick: () => void At(e, r, i)
537
- }) : null
538
- ]
539
- })
540
- }) : null
541
- ] }, s);
542
- }), an ? /* @__PURE__ */ m(Ee, {
543
- count: un,
599
+ }),
600
+ z ? /* @__PURE__ */ p(u, {
601
+ align: "center",
602
+ "data-cell": "actions",
603
+ className: n(ae, oe),
604
+ children: /* @__PURE__ */ m("div", {
605
+ "data-slot": "table-row-actions",
606
+ className: "zui:flex zui:items-center zui:justify-center zui:gap-0.5",
607
+ children: [
608
+ M ? /* @__PURE__ */ p(s, {
609
+ "data-slot": "table-action-edit-button",
610
+ label: C.common.edit,
611
+ icon: /* @__PURE__ */ p(Je, {
612
+ className: ie,
613
+ "aria-hidden": "true"
614
+ }),
615
+ disabled: V,
616
+ className: n(ce, "zui:text-[var(--zui-theme-text-primary)]"),
617
+ onClick: () => void Qt(e, r, i)
618
+ }) : null,
619
+ I.map((t, a) => /* @__PURE__ */ p(s, {
620
+ "data-slot": "table-action-custom-button",
621
+ label: t.tooltip,
622
+ icon: t.icon,
623
+ disabled: V,
624
+ className: n(ce, "zui:text-[var(--zui-theme-text-primary)]"),
625
+ onClick: () => void en(t, e, r, i)
626
+ }, `${t.tooltip}-${a}`)),
627
+ N ? /* @__PURE__ */ p(s, {
628
+ "data-slot": "table-action-delete-button",
629
+ label: C.common.delete,
630
+ icon: /* @__PURE__ */ p($e, {
631
+ className: ie,
632
+ "aria-hidden": "true"
633
+ }),
634
+ disabled: V,
635
+ className: n(ce, "zui:text-[var(--zui-theme-status-danger)]"),
636
+ onClick: () => void $t(e, r, i)
637
+ }) : null
638
+ ]
639
+ })
640
+ }) : null
641
+ ]
642
+ }, o);
643
+ }), Fn ? /* @__PURE__ */ p(Ne, {
644
+ count: Bn,
544
645
  keyPrefix: "infinite-loading",
545
- showRowNumbers: B,
546
- columns: j,
547
- actionsCount: dn
646
+ showRowNumbers: R,
647
+ columns: k,
648
+ actionsCount: Vn
548
649
  }) : null] }) })
549
650
  ] })
550
651
  })
551
652
  }),
552
- A && V ? /* @__PURE__ */ m(o, {
553
- open: Tt.open,
554
- onOpenChange: (e) => Et((t) => ({
653
+ O && Mt ? /* @__PURE__ */ p(a, {
654
+ open: Jt.open,
655
+ onOpenChange: (e) => Yt((t) => ({
555
656
  ...t,
556
657
  open: e
557
658
  })),
558
- actions: Tt.actions,
559
- label: D.table.actions
659
+ actions: Jt.actions,
660
+ label: C.table.actions
560
661
  }) : null,
561
- /* @__PURE__ */ m(ce, {
562
- shouldRenderInfiniteMode: Kt,
563
- shouldShowInfiniteLoadingStatus: sn,
564
- shouldShowInfiniteReadyStatus: cn,
565
- shouldShowInfiniteCompletedStatus: ln,
566
- shouldRenderPagination: Gt,
567
- loading: g,
568
- isRowActionBusy: U,
569
- currentPage: Ht,
570
- totalPages: Ut,
571
- onPageChange: Qt
662
+ /* @__PURE__ */ p(Oe, {
663
+ shouldRenderInfiniteMode: Sn,
664
+ shouldShowInfiniteLoadingStatus: Ln,
665
+ shouldShowInfiniteReadyStatus: Rn,
666
+ shouldShowInfiniteCompletedStatus: zn,
667
+ shouldRenderPagination: xn,
668
+ loading: h,
669
+ isRowActionBusy: V,
670
+ currentPage: _n,
671
+ totalPages: vn,
672
+ onPageChange: On
572
673
  })
573
674
  ]
574
675
  });
575
676
  });
576
- Ge.displayName = "Table";
677
+ tt.displayName = "Table";
577
678
  //#endregion
578
- export { Ge as default };
679
+ export { tt as default };