tinybase 7.2.0-beta.0 → 7.2.0-beta.2
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/queries/index.d.ts +196 -22
- package/@types/queries/with-schemas/index.d.ts +210 -22
- package/@types/ui-react/index.d.ts +285 -0
- package/@types/ui-react/with-schemas/index.d.ts +318 -0
- package/index.js +29 -5
- package/min/index.js +1 -1
- package/min/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/queries/index.js +1 -1
- package/min/queries/index.js.gz +0 -0
- package/min/queries/with-schemas/index.js +1 -1
- package/min/queries/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-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/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/omni/index.js +131 -24
- package/omni/with-schemas/index.js +131 -24
- package/package.json +1 -1
- package/queries/index.js +41 -5
- package/queries/with-schemas/index.js +41 -5
- package/readme.md +13 -13
- package/releases.md +69 -41
- package/ui-react/index.js +102 -19
- package/ui-react/with-schemas/index.js +102 -19
- package/ui-react-dom/index.js +39 -13
- package/ui-react-dom/with-schemas/index.js +39 -13
- package/ui-react-inspector/index.js +41 -15
- package/ui-react-inspector/with-schemas/index.js +41 -15
- package/with-schemas/index.js +29 -5
package/ui-react/index.js
CHANGED
|
@@ -392,32 +392,77 @@ const useListener = (
|
|
|
392
392
|
[thing, listenable, ...preArgs, ...listenerDeps, ...postArgs],
|
|
393
393
|
);
|
|
394
394
|
const useSetCallback = (
|
|
395
|
-
|
|
395
|
+
storeOrQueries,
|
|
396
396
|
settable,
|
|
397
397
|
get,
|
|
398
398
|
getDeps = EMPTY_ARRAY,
|
|
399
399
|
then = getUndefined,
|
|
400
400
|
thenDeps = EMPTY_ARRAY,
|
|
401
|
+
methodPrefix = EMPTY_STRING,
|
|
401
402
|
...args
|
|
402
|
-
) =>
|
|
403
|
-
|
|
404
|
-
return useCallback(
|
|
403
|
+
) =>
|
|
404
|
+
useCallback(
|
|
405
405
|
(parameter) =>
|
|
406
|
-
ifNotUndefined(
|
|
407
|
-
ifNotUndefined(get(parameter,
|
|
406
|
+
ifNotUndefined(storeOrQueries, (obj) =>
|
|
407
|
+
ifNotUndefined(get(parameter, obj), (thing) =>
|
|
408
408
|
then(
|
|
409
|
-
|
|
410
|
-
...argsOrGetArgs(args,
|
|
409
|
+
obj[methodPrefix + settable](
|
|
410
|
+
...argsOrGetArgs(args, obj, parameter),
|
|
411
411
|
thing,
|
|
412
412
|
),
|
|
413
413
|
thing,
|
|
414
414
|
),
|
|
415
415
|
),
|
|
416
416
|
),
|
|
417
|
-
|
|
418
|
-
[
|
|
417
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
418
|
+
[
|
|
419
|
+
storeOrQueries,
|
|
420
|
+
settable,
|
|
421
|
+
...getDeps,
|
|
422
|
+
...thenDeps,
|
|
423
|
+
methodPrefix,
|
|
424
|
+
...nonFunctionDeps(args),
|
|
425
|
+
],
|
|
426
|
+
/* eslint-enable react-hooks/exhaustive-deps */
|
|
427
|
+
);
|
|
428
|
+
const useStoreSetCallback = (
|
|
429
|
+
storeOrStoreId,
|
|
430
|
+
settable,
|
|
431
|
+
get,
|
|
432
|
+
getDeps = EMPTY_ARRAY,
|
|
433
|
+
then = getUndefined,
|
|
434
|
+
thenDeps = EMPTY_ARRAY,
|
|
435
|
+
...args
|
|
436
|
+
) =>
|
|
437
|
+
useSetCallback(
|
|
438
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
439
|
+
settable,
|
|
440
|
+
get,
|
|
441
|
+
getDeps,
|
|
442
|
+
then,
|
|
443
|
+
thenDeps,
|
|
444
|
+
SET,
|
|
445
|
+
...args,
|
|
446
|
+
);
|
|
447
|
+
const useQueriesSetCallback = (
|
|
448
|
+
queriesOrQueriesId,
|
|
449
|
+
settable,
|
|
450
|
+
get,
|
|
451
|
+
getDeps = EMPTY_ARRAY,
|
|
452
|
+
then = getUndefined,
|
|
453
|
+
thenDeps = EMPTY_ARRAY,
|
|
454
|
+
...args
|
|
455
|
+
) =>
|
|
456
|
+
useSetCallback(
|
|
457
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
458
|
+
settable,
|
|
459
|
+
get,
|
|
460
|
+
getDeps,
|
|
461
|
+
then,
|
|
462
|
+
thenDeps,
|
|
463
|
+
EMPTY_STRING,
|
|
464
|
+
...args,
|
|
419
465
|
);
|
|
420
|
-
};
|
|
421
466
|
const argsOrGetArgs = (args, store, parameter) =>
|
|
422
467
|
arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
|
|
423
468
|
const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
|
|
@@ -617,7 +662,7 @@ const useSetTablesCallback = (
|
|
|
617
662
|
then,
|
|
618
663
|
thenDeps,
|
|
619
664
|
) =>
|
|
620
|
-
|
|
665
|
+
useStoreSetCallback(
|
|
621
666
|
storeOrStoreId,
|
|
622
667
|
TABLES,
|
|
623
668
|
getTables,
|
|
@@ -633,7 +678,7 @@ const useSetTableCallback = (
|
|
|
633
678
|
then,
|
|
634
679
|
thenDeps,
|
|
635
680
|
) =>
|
|
636
|
-
|
|
681
|
+
useStoreSetCallback(
|
|
637
682
|
storeOrStoreId,
|
|
638
683
|
TABLE,
|
|
639
684
|
getTable,
|
|
@@ -651,7 +696,7 @@ const useSetRowCallback = (
|
|
|
651
696
|
then,
|
|
652
697
|
thenDeps,
|
|
653
698
|
) =>
|
|
654
|
-
|
|
699
|
+
useStoreSetCallback(
|
|
655
700
|
storeOrStoreId,
|
|
656
701
|
ROW,
|
|
657
702
|
getRow,
|
|
@@ -699,7 +744,7 @@ const useSetPartialRowCallback = (
|
|
|
699
744
|
then,
|
|
700
745
|
thenDeps,
|
|
701
746
|
) =>
|
|
702
|
-
|
|
747
|
+
useStoreSetCallback(
|
|
703
748
|
storeOrStoreId,
|
|
704
749
|
PARTIAL + ROW,
|
|
705
750
|
getPartialRow,
|
|
@@ -719,7 +764,7 @@ const useSetCellCallback = (
|
|
|
719
764
|
then,
|
|
720
765
|
thenDeps,
|
|
721
766
|
) =>
|
|
722
|
-
|
|
767
|
+
useStoreSetCallback(
|
|
723
768
|
storeOrStoreId,
|
|
724
769
|
CELL,
|
|
725
770
|
getCell,
|
|
@@ -737,7 +782,7 @@ const useSetValuesCallback = (
|
|
|
737
782
|
then,
|
|
738
783
|
thenDeps,
|
|
739
784
|
) =>
|
|
740
|
-
|
|
785
|
+
useStoreSetCallback(
|
|
741
786
|
storeOrStoreId,
|
|
742
787
|
VALUES,
|
|
743
788
|
getValues,
|
|
@@ -752,7 +797,7 @@ const useSetPartialValuesCallback = (
|
|
|
752
797
|
then,
|
|
753
798
|
thenDeps,
|
|
754
799
|
) =>
|
|
755
|
-
|
|
800
|
+
useStoreSetCallback(
|
|
756
801
|
storeOrStoreId,
|
|
757
802
|
PARTIAL + VALUES,
|
|
758
803
|
getPartialValues,
|
|
@@ -768,7 +813,7 @@ const useSetValueCallback = (
|
|
|
768
813
|
then,
|
|
769
814
|
thenDeps,
|
|
770
815
|
) =>
|
|
771
|
-
|
|
816
|
+
useStoreSetCallback(
|
|
772
817
|
storeOrStoreId,
|
|
773
818
|
VALUE,
|
|
774
819
|
getValue,
|
|
@@ -1505,6 +1550,42 @@ const useResultCellListener = (
|
|
|
1505
1550
|
listenerDeps,
|
|
1506
1551
|
[queryId, rowId, cellId],
|
|
1507
1552
|
);
|
|
1553
|
+
const useSetParamValueCallback = (
|
|
1554
|
+
queryId,
|
|
1555
|
+
paramId,
|
|
1556
|
+
getParamValue,
|
|
1557
|
+
getParamValueDeps,
|
|
1558
|
+
queriesOrQueriesId,
|
|
1559
|
+
then,
|
|
1560
|
+
thenDeps,
|
|
1561
|
+
) =>
|
|
1562
|
+
useQueriesSetCallback(
|
|
1563
|
+
queriesOrQueriesId,
|
|
1564
|
+
'setParamValue',
|
|
1565
|
+
getParamValue,
|
|
1566
|
+
getParamValueDeps,
|
|
1567
|
+
then,
|
|
1568
|
+
thenDeps,
|
|
1569
|
+
queryId,
|
|
1570
|
+
paramId,
|
|
1571
|
+
);
|
|
1572
|
+
const useSetParamValuesCallback = (
|
|
1573
|
+
queryId,
|
|
1574
|
+
getParamValues,
|
|
1575
|
+
getParamValuesDeps,
|
|
1576
|
+
queriesOrQueriesId,
|
|
1577
|
+
then,
|
|
1578
|
+
thenDeps,
|
|
1579
|
+
) =>
|
|
1580
|
+
useQueriesSetCallback(
|
|
1581
|
+
queriesOrQueriesId,
|
|
1582
|
+
'setParamValues',
|
|
1583
|
+
getParamValues,
|
|
1584
|
+
getParamValuesDeps,
|
|
1585
|
+
then,
|
|
1586
|
+
thenDeps,
|
|
1587
|
+
queryId,
|
|
1588
|
+
);
|
|
1508
1589
|
const useCreateCheckpoints = (store, create, createDeps) =>
|
|
1509
1590
|
useCreate(store, create, createDeps);
|
|
1510
1591
|
const useCheckpointsIds = () => useThingIds(OFFSET_CHECKPOINTS);
|
|
@@ -2313,6 +2394,8 @@ export {
|
|
|
2313
2394
|
useRowListener,
|
|
2314
2395
|
useSetCellCallback,
|
|
2315
2396
|
useSetCheckpointCallback,
|
|
2397
|
+
useSetParamValueCallback,
|
|
2398
|
+
useSetParamValuesCallback,
|
|
2316
2399
|
useSetPartialRowCallback,
|
|
2317
2400
|
useSetPartialValuesCallback,
|
|
2318
2401
|
useSetRowCallback,
|
|
@@ -392,32 +392,77 @@ const useListener = (
|
|
|
392
392
|
[thing, listenable, ...preArgs, ...listenerDeps, ...postArgs],
|
|
393
393
|
);
|
|
394
394
|
const useSetCallback = (
|
|
395
|
-
|
|
395
|
+
storeOrQueries,
|
|
396
396
|
settable,
|
|
397
397
|
get,
|
|
398
398
|
getDeps = EMPTY_ARRAY,
|
|
399
399
|
then = getUndefined,
|
|
400
400
|
thenDeps = EMPTY_ARRAY,
|
|
401
|
+
methodPrefix = EMPTY_STRING,
|
|
401
402
|
...args
|
|
402
|
-
) =>
|
|
403
|
-
|
|
404
|
-
return useCallback(
|
|
403
|
+
) =>
|
|
404
|
+
useCallback(
|
|
405
405
|
(parameter) =>
|
|
406
|
-
ifNotUndefined(
|
|
407
|
-
ifNotUndefined(get(parameter,
|
|
406
|
+
ifNotUndefined(storeOrQueries, (obj) =>
|
|
407
|
+
ifNotUndefined(get(parameter, obj), (thing) =>
|
|
408
408
|
then(
|
|
409
|
-
|
|
410
|
-
...argsOrGetArgs(args,
|
|
409
|
+
obj[methodPrefix + settable](
|
|
410
|
+
...argsOrGetArgs(args, obj, parameter),
|
|
411
411
|
thing,
|
|
412
412
|
),
|
|
413
413
|
thing,
|
|
414
414
|
),
|
|
415
415
|
),
|
|
416
416
|
),
|
|
417
|
-
|
|
418
|
-
[
|
|
417
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
418
|
+
[
|
|
419
|
+
storeOrQueries,
|
|
420
|
+
settable,
|
|
421
|
+
...getDeps,
|
|
422
|
+
...thenDeps,
|
|
423
|
+
methodPrefix,
|
|
424
|
+
...nonFunctionDeps(args),
|
|
425
|
+
],
|
|
426
|
+
/* eslint-enable react-hooks/exhaustive-deps */
|
|
427
|
+
);
|
|
428
|
+
const useStoreSetCallback = (
|
|
429
|
+
storeOrStoreId,
|
|
430
|
+
settable,
|
|
431
|
+
get,
|
|
432
|
+
getDeps = EMPTY_ARRAY,
|
|
433
|
+
then = getUndefined,
|
|
434
|
+
thenDeps = EMPTY_ARRAY,
|
|
435
|
+
...args
|
|
436
|
+
) =>
|
|
437
|
+
useSetCallback(
|
|
438
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
439
|
+
settable,
|
|
440
|
+
get,
|
|
441
|
+
getDeps,
|
|
442
|
+
then,
|
|
443
|
+
thenDeps,
|
|
444
|
+
SET,
|
|
445
|
+
...args,
|
|
446
|
+
);
|
|
447
|
+
const useQueriesSetCallback = (
|
|
448
|
+
queriesOrQueriesId,
|
|
449
|
+
settable,
|
|
450
|
+
get,
|
|
451
|
+
getDeps = EMPTY_ARRAY,
|
|
452
|
+
then = getUndefined,
|
|
453
|
+
thenDeps = EMPTY_ARRAY,
|
|
454
|
+
...args
|
|
455
|
+
) =>
|
|
456
|
+
useSetCallback(
|
|
457
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
458
|
+
settable,
|
|
459
|
+
get,
|
|
460
|
+
getDeps,
|
|
461
|
+
then,
|
|
462
|
+
thenDeps,
|
|
463
|
+
EMPTY_STRING,
|
|
464
|
+
...args,
|
|
419
465
|
);
|
|
420
|
-
};
|
|
421
466
|
const argsOrGetArgs = (args, store, parameter) =>
|
|
422
467
|
arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
|
|
423
468
|
const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
|
|
@@ -617,7 +662,7 @@ const useSetTablesCallback = (
|
|
|
617
662
|
then,
|
|
618
663
|
thenDeps,
|
|
619
664
|
) =>
|
|
620
|
-
|
|
665
|
+
useStoreSetCallback(
|
|
621
666
|
storeOrStoreId,
|
|
622
667
|
TABLES,
|
|
623
668
|
getTables,
|
|
@@ -633,7 +678,7 @@ const useSetTableCallback = (
|
|
|
633
678
|
then,
|
|
634
679
|
thenDeps,
|
|
635
680
|
) =>
|
|
636
|
-
|
|
681
|
+
useStoreSetCallback(
|
|
637
682
|
storeOrStoreId,
|
|
638
683
|
TABLE,
|
|
639
684
|
getTable,
|
|
@@ -651,7 +696,7 @@ const useSetRowCallback = (
|
|
|
651
696
|
then,
|
|
652
697
|
thenDeps,
|
|
653
698
|
) =>
|
|
654
|
-
|
|
699
|
+
useStoreSetCallback(
|
|
655
700
|
storeOrStoreId,
|
|
656
701
|
ROW,
|
|
657
702
|
getRow,
|
|
@@ -699,7 +744,7 @@ const useSetPartialRowCallback = (
|
|
|
699
744
|
then,
|
|
700
745
|
thenDeps,
|
|
701
746
|
) =>
|
|
702
|
-
|
|
747
|
+
useStoreSetCallback(
|
|
703
748
|
storeOrStoreId,
|
|
704
749
|
PARTIAL + ROW,
|
|
705
750
|
getPartialRow,
|
|
@@ -719,7 +764,7 @@ const useSetCellCallback = (
|
|
|
719
764
|
then,
|
|
720
765
|
thenDeps,
|
|
721
766
|
) =>
|
|
722
|
-
|
|
767
|
+
useStoreSetCallback(
|
|
723
768
|
storeOrStoreId,
|
|
724
769
|
CELL,
|
|
725
770
|
getCell,
|
|
@@ -737,7 +782,7 @@ const useSetValuesCallback = (
|
|
|
737
782
|
then,
|
|
738
783
|
thenDeps,
|
|
739
784
|
) =>
|
|
740
|
-
|
|
785
|
+
useStoreSetCallback(
|
|
741
786
|
storeOrStoreId,
|
|
742
787
|
VALUES,
|
|
743
788
|
getValues,
|
|
@@ -752,7 +797,7 @@ const useSetPartialValuesCallback = (
|
|
|
752
797
|
then,
|
|
753
798
|
thenDeps,
|
|
754
799
|
) =>
|
|
755
|
-
|
|
800
|
+
useStoreSetCallback(
|
|
756
801
|
storeOrStoreId,
|
|
757
802
|
PARTIAL + VALUES,
|
|
758
803
|
getPartialValues,
|
|
@@ -768,7 +813,7 @@ const useSetValueCallback = (
|
|
|
768
813
|
then,
|
|
769
814
|
thenDeps,
|
|
770
815
|
) =>
|
|
771
|
-
|
|
816
|
+
useStoreSetCallback(
|
|
772
817
|
storeOrStoreId,
|
|
773
818
|
VALUE,
|
|
774
819
|
getValue,
|
|
@@ -1505,6 +1550,42 @@ const useResultCellListener = (
|
|
|
1505
1550
|
listenerDeps,
|
|
1506
1551
|
[queryId, rowId, cellId],
|
|
1507
1552
|
);
|
|
1553
|
+
const useSetParamValueCallback = (
|
|
1554
|
+
queryId,
|
|
1555
|
+
paramId,
|
|
1556
|
+
getParamValue,
|
|
1557
|
+
getParamValueDeps,
|
|
1558
|
+
queriesOrQueriesId,
|
|
1559
|
+
then,
|
|
1560
|
+
thenDeps,
|
|
1561
|
+
) =>
|
|
1562
|
+
useQueriesSetCallback(
|
|
1563
|
+
queriesOrQueriesId,
|
|
1564
|
+
'setParamValue',
|
|
1565
|
+
getParamValue,
|
|
1566
|
+
getParamValueDeps,
|
|
1567
|
+
then,
|
|
1568
|
+
thenDeps,
|
|
1569
|
+
queryId,
|
|
1570
|
+
paramId,
|
|
1571
|
+
);
|
|
1572
|
+
const useSetParamValuesCallback = (
|
|
1573
|
+
queryId,
|
|
1574
|
+
getParamValues,
|
|
1575
|
+
getParamValuesDeps,
|
|
1576
|
+
queriesOrQueriesId,
|
|
1577
|
+
then,
|
|
1578
|
+
thenDeps,
|
|
1579
|
+
) =>
|
|
1580
|
+
useQueriesSetCallback(
|
|
1581
|
+
queriesOrQueriesId,
|
|
1582
|
+
'setParamValues',
|
|
1583
|
+
getParamValues,
|
|
1584
|
+
getParamValuesDeps,
|
|
1585
|
+
then,
|
|
1586
|
+
thenDeps,
|
|
1587
|
+
queryId,
|
|
1588
|
+
);
|
|
1508
1589
|
const useCreateCheckpoints = (store, create, createDeps) =>
|
|
1509
1590
|
useCreate(store, create, createDeps);
|
|
1510
1591
|
const useCheckpointsIds = () => useThingIds(OFFSET_CHECKPOINTS);
|
|
@@ -2313,6 +2394,8 @@ export {
|
|
|
2313
2394
|
useRowListener,
|
|
2314
2395
|
useSetCellCallback,
|
|
2315
2396
|
useSetCheckpointCallback,
|
|
2397
|
+
useSetParamValueCallback,
|
|
2398
|
+
useSetParamValuesCallback,
|
|
2316
2399
|
useSetPartialRowCallback,
|
|
2317
2400
|
useSetPartialValuesCallback,
|
|
2318
2401
|
useSetRowCallback,
|
package/ui-react-dom/index.js
CHANGED
|
@@ -197,32 +197,58 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
|
197
197
|
return useSyncExternalStore(subscribe, getResult, getResult);
|
|
198
198
|
};
|
|
199
199
|
const useSetCallback = (
|
|
200
|
-
|
|
200
|
+
storeOrQueries,
|
|
201
201
|
settable,
|
|
202
202
|
get,
|
|
203
203
|
getDeps = EMPTY_ARRAY,
|
|
204
204
|
then = getUndefined,
|
|
205
205
|
thenDeps = EMPTY_ARRAY,
|
|
206
|
+
methodPrefix = EMPTY_STRING,
|
|
206
207
|
...args
|
|
207
|
-
) =>
|
|
208
|
-
|
|
209
|
-
return useCallback(
|
|
208
|
+
) =>
|
|
209
|
+
useCallback(
|
|
210
210
|
(parameter) =>
|
|
211
|
-
ifNotUndefined(
|
|
212
|
-
ifNotUndefined(get(parameter,
|
|
211
|
+
ifNotUndefined(storeOrQueries, (obj) =>
|
|
212
|
+
ifNotUndefined(get(parameter, obj), (thing) =>
|
|
213
213
|
then(
|
|
214
|
-
|
|
215
|
-
...argsOrGetArgs(args,
|
|
214
|
+
obj[methodPrefix + settable](
|
|
215
|
+
...argsOrGetArgs(args, obj, parameter),
|
|
216
216
|
thing,
|
|
217
217
|
),
|
|
218
218
|
thing,
|
|
219
219
|
),
|
|
220
220
|
),
|
|
221
221
|
),
|
|
222
|
-
|
|
223
|
-
[
|
|
222
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
223
|
+
[
|
|
224
|
+
storeOrQueries,
|
|
225
|
+
settable,
|
|
226
|
+
...getDeps,
|
|
227
|
+
...thenDeps,
|
|
228
|
+
methodPrefix,
|
|
229
|
+
...nonFunctionDeps(args),
|
|
230
|
+
],
|
|
231
|
+
/* eslint-enable react-hooks/exhaustive-deps */
|
|
232
|
+
);
|
|
233
|
+
const useStoreSetCallback = (
|
|
234
|
+
storeOrStoreId,
|
|
235
|
+
settable,
|
|
236
|
+
get,
|
|
237
|
+
getDeps = EMPTY_ARRAY,
|
|
238
|
+
then = getUndefined,
|
|
239
|
+
thenDeps = EMPTY_ARRAY,
|
|
240
|
+
...args
|
|
241
|
+
) =>
|
|
242
|
+
useSetCallback(
|
|
243
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
244
|
+
settable,
|
|
245
|
+
get,
|
|
246
|
+
getDeps,
|
|
247
|
+
then,
|
|
248
|
+
thenDeps,
|
|
249
|
+
SET,
|
|
250
|
+
...args,
|
|
224
251
|
);
|
|
225
|
-
};
|
|
226
252
|
const argsOrGetArgs = (args, store, parameter) =>
|
|
227
253
|
arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
|
|
228
254
|
const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
|
|
@@ -313,7 +339,7 @@ const useSetCellCallback = (
|
|
|
313
339
|
then,
|
|
314
340
|
thenDeps,
|
|
315
341
|
) =>
|
|
316
|
-
|
|
342
|
+
useStoreSetCallback(
|
|
317
343
|
storeOrStoreId,
|
|
318
344
|
CELL,
|
|
319
345
|
getCell,
|
|
@@ -332,7 +358,7 @@ const useSetValueCallback = (
|
|
|
332
358
|
then,
|
|
333
359
|
thenDeps,
|
|
334
360
|
) =>
|
|
335
|
-
|
|
361
|
+
useStoreSetCallback(
|
|
336
362
|
storeOrStoreId,
|
|
337
363
|
VALUE,
|
|
338
364
|
getValue,
|
|
@@ -197,32 +197,58 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
|
197
197
|
return useSyncExternalStore(subscribe, getResult, getResult);
|
|
198
198
|
};
|
|
199
199
|
const useSetCallback = (
|
|
200
|
-
|
|
200
|
+
storeOrQueries,
|
|
201
201
|
settable,
|
|
202
202
|
get,
|
|
203
203
|
getDeps = EMPTY_ARRAY,
|
|
204
204
|
then = getUndefined,
|
|
205
205
|
thenDeps = EMPTY_ARRAY,
|
|
206
|
+
methodPrefix = EMPTY_STRING,
|
|
206
207
|
...args
|
|
207
|
-
) =>
|
|
208
|
-
|
|
209
|
-
return useCallback(
|
|
208
|
+
) =>
|
|
209
|
+
useCallback(
|
|
210
210
|
(parameter) =>
|
|
211
|
-
ifNotUndefined(
|
|
212
|
-
ifNotUndefined(get(parameter,
|
|
211
|
+
ifNotUndefined(storeOrQueries, (obj) =>
|
|
212
|
+
ifNotUndefined(get(parameter, obj), (thing) =>
|
|
213
213
|
then(
|
|
214
|
-
|
|
215
|
-
...argsOrGetArgs(args,
|
|
214
|
+
obj[methodPrefix + settable](
|
|
215
|
+
...argsOrGetArgs(args, obj, parameter),
|
|
216
216
|
thing,
|
|
217
217
|
),
|
|
218
218
|
thing,
|
|
219
219
|
),
|
|
220
220
|
),
|
|
221
221
|
),
|
|
222
|
-
|
|
223
|
-
[
|
|
222
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
223
|
+
[
|
|
224
|
+
storeOrQueries,
|
|
225
|
+
settable,
|
|
226
|
+
...getDeps,
|
|
227
|
+
...thenDeps,
|
|
228
|
+
methodPrefix,
|
|
229
|
+
...nonFunctionDeps(args),
|
|
230
|
+
],
|
|
231
|
+
/* eslint-enable react-hooks/exhaustive-deps */
|
|
232
|
+
);
|
|
233
|
+
const useStoreSetCallback = (
|
|
234
|
+
storeOrStoreId,
|
|
235
|
+
settable,
|
|
236
|
+
get,
|
|
237
|
+
getDeps = EMPTY_ARRAY,
|
|
238
|
+
then = getUndefined,
|
|
239
|
+
thenDeps = EMPTY_ARRAY,
|
|
240
|
+
...args
|
|
241
|
+
) =>
|
|
242
|
+
useSetCallback(
|
|
243
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
244
|
+
settable,
|
|
245
|
+
get,
|
|
246
|
+
getDeps,
|
|
247
|
+
then,
|
|
248
|
+
thenDeps,
|
|
249
|
+
SET,
|
|
250
|
+
...args,
|
|
224
251
|
);
|
|
225
|
-
};
|
|
226
252
|
const argsOrGetArgs = (args, store, parameter) =>
|
|
227
253
|
arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
|
|
228
254
|
const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
|
|
@@ -313,7 +339,7 @@ const useSetCellCallback = (
|
|
|
313
339
|
then,
|
|
314
340
|
thenDeps,
|
|
315
341
|
) =>
|
|
316
|
-
|
|
342
|
+
useStoreSetCallback(
|
|
317
343
|
storeOrStoreId,
|
|
318
344
|
CELL,
|
|
319
345
|
getCell,
|
|
@@ -332,7 +358,7 @@ const useSetValueCallback = (
|
|
|
332
358
|
then,
|
|
333
359
|
thenDeps,
|
|
334
360
|
) =>
|
|
335
|
-
|
|
361
|
+
useStoreSetCallback(
|
|
336
362
|
storeOrStoreId,
|
|
337
363
|
VALUE,
|
|
338
364
|
getValue,
|
|
@@ -2205,32 +2205,58 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
|
2205
2205
|
return useSyncExternalStore(subscribe, getResult, getResult);
|
|
2206
2206
|
};
|
|
2207
2207
|
const useSetCallback = (
|
|
2208
|
-
|
|
2208
|
+
storeOrQueries,
|
|
2209
2209
|
settable,
|
|
2210
2210
|
get,
|
|
2211
2211
|
getDeps = EMPTY_ARRAY,
|
|
2212
2212
|
then = getUndefined,
|
|
2213
2213
|
thenDeps = EMPTY_ARRAY,
|
|
2214
|
+
methodPrefix = EMPTY_STRING,
|
|
2214
2215
|
...args
|
|
2215
|
-
) =>
|
|
2216
|
-
|
|
2217
|
-
return useCallback(
|
|
2216
|
+
) =>
|
|
2217
|
+
useCallback(
|
|
2218
2218
|
(parameter) =>
|
|
2219
|
-
ifNotUndefined(
|
|
2220
|
-
ifNotUndefined(get(parameter,
|
|
2219
|
+
ifNotUndefined(storeOrQueries, (obj) =>
|
|
2220
|
+
ifNotUndefined(get(parameter, obj), (thing) =>
|
|
2221
2221
|
then(
|
|
2222
|
-
|
|
2223
|
-
...argsOrGetArgs(args,
|
|
2222
|
+
obj[methodPrefix + settable](
|
|
2223
|
+
...argsOrGetArgs(args, obj, parameter),
|
|
2224
2224
|
thing,
|
|
2225
2225
|
),
|
|
2226
2226
|
thing,
|
|
2227
2227
|
),
|
|
2228
2228
|
),
|
|
2229
2229
|
),
|
|
2230
|
-
|
|
2231
|
-
[
|
|
2230
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2231
|
+
[
|
|
2232
|
+
storeOrQueries,
|
|
2233
|
+
settable,
|
|
2234
|
+
...getDeps,
|
|
2235
|
+
...thenDeps,
|
|
2236
|
+
methodPrefix,
|
|
2237
|
+
...nonFunctionDeps(args),
|
|
2238
|
+
],
|
|
2239
|
+
/* eslint-enable react-hooks/exhaustive-deps */
|
|
2240
|
+
);
|
|
2241
|
+
const useStoreSetCallback = (
|
|
2242
|
+
storeOrStoreId,
|
|
2243
|
+
settable,
|
|
2244
|
+
get,
|
|
2245
|
+
getDeps = EMPTY_ARRAY,
|
|
2246
|
+
then = getUndefined,
|
|
2247
|
+
thenDeps = EMPTY_ARRAY,
|
|
2248
|
+
...args
|
|
2249
|
+
) =>
|
|
2250
|
+
useSetCallback(
|
|
2251
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
2252
|
+
settable,
|
|
2253
|
+
get,
|
|
2254
|
+
getDeps,
|
|
2255
|
+
then,
|
|
2256
|
+
thenDeps,
|
|
2257
|
+
SET,
|
|
2258
|
+
...args,
|
|
2232
2259
|
);
|
|
2233
|
-
};
|
|
2234
2260
|
const argsOrGetArgs = (args, store, parameter) =>
|
|
2235
2261
|
arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
|
|
2236
2262
|
const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
|
|
@@ -2348,7 +2374,7 @@ const useSetTableCallback = (
|
|
|
2348
2374
|
then,
|
|
2349
2375
|
thenDeps,
|
|
2350
2376
|
) =>
|
|
2351
|
-
|
|
2377
|
+
useStoreSetCallback(
|
|
2352
2378
|
storeOrStoreId,
|
|
2353
2379
|
TABLE,
|
|
2354
2380
|
getTable,
|
|
@@ -2366,7 +2392,7 @@ const useSetRowCallback = (
|
|
|
2366
2392
|
then,
|
|
2367
2393
|
thenDeps,
|
|
2368
2394
|
) =>
|
|
2369
|
-
|
|
2395
|
+
useStoreSetCallback(
|
|
2370
2396
|
storeOrStoreId,
|
|
2371
2397
|
ROW,
|
|
2372
2398
|
getRow,
|
|
@@ -2386,7 +2412,7 @@ const useSetCellCallback = (
|
|
|
2386
2412
|
then,
|
|
2387
2413
|
thenDeps,
|
|
2388
2414
|
) =>
|
|
2389
|
-
|
|
2415
|
+
useStoreSetCallback(
|
|
2390
2416
|
storeOrStoreId,
|
|
2391
2417
|
CELL,
|
|
2392
2418
|
getCell,
|
|
@@ -2405,7 +2431,7 @@ const useSetValueCallback = (
|
|
|
2405
2431
|
then,
|
|
2406
2432
|
thenDeps,
|
|
2407
2433
|
) =>
|
|
2408
|
-
|
|
2434
|
+
useStoreSetCallback(
|
|
2409
2435
|
storeOrStoreId,
|
|
2410
2436
|
VALUE,
|
|
2411
2437
|
getValue,
|