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