tinybase 9.0.0 → 9.1.0-beta.1
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/@types/common/index.d.ts +17 -2
- package/@types/common/with-schemas/index.d.ts +18 -2
- package/@types/store/index.d.ts +37 -7
- package/@types/store/with-schemas/index.d.ts +38 -7
- package/@types/ui-react/index.d.ts +6 -2
- package/@types/ui-react/with-schemas/index.d.ts +7 -2
- package/@types/ui-react-dom/index.d.ts +10 -10
- package/@types/ui-react-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-react-dom-charts/index.d.ts +7 -7
- package/@types/ui-react-dom-charts/with-schemas/index.d.ts +7 -7
- package/@types/ui-react-inspector/index.d.ts +1 -1
- package/@types/ui-react-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-solid/index.d.ts +9 -2
- package/@types/ui-solid/with-schemas/index.d.ts +10 -2
- package/@types/ui-solid-dom/index.d.ts +10 -10
- package/@types/ui-solid-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-solid-inspector/index.d.ts +1 -1
- package/@types/ui-solid-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-svelte/index.d.ts +50 -2
- package/@types/ui-svelte/with-schemas/index.d.ts +88 -25
- package/@types/ui-svelte-dom/index.d.ts +10 -10
- package/@types/ui-svelte-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-svelte-inspector/index.d.ts +1 -1
- package/@types/ui-svelte-inspector/with-schemas/index.d.ts +1 -1
- package/index.js +34 -6
- package/mergeable-store/index.js +34 -6
- package/mergeable-store/with-schemas/index.js +34 -6
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/mergeable-store/index.js +1 -1
- package/min/mergeable-store/index.js.gz +0 -0
- package/min/mergeable-store/with-schemas/index.js +1 -1
- package/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/min/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/min/store/index.js +1 -1
- package/min/store/index.js.gz +0 -0
- package/min/store/with-schemas/index.js +1 -1
- package/min/store/with-schemas/index.js.gz +0 -0
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom/index.js +1 -1
- package/min/ui-react-dom/index.js.gz +0 -0
- package/min/ui-react-dom/with-schemas/index.js +1 -1
- package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom-charts/index.js +1 -1
- package/min/ui-react-dom-charts/index.js.gz +0 -0
- package/min/ui-react-dom-charts/with-schemas/index.js +1 -1
- package/min/ui-react-dom-charts/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/min/ui-solid/index.js +1 -1
- package/min/ui-solid/index.js.gz +0 -0
- package/min/ui-solid/with-schemas/index.js +1 -1
- package/min/ui-solid/with-schemas/index.js.gz +0 -0
- package/min/ui-solid-dom/index.js +1 -1
- package/min/ui-solid-dom/index.js.gz +0 -0
- package/min/ui-solid-dom/with-schemas/index.js +1 -1
- package/min/ui-solid-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-solid-inspector/index.js +1 -1
- package/min/ui-solid-inspector/index.js.gz +0 -0
- package/min/ui-solid-inspector/with-schemas/index.js +1 -1
- package/min/ui-solid-inspector/with-schemas/index.js.gz +0 -0
- package/min/ui-svelte/index.js +1 -1
- package/min/ui-svelte/index.js.gz +0 -0
- package/min/ui-svelte/with-schemas/index.js +1 -1
- package/min/ui-svelte/with-schemas/index.js.gz +0 -0
- package/min/ui-svelte-dom/index.js +1 -1
- package/min/ui-svelte-dom/index.js.gz +0 -0
- package/min/ui-svelte-dom/with-schemas/index.js +1 -1
- package/min/ui-svelte-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-svelte-inspector/index.js +1 -1
- package/min/ui-svelte-inspector/index.js.gz +0 -0
- package/min/ui-svelte-inspector/with-schemas/index.js +1 -1
- package/min/ui-svelte-inspector/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/omni/index.js +34 -6
- package/omni/with-schemas/index.js +34 -6
- package/package.json +3 -3
- package/readme.md +14 -14
- package/releases.md +59 -59
- package/store/index.js +34 -6
- package/store/with-schemas/index.js +34 -6
- package/ui-react/index.js +36 -6
- package/ui-react/with-schemas/index.js +36 -6
- package/ui-react-dom/index.js +24 -4
- package/ui-react-dom/with-schemas/index.js +24 -4
- package/ui-react-dom-charts/index.js +24 -4
- package/ui-react-dom-charts/with-schemas/index.js +24 -4
- package/ui-react-inspector/index.js +58 -10
- package/ui-react-inspector/with-schemas/index.js +58 -10
- package/ui-solid/index.js +32 -2
- package/ui-solid/with-schemas/index.js +32 -2
- package/ui-solid-dom/index.js +17 -1
- package/ui-solid-dom/with-schemas/index.js +17 -1
- package/ui-solid-inspector/index.js +51 -7
- package/ui-solid-inspector/with-schemas/index.js +51 -7
- package/ui-svelte/index.js +73 -31
- package/ui-svelte/with-schemas/index.js +73 -31
- package/ui-svelte-dom/index.js +35 -14
- package/ui-svelte-dom/with-schemas/index.js +35 -14
- package/ui-svelte-inspector/index.js +69 -20
- package/ui-svelte-inspector/with-schemas/index.js +69 -20
- package/with-schemas/index.js +34 -6
package/store/index.js
CHANGED
|
@@ -1314,13 +1314,36 @@ const createStore = () => {
|
|
|
1314
1314
|
listener,
|
|
1315
1315
|
mutator,
|
|
1316
1316
|
) => {
|
|
1317
|
-
|
|
1317
|
+
const [descending, offset, limit, sorter] = otherArgs;
|
|
1318
|
+
let sortedRowIds = getSortedRowIds(
|
|
1319
|
+
tableId,
|
|
1320
|
+
cellId,
|
|
1321
|
+
descending,
|
|
1322
|
+
offset,
|
|
1323
|
+
limit,
|
|
1324
|
+
sorter,
|
|
1325
|
+
);
|
|
1318
1326
|
return addListener(
|
|
1319
1327
|
() => {
|
|
1320
|
-
const newSortedRowIds = getSortedRowIds(
|
|
1328
|
+
const newSortedRowIds = getSortedRowIds(
|
|
1329
|
+
tableId,
|
|
1330
|
+
cellId,
|
|
1331
|
+
descending,
|
|
1332
|
+
offset,
|
|
1333
|
+
limit,
|
|
1334
|
+
sorter,
|
|
1335
|
+
);
|
|
1321
1336
|
if (!arrayIsEqual(newSortedRowIds, sortedRowIds)) {
|
|
1322
1337
|
sortedRowIds = newSortedRowIds;
|
|
1323
|
-
listener(
|
|
1338
|
+
listener(
|
|
1339
|
+
store,
|
|
1340
|
+
tableId,
|
|
1341
|
+
cellId,
|
|
1342
|
+
descending,
|
|
1343
|
+
offset,
|
|
1344
|
+
limit,
|
|
1345
|
+
sortedRowIds,
|
|
1346
|
+
);
|
|
1324
1347
|
}
|
|
1325
1348
|
},
|
|
1326
1349
|
sortedRowIdsListeners[mutator ? 1 : 0],
|
|
@@ -1374,6 +1397,7 @@ const createStore = () => {
|
|
|
1374
1397
|
descending,
|
|
1375
1398
|
offset = 0,
|
|
1376
1399
|
limit,
|
|
1400
|
+
sorter = defaultSorter,
|
|
1377
1401
|
) =>
|
|
1378
1402
|
isObject(tableIdOrArgs)
|
|
1379
1403
|
? getSortedRowIds(
|
|
@@ -1382,16 +1406,19 @@ const createStore = () => {
|
|
|
1382
1406
|
tableIdOrArgs.descending,
|
|
1383
1407
|
tableIdOrArgs.offset,
|
|
1384
1408
|
tableIdOrArgs.limit,
|
|
1409
|
+
tableIdOrArgs.sorter,
|
|
1385
1410
|
)
|
|
1386
1411
|
: arrayMap(
|
|
1387
1412
|
slice(
|
|
1388
1413
|
arraySort(
|
|
1389
1414
|
mapMap(mapGet(tablesMap, id(tableIdOrArgs)), (row, rowId) => [
|
|
1390
|
-
isUndefined(cellId)
|
|
1415
|
+
isUndefined(cellId)
|
|
1416
|
+
? rowId
|
|
1417
|
+
: decodeIfJson(mapGet(row, id(cellId))),
|
|
1391
1418
|
rowId,
|
|
1392
1419
|
]),
|
|
1393
1420
|
([cell1], [cell2]) =>
|
|
1394
|
-
|
|
1421
|
+
sorter(cell1, cell2) * (descending ? -1 : 1),
|
|
1395
1422
|
),
|
|
1396
1423
|
offset,
|
|
1397
1424
|
isUndefined(limit) ? limit : offset + limit,
|
|
@@ -1869,6 +1896,7 @@ const createStore = () => {
|
|
|
1869
1896
|
tableIdOrArgs.descending ?? false,
|
|
1870
1897
|
tableIdOrArgs.offset ?? 0,
|
|
1871
1898
|
tableIdOrArgs.limit,
|
|
1899
|
+
tableIdOrArgs.sorter,
|
|
1872
1900
|
],
|
|
1873
1901
|
cellIdOrListener,
|
|
1874
1902
|
descendingOrMutator,
|
|
@@ -1876,7 +1904,7 @@ const createStore = () => {
|
|
|
1876
1904
|
: addSortedRowIdsListenerImpl(
|
|
1877
1905
|
tableIdOrArgs,
|
|
1878
1906
|
cellIdOrListener,
|
|
1879
|
-
[descendingOrMutator, offset, limit],
|
|
1907
|
+
[descendingOrMutator, offset, limit, void 0],
|
|
1880
1908
|
listener,
|
|
1881
1909
|
mutator,
|
|
1882
1910
|
);
|
|
@@ -1314,13 +1314,36 @@ const createStore = () => {
|
|
|
1314
1314
|
listener,
|
|
1315
1315
|
mutator,
|
|
1316
1316
|
) => {
|
|
1317
|
-
|
|
1317
|
+
const [descending, offset, limit, sorter] = otherArgs;
|
|
1318
|
+
let sortedRowIds = getSortedRowIds(
|
|
1319
|
+
tableId,
|
|
1320
|
+
cellId,
|
|
1321
|
+
descending,
|
|
1322
|
+
offset,
|
|
1323
|
+
limit,
|
|
1324
|
+
sorter,
|
|
1325
|
+
);
|
|
1318
1326
|
return addListener(
|
|
1319
1327
|
() => {
|
|
1320
|
-
const newSortedRowIds = getSortedRowIds(
|
|
1328
|
+
const newSortedRowIds = getSortedRowIds(
|
|
1329
|
+
tableId,
|
|
1330
|
+
cellId,
|
|
1331
|
+
descending,
|
|
1332
|
+
offset,
|
|
1333
|
+
limit,
|
|
1334
|
+
sorter,
|
|
1335
|
+
);
|
|
1321
1336
|
if (!arrayIsEqual(newSortedRowIds, sortedRowIds)) {
|
|
1322
1337
|
sortedRowIds = newSortedRowIds;
|
|
1323
|
-
listener(
|
|
1338
|
+
listener(
|
|
1339
|
+
store,
|
|
1340
|
+
tableId,
|
|
1341
|
+
cellId,
|
|
1342
|
+
descending,
|
|
1343
|
+
offset,
|
|
1344
|
+
limit,
|
|
1345
|
+
sortedRowIds,
|
|
1346
|
+
);
|
|
1324
1347
|
}
|
|
1325
1348
|
},
|
|
1326
1349
|
sortedRowIdsListeners[mutator ? 1 : 0],
|
|
@@ -1374,6 +1397,7 @@ const createStore = () => {
|
|
|
1374
1397
|
descending,
|
|
1375
1398
|
offset = 0,
|
|
1376
1399
|
limit,
|
|
1400
|
+
sorter = defaultSorter,
|
|
1377
1401
|
) =>
|
|
1378
1402
|
isObject(tableIdOrArgs)
|
|
1379
1403
|
? getSortedRowIds(
|
|
@@ -1382,16 +1406,19 @@ const createStore = () => {
|
|
|
1382
1406
|
tableIdOrArgs.descending,
|
|
1383
1407
|
tableIdOrArgs.offset,
|
|
1384
1408
|
tableIdOrArgs.limit,
|
|
1409
|
+
tableIdOrArgs.sorter,
|
|
1385
1410
|
)
|
|
1386
1411
|
: arrayMap(
|
|
1387
1412
|
slice(
|
|
1388
1413
|
arraySort(
|
|
1389
1414
|
mapMap(mapGet(tablesMap, id(tableIdOrArgs)), (row, rowId) => [
|
|
1390
|
-
isUndefined(cellId)
|
|
1415
|
+
isUndefined(cellId)
|
|
1416
|
+
? rowId
|
|
1417
|
+
: decodeIfJson(mapGet(row, id(cellId))),
|
|
1391
1418
|
rowId,
|
|
1392
1419
|
]),
|
|
1393
1420
|
([cell1], [cell2]) =>
|
|
1394
|
-
|
|
1421
|
+
sorter(cell1, cell2) * (descending ? -1 : 1),
|
|
1395
1422
|
),
|
|
1396
1423
|
offset,
|
|
1397
1424
|
isUndefined(limit) ? limit : offset + limit,
|
|
@@ -1869,6 +1896,7 @@ const createStore = () => {
|
|
|
1869
1896
|
tableIdOrArgs.descending ?? false,
|
|
1870
1897
|
tableIdOrArgs.offset ?? 0,
|
|
1871
1898
|
tableIdOrArgs.limit,
|
|
1899
|
+
tableIdOrArgs.sorter,
|
|
1872
1900
|
],
|
|
1873
1901
|
cellIdOrListener,
|
|
1874
1902
|
descendingOrMutator,
|
|
@@ -1876,7 +1904,7 @@ const createStore = () => {
|
|
|
1876
1904
|
: addSortedRowIdsListenerImpl(
|
|
1877
1905
|
tableIdOrArgs,
|
|
1878
1906
|
cellIdOrListener,
|
|
1879
|
-
[descendingOrMutator, offset, limit],
|
|
1907
|
+
[descendingOrMutator, offset, limit, void 0],
|
|
1880
1908
|
listener,
|
|
1881
1909
|
mutator,
|
|
1882
1910
|
);
|
package/ui-react/index.js
CHANGED
|
@@ -536,33 +536,56 @@ const useSortedRowIdsImpl = (
|
|
|
536
536
|
descending,
|
|
537
537
|
offset,
|
|
538
538
|
limit,
|
|
539
|
+
sorter,
|
|
539
540
|
storeOrStoreId,
|
|
540
|
-
) =>
|
|
541
|
-
|
|
541
|
+
) => {
|
|
542
|
+
const sortedRowIdsArgs = useMemo(
|
|
543
|
+
() => ({
|
|
544
|
+
tableId,
|
|
545
|
+
cellId,
|
|
546
|
+
descending: descending ?? false,
|
|
547
|
+
offset: offset ?? 0,
|
|
548
|
+
limit,
|
|
549
|
+
sorter,
|
|
550
|
+
}),
|
|
551
|
+
[tableId, cellId, descending, offset, limit, sorter],
|
|
552
|
+
);
|
|
553
|
+
return useListenable(
|
|
542
554
|
SORTED_ROW_IDS,
|
|
543
555
|
useStoreOrStoreById(storeOrStoreId),
|
|
544
556
|
1 /* Array */,
|
|
545
|
-
|
|
557
|
+
isUndefined(sorter)
|
|
558
|
+
? [tableId, cellId, descending, offset, limit]
|
|
559
|
+
: [sortedRowIdsArgs],
|
|
546
560
|
);
|
|
561
|
+
};
|
|
547
562
|
const useSortedRowIdsListenerImpl = (
|
|
548
563
|
tableId,
|
|
549
564
|
cellId,
|
|
550
565
|
descending,
|
|
551
566
|
offset,
|
|
552
567
|
limit,
|
|
568
|
+
sorter,
|
|
553
569
|
listener,
|
|
554
570
|
listenerDeps,
|
|
555
571
|
mutator,
|
|
556
572
|
storeOrStoreId,
|
|
557
|
-
) =>
|
|
573
|
+
) => {
|
|
574
|
+
const sortedRowIdsArgs = useMemo(
|
|
575
|
+
() => ({tableId, cellId, descending, offset, limit, sorter}),
|
|
576
|
+
[tableId, cellId, descending, offset, limit, sorter],
|
|
577
|
+
);
|
|
558
578
|
useListener(
|
|
559
579
|
SORTED_ROW_IDS,
|
|
560
580
|
useStoreOrStoreById(storeOrStoreId),
|
|
561
581
|
listener,
|
|
562
582
|
listenerDeps,
|
|
563
|
-
|
|
583
|
+
isUndefined(sorter)
|
|
584
|
+
? [tableId, cellId, descending, offset, limit]
|
|
585
|
+
: [sortedRowIdsArgs],
|
|
564
586
|
mutator,
|
|
565
587
|
);
|
|
588
|
+
};
|
|
566
589
|
const useCreateStore = (create, createDeps = EMPTY_ARRAY) =>
|
|
567
590
|
useMemo(create, createDeps);
|
|
568
591
|
const useStoreIds = () => useThingIds(OFFSET_STORE);
|
|
@@ -632,6 +655,7 @@ const useSortedRowIds = (
|
|
|
632
655
|
descending,
|
|
633
656
|
offset,
|
|
634
657
|
limit,
|
|
658
|
+
sorterOrStoreOrStoreId,
|
|
635
659
|
storeOrStoreId,
|
|
636
660
|
) =>
|
|
637
661
|
useSortedRowIdsImpl(
|
|
@@ -642,6 +666,7 @@ const useSortedRowIds = (
|
|
|
642
666
|
tableIdOrArgs.descending ?? false,
|
|
643
667
|
tableIdOrArgs.offset ?? 0,
|
|
644
668
|
tableIdOrArgs.limit,
|
|
669
|
+
tableIdOrArgs.sorter,
|
|
645
670
|
cellIdOrStoreOrStoreId,
|
|
646
671
|
]
|
|
647
672
|
: [
|
|
@@ -650,7 +675,10 @@ const useSortedRowIds = (
|
|
|
650
675
|
descending,
|
|
651
676
|
offset,
|
|
652
677
|
limit,
|
|
653
|
-
|
|
678
|
+
isFunction(sorterOrStoreOrStoreId) ? sorterOrStoreOrStoreId : void 0,
|
|
679
|
+
isFunction(sorterOrStoreOrStoreId)
|
|
680
|
+
? storeOrStoreId
|
|
681
|
+
: sorterOrStoreOrStoreId,
|
|
654
682
|
]),
|
|
655
683
|
);
|
|
656
684
|
const useHasRow = (tableId, rowId, storeOrStoreId) =>
|
|
@@ -1057,6 +1085,7 @@ const useSortedRowIdsListener = (
|
|
|
1057
1085
|
tableIdOrArgs.descending ?? false,
|
|
1058
1086
|
tableIdOrArgs.offset ?? 0,
|
|
1059
1087
|
tableIdOrArgs.limit,
|
|
1088
|
+
tableIdOrArgs.sorter,
|
|
1060
1089
|
cellIdOrListener,
|
|
1061
1090
|
descendingOrListenerDeps,
|
|
1062
1091
|
offsetOrMutator,
|
|
@@ -1068,6 +1097,7 @@ const useSortedRowIdsListener = (
|
|
|
1068
1097
|
descendingOrListenerDeps,
|
|
1069
1098
|
offsetOrMutator,
|
|
1070
1099
|
limitOrStoreOrStoreId,
|
|
1100
|
+
void 0,
|
|
1071
1101
|
listener,
|
|
1072
1102
|
listenerDeps,
|
|
1073
1103
|
mutator,
|
|
@@ -536,33 +536,56 @@ const useSortedRowIdsImpl = (
|
|
|
536
536
|
descending,
|
|
537
537
|
offset,
|
|
538
538
|
limit,
|
|
539
|
+
sorter,
|
|
539
540
|
storeOrStoreId,
|
|
540
|
-
) =>
|
|
541
|
-
|
|
541
|
+
) => {
|
|
542
|
+
const sortedRowIdsArgs = useMemo(
|
|
543
|
+
() => ({
|
|
544
|
+
tableId,
|
|
545
|
+
cellId,
|
|
546
|
+
descending: descending ?? false,
|
|
547
|
+
offset: offset ?? 0,
|
|
548
|
+
limit,
|
|
549
|
+
sorter,
|
|
550
|
+
}),
|
|
551
|
+
[tableId, cellId, descending, offset, limit, sorter],
|
|
552
|
+
);
|
|
553
|
+
return useListenable(
|
|
542
554
|
SORTED_ROW_IDS,
|
|
543
555
|
useStoreOrStoreById(storeOrStoreId),
|
|
544
556
|
1 /* Array */,
|
|
545
|
-
|
|
557
|
+
isUndefined(sorter)
|
|
558
|
+
? [tableId, cellId, descending, offset, limit]
|
|
559
|
+
: [sortedRowIdsArgs],
|
|
546
560
|
);
|
|
561
|
+
};
|
|
547
562
|
const useSortedRowIdsListenerImpl = (
|
|
548
563
|
tableId,
|
|
549
564
|
cellId,
|
|
550
565
|
descending,
|
|
551
566
|
offset,
|
|
552
567
|
limit,
|
|
568
|
+
sorter,
|
|
553
569
|
listener,
|
|
554
570
|
listenerDeps,
|
|
555
571
|
mutator,
|
|
556
572
|
storeOrStoreId,
|
|
557
|
-
) =>
|
|
573
|
+
) => {
|
|
574
|
+
const sortedRowIdsArgs = useMemo(
|
|
575
|
+
() => ({tableId, cellId, descending, offset, limit, sorter}),
|
|
576
|
+
[tableId, cellId, descending, offset, limit, sorter],
|
|
577
|
+
);
|
|
558
578
|
useListener(
|
|
559
579
|
SORTED_ROW_IDS,
|
|
560
580
|
useStoreOrStoreById(storeOrStoreId),
|
|
561
581
|
listener,
|
|
562
582
|
listenerDeps,
|
|
563
|
-
|
|
583
|
+
isUndefined(sorter)
|
|
584
|
+
? [tableId, cellId, descending, offset, limit]
|
|
585
|
+
: [sortedRowIdsArgs],
|
|
564
586
|
mutator,
|
|
565
587
|
);
|
|
588
|
+
};
|
|
566
589
|
const useCreateStore = (create, createDeps = EMPTY_ARRAY) =>
|
|
567
590
|
useMemo(create, createDeps);
|
|
568
591
|
const useStoreIds = () => useThingIds(OFFSET_STORE);
|
|
@@ -632,6 +655,7 @@ const useSortedRowIds = (
|
|
|
632
655
|
descending,
|
|
633
656
|
offset,
|
|
634
657
|
limit,
|
|
658
|
+
sorterOrStoreOrStoreId,
|
|
635
659
|
storeOrStoreId,
|
|
636
660
|
) =>
|
|
637
661
|
useSortedRowIdsImpl(
|
|
@@ -642,6 +666,7 @@ const useSortedRowIds = (
|
|
|
642
666
|
tableIdOrArgs.descending ?? false,
|
|
643
667
|
tableIdOrArgs.offset ?? 0,
|
|
644
668
|
tableIdOrArgs.limit,
|
|
669
|
+
tableIdOrArgs.sorter,
|
|
645
670
|
cellIdOrStoreOrStoreId,
|
|
646
671
|
]
|
|
647
672
|
: [
|
|
@@ -650,7 +675,10 @@ const useSortedRowIds = (
|
|
|
650
675
|
descending,
|
|
651
676
|
offset,
|
|
652
677
|
limit,
|
|
653
|
-
|
|
678
|
+
isFunction(sorterOrStoreOrStoreId) ? sorterOrStoreOrStoreId : void 0,
|
|
679
|
+
isFunction(sorterOrStoreOrStoreId)
|
|
680
|
+
? storeOrStoreId
|
|
681
|
+
: sorterOrStoreOrStoreId,
|
|
654
682
|
]),
|
|
655
683
|
);
|
|
656
684
|
const useHasRow = (tableId, rowId, storeOrStoreId) =>
|
|
@@ -1057,6 +1085,7 @@ const useSortedRowIdsListener = (
|
|
|
1057
1085
|
tableIdOrArgs.descending ?? false,
|
|
1058
1086
|
tableIdOrArgs.offset ?? 0,
|
|
1059
1087
|
tableIdOrArgs.limit,
|
|
1088
|
+
tableIdOrArgs.sorter,
|
|
1060
1089
|
cellIdOrListener,
|
|
1061
1090
|
descendingOrListenerDeps,
|
|
1062
1091
|
offsetOrMutator,
|
|
@@ -1068,6 +1097,7 @@ const useSortedRowIdsListener = (
|
|
|
1068
1097
|
descendingOrListenerDeps,
|
|
1069
1098
|
offsetOrMutator,
|
|
1070
1099
|
limitOrStoreOrStoreId,
|
|
1100
|
+
void 0,
|
|
1071
1101
|
listener,
|
|
1072
1102
|
listenerDeps,
|
|
1073
1103
|
mutator,
|
package/ui-react-dom/index.js
CHANGED
|
@@ -312,14 +312,29 @@ const useSortedRowIdsImpl = (
|
|
|
312
312
|
descending,
|
|
313
313
|
offset,
|
|
314
314
|
limit,
|
|
315
|
+
sorter,
|
|
315
316
|
storeOrStoreId,
|
|
316
|
-
) =>
|
|
317
|
-
|
|
317
|
+
) => {
|
|
318
|
+
const sortedRowIdsArgs = useMemo(
|
|
319
|
+
() => ({
|
|
320
|
+
tableId,
|
|
321
|
+
cellId,
|
|
322
|
+
descending: descending ?? false,
|
|
323
|
+
offset: offset ?? 0,
|
|
324
|
+
limit,
|
|
325
|
+
sorter,
|
|
326
|
+
}),
|
|
327
|
+
[tableId, cellId, descending, offset, limit, sorter],
|
|
328
|
+
);
|
|
329
|
+
return useListenable(
|
|
318
330
|
SORTED_ROW_IDS,
|
|
319
331
|
useStoreOrStoreById(storeOrStoreId),
|
|
320
332
|
1 /* Array */,
|
|
321
|
-
|
|
333
|
+
isUndefined(sorter)
|
|
334
|
+
? [tableId, cellId, descending, offset, limit]
|
|
335
|
+
: [sortedRowIdsArgs],
|
|
322
336
|
);
|
|
337
|
+
};
|
|
323
338
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
324
339
|
useThingOrThingById(storeOrStoreId, OFFSET_STORE);
|
|
325
340
|
const useTableCellIds = (tableId, storeOrStoreId) =>
|
|
@@ -346,6 +361,7 @@ const useSortedRowIds = (
|
|
|
346
361
|
descending,
|
|
347
362
|
offset,
|
|
348
363
|
limit,
|
|
364
|
+
sorterOrStoreOrStoreId,
|
|
349
365
|
storeOrStoreId,
|
|
350
366
|
) =>
|
|
351
367
|
useSortedRowIdsImpl(
|
|
@@ -356,6 +372,7 @@ const useSortedRowIds = (
|
|
|
356
372
|
tableIdOrArgs.descending ?? false,
|
|
357
373
|
tableIdOrArgs.offset ?? 0,
|
|
358
374
|
tableIdOrArgs.limit,
|
|
375
|
+
tableIdOrArgs.sorter,
|
|
359
376
|
cellIdOrStoreOrStoreId,
|
|
360
377
|
]
|
|
361
378
|
: [
|
|
@@ -364,7 +381,10 @@ const useSortedRowIds = (
|
|
|
364
381
|
descending,
|
|
365
382
|
offset,
|
|
366
383
|
limit,
|
|
367
|
-
|
|
384
|
+
isFunction(sorterOrStoreOrStoreId) ? sorterOrStoreOrStoreId : void 0,
|
|
385
|
+
isFunction(sorterOrStoreOrStoreId)
|
|
386
|
+
? storeOrStoreId
|
|
387
|
+
: sorterOrStoreOrStoreId,
|
|
368
388
|
]),
|
|
369
389
|
);
|
|
370
390
|
const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
@@ -312,14 +312,29 @@ const useSortedRowIdsImpl = (
|
|
|
312
312
|
descending,
|
|
313
313
|
offset,
|
|
314
314
|
limit,
|
|
315
|
+
sorter,
|
|
315
316
|
storeOrStoreId,
|
|
316
|
-
) =>
|
|
317
|
-
|
|
317
|
+
) => {
|
|
318
|
+
const sortedRowIdsArgs = useMemo(
|
|
319
|
+
() => ({
|
|
320
|
+
tableId,
|
|
321
|
+
cellId,
|
|
322
|
+
descending: descending ?? false,
|
|
323
|
+
offset: offset ?? 0,
|
|
324
|
+
limit,
|
|
325
|
+
sorter,
|
|
326
|
+
}),
|
|
327
|
+
[tableId, cellId, descending, offset, limit, sorter],
|
|
328
|
+
);
|
|
329
|
+
return useListenable(
|
|
318
330
|
SORTED_ROW_IDS,
|
|
319
331
|
useStoreOrStoreById(storeOrStoreId),
|
|
320
332
|
1 /* Array */,
|
|
321
|
-
|
|
333
|
+
isUndefined(sorter)
|
|
334
|
+
? [tableId, cellId, descending, offset, limit]
|
|
335
|
+
: [sortedRowIdsArgs],
|
|
322
336
|
);
|
|
337
|
+
};
|
|
323
338
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
324
339
|
useThingOrThingById(storeOrStoreId, OFFSET_STORE);
|
|
325
340
|
const useTableCellIds = (tableId, storeOrStoreId) =>
|
|
@@ -346,6 +361,7 @@ const useSortedRowIds = (
|
|
|
346
361
|
descending,
|
|
347
362
|
offset,
|
|
348
363
|
limit,
|
|
364
|
+
sorterOrStoreOrStoreId,
|
|
349
365
|
storeOrStoreId,
|
|
350
366
|
) =>
|
|
351
367
|
useSortedRowIdsImpl(
|
|
@@ -356,6 +372,7 @@ const useSortedRowIds = (
|
|
|
356
372
|
tableIdOrArgs.descending ?? false,
|
|
357
373
|
tableIdOrArgs.offset ?? 0,
|
|
358
374
|
tableIdOrArgs.limit,
|
|
375
|
+
tableIdOrArgs.sorter,
|
|
359
376
|
cellIdOrStoreOrStoreId,
|
|
360
377
|
]
|
|
361
378
|
: [
|
|
@@ -364,7 +381,10 @@ const useSortedRowIds = (
|
|
|
364
381
|
descending,
|
|
365
382
|
offset,
|
|
366
383
|
limit,
|
|
367
|
-
|
|
384
|
+
isFunction(sorterOrStoreOrStoreId) ? sorterOrStoreOrStoreId : void 0,
|
|
385
|
+
isFunction(sorterOrStoreOrStoreId)
|
|
386
|
+
? storeOrStoreId
|
|
387
|
+
: sorterOrStoreOrStoreId,
|
|
368
388
|
]),
|
|
369
389
|
);
|
|
370
390
|
const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
@@ -917,14 +917,29 @@ const useSortedRowIdsImpl = (
|
|
|
917
917
|
descending,
|
|
918
918
|
offset,
|
|
919
919
|
limit,
|
|
920
|
+
sorter,
|
|
920
921
|
storeOrStoreId,
|
|
921
|
-
) =>
|
|
922
|
-
|
|
922
|
+
) => {
|
|
923
|
+
const sortedRowIdsArgs = useMemo(
|
|
924
|
+
() => ({
|
|
925
|
+
tableId,
|
|
926
|
+
cellId,
|
|
927
|
+
descending: descending ?? false,
|
|
928
|
+
offset: offset ?? 0,
|
|
929
|
+
limit,
|
|
930
|
+
sorter,
|
|
931
|
+
}),
|
|
932
|
+
[tableId, cellId, descending, offset, limit, sorter],
|
|
933
|
+
);
|
|
934
|
+
return useListenable(
|
|
923
935
|
SORTED_ROW_IDS,
|
|
924
936
|
useStoreOrStoreById(storeOrStoreId),
|
|
925
937
|
1 /* Array */,
|
|
926
|
-
|
|
938
|
+
isUndefined(sorter)
|
|
939
|
+
? [tableId, cellId, descending, offset, limit]
|
|
940
|
+
: [sortedRowIdsArgs],
|
|
927
941
|
);
|
|
942
|
+
};
|
|
928
943
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
929
944
|
useThingOrThingById(storeOrStoreId, OFFSET_STORE);
|
|
930
945
|
const useSortedRowIds = (
|
|
@@ -933,6 +948,7 @@ const useSortedRowIds = (
|
|
|
933
948
|
descending,
|
|
934
949
|
offset,
|
|
935
950
|
limit,
|
|
951
|
+
sorterOrStoreOrStoreId,
|
|
936
952
|
storeOrStoreId,
|
|
937
953
|
) =>
|
|
938
954
|
useSortedRowIdsImpl(
|
|
@@ -943,6 +959,7 @@ const useSortedRowIds = (
|
|
|
943
959
|
tableIdOrArgs.descending ?? false,
|
|
944
960
|
tableIdOrArgs.offset ?? 0,
|
|
945
961
|
tableIdOrArgs.limit,
|
|
962
|
+
tableIdOrArgs.sorter,
|
|
946
963
|
cellIdOrStoreOrStoreId,
|
|
947
964
|
]
|
|
948
965
|
: [
|
|
@@ -951,7 +968,10 @@ const useSortedRowIds = (
|
|
|
951
968
|
descending,
|
|
952
969
|
offset,
|
|
953
970
|
limit,
|
|
954
|
-
|
|
971
|
+
isFunction(sorterOrStoreOrStoreId) ? sorterOrStoreOrStoreId : void 0,
|
|
972
|
+
isFunction(sorterOrStoreOrStoreId)
|
|
973
|
+
? storeOrStoreId
|
|
974
|
+
: sorterOrStoreOrStoreId,
|
|
955
975
|
]),
|
|
956
976
|
);
|
|
957
977
|
const useCellListener = (
|
|
@@ -917,14 +917,29 @@ const useSortedRowIdsImpl = (
|
|
|
917
917
|
descending,
|
|
918
918
|
offset,
|
|
919
919
|
limit,
|
|
920
|
+
sorter,
|
|
920
921
|
storeOrStoreId,
|
|
921
|
-
) =>
|
|
922
|
-
|
|
922
|
+
) => {
|
|
923
|
+
const sortedRowIdsArgs = useMemo(
|
|
924
|
+
() => ({
|
|
925
|
+
tableId,
|
|
926
|
+
cellId,
|
|
927
|
+
descending: descending ?? false,
|
|
928
|
+
offset: offset ?? 0,
|
|
929
|
+
limit,
|
|
930
|
+
sorter,
|
|
931
|
+
}),
|
|
932
|
+
[tableId, cellId, descending, offset, limit, sorter],
|
|
933
|
+
);
|
|
934
|
+
return useListenable(
|
|
923
935
|
SORTED_ROW_IDS,
|
|
924
936
|
useStoreOrStoreById(storeOrStoreId),
|
|
925
937
|
1 /* Array */,
|
|
926
|
-
|
|
938
|
+
isUndefined(sorter)
|
|
939
|
+
? [tableId, cellId, descending, offset, limit]
|
|
940
|
+
: [sortedRowIdsArgs],
|
|
927
941
|
);
|
|
942
|
+
};
|
|
928
943
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
929
944
|
useThingOrThingById(storeOrStoreId, OFFSET_STORE);
|
|
930
945
|
const useSortedRowIds = (
|
|
@@ -933,6 +948,7 @@ const useSortedRowIds = (
|
|
|
933
948
|
descending,
|
|
934
949
|
offset,
|
|
935
950
|
limit,
|
|
951
|
+
sorterOrStoreOrStoreId,
|
|
936
952
|
storeOrStoreId,
|
|
937
953
|
) =>
|
|
938
954
|
useSortedRowIdsImpl(
|
|
@@ -943,6 +959,7 @@ const useSortedRowIds = (
|
|
|
943
959
|
tableIdOrArgs.descending ?? false,
|
|
944
960
|
tableIdOrArgs.offset ?? 0,
|
|
945
961
|
tableIdOrArgs.limit,
|
|
962
|
+
tableIdOrArgs.sorter,
|
|
946
963
|
cellIdOrStoreOrStoreId,
|
|
947
964
|
]
|
|
948
965
|
: [
|
|
@@ -951,7 +968,10 @@ const useSortedRowIds = (
|
|
|
951
968
|
descending,
|
|
952
969
|
offset,
|
|
953
970
|
limit,
|
|
954
|
-
|
|
971
|
+
isFunction(sorterOrStoreOrStoreId) ? sorterOrStoreOrStoreId : void 0,
|
|
972
|
+
isFunction(sorterOrStoreOrStoreId)
|
|
973
|
+
? storeOrStoreId
|
|
974
|
+
: sorterOrStoreOrStoreId,
|
|
955
975
|
]),
|
|
956
976
|
);
|
|
957
977
|
const useCellListener = (
|