lizaui 9.0.60 → 9.0.62

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.
@@ -84,7 +84,7 @@ const initialValues = {
84
84
  isActions: true,
85
85
  widthAction: 100,
86
86
  totalColumn: 0,
87
- sortDescriptors: [],
87
+ sortDescriptor: null,
88
88
  onSortChange: () => {
89
89
  },
90
90
  columnWidths: {},
@@ -285,7 +285,7 @@ const ResizeHandle = memo((t0) => {
285
285
  }
286
286
  let t7;
287
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: [
288
+ t7 = /* @__PURE__ */ jsxs("div", { className: t2, onPointerDown, onClick: _temp, onDoubleClick: _temp2, role: "separator", "aria-orientation": "vertical", "aria-label": "Resize column", children: [
289
289
  t3,
290
290
  t6
291
291
  ] });
@@ -299,8 +299,14 @@ const ResizeHandle = memo((t0) => {
299
299
  return t7;
300
300
  });
301
301
  ResizeHandle.displayName = "ResizeHandle";
302
+ function _temp(e) {
303
+ return e.stopPropagation();
304
+ }
305
+ function _temp2(e_0) {
306
+ return e_0.stopPropagation();
307
+ }
302
308
  const TableHeaderColumn = React__default.memo((t0) => {
303
- const $ = c(61);
309
+ const $ = c(55);
304
310
  const {
305
311
  children,
306
312
  className,
@@ -329,7 +335,7 @@ const TableHeaderColumn = React__default.memo((t0) => {
329
335
  const text = t3 === void 0 ? "" : t3;
330
336
  const colspan = t4 === void 0 ? void 0 : t4;
331
337
  const {
332
- sortDescriptors,
338
+ sortDescriptor,
333
339
  onSortChange,
334
340
  columnWidths,
335
341
  onColumnResize,
@@ -428,87 +434,63 @@ const TableHeaderColumn = React__default.memo((t0) => {
428
434
  const isChildrenEmpty = t13;
429
435
  const isSortable = header?.sort;
430
436
  header?.id;
437
+ const isCurrentlySorted = sortDescriptor?.column === header?.id;
431
438
  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;
437
- } else {
438
- t14 = $[25];
439
- }
440
- const currentSort = t14;
441
- let t15;
442
- if ($[26] !== currentSort || $[27] !== header?.id || $[28] !== sortDescriptors) {
443
- t15 = () => {
444
- if (!sortDescriptors || sortDescriptors.length <= 1 || !currentSort) {
445
- return null;
439
+ if ($[23] !== header || $[24] !== isResizing || $[25] !== isSortable || $[26] !== onSortChange) {
440
+ t14 = (e) => {
441
+ if (isResizing) {
442
+ e.preventDefault();
443
+ return;
446
444
  }
447
- return sortDescriptors.findIndex((d_0) => d_0.column === header?.id) + 1;
448
- };
449
- $[26] = currentSort;
450
- $[27] = header?.id;
451
- $[28] = sortDescriptors;
452
- $[29] = t15;
453
- } else {
454
- t15 = $[29];
455
- }
456
- header?.id;
457
- const sortOrderIndex = t15();
458
- let t16;
459
- if ($[30] !== header || $[31] !== isSortable || $[32] !== onSortChange) {
460
- t16 = () => {
461
445
  if (isSortable && onSortChange && header?.id) {
462
446
  onSortChange(header.id);
463
447
  }
464
448
  };
465
- $[30] = header;
466
- $[31] = isSortable;
467
- $[32] = onSortChange;
468
- $[33] = t16;
449
+ $[23] = header;
450
+ $[24] = isResizing;
451
+ $[25] = isSortable;
452
+ $[26] = onSortChange;
453
+ $[27] = t14;
469
454
  } else {
470
- t16 = $[33];
455
+ t14 = $[27];
471
456
  }
472
- const handleSort = t16;
473
- let t17;
474
- if ($[34] !== currentSort || $[35] !== icon || $[36] !== isSortable || $[37] !== sortOrderIndex) {
475
- t17 = () => {
457
+ const handleSort = t14;
458
+ let t15;
459
+ if ($[28] !== icon || $[29] !== isCurrentlySorted || $[30] !== isSortable || $[31] !== sortDescriptor) {
460
+ t15 = () => {
476
461
  if (!isSortable) {
477
462
  return icon;
478
463
  }
479
- if (currentSort) {
480
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
481
- sortOrderIndex && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-foreground-500 dark:text-foreground-500", children: sortOrderIndex }),
482
- currentSort.direction === "asc" ? /* @__PURE__ */ jsx(ChevronUp, { className: "h-4 w-4 text-foreground-500 dark:text-foreground-500" }) : /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 text-foreground-500 dark:text-foreground-500" })
483
- ] });
464
+ if (isCurrentlySorted && sortDescriptor) {
465
+ return sortDescriptor.direction === "asc" ? /* @__PURE__ */ jsx(ChevronUp, { className: "h-4 w-4 text-foreground-500 dark:text-foreground-500" }) : /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 text-foreground-500 dark:text-foreground-500" });
484
466
  }
485
467
  return /* @__PURE__ */ jsx(ChevronsUpDown, { className: "h-4 w-4 text-default-300" });
486
468
  };
487
- $[34] = currentSort;
488
- $[35] = icon;
489
- $[36] = isSortable;
490
- $[37] = sortOrderIndex;
491
- $[38] = t17;
492
- } else {
493
- t17 = $[38];
494
- }
495
- const renderSortIcon = t17;
496
- const t18 = isResizable ? columnRef : void 0;
497
- const t19 = isSortable ? "cursor-pointer 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;
506
- } else {
507
- t21 = $[42];
508
- }
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: [
469
+ $[28] = icon;
470
+ $[29] = isCurrentlySorted;
471
+ $[30] = isSortable;
472
+ $[31] = sortDescriptor;
473
+ $[32] = t15;
474
+ } else {
475
+ t15 = $[32];
476
+ }
477
+ const renderSortIcon = t15;
478
+ const t16 = isResizable ? columnRef : void 0;
479
+ const t17 = isSortable ? "cursor-pointer transition-colors" : "";
480
+ const t18 = isResizing && "select-none";
481
+ let t19;
482
+ if ($[33] !== mergedClass || $[34] !== t17 || $[35] !== t18) {
483
+ t19 = twMerge(mergedClass, t17, t18);
484
+ $[33] = mergedClass;
485
+ $[34] = t17;
486
+ $[35] = t18;
487
+ $[36] = t19;
488
+ } else {
489
+ t19 = $[36];
490
+ }
491
+ let t20;
492
+ if ($[37] !== children || $[38] !== header?.information || $[39] !== isChildrenEmpty || $[40] !== renderSortIcon || $[41] !== text) {
493
+ t20 = isChildrenEmpty ? /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center gap-x-2 font-medium", children: [
512
494
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
513
495
  /* @__PURE__ */ jsx("p", { className: "line-clamp-1 text-xs text-foreground-500 dark:text-foreground-500 text-left", children: text }),
514
496
  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: [
@@ -519,43 +501,43 @@ const TableHeaderColumn = React__default.memo((t0) => {
519
501
  ] }),
520
502
  /* @__PURE__ */ jsx("div", { className: "flex-1 flex justify-end", children: renderSortIcon() })
521
503
  ] }) : children;
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;
538
- } else {
539
- t23 = $[52];
540
- }
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
504
+ $[37] = children;
505
+ $[38] = header?.information;
506
+ $[39] = isChildrenEmpty;
507
+ $[40] = renderSortIcon;
508
+ $[41] = text;
509
+ $[42] = t20;
510
+ } else {
511
+ t20 = $[42];
512
+ }
513
+ let t21;
514
+ if ($[43] !== handlePointerDown || $[44] !== isResizable || $[45] !== isResizing) {
515
+ t21 = isResizable && /* @__PURE__ */ jsx(ResizeHandle, { onPointerDown: handlePointerDown, isResizing });
516
+ $[43] = handlePointerDown;
517
+ $[44] = isResizable;
518
+ $[45] = isResizing;
519
+ $[46] = t21;
520
+ } else {
521
+ t21 = $[46];
522
+ }
523
+ let t22;
524
+ if ($[47] !== colspan || $[48] !== handleSort || $[49] !== mergedStyle || $[50] !== t16 || $[51] !== t19 || $[52] !== t20 || $[53] !== t21) {
525
+ t22 = /* @__PURE__ */ jsxs("th", { ref: t16, className: t19, style: mergedStyle, colSpan: colspan, onClick: handleSort, children: [
526
+ t20,
527
+ t21
546
528
  ] });
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;
529
+ $[47] = colspan;
530
+ $[48] = handleSort;
531
+ $[49] = mergedStyle;
532
+ $[50] = t16;
533
+ $[51] = t19;
534
+ $[52] = t20;
535
+ $[53] = t21;
536
+ $[54] = t22;
537
+ } else {
538
+ t22 = $[54];
539
+ }
540
+ return t22;
559
541
  });
560
542
  TableHeaderColumn.displayName = "TableHeaderColumn";
561
543
  const TableEmptyState = memo((t0) => {
@@ -1327,7 +1309,7 @@ const TableHOC = ({
1327
1309
  isActions = true,
1328
1310
  widthAction = 100,
1329
1311
  dataHeader,
1330
- sortDescriptors,
1312
+ sortDescriptor,
1331
1313
  onSortChange,
1332
1314
  columnWidths = {},
1333
1315
  onColumnResize,
@@ -1344,7 +1326,7 @@ const TableHOC = ({
1344
1326
  isActions,
1345
1327
  widthAction,
1346
1328
  totalColumn: dataHeader?.length || 0,
1347
- sortDescriptors,
1329
+ sortDescriptor,
1348
1330
  onSortChange,
1349
1331
  columnWidths,
1350
1332
  onColumnResize,
@@ -1365,12 +1347,12 @@ const Table = Object.assign(TableHOC, {
1365
1347
  BodyColumn: TableBodyColumn
1366
1348
  });
1367
1349
  const useTable = (t0) => {
1368
- const $ = c(24);
1350
+ const $ = c(22);
1369
1351
  const {
1370
1352
  initialDisabledKeys: t1,
1371
1353
  initialSelectKey: t2,
1372
1354
  initialValueSearch: t3,
1373
- initialSortDescriptors: t4,
1355
+ initialSortDescriptor: t4,
1374
1356
  initialColumnWidths: t5
1375
1357
  } = t0;
1376
1358
  let t6;
@@ -1400,32 +1382,24 @@ const useTable = (t0) => {
1400
1382
  t8 = $[5];
1401
1383
  }
1402
1384
  const initialValueSearch = t8;
1385
+ const initialSortDescriptor = t4 === void 0 ? null : t4;
1403
1386
  let t9;
1404
- if ($[6] !== t4) {
1405
- t9 = t4 === void 0 ? [] : t4;
1406
- $[6] = t4;
1387
+ if ($[6] !== t5) {
1388
+ t9 = t5 === void 0 ? {} : t5;
1389
+ $[6] = t5;
1407
1390
  $[7] = t9;
1408
1391
  } else {
1409
1392
  t9 = $[7];
1410
1393
  }
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;
1394
+ const initialColumnWidths = t9;
1421
1395
  const [selectKeys, setSelectKeys] = useState(initialSelectKey);
1422
1396
  const [disabledKeys, setDisabledKeys] = useState(initialDisabledKeys);
1423
1397
  const [valueSearch, setValueSearch] = useState(initialValueSearch);
1424
- const [sortDescriptors, setSortDescriptors] = useState(initialSortDescriptors);
1398
+ const [sortDescriptor, setSortDescriptor] = useState(initialSortDescriptor);
1425
1399
  const [columnWidths, setColumnWidths] = useState(initialColumnWidths);
1426
- let t11;
1427
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1428
- t11 = (value) => {
1400
+ let t10;
1401
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1402
+ t10 = (value) => {
1429
1403
  setSelectKeys((prev) => {
1430
1404
  const exists = prev.some((el) => el.id === value.id);
1431
1405
  if (exists) {
@@ -1434,44 +1408,44 @@ const useTable = (t0) => {
1434
1408
  return [...prev, value];
1435
1409
  });
1436
1410
  };
1437
- $[10] = t11;
1411
+ $[8] = t10;
1438
1412
  } else {
1439
- t11 = $[10];
1413
+ t10 = $[8];
1440
1414
  }
1441
- const handleSelectKey = t11;
1442
- let t12;
1443
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1444
- t12 = (value_0) => {
1415
+ const handleSelectKey = t10;
1416
+ let t11;
1417
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1418
+ t11 = (value_0) => {
1445
1419
  setSelectKeys(value_0);
1446
1420
  };
1447
- $[11] = t12;
1421
+ $[9] = t11;
1448
1422
  } else {
1449
- t12 = $[11];
1423
+ t11 = $[9];
1450
1424
  }
1451
- const handleSelectKeys = t12;
1452
- let t13;
1453
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1454
- t13 = (value_1) => {
1425
+ const handleSelectKeys = t11;
1426
+ let t12;
1427
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1428
+ t12 = (value_1) => {
1455
1429
  setDisabledKeys(value_1);
1456
1430
  };
1457
- $[12] = t13;
1431
+ $[10] = t12;
1458
1432
  } else {
1459
- t13 = $[12];
1433
+ t12 = $[10];
1460
1434
  }
1461
- const handleDisabledKeys = t13;
1462
- let t14;
1463
- if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
1464
- t14 = () => {
1435
+ const handleDisabledKeys = t12;
1436
+ let t13;
1437
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1438
+ t13 = () => {
1465
1439
  setSelectKeys([]);
1466
1440
  };
1467
- $[13] = t14;
1441
+ $[11] = t13;
1468
1442
  } else {
1469
- t14 = $[13];
1443
+ t13 = $[11];
1470
1444
  }
1471
- const handleResetSelectKeys = t14;
1472
- let t15;
1473
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
1474
- t15 = (key, value_2) => {
1445
+ const handleResetSelectKeys = t13;
1446
+ let t14;
1447
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1448
+ t14 = (key, value_2) => {
1475
1449
  setValueSearch((prev_0) => {
1476
1450
  if (prev_0[key] === value_2) {
1477
1451
  return prev_0;
@@ -1487,73 +1461,69 @@ const useTable = (t0) => {
1487
1461
  return newState;
1488
1462
  });
1489
1463
  };
1490
- $[14] = t15;
1464
+ $[12] = t14;
1491
1465
  } else {
1492
- t15 = $[14];
1466
+ t14 = $[12];
1493
1467
  }
1494
- const handleSetValueSearch = t15;
1495
- let t16;
1496
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
1497
- t16 = (column) => {
1498
- setSortDescriptors((prev_1) => {
1499
- const existingIndex = prev_1.findIndex((s) => s.column === column);
1500
- if (existingIndex !== -1) {
1501
- const existing = prev_1[existingIndex];
1502
- if (existing.direction === "asc") {
1503
- const newSorts = [...prev_1];
1504
- newSorts[existingIndex] = {
1505
- ...existing,
1468
+ const handleSetValueSearch = t14;
1469
+ let t15;
1470
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
1471
+ t15 = (column) => {
1472
+ setSortDescriptor((prev_1) => {
1473
+ if (prev_1?.column === column) {
1474
+ if (prev_1.direction === "asc") {
1475
+ return {
1476
+ column,
1506
1477
  direction: "desc"
1507
1478
  };
1508
- return newSorts;
1509
1479
  } else {
1510
- return prev_1.filter((s_0) => s_0.column !== column);
1480
+ return null;
1511
1481
  }
1512
1482
  }
1513
- return [...prev_1, {
1483
+ return {
1514
1484
  column,
1515
1485
  direction: "asc"
1516
- }];
1486
+ };
1517
1487
  });
1518
1488
  };
1519
- $[15] = t16;
1489
+ $[13] = t15;
1520
1490
  } else {
1521
- t16 = $[15];
1491
+ t15 = $[13];
1522
1492
  }
1523
- const handleSort = t16;
1524
- let t17;
1525
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
1526
- t17 = (columnId, width) => {
1493
+ const handleSort = t15;
1494
+ let t16;
1495
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
1496
+ t16 = (columnId, width) => {
1527
1497
  setColumnWidths((prev_2) => ({
1528
1498
  ...prev_2,
1529
1499
  [columnId]: width
1530
1500
  }));
1531
1501
  };
1532
- $[16] = t17;
1502
+ $[14] = t16;
1533
1503
  } else {
1534
- t17 = $[16];
1504
+ t16 = $[14];
1535
1505
  }
1536
- const handleColumnResize = t17;
1537
- let t18;
1538
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
1539
- t18 = (columnId_0, width_0) => {
1506
+ const handleColumnResize = t16;
1507
+ let t17;
1508
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
1509
+ t17 = (columnId_0, width_0) => {
1540
1510
  setColumnWidths((prev_3) => ({
1541
1511
  ...prev_3,
1542
1512
  [columnId_0]: width_0
1543
1513
  }));
1544
1514
  };
1545
- $[17] = t18;
1515
+ $[15] = t17;
1546
1516
  } else {
1547
- t18 = $[17];
1517
+ t17 = $[15];
1548
1518
  }
1549
- const handleColumnResizeEnd = t18;
1550
- let t19;
1551
- if ($[18] !== columnWidths || $[19] !== disabledKeys || $[20] !== selectKeys || $[21] !== sortDescriptors || $[22] !== valueSearch) {
1552
- t19 = {
1519
+ const handleColumnResizeEnd = t17;
1520
+ let t18;
1521
+ if ($[16] !== columnWidths || $[17] !== disabledKeys || $[18] !== selectKeys || $[19] !== sortDescriptor || $[20] !== valueSearch) {
1522
+ t18 = {
1553
1523
  selectKeys,
1554
1524
  disabledKeys,
1555
1525
  valueSearch,
1556
- sortDescriptors,
1526
+ sortDescriptor,
1557
1527
  columnWidths,
1558
1528
  handleSelectKeys,
1559
1529
  handleSelectKey,
@@ -1564,16 +1534,16 @@ const useTable = (t0) => {
1564
1534
  handleColumnResize,
1565
1535
  handleColumnResizeEnd
1566
1536
  };
1567
- $[18] = columnWidths;
1568
- $[19] = disabledKeys;
1569
- $[20] = selectKeys;
1570
- $[21] = sortDescriptors;
1571
- $[22] = valueSearch;
1572
- $[23] = t19;
1537
+ $[16] = columnWidths;
1538
+ $[17] = disabledKeys;
1539
+ $[18] = selectKeys;
1540
+ $[19] = sortDescriptor;
1541
+ $[20] = valueSearch;
1542
+ $[21] = t18;
1573
1543
  } else {
1574
- t19 = $[23];
1544
+ t18 = $[21];
1575
1545
  }
1576
- return t19;
1546
+ return t18;
1577
1547
  };
1578
1548
  export {
1579
1549
  Table,