lizaui 9.0.58 → 9.0.61

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