next-data-kit 9.0.2 → 9.1.0
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 +56 -0
- package/dist/client/components/data-kit-table.d.ts +4 -0
- package/dist/client/components/data-kit-table.d.ts.map +1 -1
- package/dist/client/components/data-kit-table.js +14 -7
- package/dist/client/components/data-kit-table.js.map +1 -1
- package/dist/index.cjs +13 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1238,7 +1238,8 @@ var DataKitRoot = (props) => {
|
|
|
1238
1238
|
refetchInterval,
|
|
1239
1239
|
memory: memoryMode = "memory",
|
|
1240
1240
|
pagination: paginationType = "NUMBER",
|
|
1241
|
-
controller
|
|
1241
|
+
controller,
|
|
1242
|
+
sorts: defaultSorts = []
|
|
1242
1243
|
} = props;
|
|
1243
1244
|
const tableRef = useRef(null);
|
|
1244
1245
|
const intervalRef = useRef(null);
|
|
@@ -1270,12 +1271,17 @@ var DataKitRoot = (props) => {
|
|
|
1270
1271
|
initial: {
|
|
1271
1272
|
limit: limitConfig?.default ?? 10,
|
|
1272
1273
|
query: query ?? {},
|
|
1273
|
-
sorts:
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1274
|
+
sorts: (() => {
|
|
1275
|
+
const columnSorts = columns.reduce((acc, col) => {
|
|
1276
|
+
if (col.sortable && col.sortable.default !== 0) {
|
|
1277
|
+
acc.push({ path: col.sortable.path, value: col.sortable.default });
|
|
1278
|
+
}
|
|
1279
|
+
return acc;
|
|
1280
|
+
}, []);
|
|
1281
|
+
const columnPaths = new Set(columnSorts.map((s) => s.path));
|
|
1282
|
+
const additionalSorts = defaultSorts.filter((s) => !columnPaths.has(s.path));
|
|
1283
|
+
return [...columnSorts, ...additionalSorts];
|
|
1284
|
+
})(),
|
|
1279
1285
|
filter: filters.reduce((acc, f) => {
|
|
1280
1286
|
if (f.defaultValue !== void 0) acc[f.id] = f.defaultValue;
|
|
1281
1287
|
return acc;
|