lizaui 9.0.56 → 9.0.57

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.
@@ -1,13 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
- import React__default, { isValidElement, createContext, useContext, memo, forwardRef, useId, useMemo, useState } from "react";
3
+ import React__default, { isValidElement, createContext, useContext, useState, useRef, useEffect, memo, forwardRef, useId, useMemo } from "react";
4
4
  import { twMerge } from "tailwind-merge";
5
5
  import { T as Tooltip } from "../chunks/tooltip-BVafMD5T.js";
6
+ import clsx from "clsx";
6
7
  import { C as ChevronUp } from "../chunks/chevron-up-BBd-SipB.js";
7
8
  import { C as ChevronDown } from "../chunks/chevron-down-D-14pIT_.js";
8
9
  import { c as createLucideIcon } from "../chunks/createLucideIcon-C5oU6LEj.js";
9
10
  import { L as LoaderCircle } from "../chunks/loader-circle-CeKbzHTN.js";
10
- import clsx from "clsx";
11
11
  import { C as Checkbox } from "../chunks/checkbox-upIIzsyW.js";
12
12
  import { AnimatePresence, LazyMotion } from "framer-motion";
13
13
  const __iconNode = [
@@ -86,14 +86,221 @@ const initialValues = {
86
86
  totalColumn: 0,
87
87
  sortDescriptors: [],
88
88
  onSortChange: () => {
89
+ },
90
+ columnWidths: {},
91
+ onColumnResize: () => {
92
+ },
93
+ onColumnResizeEnd: () => {
89
94
  }
90
95
  };
91
96
  const TableContext = createContext(initialValues);
92
97
  const useTableContext = () => {
93
98
  return useContext(TableContext);
94
99
  };
100
+ function useColumnResize(t0) {
101
+ const $ = c(28);
102
+ const {
103
+ columnId,
104
+ initialWidth: t1,
105
+ minWidth: t2,
106
+ maxWidth: t3,
107
+ onResize,
108
+ onResizeEnd
109
+ } = t0;
110
+ const initialWidth = t1 === void 0 ? 150 : t1;
111
+ const minWidth = t2 === void 0 ? 80 : t2;
112
+ const maxWidth = t3 === void 0 ? 800 : t3;
113
+ const [width, setWidth] = useState(initialWidth);
114
+ const [isResizing, setIsResizing] = useState(false);
115
+ const startXRef = useRef(0);
116
+ const startWidthRef = useRef(0);
117
+ const columnRef = useRef(null);
118
+ let t4;
119
+ if ($[0] !== initialWidth || $[1] !== width) {
120
+ t4 = () => {
121
+ if (initialWidth !== width) {
122
+ setWidth(initialWidth);
123
+ }
124
+ };
125
+ $[0] = initialWidth;
126
+ $[1] = width;
127
+ $[2] = t4;
128
+ } else {
129
+ t4 = $[2];
130
+ }
131
+ let t5;
132
+ if ($[3] !== initialWidth) {
133
+ t5 = [initialWidth];
134
+ $[3] = initialWidth;
135
+ $[4] = t5;
136
+ } else {
137
+ t5 = $[4];
138
+ }
139
+ useEffect(t4, t5);
140
+ let t6;
141
+ if ($[5] !== width) {
142
+ t6 = (e) => {
143
+ e.preventDefault();
144
+ e.stopPropagation();
145
+ const target = e.currentTarget;
146
+ target.setPointerCapture(e.pointerId);
147
+ startXRef.current = e.clientX;
148
+ startWidthRef.current = width;
149
+ setIsResizing(true);
150
+ document.body.style.userSelect = "none";
151
+ document.body.style.cursor = "col-resize";
152
+ };
153
+ $[5] = width;
154
+ $[6] = t6;
155
+ } else {
156
+ t6 = $[6];
157
+ }
158
+ const handlePointerDown = t6;
159
+ let t7;
160
+ if ($[7] !== columnId || $[8] !== isResizing || $[9] !== maxWidth || $[10] !== minWidth || $[11] !== onResize) {
161
+ t7 = (e_0) => {
162
+ if (!isResizing) {
163
+ return;
164
+ }
165
+ const delta = e_0.clientX - startXRef.current;
166
+ const newWidth = Math.max(minWidth, Math.min(maxWidth, startWidthRef.current + delta));
167
+ setWidth(newWidth);
168
+ onResize?.(columnId, newWidth);
169
+ };
170
+ $[7] = columnId;
171
+ $[8] = isResizing;
172
+ $[9] = maxWidth;
173
+ $[10] = minWidth;
174
+ $[11] = onResize;
175
+ $[12] = t7;
176
+ } else {
177
+ t7 = $[12];
178
+ }
179
+ const handlePointerMove = t7;
180
+ let t8;
181
+ if ($[13] !== columnId || $[14] !== isResizing || $[15] !== maxWidth || $[16] !== minWidth || $[17] !== onResizeEnd) {
182
+ t8 = (e_1) => {
183
+ if (!isResizing) {
184
+ return;
185
+ }
186
+ setIsResizing(false);
187
+ document.body.style.userSelect = "";
188
+ document.body.style.cursor = "";
189
+ const delta_0 = e_1.clientX - startXRef.current;
190
+ const finalWidth = Math.max(minWidth, Math.min(maxWidth, startWidthRef.current + delta_0));
191
+ onResizeEnd?.(columnId, finalWidth);
192
+ };
193
+ $[13] = columnId;
194
+ $[14] = isResizing;
195
+ $[15] = maxWidth;
196
+ $[16] = minWidth;
197
+ $[17] = onResizeEnd;
198
+ $[18] = t8;
199
+ } else {
200
+ t8 = $[18];
201
+ }
202
+ const handlePointerUp = t8;
203
+ let t10;
204
+ let t9;
205
+ if ($[19] !== handlePointerMove || $[20] !== handlePointerUp || $[21] !== isResizing) {
206
+ t9 = () => {
207
+ if (isResizing) {
208
+ document.addEventListener("pointermove", handlePointerMove);
209
+ document.addEventListener("pointerup", handlePointerUp);
210
+ return () => {
211
+ document.removeEventListener("pointermove", handlePointerMove);
212
+ document.removeEventListener("pointerup", handlePointerUp);
213
+ };
214
+ }
215
+ };
216
+ t10 = [isResizing, handlePointerMove, handlePointerUp];
217
+ $[19] = handlePointerMove;
218
+ $[20] = handlePointerUp;
219
+ $[21] = isResizing;
220
+ $[22] = t10;
221
+ $[23] = t9;
222
+ } else {
223
+ t10 = $[22];
224
+ t9 = $[23];
225
+ }
226
+ useEffect(t9, t10);
227
+ let t11;
228
+ if ($[24] !== handlePointerDown || $[25] !== isResizing || $[26] !== width) {
229
+ t11 = {
230
+ width,
231
+ isResizing,
232
+ columnRef,
233
+ handlePointerDown,
234
+ setWidth
235
+ };
236
+ $[24] = handlePointerDown;
237
+ $[25] = isResizing;
238
+ $[26] = width;
239
+ $[27] = t11;
240
+ } else {
241
+ t11 = $[27];
242
+ }
243
+ return t11;
244
+ }
245
+ const ResizeHandle = memo((t0) => {
246
+ const $ = c(12);
247
+ const {
248
+ onPointerDown,
249
+ isResizing,
250
+ className
251
+ } = t0;
252
+ const t1 = isResizing && "bg-primary";
253
+ let t2;
254
+ if ($[0] !== className || $[1] !== t1) {
255
+ t2 = clsx("absolute top-0 right-0 h-full w-1 cursor-col-resize select-none touch-none group/resize z-10", "hover:bg-primary/50 active:bg-primary transition-colors", t1, className);
256
+ $[0] = className;
257
+ $[1] = t1;
258
+ $[2] = t2;
259
+ } else {
260
+ t2 = $[2];
261
+ }
262
+ let t3;
263
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
264
+ t3 = /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 -left-2 -right-2" });
265
+ $[3] = t3;
266
+ } else {
267
+ t3 = $[3];
268
+ }
269
+ const t4 = isResizing && "opacity-100";
270
+ let t5;
271
+ if ($[4] !== t4) {
272
+ t5 = clsx("absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2", "w-1 h-8 rounded-full bg-primary opacity-0 group-hover/resize:opacity-100 transition-opacity", t4);
273
+ $[4] = t4;
274
+ $[5] = t5;
275
+ } else {
276
+ t5 = $[5];
277
+ }
278
+ let t6;
279
+ if ($[6] !== t5) {
280
+ t6 = /* @__PURE__ */ jsx("div", { className: t5 });
281
+ $[6] = t5;
282
+ $[7] = t6;
283
+ } else {
284
+ t6 = $[7];
285
+ }
286
+ let t7;
287
+ if ($[8] !== onPointerDown || $[9] !== t2 || $[10] !== t6) {
288
+ t7 = /* @__PURE__ */ jsxs("div", { className: t2, onPointerDown, role: "separator", "aria-orientation": "vertical", "aria-label": "Resize column", children: [
289
+ t3,
290
+ t6
291
+ ] });
292
+ $[8] = onPointerDown;
293
+ $[9] = t2;
294
+ $[10] = t6;
295
+ $[11] = t7;
296
+ } else {
297
+ t7 = $[11];
298
+ }
299
+ return t7;
300
+ });
301
+ ResizeHandle.displayName = "ResizeHandle";
95
302
  const TableHeaderColumn = React__default.memo((t0) => {
96
- const $ = c(41);
303
+ const $ = c(61);
97
304
  const {
98
305
  children,
99
306
  className,
@@ -102,7 +309,12 @@ const TableHeaderColumn = React__default.memo((t0) => {
102
309
  text: t3,
103
310
  size,
104
311
  header,
105
- colspan: t4
312
+ colspan: t4,
313
+ resizable: resizableProp,
314
+ minWidth: minWidthProp,
315
+ maxWidth: maxWidthProp,
316
+ onResize: onResizeProp,
317
+ onResizeEnd: onResizeEndProp
106
318
  } = t0;
107
319
  let t5;
108
320
  if ($[0] !== t1) {
@@ -118,90 +330,149 @@ const TableHeaderColumn = React__default.memo((t0) => {
118
330
  const colspan = t4 === void 0 ? void 0 : t4;
119
331
  const {
120
332
  sortDescriptors,
121
- onSortChange
333
+ onSortChange,
334
+ columnWidths,
335
+ onColumnResize,
336
+ onColumnResizeEnd
122
337
  } = useTableContext();
338
+ const isResizable = resizableProp ?? header?.resizable ?? false;
339
+ const columnId = header?.id || "";
340
+ const initialWidth = columnWidths?.[columnId] || size || header?.size || 150;
341
+ const minWidth = minWidthProp ?? header?.minWidth ?? 80;
342
+ const maxWidth = maxWidthProp ?? header?.maxWidth ?? 800;
123
343
  let t6;
124
- if ($[2] !== className) {
125
- t6 = twMerge("px-2 border-b border-divider", className);
126
- $[2] = className;
127
- $[3] = t6;
344
+ if ($[2] !== onColumnResize || $[3] !== onResizeProp) {
345
+ t6 = (id, width) => {
346
+ onResizeProp?.(width);
347
+ onColumnResize?.(id, width);
348
+ };
349
+ $[2] = onColumnResize;
350
+ $[3] = onResizeProp;
351
+ $[4] = t6;
352
+ } else {
353
+ t6 = $[4];
354
+ }
355
+ let t7;
356
+ if ($[5] !== onColumnResizeEnd || $[6] !== onResizeEndProp) {
357
+ t7 = (id_0, width_0) => {
358
+ onResizeEndProp?.(width_0);
359
+ onColumnResizeEnd?.(id_0, width_0);
360
+ };
361
+ $[5] = onColumnResizeEnd;
362
+ $[6] = onResizeEndProp;
363
+ $[7] = t7;
364
+ } else {
365
+ t7 = $[7];
366
+ }
367
+ let t8;
368
+ if ($[8] !== columnId || $[9] !== initialWidth || $[10] !== maxWidth || $[11] !== minWidth || $[12] !== t6 || $[13] !== t7) {
369
+ t8 = {
370
+ columnId,
371
+ initialWidth,
372
+ minWidth,
373
+ maxWidth,
374
+ onResize: t6,
375
+ onResizeEnd: t7
376
+ };
377
+ $[8] = columnId;
378
+ $[9] = initialWidth;
379
+ $[10] = maxWidth;
380
+ $[11] = minWidth;
381
+ $[12] = t6;
382
+ $[13] = t7;
383
+ $[14] = t8;
128
384
  } else {
129
- t6 = $[3];
385
+ t8 = $[14];
130
386
  }
131
- const mergedClass = t6;
132
- const t7 = size ? `${size}px` : style.width;
133
- const t8 = size ? `${size}px` : style.minWidth;
387
+ const {
388
+ width: resizedWidth,
389
+ isResizing,
390
+ columnRef,
391
+ handlePointerDown
392
+ } = useColumnResize(t8);
134
393
  let t9;
135
- if ($[4] !== style || $[5] !== t7 || $[6] !== t8) {
136
- t9 = {
394
+ if ($[15] !== className) {
395
+ t9 = twMerge("px-2 border-b border-divider relative", className);
396
+ $[15] = className;
397
+ $[16] = t9;
398
+ } else {
399
+ t9 = $[16];
400
+ }
401
+ const mergedClass = t9;
402
+ const effectiveWidth = isResizable ? resizedWidth : size || header?.size;
403
+ const t10 = effectiveWidth ? `${effectiveWidth}px` : style.width;
404
+ const t11 = effectiveWidth ? `${effectiveWidth}px` : style.minWidth;
405
+ let t12;
406
+ if ($[17] !== style || $[18] !== t10 || $[19] !== t11) {
407
+ t12 = {
137
408
  ...style,
138
- width: t7,
139
- minWidth: t8
409
+ width: t10,
410
+ minWidth: t11
140
411
  };
141
- $[4] = style;
142
- $[5] = t7;
143
- $[6] = t8;
144
- $[7] = t9;
412
+ $[17] = style;
413
+ $[18] = t10;
414
+ $[19] = t11;
415
+ $[20] = t12;
145
416
  } else {
146
- t9 = $[7];
417
+ t12 = $[20];
147
418
  }
148
- const mergedStyle = t9;
149
- let t10;
150
- if ($[8] !== children) {
151
- t10 = !children || typeof children === "string" && children.trim() === "";
152
- $[8] = children;
153
- $[9] = t10;
419
+ const mergedStyle = t12;
420
+ let t13;
421
+ if ($[21] !== children) {
422
+ t13 = !children || typeof children === "string" && children.trim() === "";
423
+ $[21] = children;
424
+ $[22] = t13;
154
425
  } else {
155
- t10 = $[9];
426
+ t13 = $[22];
156
427
  }
157
- const isChildrenEmpty = t10;
428
+ const isChildrenEmpty = t13;
158
429
  const isSortable = header?.sort;
159
430
  header?.id;
160
- let 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;
431
+ let t14;
432
+ if ($[23] !== header?.id || $[24] !== sortDescriptors) {
433
+ t14 = sortDescriptors?.find((d) => d.column === header?.id);
434
+ $[23] = header?.id;
435
+ $[24] = sortDescriptors;
436
+ $[25] = t14;
166
437
  } else {
167
- t11 = $[12];
438
+ t14 = $[25];
168
439
  }
169
- const currentSort = t11;
170
- let t12;
171
- if ($[13] !== currentSort || $[14] !== header?.id || $[15] !== sortDescriptors) {
172
- t12 = () => {
440
+ const currentSort = t14;
441
+ let t15;
442
+ if ($[26] !== currentSort || $[27] !== header?.id || $[28] !== sortDescriptors) {
443
+ t15 = () => {
173
444
  if (!sortDescriptors || sortDescriptors.length <= 1 || !currentSort) {
174
445
  return null;
175
446
  }
176
447
  return sortDescriptors.findIndex((d_0) => d_0.column === header?.id) + 1;
177
448
  };
178
- $[13] = currentSort;
179
- $[14] = header?.id;
180
- $[15] = sortDescriptors;
181
- $[16] = t12;
449
+ $[26] = currentSort;
450
+ $[27] = header?.id;
451
+ $[28] = sortDescriptors;
452
+ $[29] = t15;
182
453
  } else {
183
- t12 = $[16];
454
+ t15 = $[29];
184
455
  }
185
456
  header?.id;
186
- const sortOrderIndex = t12();
187
- let t13;
188
- if ($[17] !== header || $[18] !== isSortable || $[19] !== onSortChange) {
189
- t13 = () => {
457
+ const sortOrderIndex = t15();
458
+ let t16;
459
+ if ($[30] !== header || $[31] !== isSortable || $[32] !== onSortChange) {
460
+ t16 = () => {
190
461
  if (isSortable && onSortChange && header?.id) {
191
462
  onSortChange(header.id);
192
463
  }
193
464
  };
194
- $[17] = header;
195
- $[18] = isSortable;
196
- $[19] = onSortChange;
197
- $[20] = t13;
465
+ $[30] = header;
466
+ $[31] = isSortable;
467
+ $[32] = onSortChange;
468
+ $[33] = t16;
198
469
  } else {
199
- t13 = $[20];
470
+ t16 = $[33];
200
471
  }
201
- const handleSort = t13;
202
- let t14;
203
- if ($[21] !== currentSort || $[22] !== icon || $[23] !== isSortable || $[24] !== sortOrderIndex) {
204
- t14 = () => {
472
+ const handleSort = t16;
473
+ let t17;
474
+ if ($[34] !== currentSort || $[35] !== icon || $[36] !== isSortable || $[37] !== sortOrderIndex) {
475
+ t17 = () => {
205
476
  if (!isSortable) {
206
477
  return icon;
207
478
  }
@@ -213,28 +484,31 @@ const TableHeaderColumn = React__default.memo((t0) => {
213
484
  }
214
485
  return /* @__PURE__ */ jsx(ChevronsUpDown, { className: "h-4 w-4 text-default-300" });
215
486
  };
216
- $[21] = currentSort;
217
- $[22] = icon;
218
- $[23] = isSortable;
219
- $[24] = sortOrderIndex;
220
- $[25] = t14;
487
+ $[34] = currentSort;
488
+ $[35] = icon;
489
+ $[36] = isSortable;
490
+ $[37] = sortOrderIndex;
491
+ $[38] = t17;
221
492
  } 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;
493
+ t17 = $[38];
494
+ }
495
+ const renderSortIcon = t17;
496
+ const t18 = isResizable ? columnRef : void 0;
497
+ const t19 = isSortable ? "cursor-pointer hover:bg-default-100 transition-colors" : "";
498
+ const t20 = isResizing && "select-none";
499
+ let t21;
500
+ if ($[39] !== mergedClass || $[40] !== t19 || $[41] !== t20) {
501
+ t21 = twMerge(mergedClass, t19, t20);
502
+ $[39] = mergedClass;
503
+ $[40] = t19;
504
+ $[41] = t20;
505
+ $[42] = t21;
232
506
  } else {
233
- t16 = $[28];
507
+ t21 = $[42];
234
508
  }
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: [
509
+ let t22;
510
+ if ($[43] !== children || $[44] !== header?.information || $[45] !== isChildrenEmpty || $[46] !== renderSortIcon || $[47] !== text) {
511
+ t22 = isChildrenEmpty ? /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center gap-x-2 font-medium", children: [
238
512
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
239
513
  /* @__PURE__ */ jsx("p", { className: "line-clamp-1 text-xs text-foreground-500 dark:text-foreground-500 text-left", children: text }),
240
514
  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: [
@@ -245,28 +519,43 @@ const TableHeaderColumn = React__default.memo((t0) => {
245
519
  ] }),
246
520
  /* @__PURE__ */ jsx("div", { className: "flex-1 flex justify-end", children: renderSortIcon() })
247
521
  ] }) : children;
248
- $[29] = children;
249
- $[30] = header?.information;
250
- $[31] = isChildrenEmpty;
251
- $[32] = renderSortIcon;
252
- $[33] = text;
253
- $[34] = t17;
522
+ $[43] = children;
523
+ $[44] = header?.information;
524
+ $[45] = isChildrenEmpty;
525
+ $[46] = renderSortIcon;
526
+ $[47] = text;
527
+ $[48] = t22;
528
+ } else {
529
+ t22 = $[48];
530
+ }
531
+ let t23;
532
+ if ($[49] !== handlePointerDown || $[50] !== isResizable || $[51] !== isResizing) {
533
+ t23 = isResizable && /* @__PURE__ */ jsx(ResizeHandle, { onPointerDown: handlePointerDown, isResizing });
534
+ $[49] = handlePointerDown;
535
+ $[50] = isResizable;
536
+ $[51] = isResizing;
537
+ $[52] = t23;
254
538
  } else {
255
- t17 = $[34];
539
+ t23 = $[52];
256
540
  }
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;
266
- } else {
267
- t18 = $[40];
268
- }
269
- return t18;
541
+ let t24;
542
+ if ($[53] !== colspan || $[54] !== handleSort || $[55] !== mergedStyle || $[56] !== t18 || $[57] !== t21 || $[58] !== t22 || $[59] !== t23) {
543
+ t24 = /* @__PURE__ */ jsxs("th", { ref: t18, className: t21, style: mergedStyle, colSpan: colspan, onClick: handleSort, children: [
544
+ t22,
545
+ t23
546
+ ] });
547
+ $[53] = colspan;
548
+ $[54] = handleSort;
549
+ $[55] = mergedStyle;
550
+ $[56] = t18;
551
+ $[57] = t21;
552
+ $[58] = t22;
553
+ $[59] = t23;
554
+ $[60] = t24;
555
+ } else {
556
+ t24 = $[60];
557
+ }
558
+ return t24;
270
559
  });
271
560
  TableHeaderColumn.displayName = "TableHeaderColumn";
272
561
  const TableEmptyState = memo((t0) => {
@@ -1040,6 +1329,9 @@ const TableHOC = ({
1040
1329
  dataHeader,
1041
1330
  sortDescriptors,
1042
1331
  onSortChange,
1332
+ columnWidths = {},
1333
+ onColumnResize,
1334
+ onColumnResizeEnd,
1043
1335
  ...otherProps
1044
1336
  } = props;
1045
1337
  const tableClass = useMemo(() => twMerge("table-main-container w-full border-collapse table-auto", className), [className]);
@@ -1053,7 +1345,10 @@ const TableHOC = ({
1053
1345
  widthAction,
1054
1346
  totalColumn: dataHeader?.length || 0,
1055
1347
  sortDescriptors,
1056
- onSortChange
1348
+ onSortChange,
1349
+ columnWidths,
1350
+ onColumnResize,
1351
+ onColumnResizeEnd
1057
1352
  }, 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, {
1058
1353
  dataHeader,
1059
1354
  ...otherProps
@@ -1070,56 +1365,67 @@ const Table = Object.assign(TableHOC, {
1070
1365
  BodyColumn: TableBodyColumn
1071
1366
  });
1072
1367
  const useTable = (t0) => {
1073
- const $ = c(19);
1368
+ const $ = c(24);
1074
1369
  const {
1075
1370
  initialDisabledKeys: t1,
1076
1371
  initialSelectKey: t2,
1077
1372
  initialValueSearch: t3,
1078
- initialSortDescriptors: t4
1373
+ initialSortDescriptors: t4,
1374
+ initialColumnWidths: t5
1079
1375
  } = t0;
1080
- let t5;
1376
+ let t6;
1081
1377
  if ($[0] !== t1) {
1082
- t5 = t1 === void 0 ? [] : t1;
1378
+ t6 = t1 === void 0 ? [] : t1;
1083
1379
  $[0] = t1;
1084
- $[1] = t5;
1380
+ $[1] = t6;
1085
1381
  } else {
1086
- t5 = $[1];
1382
+ t6 = $[1];
1087
1383
  }
1088
- const initialDisabledKeys = t5;
1089
- let t6;
1384
+ const initialDisabledKeys = t6;
1385
+ let t7;
1090
1386
  if ($[2] !== t2) {
1091
- t6 = t2 === void 0 ? [] : t2;
1387
+ t7 = t2 === void 0 ? [] : t2;
1092
1388
  $[2] = t2;
1093
- $[3] = t6;
1389
+ $[3] = t7;
1094
1390
  } else {
1095
- t6 = $[3];
1391
+ t7 = $[3];
1096
1392
  }
1097
- const initialSelectKey = t6;
1098
- let t7;
1393
+ const initialSelectKey = t7;
1394
+ let t8;
1099
1395
  if ($[4] !== t3) {
1100
- t7 = t3 === void 0 ? {} : t3;
1396
+ t8 = t3 === void 0 ? {} : t3;
1101
1397
  $[4] = t3;
1102
- $[5] = t7;
1398
+ $[5] = t8;
1103
1399
  } else {
1104
- t7 = $[5];
1400
+ t8 = $[5];
1105
1401
  }
1106
- const initialValueSearch = t7;
1107
- let t8;
1402
+ const initialValueSearch = t8;
1403
+ let t9;
1108
1404
  if ($[6] !== t4) {
1109
- t8 = t4 === void 0 ? [] : t4;
1405
+ t9 = t4 === void 0 ? [] : t4;
1110
1406
  $[6] = t4;
1111
- $[7] = t8;
1407
+ $[7] = t9;
1112
1408
  } else {
1113
- t8 = $[7];
1409
+ t9 = $[7];
1114
1410
  }
1115
- const initialSortDescriptors = t8;
1411
+ const initialSortDescriptors = t9;
1412
+ let t10;
1413
+ if ($[8] !== t5) {
1414
+ t10 = t5 === void 0 ? {} : t5;
1415
+ $[8] = t5;
1416
+ $[9] = t10;
1417
+ } else {
1418
+ t10 = $[9];
1419
+ }
1420
+ const initialColumnWidths = t10;
1116
1421
  const [selectKeys, setSelectKeys] = useState(initialSelectKey);
1117
1422
  const [disabledKeys, setDisabledKeys] = useState(initialDisabledKeys);
1118
1423
  const [valueSearch, setValueSearch] = useState(initialValueSearch);
1119
1424
  const [sortDescriptors, setSortDescriptors] = useState(initialSortDescriptors);
1120
- let t9;
1121
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1122
- t9 = (value) => {
1425
+ const [columnWidths, setColumnWidths] = useState(initialColumnWidths);
1426
+ let t11;
1427
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1428
+ t11 = (value) => {
1123
1429
  setSelectKeys((prev) => {
1124
1430
  const exists = prev.some((el) => el.id === value.id);
1125
1431
  if (exists) {
@@ -1128,44 +1434,44 @@ const useTable = (t0) => {
1128
1434
  return [...prev, value];
1129
1435
  });
1130
1436
  };
1131
- $[8] = t9;
1437
+ $[10] = t11;
1132
1438
  } else {
1133
- t9 = $[8];
1439
+ t11 = $[10];
1134
1440
  }
1135
- const handleSelectKey = t9;
1136
- let t10;
1137
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1138
- t10 = (value_0) => {
1441
+ const handleSelectKey = t11;
1442
+ let t12;
1443
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1444
+ t12 = (value_0) => {
1139
1445
  setSelectKeys(value_0);
1140
1446
  };
1141
- $[9] = t10;
1447
+ $[11] = t12;
1142
1448
  } else {
1143
- t10 = $[9];
1449
+ t12 = $[11];
1144
1450
  }
1145
- const handleSelectKeys = t10;
1146
- let t11;
1147
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1148
- t11 = (value_1) => {
1451
+ const handleSelectKeys = t12;
1452
+ let t13;
1453
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1454
+ t13 = (value_1) => {
1149
1455
  setDisabledKeys(value_1);
1150
1456
  };
1151
- $[10] = t11;
1457
+ $[12] = t13;
1152
1458
  } else {
1153
- t11 = $[10];
1459
+ t13 = $[12];
1154
1460
  }
1155
- const handleDisabledKeys = t11;
1156
- let t12;
1157
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1158
- t12 = () => {
1461
+ const handleDisabledKeys = t13;
1462
+ let t14;
1463
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
1464
+ t14 = () => {
1159
1465
  setSelectKeys([]);
1160
1466
  };
1161
- $[11] = t12;
1467
+ $[13] = t14;
1162
1468
  } else {
1163
- t12 = $[11];
1469
+ t14 = $[13];
1164
1470
  }
1165
- const handleResetSelectKeys = t12;
1166
- let t13;
1167
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1168
- t13 = (key, value_2) => {
1471
+ const handleResetSelectKeys = t14;
1472
+ let t15;
1473
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
1474
+ t15 = (key, value_2) => {
1169
1475
  setValueSearch((prev_0) => {
1170
1476
  if (prev_0[key] === value_2) {
1171
1477
  return prev_0;
@@ -1181,14 +1487,14 @@ const useTable = (t0) => {
1181
1487
  return newState;
1182
1488
  });
1183
1489
  };
1184
- $[12] = t13;
1490
+ $[14] = t15;
1185
1491
  } else {
1186
- t13 = $[12];
1492
+ t15 = $[14];
1187
1493
  }
1188
- const handleSetValueSearch = t13;
1189
- let t14;
1190
- if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
1191
- t14 = (column) => {
1494
+ const handleSetValueSearch = t15;
1495
+ let t16;
1496
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
1497
+ t16 = (column) => {
1192
1498
  setSortDescriptors((prev_1) => {
1193
1499
  const existingIndex = prev_1.findIndex((s) => s.column === column);
1194
1500
  if (existingIndex !== -1) {
@@ -1210,34 +1516,64 @@ const useTable = (t0) => {
1210
1516
  }];
1211
1517
  });
1212
1518
  };
1213
- $[13] = t14;
1519
+ $[15] = t16;
1214
1520
  } else {
1215
- t14 = $[13];
1521
+ t16 = $[15];
1216
1522
  }
1217
- const handleSort = t14;
1218
- let t15;
1219
- if ($[14] !== disabledKeys || $[15] !== selectKeys || $[16] !== sortDescriptors || $[17] !== valueSearch) {
1220
- t15 = {
1523
+ const handleSort = t16;
1524
+ let t17;
1525
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
1526
+ t17 = (columnId, width) => {
1527
+ setColumnWidths((prev_2) => ({
1528
+ ...prev_2,
1529
+ [columnId]: width
1530
+ }));
1531
+ };
1532
+ $[16] = t17;
1533
+ } else {
1534
+ t17 = $[16];
1535
+ }
1536
+ const handleColumnResize = t17;
1537
+ let t18;
1538
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
1539
+ t18 = (columnId_0, width_0) => {
1540
+ setColumnWidths((prev_3) => ({
1541
+ ...prev_3,
1542
+ [columnId_0]: width_0
1543
+ }));
1544
+ };
1545
+ $[17] = t18;
1546
+ } else {
1547
+ t18 = $[17];
1548
+ }
1549
+ const handleColumnResizeEnd = t18;
1550
+ let t19;
1551
+ if ($[18] !== columnWidths || $[19] !== disabledKeys || $[20] !== selectKeys || $[21] !== sortDescriptors || $[22] !== valueSearch) {
1552
+ t19 = {
1221
1553
  selectKeys,
1222
1554
  disabledKeys,
1223
1555
  valueSearch,
1224
1556
  sortDescriptors,
1557
+ columnWidths,
1225
1558
  handleSelectKeys,
1226
1559
  handleSelectKey,
1227
1560
  handleDisabledKeys,
1228
1561
  handleSetValueSearch,
1229
1562
  handleResetSelectKeys,
1230
- handleSort
1563
+ handleSort,
1564
+ handleColumnResize,
1565
+ handleColumnResizeEnd
1231
1566
  };
1232
- $[14] = disabledKeys;
1233
- $[15] = selectKeys;
1234
- $[16] = sortDescriptors;
1235
- $[17] = valueSearch;
1236
- $[18] = t15;
1567
+ $[18] = columnWidths;
1568
+ $[19] = disabledKeys;
1569
+ $[20] = selectKeys;
1570
+ $[21] = sortDescriptors;
1571
+ $[22] = valueSearch;
1572
+ $[23] = t19;
1237
1573
  } else {
1238
- t15 = $[18];
1574
+ t19 = $[23];
1239
1575
  }
1240
- return t15;
1576
+ return t19;
1241
1577
  };
1242
1578
  export {
1243
1579
  Table,