@skygraph/react 0.5.4 → 0.6.6

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.
Files changed (57) hide show
  1. package/README.md +70 -70
  2. package/dist/{Table-CMKo6Pc3.d.cts → Table-Bhlshbs2.d.cts} +39 -0
  3. package/dist/{Table-CAay8MmA.d.ts → Table-DOGK_njf.d.ts} +39 -0
  4. package/dist/{chunk-Y6XZ5TLD.js → chunk-B6BK5B64.js} +3 -3
  5. package/dist/chunk-B6BK5B64.js.map +1 -0
  6. package/dist/{chunk-PEX2UTNG.js → chunk-EA2J67A4.js} +2 -2
  7. package/dist/chunk-EA2J67A4.js.map +1 -0
  8. package/dist/{chunk-BNMJSYI2.js → chunk-EWUB2QCP.js} +2 -2
  9. package/dist/chunk-EWUB2QCP.js.map +1 -0
  10. package/dist/{chunk-7AA2JPZB.js → chunk-G4MRXKGC.js} +21 -14
  11. package/dist/chunk-G4MRXKGC.js.map +1 -0
  12. package/dist/{chunk-EFDB2ENB.js → chunk-MTHPDCO3.js} +8 -6
  13. package/dist/chunk-MTHPDCO3.js.map +1 -0
  14. package/dist/{chunk-KGFFQGCM.js → chunk-N4S66XHX.js} +8 -4
  15. package/dist/chunk-N4S66XHX.js.map +1 -0
  16. package/dist/{chunk-SEQI65CF.js → chunk-U7BXGUMC.js} +1 -1
  17. package/dist/chunk-U7BXGUMC.js.map +1 -0
  18. package/dist/{chunk-45YW5VSP.js → chunk-UCCGEZPJ.js} +2 -2
  19. package/dist/chunk-UCCGEZPJ.js.map +1 -0
  20. package/dist/{chunk-VLRLCHEL.js → chunk-YJZKXU5O.js} +1 -1
  21. package/dist/chunk-YJZKXU5O.js.map +1 -0
  22. package/dist/{chunk-ZJC2QUWA.js → chunk-YWCL3MUL.js} +1 -1
  23. package/dist/chunk-YWCL3MUL.js.map +1 -0
  24. package/dist/datagrid.cjs +3 -4
  25. package/dist/datagrid.cjs.map +1 -1
  26. package/dist/datagrid.js +4 -4
  27. package/dist/devtools.cjs.map +1 -1
  28. package/dist/devtools.js +1 -1
  29. package/dist/form.cjs.map +1 -1
  30. package/dist/form.js +3 -3
  31. package/dist/index.cjs +1239 -255
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +16 -4
  34. package/dist/index.d.ts +16 -4
  35. package/dist/index.js +1113 -150
  36. package/dist/index.js.map +1 -1
  37. package/dist/table.cjs +17 -10
  38. package/dist/table.cjs.map +1 -1
  39. package/dist/table.d.cts +1 -1
  40. package/dist/table.d.ts +1 -1
  41. package/dist/table.js +4 -4
  42. package/dist/tree.cjs +11 -7
  43. package/dist/tree.cjs.map +1 -1
  44. package/dist/tree.js +3 -3
  45. package/dist/virtual.cjs.map +1 -1
  46. package/dist/virtual.js +2 -2
  47. package/package.json +2 -2
  48. package/dist/chunk-45YW5VSP.js.map +0 -1
  49. package/dist/chunk-7AA2JPZB.js.map +0 -1
  50. package/dist/chunk-BNMJSYI2.js.map +0 -1
  51. package/dist/chunk-EFDB2ENB.js.map +0 -1
  52. package/dist/chunk-KGFFQGCM.js.map +0 -1
  53. package/dist/chunk-PEX2UTNG.js.map +0 -1
  54. package/dist/chunk-SEQI65CF.js.map +0 -1
  55. package/dist/chunk-VLRLCHEL.js.map +0 -1
  56. package/dist/chunk-Y6XZ5TLD.js.map +0 -1
  57. package/dist/chunk-ZJC2QUWA.js.map +0 -1
@@ -2,14 +2,14 @@ import {
2
2
  Button,
3
3
  Input,
4
4
  Transition
5
- } from "./chunk-45YW5VSP.js";
5
+ } from "./chunk-UCCGEZPJ.js";
6
6
  import {
7
7
  Checkbox
8
- } from "./chunk-PEX2UTNG.js";
8
+ } from "./chunk-EA2J67A4.js";
9
9
  import {
10
10
  Spin,
11
11
  useConfig
12
- } from "./chunk-VLRLCHEL.js";
12
+ } from "./chunk-YJZKXU5O.js";
13
13
 
14
14
  // src/components/ui/Pagination.tsx
15
15
  import { useState } from "react";
@@ -2477,7 +2477,12 @@ function useTableState(props) {
2477
2477
  setColumnWidth: persistColumnWidth,
2478
2478
  refresh
2479
2479
  } = useTable(tableOptions);
2480
- const t = useMemo3(() => ({ ...DEFAULT_LOCALE, ...locale }), [locale]);
2480
+ const config = useConfig();
2481
+ const configTableLocale = config.locale?.table;
2482
+ const t = useMemo3(
2483
+ () => ({ ...DEFAULT_LOCALE, ...configTableLocale, ...locale }),
2484
+ [configTableLocale, locale]
2485
+ );
2481
2486
  const hasColumnGroups = columnsProp.some((c) => c.children && c.children.length > 0);
2482
2487
  const leafColumns = useMemo3(() => flattenLeafColumns(columnsProp), [columnsProp]);
2483
2488
  const headerRows = useMemo3(
@@ -2654,9 +2659,8 @@ function useTableState(props) {
2654
2659
  } else {
2655
2660
  next = sorts.filter((s) => s.column !== col.key);
2656
2661
  }
2657
- if (onSortsChange) {
2658
- onSortsChange(next);
2659
- } else {
2662
+ onSortsChange?.(next);
2663
+ if (controlledSorts === void 0) {
2660
2664
  setInternalSorts(next);
2661
2665
  }
2662
2666
  if (next.length === 0) {
@@ -2665,7 +2669,7 @@ function useTableState(props) {
2665
2669
  setSorts(next);
2666
2670
  }
2667
2671
  } else {
2668
- const current = sorts.length === 1 ? sorts[0] : null;
2672
+ const current = sorts.find((s) => s.column === col.key) ?? null;
2669
2673
  let next;
2670
2674
  if (!current || current.column !== col.key) {
2671
2675
  next = [{ column: col.key, direction: "asc" }];
@@ -2674,9 +2678,8 @@ function useTableState(props) {
2674
2678
  } else {
2675
2679
  next = [];
2676
2680
  }
2677
- if (onSortsChange) {
2678
- onSortsChange(next);
2679
- } else {
2681
+ onSortsChange?.(next);
2682
+ if (controlledSorts === void 0) {
2680
2683
  setInternalSorts(next);
2681
2684
  }
2682
2685
  if (next.length === 0) {
@@ -2686,7 +2689,7 @@ function useTableState(props) {
2686
2689
  }
2687
2690
  }
2688
2691
  },
2689
- [multiSort, sorts, onSortsChange, setSort, setSorts, clearSort]
2692
+ [multiSort, sorts, controlledSorts, onSortsChange, setSort, setSorts, clearSort]
2690
2693
  );
2691
2694
  const getSortIndex = useCallback3(
2692
2695
  (colKey) => {
@@ -2782,10 +2785,14 @@ function useTableState(props) {
2782
2785
  e.preventDefault();
2783
2786
  e.stopPropagation();
2784
2787
  resizeCleanupRef.current?.();
2788
+ const handle = e.currentTarget;
2789
+ const th = handle.closest(".sg-table-th");
2790
+ const measuredW = th?.getBoundingClientRect().width;
2791
+ const startW = measuredW && Number.isFinite(measuredW) ? measuredW : colWidths[colKey] ?? DEFAULT_COL_WIDTH;
2785
2792
  resizeRef.current = {
2786
2793
  col: colKey,
2787
2794
  startX: e.clientX,
2788
- startW: colWidths[colKey] ?? DEFAULT_COL_WIDTH
2795
+ startW
2789
2796
  };
2790
2797
  const onMove = (ev) => {
2791
2798
  const ref = resizeRef.current;
@@ -3878,4 +3885,4 @@ export {
3878
3885
  printElement,
3879
3886
  Table
3880
3887
  };
3881
- //# sourceMappingURL=chunk-7AA2JPZB.js.map
3888
+ //# sourceMappingURL=chunk-G4MRXKGC.js.map