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