lizaui 9.0.56 → 9.0.58

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.
@@ -27,11 +27,11 @@ const compilerRuntime = require("react/compiler-runtime");
27
27
  const React = require("react");
28
28
  const tailwindMerge = require("tailwind-merge");
29
29
  const tooltip = require("../chunks/tooltip-hhxclHkr.js");
30
+ const clsx = require("clsx");
30
31
  const chevronUp = require("../chunks/chevron-up-egHdliKz.js");
31
32
  const chevronDown = require("../chunks/chevron-down-BTrLI_vJ.js");
32
33
  const createLucideIcon = require("../chunks/createLucideIcon-Bxsl-Fn_.js");
33
34
  const loaderCircle = require("../chunks/loader-circle-DVLrRYRP.js");
34
- const clsx = require("clsx");
35
35
  const checkbox = require("../chunks/checkbox-tCMzL33G.js");
36
36
  const framerMotion = require("framer-motion");
37
37
  const __iconNode = [
@@ -110,14 +110,221 @@ const initialValues = {
110
110
  totalColumn: 0,
111
111
  sortDescriptors: [],
112
112
  onSortChange: () => {
113
+ },
114
+ columnWidths: {},
115
+ onColumnResize: () => {
116
+ },
117
+ onColumnResizeEnd: () => {
113
118
  }
114
119
  };
115
120
  const TableContext = React.createContext(initialValues);
116
121
  const useTableContext = () => {
117
122
  return React.useContext(TableContext);
118
123
  };
124
+ function useColumnResize(t0) {
125
+ const $ = compilerRuntime.c(28);
126
+ const {
127
+ columnId,
128
+ initialWidth: t1,
129
+ minWidth: t2,
130
+ maxWidth: t3,
131
+ onResize,
132
+ onResizeEnd
133
+ } = t0;
134
+ const initialWidth = t1 === void 0 ? 150 : t1;
135
+ const minWidth = t2 === void 0 ? 80 : t2;
136
+ const maxWidth = t3 === void 0 ? 800 : t3;
137
+ const [width, setWidth] = React.useState(initialWidth);
138
+ const [isResizing, setIsResizing] = React.useState(false);
139
+ const startXRef = React.useRef(0);
140
+ const startWidthRef = React.useRef(0);
141
+ const columnRef = React.useRef(null);
142
+ let t4;
143
+ if ($[0] !== initialWidth || $[1] !== width) {
144
+ t4 = () => {
145
+ if (initialWidth !== width) {
146
+ setWidth(initialWidth);
147
+ }
148
+ };
149
+ $[0] = initialWidth;
150
+ $[1] = width;
151
+ $[2] = t4;
152
+ } else {
153
+ t4 = $[2];
154
+ }
155
+ let t5;
156
+ if ($[3] !== initialWidth) {
157
+ t5 = [initialWidth];
158
+ $[3] = initialWidth;
159
+ $[4] = t5;
160
+ } else {
161
+ t5 = $[4];
162
+ }
163
+ React.useEffect(t4, t5);
164
+ let t6;
165
+ if ($[5] !== width) {
166
+ t6 = (e) => {
167
+ e.preventDefault();
168
+ e.stopPropagation();
169
+ const target = e.currentTarget;
170
+ target.setPointerCapture(e.pointerId);
171
+ startXRef.current = e.clientX;
172
+ startWidthRef.current = width;
173
+ setIsResizing(true);
174
+ document.body.style.userSelect = "none";
175
+ document.body.style.cursor = "col-resize";
176
+ };
177
+ $[5] = width;
178
+ $[6] = t6;
179
+ } else {
180
+ t6 = $[6];
181
+ }
182
+ const handlePointerDown = t6;
183
+ let t7;
184
+ if ($[7] !== columnId || $[8] !== isResizing || $[9] !== maxWidth || $[10] !== minWidth || $[11] !== onResize) {
185
+ t7 = (e_0) => {
186
+ if (!isResizing) {
187
+ return;
188
+ }
189
+ const delta = e_0.clientX - startXRef.current;
190
+ const newWidth = Math.max(minWidth, Math.min(maxWidth, startWidthRef.current + delta));
191
+ setWidth(newWidth);
192
+ onResize?.(columnId, newWidth);
193
+ };
194
+ $[7] = columnId;
195
+ $[8] = isResizing;
196
+ $[9] = maxWidth;
197
+ $[10] = minWidth;
198
+ $[11] = onResize;
199
+ $[12] = t7;
200
+ } else {
201
+ t7 = $[12];
202
+ }
203
+ const handlePointerMove = t7;
204
+ let t8;
205
+ if ($[13] !== columnId || $[14] !== isResizing || $[15] !== maxWidth || $[16] !== minWidth || $[17] !== onResizeEnd) {
206
+ t8 = (e_1) => {
207
+ if (!isResizing) {
208
+ return;
209
+ }
210
+ setIsResizing(false);
211
+ document.body.style.userSelect = "";
212
+ document.body.style.cursor = "";
213
+ const delta_0 = e_1.clientX - startXRef.current;
214
+ const finalWidth = Math.max(minWidth, Math.min(maxWidth, startWidthRef.current + delta_0));
215
+ onResizeEnd?.(columnId, finalWidth);
216
+ };
217
+ $[13] = columnId;
218
+ $[14] = isResizing;
219
+ $[15] = maxWidth;
220
+ $[16] = minWidth;
221
+ $[17] = onResizeEnd;
222
+ $[18] = t8;
223
+ } else {
224
+ t8 = $[18];
225
+ }
226
+ const handlePointerUp = t8;
227
+ let t10;
228
+ let t9;
229
+ if ($[19] !== handlePointerMove || $[20] !== handlePointerUp || $[21] !== isResizing) {
230
+ t9 = () => {
231
+ if (isResizing) {
232
+ document.addEventListener("pointermove", handlePointerMove);
233
+ document.addEventListener("pointerup", handlePointerUp);
234
+ return () => {
235
+ document.removeEventListener("pointermove", handlePointerMove);
236
+ document.removeEventListener("pointerup", handlePointerUp);
237
+ };
238
+ }
239
+ };
240
+ t10 = [isResizing, handlePointerMove, handlePointerUp];
241
+ $[19] = handlePointerMove;
242
+ $[20] = handlePointerUp;
243
+ $[21] = isResizing;
244
+ $[22] = t10;
245
+ $[23] = t9;
246
+ } else {
247
+ t10 = $[22];
248
+ t9 = $[23];
249
+ }
250
+ React.useEffect(t9, t10);
251
+ let t11;
252
+ if ($[24] !== handlePointerDown || $[25] !== isResizing || $[26] !== width) {
253
+ t11 = {
254
+ width,
255
+ isResizing,
256
+ columnRef,
257
+ handlePointerDown,
258
+ setWidth
259
+ };
260
+ $[24] = handlePointerDown;
261
+ $[25] = isResizing;
262
+ $[26] = width;
263
+ $[27] = t11;
264
+ } else {
265
+ t11 = $[27];
266
+ }
267
+ return t11;
268
+ }
269
+ const ResizeHandle = React.memo((t0) => {
270
+ const $ = compilerRuntime.c(12);
271
+ const {
272
+ onPointerDown,
273
+ isResizing,
274
+ className
275
+ } = t0;
276
+ const t1 = isResizing && "bg-default";
277
+ let t2;
278
+ if ($[0] !== className || $[1] !== t1) {
279
+ t2 = clsx("absolute top-0 right-0 h-full w-1 cursor-col-resize select-none touch-none group/resize z-10", "hover:bg-default/50 active:bg-default transition-colors", t1, className);
280
+ $[0] = className;
281
+ $[1] = t1;
282
+ $[2] = t2;
283
+ } else {
284
+ t2 = $[2];
285
+ }
286
+ let t3;
287
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
288
+ t3 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-y-0 -left-2 -right-2" });
289
+ $[3] = t3;
290
+ } else {
291
+ t3 = $[3];
292
+ }
293
+ const t4 = isResizing && "opacity-100";
294
+ let t5;
295
+ if ($[4] !== t4) {
296
+ t5 = clsx("absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2", "w-1 h-8 rounded-full bg-default opacity-0 group-hover/resize:opacity-100 transition-opacity", t4);
297
+ $[4] = t4;
298
+ $[5] = t5;
299
+ } else {
300
+ t5 = $[5];
301
+ }
302
+ let t6;
303
+ if ($[6] !== t5) {
304
+ t6 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: t5 });
305
+ $[6] = t5;
306
+ $[7] = t6;
307
+ } else {
308
+ t6 = $[7];
309
+ }
310
+ let t7;
311
+ if ($[8] !== onPointerDown || $[9] !== t2 || $[10] !== t6) {
312
+ t7 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t2, onPointerDown, role: "separator", "aria-orientation": "vertical", "aria-label": "Resize column", children: [
313
+ t3,
314
+ t6
315
+ ] });
316
+ $[8] = onPointerDown;
317
+ $[9] = t2;
318
+ $[10] = t6;
319
+ $[11] = t7;
320
+ } else {
321
+ t7 = $[11];
322
+ }
323
+ return t7;
324
+ });
325
+ ResizeHandle.displayName = "ResizeHandle";
119
326
  const TableHeaderColumn = React.memo((t0) => {
120
- const $ = compilerRuntime.c(41);
327
+ const $ = compilerRuntime.c(61);
121
328
  const {
122
329
  children,
123
330
  className,
@@ -126,7 +333,12 @@ const TableHeaderColumn = React.memo((t0) => {
126
333
  text: t3,
127
334
  size,
128
335
  header,
129
- colspan: t4
336
+ colspan: t4,
337
+ resizable: resizableProp,
338
+ minWidth: minWidthProp,
339
+ maxWidth: maxWidthProp,
340
+ onResize: onResizeProp,
341
+ onResizeEnd: onResizeEndProp
130
342
  } = t0;
131
343
  let t5;
132
344
  if ($[0] !== t1) {
@@ -142,90 +354,149 @@ const TableHeaderColumn = React.memo((t0) => {
142
354
  const colspan = t4 === void 0 ? void 0 : t4;
143
355
  const {
144
356
  sortDescriptors,
145
- onSortChange
357
+ onSortChange,
358
+ columnWidths,
359
+ onColumnResize,
360
+ onColumnResizeEnd
146
361
  } = useTableContext();
362
+ const isResizable = resizableProp ?? header?.resizable ?? false;
363
+ const columnId = header?.id || "";
364
+ const initialWidth = columnWidths?.[columnId] || size || header?.size || 150;
365
+ const minWidth = minWidthProp ?? header?.minWidth ?? 80;
366
+ const maxWidth = maxWidthProp ?? header?.maxWidth ?? 800;
147
367
  let t6;
148
- if ($[2] !== className) {
149
- t6 = tailwindMerge.twMerge("px-2 border-b border-divider", className);
150
- $[2] = className;
151
- $[3] = t6;
368
+ if ($[2] !== onColumnResize || $[3] !== onResizeProp) {
369
+ t6 = (id, width) => {
370
+ onResizeProp?.(width);
371
+ onColumnResize?.(id, width);
372
+ };
373
+ $[2] = onColumnResize;
374
+ $[3] = onResizeProp;
375
+ $[4] = t6;
376
+ } else {
377
+ t6 = $[4];
378
+ }
379
+ let t7;
380
+ if ($[5] !== onColumnResizeEnd || $[6] !== onResizeEndProp) {
381
+ t7 = (id_0, width_0) => {
382
+ onResizeEndProp?.(width_0);
383
+ onColumnResizeEnd?.(id_0, width_0);
384
+ };
385
+ $[5] = onColumnResizeEnd;
386
+ $[6] = onResizeEndProp;
387
+ $[7] = t7;
388
+ } else {
389
+ t7 = $[7];
390
+ }
391
+ let t8;
392
+ if ($[8] !== columnId || $[9] !== initialWidth || $[10] !== maxWidth || $[11] !== minWidth || $[12] !== t6 || $[13] !== t7) {
393
+ t8 = {
394
+ columnId,
395
+ initialWidth,
396
+ minWidth,
397
+ maxWidth,
398
+ onResize: t6,
399
+ onResizeEnd: t7
400
+ };
401
+ $[8] = columnId;
402
+ $[9] = initialWidth;
403
+ $[10] = maxWidth;
404
+ $[11] = minWidth;
405
+ $[12] = t6;
406
+ $[13] = t7;
407
+ $[14] = t8;
152
408
  } else {
153
- t6 = $[3];
409
+ t8 = $[14];
154
410
  }
155
- const mergedClass = t6;
156
- const t7 = size ? `${size}px` : style.width;
157
- const t8 = size ? `${size}px` : style.minWidth;
411
+ const {
412
+ width: resizedWidth,
413
+ isResizing,
414
+ columnRef,
415
+ handlePointerDown
416
+ } = useColumnResize(t8);
158
417
  let t9;
159
- if ($[4] !== style || $[5] !== t7 || $[6] !== t8) {
160
- t9 = {
418
+ if ($[15] !== className) {
419
+ t9 = tailwindMerge.twMerge("px-2 border-b border-divider relative", className);
420
+ $[15] = className;
421
+ $[16] = t9;
422
+ } else {
423
+ t9 = $[16];
424
+ }
425
+ const mergedClass = t9;
426
+ const effectiveWidth = isResizable ? resizedWidth : size || header?.size;
427
+ const t10 = effectiveWidth ? `${effectiveWidth}px` : style.width;
428
+ const t11 = effectiveWidth ? `${effectiveWidth}px` : style.minWidth;
429
+ let t12;
430
+ if ($[17] !== style || $[18] !== t10 || $[19] !== t11) {
431
+ t12 = {
161
432
  ...style,
162
- width: t7,
163
- minWidth: t8
433
+ width: t10,
434
+ minWidth: t11
164
435
  };
165
- $[4] = style;
166
- $[5] = t7;
167
- $[6] = t8;
168
- $[7] = t9;
436
+ $[17] = style;
437
+ $[18] = t10;
438
+ $[19] = t11;
439
+ $[20] = t12;
169
440
  } else {
170
- t9 = $[7];
441
+ t12 = $[20];
171
442
  }
172
- const mergedStyle = t9;
173
- let t10;
174
- if ($[8] !== children) {
175
- t10 = !children || typeof children === "string" && children.trim() === "";
176
- $[8] = children;
177
- $[9] = t10;
443
+ const mergedStyle = t12;
444
+ let t13;
445
+ if ($[21] !== children) {
446
+ t13 = !children || typeof children === "string" && children.trim() === "";
447
+ $[21] = children;
448
+ $[22] = t13;
178
449
  } else {
179
- t10 = $[9];
450
+ t13 = $[22];
180
451
  }
181
- const isChildrenEmpty = t10;
452
+ const isChildrenEmpty = t13;
182
453
  const isSortable = header?.sort;
183
454
  header?.id;
184
- let t11;
185
- if ($[10] !== header?.id || $[11] !== sortDescriptors) {
186
- t11 = sortDescriptors?.find((d) => d.column === header?.id);
187
- $[10] = header?.id;
188
- $[11] = sortDescriptors;
189
- $[12] = t11;
455
+ let t14;
456
+ if ($[23] !== header?.id || $[24] !== sortDescriptors) {
457
+ t14 = sortDescriptors?.find((d) => d.column === header?.id);
458
+ $[23] = header?.id;
459
+ $[24] = sortDescriptors;
460
+ $[25] = t14;
190
461
  } else {
191
- t11 = $[12];
462
+ t14 = $[25];
192
463
  }
193
- const currentSort = t11;
194
- let t12;
195
- if ($[13] !== currentSort || $[14] !== header?.id || $[15] !== sortDescriptors) {
196
- t12 = () => {
464
+ const currentSort = t14;
465
+ let t15;
466
+ if ($[26] !== currentSort || $[27] !== header?.id || $[28] !== sortDescriptors) {
467
+ t15 = () => {
197
468
  if (!sortDescriptors || sortDescriptors.length <= 1 || !currentSort) {
198
469
  return null;
199
470
  }
200
471
  return sortDescriptors.findIndex((d_0) => d_0.column === header?.id) + 1;
201
472
  };
202
- $[13] = currentSort;
203
- $[14] = header?.id;
204
- $[15] = sortDescriptors;
205
- $[16] = t12;
473
+ $[26] = currentSort;
474
+ $[27] = header?.id;
475
+ $[28] = sortDescriptors;
476
+ $[29] = t15;
206
477
  } else {
207
- t12 = $[16];
478
+ t15 = $[29];
208
479
  }
209
480
  header?.id;
210
- const sortOrderIndex = t12();
211
- let t13;
212
- if ($[17] !== header || $[18] !== isSortable || $[19] !== onSortChange) {
213
- t13 = () => {
481
+ const sortOrderIndex = t15();
482
+ let t16;
483
+ if ($[30] !== header || $[31] !== isSortable || $[32] !== onSortChange) {
484
+ t16 = () => {
214
485
  if (isSortable && onSortChange && header?.id) {
215
486
  onSortChange(header.id);
216
487
  }
217
488
  };
218
- $[17] = header;
219
- $[18] = isSortable;
220
- $[19] = onSortChange;
221
- $[20] = t13;
489
+ $[30] = header;
490
+ $[31] = isSortable;
491
+ $[32] = onSortChange;
492
+ $[33] = t16;
222
493
  } else {
223
- t13 = $[20];
494
+ t16 = $[33];
224
495
  }
225
- const handleSort = t13;
226
- let t14;
227
- if ($[21] !== currentSort || $[22] !== icon || $[23] !== isSortable || $[24] !== sortOrderIndex) {
228
- t14 = () => {
496
+ const handleSort = t16;
497
+ let t17;
498
+ if ($[34] !== currentSort || $[35] !== icon || $[36] !== isSortable || $[37] !== sortOrderIndex) {
499
+ t17 = () => {
229
500
  if (!isSortable) {
230
501
  return icon;
231
502
  }
@@ -237,28 +508,31 @@ const TableHeaderColumn = React.memo((t0) => {
237
508
  }
238
509
  return /* @__PURE__ */ jsxRuntime.jsx(ChevronsUpDown, { className: "h-4 w-4 text-default-300" });
239
510
  };
240
- $[21] = currentSort;
241
- $[22] = icon;
242
- $[23] = isSortable;
243
- $[24] = sortOrderIndex;
244
- $[25] = t14;
511
+ $[34] = currentSort;
512
+ $[35] = icon;
513
+ $[36] = isSortable;
514
+ $[37] = sortOrderIndex;
515
+ $[38] = t17;
245
516
  } else {
246
- t14 = $[25];
247
- }
248
- const renderSortIcon = t14;
249
- const t15 = isSortable ? "cursor-pointer hover:bg-default-100 transition-colors" : "";
250
- let t16;
251
- if ($[26] !== mergedClass || $[27] !== t15) {
252
- t16 = tailwindMerge.twMerge(mergedClass, t15);
253
- $[26] = mergedClass;
254
- $[27] = t15;
255
- $[28] = t16;
517
+ t17 = $[38];
518
+ }
519
+ const renderSortIcon = t17;
520
+ const t18 = isResizable ? columnRef : void 0;
521
+ const t19 = isSortable ? "cursor-pointer transition-colors" : "";
522
+ const t20 = isResizing && "select-none";
523
+ let t21;
524
+ if ($[39] !== mergedClass || $[40] !== t19 || $[41] !== t20) {
525
+ t21 = tailwindMerge.twMerge(mergedClass, t19, t20);
526
+ $[39] = mergedClass;
527
+ $[40] = t19;
528
+ $[41] = t20;
529
+ $[42] = t21;
256
530
  } else {
257
- t16 = $[28];
531
+ t21 = $[42];
258
532
  }
259
- let t17;
260
- if ($[29] !== children || $[30] !== header?.information || $[31] !== isChildrenEmpty || $[32] !== renderSortIcon || $[33] !== text) {
261
- t17 = isChildrenEmpty ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center gap-x-2 font-medium", children: [
533
+ let t22;
534
+ if ($[43] !== children || $[44] !== header?.information || $[45] !== isChildrenEmpty || $[46] !== renderSortIcon || $[47] !== text) {
535
+ t22 = isChildrenEmpty ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center gap-x-2 font-medium", children: [
262
536
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
263
537
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-1 text-xs text-foreground-500 dark:text-foreground-500 text-left", children: text }),
264
538
  header?.information && /* @__PURE__ */ jsxRuntime.jsx(tooltip.Tooltip, { content: header?.information || "", children: /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsxs("g", { fill: "none", children: [
@@ -269,28 +543,43 @@ const TableHeaderColumn = React.memo((t0) => {
269
543
  ] }),
270
544
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex justify-end", children: renderSortIcon() })
271
545
  ] }) : children;
272
- $[29] = children;
273
- $[30] = header?.information;
274
- $[31] = isChildrenEmpty;
275
- $[32] = renderSortIcon;
276
- $[33] = text;
277
- $[34] = t17;
546
+ $[43] = children;
547
+ $[44] = header?.information;
548
+ $[45] = isChildrenEmpty;
549
+ $[46] = renderSortIcon;
550
+ $[47] = text;
551
+ $[48] = t22;
552
+ } else {
553
+ t22 = $[48];
554
+ }
555
+ let t23;
556
+ if ($[49] !== handlePointerDown || $[50] !== isResizable || $[51] !== isResizing) {
557
+ t23 = isResizable && /* @__PURE__ */ jsxRuntime.jsx(ResizeHandle, { onPointerDown: handlePointerDown, isResizing });
558
+ $[49] = handlePointerDown;
559
+ $[50] = isResizable;
560
+ $[51] = isResizing;
561
+ $[52] = t23;
278
562
  } else {
279
- t17 = $[34];
563
+ t23 = $[52];
280
564
  }
281
- let t18;
282
- if ($[35] !== colspan || $[36] !== handleSort || $[37] !== mergedStyle || $[38] !== t16 || $[39] !== t17) {
283
- t18 = /* @__PURE__ */ jsxRuntime.jsx("th", { className: t16, style: mergedStyle, colSpan: colspan, onClick: handleSort, children: t17 });
284
- $[35] = colspan;
285
- $[36] = handleSort;
286
- $[37] = mergedStyle;
287
- $[38] = t16;
288
- $[39] = t17;
289
- $[40] = t18;
290
- } else {
291
- t18 = $[40];
292
- }
293
- return t18;
565
+ let t24;
566
+ if ($[53] !== colspan || $[54] !== handleSort || $[55] !== mergedStyle || $[56] !== t18 || $[57] !== t21 || $[58] !== t22 || $[59] !== t23) {
567
+ t24 = /* @__PURE__ */ jsxRuntime.jsxs("th", { ref: t18, className: t21, style: mergedStyle, colSpan: colspan, onClick: handleSort, children: [
568
+ t22,
569
+ t23
570
+ ] });
571
+ $[53] = colspan;
572
+ $[54] = handleSort;
573
+ $[55] = mergedStyle;
574
+ $[56] = t18;
575
+ $[57] = t21;
576
+ $[58] = t22;
577
+ $[59] = t23;
578
+ $[60] = t24;
579
+ } else {
580
+ t24 = $[60];
581
+ }
582
+ return t24;
294
583
  });
295
584
  TableHeaderColumn.displayName = "TableHeaderColumn";
296
585
  const TableEmptyState = React.memo((t0) => {
@@ -1064,6 +1353,9 @@ const TableHOC = ({
1064
1353
  dataHeader,
1065
1354
  sortDescriptors,
1066
1355
  onSortChange,
1356
+ columnWidths = {},
1357
+ onColumnResize,
1358
+ onColumnResizeEnd,
1067
1359
  ...otherProps
1068
1360
  } = props;
1069
1361
  const tableClass = React.useMemo(() => tailwindMerge.twMerge("table-main-container w-full border-collapse table-auto", className), [className]);
@@ -1077,7 +1369,10 @@ const TableHOC = ({
1077
1369
  widthAction,
1078
1370
  totalColumn: dataHeader?.length || 0,
1079
1371
  sortDescriptors,
1080
- onSortChange
1372
+ onSortChange,
1373
+ columnWidths,
1374
+ onColumnResize,
1375
+ onColumnResizeEnd
1081
1376
  }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: containerClass, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.LazyMotion, { features: () => import("framer-motion").then((res) => res.domAnimation), children: /* @__PURE__ */ jsxRuntime.jsx("table", { className: tableClass, children: React.Children.map(children, (child) => React.isValidElement(child) ? React.cloneElement(child, {
1082
1377
  dataHeader,
1083
1378
  ...otherProps
@@ -1094,56 +1389,67 @@ const Table = Object.assign(TableHOC, {
1094
1389
  BodyColumn: TableBodyColumn
1095
1390
  });
1096
1391
  const useTable = (t0) => {
1097
- const $ = compilerRuntime.c(19);
1392
+ const $ = compilerRuntime.c(24);
1098
1393
  const {
1099
1394
  initialDisabledKeys: t1,
1100
1395
  initialSelectKey: t2,
1101
1396
  initialValueSearch: t3,
1102
- initialSortDescriptors: t4
1397
+ initialSortDescriptors: t4,
1398
+ initialColumnWidths: t5
1103
1399
  } = t0;
1104
- let t5;
1400
+ let t6;
1105
1401
  if ($[0] !== t1) {
1106
- t5 = t1 === void 0 ? [] : t1;
1402
+ t6 = t1 === void 0 ? [] : t1;
1107
1403
  $[0] = t1;
1108
- $[1] = t5;
1404
+ $[1] = t6;
1109
1405
  } else {
1110
- t5 = $[1];
1406
+ t6 = $[1];
1111
1407
  }
1112
- const initialDisabledKeys = t5;
1113
- let t6;
1408
+ const initialDisabledKeys = t6;
1409
+ let t7;
1114
1410
  if ($[2] !== t2) {
1115
- t6 = t2 === void 0 ? [] : t2;
1411
+ t7 = t2 === void 0 ? [] : t2;
1116
1412
  $[2] = t2;
1117
- $[3] = t6;
1413
+ $[3] = t7;
1118
1414
  } else {
1119
- t6 = $[3];
1415
+ t7 = $[3];
1120
1416
  }
1121
- const initialSelectKey = t6;
1122
- let t7;
1417
+ const initialSelectKey = t7;
1418
+ let t8;
1123
1419
  if ($[4] !== t3) {
1124
- t7 = t3 === void 0 ? {} : t3;
1420
+ t8 = t3 === void 0 ? {} : t3;
1125
1421
  $[4] = t3;
1126
- $[5] = t7;
1422
+ $[5] = t8;
1127
1423
  } else {
1128
- t7 = $[5];
1424
+ t8 = $[5];
1129
1425
  }
1130
- const initialValueSearch = t7;
1131
- let t8;
1426
+ const initialValueSearch = t8;
1427
+ let t9;
1132
1428
  if ($[6] !== t4) {
1133
- t8 = t4 === void 0 ? [] : t4;
1429
+ t9 = t4 === void 0 ? [] : t4;
1134
1430
  $[6] = t4;
1135
- $[7] = t8;
1431
+ $[7] = t9;
1136
1432
  } else {
1137
- t8 = $[7];
1433
+ t9 = $[7];
1138
1434
  }
1139
- const initialSortDescriptors = t8;
1435
+ const initialSortDescriptors = t9;
1436
+ let t10;
1437
+ if ($[8] !== t5) {
1438
+ t10 = t5 === void 0 ? {} : t5;
1439
+ $[8] = t5;
1440
+ $[9] = t10;
1441
+ } else {
1442
+ t10 = $[9];
1443
+ }
1444
+ const initialColumnWidths = t10;
1140
1445
  const [selectKeys, setSelectKeys] = React.useState(initialSelectKey);
1141
1446
  const [disabledKeys, setDisabledKeys] = React.useState(initialDisabledKeys);
1142
1447
  const [valueSearch, setValueSearch] = React.useState(initialValueSearch);
1143
1448
  const [sortDescriptors, setSortDescriptors] = React.useState(initialSortDescriptors);
1144
- let t9;
1145
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1146
- t9 = (value) => {
1449
+ const [columnWidths, setColumnWidths] = React.useState(initialColumnWidths);
1450
+ let t11;
1451
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1452
+ t11 = (value) => {
1147
1453
  setSelectKeys((prev) => {
1148
1454
  const exists = prev.some((el) => el.id === value.id);
1149
1455
  if (exists) {
@@ -1152,44 +1458,44 @@ const useTable = (t0) => {
1152
1458
  return [...prev, value];
1153
1459
  });
1154
1460
  };
1155
- $[8] = t9;
1461
+ $[10] = t11;
1156
1462
  } else {
1157
- t9 = $[8];
1463
+ t11 = $[10];
1158
1464
  }
1159
- const handleSelectKey = t9;
1160
- let t10;
1161
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1162
- t10 = (value_0) => {
1465
+ const handleSelectKey = t11;
1466
+ let t12;
1467
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1468
+ t12 = (value_0) => {
1163
1469
  setSelectKeys(value_0);
1164
1470
  };
1165
- $[9] = t10;
1471
+ $[11] = t12;
1166
1472
  } else {
1167
- t10 = $[9];
1473
+ t12 = $[11];
1168
1474
  }
1169
- const handleSelectKeys = t10;
1170
- let t11;
1171
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1172
- t11 = (value_1) => {
1475
+ const handleSelectKeys = t12;
1476
+ let t13;
1477
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1478
+ t13 = (value_1) => {
1173
1479
  setDisabledKeys(value_1);
1174
1480
  };
1175
- $[10] = t11;
1481
+ $[12] = t13;
1176
1482
  } else {
1177
- t11 = $[10];
1483
+ t13 = $[12];
1178
1484
  }
1179
- const handleDisabledKeys = t11;
1180
- let t12;
1181
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1182
- t12 = () => {
1485
+ const handleDisabledKeys = t13;
1486
+ let t14;
1487
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
1488
+ t14 = () => {
1183
1489
  setSelectKeys([]);
1184
1490
  };
1185
- $[11] = t12;
1491
+ $[13] = t14;
1186
1492
  } else {
1187
- t12 = $[11];
1493
+ t14 = $[13];
1188
1494
  }
1189
- const handleResetSelectKeys = t12;
1190
- let t13;
1191
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1192
- t13 = (key, value_2) => {
1495
+ const handleResetSelectKeys = t14;
1496
+ let t15;
1497
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
1498
+ t15 = (key, value_2) => {
1193
1499
  setValueSearch((prev_0) => {
1194
1500
  if (prev_0[key] === value_2) {
1195
1501
  return prev_0;
@@ -1205,14 +1511,14 @@ const useTable = (t0) => {
1205
1511
  return newState;
1206
1512
  });
1207
1513
  };
1208
- $[12] = t13;
1514
+ $[14] = t15;
1209
1515
  } else {
1210
- t13 = $[12];
1516
+ t15 = $[14];
1211
1517
  }
1212
- const handleSetValueSearch = t13;
1213
- let t14;
1214
- if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
1215
- t14 = (column) => {
1518
+ const handleSetValueSearch = t15;
1519
+ let t16;
1520
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
1521
+ t16 = (column) => {
1216
1522
  setSortDescriptors((prev_1) => {
1217
1523
  const existingIndex = prev_1.findIndex((s) => s.column === column);
1218
1524
  if (existingIndex !== -1) {
@@ -1234,34 +1540,64 @@ const useTable = (t0) => {
1234
1540
  }];
1235
1541
  });
1236
1542
  };
1237
- $[13] = t14;
1543
+ $[15] = t16;
1238
1544
  } else {
1239
- t14 = $[13];
1545
+ t16 = $[15];
1240
1546
  }
1241
- const handleSort = t14;
1242
- let t15;
1243
- if ($[14] !== disabledKeys || $[15] !== selectKeys || $[16] !== sortDescriptors || $[17] !== valueSearch) {
1244
- t15 = {
1547
+ const handleSort = t16;
1548
+ let t17;
1549
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
1550
+ t17 = (columnId, width) => {
1551
+ setColumnWidths((prev_2) => ({
1552
+ ...prev_2,
1553
+ [columnId]: width
1554
+ }));
1555
+ };
1556
+ $[16] = t17;
1557
+ } else {
1558
+ t17 = $[16];
1559
+ }
1560
+ const handleColumnResize = t17;
1561
+ let t18;
1562
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
1563
+ t18 = (columnId_0, width_0) => {
1564
+ setColumnWidths((prev_3) => ({
1565
+ ...prev_3,
1566
+ [columnId_0]: width_0
1567
+ }));
1568
+ };
1569
+ $[17] = t18;
1570
+ } else {
1571
+ t18 = $[17];
1572
+ }
1573
+ const handleColumnResizeEnd = t18;
1574
+ let t19;
1575
+ if ($[18] !== columnWidths || $[19] !== disabledKeys || $[20] !== selectKeys || $[21] !== sortDescriptors || $[22] !== valueSearch) {
1576
+ t19 = {
1245
1577
  selectKeys,
1246
1578
  disabledKeys,
1247
1579
  valueSearch,
1248
1580
  sortDescriptors,
1581
+ columnWidths,
1249
1582
  handleSelectKeys,
1250
1583
  handleSelectKey,
1251
1584
  handleDisabledKeys,
1252
1585
  handleSetValueSearch,
1253
1586
  handleResetSelectKeys,
1254
- handleSort
1587
+ handleSort,
1588
+ handleColumnResize,
1589
+ handleColumnResizeEnd
1255
1590
  };
1256
- $[14] = disabledKeys;
1257
- $[15] = selectKeys;
1258
- $[16] = sortDescriptors;
1259
- $[17] = valueSearch;
1260
- $[18] = t15;
1591
+ $[18] = columnWidths;
1592
+ $[19] = disabledKeys;
1593
+ $[20] = selectKeys;
1594
+ $[21] = sortDescriptors;
1595
+ $[22] = valueSearch;
1596
+ $[23] = t19;
1261
1597
  } else {
1262
- t15 = $[18];
1598
+ t19 = $[23];
1263
1599
  }
1264
- return t15;
1600
+ return t19;
1265
1601
  };
1266
1602
  exports.Table = Table;
1267
1603
  exports.TableHOC = TableHOC;