tinybase 0.9.2 → 0.9.3
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/lib/checkpoints.d.ts +35 -20
- package/lib/debug/checkpoints.d.ts +35 -20
- package/lib/debug/indexes.d.ts +35 -21
- package/lib/debug/metrics.d.ts +43 -18
- package/lib/debug/persisters.d.ts +197 -14
- package/lib/debug/relationships.d.ts +45 -22
- package/lib/debug/store.d.ts +171 -92
- package/lib/debug/tinybase.d.ts +1 -2
- package/lib/debug/ui-react.d.ts +242 -161
- package/lib/debug/ui-react.js +16 -13
- package/lib/indexes.d.ts +35 -21
- package/lib/metrics.d.ts +43 -18
- package/lib/persisters.d.ts +197 -14
- package/lib/relationships.d.ts +45 -22
- package/lib/store.d.ts +171 -92
- package/lib/tinybase.d.ts +1 -2
- package/lib/ui-react.d.ts +242 -161
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/package.json +4 -4
- package/readme.md +13 -13
package/lib/debug/ui-react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The react module of the TinyBase project provides both hooks and
|
|
3
|
-
* to make it easy to create reactive apps with Store objects.
|
|
2
|
+
* The ui-react module of the TinyBase project provides both hooks and
|
|
3
|
+
* components to make it easy to create reactive apps with Store objects.
|
|
4
4
|
*
|
|
5
5
|
* The hooks in this module provide access to the data and structures exposed by
|
|
6
6
|
* other modules in the project. As well as immediate access, they all register
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* to ease the composition of user interfaces that use TinyBase.
|
|
12
12
|
*
|
|
13
13
|
* @packageDocumentation
|
|
14
|
-
* @module react
|
|
14
|
+
* @module ui-react
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import {Callback, Id, IdOrNull, Ids, ParameterizedCallback} from './common';
|
|
@@ -57,8 +57,8 @@ import {Persister} from './persisters.d';
|
|
|
57
57
|
* multiple Store objects into a context that can be used throughout the app. In
|
|
58
58
|
* this case you will want to refer to a Store by its Id in that context.
|
|
59
59
|
*
|
|
60
|
-
* Many hooks and components in this react module take this type as a
|
|
61
|
-
* or a prop, allowing you to pass in either the Store or its Id.
|
|
60
|
+
* Many hooks and components in this ui-react module take this type as a
|
|
61
|
+
* parameter or a prop, allowing you to pass in either the Store or its Id.
|
|
62
62
|
*
|
|
63
63
|
* @category Identity
|
|
64
64
|
*/
|
|
@@ -76,8 +76,8 @@ export type StoreOrStoreId = Store | Id;
|
|
|
76
76
|
* In this case you will want to refer to a Metrics object by its Id in that
|
|
77
77
|
* context.
|
|
78
78
|
*
|
|
79
|
-
* Many hooks and components in this react module take this type as a
|
|
80
|
-
* or a prop, allowing you to pass in either the Store or its Id.
|
|
79
|
+
* Many hooks and components in this ui-react module take this type as a
|
|
80
|
+
* parameter or a prop, allowing you to pass in either the Store or its Id.
|
|
81
81
|
*
|
|
82
82
|
* @category Identity
|
|
83
83
|
*/
|
|
@@ -95,8 +95,8 @@ export type MetricsOrMetricsId = Metrics | Id;
|
|
|
95
95
|
* In this case you will want to refer to an Indexes object by its Id in that
|
|
96
96
|
* context.
|
|
97
97
|
*
|
|
98
|
-
* Many hooks and components in this react module take this type as a
|
|
99
|
-
* or a prop, allowing you to pass in either the Store or its Id.
|
|
98
|
+
* Many hooks and components in this ui-react module take this type as a
|
|
99
|
+
* parameter or a prop, allowing you to pass in either the Store or its Id.
|
|
100
100
|
*
|
|
101
101
|
* @category Identity
|
|
102
102
|
*/
|
|
@@ -114,8 +114,8 @@ export type IndexesOrIndexesId = Indexes | Id;
|
|
|
114
114
|
* app. In this case you will want to refer to a Relationships object by its Id
|
|
115
115
|
* in that context.
|
|
116
116
|
*
|
|
117
|
-
* Many hooks and components in this react module take this type as a
|
|
118
|
-
* or a prop, allowing you to pass in either the Store or its Id.
|
|
117
|
+
* Many hooks and components in this ui-react module take this type as a
|
|
118
|
+
* parameter or a prop, allowing you to pass in either the Store or its Id.
|
|
119
119
|
*
|
|
120
120
|
* @category Identity
|
|
121
121
|
*/
|
|
@@ -133,8 +133,8 @@ export type RelationshipsOrRelationshipsId = Relationships | Id;
|
|
|
133
133
|
* app. In this case you will want to refer to a Checkpoints object by its Id in
|
|
134
134
|
* that context.
|
|
135
135
|
*
|
|
136
|
-
* Many hooks and components in this react module take this type as a
|
|
137
|
-
* or a prop, allowing you to pass in either the Store or its Id.
|
|
136
|
+
* Many hooks and components in this ui-react module take this type as a
|
|
137
|
+
* parameter or a prop, allowing you to pass in either the Store or its Id.
|
|
138
138
|
*
|
|
139
139
|
* @category Identity
|
|
140
140
|
*/
|
|
@@ -183,7 +183,7 @@ export type UndoOrRedoInformation = [boolean, Callback, Id | undefined, string];
|
|
|
183
183
|
* Even though the App component is rendered twice, the Store creation only
|
|
184
184
|
* occurs once by default.
|
|
185
185
|
*
|
|
186
|
-
* ```
|
|
186
|
+
* ```jsx
|
|
187
187
|
* const App = () => {
|
|
188
188
|
* const store = useCreateStore(() => {
|
|
189
189
|
* console.log('Store created');
|
|
@@ -208,7 +208,7 @@ export type UndoOrRedoInformation = [boolean, Callback, Id | undefined, string];
|
|
|
208
208
|
* The useCreateStore hook takes the `fidoSpecies` prop as a dependency, and so
|
|
209
209
|
* the Store is created again on the second render.
|
|
210
210
|
*
|
|
211
|
-
* ```
|
|
211
|
+
* ```jsx
|
|
212
212
|
* const App = ({fidoSpecies}) => {
|
|
213
213
|
* const store = useCreateStore(() => {
|
|
214
214
|
* console.log(`Store created for fido as ${fidoSpecies}`);
|
|
@@ -259,7 +259,7 @@ export function useCreateStore(
|
|
|
259
259
|
* provided. A component within it then uses the useStore hook to get a
|
|
260
260
|
* reference to the Store again, without the need to have it passed as a prop.
|
|
261
261
|
*
|
|
262
|
-
* ```
|
|
262
|
+
* ```jsx
|
|
263
263
|
* const App = ({store}) => (
|
|
264
264
|
* <Provider store={store}>
|
|
265
265
|
* <Pane />
|
|
@@ -278,7 +278,7 @@ export function useCreateStore(
|
|
|
278
278
|
* by Id. A component within it then uses the useStore hook with that Id to get
|
|
279
279
|
* a reference to the Store again, without the need to have it passed as a prop.
|
|
280
280
|
*
|
|
281
|
-
* ```
|
|
281
|
+
* ```jsx
|
|
282
282
|
* const App = ({store}) => (
|
|
283
283
|
* <Provider storesById={{petStore: store}}>
|
|
284
284
|
* <Pane />
|
|
@@ -322,7 +322,7 @@ export function useStore(id?: Id): Store | undefined;
|
|
|
322
322
|
* useTables hook by reference. A change to the data in the Store re-renders the
|
|
323
323
|
* component.
|
|
324
324
|
*
|
|
325
|
-
* ```
|
|
325
|
+
* ```jsx
|
|
326
326
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
327
327
|
* const App = () => <span>{JSON.stringify(useTables(store))}</span>;
|
|
328
328
|
*
|
|
@@ -339,7 +339,7 @@ export function useStore(id?: Id): Store | undefined;
|
|
|
339
339
|
* This example creates a Provider context into which a default Store is
|
|
340
340
|
* provided. A component within it then uses the useTables hook.
|
|
341
341
|
*
|
|
342
|
-
* ```
|
|
342
|
+
* ```jsx
|
|
343
343
|
* const App = ({store}) => (
|
|
344
344
|
* <Provider store={store}>
|
|
345
345
|
* <Pane />
|
|
@@ -357,7 +357,7 @@ export function useStore(id?: Id): Store | undefined;
|
|
|
357
357
|
* This example creates a Provider context into which a Store is provided, named
|
|
358
358
|
* by Id. A component within it then uses the useTables hook.
|
|
359
359
|
*
|
|
360
|
-
* ```
|
|
360
|
+
* ```jsx
|
|
361
361
|
* const App = ({store}) => (
|
|
362
362
|
* <Provider storesById={{petStore: store}}>
|
|
363
363
|
* <Pane />
|
|
@@ -397,7 +397,7 @@ export function useTables(storeOrStoreId?: StoreOrStoreId): Tables;
|
|
|
397
397
|
* useTableIds hook by reference. A change to the data in the Store re-renders
|
|
398
398
|
* the component.
|
|
399
399
|
*
|
|
400
|
-
* ```
|
|
400
|
+
* ```jsx
|
|
401
401
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
402
402
|
* const App = () => <span>{JSON.stringify(useTableIds(store))}</span>;
|
|
403
403
|
*
|
|
@@ -414,7 +414,7 @@ export function useTables(storeOrStoreId?: StoreOrStoreId): Tables;
|
|
|
414
414
|
* This example creates a Provider context into which a default Store is
|
|
415
415
|
* provided. A component within it then uses the useTableIds hook.
|
|
416
416
|
*
|
|
417
|
-
* ```
|
|
417
|
+
* ```jsx
|
|
418
418
|
* const App = ({store}) => (
|
|
419
419
|
* <Provider store={store}>
|
|
420
420
|
* <Pane />
|
|
@@ -432,7 +432,7 @@ export function useTables(storeOrStoreId?: StoreOrStoreId): Tables;
|
|
|
432
432
|
* This example creates a Provider context into which a Store is provided, named
|
|
433
433
|
* by Id. A component within it then uses the useTableIds hook.
|
|
434
434
|
*
|
|
435
|
-
* ```
|
|
435
|
+
* ```jsx
|
|
436
436
|
* const App = ({store}) => (
|
|
437
437
|
* <Provider storesById={{petStore: store}}>
|
|
438
438
|
* <Pane />
|
|
@@ -475,7 +475,7 @@ export function useTableIds(storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
475
475
|
* useTable hook by reference. A change to the data in the Store re-renders the
|
|
476
476
|
* component.
|
|
477
477
|
*
|
|
478
|
-
* ```
|
|
478
|
+
* ```jsx
|
|
479
479
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
480
480
|
* const App = () => <span>{JSON.stringify(useTable('pets', store))}</span>;
|
|
481
481
|
*
|
|
@@ -492,7 +492,7 @@ export function useTableIds(storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
492
492
|
* This example creates a Provider context into which a default Store is
|
|
493
493
|
* provided. A component within it then uses the useTable hook.
|
|
494
494
|
*
|
|
495
|
-
* ```
|
|
495
|
+
* ```jsx
|
|
496
496
|
* const App = ({store}) => (
|
|
497
497
|
* <Provider store={store}>
|
|
498
498
|
* <Pane />
|
|
@@ -510,7 +510,7 @@ export function useTableIds(storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
510
510
|
* This example creates a Provider context into which a Store is provided, named
|
|
511
511
|
* by Id. A component within it then uses the useTable hook.
|
|
512
512
|
*
|
|
513
|
-
* ```
|
|
513
|
+
* ```jsx
|
|
514
514
|
* const App = ({store}) => (
|
|
515
515
|
* <Provider storesById={{petStore: store}}>
|
|
516
516
|
* <Pane />
|
|
@@ -555,7 +555,7 @@ export function useTable(tableId: Id, storeOrStoreId?: StoreOrStoreId): Table;
|
|
|
555
555
|
* useRowIds hook by reference. A change to the data in the Store re-renders
|
|
556
556
|
* the component.
|
|
557
557
|
*
|
|
558
|
-
* ```
|
|
558
|
+
* ```jsx
|
|
559
559
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
560
560
|
* const App = () => <span>{JSON.stringify(useRowIds('pets', store))}</span>;
|
|
561
561
|
*
|
|
@@ -572,7 +572,7 @@ export function useTable(tableId: Id, storeOrStoreId?: StoreOrStoreId): Table;
|
|
|
572
572
|
* This example creates a Provider context into which a default Store is
|
|
573
573
|
* provided. A component within it then uses the useRowIds hook.
|
|
574
574
|
*
|
|
575
|
-
* ```
|
|
575
|
+
* ```jsx
|
|
576
576
|
* const App = ({store}) => (
|
|
577
577
|
* <Provider store={store}>
|
|
578
578
|
* <Pane />
|
|
@@ -590,7 +590,7 @@ export function useTable(tableId: Id, storeOrStoreId?: StoreOrStoreId): Table;
|
|
|
590
590
|
* This example creates a Provider context into which a Store is provided, named
|
|
591
591
|
* by Id. A component within it then uses the useRowIds hook.
|
|
592
592
|
*
|
|
593
|
-
* ```
|
|
593
|
+
* ```jsx
|
|
594
594
|
* const App = ({store}) => (
|
|
595
595
|
* <Provider storesById={{petStore: store}}>
|
|
596
596
|
* <Pane />
|
|
@@ -636,7 +636,7 @@ export function useRowIds(tableId: Id, storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
636
636
|
* useRow hook by reference. A change to the data in the Store re-renders the
|
|
637
637
|
* component.
|
|
638
638
|
*
|
|
639
|
-
* ```
|
|
639
|
+
* ```jsx
|
|
640
640
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
641
641
|
* const App = () => (
|
|
642
642
|
* <span>{JSON.stringify(useRow('pets', 'fido', store))}</span>
|
|
@@ -655,7 +655,7 @@ export function useRowIds(tableId: Id, storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
655
655
|
* This example creates a Provider context into which a default Store is
|
|
656
656
|
* provided. A component within it then uses the useRow hook.
|
|
657
657
|
*
|
|
658
|
-
* ```
|
|
658
|
+
* ```jsx
|
|
659
659
|
* const App = ({store}) => (
|
|
660
660
|
* <Provider store={store}>
|
|
661
661
|
* <Pane />
|
|
@@ -673,7 +673,7 @@ export function useRowIds(tableId: Id, storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
673
673
|
* This example creates a Provider context into which a Store is provided, named
|
|
674
674
|
* by Id. A component within it then uses the useRow hook.
|
|
675
675
|
*
|
|
676
|
-
* ```
|
|
676
|
+
* ```jsx
|
|
677
677
|
* const App = ({store}) => (
|
|
678
678
|
* <Provider storesById={{petStore: store}}>
|
|
679
679
|
* <Pane />
|
|
@@ -723,7 +723,7 @@ export function useRow(
|
|
|
723
723
|
* useCellIds hook by reference. A change to the data in the Store re-renders
|
|
724
724
|
* the component.
|
|
725
725
|
*
|
|
726
|
-
* ```
|
|
726
|
+
* ```jsx
|
|
727
727
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
728
728
|
* const App = () => (
|
|
729
729
|
* <span>{JSON.stringify(useCellIds('pets', 'fido', store))}</span>
|
|
@@ -742,7 +742,7 @@ export function useRow(
|
|
|
742
742
|
* This example creates a Provider context into which a default Store is
|
|
743
743
|
* provided. A component within it then uses the useCellIds hook.
|
|
744
744
|
*
|
|
745
|
-
* ```
|
|
745
|
+
* ```jsx
|
|
746
746
|
* const App = ({store}) => (
|
|
747
747
|
* <Provider store={store}>
|
|
748
748
|
* <Pane />
|
|
@@ -762,7 +762,7 @@ export function useRow(
|
|
|
762
762
|
* This example creates a Provider context into which a Store is provided, named
|
|
763
763
|
* by Id. A component within it then uses the useCellIds hook.
|
|
764
764
|
*
|
|
765
|
-
* ```
|
|
765
|
+
* ```jsx
|
|
766
766
|
* const App = ({store}) => (
|
|
767
767
|
* <Provider storesById={{petStore: store}}>
|
|
768
768
|
* <Pane />
|
|
@@ -813,7 +813,7 @@ export function useCellIds(
|
|
|
813
813
|
* useCell hook by reference. A change to the data in the Store re-renders the
|
|
814
814
|
* component.
|
|
815
815
|
*
|
|
816
|
-
* ```
|
|
816
|
+
* ```jsx
|
|
817
817
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
818
818
|
* const App = () => <span>{useCell('pets', 'fido', 'color', store)}</span>;
|
|
819
819
|
*
|
|
@@ -830,7 +830,7 @@ export function useCellIds(
|
|
|
830
830
|
* This example creates a Provider context into which a default Store is
|
|
831
831
|
* provided. A component within it then uses the useCell hook.
|
|
832
832
|
*
|
|
833
|
-
* ```
|
|
833
|
+
* ```jsx
|
|
834
834
|
* const App = ({store}) => (
|
|
835
835
|
* <Provider store={store}>
|
|
836
836
|
* <Pane />
|
|
@@ -848,7 +848,7 @@ export function useCellIds(
|
|
|
848
848
|
* This example creates a Provider context into which a Store is provided, named
|
|
849
849
|
* by Id. A component within it then uses the useCell hook.
|
|
850
850
|
*
|
|
851
|
-
* ```
|
|
851
|
+
* ```jsx
|
|
852
852
|
* const App = ({store}) => (
|
|
853
853
|
* <Provider storesById={{petStore: store}}>
|
|
854
854
|
* <Pane />
|
|
@@ -917,7 +917,7 @@ export function useCell(
|
|
|
917
917
|
* This example uses the useSetTablesCallback hook to create an event handler
|
|
918
918
|
* which updates the Store when the `span` element is clicked.
|
|
919
919
|
*
|
|
920
|
-
* ```
|
|
920
|
+
* ```jsx
|
|
921
921
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
922
922
|
* const App = () => {
|
|
923
923
|
* const handleClick = useSetTablesCallback(
|
|
@@ -1001,7 +1001,7 @@ export function useSetTablesCallback<Parameter>(
|
|
|
1001
1001
|
* This example uses the useSetTableCallback hook to create an event handler
|
|
1002
1002
|
* which updates the Store when the `span` element is clicked.
|
|
1003
1003
|
*
|
|
1004
|
-
* ```
|
|
1004
|
+
* ```jsx
|
|
1005
1005
|
* const store = createStore().setTable('pets', {nemo: {species: 'fish'}});
|
|
1006
1006
|
* const App = () => {
|
|
1007
1007
|
* const handleClick = useSetTableCallback(
|
|
@@ -1088,7 +1088,7 @@ export function useSetTableCallback<Parameter>(
|
|
|
1088
1088
|
* This example uses the useSetRowCallback hook to create an event handler which
|
|
1089
1089
|
* updates the Store when the `span` element is clicked.
|
|
1090
1090
|
*
|
|
1091
|
-
* ```
|
|
1091
|
+
* ```jsx
|
|
1092
1092
|
* const store = createStore().setRow('pets', 'nemo', {species: 'fish'});
|
|
1093
1093
|
* const App = () => {
|
|
1094
1094
|
* const handleClick = useSetRowCallback(
|
|
@@ -1176,7 +1176,7 @@ export function useSetRowCallback<Parameter>(
|
|
|
1176
1176
|
* This example uses the useAddRowCallback hook to create an event handler which
|
|
1177
1177
|
* updates the Store when the `span` element is clicked.
|
|
1178
1178
|
*
|
|
1179
|
-
* ```
|
|
1179
|
+
* ```jsx
|
|
1180
1180
|
* const store = createStore().setRow('pets', 'nemo', {species: 'fish'});
|
|
1181
1181
|
* const App = () => {
|
|
1182
1182
|
* const handleClick = useAddRowCallback(
|
|
@@ -1264,7 +1264,7 @@ export function useAddRowCallback<Parameter>(
|
|
|
1264
1264
|
* This example uses the useSetPartialRowCallback hook to create an event
|
|
1265
1265
|
* handler which updates the Store when the `span` element is clicked.
|
|
1266
1266
|
*
|
|
1267
|
-
* ```
|
|
1267
|
+
* ```jsx
|
|
1268
1268
|
* const store = createStore().setRow('pets', 'nemo', {species: 'fish'});
|
|
1269
1269
|
* const App = () => {
|
|
1270
1270
|
* const handleClick = useSetPartialRowCallback(
|
|
@@ -1355,7 +1355,7 @@ export function useSetPartialRowCallback<Parameter>(
|
|
|
1355
1355
|
* This example uses the useSetCellCallback hook to create an event handler
|
|
1356
1356
|
* which updates the Store with a Cell value when the `span` element is clicked.
|
|
1357
1357
|
*
|
|
1358
|
-
* ```
|
|
1358
|
+
* ```jsx
|
|
1359
1359
|
* const store = createStore().setCell('pets', 'nemo', 'species', 'fish');
|
|
1360
1360
|
* const App = () => {
|
|
1361
1361
|
* const handleClick = useSetCellCallback(
|
|
@@ -1392,7 +1392,7 @@ export function useSetPartialRowCallback<Parameter>(
|
|
|
1392
1392
|
* which updates the Store via a MapCell function when the `span` element is
|
|
1393
1393
|
* clicked.
|
|
1394
1394
|
*
|
|
1395
|
-
* ```
|
|
1395
|
+
* ```jsx
|
|
1396
1396
|
* const store = createStore().setCell('pets', 'nemo', 'visits', 1);
|
|
1397
1397
|
* const App = () => {
|
|
1398
1398
|
* const handleClick = useSetCellCallback(
|
|
@@ -1466,7 +1466,7 @@ export function useSetCellCallback<Parameter>(
|
|
|
1466
1466
|
* This example uses the useDelTablesCallback hook to create an event handler
|
|
1467
1467
|
* which deletes from the Store when the `span` element is clicked.
|
|
1468
1468
|
*
|
|
1469
|
-
* ```
|
|
1469
|
+
* ```jsx
|
|
1470
1470
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
1471
1471
|
* const App = () => {
|
|
1472
1472
|
* const handleClick = useDelTablesCallback(store, () =>
|
|
@@ -1530,7 +1530,7 @@ export function useDelTablesCallback(
|
|
|
1530
1530
|
* This example uses the useDelTableCallback hook to create an event handler
|
|
1531
1531
|
* which deletes from the Store when the `span` element is clicked.
|
|
1532
1532
|
*
|
|
1533
|
-
* ```
|
|
1533
|
+
* ```jsx
|
|
1534
1534
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
1535
1535
|
* const App = () => {
|
|
1536
1536
|
* const handleClick = useDelTableCallback('pets', store, () =>
|
|
@@ -1596,7 +1596,7 @@ export function useDelTableCallback(
|
|
|
1596
1596
|
* This example uses the useDelRowCallback hook to create an event handler which
|
|
1597
1597
|
* deletes from the Store when the `span` element is clicked.
|
|
1598
1598
|
*
|
|
1599
|
-
* ```
|
|
1599
|
+
* ```jsx
|
|
1600
1600
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
1601
1601
|
* const App = () => {
|
|
1602
1602
|
* const handleClick = useDelRowCallback('pets', 'nemo', store, () =>
|
|
@@ -1667,7 +1667,7 @@ export function useDelRowCallback(
|
|
|
1667
1667
|
* This example uses the useDelCellCallback hook to create an event handler
|
|
1668
1668
|
* which deletes from the Store when the `span` element is clicked.
|
|
1669
1669
|
*
|
|
1670
|
-
* ```
|
|
1670
|
+
* ```jsx
|
|
1671
1671
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
1672
1672
|
* const App = () => {
|
|
1673
1673
|
* const handleClick = useDelCellCallback(
|
|
@@ -1738,7 +1738,7 @@ export function useDelCellCallback(
|
|
|
1738
1738
|
* scoped to a single component. When the component is unmounted, the listener
|
|
1739
1739
|
* is removed from the Store.
|
|
1740
1740
|
*
|
|
1741
|
-
* ```
|
|
1741
|
+
* ```jsx
|
|
1742
1742
|
* const App = ({store}) => (
|
|
1743
1743
|
* <Provider store={store}>
|
|
1744
1744
|
* <Pane />
|
|
@@ -1800,7 +1800,7 @@ export function useTablesListener(
|
|
|
1800
1800
|
* scoped to a single component. When the component is unmounted, the listener
|
|
1801
1801
|
* is removed from the Store.
|
|
1802
1802
|
*
|
|
1803
|
-
* ```
|
|
1803
|
+
* ```jsx
|
|
1804
1804
|
* const App = ({store}) => (
|
|
1805
1805
|
* <Provider store={store}>
|
|
1806
1806
|
* <Pane />
|
|
@@ -1865,7 +1865,7 @@ export function useTableIdsListener(
|
|
|
1865
1865
|
* scoped to a single component. When the component is unmounted, the listener
|
|
1866
1866
|
* is removed from the Store.
|
|
1867
1867
|
*
|
|
1868
|
-
* ```
|
|
1868
|
+
* ```jsx
|
|
1869
1869
|
* const App = ({store}) => (
|
|
1870
1870
|
* <Provider store={store}>
|
|
1871
1871
|
* <Pane />
|
|
@@ -1931,7 +1931,7 @@ export function useTableListener(
|
|
|
1931
1931
|
* scoped to a single component. When the component is unmounted, the listener
|
|
1932
1932
|
* is removed from the Store.
|
|
1933
1933
|
*
|
|
1934
|
-
* ```
|
|
1934
|
+
* ```jsx
|
|
1935
1935
|
* const App = ({store}) => (
|
|
1936
1936
|
* <Provider store={store}>
|
|
1937
1937
|
* <Pane />
|
|
@@ -2004,7 +2004,7 @@ export function useRowIdsListener(
|
|
|
2004
2004
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2005
2005
|
* is removed from the Store.
|
|
2006
2006
|
*
|
|
2007
|
-
* ```
|
|
2007
|
+
* ```jsx
|
|
2008
2008
|
* const App = ({store}) => (
|
|
2009
2009
|
* <Provider store={store}>
|
|
2010
2010
|
* <Pane />
|
|
@@ -2079,7 +2079,7 @@ export function useRowListener(
|
|
|
2079
2079
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2080
2080
|
* is removed from the Store.
|
|
2081
2081
|
*
|
|
2082
|
-
* ```
|
|
2082
|
+
* ```jsx
|
|
2083
2083
|
* const App = ({store}) => (
|
|
2084
2084
|
* <Provider store={store}>
|
|
2085
2085
|
* <Pane />
|
|
@@ -2156,7 +2156,7 @@ export function useCellIdsListener(
|
|
|
2156
2156
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2157
2157
|
* is removed from the Store.
|
|
2158
2158
|
*
|
|
2159
|
-
* ```
|
|
2159
|
+
* ```jsx
|
|
2160
2160
|
* const App = ({store}) => (
|
|
2161
2161
|
* <Provider store={store}>
|
|
2162
2162
|
* <Pane />
|
|
@@ -2227,7 +2227,7 @@ export function useCellListener(
|
|
|
2227
2227
|
* application. Even though the App component is rendered twice, the Metrics
|
|
2228
2228
|
* object creation only occurs once by default.
|
|
2229
2229
|
*
|
|
2230
|
-
* ```
|
|
2230
|
+
* ```jsx
|
|
2231
2231
|
* const App = () => {
|
|
2232
2232
|
* const store = useCreateStore(() =>
|
|
2233
2233
|
* createStore().setTable('species', {dog: {price: 5}, cat: {price: 4}}),
|
|
@@ -2258,7 +2258,7 @@ export function useCellListener(
|
|
|
2258
2258
|
* top-level prop. The useCreateMetrics hook takes the tableToCount prop as a
|
|
2259
2259
|
* dependency, and so the Metrics object is created again on the second render.
|
|
2260
2260
|
*
|
|
2261
|
-
* ```
|
|
2261
|
+
* ```jsx
|
|
2262
2262
|
* const App = ({tableToCount}) => {
|
|
2263
2263
|
* const store = useCreateStore(() =>
|
|
2264
2264
|
* createStore()
|
|
@@ -2323,7 +2323,7 @@ export function useCreateMetrics(
|
|
|
2323
2323
|
* reference to the Metrics object again, without the need to have it passed
|
|
2324
2324
|
* as a prop.
|
|
2325
2325
|
*
|
|
2326
|
-
* ```
|
|
2326
|
+
* ```jsx
|
|
2327
2327
|
* const App = ({metrics}) => (
|
|
2328
2328
|
* <Provider metrics={metrics}>
|
|
2329
2329
|
* <Pane />
|
|
@@ -2343,7 +2343,7 @@ export function useCreateMetrics(
|
|
|
2343
2343
|
* with that Id to get a reference to the Metrics object again, without the need
|
|
2344
2344
|
* to have it passed as a prop.
|
|
2345
2345
|
*
|
|
2346
|
-
* ```
|
|
2346
|
+
* ```jsx
|
|
2347
2347
|
* const App = ({metrics}) => (
|
|
2348
2348
|
* <Provider metricsById={{petStore: metrics}}>
|
|
2349
2349
|
* <Pane />
|
|
@@ -2388,7 +2388,7 @@ export function useMetrics(id?: Id): Metrics | undefined;
|
|
|
2388
2388
|
* in the useMetric hook by reference. A change to the Metric re-renders the
|
|
2389
2389
|
* component.
|
|
2390
2390
|
*
|
|
2391
|
-
* ```
|
|
2391
|
+
* ```jsx
|
|
2392
2392
|
* const store = createStore().setTable('species', {
|
|
2393
2393
|
* dog: {price: 5},
|
|
2394
2394
|
* cat: {price: 4},
|
|
@@ -2411,7 +2411,7 @@ export function useMetrics(id?: Id): Metrics | undefined;
|
|
|
2411
2411
|
* This example creates a Provider context into which a default Metrics object
|
|
2412
2412
|
* is provided. A component within it then uses the useMetric hook.
|
|
2413
2413
|
*
|
|
2414
|
-
* ```
|
|
2414
|
+
* ```jsx
|
|
2415
2415
|
* const App = ({metrics}) => (
|
|
2416
2416
|
* <Provider metrics={metrics}>
|
|
2417
2417
|
* <Pane />
|
|
@@ -2436,7 +2436,7 @@ export function useMetrics(id?: Id): Metrics | undefined;
|
|
|
2436
2436
|
* This example creates a Provider context into which a default Metrics object
|
|
2437
2437
|
* is provided. A component within it then uses the useMetric hook.
|
|
2438
2438
|
*
|
|
2439
|
-
* ```
|
|
2439
|
+
* ```jsx
|
|
2440
2440
|
* const App = ({metrics}) => (
|
|
2441
2441
|
* <Provider metricsById={{petMetrics: metrics}}>
|
|
2442
2442
|
* <Pane />
|
|
@@ -2495,7 +2495,7 @@ export function useMetric(
|
|
|
2495
2495
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2496
2496
|
* is removed from the Metrics object.
|
|
2497
2497
|
*
|
|
2498
|
-
* ```
|
|
2498
|
+
* ```jsx
|
|
2499
2499
|
* const App = ({metrics}) => (
|
|
2500
2500
|
* <Provider metrics={metrics}>
|
|
2501
2501
|
* <Pane />
|
|
@@ -2568,7 +2568,7 @@ export function useMetricListener(
|
|
|
2568
2568
|
* application. Even though the App component is rendered twice, the Indexes
|
|
2569
2569
|
* object creation only occurs once by default.
|
|
2570
2570
|
*
|
|
2571
|
-
* ```
|
|
2571
|
+
* ```jsx
|
|
2572
2572
|
* const App = () => {
|
|
2573
2573
|
* const store = useCreateStore((store) =>
|
|
2574
2574
|
* createStore().setTable('pets', {
|
|
@@ -2604,7 +2604,7 @@ export function useMetricListener(
|
|
|
2604
2604
|
* top-level prop. The useCreateIndexes hook takes the cellToIndex prop as a
|
|
2605
2605
|
* dependency, and so the Indexes object is created again on the second render.
|
|
2606
2606
|
*
|
|
2607
|
-
* ```
|
|
2607
|
+
* ```jsx
|
|
2608
2608
|
* const App = ({cellToIndex}) => {
|
|
2609
2609
|
* const store = useCreateStore(() =>
|
|
2610
2610
|
* createStore().setTable('pets', {
|
|
@@ -2672,7 +2672,7 @@ export function useCreateIndexes(
|
|
|
2672
2672
|
* reference to the Indexes object again, without the need to have it passed
|
|
2673
2673
|
* as a prop.
|
|
2674
2674
|
*
|
|
2675
|
-
* ```
|
|
2675
|
+
* ```jsx
|
|
2676
2676
|
* const App = ({indexes}) => (
|
|
2677
2677
|
* <Provider indexes={indexes}>
|
|
2678
2678
|
* <Pane />
|
|
@@ -2692,7 +2692,7 @@ export function useCreateIndexes(
|
|
|
2692
2692
|
* with that Id to get a reference to the Indexes object again, without the need
|
|
2693
2693
|
* to have it passed as a prop.
|
|
2694
2694
|
*
|
|
2695
|
-
* ```
|
|
2695
|
+
* ```jsx
|
|
2696
2696
|
* const App = ({indexes}) => (
|
|
2697
2697
|
* <Provider indexesById={{petStore: indexes}}>
|
|
2698
2698
|
* <Pane />
|
|
@@ -2737,7 +2737,7 @@ export function useIndexes(id?: Id): Indexes | undefined;
|
|
|
2737
2737
|
* in the useSliceIds hook by reference. A change to the Slice Ids re-renders
|
|
2738
2738
|
* the component.
|
|
2739
2739
|
*
|
|
2740
|
-
* ```
|
|
2740
|
+
* ```jsx
|
|
2741
2741
|
* const store = createStore().setTable('pets', {
|
|
2742
2742
|
* fido: {species: 'dog'},
|
|
2743
2743
|
* felix: {species: 'cat'},
|
|
@@ -2762,7 +2762,7 @@ export function useIndexes(id?: Id): Indexes | undefined;
|
|
|
2762
2762
|
* This example creates a Provider context into which a default Indexes object
|
|
2763
2763
|
* is provided. A component within it then uses the useSliceIds hook.
|
|
2764
2764
|
*
|
|
2765
|
-
* ```
|
|
2765
|
+
* ```jsx
|
|
2766
2766
|
* const App = ({indexes}) => (
|
|
2767
2767
|
* <Provider indexes={indexes}>
|
|
2768
2768
|
* <Pane />
|
|
@@ -2787,7 +2787,7 @@ export function useIndexes(id?: Id): Indexes | undefined;
|
|
|
2787
2787
|
* This example creates a Provider context into which a default Indexes object
|
|
2788
2788
|
* is provided. A component within it then uses the useSliceIds hook.
|
|
2789
2789
|
*
|
|
2790
|
-
* ```
|
|
2790
|
+
* ```jsx
|
|
2791
2791
|
* const App = ({indexes}) => (
|
|
2792
2792
|
* <Provider indexesById={{petIndexes: indexes}}>
|
|
2793
2793
|
* <Pane />
|
|
@@ -2844,7 +2844,7 @@ export function useSliceIds(
|
|
|
2844
2844
|
* in the useSliceRowIds hook by reference. A change to the Row Ids in the Slice
|
|
2845
2845
|
* re-renders the component.
|
|
2846
2846
|
*
|
|
2847
|
-
* ```
|
|
2847
|
+
* ```jsx
|
|
2848
2848
|
* const store = createStore().setTable('pets', {
|
|
2849
2849
|
* fido: {species: 'dog'},
|
|
2850
2850
|
* felix: {species: 'cat'},
|
|
@@ -2871,7 +2871,7 @@ export function useSliceIds(
|
|
|
2871
2871
|
* This example creates a Provider context into which a default Indexes object
|
|
2872
2872
|
* is provided. A component within it then uses the useSliceRowIds hook.
|
|
2873
2873
|
*
|
|
2874
|
-
* ```
|
|
2874
|
+
* ```jsx
|
|
2875
2875
|
* const App = ({indexes}) => (
|
|
2876
2876
|
* <Provider indexes={indexes}>
|
|
2877
2877
|
* <Pane />
|
|
@@ -2898,7 +2898,7 @@ export function useSliceIds(
|
|
|
2898
2898
|
* This example creates a Provider context into which a default Indexes object
|
|
2899
2899
|
* is provided. A component within it then uses the useSliceRowIds hook.
|
|
2900
2900
|
*
|
|
2901
|
-
* ```
|
|
2901
|
+
* ```jsx
|
|
2902
2902
|
* const App = ({indexes}) => (
|
|
2903
2903
|
* <Provider indexesById={{petIndexes: indexes}}>
|
|
2904
2904
|
* <Pane />
|
|
@@ -2963,7 +2963,7 @@ export function useSliceRowIds(
|
|
|
2963
2963
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2964
2964
|
* is removed from the Indexes object.
|
|
2965
2965
|
*
|
|
2966
|
-
* ```
|
|
2966
|
+
* ```jsx
|
|
2967
2967
|
* const App = ({indexes}) => (
|
|
2968
2968
|
* <Provider indexes={indexes}>
|
|
2969
2969
|
* <Pane />
|
|
@@ -3041,7 +3041,7 @@ export function useSliceIdsListener(
|
|
|
3041
3041
|
* is scoped to a single component. When the component is unmounted, the
|
|
3042
3042
|
* listener is removed from the Indexes object.
|
|
3043
3043
|
*
|
|
3044
|
-
* ```
|
|
3044
|
+
* ```jsx
|
|
3045
3045
|
* const App = ({indexes}) => (
|
|
3046
3046
|
* <Provider indexes={indexes}>
|
|
3047
3047
|
* <Pane />
|
|
@@ -3117,7 +3117,7 @@ export function useSliceRowIdsListener(
|
|
|
3117
3117
|
* application. Even though the App component is rendered twice, the
|
|
3118
3118
|
* Relationships object creation only occurs once by default.
|
|
3119
3119
|
*
|
|
3120
|
-
* ```
|
|
3120
|
+
* ```jsx
|
|
3121
3121
|
* const App = () => {
|
|
3122
3122
|
* const store = useCreateStore(() =>
|
|
3123
3123
|
* createStore()
|
|
@@ -3157,7 +3157,7 @@ export function useSliceRowIdsListener(
|
|
|
3157
3157
|
* `remoteTableAndCellToLink` prop as a dependency, and so the Relationships
|
|
3158
3158
|
* object is created again on the second render.
|
|
3159
3159
|
*
|
|
3160
|
-
* ```
|
|
3160
|
+
* ```jsx
|
|
3161
3161
|
* const App = ({remoteTableAndCellToLink}) => {
|
|
3162
3162
|
* const store = useCreateStore(() =>
|
|
3163
3163
|
* createStore()
|
|
@@ -3231,7 +3231,7 @@ export function useCreateRelationships(
|
|
|
3231
3231
|
* to get a reference to the Relationships object again, without the need to
|
|
3232
3232
|
* have it passed as a prop.
|
|
3233
3233
|
*
|
|
3234
|
-
* ```
|
|
3234
|
+
* ```jsx
|
|
3235
3235
|
* const App = ({relationships}) => (
|
|
3236
3236
|
* <Provider relationships={relationships}>
|
|
3237
3237
|
* <Pane />
|
|
@@ -3253,7 +3253,7 @@ export function useCreateRelationships(
|
|
|
3253
3253
|
* hook with that Id to get a reference to the Relationships object again,
|
|
3254
3254
|
* without the need to have it passed as a prop.
|
|
3255
3255
|
*
|
|
3256
|
-
* ```
|
|
3256
|
+
* ```jsx
|
|
3257
3257
|
* const App = ({relationships}) => (
|
|
3258
3258
|
* <Provider relationshipsById={{petStore: relationships}}>
|
|
3259
3259
|
* <Pane />
|
|
@@ -3303,7 +3303,7 @@ export function useRelationships(id?: Id): Relationships | undefined;
|
|
|
3303
3303
|
* used in the useRemoteRowId hook by reference. A change to the remote Row Id
|
|
3304
3304
|
* re-renders the component.
|
|
3305
3305
|
*
|
|
3306
|
-
* ```
|
|
3306
|
+
* ```jsx
|
|
3307
3307
|
* const store = createStore()
|
|
3308
3308
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
3309
3309
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -3330,7 +3330,7 @@ export function useRelationships(id?: Id): Relationships | undefined;
|
|
|
3330
3330
|
* This example creates a Provider context into which a default Relationships
|
|
3331
3331
|
* object is provided. A component within it then uses the useRemoteRowId hook.
|
|
3332
3332
|
*
|
|
3333
|
-
* ```
|
|
3333
|
+
* ```jsx
|
|
3334
3334
|
* const App = ({relationships}) => (
|
|
3335
3335
|
* <Provider relationships={relationships}>
|
|
3336
3336
|
* <Pane />
|
|
@@ -3353,7 +3353,7 @@ export function useRelationships(id?: Id): Relationships | undefined;
|
|
|
3353
3353
|
* This example creates a Provider context into which a default Relationships
|
|
3354
3354
|
* object is provided. A component within it then uses the useRemoteRowId hook.
|
|
3355
3355
|
*
|
|
3356
|
-
* ```
|
|
3356
|
+
* ```jsx
|
|
3357
3357
|
* const App = ({relationships}) => (
|
|
3358
3358
|
* <Provider relationshipsById={{petRelationships: relationships}}>
|
|
3359
3359
|
* <Pane />
|
|
@@ -3410,7 +3410,7 @@ export function useRemoteRowId(
|
|
|
3410
3410
|
* used in the useLocalRowIds hook by reference. A change to the local Row Ids
|
|
3411
3411
|
* re-renders the component.
|
|
3412
3412
|
*
|
|
3413
|
-
* ```
|
|
3413
|
+
* ```jsx
|
|
3414
3414
|
* const store = createStore()
|
|
3415
3415
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
3416
3416
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -3439,7 +3439,7 @@ export function useRemoteRowId(
|
|
|
3439
3439
|
* This example creates a Provider context into which a default Relationships
|
|
3440
3440
|
* object is provided. A component within it then uses the useLocalRowIds hook.
|
|
3441
3441
|
*
|
|
3442
|
-
* ```
|
|
3442
|
+
* ```jsx
|
|
3443
3443
|
* const App = ({relationships}) => (
|
|
3444
3444
|
* <Provider relationships={relationships}>
|
|
3445
3445
|
* <Pane />
|
|
@@ -3464,7 +3464,7 @@ export function useRemoteRowId(
|
|
|
3464
3464
|
* This example creates a Provider context into which a default Relationships
|
|
3465
3465
|
* object is provided. A component within it then uses the useLocalRowIds hook.
|
|
3466
3466
|
*
|
|
3467
|
-
* ```
|
|
3467
|
+
* ```jsx
|
|
3468
3468
|
* const App = ({relationships}) => (
|
|
3469
3469
|
* <Provider relationshipsById={{petRelationships: relationships}}>
|
|
3470
3470
|
* <Pane />
|
|
@@ -3525,7 +3525,7 @@ export function useLocalRowIds(
|
|
|
3525
3525
|
* used in the useLinkedRowIds hook by reference. A change to the linked Row Ids
|
|
3526
3526
|
* re-renders the component.
|
|
3527
3527
|
*
|
|
3528
|
-
* ```
|
|
3528
|
+
* ```jsx
|
|
3529
3529
|
* const store = createStore().setTable('pets', {
|
|
3530
3530
|
* fido: {species: 'dog', next: 'felix'},
|
|
3531
3531
|
* felix: {species: 'cat', next: 'cujo'},
|
|
@@ -3557,7 +3557,7 @@ export function useLocalRowIds(
|
|
|
3557
3557
|
* This example creates a Provider context into which a default Relationships
|
|
3558
3558
|
* object is provided. A component within it then uses the useLinkedRowIds hook.
|
|
3559
3559
|
*
|
|
3560
|
-
* ```
|
|
3560
|
+
* ```jsx
|
|
3561
3561
|
* const App = ({relationships}) => (
|
|
3562
3562
|
* <Provider relationships={relationships}>
|
|
3563
3563
|
* <Pane />
|
|
@@ -3584,7 +3584,7 @@ export function useLocalRowIds(
|
|
|
3584
3584
|
* This example creates a Provider context into which a default Relationships
|
|
3585
3585
|
* object is provided. A component within it then uses the useLinkedRowIds hook.
|
|
3586
3586
|
*
|
|
3587
|
-
* ```
|
|
3587
|
+
* ```jsx
|
|
3588
3588
|
* const App = ({relationships}) => (
|
|
3589
3589
|
* <Provider relationshipsById={{petRelationships: relationships}}>
|
|
3590
3590
|
* <Pane />
|
|
@@ -3661,7 +3661,7 @@ export function useLinkedRowIds(
|
|
|
3661
3661
|
* is scoped to a single component. When the component is unmounted, the
|
|
3662
3662
|
* listener is removed from the Relationships object.
|
|
3663
3663
|
*
|
|
3664
|
-
* ```
|
|
3664
|
+
* ```jsx
|
|
3665
3665
|
* const App = ({relationships}) => (
|
|
3666
3666
|
* <Provider relationships={relationships}>
|
|
3667
3667
|
* <Pane />
|
|
@@ -3749,7 +3749,7 @@ export function useRemoteRowIdListener(
|
|
|
3749
3749
|
* is scoped to a single component. When the component is unmounted, the
|
|
3750
3750
|
* listener is removed from the Relationships object.
|
|
3751
3751
|
*
|
|
3752
|
-
* ```
|
|
3752
|
+
* ```jsx
|
|
3753
3753
|
* const App = ({relationships}) => (
|
|
3754
3754
|
* <Provider relationships={relationships}>
|
|
3755
3755
|
* <Pane />
|
|
@@ -3831,7 +3831,7 @@ export function useLocalRowIdsListener(
|
|
|
3831
3831
|
* is scoped to a single component. When the component is unmounted, the
|
|
3832
3832
|
* listener is removed from the Relationships object.
|
|
3833
3833
|
*
|
|
3834
|
-
* ```
|
|
3834
|
+
* ```jsx
|
|
3835
3835
|
* const App = ({relationships}) => (
|
|
3836
3836
|
* <Provider relationships={relationships}>
|
|
3837
3837
|
* <Pane />
|
|
@@ -3914,7 +3914,7 @@ export function useLinkedRowIdsListener(
|
|
|
3914
3914
|
* application. Even though the App component is rendered twice, the
|
|
3915
3915
|
* Checkpoints object creation only occurs once by default.
|
|
3916
3916
|
*
|
|
3917
|
-
* ```
|
|
3917
|
+
* ```jsx
|
|
3918
3918
|
* const App = () => {
|
|
3919
3919
|
* const store = useCreateStore(createStore);
|
|
3920
3920
|
* const checkpoints = useCreateCheckpoints(store, (store) => {
|
|
@@ -3941,7 +3941,7 @@ export function useLinkedRowIdsListener(
|
|
|
3941
3941
|
* dependency, and so the Checkpoints object is created again on the second
|
|
3942
3942
|
* render.
|
|
3943
3943
|
*
|
|
3944
|
-
* ```
|
|
3944
|
+
* ```jsx
|
|
3945
3945
|
* const App = ({size}) => {
|
|
3946
3946
|
* const store = useCreateStore(createStore);
|
|
3947
3947
|
* const checkpoints = useCreateCheckpoints(
|
|
@@ -3999,7 +3999,7 @@ export function useCreateCheckpoints(
|
|
|
3999
3999
|
* to get a reference to the Checkpoints object again, without the need to have
|
|
4000
4000
|
* it passed as a prop.
|
|
4001
4001
|
*
|
|
4002
|
-
* ```
|
|
4002
|
+
* ```jsx
|
|
4003
4003
|
* const App = ({checkpoints}) => (
|
|
4004
4004
|
* <Provider checkpoints={checkpoints}>
|
|
4005
4005
|
* <Pane />
|
|
@@ -4021,7 +4021,7 @@ export function useCreateCheckpoints(
|
|
|
4021
4021
|
* hook with that Id to get a reference to the Checkpoints object again, without
|
|
4022
4022
|
* the need to have it passed as a prop.
|
|
4023
4023
|
*
|
|
4024
|
-
* ```
|
|
4024
|
+
* ```jsx
|
|
4025
4025
|
* const App = ({checkpoints}) => (
|
|
4026
4026
|
* <Provider checkpointsById={{petStore: checkpoints}}>
|
|
4027
4027
|
* <Pane />
|
|
@@ -4070,7 +4070,7 @@ export function useCheckpoints(id?: Id): Checkpoints | undefined;
|
|
|
4070
4070
|
* used in the useCheckpointIds hook by reference. A change to the checkpoint
|
|
4071
4071
|
* Ids re-renders the component.
|
|
4072
4072
|
*
|
|
4073
|
-
* ```
|
|
4073
|
+
* ```jsx
|
|
4074
4074
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
4075
4075
|
* const checkpoints = createCheckpoints(store);
|
|
4076
4076
|
* const App = () => (
|
|
@@ -4095,7 +4095,7 @@ export function useCheckpoints(id?: Id): Checkpoints | undefined;
|
|
|
4095
4095
|
* object is provided. A component within it then uses the useCheckpointIds
|
|
4096
4096
|
* hook.
|
|
4097
4097
|
*
|
|
4098
|
-
* ```
|
|
4098
|
+
* ```jsx
|
|
4099
4099
|
* const App = ({checkpoints}) => (
|
|
4100
4100
|
* <Provider checkpoints={checkpoints}>
|
|
4101
4101
|
* <Pane />
|
|
@@ -4117,7 +4117,7 @@ export function useCheckpoints(id?: Id): Checkpoints | undefined;
|
|
|
4117
4117
|
* object is provided. A component within it then uses the useCheckpointIds
|
|
4118
4118
|
* hook.
|
|
4119
4119
|
*
|
|
4120
|
-
* ```
|
|
4120
|
+
* ```jsx
|
|
4121
4121
|
* const App = ({checkpoints}) => (
|
|
4122
4122
|
* <Provider checkpointsById={{petCheckpoints: checkpoints}}>
|
|
4123
4123
|
* <Pane />
|
|
@@ -4168,7 +4168,7 @@ export function useCheckpointIds(
|
|
|
4168
4168
|
* used in the useCheckpoint hook by reference. A change to the checkpoint label
|
|
4169
4169
|
* re-renders the component.
|
|
4170
4170
|
*
|
|
4171
|
-
* ```
|
|
4171
|
+
* ```jsx
|
|
4172
4172
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
4173
4173
|
* const checkpoints = createCheckpoints(store);
|
|
4174
4174
|
* const App = () => <span>{useCheckpoint('1', checkpoints)}</span>;
|
|
@@ -4188,7 +4188,7 @@ export function useCheckpointIds(
|
|
|
4188
4188
|
* object is provided. A component within it then uses the useCheckpoint
|
|
4189
4189
|
* hook.
|
|
4190
4190
|
*
|
|
4191
|
-
* ```
|
|
4191
|
+
* ```jsx
|
|
4192
4192
|
* const App = ({checkpoints}) => (
|
|
4193
4193
|
* <Provider checkpoints={checkpoints}>
|
|
4194
4194
|
* <Pane />
|
|
@@ -4210,7 +4210,7 @@ export function useCheckpointIds(
|
|
|
4210
4210
|
* object is provided. A component within it then uses the useCheckpoint
|
|
4211
4211
|
* hook.
|
|
4212
4212
|
*
|
|
4213
|
-
* ```
|
|
4213
|
+
* ```jsx
|
|
4214
4214
|
* const App = ({checkpoints}) => (
|
|
4215
4215
|
* <Provider checkpointsById={{petCheckpoints: checkpoints}}>
|
|
4216
4216
|
* <Pane />
|
|
@@ -4279,7 +4279,7 @@ export function useCheckpoint(
|
|
|
4279
4279
|
* This example uses the useSetCheckpointCallback hook to create an event
|
|
4280
4280
|
* handler which sets a checkpoint when the `span` element is clicked.
|
|
4281
4281
|
*
|
|
4282
|
-
* ```
|
|
4282
|
+
* ```jsx
|
|
4283
4283
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4284
4284
|
* const checkpoints = createCheckpoints(store);
|
|
4285
4285
|
* const App = () => {
|
|
@@ -4336,7 +4336,7 @@ export function useSetCheckpointCallback<Parameter>(
|
|
|
4336
4336
|
* which goes backward in the checkpoint stack when the `span` element is
|
|
4337
4337
|
* clicked.
|
|
4338
4338
|
*
|
|
4339
|
-
* ```
|
|
4339
|
+
* ```jsx
|
|
4340
4340
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4341
4341
|
* const checkpoints = createCheckpoints(store);
|
|
4342
4342
|
* const App = () => (
|
|
@@ -4384,7 +4384,7 @@ export function useGoBackwardCallback(
|
|
|
4384
4384
|
* which goes backward in the checkpoint stack when the `span` element is
|
|
4385
4385
|
* clicked.
|
|
4386
4386
|
*
|
|
4387
|
-
* ```
|
|
4387
|
+
* ```jsx
|
|
4388
4388
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4389
4389
|
* const checkpoints = createCheckpoints(store);
|
|
4390
4390
|
* const App = () => (
|
|
@@ -4461,7 +4461,7 @@ export function useGoForwardCallback(
|
|
|
4461
4461
|
* This example uses the useGoToCallback hook to create an event handler which
|
|
4462
4462
|
* moves to a checkpoint when the `span` element is clicked.
|
|
4463
4463
|
*
|
|
4464
|
-
* ```
|
|
4464
|
+
* ```jsx
|
|
4465
4465
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4466
4466
|
* const checkpoints = createCheckpoints(store);
|
|
4467
4467
|
* const App = () => {
|
|
@@ -4515,7 +4515,7 @@ export function useGoToCallback<Parameter>(
|
|
|
4515
4515
|
* @example
|
|
4516
4516
|
* This example uses the useUndoInformation hook to create an undo button.
|
|
4517
4517
|
*
|
|
4518
|
-
* ```
|
|
4518
|
+
* ```jsx
|
|
4519
4519
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4520
4520
|
* const checkpoints = createCheckpoints(store);
|
|
4521
4521
|
* const App = () => {
|
|
@@ -4561,7 +4561,7 @@ export function useUndoInformation(
|
|
|
4561
4561
|
* @example
|
|
4562
4562
|
* This example uses the useUndoInformation hook to create a redo button.
|
|
4563
4563
|
*
|
|
4564
|
-
* ```
|
|
4564
|
+
* ```jsx
|
|
4565
4565
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4566
4566
|
* const checkpoints = createCheckpoints(store);
|
|
4567
4567
|
* const App = () => {
|
|
@@ -4618,7 +4618,7 @@ export function useRedoInformation(
|
|
|
4618
4618
|
* is scoped to a single component. When the component is unmounted, the
|
|
4619
4619
|
* listener is removed from the Store.
|
|
4620
4620
|
*
|
|
4621
|
-
* ```
|
|
4621
|
+
* ```jsx
|
|
4622
4622
|
* const App = ({checkpoints}) => (
|
|
4623
4623
|
* <Provider checkpoints={checkpoints}>
|
|
4624
4624
|
* <Pane />
|
|
@@ -4688,7 +4688,7 @@ export function useCheckpointIdsListener(
|
|
|
4688
4688
|
* is scoped to a single component. When the component is unmounted, the
|
|
4689
4689
|
* listener is removed from the Store.
|
|
4690
4690
|
*
|
|
4691
|
-
* ```
|
|
4691
|
+
* ```jsx
|
|
4692
4692
|
* const App = ({checkpoints}) => (
|
|
4693
4693
|
* <Provider checkpoints={checkpoints}>
|
|
4694
4694
|
* <Pane />
|
|
@@ -4769,7 +4769,7 @@ export function useCheckpointListener(
|
|
|
4769
4769
|
* Even though the App component is rendered twice, the Persister creation only
|
|
4770
4770
|
* occurs once by default.
|
|
4771
4771
|
*
|
|
4772
|
-
* ```
|
|
4772
|
+
* ```jsx
|
|
4773
4773
|
* const App = () => {
|
|
4774
4774
|
* const store = useCreateStore(createStore);
|
|
4775
4775
|
* const persister = useCreatePersister(
|
|
@@ -4806,7 +4806,7 @@ export function useCheckpointListener(
|
|
|
4806
4806
|
* useCreatePersister hook takes the `sessionKey` prop as a dependency, and so
|
|
4807
4807
|
* the Persister object is created again on the second render.
|
|
4808
4808
|
*
|
|
4809
|
-
* ```
|
|
4809
|
+
* ```jsx
|
|
4810
4810
|
* const App = ({sessionKey}) => {
|
|
4811
4811
|
* const store = useCreateStore(createStore);
|
|
4812
4812
|
* const persister = useCreatePersister(
|
|
@@ -4853,13 +4853,17 @@ export function useCreatePersister(
|
|
|
4853
4853
|
): Persister;
|
|
4854
4854
|
|
|
4855
4855
|
/**
|
|
4856
|
-
* The ExtraProps type represents a set of arbitrary additional props
|
|
4856
|
+
* The ExtraProps type represents a set of arbitrary additional props.
|
|
4857
|
+
*
|
|
4858
|
+
* @category Props
|
|
4857
4859
|
*/
|
|
4858
4860
|
export type ExtraProps = {[propName: string]: any};
|
|
4859
4861
|
|
|
4860
4862
|
/**
|
|
4861
4863
|
* TablesProps props are used for components that refer to all the Tables in a
|
|
4862
4864
|
* Store, such as the TablesView component.
|
|
4865
|
+
*
|
|
4866
|
+
* @category Props
|
|
4863
4867
|
*/
|
|
4864
4868
|
export type TablesProps = {
|
|
4865
4869
|
/**
|
|
@@ -4891,6 +4895,8 @@ export type TablesProps = {
|
|
|
4891
4895
|
/**
|
|
4892
4896
|
* TableProps props are used for components that refer to a single Table in a
|
|
4893
4897
|
* Store, such as the TableView component.
|
|
4898
|
+
*
|
|
4899
|
+
* @category Props
|
|
4894
4900
|
*/
|
|
4895
4901
|
export type TableProps = {
|
|
4896
4902
|
/**
|
|
@@ -4926,6 +4932,8 @@ export type TableProps = {
|
|
|
4926
4932
|
/**
|
|
4927
4933
|
* RowProps props are used for components that refer to a single Row in a Table,
|
|
4928
4934
|
* such as the RowView component.
|
|
4935
|
+
*
|
|
4936
|
+
* @category Props
|
|
4929
4937
|
*/
|
|
4930
4938
|
export type RowProps = {
|
|
4931
4939
|
/**
|
|
@@ -4965,6 +4973,8 @@ export type RowProps = {
|
|
|
4965
4973
|
/**
|
|
4966
4974
|
* RowProps props are used for components that refer to a single Cell in a Row,
|
|
4967
4975
|
* such as the CellView component.
|
|
4976
|
+
*
|
|
4977
|
+
* @category Props
|
|
4968
4978
|
*/
|
|
4969
4979
|
export type CellProps = {
|
|
4970
4980
|
/**
|
|
@@ -4994,6 +5004,8 @@ export type CellProps = {
|
|
|
4994
5004
|
/**
|
|
4995
5005
|
* MetricProps props are used for components that refer to a single Metric in a
|
|
4996
5006
|
* Metrics object, such as the MetricView component.
|
|
5007
|
+
*
|
|
5008
|
+
* @category Props
|
|
4997
5009
|
*/
|
|
4998
5010
|
export type MetricProps = {
|
|
4999
5011
|
/**
|
|
@@ -5016,6 +5028,8 @@ export type MetricProps = {
|
|
|
5016
5028
|
/**
|
|
5017
5029
|
* IndexProps props are used for components that refer to a single Index in an
|
|
5018
5030
|
* Indexes object, such as the IndexView component.
|
|
5031
|
+
*
|
|
5032
|
+
* @category Props
|
|
5019
5033
|
*/
|
|
5020
5034
|
export type IndexProps = {
|
|
5021
5035
|
/**
|
|
@@ -5051,6 +5065,8 @@ export type IndexProps = {
|
|
|
5051
5065
|
/**
|
|
5052
5066
|
* IndexProps props are used for components that refer to a single Slice in an
|
|
5053
5067
|
* Index object, such as the SliceView component.
|
|
5068
|
+
*
|
|
5069
|
+
* @category Props
|
|
5054
5070
|
*/
|
|
5055
5071
|
export type SliceProps = {
|
|
5056
5072
|
/**
|
|
@@ -5091,6 +5107,8 @@ export type SliceProps = {
|
|
|
5091
5107
|
* RemoteRowProps props are used for components that refer to a single
|
|
5092
5108
|
* Relationship in an Relationships object, and where you want to render a
|
|
5093
5109
|
* remote Row based on a local Row, such as in the RemoteRowView component.
|
|
5110
|
+
*
|
|
5111
|
+
* @category Props
|
|
5094
5112
|
*/
|
|
5095
5113
|
export type RemoteRowProps = {
|
|
5096
5114
|
/**
|
|
@@ -5128,6 +5146,8 @@ export type RemoteRowProps = {
|
|
|
5128
5146
|
* LocalRowsProps props are used for components that refer to a single
|
|
5129
5147
|
* Relationship in an Relationships object, and where you want to render local
|
|
5130
5148
|
* Rows based on a remote Row, such as the LocalRowsView component.
|
|
5149
|
+
*
|
|
5150
|
+
* @category Props
|
|
5131
5151
|
*/
|
|
5132
5152
|
export type LocalRowsProps = {
|
|
5133
5153
|
/**
|
|
@@ -5170,6 +5190,8 @@ export type LocalRowsProps = {
|
|
|
5170
5190
|
* Relationship in an Relationships object, and where you want to render a
|
|
5171
5191
|
* linked list of Rows starting from a first Row, such as the LinkedRowsView
|
|
5172
5192
|
* component.
|
|
5193
|
+
*
|
|
5194
|
+
* @category Props
|
|
5173
5195
|
*/
|
|
5174
5196
|
export type LinkedRowsProps = {
|
|
5175
5197
|
/**
|
|
@@ -5210,6 +5232,8 @@ export type LinkedRowsProps = {
|
|
|
5210
5232
|
/**
|
|
5211
5233
|
* CheckpointProps props are used for components that refer to a single
|
|
5212
5234
|
* checkpoint in an Checkpoints object, such as the CheckpointView component.
|
|
5235
|
+
*
|
|
5236
|
+
* @category Props
|
|
5213
5237
|
*/
|
|
5214
5238
|
export type CheckpointProps = {
|
|
5215
5239
|
/**
|
|
@@ -5233,6 +5257,8 @@ export type CheckpointProps = {
|
|
|
5233
5257
|
* BackwardCheckpointsProps props are used for components that refer to a list
|
|
5234
5258
|
* of previous checkpoints in a Checkpoints object, such as the
|
|
5235
5259
|
* BackwardCheckpointsView component.
|
|
5260
|
+
*
|
|
5261
|
+
* @category Props
|
|
5236
5262
|
*/
|
|
5237
5263
|
export type BackwardCheckpointsProps = {
|
|
5238
5264
|
/**
|
|
@@ -5265,6 +5291,8 @@ export type BackwardCheckpointsProps = {
|
|
|
5265
5291
|
* CurrentCheckpointsProps props are used for components that refer to the
|
|
5266
5292
|
* current checkpoints in a Checkpoints object, such as the
|
|
5267
5293
|
* BackwardCheckpointsView component.
|
|
5294
|
+
*
|
|
5295
|
+
* @category Props
|
|
5268
5296
|
*/
|
|
5269
5297
|
export type CurrentCheckpointProps = {
|
|
5270
5298
|
/**
|
|
@@ -5293,6 +5321,8 @@ export type CurrentCheckpointProps = {
|
|
|
5293
5321
|
* ForwardCheckpointsProps props are used for components that refer to a list of
|
|
5294
5322
|
* future checkpoints in a Checkpoints object, such as the
|
|
5295
5323
|
* ForwardCheckpointsView component.
|
|
5324
|
+
*
|
|
5325
|
+
* @category Props
|
|
5296
5326
|
*/
|
|
5297
5327
|
export type ForwardCheckpointsProps = {
|
|
5298
5328
|
/**
|
|
@@ -5324,10 +5354,13 @@ export type ForwardCheckpointsProps = {
|
|
|
5324
5354
|
/**
|
|
5325
5355
|
* ProviderProps props are used with the Provider component, so that Store
|
|
5326
5356
|
* Metrics, Indexes, Relationships, and Checkpoints objects can be passed into
|
|
5327
|
-
* the context of an application and used throughout.
|
|
5328
|
-
*
|
|
5329
|
-
* each type of object can be provided
|
|
5330
|
-
*
|
|
5357
|
+
* the context of an application and used throughout.
|
|
5358
|
+
*
|
|
5359
|
+
* One of each type of object can be provided as a default within the context.
|
|
5360
|
+
* Additionally, multiple of each type of object can be provided in an Id-keyed
|
|
5361
|
+
* map to the `___ById` props.
|
|
5362
|
+
*
|
|
5363
|
+
* @category Props
|
|
5331
5364
|
*/
|
|
5332
5365
|
export type ProviderProps = {
|
|
5333
5366
|
/**
|
|
@@ -5385,6 +5418,8 @@ export type ProviderProps = {
|
|
|
5385
5418
|
/**
|
|
5386
5419
|
* ComponentReturnType is a simple alias for what a React component can return:
|
|
5387
5420
|
* either a ReactElement, or `null` for an empty component.
|
|
5421
|
+
*
|
|
5422
|
+
* @category Component
|
|
5388
5423
|
*/
|
|
5389
5424
|
export type ComponentReturnType = ReactElement<any, any> | null;
|
|
5390
5425
|
|
|
@@ -5398,9 +5433,12 @@ export type ComponentReturnType = ReactElement<any, any> | null;
|
|
|
5398
5433
|
* multiple of each type of object can be provided in an Id-keyed map to the
|
|
5399
5434
|
* `___ById` props.
|
|
5400
5435
|
*
|
|
5401
|
-
* Provider contexts can be nested
|
|
5402
|
-
* if an outer context contains a
|
|
5403
|
-
*
|
|
5436
|
+
* Provider contexts can be nested and the objects passed in will be merged. For
|
|
5437
|
+
* example, if an outer context contains a default Metrics object and an inner
|
|
5438
|
+
* context contains only a default Store, both the Metrics objects and the Store
|
|
5439
|
+
* will be visible within the inner context. If the outer context contains a
|
|
5440
|
+
* Store named by Id and the inner context contains a Store named by a different
|
|
5441
|
+
* Id, both will be visible within the inner context.
|
|
5404
5442
|
*
|
|
5405
5443
|
* @param props The props for this component.
|
|
5406
5444
|
* @returns A rendering of the child components.
|
|
@@ -5410,7 +5448,7 @@ export type ComponentReturnType = ReactElement<any, any> | null;
|
|
|
5410
5448
|
* it then render content from both, without the need to have them passed as
|
|
5411
5449
|
* props.
|
|
5412
5450
|
*
|
|
5413
|
-
* ```
|
|
5451
|
+
* ```jsx
|
|
5414
5452
|
* const App = ({store, metrics}) => (
|
|
5415
5453
|
* <Provider store={store} metricsById={{petStore: metrics}}>
|
|
5416
5454
|
* <Pane />
|
|
@@ -5434,6 +5472,49 @@ export type ComponentReturnType = ReactElement<any, any> | null;
|
|
|
5434
5472
|
* console.log(app.innerHTML);
|
|
5435
5473
|
* // -> '<span>5,4,5</span>'
|
|
5436
5474
|
* ```
|
|
5475
|
+
* @example
|
|
5476
|
+
* This example creates nested Provider contexts into which Store and Metrics
|
|
5477
|
+
* objects are provided, showing how visibility is merged.
|
|
5478
|
+
*
|
|
5479
|
+
* ```jsx
|
|
5480
|
+
* const App = ({petStore, metrics}) => (
|
|
5481
|
+
* <Provider storesById={{pet: petStore}} metrics={metrics}>
|
|
5482
|
+
* <OuterPane />
|
|
5483
|
+
* </Provider>
|
|
5484
|
+
* );
|
|
5485
|
+
* const OuterPane = () => {
|
|
5486
|
+
* const planetStore = useCreateStore(() =>
|
|
5487
|
+
* createStore().setTables({planets: {mars: {moons: 2}}}),
|
|
5488
|
+
* );
|
|
5489
|
+
* return (
|
|
5490
|
+
* <Provider storesById={{planet: planetStore}}>
|
|
5491
|
+
* <InnerPane />
|
|
5492
|
+
* </Provider>
|
|
5493
|
+
* );
|
|
5494
|
+
* };
|
|
5495
|
+
* const InnerPane = () => (
|
|
5496
|
+
* <span>
|
|
5497
|
+
* <CellView tableId="species" rowId="dog" cellId="price" store="pet" />,
|
|
5498
|
+
* {useMetric('highestPrice')},
|
|
5499
|
+
* <CellView
|
|
5500
|
+
* tableId="planets"
|
|
5501
|
+
* rowId="mars"
|
|
5502
|
+
* cellId="moons"
|
|
5503
|
+
* store="planet"
|
|
5504
|
+
* />
|
|
5505
|
+
* </span>
|
|
5506
|
+
* );
|
|
5507
|
+
*
|
|
5508
|
+
* const petStore = createStore();
|
|
5509
|
+
* petStore.setTable('species', {dog: {price: 5}, cat: {price: 4}});
|
|
5510
|
+
* const metrics = createMetrics(petStore);
|
|
5511
|
+
* metrics.setMetricDefinition('highestPrice', 'species', 'max', 'price');
|
|
5512
|
+
*
|
|
5513
|
+
* const app = document.createElement('div');
|
|
5514
|
+
* ReactDOM.render(<App petStore={petStore} metrics={metrics} />, app); // !act
|
|
5515
|
+
* console.log(app.innerHTML);
|
|
5516
|
+
* // -> '<span>5,5,2</span>'
|
|
5517
|
+
* ```
|
|
5437
5518
|
* @category Context components
|
|
5438
5519
|
*/
|
|
5439
5520
|
export function Provider(
|
|
@@ -5464,7 +5545,7 @@ export function Provider(
|
|
|
5464
5545
|
* CellView component by reference. A change to the data in the Store re-renders
|
|
5465
5546
|
* the component.
|
|
5466
5547
|
*
|
|
5467
|
-
* ```
|
|
5548
|
+
* ```jsx
|
|
5468
5549
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
5469
5550
|
* const App = () => (
|
|
5470
5551
|
* <span>
|
|
@@ -5486,7 +5567,7 @@ export function Provider(
|
|
|
5486
5567
|
* provided. The CellView component within it then renders the Cell (with its Id
|
|
5487
5568
|
* for readability).
|
|
5488
5569
|
*
|
|
5489
|
-
* ```
|
|
5570
|
+
* ```jsx
|
|
5490
5571
|
* const App = ({store}) => (
|
|
5491
5572
|
* <Provider store={store}>
|
|
5492
5573
|
* <Pane />
|
|
@@ -5509,7 +5590,7 @@ export function Provider(
|
|
|
5509
5590
|
* provided. The CellView component within it then attempts to render a
|
|
5510
5591
|
* non-existent Cell.
|
|
5511
5592
|
*
|
|
5512
|
-
* ```
|
|
5593
|
+
* ```jsx
|
|
5513
5594
|
* const App = ({store}) => (
|
|
5514
5595
|
* <Provider store={store}>
|
|
5515
5596
|
* <Pane />
|
|
@@ -5560,7 +5641,7 @@ export function CellView(props: CellProps): ComponentReturnType;
|
|
|
5560
5641
|
* RowView component by reference. A change to the data in the Store re-renders
|
|
5561
5642
|
* the component.
|
|
5562
5643
|
*
|
|
5563
|
-
* ```
|
|
5644
|
+
* ```jsx
|
|
5564
5645
|
* const store = createStore().setRow('pets', 'fido', {species: 'dog'});
|
|
5565
5646
|
* const App = () => (
|
|
5566
5647
|
* <div>
|
|
@@ -5582,7 +5663,7 @@ export function CellView(props: CellProps): ComponentReturnType;
|
|
|
5582
5663
|
* provided. The RowView component within it then renders the Row (with Ids for
|
|
5583
5664
|
* readability).
|
|
5584
5665
|
*
|
|
5585
|
-
* ```
|
|
5666
|
+
* ```jsx
|
|
5586
5667
|
* const App = ({store}) => (
|
|
5587
5668
|
* <Provider store={store}>
|
|
5588
5669
|
* <Pane />
|
|
@@ -5608,7 +5689,7 @@ export function CellView(props: CellProps): ComponentReturnType;
|
|
|
5608
5689
|
* provided. The RowView component within it then renders the Row with a custom
|
|
5609
5690
|
* Cell component and a custom props callback.
|
|
5610
5691
|
*
|
|
5611
|
-
* ```
|
|
5692
|
+
* ```jsx
|
|
5612
5693
|
* const App = ({store}) => (
|
|
5613
5694
|
* <Provider store={store}>
|
|
5614
5695
|
* <Pane />
|
|
@@ -5673,7 +5754,7 @@ export function RowView(props: RowProps): ComponentReturnType;
|
|
|
5673
5754
|
* TableView component by reference. A change to the data in the Store
|
|
5674
5755
|
* re-renders the component.
|
|
5675
5756
|
*
|
|
5676
|
-
* ```
|
|
5757
|
+
* ```jsx
|
|
5677
5758
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
5678
5759
|
* const App = () => (
|
|
5679
5760
|
* <div>
|
|
@@ -5695,7 +5776,7 @@ export function RowView(props: RowProps): ComponentReturnType;
|
|
|
5695
5776
|
* provided. The TableView component within it then renders the Table (with Ids
|
|
5696
5777
|
* for readability).
|
|
5697
5778
|
*
|
|
5698
|
-
* ```
|
|
5779
|
+
* ```jsx
|
|
5699
5780
|
* const App = ({store}) => (
|
|
5700
5781
|
* <Provider store={store}>
|
|
5701
5782
|
* <Pane />
|
|
@@ -5721,7 +5802,7 @@ export function RowView(props: RowProps): ComponentReturnType;
|
|
|
5721
5802
|
* provided. The TableView component within it then renders the Table with a
|
|
5722
5803
|
* custom Row component and a custom props callback.
|
|
5723
5804
|
*
|
|
5724
|
-
* ```
|
|
5805
|
+
* ```jsx
|
|
5725
5806
|
* const App = ({store}) => (
|
|
5726
5807
|
* <Provider store={store}>
|
|
5727
5808
|
* <Pane />
|
|
@@ -5781,7 +5862,7 @@ export function TableView(props: TableProps): ComponentReturnType;
|
|
|
5781
5862
|
* TablesView component by reference. A change to the data in the Store
|
|
5782
5863
|
* re-renders the component.
|
|
5783
5864
|
*
|
|
5784
|
-
* ```
|
|
5865
|
+
* ```jsx
|
|
5785
5866
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
5786
5867
|
* const App = () => (
|
|
5787
5868
|
* <div>
|
|
@@ -5803,7 +5884,7 @@ export function TableView(props: TableProps): ComponentReturnType;
|
|
|
5803
5884
|
* provided. The TablesView component within it then renders the Store (with Ids
|
|
5804
5885
|
* for readability).
|
|
5805
5886
|
*
|
|
5806
|
-
* ```
|
|
5887
|
+
* ```jsx
|
|
5807
5888
|
* const App = ({store}) => (
|
|
5808
5889
|
* <Provider store={store}>
|
|
5809
5890
|
* <Pane />
|
|
@@ -5829,7 +5910,7 @@ export function TableView(props: TableProps): ComponentReturnType;
|
|
|
5829
5910
|
* provided. The TablesView component within it then renders the Store with a
|
|
5830
5911
|
* custom Table component and a custom props callback.
|
|
5831
5912
|
*
|
|
5832
|
-
* ```
|
|
5913
|
+
* ```jsx
|
|
5833
5914
|
* const App = ({store}) => (
|
|
5834
5915
|
* <Provider store={store}>
|
|
5835
5916
|
* <Pane />
|
|
@@ -5882,7 +5963,7 @@ export function TablesView(props: TablesProps): ComponentReturnType;
|
|
|
5882
5963
|
* in the MetricView component hook by reference. A change to the Metric
|
|
5883
5964
|
* re-renders the component.
|
|
5884
5965
|
*
|
|
5885
|
-
* ```
|
|
5966
|
+
* ```jsx
|
|
5886
5967
|
* const store = createStore().setTable('species', {
|
|
5887
5968
|
* dog: {price: 5},
|
|
5888
5969
|
* cat: {price: 4},
|
|
@@ -5910,7 +5991,7 @@ export function TablesView(props: TablesProps): ComponentReturnType;
|
|
|
5910
5991
|
* is provided. The MetricView component within it then renders the Metric (with
|
|
5911
5992
|
* its Id for readability).
|
|
5912
5993
|
*
|
|
5913
|
-
* ```
|
|
5994
|
+
* ```jsx
|
|
5914
5995
|
* const App = ({metrics}) => (
|
|
5915
5996
|
* <Provider metrics={metrics}>
|
|
5916
5997
|
* <Pane />
|
|
@@ -5940,7 +6021,7 @@ export function TablesView(props: TablesProps): ComponentReturnType;
|
|
|
5940
6021
|
* is provided. The MetricView component within it then attempts to render a
|
|
5941
6022
|
* non-existent Metric.
|
|
5942
6023
|
*
|
|
5943
|
-
* ```
|
|
6024
|
+
* ```jsx
|
|
5944
6025
|
* const App = ({metrics}) => (
|
|
5945
6026
|
* <Provider metrics={metrics}>
|
|
5946
6027
|
* <Pane />
|
|
@@ -5993,7 +6074,7 @@ export function MetricView(props: MetricProps): ComponentReturnType;
|
|
|
5993
6074
|
* in the SliceView component by reference. A change to the Row Ids re-renders
|
|
5994
6075
|
* the component.
|
|
5995
6076
|
*
|
|
5996
|
-
* ```
|
|
6077
|
+
* ```jsx
|
|
5997
6078
|
* const store = createStore().setTable('pets', {
|
|
5998
6079
|
* fido: {species: 'dog'},
|
|
5999
6080
|
* felix: {species: 'cat'},
|
|
@@ -6025,7 +6106,7 @@ export function MetricView(props: MetricProps): ComponentReturnType;
|
|
|
6025
6106
|
* is provided. The SliceView component within it then renders the Slice (with
|
|
6026
6107
|
* Ids for readability).
|
|
6027
6108
|
*
|
|
6028
|
-
* ```
|
|
6109
|
+
* ```jsx
|
|
6029
6110
|
* const App = ({indexes}) => (
|
|
6030
6111
|
* <Provider indexes={indexes}>
|
|
6031
6112
|
* <Pane />
|
|
@@ -6054,7 +6135,7 @@ export function MetricView(props: MetricProps): ComponentReturnType;
|
|
|
6054
6135
|
* is provided. The SliceView component within it then renders the Slice with a
|
|
6055
6136
|
* custom Row component and a custom props callback.
|
|
6056
6137
|
*
|
|
6057
|
-
* ```
|
|
6138
|
+
* ```jsx
|
|
6058
6139
|
* const App = ({indexes}) => (
|
|
6059
6140
|
* <Provider indexes={indexes}>
|
|
6060
6141
|
* <Pane />
|
|
@@ -6120,7 +6201,7 @@ export function SliceView(props: SliceProps): ComponentReturnType;
|
|
|
6120
6201
|
* in the IndexView component by reference. A change to the Slice Ids re-renders
|
|
6121
6202
|
* the component.
|
|
6122
6203
|
*
|
|
6123
|
-
* ```
|
|
6204
|
+
* ```jsx
|
|
6124
6205
|
* const store = createStore().setTable('pets', {
|
|
6125
6206
|
* fido: {species: 'dog'},
|
|
6126
6207
|
* felix: {species: 'cat'},
|
|
@@ -6147,7 +6228,7 @@ export function SliceView(props: SliceProps): ComponentReturnType;
|
|
|
6147
6228
|
* is provided. The IndexView component within it then renders the Index (with
|
|
6148
6229
|
* Ids for readability).
|
|
6149
6230
|
*
|
|
6150
|
-
* ```
|
|
6231
|
+
* ```jsx
|
|
6151
6232
|
* const App = ({indexes}) => (
|
|
6152
6233
|
* <Provider indexes={indexes}>
|
|
6153
6234
|
* <Pane />
|
|
@@ -6176,7 +6257,7 @@ export function SliceView(props: SliceProps): ComponentReturnType;
|
|
|
6176
6257
|
* is provided. The IndexView component within it then renders the Index with a
|
|
6177
6258
|
* custom Slice component and a custom props callback.
|
|
6178
6259
|
*
|
|
6179
|
-
* ```
|
|
6260
|
+
* ```jsx
|
|
6180
6261
|
* const App = ({indexes}) => (
|
|
6181
6262
|
* <Provider indexes={indexes}>
|
|
6182
6263
|
* <Pane />
|
|
@@ -6243,7 +6324,7 @@ export function IndexView(props: IndexProps): ComponentReturnType;
|
|
|
6243
6324
|
* is used in the RemoteRowView component by reference. A change to the Row Ids
|
|
6244
6325
|
* re-renders the component.
|
|
6245
6326
|
*
|
|
6246
|
-
* ```
|
|
6327
|
+
* ```jsx
|
|
6247
6328
|
* const store = createStore()
|
|
6248
6329
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
6249
6330
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -6277,7 +6358,7 @@ export function IndexView(props: IndexProps): ComponentReturnType;
|
|
|
6277
6358
|
* object is provided. The RemoteRowView component within it then renders the
|
|
6278
6359
|
* remote Row (with Ids for readability).
|
|
6279
6360
|
*
|
|
6280
|
-
* ```
|
|
6361
|
+
* ```jsx
|
|
6281
6362
|
* const App = ({relationships}) => (
|
|
6282
6363
|
* <Provider relationships={relationships}>
|
|
6283
6364
|
* <Pane />
|
|
@@ -6309,7 +6390,7 @@ export function IndexView(props: IndexProps): ComponentReturnType;
|
|
|
6309
6390
|
* object is provided. The RemoteRowView component within it then renders the
|
|
6310
6391
|
* remote Row with a custom Row component and a custom props callback.
|
|
6311
6392
|
*
|
|
6312
|
-
* ```
|
|
6393
|
+
* ```jsx
|
|
6313
6394
|
* const App = ({relationships}) => (
|
|
6314
6395
|
* <Provider relationships={relationships}>
|
|
6315
6396
|
* <Pane />
|
|
@@ -6375,7 +6456,7 @@ export function RemoteRowView(props: RemoteRowProps): ComponentReturnType;
|
|
|
6375
6456
|
* is used in the LocalRowsView component by reference. A change to the Row Ids
|
|
6376
6457
|
* re-renders the component.
|
|
6377
6458
|
*
|
|
6378
|
-
* ```
|
|
6459
|
+
* ```jsx
|
|
6379
6460
|
* const store = createStore()
|
|
6380
6461
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
6381
6462
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -6410,7 +6491,7 @@ export function RemoteRowView(props: RemoteRowProps): ComponentReturnType;
|
|
|
6410
6491
|
* object is provided. The LocalRowsView component within it then renders the
|
|
6411
6492
|
* local Row objects (with Ids for readability).
|
|
6412
6493
|
*
|
|
6413
|
-
* ```
|
|
6494
|
+
* ```jsx
|
|
6414
6495
|
* const App = ({relationships}) => (
|
|
6415
6496
|
* <Provider relationships={relationships}>
|
|
6416
6497
|
* <Pane />
|
|
@@ -6442,7 +6523,7 @@ export function RemoteRowView(props: RemoteRowProps): ComponentReturnType;
|
|
|
6442
6523
|
* object is provided. The LocalRowsView component within it then renders the
|
|
6443
6524
|
* local Row objects with a custom Row component and a custom props callback.
|
|
6444
6525
|
*
|
|
6445
|
-
* ```
|
|
6526
|
+
* ```jsx
|
|
6446
6527
|
* const App = ({relationships}) => (
|
|
6447
6528
|
* <Provider relationships={relationships}>
|
|
6448
6529
|
* <Pane />
|
|
@@ -6508,7 +6589,7 @@ export function LocalRowsView(props: LocalRowsProps): ComponentReturnType;
|
|
|
6508
6589
|
* is used in the LinkedRowsView component by reference. A change to the Row Ids
|
|
6509
6590
|
* re-renders the component.
|
|
6510
6591
|
*
|
|
6511
|
-
* ```
|
|
6592
|
+
* ```jsx
|
|
6512
6593
|
* const store = createStore().setTable('pets', {
|
|
6513
6594
|
* fido: {next: 'felix'},
|
|
6514
6595
|
* felix: {next: 'cujo'},
|
|
@@ -6546,7 +6627,7 @@ export function LocalRowsView(props: LocalRowsProps): ComponentReturnType;
|
|
|
6546
6627
|
* object is provided. The LinkedRowsView component within it then renders the
|
|
6547
6628
|
* local Row objects (with Ids for readability).
|
|
6548
6629
|
*
|
|
6549
|
-
* ```
|
|
6630
|
+
* ```jsx
|
|
6550
6631
|
* const App = ({relationships}) => (
|
|
6551
6632
|
* <Provider relationships={relationships}>
|
|
6552
6633
|
* <Pane />
|
|
@@ -6579,7 +6660,7 @@ export function LocalRowsView(props: LocalRowsProps): ComponentReturnType;
|
|
|
6579
6660
|
* object is provided. The LinkedRowsView component within it then renders the
|
|
6580
6661
|
* local Row objects with a custom Row component and a custom props callback.
|
|
6581
6662
|
*
|
|
6582
|
-
* ```
|
|
6663
|
+
* ```jsx
|
|
6583
6664
|
* const App = ({relationships}) => (
|
|
6584
6665
|
* <Provider relationships={relationships}>
|
|
6585
6666
|
* <Pane />
|
|
@@ -6639,7 +6720,7 @@ export function LinkedRowsView(props: LinkedRowsProps): ComponentReturnType;
|
|
|
6639
6720
|
* used in the CheckpointView component by reference to render a checkpoint with
|
|
6640
6721
|
* a label (with its Id for readability).
|
|
6641
6722
|
*
|
|
6642
|
-
* ```
|
|
6723
|
+
* ```jsx
|
|
6643
6724
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
6644
6725
|
* const checkpoints = createCheckpoints(store);
|
|
6645
6726
|
* const App = () => (
|
|
@@ -6696,7 +6777,7 @@ export function CheckpointView(props: CheckpointProps): ComponentReturnType;
|
|
|
6696
6777
|
* used in the BackwardCheckpointsView component by reference to render a list
|
|
6697
6778
|
* of previous checkpoints.
|
|
6698
6779
|
*
|
|
6699
|
-
* ```
|
|
6780
|
+
* ```jsx
|
|
6700
6781
|
* const store = createStore().setTable('pets', {fido: {color: 'brown'}});
|
|
6701
6782
|
* const checkpoints = createCheckpoints(store);
|
|
6702
6783
|
* const App = () => (
|
|
@@ -6726,7 +6807,7 @@ export function CheckpointView(props: CheckpointProps): ComponentReturnType;
|
|
|
6726
6807
|
* object is provided. The BackwardCheckpointsView component within it then
|
|
6727
6808
|
* renders the list of previous checkpoints (with Ids for readability).
|
|
6728
6809
|
*
|
|
6729
|
-
* ```
|
|
6810
|
+
* ```jsx
|
|
6730
6811
|
* const App = ({checkpoints}) => (
|
|
6731
6812
|
* <Provider checkpoints={checkpoints}>
|
|
6732
6813
|
* <Pane />
|
|
@@ -6758,7 +6839,7 @@ export function CheckpointView(props: CheckpointProps): ComponentReturnType;
|
|
|
6758
6839
|
* renders the list of previous checkpoints with a custom Row component and a
|
|
6759
6840
|
* custom props callback.
|
|
6760
6841
|
*
|
|
6761
|
-
* ```
|
|
6842
|
+
* ```jsx
|
|
6762
6843
|
* const App = ({checkpoints}) => (
|
|
6763
6844
|
* <Provider checkpoints={checkpoints}>
|
|
6764
6845
|
* <Pane />
|
|
@@ -6830,7 +6911,7 @@ export function BackwardCheckpointsView(
|
|
|
6830
6911
|
* used in the CurrentCheckpointView component by reference to render the
|
|
6831
6912
|
* current checkpoints.
|
|
6832
6913
|
*
|
|
6833
|
-
* ```
|
|
6914
|
+
* ```jsx
|
|
6834
6915
|
* const store = createStore().setTable('pets', {fido: {color: 'brown'}});
|
|
6835
6916
|
* const checkpoints = createCheckpoints(store);
|
|
6836
6917
|
* const App = () => (
|
|
@@ -6862,7 +6943,7 @@ export function BackwardCheckpointsView(
|
|
|
6862
6943
|
* object is provided. The CurrentCheckpointView component within it then
|
|
6863
6944
|
* renders current checkpoint (with its Id for readability).
|
|
6864
6945
|
*
|
|
6865
|
-
* ```
|
|
6946
|
+
* ```jsx
|
|
6866
6947
|
* const App = ({checkpoints}) => (
|
|
6867
6948
|
* <Provider checkpoints={checkpoints}>
|
|
6868
6949
|
* <Pane />
|
|
@@ -6891,7 +6972,7 @@ export function BackwardCheckpointsView(
|
|
|
6891
6972
|
* renders the list of future checkpoints with a custom Row component and a
|
|
6892
6973
|
* custom props callback.
|
|
6893
6974
|
*
|
|
6894
|
-
* ```
|
|
6975
|
+
* ```jsx
|
|
6895
6976
|
* const App = ({checkpoints}) => (
|
|
6896
6977
|
* <Provider checkpoints={checkpoints}>
|
|
6897
6978
|
* <Pane />
|
|
@@ -6966,7 +7047,7 @@ export function CurrentCheckpointView(
|
|
|
6966
7047
|
* used in the ForwardCheckpointsView component by reference to render a list
|
|
6967
7048
|
* of future checkpoints.
|
|
6968
7049
|
*
|
|
6969
|
-
* ```
|
|
7050
|
+
* ```jsx
|
|
6970
7051
|
* const store = createStore().setTable('pets', {fido: {color: 'brown'}});
|
|
6971
7052
|
* const checkpoints = createCheckpoints(store);
|
|
6972
7053
|
* const App = () => (
|
|
@@ -6997,7 +7078,7 @@ export function CurrentCheckpointView(
|
|
|
6997
7078
|
* object is provided. The ForwardCheckpointsView component within it then
|
|
6998
7079
|
* renders the list of future checkpoints (with Ids for readability).
|
|
6999
7080
|
*
|
|
7000
|
-
* ```
|
|
7081
|
+
* ```jsx
|
|
7001
7082
|
* const App = ({checkpoints}) => (
|
|
7002
7083
|
* <Provider checkpoints={checkpoints}>
|
|
7003
7084
|
* <Pane />
|
|
@@ -7029,7 +7110,7 @@ export function CurrentCheckpointView(
|
|
|
7029
7110
|
* renders the list of future checkpoints with a custom Row component and a
|
|
7030
7111
|
* custom props callback.
|
|
7031
7112
|
*
|
|
7032
|
-
* ```
|
|
7113
|
+
* ```jsx
|
|
7033
7114
|
* const App = ({checkpoints}) => (
|
|
7034
7115
|
* <Provider checkpoints={checkpoints}>
|
|
7035
7116
|
* <Pane />
|