lizaui 9.0.52 → 9.0.54
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/chunks/chevron-down-BTrLI_vJ.js +6 -0
- package/dist/chunks/chevron-down-BTrLI_vJ.js.map +1 -0
- package/dist/chunks/chevron-down-D-14pIT_.js +7 -0
- package/dist/chunks/chevron-down-D-14pIT_.js.map +1 -0
- package/dist/chunks/chevron-up-BBd-SipB.js +7 -0
- package/dist/chunks/chevron-up-BBd-SipB.js.map +1 -0
- package/dist/chunks/chevron-up-egHdliKz.js +6 -0
- package/dist/chunks/chevron-up-egHdliKz.js.map +1 -0
- package/dist/chunks/{index--Lp5VMoT.js → index-Cqht2FCn.js} +3 -6
- package/dist/chunks/index-Cqht2FCn.js.map +1 -0
- package/dist/chunks/{index-xVewW5kR.js → index-D6rBzjZf.js} +3 -6
- package/dist/chunks/index-D6rBzjZf.js.map +1 -0
- package/dist/chunks/{scroll-area-DTgVLYwQ.js → scroll-area-DDEg3_oz.js} +2 -2
- package/dist/chunks/{scroll-area-DTgVLYwQ.js.map → scroll-area-DDEg3_oz.js.map} +1 -1
- package/dist/chunks/{scroll-area-Bv006UzS.js → scroll-area-_ap_QsnE.js} +2 -2
- package/dist/chunks/{scroll-area-Bv006UzS.js.map → scroll-area-_ap_QsnE.js.map} +1 -1
- package/dist/chunks/{select-JfY1UjKe.js → select-BROp3S0I.js} +4 -5
- package/dist/chunks/select-BROp3S0I.js.map +1 -0
- package/dist/chunks/{select-Bm7MENHi.js → select-CqltFRiu.js} +7 -8
- package/dist/chunks/select-CqltFRiu.js.map +1 -0
- package/dist/components/table/body/table-body.d.ts.map +1 -1
- package/dist/components/table/context/table.context.d.ts.map +1 -1
- package/dist/components/table/header/table-header-column.d.ts.map +1 -1
- package/dist/components/table/hook/use-table.d.ts +3 -2
- package/dist/components/table/hook/use-table.d.ts.map +1 -1
- package/dist/components/table/interface/table.interface.d.ts +9 -0
- package/dist/components/table/interface/table.interface.d.ts.map +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/pagination/index.cjs.js +1 -1
- package/dist/pagination/index.es.js +1 -1
- package/dist/phone-input/index.cjs.js +4 -3
- package/dist/phone-input/index.cjs.js.map +1 -1
- package/dist/phone-input/index.es.js +3 -2
- package/dist/phone-input/index.es.js.map +1 -1
- package/dist/table/index.cjs.js +333 -179
- package/dist/table/index.cjs.js.map +1 -1
- package/dist/table/index.es.js +333 -179
- package/dist/table/index.es.js.map +1 -1
- package/dist/ui/index.cjs.js +6 -5
- package/dist/ui/index.cjs.js.map +1 -1
- package/dist/ui/index.es.js +6 -5
- package/dist/ui/index.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/index--Lp5VMoT.js.map +0 -1
- package/dist/chunks/index-xVewW5kR.js.map +0 -1
- package/dist/chunks/select-Bm7MENHi.js.map +0 -1
- package/dist/chunks/select-JfY1UjKe.js.map +0 -1
package/dist/table/index.es.js
CHANGED
|
@@ -3,10 +3,18 @@ import { c } from "react/compiler-runtime";
|
|
|
3
3
|
import React__default, { isValidElement, createContext, useContext, memo, forwardRef, useId, useMemo, useState } from "react";
|
|
4
4
|
import { twMerge } from "tailwind-merge";
|
|
5
5
|
import { T as Tooltip } from "../chunks/tooltip-BVafMD5T.js";
|
|
6
|
+
import { C as ChevronUp } from "../chunks/chevron-up-BBd-SipB.js";
|
|
7
|
+
import { C as ChevronDown } from "../chunks/chevron-down-D-14pIT_.js";
|
|
8
|
+
import { c as createLucideIcon } from "../chunks/createLucideIcon-C5oU6LEj.js";
|
|
6
9
|
import { L as LoaderCircle } from "../chunks/loader-circle-CeKbzHTN.js";
|
|
7
10
|
import clsx from "clsx";
|
|
8
11
|
import { C as Checkbox } from "../chunks/checkbox-upIIzsyW.js";
|
|
9
12
|
import { AnimatePresence, LazyMotion } from "framer-motion";
|
|
13
|
+
const __iconNode = [
|
|
14
|
+
["path", { d: "m7 15 5 5 5-5", key: "1hf1tw" }],
|
|
15
|
+
["path", { d: "m7 9 5-5 5 5", key: "sgt6xg" }]
|
|
16
|
+
];
|
|
17
|
+
const ChevronsUpDown = createLucideIcon("chevrons-up-down", __iconNode);
|
|
10
18
|
const TableHeader = React__default.memo((t0) => {
|
|
11
19
|
const $ = c(14);
|
|
12
20
|
let children;
|
|
@@ -68,8 +76,24 @@ const TableHeader = React__default.memo((t0) => {
|
|
|
68
76
|
return t3;
|
|
69
77
|
});
|
|
70
78
|
TableHeader.displayName = "TableHeader";
|
|
79
|
+
const initialValues = {
|
|
80
|
+
color: "primary",
|
|
81
|
+
disabledKeys: [],
|
|
82
|
+
isChecks: true,
|
|
83
|
+
selectKeys: [],
|
|
84
|
+
isActions: true,
|
|
85
|
+
widthAction: 100,
|
|
86
|
+
totalColumn: 0,
|
|
87
|
+
sortDescriptors: [],
|
|
88
|
+
onSortChange: () => {
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const TableContext = createContext(initialValues);
|
|
92
|
+
const useTableContext = () => {
|
|
93
|
+
return useContext(TableContext);
|
|
94
|
+
};
|
|
71
95
|
const TableHeaderColumn = React__default.memo((t0) => {
|
|
72
|
-
const $ = c(
|
|
96
|
+
const $ = c(41);
|
|
73
97
|
const {
|
|
74
98
|
children,
|
|
75
99
|
className,
|
|
@@ -92,6 +116,10 @@ const TableHeaderColumn = React__default.memo((t0) => {
|
|
|
92
116
|
const icon = t2 === void 0 ? null : t2;
|
|
93
117
|
const text = t3 === void 0 ? "" : t3;
|
|
94
118
|
const colspan = t4 === void 0 ? void 0 : t4;
|
|
119
|
+
const {
|
|
120
|
+
sortDescriptors,
|
|
121
|
+
onSortChange
|
|
122
|
+
} = useTableContext();
|
|
95
123
|
let t6;
|
|
96
124
|
if ($[2] !== className) {
|
|
97
125
|
t6 = twMerge("px-2 border-b border-divider", className);
|
|
@@ -127,9 +155,86 @@ const TableHeaderColumn = React__default.memo((t0) => {
|
|
|
127
155
|
t10 = $[9];
|
|
128
156
|
}
|
|
129
157
|
const isChildrenEmpty = t10;
|
|
158
|
+
const isSortable = header?.sort;
|
|
159
|
+
header?.id;
|
|
130
160
|
let t11;
|
|
131
|
-
if ($[10] !==
|
|
132
|
-
t11 =
|
|
161
|
+
if ($[10] !== header?.id || $[11] !== sortDescriptors) {
|
|
162
|
+
t11 = sortDescriptors?.find((d) => d.column === header?.id);
|
|
163
|
+
$[10] = header?.id;
|
|
164
|
+
$[11] = sortDescriptors;
|
|
165
|
+
$[12] = t11;
|
|
166
|
+
} else {
|
|
167
|
+
t11 = $[12];
|
|
168
|
+
}
|
|
169
|
+
const currentSort = t11;
|
|
170
|
+
let t12;
|
|
171
|
+
if ($[13] !== currentSort || $[14] !== header?.id || $[15] !== sortDescriptors) {
|
|
172
|
+
t12 = () => {
|
|
173
|
+
if (!sortDescriptors || sortDescriptors.length <= 1 || !currentSort) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
return sortDescriptors.findIndex((d_0) => d_0.column === header?.id) + 1;
|
|
177
|
+
};
|
|
178
|
+
$[13] = currentSort;
|
|
179
|
+
$[14] = header?.id;
|
|
180
|
+
$[15] = sortDescriptors;
|
|
181
|
+
$[16] = t12;
|
|
182
|
+
} else {
|
|
183
|
+
t12 = $[16];
|
|
184
|
+
}
|
|
185
|
+
header?.id;
|
|
186
|
+
const sortOrderIndex = t12();
|
|
187
|
+
let t13;
|
|
188
|
+
if ($[17] !== header || $[18] !== isSortable || $[19] !== onSortChange) {
|
|
189
|
+
t13 = () => {
|
|
190
|
+
if (isSortable && onSortChange && header?.id) {
|
|
191
|
+
onSortChange(header.id);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
$[17] = header;
|
|
195
|
+
$[18] = isSortable;
|
|
196
|
+
$[19] = onSortChange;
|
|
197
|
+
$[20] = t13;
|
|
198
|
+
} else {
|
|
199
|
+
t13 = $[20];
|
|
200
|
+
}
|
|
201
|
+
const handleSort = t13;
|
|
202
|
+
let t14;
|
|
203
|
+
if ($[21] !== currentSort || $[22] !== icon || $[23] !== isSortable || $[24] !== sortOrderIndex) {
|
|
204
|
+
t14 = () => {
|
|
205
|
+
if (!isSortable) {
|
|
206
|
+
return icon;
|
|
207
|
+
}
|
|
208
|
+
if (currentSort) {
|
|
209
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
|
|
210
|
+
sortOrderIndex && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-default-400", children: sortOrderIndex }),
|
|
211
|
+
currentSort.direction === "asc" ? /* @__PURE__ */ jsx(ChevronUp, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 text-primary" })
|
|
212
|
+
] });
|
|
213
|
+
}
|
|
214
|
+
return /* @__PURE__ */ jsx(ChevronsUpDown, { className: "h-4 w-4 text-default-300" });
|
|
215
|
+
};
|
|
216
|
+
$[21] = currentSort;
|
|
217
|
+
$[22] = icon;
|
|
218
|
+
$[23] = isSortable;
|
|
219
|
+
$[24] = sortOrderIndex;
|
|
220
|
+
$[25] = t14;
|
|
221
|
+
} else {
|
|
222
|
+
t14 = $[25];
|
|
223
|
+
}
|
|
224
|
+
const renderSortIcon = t14;
|
|
225
|
+
const t15 = isSortable ? "cursor-pointer hover:bg-default-100 transition-colors" : "";
|
|
226
|
+
let t16;
|
|
227
|
+
if ($[26] !== mergedClass || $[27] !== t15) {
|
|
228
|
+
t16 = twMerge(mergedClass, t15);
|
|
229
|
+
$[26] = mergedClass;
|
|
230
|
+
$[27] = t15;
|
|
231
|
+
$[28] = t16;
|
|
232
|
+
} else {
|
|
233
|
+
t16 = $[28];
|
|
234
|
+
}
|
|
235
|
+
let t17;
|
|
236
|
+
if ($[29] !== children || $[30] !== header?.information || $[31] !== isChildrenEmpty || $[32] !== renderSortIcon || $[33] !== text) {
|
|
237
|
+
t17 = isChildrenEmpty ? /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center gap-x-2 font-medium", children: [
|
|
133
238
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
134
239
|
/* @__PURE__ */ jsx("p", { className: "line-clamp-1 text-xs text-foreground-500 dark:text-foreground-500 text-left", children: text }),
|
|
135
240
|
header?.information && /* @__PURE__ */ jsx(Tooltip, { content: header?.information || "", children: /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", role: "img", className: "text-default-300 cursor-pointer dark:text-foreground-500", width: 16, height: 16, viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxs("g", { fill: "none", children: [
|
|
@@ -138,44 +243,32 @@ const TableHeaderColumn = React__default.memo((t0) => {
|
|
|
138
243
|
/* @__PURE__ */ jsx("circle", { cx: 1, cy: 1, r: 1, fill: "currentColor", transform: "matrix(1 0 0 -1 11 9)" })
|
|
139
244
|
] }) }) })
|
|
140
245
|
] }),
|
|
141
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 flex", children:
|
|
246
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 flex justify-end", children: renderSortIcon() })
|
|
142
247
|
] }) : children;
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
248
|
+
$[29] = children;
|
|
249
|
+
$[30] = header?.information;
|
|
250
|
+
$[31] = isChildrenEmpty;
|
|
251
|
+
$[32] = renderSortIcon;
|
|
252
|
+
$[33] = text;
|
|
253
|
+
$[34] = t17;
|
|
149
254
|
} else {
|
|
150
|
-
|
|
255
|
+
t17 = $[34];
|
|
151
256
|
}
|
|
152
|
-
let
|
|
153
|
-
if ($[
|
|
154
|
-
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
257
|
+
let t18;
|
|
258
|
+
if ($[35] !== colspan || $[36] !== handleSort || $[37] !== mergedStyle || $[38] !== t16 || $[39] !== t17) {
|
|
259
|
+
t18 = /* @__PURE__ */ jsx("th", { className: t16, style: mergedStyle, colSpan: colspan, onClick: handleSort, children: t17 });
|
|
260
|
+
$[35] = colspan;
|
|
261
|
+
$[36] = handleSort;
|
|
262
|
+
$[37] = mergedStyle;
|
|
263
|
+
$[38] = t16;
|
|
264
|
+
$[39] = t17;
|
|
265
|
+
$[40] = t18;
|
|
160
266
|
} else {
|
|
161
|
-
|
|
267
|
+
t18 = $[40];
|
|
162
268
|
}
|
|
163
|
-
return
|
|
269
|
+
return t18;
|
|
164
270
|
});
|
|
165
271
|
TableHeaderColumn.displayName = "TableHeaderColumn";
|
|
166
|
-
const initialValues = {
|
|
167
|
-
color: "primary",
|
|
168
|
-
disabledKeys: [],
|
|
169
|
-
isChecks: true,
|
|
170
|
-
selectKeys: [],
|
|
171
|
-
isActions: true,
|
|
172
|
-
widthAction: 100,
|
|
173
|
-
totalColumn: 0
|
|
174
|
-
};
|
|
175
|
-
const TableContext = createContext(initialValues);
|
|
176
|
-
const useTableContext = () => {
|
|
177
|
-
return useContext(TableContext);
|
|
178
|
-
};
|
|
179
272
|
const TableEmptyState = memo((t0) => {
|
|
180
273
|
const $ = c(3);
|
|
181
274
|
const {
|
|
@@ -204,7 +297,7 @@ const TableEmptyState = memo((t0) => {
|
|
|
204
297
|
});
|
|
205
298
|
TableEmptyState.displayName = "TableEmptyState";
|
|
206
299
|
function TableBodyComponent(t0) {
|
|
207
|
-
const $ = c(
|
|
300
|
+
const $ = c(45);
|
|
208
301
|
let children;
|
|
209
302
|
let className;
|
|
210
303
|
let props;
|
|
@@ -261,27 +354,39 @@ function TableBodyComponent(t0) {
|
|
|
261
354
|
isChecks
|
|
262
355
|
} = useTableContext();
|
|
263
356
|
const total = Number(totalColumn) + Number(isActions) + Number(isChecks);
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
357
|
+
const t6 = props;
|
|
358
|
+
let domProps;
|
|
359
|
+
if ($[11] !== t6) {
|
|
360
|
+
domProps = {
|
|
361
|
+
...t6
|
|
362
|
+
};
|
|
363
|
+
delete domProps.dataHeader;
|
|
364
|
+
$[11] = t6;
|
|
365
|
+
$[12] = domProps;
|
|
269
366
|
} else {
|
|
270
|
-
|
|
367
|
+
domProps = $[12];
|
|
271
368
|
}
|
|
272
|
-
const mergedClass = t6;
|
|
273
369
|
let t7;
|
|
370
|
+
if ($[13] !== className) {
|
|
371
|
+
t7 = twMerge(className);
|
|
372
|
+
$[13] = className;
|
|
373
|
+
$[14] = t7;
|
|
374
|
+
} else {
|
|
375
|
+
t7 = $[14];
|
|
376
|
+
}
|
|
377
|
+
const mergedClass = t7;
|
|
378
|
+
let t8;
|
|
274
379
|
bb0: {
|
|
275
380
|
if (!data || data.length === 0) {
|
|
276
|
-
|
|
381
|
+
t8 = null;
|
|
277
382
|
break bb0;
|
|
278
383
|
}
|
|
279
384
|
if (typeof children === "function") {
|
|
280
|
-
let
|
|
281
|
-
if ($[
|
|
282
|
-
let
|
|
283
|
-
if ($[
|
|
284
|
-
|
|
385
|
+
let t92;
|
|
386
|
+
if ($[15] !== children || $[16] !== data || $[17] !== rowKey) {
|
|
387
|
+
let t10;
|
|
388
|
+
if ($[19] !== children || $[20] !== rowKey) {
|
|
389
|
+
t10 = (el, index) => {
|
|
285
390
|
const child = children({
|
|
286
391
|
item: el,
|
|
287
392
|
index
|
|
@@ -291,114 +396,114 @@ function TableBodyComponent(t0) {
|
|
|
291
396
|
key: keyValue
|
|
292
397
|
}) : null;
|
|
293
398
|
};
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
399
|
+
$[19] = children;
|
|
400
|
+
$[20] = rowKey;
|
|
401
|
+
$[21] = t10;
|
|
297
402
|
} else {
|
|
298
|
-
|
|
403
|
+
t10 = $[21];
|
|
299
404
|
}
|
|
300
|
-
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
405
|
+
t92 = data.map(t10);
|
|
406
|
+
$[15] = children;
|
|
407
|
+
$[16] = data;
|
|
408
|
+
$[17] = rowKey;
|
|
409
|
+
$[18] = t92;
|
|
305
410
|
} else {
|
|
306
|
-
|
|
411
|
+
t92 = $[18];
|
|
307
412
|
}
|
|
308
|
-
|
|
413
|
+
t8 = t92;
|
|
309
414
|
} else {
|
|
310
|
-
let
|
|
311
|
-
if ($[
|
|
312
|
-
let
|
|
313
|
-
if ($[
|
|
314
|
-
|
|
415
|
+
let t92;
|
|
416
|
+
if ($[22] !== children || $[23] !== data || $[24] !== rowKey) {
|
|
417
|
+
let t10;
|
|
418
|
+
if ($[26] !== data || $[27] !== rowKey) {
|
|
419
|
+
t10 = (child_0, index_0) => isValidElement(child_0) ? React__default.cloneElement(child_0, {
|
|
315
420
|
key: rowKey ? rowKey(data[index_0], index_0) : index_0
|
|
316
421
|
}) : child_0;
|
|
317
|
-
$[
|
|
318
|
-
$[
|
|
319
|
-
$[
|
|
422
|
+
$[26] = data;
|
|
423
|
+
$[27] = rowKey;
|
|
424
|
+
$[28] = t10;
|
|
320
425
|
} else {
|
|
321
|
-
|
|
426
|
+
t10 = $[28];
|
|
322
427
|
}
|
|
323
|
-
|
|
324
|
-
$[
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
$[
|
|
428
|
+
t92 = React__default.Children.map(children, t10);
|
|
429
|
+
$[22] = children;
|
|
430
|
+
$[23] = data;
|
|
431
|
+
$[24] = rowKey;
|
|
432
|
+
$[25] = t92;
|
|
328
433
|
} else {
|
|
329
|
-
|
|
434
|
+
t92 = $[25];
|
|
330
435
|
}
|
|
331
|
-
|
|
436
|
+
t8 = t92;
|
|
332
437
|
}
|
|
333
438
|
}
|
|
334
|
-
const renderedRows =
|
|
439
|
+
const renderedRows = t8;
|
|
335
440
|
let fallbackContent = null;
|
|
336
441
|
if (isLoading) {
|
|
337
|
-
let
|
|
338
|
-
if ($[
|
|
339
|
-
|
|
340
|
-
$[
|
|
442
|
+
let t92;
|
|
443
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
444
|
+
t92 = /* @__PURE__ */ jsx("div", { className: "mt-3.5", children: /* @__PURE__ */ jsx(LoaderCircle, { size: 45 }) });
|
|
445
|
+
$[29] = t92;
|
|
341
446
|
} else {
|
|
342
|
-
|
|
447
|
+
t92 = $[29];
|
|
343
448
|
}
|
|
344
|
-
let
|
|
345
|
-
if ($[
|
|
346
|
-
|
|
347
|
-
|
|
449
|
+
let t10;
|
|
450
|
+
if ($[30] !== loadingLabel) {
|
|
451
|
+
t10 = /* @__PURE__ */ jsx("div", { className: "flex justify-center relative", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-center items-center gap-2", children: [
|
|
452
|
+
t92,
|
|
348
453
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("p", { className: "line-clamp-1 text-sm text-default-800", children: loadingLabel }) })
|
|
349
454
|
] }) });
|
|
350
|
-
$[
|
|
351
|
-
$[
|
|
455
|
+
$[30] = loadingLabel;
|
|
456
|
+
$[31] = t10;
|
|
352
457
|
} else {
|
|
353
|
-
|
|
458
|
+
t10 = $[31];
|
|
354
459
|
}
|
|
355
|
-
let
|
|
356
|
-
if ($[
|
|
357
|
-
|
|
358
|
-
$[30] = t9;
|
|
359
|
-
$[31] = total;
|
|
460
|
+
let t11;
|
|
461
|
+
if ($[32] !== t10 || $[33] !== total) {
|
|
462
|
+
t11 = /* @__PURE__ */ jsx("tr", { className: "border-b border-divider", children: /* @__PURE__ */ jsx("td", { className: "px-2 py-2.5 w-full", colSpan: total, children: t10 }) });
|
|
360
463
|
$[32] = t10;
|
|
464
|
+
$[33] = total;
|
|
465
|
+
$[34] = t11;
|
|
361
466
|
} else {
|
|
362
|
-
|
|
467
|
+
t11 = $[34];
|
|
363
468
|
}
|
|
364
|
-
fallbackContent =
|
|
469
|
+
fallbackContent = t11;
|
|
365
470
|
} else {
|
|
366
471
|
if (data.length === 0) {
|
|
367
|
-
let
|
|
368
|
-
if ($[
|
|
369
|
-
|
|
370
|
-
$[
|
|
371
|
-
$[
|
|
472
|
+
let t92;
|
|
473
|
+
if ($[35] !== emptyText) {
|
|
474
|
+
t92 = /* @__PURE__ */ jsx(TableEmptyState, { text: emptyText });
|
|
475
|
+
$[35] = emptyText;
|
|
476
|
+
$[36] = t92;
|
|
372
477
|
} else {
|
|
373
|
-
|
|
478
|
+
t92 = $[36];
|
|
374
479
|
}
|
|
375
|
-
let
|
|
376
|
-
if ($[
|
|
377
|
-
|
|
378
|
-
$[
|
|
379
|
-
$[
|
|
380
|
-
$[
|
|
480
|
+
let t10;
|
|
481
|
+
if ($[37] !== t92 || $[38] !== total) {
|
|
482
|
+
t10 = /* @__PURE__ */ jsx("tr", { className: "border-b border-divider", children: /* @__PURE__ */ jsx("td", { className: "px-2 py-10 w-full", colSpan: total, children: t92 }) });
|
|
483
|
+
$[37] = t92;
|
|
484
|
+
$[38] = total;
|
|
485
|
+
$[39] = t10;
|
|
381
486
|
} else {
|
|
382
|
-
|
|
487
|
+
t10 = $[39];
|
|
383
488
|
}
|
|
384
|
-
fallbackContent =
|
|
489
|
+
fallbackContent = t10;
|
|
385
490
|
}
|
|
386
491
|
}
|
|
387
|
-
let
|
|
388
|
-
if ($[
|
|
389
|
-
|
|
492
|
+
let t9;
|
|
493
|
+
if ($[40] !== domProps || $[41] !== fallbackContent || $[42] !== mergedClass || $[43] !== renderedRows) {
|
|
494
|
+
t9 = /* @__PURE__ */ jsxs("tbody", { className: mergedClass, ...domProps, children: [
|
|
390
495
|
renderedRows,
|
|
391
496
|
fallbackContent
|
|
392
497
|
] });
|
|
393
|
-
$[
|
|
394
|
-
$[
|
|
395
|
-
$[
|
|
396
|
-
$[
|
|
397
|
-
$[
|
|
498
|
+
$[40] = domProps;
|
|
499
|
+
$[41] = fallbackContent;
|
|
500
|
+
$[42] = mergedClass;
|
|
501
|
+
$[43] = renderedRows;
|
|
502
|
+
$[44] = t9;
|
|
398
503
|
} else {
|
|
399
|
-
|
|
504
|
+
t9 = $[44];
|
|
400
505
|
}
|
|
401
|
-
return
|
|
506
|
+
return t9;
|
|
402
507
|
}
|
|
403
508
|
const TableBody = memo((props) => {
|
|
404
509
|
const $ = c(2);
|
|
@@ -932,7 +1037,10 @@ const TableHOC = ({
|
|
|
932
1037
|
selectKeys = [],
|
|
933
1038
|
isActions = true,
|
|
934
1039
|
widthAction = 100,
|
|
935
|
-
dataHeader
|
|
1040
|
+
dataHeader,
|
|
1041
|
+
sortDescriptors,
|
|
1042
|
+
onSortChange,
|
|
1043
|
+
...otherProps
|
|
936
1044
|
} = props;
|
|
937
1045
|
const tableClass = useMemo(() => twMerge("table-main-container w-full border-collapse table-auto", className), [className]);
|
|
938
1046
|
const containerClass = useMemo(() => twMerge("max-w-full overflow-x-auto overflow-y-auto bg-content1", classNameContainer), [classNameContainer]);
|
|
@@ -943,9 +1051,12 @@ const TableHOC = ({
|
|
|
943
1051
|
selectKeys,
|
|
944
1052
|
isActions,
|
|
945
1053
|
widthAction,
|
|
946
|
-
totalColumn: dataHeader?.length || 0
|
|
1054
|
+
totalColumn: dataHeader?.length || 0,
|
|
1055
|
+
sortDescriptors,
|
|
1056
|
+
onSortChange
|
|
947
1057
|
}, children: /* @__PURE__ */ jsx("div", { className: containerClass, children: /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(LazyMotion, { features: () => import("framer-motion").then((res) => res.domAnimation), children: /* @__PURE__ */ jsx("table", { className: tableClass, children: React__default.Children.map(children, (child) => isValidElement(child) ? React__default.cloneElement(child, {
|
|
948
|
-
|
|
1058
|
+
dataHeader,
|
|
1059
|
+
...otherProps
|
|
949
1060
|
}) : child) }) }) }) }) });
|
|
950
1061
|
};
|
|
951
1062
|
const Table = Object.assign(TableHOC, {
|
|
@@ -959,45 +1070,56 @@ const Table = Object.assign(TableHOC, {
|
|
|
959
1070
|
BodyColumn: TableBodyColumn
|
|
960
1071
|
});
|
|
961
1072
|
const useTable = (t0) => {
|
|
962
|
-
const $ = c(
|
|
1073
|
+
const $ = c(19);
|
|
963
1074
|
const {
|
|
964
1075
|
initialDisabledKeys: t1,
|
|
965
1076
|
initialSelectKey: t2,
|
|
966
|
-
initialValueSearch: t3
|
|
1077
|
+
initialValueSearch: t3,
|
|
1078
|
+
initialSortDescriptors: t4
|
|
967
1079
|
} = t0;
|
|
968
|
-
let
|
|
1080
|
+
let t5;
|
|
969
1081
|
if ($[0] !== t1) {
|
|
970
|
-
|
|
1082
|
+
t5 = t1 === void 0 ? [] : t1;
|
|
971
1083
|
$[0] = t1;
|
|
972
|
-
$[1] =
|
|
1084
|
+
$[1] = t5;
|
|
973
1085
|
} else {
|
|
974
|
-
|
|
1086
|
+
t5 = $[1];
|
|
975
1087
|
}
|
|
976
|
-
const initialDisabledKeys =
|
|
977
|
-
let
|
|
1088
|
+
const initialDisabledKeys = t5;
|
|
1089
|
+
let t6;
|
|
978
1090
|
if ($[2] !== t2) {
|
|
979
|
-
|
|
1091
|
+
t6 = t2 === void 0 ? [] : t2;
|
|
980
1092
|
$[2] = t2;
|
|
981
|
-
$[3] =
|
|
1093
|
+
$[3] = t6;
|
|
982
1094
|
} else {
|
|
983
|
-
|
|
1095
|
+
t6 = $[3];
|
|
984
1096
|
}
|
|
985
|
-
const initialSelectKey =
|
|
986
|
-
let
|
|
1097
|
+
const initialSelectKey = t6;
|
|
1098
|
+
let t7;
|
|
987
1099
|
if ($[4] !== t3) {
|
|
988
|
-
|
|
1100
|
+
t7 = t3 === void 0 ? {} : t3;
|
|
989
1101
|
$[4] = t3;
|
|
990
|
-
$[5] =
|
|
1102
|
+
$[5] = t7;
|
|
991
1103
|
} else {
|
|
992
|
-
|
|
1104
|
+
t7 = $[5];
|
|
1105
|
+
}
|
|
1106
|
+
const initialValueSearch = t7;
|
|
1107
|
+
let t8;
|
|
1108
|
+
if ($[6] !== t4) {
|
|
1109
|
+
t8 = t4 === void 0 ? [] : t4;
|
|
1110
|
+
$[6] = t4;
|
|
1111
|
+
$[7] = t8;
|
|
1112
|
+
} else {
|
|
1113
|
+
t8 = $[7];
|
|
993
1114
|
}
|
|
994
|
-
const
|
|
1115
|
+
const initialSortDescriptors = t8;
|
|
995
1116
|
const [selectKeys, setSelectKeys] = useState(initialSelectKey);
|
|
996
1117
|
const [disabledKeys, setDisabledKeys] = useState(initialDisabledKeys);
|
|
997
1118
|
const [valueSearch, setValueSearch] = useState(initialValueSearch);
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1119
|
+
const [sortDescriptors, setSortDescriptors] = useState(initialSortDescriptors);
|
|
1120
|
+
let t9;
|
|
1121
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1122
|
+
t9 = (value) => {
|
|
1001
1123
|
setSelectKeys((prev) => {
|
|
1002
1124
|
const exists = prev.some((el) => el.id === value.id);
|
|
1003
1125
|
if (exists) {
|
|
@@ -1006,44 +1128,44 @@ const useTable = (t0) => {
|
|
|
1006
1128
|
return [...prev, value];
|
|
1007
1129
|
});
|
|
1008
1130
|
};
|
|
1009
|
-
$[
|
|
1131
|
+
$[8] = t9;
|
|
1010
1132
|
} else {
|
|
1011
|
-
|
|
1133
|
+
t9 = $[8];
|
|
1012
1134
|
}
|
|
1013
|
-
const handleSelectKey =
|
|
1014
|
-
let
|
|
1015
|
-
if ($[
|
|
1016
|
-
|
|
1135
|
+
const handleSelectKey = t9;
|
|
1136
|
+
let t10;
|
|
1137
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1138
|
+
t10 = (value_0) => {
|
|
1017
1139
|
setSelectKeys(value_0);
|
|
1018
1140
|
};
|
|
1019
|
-
$[
|
|
1141
|
+
$[9] = t10;
|
|
1020
1142
|
} else {
|
|
1021
|
-
|
|
1143
|
+
t10 = $[9];
|
|
1022
1144
|
}
|
|
1023
|
-
const handleSelectKeys =
|
|
1024
|
-
let
|
|
1025
|
-
if ($[
|
|
1026
|
-
|
|
1145
|
+
const handleSelectKeys = t10;
|
|
1146
|
+
let t11;
|
|
1147
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1148
|
+
t11 = (value_1) => {
|
|
1027
1149
|
setDisabledKeys(value_1);
|
|
1028
1150
|
};
|
|
1029
|
-
$[
|
|
1151
|
+
$[10] = t11;
|
|
1030
1152
|
} else {
|
|
1031
|
-
|
|
1153
|
+
t11 = $[10];
|
|
1032
1154
|
}
|
|
1033
|
-
const handleDisabledKeys =
|
|
1034
|
-
let
|
|
1035
|
-
if ($[
|
|
1036
|
-
|
|
1155
|
+
const handleDisabledKeys = t11;
|
|
1156
|
+
let t12;
|
|
1157
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1158
|
+
t12 = () => {
|
|
1037
1159
|
setSelectKeys([]);
|
|
1038
1160
|
};
|
|
1039
|
-
$[
|
|
1161
|
+
$[11] = t12;
|
|
1040
1162
|
} else {
|
|
1041
|
-
|
|
1163
|
+
t12 = $[11];
|
|
1042
1164
|
}
|
|
1043
|
-
const handleResetSelectKeys =
|
|
1044
|
-
let
|
|
1045
|
-
if ($[
|
|
1046
|
-
|
|
1165
|
+
const handleResetSelectKeys = t12;
|
|
1166
|
+
let t13;
|
|
1167
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1168
|
+
t13 = (key, value_2) => {
|
|
1047
1169
|
setValueSearch((prev_0) => {
|
|
1048
1170
|
if (prev_0[key] === value_2) {
|
|
1049
1171
|
return prev_0;
|
|
@@ -1059,31 +1181,63 @@ const useTable = (t0) => {
|
|
|
1059
1181
|
return newState;
|
|
1060
1182
|
});
|
|
1061
1183
|
};
|
|
1062
|
-
$[
|
|
1184
|
+
$[12] = t13;
|
|
1063
1185
|
} else {
|
|
1064
|
-
|
|
1186
|
+
t13 = $[12];
|
|
1065
1187
|
}
|
|
1066
|
-
const handleSetValueSearch =
|
|
1067
|
-
let
|
|
1068
|
-
if ($[
|
|
1069
|
-
|
|
1188
|
+
const handleSetValueSearch = t13;
|
|
1189
|
+
let t14;
|
|
1190
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1191
|
+
t14 = (column) => {
|
|
1192
|
+
setSortDescriptors((prev_1) => {
|
|
1193
|
+
const existingIndex = prev_1.findIndex((s) => s.column === column);
|
|
1194
|
+
if (existingIndex !== -1) {
|
|
1195
|
+
const existing = prev_1[existingIndex];
|
|
1196
|
+
if (existing.direction === "asc") {
|
|
1197
|
+
const newSorts = [...prev_1];
|
|
1198
|
+
newSorts[existingIndex] = {
|
|
1199
|
+
...existing,
|
|
1200
|
+
direction: "desc"
|
|
1201
|
+
};
|
|
1202
|
+
return newSorts;
|
|
1203
|
+
} else {
|
|
1204
|
+
return prev_1.filter((s_0) => s_0.column !== column);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
return [...prev_1, {
|
|
1208
|
+
column,
|
|
1209
|
+
direction: "asc"
|
|
1210
|
+
}];
|
|
1211
|
+
});
|
|
1212
|
+
};
|
|
1213
|
+
$[13] = t14;
|
|
1214
|
+
} else {
|
|
1215
|
+
t14 = $[13];
|
|
1216
|
+
}
|
|
1217
|
+
const handleSort = t14;
|
|
1218
|
+
let t15;
|
|
1219
|
+
if ($[14] !== disabledKeys || $[15] !== selectKeys || $[16] !== sortDescriptors || $[17] !== valueSearch) {
|
|
1220
|
+
t15 = {
|
|
1070
1221
|
selectKeys,
|
|
1071
1222
|
disabledKeys,
|
|
1072
1223
|
valueSearch,
|
|
1224
|
+
sortDescriptors,
|
|
1073
1225
|
handleSelectKeys,
|
|
1074
1226
|
handleSelectKey,
|
|
1075
1227
|
handleDisabledKeys,
|
|
1076
1228
|
handleSetValueSearch,
|
|
1077
|
-
handleResetSelectKeys
|
|
1229
|
+
handleResetSelectKeys,
|
|
1230
|
+
handleSort
|
|
1078
1231
|
};
|
|
1079
|
-
$[
|
|
1080
|
-
$[
|
|
1081
|
-
$[
|
|
1082
|
-
$[
|
|
1232
|
+
$[14] = disabledKeys;
|
|
1233
|
+
$[15] = selectKeys;
|
|
1234
|
+
$[16] = sortDescriptors;
|
|
1235
|
+
$[17] = valueSearch;
|
|
1236
|
+
$[18] = t15;
|
|
1083
1237
|
} else {
|
|
1084
|
-
|
|
1238
|
+
t15 = $[18];
|
|
1085
1239
|
}
|
|
1086
|
-
return
|
|
1240
|
+
return t15;
|
|
1087
1241
|
};
|
|
1088
1242
|
export {
|
|
1089
1243
|
Table,
|