@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.
- package/README.md +70 -70
- package/dist/{Table-CMKo6Pc3.d.cts → Table-Bhlshbs2.d.cts} +39 -0
- package/dist/{Table-CAay8MmA.d.ts → Table-DOGK_njf.d.ts} +39 -0
- package/dist/{chunk-Y6XZ5TLD.js → chunk-B6BK5B64.js} +3 -3
- package/dist/chunk-B6BK5B64.js.map +1 -0
- package/dist/{chunk-PEX2UTNG.js → chunk-EA2J67A4.js} +2 -2
- package/dist/chunk-EA2J67A4.js.map +1 -0
- package/dist/{chunk-BNMJSYI2.js → chunk-EWUB2QCP.js} +2 -2
- package/dist/chunk-EWUB2QCP.js.map +1 -0
- package/dist/{chunk-7AA2JPZB.js → chunk-G4MRXKGC.js} +21 -14
- package/dist/chunk-G4MRXKGC.js.map +1 -0
- package/dist/{chunk-EFDB2ENB.js → chunk-MTHPDCO3.js} +8 -6
- package/dist/chunk-MTHPDCO3.js.map +1 -0
- package/dist/{chunk-KGFFQGCM.js → chunk-N4S66XHX.js} +8 -4
- package/dist/chunk-N4S66XHX.js.map +1 -0
- package/dist/{chunk-SEQI65CF.js → chunk-U7BXGUMC.js} +1 -1
- package/dist/chunk-U7BXGUMC.js.map +1 -0
- package/dist/{chunk-45YW5VSP.js → chunk-UCCGEZPJ.js} +2 -2
- package/dist/chunk-UCCGEZPJ.js.map +1 -0
- package/dist/{chunk-VLRLCHEL.js → chunk-YJZKXU5O.js} +1 -1
- package/dist/chunk-YJZKXU5O.js.map +1 -0
- package/dist/{chunk-ZJC2QUWA.js → chunk-YWCL3MUL.js} +1 -1
- package/dist/chunk-YWCL3MUL.js.map +1 -0
- package/dist/datagrid.cjs +3 -4
- package/dist/datagrid.cjs.map +1 -1
- package/dist/datagrid.js +4 -4
- package/dist/devtools.cjs.map +1 -1
- package/dist/devtools.js +1 -1
- package/dist/form.cjs.map +1 -1
- package/dist/form.js +3 -3
- package/dist/index.cjs +1239 -255
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +1113 -150
- package/dist/index.js.map +1 -1
- package/dist/table.cjs +17 -10
- package/dist/table.cjs.map +1 -1
- package/dist/table.d.cts +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.js +4 -4
- package/dist/tree.cjs +11 -7
- package/dist/tree.cjs.map +1 -1
- package/dist/tree.js +3 -3
- package/dist/virtual.cjs.map +1 -1
- package/dist/virtual.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-45YW5VSP.js.map +0 -1
- package/dist/chunk-7AA2JPZB.js.map +0 -1
- package/dist/chunk-BNMJSYI2.js.map +0 -1
- package/dist/chunk-EFDB2ENB.js.map +0 -1
- package/dist/chunk-KGFFQGCM.js.map +0 -1
- package/dist/chunk-PEX2UTNG.js.map +0 -1
- package/dist/chunk-SEQI65CF.js.map +0 -1
- package/dist/chunk-VLRLCHEL.js.map +0 -1
- package/dist/chunk-Y6XZ5TLD.js.map +0 -1
- package/dist/chunk-ZJC2QUWA.js.map +0 -1
package/dist/table.cjs
CHANGED
|
@@ -2788,7 +2788,12 @@ function useTableState(props) {
|
|
|
2788
2788
|
setColumnWidth: persistColumnWidth,
|
|
2789
2789
|
refresh
|
|
2790
2790
|
} = useTable(tableOptions);
|
|
2791
|
-
const
|
|
2791
|
+
const config = useConfig();
|
|
2792
|
+
const configTableLocale = config.locale?.table;
|
|
2793
|
+
const t = (0, import_react13.useMemo)(
|
|
2794
|
+
() => ({ ...DEFAULT_LOCALE, ...configTableLocale, ...locale }),
|
|
2795
|
+
[configTableLocale, locale]
|
|
2796
|
+
);
|
|
2792
2797
|
const hasColumnGroups = columnsProp.some((c) => c.children && c.children.length > 0);
|
|
2793
2798
|
const leafColumns = (0, import_react13.useMemo)(() => flattenLeafColumns(columnsProp), [columnsProp]);
|
|
2794
2799
|
const headerRows = (0, import_react13.useMemo)(
|
|
@@ -2965,9 +2970,8 @@ function useTableState(props) {
|
|
|
2965
2970
|
} else {
|
|
2966
2971
|
next = sorts.filter((s) => s.column !== col.key);
|
|
2967
2972
|
}
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
} else {
|
|
2973
|
+
onSortsChange?.(next);
|
|
2974
|
+
if (controlledSorts === void 0) {
|
|
2971
2975
|
setInternalSorts(next);
|
|
2972
2976
|
}
|
|
2973
2977
|
if (next.length === 0) {
|
|
@@ -2976,7 +2980,7 @@ function useTableState(props) {
|
|
|
2976
2980
|
setSorts(next);
|
|
2977
2981
|
}
|
|
2978
2982
|
} else {
|
|
2979
|
-
const current = sorts.
|
|
2983
|
+
const current = sorts.find((s) => s.column === col.key) ?? null;
|
|
2980
2984
|
let next;
|
|
2981
2985
|
if (!current || current.column !== col.key) {
|
|
2982
2986
|
next = [{ column: col.key, direction: "asc" }];
|
|
@@ -2985,9 +2989,8 @@ function useTableState(props) {
|
|
|
2985
2989
|
} else {
|
|
2986
2990
|
next = [];
|
|
2987
2991
|
}
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
} else {
|
|
2992
|
+
onSortsChange?.(next);
|
|
2993
|
+
if (controlledSorts === void 0) {
|
|
2991
2994
|
setInternalSorts(next);
|
|
2992
2995
|
}
|
|
2993
2996
|
if (next.length === 0) {
|
|
@@ -2997,7 +3000,7 @@ function useTableState(props) {
|
|
|
2997
3000
|
}
|
|
2998
3001
|
}
|
|
2999
3002
|
},
|
|
3000
|
-
[multiSort, sorts, onSortsChange, setSort, setSorts, clearSort]
|
|
3003
|
+
[multiSort, sorts, controlledSorts, onSortsChange, setSort, setSorts, clearSort]
|
|
3001
3004
|
);
|
|
3002
3005
|
const getSortIndex = (0, import_react13.useCallback)(
|
|
3003
3006
|
(colKey) => {
|
|
@@ -3093,10 +3096,14 @@ function useTableState(props) {
|
|
|
3093
3096
|
e.preventDefault();
|
|
3094
3097
|
e.stopPropagation();
|
|
3095
3098
|
resizeCleanupRef.current?.();
|
|
3099
|
+
const handle = e.currentTarget;
|
|
3100
|
+
const th = handle.closest(".sg-table-th");
|
|
3101
|
+
const measuredW = th?.getBoundingClientRect().width;
|
|
3102
|
+
const startW = measuredW && Number.isFinite(measuredW) ? measuredW : colWidths[colKey] ?? DEFAULT_COL_WIDTH;
|
|
3096
3103
|
resizeRef.current = {
|
|
3097
3104
|
col: colKey,
|
|
3098
3105
|
startX: e.clientX,
|
|
3099
|
-
startW
|
|
3106
|
+
startW
|
|
3100
3107
|
};
|
|
3101
3108
|
const onMove = (ev) => {
|
|
3102
3109
|
const ref = resizeRef.current;
|