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