tinybase 7.2.0 → 7.3.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/ui-react/index.d.ts +533 -1
- package/@types/ui-react/with-schemas/index.d.ts +620 -2
- 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/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/omni/index.js +53 -15
- package/omni/with-schemas/index.js +53 -15
- package/package.json +4 -4
- package/readme.md +13 -13
- package/releases.md +40 -40
- package/ui-react/index.js +41 -0
- package/ui-react/with-schemas/index.js +41 -0
- package/ui-react-dom/index.js +21 -15
- package/ui-react-dom/with-schemas/index.js +21 -15
- package/ui-react-inspector/index.js +21 -15
- package/ui-react-inspector/with-schemas/index.js +21 -15
package/ui-react/index.js
CHANGED
|
@@ -53,6 +53,7 @@ const isFunction = (thing) => getTypeOf(thing) == FUNCTION;
|
|
|
53
53
|
const isArray = (thing) => Array.isArray(thing);
|
|
54
54
|
const size = (arrayOrString) => arrayOrString.length;
|
|
55
55
|
const getUndefined = () => void 0;
|
|
56
|
+
const getArg = (value) => value;
|
|
56
57
|
|
|
57
58
|
const arrayNew = (size2, cb) =>
|
|
58
59
|
arrayMap(new Array(size2).fill(0), (_, index) => cb(index));
|
|
@@ -566,6 +567,10 @@ const useHasTables = (storeOrStoreId) =>
|
|
|
566
567
|
);
|
|
567
568
|
const useTables = (storeOrStoreId) =>
|
|
568
569
|
useListenable(TABLES, useStoreOrStoreById(storeOrStoreId), 0 /* Object */);
|
|
570
|
+
const useTablesState = (storeOrStoreId) => [
|
|
571
|
+
useTables(storeOrStoreId),
|
|
572
|
+
useSetTablesCallback(getArg, [], storeOrStoreId),
|
|
573
|
+
];
|
|
569
574
|
const useTableIds = (storeOrStoreId) =>
|
|
570
575
|
useListenable(TABLE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
571
576
|
const useHasTable = (tableId, storeOrStoreId) =>
|
|
@@ -576,6 +581,10 @@ const useTable = (tableId, storeOrStoreId) =>
|
|
|
576
581
|
useListenable(TABLE, useStoreOrStoreById(storeOrStoreId), 0 /* Object */, [
|
|
577
582
|
tableId,
|
|
578
583
|
]);
|
|
584
|
+
const useTableState = (tableId, storeOrStoreId) => [
|
|
585
|
+
useTable(tableId, storeOrStoreId),
|
|
586
|
+
useSetTableCallback(tableId, getArg, [], storeOrStoreId),
|
|
587
|
+
];
|
|
579
588
|
const useTableCellIds = (tableId, storeOrStoreId) =>
|
|
580
589
|
useListenable(
|
|
581
590
|
TABLE + CELL_IDS,
|
|
@@ -638,6 +647,10 @@ const useRow = (tableId, rowId, storeOrStoreId) =>
|
|
|
638
647
|
tableId,
|
|
639
648
|
rowId,
|
|
640
649
|
]);
|
|
650
|
+
const useRowState = (tableId, rowId, storeOrStoreId) => [
|
|
651
|
+
useRow(tableId, rowId, storeOrStoreId),
|
|
652
|
+
useSetRowCallback(tableId, rowId, getArg, [], storeOrStoreId),
|
|
653
|
+
];
|
|
641
654
|
const useCellIds = (tableId, rowId, storeOrStoreId) =>
|
|
642
655
|
useListenable(CELL_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */, [
|
|
643
656
|
tableId,
|
|
@@ -656,6 +669,10 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
|
656
669
|
5 /* CellOrValue */,
|
|
657
670
|
[tableId, rowId, cellId],
|
|
658
671
|
);
|
|
672
|
+
const useCellState = (tableId, rowId, cellId, storeOrStoreId) => [
|
|
673
|
+
useCell(tableId, rowId, cellId, storeOrStoreId),
|
|
674
|
+
useSetCellCallback(tableId, rowId, cellId, getArg, [], storeOrStoreId),
|
|
675
|
+
];
|
|
659
676
|
const useHasValues = (storeOrStoreId) =>
|
|
660
677
|
useListenable(
|
|
661
678
|
VALUES,
|
|
@@ -665,6 +682,10 @@ const useHasValues = (storeOrStoreId) =>
|
|
|
665
682
|
);
|
|
666
683
|
const useValues = (storeOrStoreId) =>
|
|
667
684
|
useListenable(VALUES, useStoreOrStoreById(storeOrStoreId), 0 /* Object */);
|
|
685
|
+
const useValuesState = (storeOrStoreId) => [
|
|
686
|
+
useValues(storeOrStoreId),
|
|
687
|
+
useSetValuesCallback(getArg, [], storeOrStoreId),
|
|
688
|
+
];
|
|
668
689
|
const useValueIds = (storeOrStoreId) =>
|
|
669
690
|
useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
670
691
|
const useHasValue = (valueId, storeOrStoreId) =>
|
|
@@ -678,6 +699,10 @@ const useValue = (valueId, storeOrStoreId) =>
|
|
|
678
699
|
5 /* CellOrValue */,
|
|
679
700
|
[valueId],
|
|
680
701
|
);
|
|
702
|
+
const useValueState = (valueId, storeOrStoreId) => [
|
|
703
|
+
useValue(valueId, storeOrStoreId),
|
|
704
|
+
useSetValueCallback(valueId, getArg, [], storeOrStoreId),
|
|
705
|
+
];
|
|
681
706
|
const useSetTablesCallback = (
|
|
682
707
|
getTables,
|
|
683
708
|
getTablesDeps,
|
|
@@ -1580,6 +1605,10 @@ const useParamValues = (queryId, queriesOrQueriesId) =>
|
|
|
1580
1605
|
3 /* ParamValues */,
|
|
1581
1606
|
[queryId],
|
|
1582
1607
|
);
|
|
1608
|
+
const useParamValuesState = (queryId, queriesOrQueriesId) => [
|
|
1609
|
+
useParamValues(queryId, queriesOrQueriesId),
|
|
1610
|
+
useSetParamValuesCallback(queryId, getArg, [], queriesOrQueriesId),
|
|
1611
|
+
];
|
|
1583
1612
|
const useParamValue = (queryId, paramId, queriesOrQueriesId) =>
|
|
1584
1613
|
useListenable(
|
|
1585
1614
|
'ParamValue',
|
|
@@ -1587,6 +1616,10 @@ const useParamValue = (queryId, paramId, queriesOrQueriesId) =>
|
|
|
1587
1616
|
4 /* ParamValue */,
|
|
1588
1617
|
[queryId, paramId],
|
|
1589
1618
|
);
|
|
1619
|
+
const useParamValueState = (queryId, paramId, queriesOrQueriesId) => [
|
|
1620
|
+
useParamValue(queryId, paramId, queriesOrQueriesId),
|
|
1621
|
+
useSetParamValueCallback(queryId, paramId, getArg, [], queriesOrQueriesId),
|
|
1622
|
+
];
|
|
1590
1623
|
const useParamValuesListener = (
|
|
1591
1624
|
queryId,
|
|
1592
1625
|
listener,
|
|
@@ -2356,6 +2389,7 @@ export {
|
|
|
2356
2389
|
useCellIds,
|
|
2357
2390
|
useCellIdsListener,
|
|
2358
2391
|
useCellListener,
|
|
2392
|
+
useCellState,
|
|
2359
2393
|
useCheckpoint,
|
|
2360
2394
|
useCheckpointIds,
|
|
2361
2395
|
useCheckpointIdsListener,
|
|
@@ -2414,6 +2448,8 @@ export {
|
|
|
2414
2448
|
useParamValueListener,
|
|
2415
2449
|
useParamValues,
|
|
2416
2450
|
useParamValuesListener,
|
|
2451
|
+
useParamValuesState,
|
|
2452
|
+
useParamValueState,
|
|
2417
2453
|
usePersister,
|
|
2418
2454
|
usePersisterIds,
|
|
2419
2455
|
usePersisterOrPersisterById,
|
|
@@ -2460,6 +2496,7 @@ export {
|
|
|
2460
2496
|
useRowIds,
|
|
2461
2497
|
useRowIdsListener,
|
|
2462
2498
|
useRowListener,
|
|
2499
|
+
useRowState,
|
|
2463
2500
|
useSetCellCallback,
|
|
2464
2501
|
useSetCheckpointCallback,
|
|
2465
2502
|
useSetParamValueCallback,
|
|
@@ -2496,6 +2533,8 @@ export {
|
|
|
2496
2533
|
useTableListener,
|
|
2497
2534
|
useTables,
|
|
2498
2535
|
useTablesListener,
|
|
2536
|
+
useTablesState,
|
|
2537
|
+
useTableState,
|
|
2499
2538
|
useUndoInformation,
|
|
2500
2539
|
useValue,
|
|
2501
2540
|
useValueIds,
|
|
@@ -2503,6 +2542,8 @@ export {
|
|
|
2503
2542
|
useValueListener,
|
|
2504
2543
|
useValues,
|
|
2505
2544
|
useValuesListener,
|
|
2545
|
+
useValuesState,
|
|
2546
|
+
useValueState,
|
|
2506
2547
|
useWillFinishTransactionListener,
|
|
2507
2548
|
ValuesView,
|
|
2508
2549
|
ValueView,
|
|
@@ -53,6 +53,7 @@ const isFunction = (thing) => getTypeOf(thing) == FUNCTION;
|
|
|
53
53
|
const isArray = (thing) => Array.isArray(thing);
|
|
54
54
|
const size = (arrayOrString) => arrayOrString.length;
|
|
55
55
|
const getUndefined = () => void 0;
|
|
56
|
+
const getArg = (value) => value;
|
|
56
57
|
|
|
57
58
|
const arrayNew = (size2, cb) =>
|
|
58
59
|
arrayMap(new Array(size2).fill(0), (_, index) => cb(index));
|
|
@@ -566,6 +567,10 @@ const useHasTables = (storeOrStoreId) =>
|
|
|
566
567
|
);
|
|
567
568
|
const useTables = (storeOrStoreId) =>
|
|
568
569
|
useListenable(TABLES, useStoreOrStoreById(storeOrStoreId), 0 /* Object */);
|
|
570
|
+
const useTablesState = (storeOrStoreId) => [
|
|
571
|
+
useTables(storeOrStoreId),
|
|
572
|
+
useSetTablesCallback(getArg, [], storeOrStoreId),
|
|
573
|
+
];
|
|
569
574
|
const useTableIds = (storeOrStoreId) =>
|
|
570
575
|
useListenable(TABLE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
571
576
|
const useHasTable = (tableId, storeOrStoreId) =>
|
|
@@ -576,6 +581,10 @@ const useTable = (tableId, storeOrStoreId) =>
|
|
|
576
581
|
useListenable(TABLE, useStoreOrStoreById(storeOrStoreId), 0 /* Object */, [
|
|
577
582
|
tableId,
|
|
578
583
|
]);
|
|
584
|
+
const useTableState = (tableId, storeOrStoreId) => [
|
|
585
|
+
useTable(tableId, storeOrStoreId),
|
|
586
|
+
useSetTableCallback(tableId, getArg, [], storeOrStoreId),
|
|
587
|
+
];
|
|
579
588
|
const useTableCellIds = (tableId, storeOrStoreId) =>
|
|
580
589
|
useListenable(
|
|
581
590
|
TABLE + CELL_IDS,
|
|
@@ -638,6 +647,10 @@ const useRow = (tableId, rowId, storeOrStoreId) =>
|
|
|
638
647
|
tableId,
|
|
639
648
|
rowId,
|
|
640
649
|
]);
|
|
650
|
+
const useRowState = (tableId, rowId, storeOrStoreId) => [
|
|
651
|
+
useRow(tableId, rowId, storeOrStoreId),
|
|
652
|
+
useSetRowCallback(tableId, rowId, getArg, [], storeOrStoreId),
|
|
653
|
+
];
|
|
641
654
|
const useCellIds = (tableId, rowId, storeOrStoreId) =>
|
|
642
655
|
useListenable(CELL_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */, [
|
|
643
656
|
tableId,
|
|
@@ -656,6 +669,10 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
|
656
669
|
5 /* CellOrValue */,
|
|
657
670
|
[tableId, rowId, cellId],
|
|
658
671
|
);
|
|
672
|
+
const useCellState = (tableId, rowId, cellId, storeOrStoreId) => [
|
|
673
|
+
useCell(tableId, rowId, cellId, storeOrStoreId),
|
|
674
|
+
useSetCellCallback(tableId, rowId, cellId, getArg, [], storeOrStoreId),
|
|
675
|
+
];
|
|
659
676
|
const useHasValues = (storeOrStoreId) =>
|
|
660
677
|
useListenable(
|
|
661
678
|
VALUES,
|
|
@@ -665,6 +682,10 @@ const useHasValues = (storeOrStoreId) =>
|
|
|
665
682
|
);
|
|
666
683
|
const useValues = (storeOrStoreId) =>
|
|
667
684
|
useListenable(VALUES, useStoreOrStoreById(storeOrStoreId), 0 /* Object */);
|
|
685
|
+
const useValuesState = (storeOrStoreId) => [
|
|
686
|
+
useValues(storeOrStoreId),
|
|
687
|
+
useSetValuesCallback(getArg, [], storeOrStoreId),
|
|
688
|
+
];
|
|
668
689
|
const useValueIds = (storeOrStoreId) =>
|
|
669
690
|
useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
670
691
|
const useHasValue = (valueId, storeOrStoreId) =>
|
|
@@ -678,6 +699,10 @@ const useValue = (valueId, storeOrStoreId) =>
|
|
|
678
699
|
5 /* CellOrValue */,
|
|
679
700
|
[valueId],
|
|
680
701
|
);
|
|
702
|
+
const useValueState = (valueId, storeOrStoreId) => [
|
|
703
|
+
useValue(valueId, storeOrStoreId),
|
|
704
|
+
useSetValueCallback(valueId, getArg, [], storeOrStoreId),
|
|
705
|
+
];
|
|
681
706
|
const useSetTablesCallback = (
|
|
682
707
|
getTables,
|
|
683
708
|
getTablesDeps,
|
|
@@ -1580,6 +1605,10 @@ const useParamValues = (queryId, queriesOrQueriesId) =>
|
|
|
1580
1605
|
3 /* ParamValues */,
|
|
1581
1606
|
[queryId],
|
|
1582
1607
|
);
|
|
1608
|
+
const useParamValuesState = (queryId, queriesOrQueriesId) => [
|
|
1609
|
+
useParamValues(queryId, queriesOrQueriesId),
|
|
1610
|
+
useSetParamValuesCallback(queryId, getArg, [], queriesOrQueriesId),
|
|
1611
|
+
];
|
|
1583
1612
|
const useParamValue = (queryId, paramId, queriesOrQueriesId) =>
|
|
1584
1613
|
useListenable(
|
|
1585
1614
|
'ParamValue',
|
|
@@ -1587,6 +1616,10 @@ const useParamValue = (queryId, paramId, queriesOrQueriesId) =>
|
|
|
1587
1616
|
4 /* ParamValue */,
|
|
1588
1617
|
[queryId, paramId],
|
|
1589
1618
|
);
|
|
1619
|
+
const useParamValueState = (queryId, paramId, queriesOrQueriesId) => [
|
|
1620
|
+
useParamValue(queryId, paramId, queriesOrQueriesId),
|
|
1621
|
+
useSetParamValueCallback(queryId, paramId, getArg, [], queriesOrQueriesId),
|
|
1622
|
+
];
|
|
1590
1623
|
const useParamValuesListener = (
|
|
1591
1624
|
queryId,
|
|
1592
1625
|
listener,
|
|
@@ -2356,6 +2389,7 @@ export {
|
|
|
2356
2389
|
useCellIds,
|
|
2357
2390
|
useCellIdsListener,
|
|
2358
2391
|
useCellListener,
|
|
2392
|
+
useCellState,
|
|
2359
2393
|
useCheckpoint,
|
|
2360
2394
|
useCheckpointIds,
|
|
2361
2395
|
useCheckpointIdsListener,
|
|
@@ -2414,6 +2448,8 @@ export {
|
|
|
2414
2448
|
useParamValueListener,
|
|
2415
2449
|
useParamValues,
|
|
2416
2450
|
useParamValuesListener,
|
|
2451
|
+
useParamValuesState,
|
|
2452
|
+
useParamValueState,
|
|
2417
2453
|
usePersister,
|
|
2418
2454
|
usePersisterIds,
|
|
2419
2455
|
usePersisterOrPersisterById,
|
|
@@ -2460,6 +2496,7 @@ export {
|
|
|
2460
2496
|
useRowIds,
|
|
2461
2497
|
useRowIdsListener,
|
|
2462
2498
|
useRowListener,
|
|
2499
|
+
useRowState,
|
|
2463
2500
|
useSetCellCallback,
|
|
2464
2501
|
useSetCheckpointCallback,
|
|
2465
2502
|
useSetParamValueCallback,
|
|
@@ -2496,6 +2533,8 @@ export {
|
|
|
2496
2533
|
useTableListener,
|
|
2497
2534
|
useTables,
|
|
2498
2535
|
useTablesListener,
|
|
2536
|
+
useTablesState,
|
|
2537
|
+
useTableState,
|
|
2499
2538
|
useUndoInformation,
|
|
2500
2539
|
useValue,
|
|
2501
2540
|
useValueIds,
|
|
@@ -2503,6 +2542,8 @@ export {
|
|
|
2503
2542
|
useValueListener,
|
|
2504
2543
|
useValues,
|
|
2505
2544
|
useValuesListener,
|
|
2545
|
+
useValuesState,
|
|
2546
|
+
useValueState,
|
|
2506
2547
|
useWillFinishTransactionListener,
|
|
2507
2548
|
ValuesView,
|
|
2508
2549
|
ValueView,
|
package/ui-react-dom/index.js
CHANGED
|
@@ -55,6 +55,7 @@ const isFunction = (thing) => getTypeOf(thing) == FUNCTION;
|
|
|
55
55
|
const isArray = (thing) => Array.isArray(thing);
|
|
56
56
|
const size = (arrayOrString) => arrayOrString.length;
|
|
57
57
|
const getUndefined = () => void 0;
|
|
58
|
+
const getArg = (value) => value;
|
|
58
59
|
|
|
59
60
|
const arrayEvery = (array, cb) => array.every(cb);
|
|
60
61
|
const arrayIsEqual = (array1, array2) =>
|
|
@@ -343,6 +344,10 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
|
343
344
|
5 /* CellOrValue */,
|
|
344
345
|
[tableId, rowId, cellId],
|
|
345
346
|
);
|
|
347
|
+
const useCellState = (tableId, rowId, cellId, storeOrStoreId) => [
|
|
348
|
+
useCell(tableId, rowId, cellId, storeOrStoreId),
|
|
349
|
+
useSetCellCallback(tableId, rowId, cellId, getArg, [], storeOrStoreId),
|
|
350
|
+
];
|
|
346
351
|
const useValueIds = (storeOrStoreId) =>
|
|
347
352
|
useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
348
353
|
const useValue = (valueId, storeOrStoreId) =>
|
|
@@ -352,6 +357,10 @@ const useValue = (valueId, storeOrStoreId) =>
|
|
|
352
357
|
5 /* CellOrValue */,
|
|
353
358
|
[valueId],
|
|
354
359
|
);
|
|
360
|
+
const useValueState = (valueId, storeOrStoreId) => [
|
|
361
|
+
useValue(valueId, storeOrStoreId),
|
|
362
|
+
useSetValueCallback(valueId, getArg, [], storeOrStoreId),
|
|
363
|
+
];
|
|
355
364
|
const useSetCellCallback = (
|
|
356
365
|
tableId,
|
|
357
366
|
rowId,
|
|
@@ -752,30 +761,27 @@ const EditableCellView = ({
|
|
|
752
761
|
store,
|
|
753
762
|
className,
|
|
754
763
|
showType,
|
|
755
|
-
}) =>
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
rowId,
|
|
761
|
-
cellId,
|
|
762
|
-
(cell) => cell,
|
|
763
|
-
[],
|
|
764
|
-
store,
|
|
765
|
-
),
|
|
764
|
+
}) => {
|
|
765
|
+
const [cell, setCell] = useCellState(tableId, rowId, cellId, store);
|
|
766
|
+
return /* @__PURE__ */ jsx(EditableThing, {
|
|
767
|
+
thing: cell,
|
|
768
|
+
onThingChange: setCell,
|
|
766
769
|
className: className ?? EDITABLE + CELL,
|
|
767
770
|
showType,
|
|
768
771
|
hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
|
|
769
772
|
});
|
|
773
|
+
};
|
|
770
774
|
|
|
771
|
-
const EditableValueView = ({valueId, store, className, showType}) =>
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
+
const EditableValueView = ({valueId, store, className, showType}) => {
|
|
776
|
+
const [value, setValue] = useValueState(valueId, store);
|
|
777
|
+
return /* @__PURE__ */ jsx(EditableThing, {
|
|
778
|
+
thing: value,
|
|
779
|
+
onThingChange: setValue,
|
|
775
780
|
className: className ?? EDITABLE + VALUE,
|
|
776
781
|
showType,
|
|
777
782
|
hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
|
|
778
783
|
});
|
|
784
|
+
};
|
|
779
785
|
|
|
780
786
|
const useDottedCellIds = (tableId, store) =>
|
|
781
787
|
arrayMap(useTableCellIds(tableId, store), (cellId) => tableId + DOT + cellId);
|
|
@@ -55,6 +55,7 @@ const isFunction = (thing) => getTypeOf(thing) == FUNCTION;
|
|
|
55
55
|
const isArray = (thing) => Array.isArray(thing);
|
|
56
56
|
const size = (arrayOrString) => arrayOrString.length;
|
|
57
57
|
const getUndefined = () => void 0;
|
|
58
|
+
const getArg = (value) => value;
|
|
58
59
|
|
|
59
60
|
const arrayEvery = (array, cb) => array.every(cb);
|
|
60
61
|
const arrayIsEqual = (array1, array2) =>
|
|
@@ -343,6 +344,10 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
|
343
344
|
5 /* CellOrValue */,
|
|
344
345
|
[tableId, rowId, cellId],
|
|
345
346
|
);
|
|
347
|
+
const useCellState = (tableId, rowId, cellId, storeOrStoreId) => [
|
|
348
|
+
useCell(tableId, rowId, cellId, storeOrStoreId),
|
|
349
|
+
useSetCellCallback(tableId, rowId, cellId, getArg, [], storeOrStoreId),
|
|
350
|
+
];
|
|
346
351
|
const useValueIds = (storeOrStoreId) =>
|
|
347
352
|
useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
348
353
|
const useValue = (valueId, storeOrStoreId) =>
|
|
@@ -352,6 +357,10 @@ const useValue = (valueId, storeOrStoreId) =>
|
|
|
352
357
|
5 /* CellOrValue */,
|
|
353
358
|
[valueId],
|
|
354
359
|
);
|
|
360
|
+
const useValueState = (valueId, storeOrStoreId) => [
|
|
361
|
+
useValue(valueId, storeOrStoreId),
|
|
362
|
+
useSetValueCallback(valueId, getArg, [], storeOrStoreId),
|
|
363
|
+
];
|
|
355
364
|
const useSetCellCallback = (
|
|
356
365
|
tableId,
|
|
357
366
|
rowId,
|
|
@@ -752,30 +761,27 @@ const EditableCellView = ({
|
|
|
752
761
|
store,
|
|
753
762
|
className,
|
|
754
763
|
showType,
|
|
755
|
-
}) =>
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
rowId,
|
|
761
|
-
cellId,
|
|
762
|
-
(cell) => cell,
|
|
763
|
-
[],
|
|
764
|
-
store,
|
|
765
|
-
),
|
|
764
|
+
}) => {
|
|
765
|
+
const [cell, setCell] = useCellState(tableId, rowId, cellId, store);
|
|
766
|
+
return /* @__PURE__ */ jsx(EditableThing, {
|
|
767
|
+
thing: cell,
|
|
768
|
+
onThingChange: setCell,
|
|
766
769
|
className: className ?? EDITABLE + CELL,
|
|
767
770
|
showType,
|
|
768
771
|
hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
|
|
769
772
|
});
|
|
773
|
+
};
|
|
770
774
|
|
|
771
|
-
const EditableValueView = ({valueId, store, className, showType}) =>
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
+
const EditableValueView = ({valueId, store, className, showType}) => {
|
|
776
|
+
const [value, setValue] = useValueState(valueId, store);
|
|
777
|
+
return /* @__PURE__ */ jsx(EditableThing, {
|
|
778
|
+
thing: value,
|
|
779
|
+
onThingChange: setValue,
|
|
775
780
|
className: className ?? EDITABLE + VALUE,
|
|
776
781
|
showType,
|
|
777
782
|
hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
|
|
778
783
|
});
|
|
784
|
+
};
|
|
779
785
|
|
|
780
786
|
const useDottedCellIds = (tableId, store) =>
|
|
781
787
|
arrayMap(useTableCellIds(tableId, store), (cellId) => tableId + DOT + cellId);
|
|
@@ -100,6 +100,7 @@ const slice = (arrayOrString, start, end) => arrayOrString.slice(start, end);
|
|
|
100
100
|
const size = (arrayOrString) => arrayOrString.length;
|
|
101
101
|
const test = (regex, subject) => regex.test(subject);
|
|
102
102
|
const getUndefined = () => void 0;
|
|
103
|
+
const getArg = (value) => value;
|
|
103
104
|
const errorNew = (message) => {
|
|
104
105
|
throw new Error(message);
|
|
105
106
|
};
|
|
@@ -2373,6 +2374,10 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
|
2373
2374
|
5 /* CellOrValue */,
|
|
2374
2375
|
[tableId, rowId, cellId],
|
|
2375
2376
|
);
|
|
2377
|
+
const useCellState = (tableId, rowId, cellId, storeOrStoreId) => [
|
|
2378
|
+
useCell(tableId, rowId, cellId, storeOrStoreId),
|
|
2379
|
+
useSetCellCallback(tableId, rowId, cellId, getArg, [], storeOrStoreId),
|
|
2380
|
+
];
|
|
2376
2381
|
const useHasValues = (storeOrStoreId) =>
|
|
2377
2382
|
useListenable(
|
|
2378
2383
|
VALUES,
|
|
@@ -2389,6 +2394,10 @@ const useValue = (valueId, storeOrStoreId) =>
|
|
|
2389
2394
|
5 /* CellOrValue */,
|
|
2390
2395
|
[valueId],
|
|
2391
2396
|
);
|
|
2397
|
+
const useValueState = (valueId, storeOrStoreId) => [
|
|
2398
|
+
useValue(valueId, storeOrStoreId),
|
|
2399
|
+
useSetValueCallback(valueId, getArg, [], storeOrStoreId),
|
|
2400
|
+
];
|
|
2392
2401
|
const useSetTableCallback = (
|
|
2393
2402
|
tableId,
|
|
2394
2403
|
getTable,
|
|
@@ -2828,30 +2837,27 @@ const EditableCellView = ({
|
|
|
2828
2837
|
store,
|
|
2829
2838
|
className,
|
|
2830
2839
|
showType,
|
|
2831
|
-
}) =>
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
rowId,
|
|
2837
|
-
cellId,
|
|
2838
|
-
(cell) => cell,
|
|
2839
|
-
[],
|
|
2840
|
-
store,
|
|
2841
|
-
),
|
|
2840
|
+
}) => {
|
|
2841
|
+
const [cell, setCell] = useCellState(tableId, rowId, cellId, store);
|
|
2842
|
+
return /* @__PURE__ */ jsx(EditableThing, {
|
|
2843
|
+
thing: cell,
|
|
2844
|
+
onThingChange: setCell,
|
|
2842
2845
|
className: className ?? EDITABLE + CELL,
|
|
2843
2846
|
showType,
|
|
2844
2847
|
hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
|
|
2845
2848
|
});
|
|
2849
|
+
};
|
|
2846
2850
|
|
|
2847
|
-
const EditableValueView = ({valueId, store, className, showType}) =>
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
+
const EditableValueView = ({valueId, store, className, showType}) => {
|
|
2852
|
+
const [value, setValue] = useValueState(valueId, store);
|
|
2853
|
+
return /* @__PURE__ */ jsx(EditableThing, {
|
|
2854
|
+
thing: value,
|
|
2855
|
+
onThingChange: setValue,
|
|
2851
2856
|
className: className ?? EDITABLE + VALUE,
|
|
2852
2857
|
showType,
|
|
2853
2858
|
hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
|
|
2854
2859
|
});
|
|
2860
|
+
};
|
|
2855
2861
|
|
|
2856
2862
|
const useDottedCellIds = (tableId, store) =>
|
|
2857
2863
|
arrayMap(useTableCellIds(tableId, store), (cellId) => tableId + DOT + cellId);
|
|
@@ -100,6 +100,7 @@ const slice = (arrayOrString, start, end) => arrayOrString.slice(start, end);
|
|
|
100
100
|
const size = (arrayOrString) => arrayOrString.length;
|
|
101
101
|
const test = (regex, subject) => regex.test(subject);
|
|
102
102
|
const getUndefined = () => void 0;
|
|
103
|
+
const getArg = (value) => value;
|
|
103
104
|
const errorNew = (message) => {
|
|
104
105
|
throw new Error(message);
|
|
105
106
|
};
|
|
@@ -2373,6 +2374,10 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
|
2373
2374
|
5 /* CellOrValue */,
|
|
2374
2375
|
[tableId, rowId, cellId],
|
|
2375
2376
|
);
|
|
2377
|
+
const useCellState = (tableId, rowId, cellId, storeOrStoreId) => [
|
|
2378
|
+
useCell(tableId, rowId, cellId, storeOrStoreId),
|
|
2379
|
+
useSetCellCallback(tableId, rowId, cellId, getArg, [], storeOrStoreId),
|
|
2380
|
+
];
|
|
2376
2381
|
const useHasValues = (storeOrStoreId) =>
|
|
2377
2382
|
useListenable(
|
|
2378
2383
|
VALUES,
|
|
@@ -2389,6 +2394,10 @@ const useValue = (valueId, storeOrStoreId) =>
|
|
|
2389
2394
|
5 /* CellOrValue */,
|
|
2390
2395
|
[valueId],
|
|
2391
2396
|
);
|
|
2397
|
+
const useValueState = (valueId, storeOrStoreId) => [
|
|
2398
|
+
useValue(valueId, storeOrStoreId),
|
|
2399
|
+
useSetValueCallback(valueId, getArg, [], storeOrStoreId),
|
|
2400
|
+
];
|
|
2392
2401
|
const useSetTableCallback = (
|
|
2393
2402
|
tableId,
|
|
2394
2403
|
getTable,
|
|
@@ -2828,30 +2837,27 @@ const EditableCellView = ({
|
|
|
2828
2837
|
store,
|
|
2829
2838
|
className,
|
|
2830
2839
|
showType,
|
|
2831
|
-
}) =>
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
rowId,
|
|
2837
|
-
cellId,
|
|
2838
|
-
(cell) => cell,
|
|
2839
|
-
[],
|
|
2840
|
-
store,
|
|
2841
|
-
),
|
|
2840
|
+
}) => {
|
|
2841
|
+
const [cell, setCell] = useCellState(tableId, rowId, cellId, store);
|
|
2842
|
+
return /* @__PURE__ */ jsx(EditableThing, {
|
|
2843
|
+
thing: cell,
|
|
2844
|
+
onThingChange: setCell,
|
|
2842
2845
|
className: className ?? EDITABLE + CELL,
|
|
2843
2846
|
showType,
|
|
2844
2847
|
hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
|
|
2845
2848
|
});
|
|
2849
|
+
};
|
|
2846
2850
|
|
|
2847
|
-
const EditableValueView = ({valueId, store, className, showType}) =>
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
+
const EditableValueView = ({valueId, store, className, showType}) => {
|
|
2852
|
+
const [value, setValue] = useValueState(valueId, store);
|
|
2853
|
+
return /* @__PURE__ */ jsx(EditableThing, {
|
|
2854
|
+
thing: value,
|
|
2855
|
+
onThingChange: setValue,
|
|
2851
2856
|
className: className ?? EDITABLE + VALUE,
|
|
2852
2857
|
showType,
|
|
2853
2858
|
hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
|
|
2854
2859
|
});
|
|
2860
|
+
};
|
|
2855
2861
|
|
|
2856
2862
|
const useDottedCellIds = (tableId, store) =>
|
|
2857
2863
|
arrayMap(useTableCellIds(tableId, store), (cellId) => tableId + DOT + cellId);
|