tinybase 0.9.0 → 0.9.4
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/checkpoints.js +1 -1
- package/lib/checkpoints.js.gz +0 -0
- package/lib/common.d.ts +56 -0
- package/lib/common.js +1 -0
- package/lib/common.js.gz +0 -0
- package/lib/debug/checkpoints.d.ts +35 -20
- package/lib/debug/checkpoints.js +1 -1
- package/lib/debug/common.d.ts +56 -0
- package/lib/debug/common.js +3 -0
- package/lib/debug/indexes.d.ts +35 -76
- package/lib/debug/indexes.js +18 -10
- package/lib/debug/metrics.d.ts +45 -20
- package/lib/debug/metrics.js +1 -1
- package/lib/debug/persisters.d.ts +203 -17
- package/lib/debug/persisters.js +1 -1
- package/lib/debug/relationships.d.ts +46 -23
- package/lib/debug/relationships.js +1 -1
- package/lib/debug/store.d.ts +179 -102
- package/lib/debug/store.js +1 -1
- package/lib/debug/tinybase.d.ts +1 -2
- package/lib/debug/tinybase.js +18 -1029
- package/lib/debug/{react.d.ts → ui-react.d.ts} +262 -162
- package/lib/debug/{react.js → ui-react.js} +24 -15
- package/lib/indexes.d.ts +35 -76
- package/lib/indexes.js +1 -1
- package/lib/indexes.js.gz +0 -0
- package/lib/metrics.d.ts +45 -20
- package/lib/metrics.js +1 -1
- package/lib/metrics.js.gz +0 -0
- package/lib/persisters.d.ts +203 -17
- package/lib/persisters.js +1 -1
- package/lib/persisters.js.gz +0 -0
- package/lib/relationships.d.ts +46 -23
- package/lib/relationships.js +1 -1
- package/lib/relationships.js.gz +0 -0
- package/lib/store.d.ts +179 -102
- package/lib/store.js +1 -1
- package/lib/store.js.gz +0 -0
- package/lib/tinybase.d.ts +1 -2
- package/lib/tinybase.js +1 -1
- package/lib/tinybase.js.gz +0 -0
- package/lib/{react.d.ts → ui-react.d.ts} +262 -162
- package/lib/ui-react.js +1 -0
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/checkpoints.js +1 -1
- package/lib/umd/checkpoints.js.gz +0 -0
- package/lib/umd/common.js +1 -0
- package/lib/umd/common.js.gz +0 -0
- package/lib/umd/indexes.js +1 -1
- package/lib/umd/indexes.js.gz +0 -0
- package/lib/umd/metrics.js +1 -1
- package/lib/umd/metrics.js.gz +0 -0
- package/lib/umd/persisters.js +1 -1
- package/lib/umd/persisters.js.gz +0 -0
- package/lib/umd/relationships.js +1 -1
- package/lib/umd/relationships.js.gz +0 -0
- package/lib/umd/store.js +1 -1
- package/lib/umd/store.js.gz +0 -0
- package/lib/umd/tinybase.js +1 -1
- package/lib/umd/tinybase.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -0
- package/lib/umd/ui-react.js.gz +0 -0
- package/package.json +21 -16
- package/readme.md +13 -13
- package/lib/react.js +0 -1
- package/lib/react.js.gz +0 -0
- package/lib/umd/react.js +0 -1
- package/lib/umd/react.js.gz +0 -0
|
@@ -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.d';
|
|
@@ -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 />
|
|
@@ -2213,6 +2213,9 @@ export function useCellListener(
|
|
|
2213
2213
|
* an array in the optional second parameter, just as you would for any React
|
|
2214
2214
|
* hook with dependencies.
|
|
2215
2215
|
*
|
|
2216
|
+
* This hook ensures the Metrics object is destroyed whenever a new one is
|
|
2217
|
+
* created or the component is unmounted.
|
|
2218
|
+
*
|
|
2216
2219
|
* @param store A reference to the Store for which to create a new Metrics
|
|
2217
2220
|
* object.
|
|
2218
2221
|
* @param create A function for performing the creation steps of the Metrics
|
|
@@ -2227,7 +2230,7 @@ export function useCellListener(
|
|
|
2227
2230
|
* application. Even though the App component is rendered twice, the Metrics
|
|
2228
2231
|
* object creation only occurs once by default.
|
|
2229
2232
|
*
|
|
2230
|
-
* ```
|
|
2233
|
+
* ```jsx
|
|
2231
2234
|
* const App = () => {
|
|
2232
2235
|
* const store = useCreateStore(() =>
|
|
2233
2236
|
* createStore().setTable('species', {dog: {price: 5}, cat: {price: 4}}),
|
|
@@ -2258,7 +2261,7 @@ export function useCellListener(
|
|
|
2258
2261
|
* top-level prop. The useCreateMetrics hook takes the tableToCount prop as a
|
|
2259
2262
|
* dependency, and so the Metrics object is created again on the second render.
|
|
2260
2263
|
*
|
|
2261
|
-
* ```
|
|
2264
|
+
* ```jsx
|
|
2262
2265
|
* const App = ({tableToCount}) => {
|
|
2263
2266
|
* const store = useCreateStore(() =>
|
|
2264
2267
|
* createStore()
|
|
@@ -2323,7 +2326,7 @@ export function useCreateMetrics(
|
|
|
2323
2326
|
* reference to the Metrics object again, without the need to have it passed
|
|
2324
2327
|
* as a prop.
|
|
2325
2328
|
*
|
|
2326
|
-
* ```
|
|
2329
|
+
* ```jsx
|
|
2327
2330
|
* const App = ({metrics}) => (
|
|
2328
2331
|
* <Provider metrics={metrics}>
|
|
2329
2332
|
* <Pane />
|
|
@@ -2343,7 +2346,7 @@ export function useCreateMetrics(
|
|
|
2343
2346
|
* with that Id to get a reference to the Metrics object again, without the need
|
|
2344
2347
|
* to have it passed as a prop.
|
|
2345
2348
|
*
|
|
2346
|
-
* ```
|
|
2349
|
+
* ```jsx
|
|
2347
2350
|
* const App = ({metrics}) => (
|
|
2348
2351
|
* <Provider metricsById={{petStore: metrics}}>
|
|
2349
2352
|
* <Pane />
|
|
@@ -2388,7 +2391,7 @@ export function useMetrics(id?: Id): Metrics | undefined;
|
|
|
2388
2391
|
* in the useMetric hook by reference. A change to the Metric re-renders the
|
|
2389
2392
|
* component.
|
|
2390
2393
|
*
|
|
2391
|
-
* ```
|
|
2394
|
+
* ```jsx
|
|
2392
2395
|
* const store = createStore().setTable('species', {
|
|
2393
2396
|
* dog: {price: 5},
|
|
2394
2397
|
* cat: {price: 4},
|
|
@@ -2411,7 +2414,7 @@ export function useMetrics(id?: Id): Metrics | undefined;
|
|
|
2411
2414
|
* This example creates a Provider context into which a default Metrics object
|
|
2412
2415
|
* is provided. A component within it then uses the useMetric hook.
|
|
2413
2416
|
*
|
|
2414
|
-
* ```
|
|
2417
|
+
* ```jsx
|
|
2415
2418
|
* const App = ({metrics}) => (
|
|
2416
2419
|
* <Provider metrics={metrics}>
|
|
2417
2420
|
* <Pane />
|
|
@@ -2436,7 +2439,7 @@ export function useMetrics(id?: Id): Metrics | undefined;
|
|
|
2436
2439
|
* This example creates a Provider context into which a default Metrics object
|
|
2437
2440
|
* is provided. A component within it then uses the useMetric hook.
|
|
2438
2441
|
*
|
|
2439
|
-
* ```
|
|
2442
|
+
* ```jsx
|
|
2440
2443
|
* const App = ({metrics}) => (
|
|
2441
2444
|
* <Provider metricsById={{petMetrics: metrics}}>
|
|
2442
2445
|
* <Pane />
|
|
@@ -2495,7 +2498,7 @@ export function useMetric(
|
|
|
2495
2498
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2496
2499
|
* is removed from the Metrics object.
|
|
2497
2500
|
*
|
|
2498
|
-
* ```
|
|
2501
|
+
* ```jsx
|
|
2499
2502
|
* const App = ({metrics}) => (
|
|
2500
2503
|
* <Provider metrics={metrics}>
|
|
2501
2504
|
* <Pane />
|
|
@@ -2554,6 +2557,9 @@ export function useMetricListener(
|
|
|
2554
2557
|
* an array in the optional second parameter, just as you would for any React
|
|
2555
2558
|
* hook with dependencies.
|
|
2556
2559
|
*
|
|
2560
|
+
* This hook ensures the Indexes object is destroyed whenever a new one is
|
|
2561
|
+
* created or the component is unmounted.
|
|
2562
|
+
*
|
|
2557
2563
|
* @param store A reference to the Store for which to create a new Indexes
|
|
2558
2564
|
* object.
|
|
2559
2565
|
* @param create A function for performing the creation steps of the Indexes
|
|
@@ -2568,7 +2574,7 @@ export function useMetricListener(
|
|
|
2568
2574
|
* application. Even though the App component is rendered twice, the Indexes
|
|
2569
2575
|
* object creation only occurs once by default.
|
|
2570
2576
|
*
|
|
2571
|
-
* ```
|
|
2577
|
+
* ```jsx
|
|
2572
2578
|
* const App = () => {
|
|
2573
2579
|
* const store = useCreateStore((store) =>
|
|
2574
2580
|
* createStore().setTable('pets', {
|
|
@@ -2604,7 +2610,7 @@ export function useMetricListener(
|
|
|
2604
2610
|
* top-level prop. The useCreateIndexes hook takes the cellToIndex prop as a
|
|
2605
2611
|
* dependency, and so the Indexes object is created again on the second render.
|
|
2606
2612
|
*
|
|
2607
|
-
* ```
|
|
2613
|
+
* ```jsx
|
|
2608
2614
|
* const App = ({cellToIndex}) => {
|
|
2609
2615
|
* const store = useCreateStore(() =>
|
|
2610
2616
|
* createStore().setTable('pets', {
|
|
@@ -2672,7 +2678,7 @@ export function useCreateIndexes(
|
|
|
2672
2678
|
* reference to the Indexes object again, without the need to have it passed
|
|
2673
2679
|
* as a prop.
|
|
2674
2680
|
*
|
|
2675
|
-
* ```
|
|
2681
|
+
* ```jsx
|
|
2676
2682
|
* const App = ({indexes}) => (
|
|
2677
2683
|
* <Provider indexes={indexes}>
|
|
2678
2684
|
* <Pane />
|
|
@@ -2692,7 +2698,7 @@ export function useCreateIndexes(
|
|
|
2692
2698
|
* with that Id to get a reference to the Indexes object again, without the need
|
|
2693
2699
|
* to have it passed as a prop.
|
|
2694
2700
|
*
|
|
2695
|
-
* ```
|
|
2701
|
+
* ```jsx
|
|
2696
2702
|
* const App = ({indexes}) => (
|
|
2697
2703
|
* <Provider indexesById={{petStore: indexes}}>
|
|
2698
2704
|
* <Pane />
|
|
@@ -2737,7 +2743,7 @@ export function useIndexes(id?: Id): Indexes | undefined;
|
|
|
2737
2743
|
* in the useSliceIds hook by reference. A change to the Slice Ids re-renders
|
|
2738
2744
|
* the component.
|
|
2739
2745
|
*
|
|
2740
|
-
* ```
|
|
2746
|
+
* ```jsx
|
|
2741
2747
|
* const store = createStore().setTable('pets', {
|
|
2742
2748
|
* fido: {species: 'dog'},
|
|
2743
2749
|
* felix: {species: 'cat'},
|
|
@@ -2762,7 +2768,7 @@ export function useIndexes(id?: Id): Indexes | undefined;
|
|
|
2762
2768
|
* This example creates a Provider context into which a default Indexes object
|
|
2763
2769
|
* is provided. A component within it then uses the useSliceIds hook.
|
|
2764
2770
|
*
|
|
2765
|
-
* ```
|
|
2771
|
+
* ```jsx
|
|
2766
2772
|
* const App = ({indexes}) => (
|
|
2767
2773
|
* <Provider indexes={indexes}>
|
|
2768
2774
|
* <Pane />
|
|
@@ -2787,7 +2793,7 @@ export function useIndexes(id?: Id): Indexes | undefined;
|
|
|
2787
2793
|
* This example creates a Provider context into which a default Indexes object
|
|
2788
2794
|
* is provided. A component within it then uses the useSliceIds hook.
|
|
2789
2795
|
*
|
|
2790
|
-
* ```
|
|
2796
|
+
* ```jsx
|
|
2791
2797
|
* const App = ({indexes}) => (
|
|
2792
2798
|
* <Provider indexesById={{petIndexes: indexes}}>
|
|
2793
2799
|
* <Pane />
|
|
@@ -2844,7 +2850,7 @@ export function useSliceIds(
|
|
|
2844
2850
|
* in the useSliceRowIds hook by reference. A change to the Row Ids in the Slice
|
|
2845
2851
|
* re-renders the component.
|
|
2846
2852
|
*
|
|
2847
|
-
* ```
|
|
2853
|
+
* ```jsx
|
|
2848
2854
|
* const store = createStore().setTable('pets', {
|
|
2849
2855
|
* fido: {species: 'dog'},
|
|
2850
2856
|
* felix: {species: 'cat'},
|
|
@@ -2871,7 +2877,7 @@ export function useSliceIds(
|
|
|
2871
2877
|
* This example creates a Provider context into which a default Indexes object
|
|
2872
2878
|
* is provided. A component within it then uses the useSliceRowIds hook.
|
|
2873
2879
|
*
|
|
2874
|
-
* ```
|
|
2880
|
+
* ```jsx
|
|
2875
2881
|
* const App = ({indexes}) => (
|
|
2876
2882
|
* <Provider indexes={indexes}>
|
|
2877
2883
|
* <Pane />
|
|
@@ -2898,7 +2904,7 @@ export function useSliceIds(
|
|
|
2898
2904
|
* This example creates a Provider context into which a default Indexes object
|
|
2899
2905
|
* is provided. A component within it then uses the useSliceRowIds hook.
|
|
2900
2906
|
*
|
|
2901
|
-
* ```
|
|
2907
|
+
* ```jsx
|
|
2902
2908
|
* const App = ({indexes}) => (
|
|
2903
2909
|
* <Provider indexesById={{petIndexes: indexes}}>
|
|
2904
2910
|
* <Pane />
|
|
@@ -2963,7 +2969,7 @@ export function useSliceRowIds(
|
|
|
2963
2969
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2964
2970
|
* is removed from the Indexes object.
|
|
2965
2971
|
*
|
|
2966
|
-
* ```
|
|
2972
|
+
* ```jsx
|
|
2967
2973
|
* const App = ({indexes}) => (
|
|
2968
2974
|
* <Provider indexes={indexes}>
|
|
2969
2975
|
* <Pane />
|
|
@@ -3041,7 +3047,7 @@ export function useSliceIdsListener(
|
|
|
3041
3047
|
* is scoped to a single component. When the component is unmounted, the
|
|
3042
3048
|
* listener is removed from the Indexes object.
|
|
3043
3049
|
*
|
|
3044
|
-
* ```
|
|
3050
|
+
* ```jsx
|
|
3045
3051
|
* const App = ({indexes}) => (
|
|
3046
3052
|
* <Provider indexes={indexes}>
|
|
3047
3053
|
* <Pane />
|
|
@@ -3104,6 +3110,9 @@ export function useSliceRowIdsListener(
|
|
|
3104
3110
|
* them in an array in the optional second parameter, just as you would for any
|
|
3105
3111
|
* React hook with dependencies.
|
|
3106
3112
|
*
|
|
3113
|
+
* This hook ensures the Relationships object is destroyed whenever a new one is
|
|
3114
|
+
* created or the component is unmounted.
|
|
3115
|
+
*
|
|
3107
3116
|
* @param store A reference to the Store for which to create a new Relationships
|
|
3108
3117
|
* object.
|
|
3109
3118
|
* @param create An optional callback for performing post-creation steps on the
|
|
@@ -3117,7 +3126,7 @@ export function useSliceRowIdsListener(
|
|
|
3117
3126
|
* application. Even though the App component is rendered twice, the
|
|
3118
3127
|
* Relationships object creation only occurs once by default.
|
|
3119
3128
|
*
|
|
3120
|
-
* ```
|
|
3129
|
+
* ```jsx
|
|
3121
3130
|
* const App = () => {
|
|
3122
3131
|
* const store = useCreateStore(() =>
|
|
3123
3132
|
* createStore()
|
|
@@ -3157,7 +3166,7 @@ export function useSliceRowIdsListener(
|
|
|
3157
3166
|
* `remoteTableAndCellToLink` prop as a dependency, and so the Relationships
|
|
3158
3167
|
* object is created again on the second render.
|
|
3159
3168
|
*
|
|
3160
|
-
* ```
|
|
3169
|
+
* ```jsx
|
|
3161
3170
|
* const App = ({remoteTableAndCellToLink}) => {
|
|
3162
3171
|
* const store = useCreateStore(() =>
|
|
3163
3172
|
* createStore()
|
|
@@ -3231,7 +3240,7 @@ export function useCreateRelationships(
|
|
|
3231
3240
|
* to get a reference to the Relationships object again, without the need to
|
|
3232
3241
|
* have it passed as a prop.
|
|
3233
3242
|
*
|
|
3234
|
-
* ```
|
|
3243
|
+
* ```jsx
|
|
3235
3244
|
* const App = ({relationships}) => (
|
|
3236
3245
|
* <Provider relationships={relationships}>
|
|
3237
3246
|
* <Pane />
|
|
@@ -3253,7 +3262,7 @@ export function useCreateRelationships(
|
|
|
3253
3262
|
* hook with that Id to get a reference to the Relationships object again,
|
|
3254
3263
|
* without the need to have it passed as a prop.
|
|
3255
3264
|
*
|
|
3256
|
-
* ```
|
|
3265
|
+
* ```jsx
|
|
3257
3266
|
* const App = ({relationships}) => (
|
|
3258
3267
|
* <Provider relationshipsById={{petStore: relationships}}>
|
|
3259
3268
|
* <Pane />
|
|
@@ -3303,7 +3312,7 @@ export function useRelationships(id?: Id): Relationships | undefined;
|
|
|
3303
3312
|
* used in the useRemoteRowId hook by reference. A change to the remote Row Id
|
|
3304
3313
|
* re-renders the component.
|
|
3305
3314
|
*
|
|
3306
|
-
* ```
|
|
3315
|
+
* ```jsx
|
|
3307
3316
|
* const store = createStore()
|
|
3308
3317
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
3309
3318
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -3330,7 +3339,7 @@ export function useRelationships(id?: Id): Relationships | undefined;
|
|
|
3330
3339
|
* This example creates a Provider context into which a default Relationships
|
|
3331
3340
|
* object is provided. A component within it then uses the useRemoteRowId hook.
|
|
3332
3341
|
*
|
|
3333
|
-
* ```
|
|
3342
|
+
* ```jsx
|
|
3334
3343
|
* const App = ({relationships}) => (
|
|
3335
3344
|
* <Provider relationships={relationships}>
|
|
3336
3345
|
* <Pane />
|
|
@@ -3353,7 +3362,7 @@ export function useRelationships(id?: Id): Relationships | undefined;
|
|
|
3353
3362
|
* This example creates a Provider context into which a default Relationships
|
|
3354
3363
|
* object is provided. A component within it then uses the useRemoteRowId hook.
|
|
3355
3364
|
*
|
|
3356
|
-
* ```
|
|
3365
|
+
* ```jsx
|
|
3357
3366
|
* const App = ({relationships}) => (
|
|
3358
3367
|
* <Provider relationshipsById={{petRelationships: relationships}}>
|
|
3359
3368
|
* <Pane />
|
|
@@ -3410,7 +3419,7 @@ export function useRemoteRowId(
|
|
|
3410
3419
|
* used in the useLocalRowIds hook by reference. A change to the local Row Ids
|
|
3411
3420
|
* re-renders the component.
|
|
3412
3421
|
*
|
|
3413
|
-
* ```
|
|
3422
|
+
* ```jsx
|
|
3414
3423
|
* const store = createStore()
|
|
3415
3424
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
3416
3425
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -3439,7 +3448,7 @@ export function useRemoteRowId(
|
|
|
3439
3448
|
* This example creates a Provider context into which a default Relationships
|
|
3440
3449
|
* object is provided. A component within it then uses the useLocalRowIds hook.
|
|
3441
3450
|
*
|
|
3442
|
-
* ```
|
|
3451
|
+
* ```jsx
|
|
3443
3452
|
* const App = ({relationships}) => (
|
|
3444
3453
|
* <Provider relationships={relationships}>
|
|
3445
3454
|
* <Pane />
|
|
@@ -3464,7 +3473,7 @@ export function useRemoteRowId(
|
|
|
3464
3473
|
* This example creates a Provider context into which a default Relationships
|
|
3465
3474
|
* object is provided. A component within it then uses the useLocalRowIds hook.
|
|
3466
3475
|
*
|
|
3467
|
-
* ```
|
|
3476
|
+
* ```jsx
|
|
3468
3477
|
* const App = ({relationships}) => (
|
|
3469
3478
|
* <Provider relationshipsById={{petRelationships: relationships}}>
|
|
3470
3479
|
* <Pane />
|
|
@@ -3525,7 +3534,7 @@ export function useLocalRowIds(
|
|
|
3525
3534
|
* used in the useLinkedRowIds hook by reference. A change to the linked Row Ids
|
|
3526
3535
|
* re-renders the component.
|
|
3527
3536
|
*
|
|
3528
|
-
* ```
|
|
3537
|
+
* ```jsx
|
|
3529
3538
|
* const store = createStore().setTable('pets', {
|
|
3530
3539
|
* fido: {species: 'dog', next: 'felix'},
|
|
3531
3540
|
* felix: {species: 'cat', next: 'cujo'},
|
|
@@ -3557,7 +3566,7 @@ export function useLocalRowIds(
|
|
|
3557
3566
|
* This example creates a Provider context into which a default Relationships
|
|
3558
3567
|
* object is provided. A component within it then uses the useLinkedRowIds hook.
|
|
3559
3568
|
*
|
|
3560
|
-
* ```
|
|
3569
|
+
* ```jsx
|
|
3561
3570
|
* const App = ({relationships}) => (
|
|
3562
3571
|
* <Provider relationships={relationships}>
|
|
3563
3572
|
* <Pane />
|
|
@@ -3584,7 +3593,7 @@ export function useLocalRowIds(
|
|
|
3584
3593
|
* This example creates a Provider context into which a default Relationships
|
|
3585
3594
|
* object is provided. A component within it then uses the useLinkedRowIds hook.
|
|
3586
3595
|
*
|
|
3587
|
-
* ```
|
|
3596
|
+
* ```jsx
|
|
3588
3597
|
* const App = ({relationships}) => (
|
|
3589
3598
|
* <Provider relationshipsById={{petRelationships: relationships}}>
|
|
3590
3599
|
* <Pane />
|
|
@@ -3661,7 +3670,7 @@ export function useLinkedRowIds(
|
|
|
3661
3670
|
* is scoped to a single component. When the component is unmounted, the
|
|
3662
3671
|
* listener is removed from the Relationships object.
|
|
3663
3672
|
*
|
|
3664
|
-
* ```
|
|
3673
|
+
* ```jsx
|
|
3665
3674
|
* const App = ({relationships}) => (
|
|
3666
3675
|
* <Provider relationships={relationships}>
|
|
3667
3676
|
* <Pane />
|
|
@@ -3749,7 +3758,7 @@ export function useRemoteRowIdListener(
|
|
|
3749
3758
|
* is scoped to a single component. When the component is unmounted, the
|
|
3750
3759
|
* listener is removed from the Relationships object.
|
|
3751
3760
|
*
|
|
3752
|
-
* ```
|
|
3761
|
+
* ```jsx
|
|
3753
3762
|
* const App = ({relationships}) => (
|
|
3754
3763
|
* <Provider relationships={relationships}>
|
|
3755
3764
|
* <Pane />
|
|
@@ -3831,7 +3840,7 @@ export function useLocalRowIdsListener(
|
|
|
3831
3840
|
* is scoped to a single component. When the component is unmounted, the
|
|
3832
3841
|
* listener is removed from the Relationships object.
|
|
3833
3842
|
*
|
|
3834
|
-
* ```
|
|
3843
|
+
* ```jsx
|
|
3835
3844
|
* const App = ({relationships}) => (
|
|
3836
3845
|
* <Provider relationships={relationships}>
|
|
3837
3846
|
* <Pane />
|
|
@@ -3900,6 +3909,9 @@ export function useLinkedRowIdsListener(
|
|
|
3900
3909
|
* them in an array in the optional second parameter, just as you would for any
|
|
3901
3910
|
* React hook with dependencies.
|
|
3902
3911
|
*
|
|
3912
|
+
* This hook ensures the Checkpoints object is destroyed whenever a new one is
|
|
3913
|
+
* created or the component is unmounted.
|
|
3914
|
+
*
|
|
3903
3915
|
* @param store A reference to the Store for which to create a new Checkpoints
|
|
3904
3916
|
* object.
|
|
3905
3917
|
* @param create A function for performing the creation steps of the Checkpoints
|
|
@@ -3914,7 +3926,7 @@ export function useLinkedRowIdsListener(
|
|
|
3914
3926
|
* application. Even though the App component is rendered twice, the
|
|
3915
3927
|
* Checkpoints object creation only occurs once by default.
|
|
3916
3928
|
*
|
|
3917
|
-
* ```
|
|
3929
|
+
* ```jsx
|
|
3918
3930
|
* const App = () => {
|
|
3919
3931
|
* const store = useCreateStore(createStore);
|
|
3920
3932
|
* const checkpoints = useCreateCheckpoints(store, (store) => {
|
|
@@ -3941,7 +3953,7 @@ export function useLinkedRowIdsListener(
|
|
|
3941
3953
|
* dependency, and so the Checkpoints object is created again on the second
|
|
3942
3954
|
* render.
|
|
3943
3955
|
*
|
|
3944
|
-
* ```
|
|
3956
|
+
* ```jsx
|
|
3945
3957
|
* const App = ({size}) => {
|
|
3946
3958
|
* const store = useCreateStore(createStore);
|
|
3947
3959
|
* const checkpoints = useCreateCheckpoints(
|
|
@@ -3999,7 +4011,7 @@ export function useCreateCheckpoints(
|
|
|
3999
4011
|
* to get a reference to the Checkpoints object again, without the need to have
|
|
4000
4012
|
* it passed as a prop.
|
|
4001
4013
|
*
|
|
4002
|
-
* ```
|
|
4014
|
+
* ```jsx
|
|
4003
4015
|
* const App = ({checkpoints}) => (
|
|
4004
4016
|
* <Provider checkpoints={checkpoints}>
|
|
4005
4017
|
* <Pane />
|
|
@@ -4021,7 +4033,7 @@ export function useCreateCheckpoints(
|
|
|
4021
4033
|
* hook with that Id to get a reference to the Checkpoints object again, without
|
|
4022
4034
|
* the need to have it passed as a prop.
|
|
4023
4035
|
*
|
|
4024
|
-
* ```
|
|
4036
|
+
* ```jsx
|
|
4025
4037
|
* const App = ({checkpoints}) => (
|
|
4026
4038
|
* <Provider checkpointsById={{petStore: checkpoints}}>
|
|
4027
4039
|
* <Pane />
|
|
@@ -4070,7 +4082,7 @@ export function useCheckpoints(id?: Id): Checkpoints | undefined;
|
|
|
4070
4082
|
* used in the useCheckpointIds hook by reference. A change to the checkpoint
|
|
4071
4083
|
* Ids re-renders the component.
|
|
4072
4084
|
*
|
|
4073
|
-
* ```
|
|
4085
|
+
* ```jsx
|
|
4074
4086
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
4075
4087
|
* const checkpoints = createCheckpoints(store);
|
|
4076
4088
|
* const App = () => (
|
|
@@ -4095,7 +4107,7 @@ export function useCheckpoints(id?: Id): Checkpoints | undefined;
|
|
|
4095
4107
|
* object is provided. A component within it then uses the useCheckpointIds
|
|
4096
4108
|
* hook.
|
|
4097
4109
|
*
|
|
4098
|
-
* ```
|
|
4110
|
+
* ```jsx
|
|
4099
4111
|
* const App = ({checkpoints}) => (
|
|
4100
4112
|
* <Provider checkpoints={checkpoints}>
|
|
4101
4113
|
* <Pane />
|
|
@@ -4117,7 +4129,7 @@ export function useCheckpoints(id?: Id): Checkpoints | undefined;
|
|
|
4117
4129
|
* object is provided. A component within it then uses the useCheckpointIds
|
|
4118
4130
|
* hook.
|
|
4119
4131
|
*
|
|
4120
|
-
* ```
|
|
4132
|
+
* ```jsx
|
|
4121
4133
|
* const App = ({checkpoints}) => (
|
|
4122
4134
|
* <Provider checkpointsById={{petCheckpoints: checkpoints}}>
|
|
4123
4135
|
* <Pane />
|
|
@@ -4168,7 +4180,7 @@ export function useCheckpointIds(
|
|
|
4168
4180
|
* used in the useCheckpoint hook by reference. A change to the checkpoint label
|
|
4169
4181
|
* re-renders the component.
|
|
4170
4182
|
*
|
|
4171
|
-
* ```
|
|
4183
|
+
* ```jsx
|
|
4172
4184
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
4173
4185
|
* const checkpoints = createCheckpoints(store);
|
|
4174
4186
|
* const App = () => <span>{useCheckpoint('1', checkpoints)}</span>;
|
|
@@ -4188,7 +4200,7 @@ export function useCheckpointIds(
|
|
|
4188
4200
|
* object is provided. A component within it then uses the useCheckpoint
|
|
4189
4201
|
* hook.
|
|
4190
4202
|
*
|
|
4191
|
-
* ```
|
|
4203
|
+
* ```jsx
|
|
4192
4204
|
* const App = ({checkpoints}) => (
|
|
4193
4205
|
* <Provider checkpoints={checkpoints}>
|
|
4194
4206
|
* <Pane />
|
|
@@ -4210,7 +4222,7 @@ export function useCheckpointIds(
|
|
|
4210
4222
|
* object is provided. A component within it then uses the useCheckpoint
|
|
4211
4223
|
* hook.
|
|
4212
4224
|
*
|
|
4213
|
-
* ```
|
|
4225
|
+
* ```jsx
|
|
4214
4226
|
* const App = ({checkpoints}) => (
|
|
4215
4227
|
* <Provider checkpointsById={{petCheckpoints: checkpoints}}>
|
|
4216
4228
|
* <Pane />
|
|
@@ -4279,7 +4291,7 @@ export function useCheckpoint(
|
|
|
4279
4291
|
* This example uses the useSetCheckpointCallback hook to create an event
|
|
4280
4292
|
* handler which sets a checkpoint when the `span` element is clicked.
|
|
4281
4293
|
*
|
|
4282
|
-
* ```
|
|
4294
|
+
* ```jsx
|
|
4283
4295
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4284
4296
|
* const checkpoints = createCheckpoints(store);
|
|
4285
4297
|
* const App = () => {
|
|
@@ -4336,7 +4348,7 @@ export function useSetCheckpointCallback<Parameter>(
|
|
|
4336
4348
|
* which goes backward in the checkpoint stack when the `span` element is
|
|
4337
4349
|
* clicked.
|
|
4338
4350
|
*
|
|
4339
|
-
* ```
|
|
4351
|
+
* ```jsx
|
|
4340
4352
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4341
4353
|
* const checkpoints = createCheckpoints(store);
|
|
4342
4354
|
* const App = () => (
|
|
@@ -4384,7 +4396,7 @@ export function useGoBackwardCallback(
|
|
|
4384
4396
|
* which goes backward in the checkpoint stack when the `span` element is
|
|
4385
4397
|
* clicked.
|
|
4386
4398
|
*
|
|
4387
|
-
* ```
|
|
4399
|
+
* ```jsx
|
|
4388
4400
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4389
4401
|
* const checkpoints = createCheckpoints(store);
|
|
4390
4402
|
* const App = () => (
|
|
@@ -4461,7 +4473,7 @@ export function useGoForwardCallback(
|
|
|
4461
4473
|
* This example uses the useGoToCallback hook to create an event handler which
|
|
4462
4474
|
* moves to a checkpoint when the `span` element is clicked.
|
|
4463
4475
|
*
|
|
4464
|
-
* ```
|
|
4476
|
+
* ```jsx
|
|
4465
4477
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4466
4478
|
* const checkpoints = createCheckpoints(store);
|
|
4467
4479
|
* const App = () => {
|
|
@@ -4515,7 +4527,7 @@ export function useGoToCallback<Parameter>(
|
|
|
4515
4527
|
* @example
|
|
4516
4528
|
* This example uses the useUndoInformation hook to create an undo button.
|
|
4517
4529
|
*
|
|
4518
|
-
* ```
|
|
4530
|
+
* ```jsx
|
|
4519
4531
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4520
4532
|
* const checkpoints = createCheckpoints(store);
|
|
4521
4533
|
* const App = () => {
|
|
@@ -4561,7 +4573,7 @@ export function useUndoInformation(
|
|
|
4561
4573
|
* @example
|
|
4562
4574
|
* This example uses the useUndoInformation hook to create a redo button.
|
|
4563
4575
|
*
|
|
4564
|
-
* ```
|
|
4576
|
+
* ```jsx
|
|
4565
4577
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4566
4578
|
* const checkpoints = createCheckpoints(store);
|
|
4567
4579
|
* const App = () => {
|
|
@@ -4618,7 +4630,7 @@ export function useRedoInformation(
|
|
|
4618
4630
|
* is scoped to a single component. When the component is unmounted, the
|
|
4619
4631
|
* listener is removed from the Store.
|
|
4620
4632
|
*
|
|
4621
|
-
* ```
|
|
4633
|
+
* ```jsx
|
|
4622
4634
|
* const App = ({checkpoints}) => (
|
|
4623
4635
|
* <Provider checkpoints={checkpoints}>
|
|
4624
4636
|
* <Pane />
|
|
@@ -4688,7 +4700,7 @@ export function useCheckpointIdsListener(
|
|
|
4688
4700
|
* is scoped to a single component. When the component is unmounted, the
|
|
4689
4701
|
* listener is removed from the Store.
|
|
4690
4702
|
*
|
|
4691
|
-
* ```
|
|
4703
|
+
* ```jsx
|
|
4692
4704
|
* const App = ({checkpoints}) => (
|
|
4693
4705
|
* <Provider checkpoints={checkpoints}>
|
|
4694
4706
|
* <Pane />
|
|
@@ -4751,6 +4763,9 @@ export function useCheckpointListener(
|
|
|
4751
4763
|
* an array in the fifth parameter. The Persister itself is used as a dependency
|
|
4752
4764
|
* by default.
|
|
4753
4765
|
*
|
|
4766
|
+
* This hook ensures the Persister object is destroyed whenever a new one is
|
|
4767
|
+
* created or the component is unmounted.
|
|
4768
|
+
*
|
|
4754
4769
|
* @param store A reference to the Store for which to create a new Persister
|
|
4755
4770
|
* object.
|
|
4756
4771
|
* @param create A function for performing the creation steps of the Persister
|
|
@@ -4769,7 +4784,7 @@ export function useCheckpointListener(
|
|
|
4769
4784
|
* Even though the App component is rendered twice, the Persister creation only
|
|
4770
4785
|
* occurs once by default.
|
|
4771
4786
|
*
|
|
4772
|
-
* ```
|
|
4787
|
+
* ```jsx
|
|
4773
4788
|
* const App = () => {
|
|
4774
4789
|
* const store = useCreateStore(createStore);
|
|
4775
4790
|
* const persister = useCreatePersister(
|
|
@@ -4795,10 +4810,12 @@ export function useCheckpointListener(
|
|
|
4795
4810
|
*
|
|
4796
4811
|
* // ... // !act
|
|
4797
4812
|
* ReactDOM.render(<App />, app); // !act
|
|
4798
|
-
* // No second
|
|
4813
|
+
* // No second Persister creation
|
|
4799
4814
|
*
|
|
4800
4815
|
* console.log(app.innerHTML);
|
|
4801
4816
|
* // -> '<span>{\"pets\":{\"fido\":{\"species\":\"dog\"}}}</span>'
|
|
4817
|
+
*
|
|
4818
|
+
* ReactDOM.unmountComponentAtNode(app); // !act
|
|
4802
4819
|
* ```
|
|
4803
4820
|
* @example
|
|
4804
4821
|
* This example creates a Persister at the top level of a React application. The
|
|
@@ -4806,7 +4823,7 @@ export function useCheckpointListener(
|
|
|
4806
4823
|
* useCreatePersister hook takes the `sessionKey` prop as a dependency, and so
|
|
4807
4824
|
* the Persister object is created again on the second render.
|
|
4808
4825
|
*
|
|
4809
|
-
* ```
|
|
4826
|
+
* ```jsx
|
|
4810
4827
|
* const App = ({sessionKey}) => {
|
|
4811
4828
|
* const store = useCreateStore(createStore);
|
|
4812
4829
|
* const persister = useCreatePersister(
|
|
@@ -4841,6 +4858,8 @@ export function useCheckpointListener(
|
|
|
4841
4858
|
* // ... // !act
|
|
4842
4859
|
* console.log(app.innerHTML);
|
|
4843
4860
|
* // -> '<span>{\"pets\":{\"cujo\":{\"species\":\"dog\"}}}</span>'
|
|
4861
|
+
*
|
|
4862
|
+
* ReactDOM.unmountComponentAtNode(app); // !act
|
|
4844
4863
|
* ```
|
|
4845
4864
|
* @category Persister hooks
|
|
4846
4865
|
*/
|
|
@@ -4853,13 +4872,17 @@ export function useCreatePersister(
|
|
|
4853
4872
|
): Persister;
|
|
4854
4873
|
|
|
4855
4874
|
/**
|
|
4856
|
-
* The ExtraProps type represents a set of arbitrary additional props
|
|
4875
|
+
* The ExtraProps type represents a set of arbitrary additional props.
|
|
4876
|
+
*
|
|
4877
|
+
* @category Props
|
|
4857
4878
|
*/
|
|
4858
4879
|
export type ExtraProps = {[propName: string]: any};
|
|
4859
4880
|
|
|
4860
4881
|
/**
|
|
4861
4882
|
* TablesProps props are used for components that refer to all the Tables in a
|
|
4862
4883
|
* Store, such as the TablesView component.
|
|
4884
|
+
*
|
|
4885
|
+
* @category Props
|
|
4863
4886
|
*/
|
|
4864
4887
|
export type TablesProps = {
|
|
4865
4888
|
/**
|
|
@@ -4891,6 +4914,8 @@ export type TablesProps = {
|
|
|
4891
4914
|
/**
|
|
4892
4915
|
* TableProps props are used for components that refer to a single Table in a
|
|
4893
4916
|
* Store, such as the TableView component.
|
|
4917
|
+
*
|
|
4918
|
+
* @category Props
|
|
4894
4919
|
*/
|
|
4895
4920
|
export type TableProps = {
|
|
4896
4921
|
/**
|
|
@@ -4926,6 +4951,8 @@ export type TableProps = {
|
|
|
4926
4951
|
/**
|
|
4927
4952
|
* RowProps props are used for components that refer to a single Row in a Table,
|
|
4928
4953
|
* such as the RowView component.
|
|
4954
|
+
*
|
|
4955
|
+
* @category Props
|
|
4929
4956
|
*/
|
|
4930
4957
|
export type RowProps = {
|
|
4931
4958
|
/**
|
|
@@ -4965,6 +4992,8 @@ export type RowProps = {
|
|
|
4965
4992
|
/**
|
|
4966
4993
|
* RowProps props are used for components that refer to a single Cell in a Row,
|
|
4967
4994
|
* such as the CellView component.
|
|
4995
|
+
*
|
|
4996
|
+
* @category Props
|
|
4968
4997
|
*/
|
|
4969
4998
|
export type CellProps = {
|
|
4970
4999
|
/**
|
|
@@ -4994,6 +5023,8 @@ export type CellProps = {
|
|
|
4994
5023
|
/**
|
|
4995
5024
|
* MetricProps props are used for components that refer to a single Metric in a
|
|
4996
5025
|
* Metrics object, such as the MetricView component.
|
|
5026
|
+
*
|
|
5027
|
+
* @category Props
|
|
4997
5028
|
*/
|
|
4998
5029
|
export type MetricProps = {
|
|
4999
5030
|
/**
|
|
@@ -5016,6 +5047,8 @@ export type MetricProps = {
|
|
|
5016
5047
|
/**
|
|
5017
5048
|
* IndexProps props are used for components that refer to a single Index in an
|
|
5018
5049
|
* Indexes object, such as the IndexView component.
|
|
5050
|
+
*
|
|
5051
|
+
* @category Props
|
|
5019
5052
|
*/
|
|
5020
5053
|
export type IndexProps = {
|
|
5021
5054
|
/**
|
|
@@ -5051,6 +5084,8 @@ export type IndexProps = {
|
|
|
5051
5084
|
/**
|
|
5052
5085
|
* IndexProps props are used for components that refer to a single Slice in an
|
|
5053
5086
|
* Index object, such as the SliceView component.
|
|
5087
|
+
*
|
|
5088
|
+
* @category Props
|
|
5054
5089
|
*/
|
|
5055
5090
|
export type SliceProps = {
|
|
5056
5091
|
/**
|
|
@@ -5091,6 +5126,8 @@ export type SliceProps = {
|
|
|
5091
5126
|
* RemoteRowProps props are used for components that refer to a single
|
|
5092
5127
|
* Relationship in an Relationships object, and where you want to render a
|
|
5093
5128
|
* remote Row based on a local Row, such as in the RemoteRowView component.
|
|
5129
|
+
*
|
|
5130
|
+
* @category Props
|
|
5094
5131
|
*/
|
|
5095
5132
|
export type RemoteRowProps = {
|
|
5096
5133
|
/**
|
|
@@ -5128,6 +5165,8 @@ export type RemoteRowProps = {
|
|
|
5128
5165
|
* LocalRowsProps props are used for components that refer to a single
|
|
5129
5166
|
* Relationship in an Relationships object, and where you want to render local
|
|
5130
5167
|
* Rows based on a remote Row, such as the LocalRowsView component.
|
|
5168
|
+
*
|
|
5169
|
+
* @category Props
|
|
5131
5170
|
*/
|
|
5132
5171
|
export type LocalRowsProps = {
|
|
5133
5172
|
/**
|
|
@@ -5170,6 +5209,8 @@ export type LocalRowsProps = {
|
|
|
5170
5209
|
* Relationship in an Relationships object, and where you want to render a
|
|
5171
5210
|
* linked list of Rows starting from a first Row, such as the LinkedRowsView
|
|
5172
5211
|
* component.
|
|
5212
|
+
*
|
|
5213
|
+
* @category Props
|
|
5173
5214
|
*/
|
|
5174
5215
|
export type LinkedRowsProps = {
|
|
5175
5216
|
/**
|
|
@@ -5210,6 +5251,8 @@ export type LinkedRowsProps = {
|
|
|
5210
5251
|
/**
|
|
5211
5252
|
* CheckpointProps props are used for components that refer to a single
|
|
5212
5253
|
* checkpoint in an Checkpoints object, such as the CheckpointView component.
|
|
5254
|
+
*
|
|
5255
|
+
* @category Props
|
|
5213
5256
|
*/
|
|
5214
5257
|
export type CheckpointProps = {
|
|
5215
5258
|
/**
|
|
@@ -5233,6 +5276,8 @@ export type CheckpointProps = {
|
|
|
5233
5276
|
* BackwardCheckpointsProps props are used for components that refer to a list
|
|
5234
5277
|
* of previous checkpoints in a Checkpoints object, such as the
|
|
5235
5278
|
* BackwardCheckpointsView component.
|
|
5279
|
+
*
|
|
5280
|
+
* @category Props
|
|
5236
5281
|
*/
|
|
5237
5282
|
export type BackwardCheckpointsProps = {
|
|
5238
5283
|
/**
|
|
@@ -5265,6 +5310,8 @@ export type BackwardCheckpointsProps = {
|
|
|
5265
5310
|
* CurrentCheckpointsProps props are used for components that refer to the
|
|
5266
5311
|
* current checkpoints in a Checkpoints object, such as the
|
|
5267
5312
|
* BackwardCheckpointsView component.
|
|
5313
|
+
*
|
|
5314
|
+
* @category Props
|
|
5268
5315
|
*/
|
|
5269
5316
|
export type CurrentCheckpointProps = {
|
|
5270
5317
|
/**
|
|
@@ -5293,6 +5340,8 @@ export type CurrentCheckpointProps = {
|
|
|
5293
5340
|
* ForwardCheckpointsProps props are used for components that refer to a list of
|
|
5294
5341
|
* future checkpoints in a Checkpoints object, such as the
|
|
5295
5342
|
* ForwardCheckpointsView component.
|
|
5343
|
+
*
|
|
5344
|
+
* @category Props
|
|
5296
5345
|
*/
|
|
5297
5346
|
export type ForwardCheckpointsProps = {
|
|
5298
5347
|
/**
|
|
@@ -5324,10 +5373,13 @@ export type ForwardCheckpointsProps = {
|
|
|
5324
5373
|
/**
|
|
5325
5374
|
* ProviderProps props are used with the Provider component, so that Store
|
|
5326
5375
|
* 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
|
-
*
|
|
5376
|
+
* the context of an application and used throughout.
|
|
5377
|
+
*
|
|
5378
|
+
* One of each type of object can be provided as a default within the context.
|
|
5379
|
+
* Additionally, multiple of each type of object can be provided in an Id-keyed
|
|
5380
|
+
* map to the `___ById` props.
|
|
5381
|
+
*
|
|
5382
|
+
* @category Props
|
|
5331
5383
|
*/
|
|
5332
5384
|
export type ProviderProps = {
|
|
5333
5385
|
/**
|
|
@@ -5385,6 +5437,8 @@ export type ProviderProps = {
|
|
|
5385
5437
|
/**
|
|
5386
5438
|
* ComponentReturnType is a simple alias for what a React component can return:
|
|
5387
5439
|
* either a ReactElement, or `null` for an empty component.
|
|
5440
|
+
*
|
|
5441
|
+
* @category Component
|
|
5388
5442
|
*/
|
|
5389
5443
|
export type ComponentReturnType = ReactElement<any, any> | null;
|
|
5390
5444
|
|
|
@@ -5398,9 +5452,12 @@ export type ComponentReturnType = ReactElement<any, any> | null;
|
|
|
5398
5452
|
* multiple of each type of object can be provided in an Id-keyed map to the
|
|
5399
5453
|
* `___ById` props.
|
|
5400
5454
|
*
|
|
5401
|
-
* Provider contexts can be nested
|
|
5402
|
-
* if an outer context contains a
|
|
5403
|
-
*
|
|
5455
|
+
* Provider contexts can be nested and the objects passed in will be merged. For
|
|
5456
|
+
* example, if an outer context contains a default Metrics object and an inner
|
|
5457
|
+
* context contains only a default Store, both the Metrics objects and the Store
|
|
5458
|
+
* will be visible within the inner context. If the outer context contains a
|
|
5459
|
+
* Store named by Id and the inner context contains a Store named by a different
|
|
5460
|
+
* Id, both will be visible within the inner context.
|
|
5404
5461
|
*
|
|
5405
5462
|
* @param props The props for this component.
|
|
5406
5463
|
* @returns A rendering of the child components.
|
|
@@ -5410,7 +5467,7 @@ export type ComponentReturnType = ReactElement<any, any> | null;
|
|
|
5410
5467
|
* it then render content from both, without the need to have them passed as
|
|
5411
5468
|
* props.
|
|
5412
5469
|
*
|
|
5413
|
-
* ```
|
|
5470
|
+
* ```jsx
|
|
5414
5471
|
* const App = ({store, metrics}) => (
|
|
5415
5472
|
* <Provider store={store} metricsById={{petStore: metrics}}>
|
|
5416
5473
|
* <Pane />
|
|
@@ -5434,6 +5491,49 @@ export type ComponentReturnType = ReactElement<any, any> | null;
|
|
|
5434
5491
|
* console.log(app.innerHTML);
|
|
5435
5492
|
* // -> '<span>5,4,5</span>'
|
|
5436
5493
|
* ```
|
|
5494
|
+
* @example
|
|
5495
|
+
* This example creates nested Provider contexts into which Store and Metrics
|
|
5496
|
+
* objects are provided, showing how visibility is merged.
|
|
5497
|
+
*
|
|
5498
|
+
* ```jsx
|
|
5499
|
+
* const App = ({petStore, metrics}) => (
|
|
5500
|
+
* <Provider storesById={{pet: petStore}} metrics={metrics}>
|
|
5501
|
+
* <OuterPane />
|
|
5502
|
+
* </Provider>
|
|
5503
|
+
* );
|
|
5504
|
+
* const OuterPane = () => {
|
|
5505
|
+
* const planetStore = useCreateStore(() =>
|
|
5506
|
+
* createStore().setTables({planets: {mars: {moons: 2}}}),
|
|
5507
|
+
* );
|
|
5508
|
+
* return (
|
|
5509
|
+
* <Provider storesById={{planet: planetStore}}>
|
|
5510
|
+
* <InnerPane />
|
|
5511
|
+
* </Provider>
|
|
5512
|
+
* );
|
|
5513
|
+
* };
|
|
5514
|
+
* const InnerPane = () => (
|
|
5515
|
+
* <span>
|
|
5516
|
+
* <CellView tableId="species" rowId="dog" cellId="price" store="pet" />,
|
|
5517
|
+
* {useMetric('highestPrice')},
|
|
5518
|
+
* <CellView
|
|
5519
|
+
* tableId="planets"
|
|
5520
|
+
* rowId="mars"
|
|
5521
|
+
* cellId="moons"
|
|
5522
|
+
* store="planet"
|
|
5523
|
+
* />
|
|
5524
|
+
* </span>
|
|
5525
|
+
* );
|
|
5526
|
+
*
|
|
5527
|
+
* const petStore = createStore();
|
|
5528
|
+
* petStore.setTable('species', {dog: {price: 5}, cat: {price: 4}});
|
|
5529
|
+
* const metrics = createMetrics(petStore);
|
|
5530
|
+
* metrics.setMetricDefinition('highestPrice', 'species', 'max', 'price');
|
|
5531
|
+
*
|
|
5532
|
+
* const app = document.createElement('div');
|
|
5533
|
+
* ReactDOM.render(<App petStore={petStore} metrics={metrics} />, app); // !act
|
|
5534
|
+
* console.log(app.innerHTML);
|
|
5535
|
+
* // -> '<span>5,5,2</span>'
|
|
5536
|
+
* ```
|
|
5437
5537
|
* @category Context components
|
|
5438
5538
|
*/
|
|
5439
5539
|
export function Provider(
|
|
@@ -5464,7 +5564,7 @@ export function Provider(
|
|
|
5464
5564
|
* CellView component by reference. A change to the data in the Store re-renders
|
|
5465
5565
|
* the component.
|
|
5466
5566
|
*
|
|
5467
|
-
* ```
|
|
5567
|
+
* ```jsx
|
|
5468
5568
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
5469
5569
|
* const App = () => (
|
|
5470
5570
|
* <span>
|
|
@@ -5486,7 +5586,7 @@ export function Provider(
|
|
|
5486
5586
|
* provided. The CellView component within it then renders the Cell (with its Id
|
|
5487
5587
|
* for readability).
|
|
5488
5588
|
*
|
|
5489
|
-
* ```
|
|
5589
|
+
* ```jsx
|
|
5490
5590
|
* const App = ({store}) => (
|
|
5491
5591
|
* <Provider store={store}>
|
|
5492
5592
|
* <Pane />
|
|
@@ -5509,7 +5609,7 @@ export function Provider(
|
|
|
5509
5609
|
* provided. The CellView component within it then attempts to render a
|
|
5510
5610
|
* non-existent Cell.
|
|
5511
5611
|
*
|
|
5512
|
-
* ```
|
|
5612
|
+
* ```jsx
|
|
5513
5613
|
* const App = ({store}) => (
|
|
5514
5614
|
* <Provider store={store}>
|
|
5515
5615
|
* <Pane />
|
|
@@ -5560,7 +5660,7 @@ export function CellView(props: CellProps): ComponentReturnType;
|
|
|
5560
5660
|
* RowView component by reference. A change to the data in the Store re-renders
|
|
5561
5661
|
* the component.
|
|
5562
5662
|
*
|
|
5563
|
-
* ```
|
|
5663
|
+
* ```jsx
|
|
5564
5664
|
* const store = createStore().setRow('pets', 'fido', {species: 'dog'});
|
|
5565
5665
|
* const App = () => (
|
|
5566
5666
|
* <div>
|
|
@@ -5582,7 +5682,7 @@ export function CellView(props: CellProps): ComponentReturnType;
|
|
|
5582
5682
|
* provided. The RowView component within it then renders the Row (with Ids for
|
|
5583
5683
|
* readability).
|
|
5584
5684
|
*
|
|
5585
|
-
* ```
|
|
5685
|
+
* ```jsx
|
|
5586
5686
|
* const App = ({store}) => (
|
|
5587
5687
|
* <Provider store={store}>
|
|
5588
5688
|
* <Pane />
|
|
@@ -5608,7 +5708,7 @@ export function CellView(props: CellProps): ComponentReturnType;
|
|
|
5608
5708
|
* provided. The RowView component within it then renders the Row with a custom
|
|
5609
5709
|
* Cell component and a custom props callback.
|
|
5610
5710
|
*
|
|
5611
|
-
* ```
|
|
5711
|
+
* ```jsx
|
|
5612
5712
|
* const App = ({store}) => (
|
|
5613
5713
|
* <Provider store={store}>
|
|
5614
5714
|
* <Pane />
|
|
@@ -5673,7 +5773,7 @@ export function RowView(props: RowProps): ComponentReturnType;
|
|
|
5673
5773
|
* TableView component by reference. A change to the data in the Store
|
|
5674
5774
|
* re-renders the component.
|
|
5675
5775
|
*
|
|
5676
|
-
* ```
|
|
5776
|
+
* ```jsx
|
|
5677
5777
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
5678
5778
|
* const App = () => (
|
|
5679
5779
|
* <div>
|
|
@@ -5695,7 +5795,7 @@ export function RowView(props: RowProps): ComponentReturnType;
|
|
|
5695
5795
|
* provided. The TableView component within it then renders the Table (with Ids
|
|
5696
5796
|
* for readability).
|
|
5697
5797
|
*
|
|
5698
|
-
* ```
|
|
5798
|
+
* ```jsx
|
|
5699
5799
|
* const App = ({store}) => (
|
|
5700
5800
|
* <Provider store={store}>
|
|
5701
5801
|
* <Pane />
|
|
@@ -5721,7 +5821,7 @@ export function RowView(props: RowProps): ComponentReturnType;
|
|
|
5721
5821
|
* provided. The TableView component within it then renders the Table with a
|
|
5722
5822
|
* custom Row component and a custom props callback.
|
|
5723
5823
|
*
|
|
5724
|
-
* ```
|
|
5824
|
+
* ```jsx
|
|
5725
5825
|
* const App = ({store}) => (
|
|
5726
5826
|
* <Provider store={store}>
|
|
5727
5827
|
* <Pane />
|
|
@@ -5781,7 +5881,7 @@ export function TableView(props: TableProps): ComponentReturnType;
|
|
|
5781
5881
|
* TablesView component by reference. A change to the data in the Store
|
|
5782
5882
|
* re-renders the component.
|
|
5783
5883
|
*
|
|
5784
|
-
* ```
|
|
5884
|
+
* ```jsx
|
|
5785
5885
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
5786
5886
|
* const App = () => (
|
|
5787
5887
|
* <div>
|
|
@@ -5803,7 +5903,7 @@ export function TableView(props: TableProps): ComponentReturnType;
|
|
|
5803
5903
|
* provided. The TablesView component within it then renders the Store (with Ids
|
|
5804
5904
|
* for readability).
|
|
5805
5905
|
*
|
|
5806
|
-
* ```
|
|
5906
|
+
* ```jsx
|
|
5807
5907
|
* const App = ({store}) => (
|
|
5808
5908
|
* <Provider store={store}>
|
|
5809
5909
|
* <Pane />
|
|
@@ -5829,7 +5929,7 @@ export function TableView(props: TableProps): ComponentReturnType;
|
|
|
5829
5929
|
* provided. The TablesView component within it then renders the Store with a
|
|
5830
5930
|
* custom Table component and a custom props callback.
|
|
5831
5931
|
*
|
|
5832
|
-
* ```
|
|
5932
|
+
* ```jsx
|
|
5833
5933
|
* const App = ({store}) => (
|
|
5834
5934
|
* <Provider store={store}>
|
|
5835
5935
|
* <Pane />
|
|
@@ -5882,7 +5982,7 @@ export function TablesView(props: TablesProps): ComponentReturnType;
|
|
|
5882
5982
|
* in the MetricView component hook by reference. A change to the Metric
|
|
5883
5983
|
* re-renders the component.
|
|
5884
5984
|
*
|
|
5885
|
-
* ```
|
|
5985
|
+
* ```jsx
|
|
5886
5986
|
* const store = createStore().setTable('species', {
|
|
5887
5987
|
* dog: {price: 5},
|
|
5888
5988
|
* cat: {price: 4},
|
|
@@ -5910,7 +6010,7 @@ export function TablesView(props: TablesProps): ComponentReturnType;
|
|
|
5910
6010
|
* is provided. The MetricView component within it then renders the Metric (with
|
|
5911
6011
|
* its Id for readability).
|
|
5912
6012
|
*
|
|
5913
|
-
* ```
|
|
6013
|
+
* ```jsx
|
|
5914
6014
|
* const App = ({metrics}) => (
|
|
5915
6015
|
* <Provider metrics={metrics}>
|
|
5916
6016
|
* <Pane />
|
|
@@ -5940,7 +6040,7 @@ export function TablesView(props: TablesProps): ComponentReturnType;
|
|
|
5940
6040
|
* is provided. The MetricView component within it then attempts to render a
|
|
5941
6041
|
* non-existent Metric.
|
|
5942
6042
|
*
|
|
5943
|
-
* ```
|
|
6043
|
+
* ```jsx
|
|
5944
6044
|
* const App = ({metrics}) => (
|
|
5945
6045
|
* <Provider metrics={metrics}>
|
|
5946
6046
|
* <Pane />
|
|
@@ -5993,7 +6093,7 @@ export function MetricView(props: MetricProps): ComponentReturnType;
|
|
|
5993
6093
|
* in the SliceView component by reference. A change to the Row Ids re-renders
|
|
5994
6094
|
* the component.
|
|
5995
6095
|
*
|
|
5996
|
-
* ```
|
|
6096
|
+
* ```jsx
|
|
5997
6097
|
* const store = createStore().setTable('pets', {
|
|
5998
6098
|
* fido: {species: 'dog'},
|
|
5999
6099
|
* felix: {species: 'cat'},
|
|
@@ -6025,7 +6125,7 @@ export function MetricView(props: MetricProps): ComponentReturnType;
|
|
|
6025
6125
|
* is provided. The SliceView component within it then renders the Slice (with
|
|
6026
6126
|
* Ids for readability).
|
|
6027
6127
|
*
|
|
6028
|
-
* ```
|
|
6128
|
+
* ```jsx
|
|
6029
6129
|
* const App = ({indexes}) => (
|
|
6030
6130
|
* <Provider indexes={indexes}>
|
|
6031
6131
|
* <Pane />
|
|
@@ -6054,7 +6154,7 @@ export function MetricView(props: MetricProps): ComponentReturnType;
|
|
|
6054
6154
|
* is provided. The SliceView component within it then renders the Slice with a
|
|
6055
6155
|
* custom Row component and a custom props callback.
|
|
6056
6156
|
*
|
|
6057
|
-
* ```
|
|
6157
|
+
* ```jsx
|
|
6058
6158
|
* const App = ({indexes}) => (
|
|
6059
6159
|
* <Provider indexes={indexes}>
|
|
6060
6160
|
* <Pane />
|
|
@@ -6120,7 +6220,7 @@ export function SliceView(props: SliceProps): ComponentReturnType;
|
|
|
6120
6220
|
* in the IndexView component by reference. A change to the Slice Ids re-renders
|
|
6121
6221
|
* the component.
|
|
6122
6222
|
*
|
|
6123
|
-
* ```
|
|
6223
|
+
* ```jsx
|
|
6124
6224
|
* const store = createStore().setTable('pets', {
|
|
6125
6225
|
* fido: {species: 'dog'},
|
|
6126
6226
|
* felix: {species: 'cat'},
|
|
@@ -6147,7 +6247,7 @@ export function SliceView(props: SliceProps): ComponentReturnType;
|
|
|
6147
6247
|
* is provided. The IndexView component within it then renders the Index (with
|
|
6148
6248
|
* Ids for readability).
|
|
6149
6249
|
*
|
|
6150
|
-
* ```
|
|
6250
|
+
* ```jsx
|
|
6151
6251
|
* const App = ({indexes}) => (
|
|
6152
6252
|
* <Provider indexes={indexes}>
|
|
6153
6253
|
* <Pane />
|
|
@@ -6176,7 +6276,7 @@ export function SliceView(props: SliceProps): ComponentReturnType;
|
|
|
6176
6276
|
* is provided. The IndexView component within it then renders the Index with a
|
|
6177
6277
|
* custom Slice component and a custom props callback.
|
|
6178
6278
|
*
|
|
6179
|
-
* ```
|
|
6279
|
+
* ```jsx
|
|
6180
6280
|
* const App = ({indexes}) => (
|
|
6181
6281
|
* <Provider indexes={indexes}>
|
|
6182
6282
|
* <Pane />
|
|
@@ -6243,7 +6343,7 @@ export function IndexView(props: IndexProps): ComponentReturnType;
|
|
|
6243
6343
|
* is used in the RemoteRowView component by reference. A change to the Row Ids
|
|
6244
6344
|
* re-renders the component.
|
|
6245
6345
|
*
|
|
6246
|
-
* ```
|
|
6346
|
+
* ```jsx
|
|
6247
6347
|
* const store = createStore()
|
|
6248
6348
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
6249
6349
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -6277,7 +6377,7 @@ export function IndexView(props: IndexProps): ComponentReturnType;
|
|
|
6277
6377
|
* object is provided. The RemoteRowView component within it then renders the
|
|
6278
6378
|
* remote Row (with Ids for readability).
|
|
6279
6379
|
*
|
|
6280
|
-
* ```
|
|
6380
|
+
* ```jsx
|
|
6281
6381
|
* const App = ({relationships}) => (
|
|
6282
6382
|
* <Provider relationships={relationships}>
|
|
6283
6383
|
* <Pane />
|
|
@@ -6309,7 +6409,7 @@ export function IndexView(props: IndexProps): ComponentReturnType;
|
|
|
6309
6409
|
* object is provided. The RemoteRowView component within it then renders the
|
|
6310
6410
|
* remote Row with a custom Row component and a custom props callback.
|
|
6311
6411
|
*
|
|
6312
|
-
* ```
|
|
6412
|
+
* ```jsx
|
|
6313
6413
|
* const App = ({relationships}) => (
|
|
6314
6414
|
* <Provider relationships={relationships}>
|
|
6315
6415
|
* <Pane />
|
|
@@ -6375,7 +6475,7 @@ export function RemoteRowView(props: RemoteRowProps): ComponentReturnType;
|
|
|
6375
6475
|
* is used in the LocalRowsView component by reference. A change to the Row Ids
|
|
6376
6476
|
* re-renders the component.
|
|
6377
6477
|
*
|
|
6378
|
-
* ```
|
|
6478
|
+
* ```jsx
|
|
6379
6479
|
* const store = createStore()
|
|
6380
6480
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
6381
6481
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -6410,7 +6510,7 @@ export function RemoteRowView(props: RemoteRowProps): ComponentReturnType;
|
|
|
6410
6510
|
* object is provided. The LocalRowsView component within it then renders the
|
|
6411
6511
|
* local Row objects (with Ids for readability).
|
|
6412
6512
|
*
|
|
6413
|
-
* ```
|
|
6513
|
+
* ```jsx
|
|
6414
6514
|
* const App = ({relationships}) => (
|
|
6415
6515
|
* <Provider relationships={relationships}>
|
|
6416
6516
|
* <Pane />
|
|
@@ -6442,7 +6542,7 @@ export function RemoteRowView(props: RemoteRowProps): ComponentReturnType;
|
|
|
6442
6542
|
* object is provided. The LocalRowsView component within it then renders the
|
|
6443
6543
|
* local Row objects with a custom Row component and a custom props callback.
|
|
6444
6544
|
*
|
|
6445
|
-
* ```
|
|
6545
|
+
* ```jsx
|
|
6446
6546
|
* const App = ({relationships}) => (
|
|
6447
6547
|
* <Provider relationships={relationships}>
|
|
6448
6548
|
* <Pane />
|
|
@@ -6508,7 +6608,7 @@ export function LocalRowsView(props: LocalRowsProps): ComponentReturnType;
|
|
|
6508
6608
|
* is used in the LinkedRowsView component by reference. A change to the Row Ids
|
|
6509
6609
|
* re-renders the component.
|
|
6510
6610
|
*
|
|
6511
|
-
* ```
|
|
6611
|
+
* ```jsx
|
|
6512
6612
|
* const store = createStore().setTable('pets', {
|
|
6513
6613
|
* fido: {next: 'felix'},
|
|
6514
6614
|
* felix: {next: 'cujo'},
|
|
@@ -6546,7 +6646,7 @@ export function LocalRowsView(props: LocalRowsProps): ComponentReturnType;
|
|
|
6546
6646
|
* object is provided. The LinkedRowsView component within it then renders the
|
|
6547
6647
|
* local Row objects (with Ids for readability).
|
|
6548
6648
|
*
|
|
6549
|
-
* ```
|
|
6649
|
+
* ```jsx
|
|
6550
6650
|
* const App = ({relationships}) => (
|
|
6551
6651
|
* <Provider relationships={relationships}>
|
|
6552
6652
|
* <Pane />
|
|
@@ -6579,7 +6679,7 @@ export function LocalRowsView(props: LocalRowsProps): ComponentReturnType;
|
|
|
6579
6679
|
* object is provided. The LinkedRowsView component within it then renders the
|
|
6580
6680
|
* local Row objects with a custom Row component and a custom props callback.
|
|
6581
6681
|
*
|
|
6582
|
-
* ```
|
|
6682
|
+
* ```jsx
|
|
6583
6683
|
* const App = ({relationships}) => (
|
|
6584
6684
|
* <Provider relationships={relationships}>
|
|
6585
6685
|
* <Pane />
|
|
@@ -6639,7 +6739,7 @@ export function LinkedRowsView(props: LinkedRowsProps): ComponentReturnType;
|
|
|
6639
6739
|
* used in the CheckpointView component by reference to render a checkpoint with
|
|
6640
6740
|
* a label (with its Id for readability).
|
|
6641
6741
|
*
|
|
6642
|
-
* ```
|
|
6742
|
+
* ```jsx
|
|
6643
6743
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
6644
6744
|
* const checkpoints = createCheckpoints(store);
|
|
6645
6745
|
* const App = () => (
|
|
@@ -6696,7 +6796,7 @@ export function CheckpointView(props: CheckpointProps): ComponentReturnType;
|
|
|
6696
6796
|
* used in the BackwardCheckpointsView component by reference to render a list
|
|
6697
6797
|
* of previous checkpoints.
|
|
6698
6798
|
*
|
|
6699
|
-
* ```
|
|
6799
|
+
* ```jsx
|
|
6700
6800
|
* const store = createStore().setTable('pets', {fido: {color: 'brown'}});
|
|
6701
6801
|
* const checkpoints = createCheckpoints(store);
|
|
6702
6802
|
* const App = () => (
|
|
@@ -6726,7 +6826,7 @@ export function CheckpointView(props: CheckpointProps): ComponentReturnType;
|
|
|
6726
6826
|
* object is provided. The BackwardCheckpointsView component within it then
|
|
6727
6827
|
* renders the list of previous checkpoints (with Ids for readability).
|
|
6728
6828
|
*
|
|
6729
|
-
* ```
|
|
6829
|
+
* ```jsx
|
|
6730
6830
|
* const App = ({checkpoints}) => (
|
|
6731
6831
|
* <Provider checkpoints={checkpoints}>
|
|
6732
6832
|
* <Pane />
|
|
@@ -6758,7 +6858,7 @@ export function CheckpointView(props: CheckpointProps): ComponentReturnType;
|
|
|
6758
6858
|
* renders the list of previous checkpoints with a custom Row component and a
|
|
6759
6859
|
* custom props callback.
|
|
6760
6860
|
*
|
|
6761
|
-
* ```
|
|
6861
|
+
* ```jsx
|
|
6762
6862
|
* const App = ({checkpoints}) => (
|
|
6763
6863
|
* <Provider checkpoints={checkpoints}>
|
|
6764
6864
|
* <Pane />
|
|
@@ -6830,7 +6930,7 @@ export function BackwardCheckpointsView(
|
|
|
6830
6930
|
* used in the CurrentCheckpointView component by reference to render the
|
|
6831
6931
|
* current checkpoints.
|
|
6832
6932
|
*
|
|
6833
|
-
* ```
|
|
6933
|
+
* ```jsx
|
|
6834
6934
|
* const store = createStore().setTable('pets', {fido: {color: 'brown'}});
|
|
6835
6935
|
* const checkpoints = createCheckpoints(store);
|
|
6836
6936
|
* const App = () => (
|
|
@@ -6862,7 +6962,7 @@ export function BackwardCheckpointsView(
|
|
|
6862
6962
|
* object is provided. The CurrentCheckpointView component within it then
|
|
6863
6963
|
* renders current checkpoint (with its Id for readability).
|
|
6864
6964
|
*
|
|
6865
|
-
* ```
|
|
6965
|
+
* ```jsx
|
|
6866
6966
|
* const App = ({checkpoints}) => (
|
|
6867
6967
|
* <Provider checkpoints={checkpoints}>
|
|
6868
6968
|
* <Pane />
|
|
@@ -6891,7 +6991,7 @@ export function BackwardCheckpointsView(
|
|
|
6891
6991
|
* renders the list of future checkpoints with a custom Row component and a
|
|
6892
6992
|
* custom props callback.
|
|
6893
6993
|
*
|
|
6894
|
-
* ```
|
|
6994
|
+
* ```jsx
|
|
6895
6995
|
* const App = ({checkpoints}) => (
|
|
6896
6996
|
* <Provider checkpoints={checkpoints}>
|
|
6897
6997
|
* <Pane />
|
|
@@ -6966,7 +7066,7 @@ export function CurrentCheckpointView(
|
|
|
6966
7066
|
* used in the ForwardCheckpointsView component by reference to render a list
|
|
6967
7067
|
* of future checkpoints.
|
|
6968
7068
|
*
|
|
6969
|
-
* ```
|
|
7069
|
+
* ```jsx
|
|
6970
7070
|
* const store = createStore().setTable('pets', {fido: {color: 'brown'}});
|
|
6971
7071
|
* const checkpoints = createCheckpoints(store);
|
|
6972
7072
|
* const App = () => (
|
|
@@ -6997,7 +7097,7 @@ export function CurrentCheckpointView(
|
|
|
6997
7097
|
* object is provided. The ForwardCheckpointsView component within it then
|
|
6998
7098
|
* renders the list of future checkpoints (with Ids for readability).
|
|
6999
7099
|
*
|
|
7000
|
-
* ```
|
|
7100
|
+
* ```jsx
|
|
7001
7101
|
* const App = ({checkpoints}) => (
|
|
7002
7102
|
* <Provider checkpoints={checkpoints}>
|
|
7003
7103
|
* <Pane />
|
|
@@ -7029,7 +7129,7 @@ export function CurrentCheckpointView(
|
|
|
7029
7129
|
* renders the list of future checkpoints with a custom Row component and a
|
|
7030
7130
|
* custom props callback.
|
|
7031
7131
|
*
|
|
7032
|
-
* ```
|
|
7132
|
+
* ```jsx
|
|
7033
7133
|
* const App = ({checkpoints}) => (
|
|
7034
7134
|
* <Provider checkpoints={checkpoints}>
|
|
7035
7135
|
* <Pane />
|