tinybase 0.9.1 → 1.0.0
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 +38 -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 +38 -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 +39 -76
- package/lib/debug/indexes.js +18 -10
- package/lib/debug/metrics.d.ts +49 -20
- package/lib/debug/metrics.js +1 -1
- package/lib/debug/persisters.d.ts +207 -17
- package/lib/debug/persisters.js +1 -1
- package/lib/debug/relationships.d.ts +48 -23
- package/lib/debug/relationships.js +1 -1
- package/lib/debug/store.d.ts +184 -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} +270 -162
- package/lib/debug/{react.js → ui-react.js} +28 -19
- package/lib/indexes.d.ts +39 -76
- package/lib/indexes.js +1 -1
- package/lib/indexes.js.gz +0 -0
- package/lib/metrics.d.ts +49 -20
- package/lib/metrics.js +1 -1
- package/lib/metrics.js.gz +0 -0
- package/lib/persisters.d.ts +207 -17
- package/lib/persisters.js +1 -1
- package/lib/persisters.js.gz +0 -0
- package/lib/relationships.d.ts +48 -23
- package/lib/relationships.js +1 -1
- package/lib/relationships.js.gz +0 -0
- package/lib/store.d.ts +184 -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} +270 -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 +28 -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
|
|
@@ -10,8 +10,16 @@
|
|
|
10
10
|
* The components in this module provide a further abstraction over those hooks
|
|
11
11
|
* to ease the composition of user interfaces that use TinyBase.
|
|
12
12
|
*
|
|
13
|
+
* @see Building UIs guides
|
|
14
|
+
* @see Building UIs With Metrics guide
|
|
15
|
+
* @see Building UIs With Indexes guide
|
|
16
|
+
* @see Building UIs With Relationships guide
|
|
17
|
+
* @see Building UIs With Checkpoints guide
|
|
18
|
+
* @see Countries demo
|
|
19
|
+
* @see Todo App demos
|
|
20
|
+
* @see TinyDraw demo
|
|
13
21
|
* @packageDocumentation
|
|
14
|
-
* @module react
|
|
22
|
+
* @module ui-react
|
|
15
23
|
*/
|
|
16
24
|
|
|
17
25
|
import {Callback, Id, IdOrNull, Ids, ParameterizedCallback} from './common.d';
|
|
@@ -57,8 +65,8 @@ import {Persister} from './persisters.d';
|
|
|
57
65
|
* multiple Store objects into a context that can be used throughout the app. In
|
|
58
66
|
* this case you will want to refer to a Store by its Id in that context.
|
|
59
67
|
*
|
|
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.
|
|
68
|
+
* Many hooks and components in this ui-react module take this type as a
|
|
69
|
+
* parameter or a prop, allowing you to pass in either the Store or its Id.
|
|
62
70
|
*
|
|
63
71
|
* @category Identity
|
|
64
72
|
*/
|
|
@@ -76,8 +84,8 @@ export type StoreOrStoreId = Store | Id;
|
|
|
76
84
|
* In this case you will want to refer to a Metrics object by its Id in that
|
|
77
85
|
* context.
|
|
78
86
|
*
|
|
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.
|
|
87
|
+
* Many hooks and components in this ui-react module take this type as a
|
|
88
|
+
* parameter or a prop, allowing you to pass in either the Store or its Id.
|
|
81
89
|
*
|
|
82
90
|
* @category Identity
|
|
83
91
|
*/
|
|
@@ -95,8 +103,8 @@ export type MetricsOrMetricsId = Metrics | Id;
|
|
|
95
103
|
* In this case you will want to refer to an Indexes object by its Id in that
|
|
96
104
|
* context.
|
|
97
105
|
*
|
|
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.
|
|
106
|
+
* Many hooks and components in this ui-react module take this type as a
|
|
107
|
+
* parameter or a prop, allowing you to pass in either the Store or its Id.
|
|
100
108
|
*
|
|
101
109
|
* @category Identity
|
|
102
110
|
*/
|
|
@@ -114,8 +122,8 @@ export type IndexesOrIndexesId = Indexes | Id;
|
|
|
114
122
|
* app. In this case you will want to refer to a Relationships object by its Id
|
|
115
123
|
* in that context.
|
|
116
124
|
*
|
|
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.
|
|
125
|
+
* Many hooks and components in this ui-react module take this type as a
|
|
126
|
+
* parameter or a prop, allowing you to pass in either the Store or its Id.
|
|
119
127
|
*
|
|
120
128
|
* @category Identity
|
|
121
129
|
*/
|
|
@@ -133,8 +141,8 @@ export type RelationshipsOrRelationshipsId = Relationships | Id;
|
|
|
133
141
|
* app. In this case you will want to refer to a Checkpoints object by its Id in
|
|
134
142
|
* that context.
|
|
135
143
|
*
|
|
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.
|
|
144
|
+
* Many hooks and components in this ui-react module take this type as a
|
|
145
|
+
* parameter or a prop, allowing you to pass in either the Store or its Id.
|
|
138
146
|
*
|
|
139
147
|
* @category Identity
|
|
140
148
|
*/
|
|
@@ -183,7 +191,7 @@ export type UndoOrRedoInformation = [boolean, Callback, Id | undefined, string];
|
|
|
183
191
|
* Even though the App component is rendered twice, the Store creation only
|
|
184
192
|
* occurs once by default.
|
|
185
193
|
*
|
|
186
|
-
* ```
|
|
194
|
+
* ```jsx
|
|
187
195
|
* const App = () => {
|
|
188
196
|
* const store = useCreateStore(() => {
|
|
189
197
|
* console.log('Store created');
|
|
@@ -208,7 +216,7 @@ export type UndoOrRedoInformation = [boolean, Callback, Id | undefined, string];
|
|
|
208
216
|
* The useCreateStore hook takes the `fidoSpecies` prop as a dependency, and so
|
|
209
217
|
* the Store is created again on the second render.
|
|
210
218
|
*
|
|
211
|
-
* ```
|
|
219
|
+
* ```jsx
|
|
212
220
|
* const App = ({fidoSpecies}) => {
|
|
213
221
|
* const store = useCreateStore(() => {
|
|
214
222
|
* console.log(`Store created for fido as ${fidoSpecies}`);
|
|
@@ -259,7 +267,7 @@ export function useCreateStore(
|
|
|
259
267
|
* provided. A component within it then uses the useStore hook to get a
|
|
260
268
|
* reference to the Store again, without the need to have it passed as a prop.
|
|
261
269
|
*
|
|
262
|
-
* ```
|
|
270
|
+
* ```jsx
|
|
263
271
|
* const App = ({store}) => (
|
|
264
272
|
* <Provider store={store}>
|
|
265
273
|
* <Pane />
|
|
@@ -278,7 +286,7 @@ export function useCreateStore(
|
|
|
278
286
|
* by Id. A component within it then uses the useStore hook with that Id to get
|
|
279
287
|
* a reference to the Store again, without the need to have it passed as a prop.
|
|
280
288
|
*
|
|
281
|
-
* ```
|
|
289
|
+
* ```jsx
|
|
282
290
|
* const App = ({store}) => (
|
|
283
291
|
* <Provider storesById={{petStore: store}}>
|
|
284
292
|
* <Pane />
|
|
@@ -322,7 +330,7 @@ export function useStore(id?: Id): Store | undefined;
|
|
|
322
330
|
* useTables hook by reference. A change to the data in the Store re-renders the
|
|
323
331
|
* component.
|
|
324
332
|
*
|
|
325
|
-
* ```
|
|
333
|
+
* ```jsx
|
|
326
334
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
327
335
|
* const App = () => <span>{JSON.stringify(useTables(store))}</span>;
|
|
328
336
|
*
|
|
@@ -339,7 +347,7 @@ export function useStore(id?: Id): Store | undefined;
|
|
|
339
347
|
* This example creates a Provider context into which a default Store is
|
|
340
348
|
* provided. A component within it then uses the useTables hook.
|
|
341
349
|
*
|
|
342
|
-
* ```
|
|
350
|
+
* ```jsx
|
|
343
351
|
* const App = ({store}) => (
|
|
344
352
|
* <Provider store={store}>
|
|
345
353
|
* <Pane />
|
|
@@ -357,7 +365,7 @@ export function useStore(id?: Id): Store | undefined;
|
|
|
357
365
|
* This example creates a Provider context into which a Store is provided, named
|
|
358
366
|
* by Id. A component within it then uses the useTables hook.
|
|
359
367
|
*
|
|
360
|
-
* ```
|
|
368
|
+
* ```jsx
|
|
361
369
|
* const App = ({store}) => (
|
|
362
370
|
* <Provider storesById={{petStore: store}}>
|
|
363
371
|
* <Pane />
|
|
@@ -397,7 +405,7 @@ export function useTables(storeOrStoreId?: StoreOrStoreId): Tables;
|
|
|
397
405
|
* useTableIds hook by reference. A change to the data in the Store re-renders
|
|
398
406
|
* the component.
|
|
399
407
|
*
|
|
400
|
-
* ```
|
|
408
|
+
* ```jsx
|
|
401
409
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
402
410
|
* const App = () => <span>{JSON.stringify(useTableIds(store))}</span>;
|
|
403
411
|
*
|
|
@@ -414,7 +422,7 @@ export function useTables(storeOrStoreId?: StoreOrStoreId): Tables;
|
|
|
414
422
|
* This example creates a Provider context into which a default Store is
|
|
415
423
|
* provided. A component within it then uses the useTableIds hook.
|
|
416
424
|
*
|
|
417
|
-
* ```
|
|
425
|
+
* ```jsx
|
|
418
426
|
* const App = ({store}) => (
|
|
419
427
|
* <Provider store={store}>
|
|
420
428
|
* <Pane />
|
|
@@ -432,7 +440,7 @@ export function useTables(storeOrStoreId?: StoreOrStoreId): Tables;
|
|
|
432
440
|
* This example creates a Provider context into which a Store is provided, named
|
|
433
441
|
* by Id. A component within it then uses the useTableIds hook.
|
|
434
442
|
*
|
|
435
|
-
* ```
|
|
443
|
+
* ```jsx
|
|
436
444
|
* const App = ({store}) => (
|
|
437
445
|
* <Provider storesById={{petStore: store}}>
|
|
438
446
|
* <Pane />
|
|
@@ -475,7 +483,7 @@ export function useTableIds(storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
475
483
|
* useTable hook by reference. A change to the data in the Store re-renders the
|
|
476
484
|
* component.
|
|
477
485
|
*
|
|
478
|
-
* ```
|
|
486
|
+
* ```jsx
|
|
479
487
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
480
488
|
* const App = () => <span>{JSON.stringify(useTable('pets', store))}</span>;
|
|
481
489
|
*
|
|
@@ -492,7 +500,7 @@ export function useTableIds(storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
492
500
|
* This example creates a Provider context into which a default Store is
|
|
493
501
|
* provided. A component within it then uses the useTable hook.
|
|
494
502
|
*
|
|
495
|
-
* ```
|
|
503
|
+
* ```jsx
|
|
496
504
|
* const App = ({store}) => (
|
|
497
505
|
* <Provider store={store}>
|
|
498
506
|
* <Pane />
|
|
@@ -510,7 +518,7 @@ export function useTableIds(storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
510
518
|
* This example creates a Provider context into which a Store is provided, named
|
|
511
519
|
* by Id. A component within it then uses the useTable hook.
|
|
512
520
|
*
|
|
513
|
-
* ```
|
|
521
|
+
* ```jsx
|
|
514
522
|
* const App = ({store}) => (
|
|
515
523
|
* <Provider storesById={{petStore: store}}>
|
|
516
524
|
* <Pane />
|
|
@@ -555,7 +563,7 @@ export function useTable(tableId: Id, storeOrStoreId?: StoreOrStoreId): Table;
|
|
|
555
563
|
* useRowIds hook by reference. A change to the data in the Store re-renders
|
|
556
564
|
* the component.
|
|
557
565
|
*
|
|
558
|
-
* ```
|
|
566
|
+
* ```jsx
|
|
559
567
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
560
568
|
* const App = () => <span>{JSON.stringify(useRowIds('pets', store))}</span>;
|
|
561
569
|
*
|
|
@@ -572,7 +580,7 @@ export function useTable(tableId: Id, storeOrStoreId?: StoreOrStoreId): Table;
|
|
|
572
580
|
* This example creates a Provider context into which a default Store is
|
|
573
581
|
* provided. A component within it then uses the useRowIds hook.
|
|
574
582
|
*
|
|
575
|
-
* ```
|
|
583
|
+
* ```jsx
|
|
576
584
|
* const App = ({store}) => (
|
|
577
585
|
* <Provider store={store}>
|
|
578
586
|
* <Pane />
|
|
@@ -590,7 +598,7 @@ export function useTable(tableId: Id, storeOrStoreId?: StoreOrStoreId): Table;
|
|
|
590
598
|
* This example creates a Provider context into which a Store is provided, named
|
|
591
599
|
* by Id. A component within it then uses the useRowIds hook.
|
|
592
600
|
*
|
|
593
|
-
* ```
|
|
601
|
+
* ```jsx
|
|
594
602
|
* const App = ({store}) => (
|
|
595
603
|
* <Provider storesById={{petStore: store}}>
|
|
596
604
|
* <Pane />
|
|
@@ -636,7 +644,7 @@ export function useRowIds(tableId: Id, storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
636
644
|
* useRow hook by reference. A change to the data in the Store re-renders the
|
|
637
645
|
* component.
|
|
638
646
|
*
|
|
639
|
-
* ```
|
|
647
|
+
* ```jsx
|
|
640
648
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
641
649
|
* const App = () => (
|
|
642
650
|
* <span>{JSON.stringify(useRow('pets', 'fido', store))}</span>
|
|
@@ -655,7 +663,7 @@ export function useRowIds(tableId: Id, storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
655
663
|
* This example creates a Provider context into which a default Store is
|
|
656
664
|
* provided. A component within it then uses the useRow hook.
|
|
657
665
|
*
|
|
658
|
-
* ```
|
|
666
|
+
* ```jsx
|
|
659
667
|
* const App = ({store}) => (
|
|
660
668
|
* <Provider store={store}>
|
|
661
669
|
* <Pane />
|
|
@@ -673,7 +681,7 @@ export function useRowIds(tableId: Id, storeOrStoreId?: StoreOrStoreId): Ids;
|
|
|
673
681
|
* This example creates a Provider context into which a Store is provided, named
|
|
674
682
|
* by Id. A component within it then uses the useRow hook.
|
|
675
683
|
*
|
|
676
|
-
* ```
|
|
684
|
+
* ```jsx
|
|
677
685
|
* const App = ({store}) => (
|
|
678
686
|
* <Provider storesById={{petStore: store}}>
|
|
679
687
|
* <Pane />
|
|
@@ -723,7 +731,7 @@ export function useRow(
|
|
|
723
731
|
* useCellIds hook by reference. A change to the data in the Store re-renders
|
|
724
732
|
* the component.
|
|
725
733
|
*
|
|
726
|
-
* ```
|
|
734
|
+
* ```jsx
|
|
727
735
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
728
736
|
* const App = () => (
|
|
729
737
|
* <span>{JSON.stringify(useCellIds('pets', 'fido', store))}</span>
|
|
@@ -742,7 +750,7 @@ export function useRow(
|
|
|
742
750
|
* This example creates a Provider context into which a default Store is
|
|
743
751
|
* provided. A component within it then uses the useCellIds hook.
|
|
744
752
|
*
|
|
745
|
-
* ```
|
|
753
|
+
* ```jsx
|
|
746
754
|
* const App = ({store}) => (
|
|
747
755
|
* <Provider store={store}>
|
|
748
756
|
* <Pane />
|
|
@@ -762,7 +770,7 @@ export function useRow(
|
|
|
762
770
|
* This example creates a Provider context into which a Store is provided, named
|
|
763
771
|
* by Id. A component within it then uses the useCellIds hook.
|
|
764
772
|
*
|
|
765
|
-
* ```
|
|
773
|
+
* ```jsx
|
|
766
774
|
* const App = ({store}) => (
|
|
767
775
|
* <Provider storesById={{petStore: store}}>
|
|
768
776
|
* <Pane />
|
|
@@ -813,7 +821,7 @@ export function useCellIds(
|
|
|
813
821
|
* useCell hook by reference. A change to the data in the Store re-renders the
|
|
814
822
|
* component.
|
|
815
823
|
*
|
|
816
|
-
* ```
|
|
824
|
+
* ```jsx
|
|
817
825
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
818
826
|
* const App = () => <span>{useCell('pets', 'fido', 'color', store)}</span>;
|
|
819
827
|
*
|
|
@@ -830,7 +838,7 @@ export function useCellIds(
|
|
|
830
838
|
* This example creates a Provider context into which a default Store is
|
|
831
839
|
* provided. A component within it then uses the useCell hook.
|
|
832
840
|
*
|
|
833
|
-
* ```
|
|
841
|
+
* ```jsx
|
|
834
842
|
* const App = ({store}) => (
|
|
835
843
|
* <Provider store={store}>
|
|
836
844
|
* <Pane />
|
|
@@ -848,7 +856,7 @@ export function useCellIds(
|
|
|
848
856
|
* This example creates a Provider context into which a Store is provided, named
|
|
849
857
|
* by Id. A component within it then uses the useCell hook.
|
|
850
858
|
*
|
|
851
|
-
* ```
|
|
859
|
+
* ```jsx
|
|
852
860
|
* const App = ({store}) => (
|
|
853
861
|
* <Provider storesById={{petStore: store}}>
|
|
854
862
|
* <Pane />
|
|
@@ -917,7 +925,7 @@ export function useCell(
|
|
|
917
925
|
* This example uses the useSetTablesCallback hook to create an event handler
|
|
918
926
|
* which updates the Store when the `span` element is clicked.
|
|
919
927
|
*
|
|
920
|
-
* ```
|
|
928
|
+
* ```jsx
|
|
921
929
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
922
930
|
* const App = () => {
|
|
923
931
|
* const handleClick = useSetTablesCallback(
|
|
@@ -1001,7 +1009,7 @@ export function useSetTablesCallback<Parameter>(
|
|
|
1001
1009
|
* This example uses the useSetTableCallback hook to create an event handler
|
|
1002
1010
|
* which updates the Store when the `span` element is clicked.
|
|
1003
1011
|
*
|
|
1004
|
-
* ```
|
|
1012
|
+
* ```jsx
|
|
1005
1013
|
* const store = createStore().setTable('pets', {nemo: {species: 'fish'}});
|
|
1006
1014
|
* const App = () => {
|
|
1007
1015
|
* const handleClick = useSetTableCallback(
|
|
@@ -1088,7 +1096,7 @@ export function useSetTableCallback<Parameter>(
|
|
|
1088
1096
|
* This example uses the useSetRowCallback hook to create an event handler which
|
|
1089
1097
|
* updates the Store when the `span` element is clicked.
|
|
1090
1098
|
*
|
|
1091
|
-
* ```
|
|
1099
|
+
* ```jsx
|
|
1092
1100
|
* const store = createStore().setRow('pets', 'nemo', {species: 'fish'});
|
|
1093
1101
|
* const App = () => {
|
|
1094
1102
|
* const handleClick = useSetRowCallback(
|
|
@@ -1176,7 +1184,7 @@ export function useSetRowCallback<Parameter>(
|
|
|
1176
1184
|
* This example uses the useAddRowCallback hook to create an event handler which
|
|
1177
1185
|
* updates the Store when the `span` element is clicked.
|
|
1178
1186
|
*
|
|
1179
|
-
* ```
|
|
1187
|
+
* ```jsx
|
|
1180
1188
|
* const store = createStore().setRow('pets', 'nemo', {species: 'fish'});
|
|
1181
1189
|
* const App = () => {
|
|
1182
1190
|
* const handleClick = useAddRowCallback(
|
|
@@ -1264,7 +1272,7 @@ export function useAddRowCallback<Parameter>(
|
|
|
1264
1272
|
* This example uses the useSetPartialRowCallback hook to create an event
|
|
1265
1273
|
* handler which updates the Store when the `span` element is clicked.
|
|
1266
1274
|
*
|
|
1267
|
-
* ```
|
|
1275
|
+
* ```jsx
|
|
1268
1276
|
* const store = createStore().setRow('pets', 'nemo', {species: 'fish'});
|
|
1269
1277
|
* const App = () => {
|
|
1270
1278
|
* const handleClick = useSetPartialRowCallback(
|
|
@@ -1355,7 +1363,7 @@ export function useSetPartialRowCallback<Parameter>(
|
|
|
1355
1363
|
* This example uses the useSetCellCallback hook to create an event handler
|
|
1356
1364
|
* which updates the Store with a Cell value when the `span` element is clicked.
|
|
1357
1365
|
*
|
|
1358
|
-
* ```
|
|
1366
|
+
* ```jsx
|
|
1359
1367
|
* const store = createStore().setCell('pets', 'nemo', 'species', 'fish');
|
|
1360
1368
|
* const App = () => {
|
|
1361
1369
|
* const handleClick = useSetCellCallback(
|
|
@@ -1392,7 +1400,7 @@ export function useSetPartialRowCallback<Parameter>(
|
|
|
1392
1400
|
* which updates the Store via a MapCell function when the `span` element is
|
|
1393
1401
|
* clicked.
|
|
1394
1402
|
*
|
|
1395
|
-
* ```
|
|
1403
|
+
* ```jsx
|
|
1396
1404
|
* const store = createStore().setCell('pets', 'nemo', 'visits', 1);
|
|
1397
1405
|
* const App = () => {
|
|
1398
1406
|
* const handleClick = useSetCellCallback(
|
|
@@ -1466,7 +1474,7 @@ export function useSetCellCallback<Parameter>(
|
|
|
1466
1474
|
* This example uses the useDelTablesCallback hook to create an event handler
|
|
1467
1475
|
* which deletes from the Store when the `span` element is clicked.
|
|
1468
1476
|
*
|
|
1469
|
-
* ```
|
|
1477
|
+
* ```jsx
|
|
1470
1478
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
1471
1479
|
* const App = () => {
|
|
1472
1480
|
* const handleClick = useDelTablesCallback(store, () =>
|
|
@@ -1530,7 +1538,7 @@ export function useDelTablesCallback(
|
|
|
1530
1538
|
* This example uses the useDelTableCallback hook to create an event handler
|
|
1531
1539
|
* which deletes from the Store when the `span` element is clicked.
|
|
1532
1540
|
*
|
|
1533
|
-
* ```
|
|
1541
|
+
* ```jsx
|
|
1534
1542
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
1535
1543
|
* const App = () => {
|
|
1536
1544
|
* const handleClick = useDelTableCallback('pets', store, () =>
|
|
@@ -1596,7 +1604,7 @@ export function useDelTableCallback(
|
|
|
1596
1604
|
* This example uses the useDelRowCallback hook to create an event handler which
|
|
1597
1605
|
* deletes from the Store when the `span` element is clicked.
|
|
1598
1606
|
*
|
|
1599
|
-
* ```
|
|
1607
|
+
* ```jsx
|
|
1600
1608
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
1601
1609
|
* const App = () => {
|
|
1602
1610
|
* const handleClick = useDelRowCallback('pets', 'nemo', store, () =>
|
|
@@ -1667,7 +1675,7 @@ export function useDelRowCallback(
|
|
|
1667
1675
|
* This example uses the useDelCellCallback hook to create an event handler
|
|
1668
1676
|
* which deletes from the Store when the `span` element is clicked.
|
|
1669
1677
|
*
|
|
1670
|
-
* ```
|
|
1678
|
+
* ```jsx
|
|
1671
1679
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
1672
1680
|
* const App = () => {
|
|
1673
1681
|
* const handleClick = useDelCellCallback(
|
|
@@ -1738,7 +1746,7 @@ export function useDelCellCallback(
|
|
|
1738
1746
|
* scoped to a single component. When the component is unmounted, the listener
|
|
1739
1747
|
* is removed from the Store.
|
|
1740
1748
|
*
|
|
1741
|
-
* ```
|
|
1749
|
+
* ```jsx
|
|
1742
1750
|
* const App = ({store}) => (
|
|
1743
1751
|
* <Provider store={store}>
|
|
1744
1752
|
* <Pane />
|
|
@@ -1800,7 +1808,7 @@ export function useTablesListener(
|
|
|
1800
1808
|
* scoped to a single component. When the component is unmounted, the listener
|
|
1801
1809
|
* is removed from the Store.
|
|
1802
1810
|
*
|
|
1803
|
-
* ```
|
|
1811
|
+
* ```jsx
|
|
1804
1812
|
* const App = ({store}) => (
|
|
1805
1813
|
* <Provider store={store}>
|
|
1806
1814
|
* <Pane />
|
|
@@ -1865,7 +1873,7 @@ export function useTableIdsListener(
|
|
|
1865
1873
|
* scoped to a single component. When the component is unmounted, the listener
|
|
1866
1874
|
* is removed from the Store.
|
|
1867
1875
|
*
|
|
1868
|
-
* ```
|
|
1876
|
+
* ```jsx
|
|
1869
1877
|
* const App = ({store}) => (
|
|
1870
1878
|
* <Provider store={store}>
|
|
1871
1879
|
* <Pane />
|
|
@@ -1931,7 +1939,7 @@ export function useTableListener(
|
|
|
1931
1939
|
* scoped to a single component. When the component is unmounted, the listener
|
|
1932
1940
|
* is removed from the Store.
|
|
1933
1941
|
*
|
|
1934
|
-
* ```
|
|
1942
|
+
* ```jsx
|
|
1935
1943
|
* const App = ({store}) => (
|
|
1936
1944
|
* <Provider store={store}>
|
|
1937
1945
|
* <Pane />
|
|
@@ -2004,7 +2012,7 @@ export function useRowIdsListener(
|
|
|
2004
2012
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2005
2013
|
* is removed from the Store.
|
|
2006
2014
|
*
|
|
2007
|
-
* ```
|
|
2015
|
+
* ```jsx
|
|
2008
2016
|
* const App = ({store}) => (
|
|
2009
2017
|
* <Provider store={store}>
|
|
2010
2018
|
* <Pane />
|
|
@@ -2079,7 +2087,7 @@ export function useRowListener(
|
|
|
2079
2087
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2080
2088
|
* is removed from the Store.
|
|
2081
2089
|
*
|
|
2082
|
-
* ```
|
|
2090
|
+
* ```jsx
|
|
2083
2091
|
* const App = ({store}) => (
|
|
2084
2092
|
* <Provider store={store}>
|
|
2085
2093
|
* <Pane />
|
|
@@ -2156,7 +2164,7 @@ export function useCellIdsListener(
|
|
|
2156
2164
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2157
2165
|
* is removed from the Store.
|
|
2158
2166
|
*
|
|
2159
|
-
* ```
|
|
2167
|
+
* ```jsx
|
|
2160
2168
|
* const App = ({store}) => (
|
|
2161
2169
|
* <Provider store={store}>
|
|
2162
2170
|
* <Pane />
|
|
@@ -2213,6 +2221,9 @@ export function useCellListener(
|
|
|
2213
2221
|
* an array in the optional second parameter, just as you would for any React
|
|
2214
2222
|
* hook with dependencies.
|
|
2215
2223
|
*
|
|
2224
|
+
* This hook ensures the Metrics object is destroyed whenever a new one is
|
|
2225
|
+
* created or the component is unmounted.
|
|
2226
|
+
*
|
|
2216
2227
|
* @param store A reference to the Store for which to create a new Metrics
|
|
2217
2228
|
* object.
|
|
2218
2229
|
* @param create A function for performing the creation steps of the Metrics
|
|
@@ -2227,7 +2238,7 @@ export function useCellListener(
|
|
|
2227
2238
|
* application. Even though the App component is rendered twice, the Metrics
|
|
2228
2239
|
* object creation only occurs once by default.
|
|
2229
2240
|
*
|
|
2230
|
-
* ```
|
|
2241
|
+
* ```jsx
|
|
2231
2242
|
* const App = () => {
|
|
2232
2243
|
* const store = useCreateStore(() =>
|
|
2233
2244
|
* createStore().setTable('species', {dog: {price: 5}, cat: {price: 4}}),
|
|
@@ -2258,7 +2269,7 @@ export function useCellListener(
|
|
|
2258
2269
|
* top-level prop. The useCreateMetrics hook takes the tableToCount prop as a
|
|
2259
2270
|
* dependency, and so the Metrics object is created again on the second render.
|
|
2260
2271
|
*
|
|
2261
|
-
* ```
|
|
2272
|
+
* ```jsx
|
|
2262
2273
|
* const App = ({tableToCount}) => {
|
|
2263
2274
|
* const store = useCreateStore(() =>
|
|
2264
2275
|
* createStore()
|
|
@@ -2323,7 +2334,7 @@ export function useCreateMetrics(
|
|
|
2323
2334
|
* reference to the Metrics object again, without the need to have it passed
|
|
2324
2335
|
* as a prop.
|
|
2325
2336
|
*
|
|
2326
|
-
* ```
|
|
2337
|
+
* ```jsx
|
|
2327
2338
|
* const App = ({metrics}) => (
|
|
2328
2339
|
* <Provider metrics={metrics}>
|
|
2329
2340
|
* <Pane />
|
|
@@ -2343,7 +2354,7 @@ export function useCreateMetrics(
|
|
|
2343
2354
|
* with that Id to get a reference to the Metrics object again, without the need
|
|
2344
2355
|
* to have it passed as a prop.
|
|
2345
2356
|
*
|
|
2346
|
-
* ```
|
|
2357
|
+
* ```jsx
|
|
2347
2358
|
* const App = ({metrics}) => (
|
|
2348
2359
|
* <Provider metricsById={{petStore: metrics}}>
|
|
2349
2360
|
* <Pane />
|
|
@@ -2388,7 +2399,7 @@ export function useMetrics(id?: Id): Metrics | undefined;
|
|
|
2388
2399
|
* in the useMetric hook by reference. A change to the Metric re-renders the
|
|
2389
2400
|
* component.
|
|
2390
2401
|
*
|
|
2391
|
-
* ```
|
|
2402
|
+
* ```jsx
|
|
2392
2403
|
* const store = createStore().setTable('species', {
|
|
2393
2404
|
* dog: {price: 5},
|
|
2394
2405
|
* cat: {price: 4},
|
|
@@ -2411,7 +2422,7 @@ export function useMetrics(id?: Id): Metrics | undefined;
|
|
|
2411
2422
|
* This example creates a Provider context into which a default Metrics object
|
|
2412
2423
|
* is provided. A component within it then uses the useMetric hook.
|
|
2413
2424
|
*
|
|
2414
|
-
* ```
|
|
2425
|
+
* ```jsx
|
|
2415
2426
|
* const App = ({metrics}) => (
|
|
2416
2427
|
* <Provider metrics={metrics}>
|
|
2417
2428
|
* <Pane />
|
|
@@ -2436,7 +2447,7 @@ export function useMetrics(id?: Id): Metrics | undefined;
|
|
|
2436
2447
|
* This example creates a Provider context into which a default Metrics object
|
|
2437
2448
|
* is provided. A component within it then uses the useMetric hook.
|
|
2438
2449
|
*
|
|
2439
|
-
* ```
|
|
2450
|
+
* ```jsx
|
|
2440
2451
|
* const App = ({metrics}) => (
|
|
2441
2452
|
* <Provider metricsById={{petMetrics: metrics}}>
|
|
2442
2453
|
* <Pane />
|
|
@@ -2495,7 +2506,7 @@ export function useMetric(
|
|
|
2495
2506
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2496
2507
|
* is removed from the Metrics object.
|
|
2497
2508
|
*
|
|
2498
|
-
* ```
|
|
2509
|
+
* ```jsx
|
|
2499
2510
|
* const App = ({metrics}) => (
|
|
2500
2511
|
* <Provider metrics={metrics}>
|
|
2501
2512
|
* <Pane />
|
|
@@ -2554,6 +2565,9 @@ export function useMetricListener(
|
|
|
2554
2565
|
* an array in the optional second parameter, just as you would for any React
|
|
2555
2566
|
* hook with dependencies.
|
|
2556
2567
|
*
|
|
2568
|
+
* This hook ensures the Indexes object is destroyed whenever a new one is
|
|
2569
|
+
* created or the component is unmounted.
|
|
2570
|
+
*
|
|
2557
2571
|
* @param store A reference to the Store for which to create a new Indexes
|
|
2558
2572
|
* object.
|
|
2559
2573
|
* @param create A function for performing the creation steps of the Indexes
|
|
@@ -2568,7 +2582,7 @@ export function useMetricListener(
|
|
|
2568
2582
|
* application. Even though the App component is rendered twice, the Indexes
|
|
2569
2583
|
* object creation only occurs once by default.
|
|
2570
2584
|
*
|
|
2571
|
-
* ```
|
|
2585
|
+
* ```jsx
|
|
2572
2586
|
* const App = () => {
|
|
2573
2587
|
* const store = useCreateStore((store) =>
|
|
2574
2588
|
* createStore().setTable('pets', {
|
|
@@ -2604,7 +2618,7 @@ export function useMetricListener(
|
|
|
2604
2618
|
* top-level prop. The useCreateIndexes hook takes the cellToIndex prop as a
|
|
2605
2619
|
* dependency, and so the Indexes object is created again on the second render.
|
|
2606
2620
|
*
|
|
2607
|
-
* ```
|
|
2621
|
+
* ```jsx
|
|
2608
2622
|
* const App = ({cellToIndex}) => {
|
|
2609
2623
|
* const store = useCreateStore(() =>
|
|
2610
2624
|
* createStore().setTable('pets', {
|
|
@@ -2672,7 +2686,7 @@ export function useCreateIndexes(
|
|
|
2672
2686
|
* reference to the Indexes object again, without the need to have it passed
|
|
2673
2687
|
* as a prop.
|
|
2674
2688
|
*
|
|
2675
|
-
* ```
|
|
2689
|
+
* ```jsx
|
|
2676
2690
|
* const App = ({indexes}) => (
|
|
2677
2691
|
* <Provider indexes={indexes}>
|
|
2678
2692
|
* <Pane />
|
|
@@ -2692,7 +2706,7 @@ export function useCreateIndexes(
|
|
|
2692
2706
|
* with that Id to get a reference to the Indexes object again, without the need
|
|
2693
2707
|
* to have it passed as a prop.
|
|
2694
2708
|
*
|
|
2695
|
-
* ```
|
|
2709
|
+
* ```jsx
|
|
2696
2710
|
* const App = ({indexes}) => (
|
|
2697
2711
|
* <Provider indexesById={{petStore: indexes}}>
|
|
2698
2712
|
* <Pane />
|
|
@@ -2737,7 +2751,7 @@ export function useIndexes(id?: Id): Indexes | undefined;
|
|
|
2737
2751
|
* in the useSliceIds hook by reference. A change to the Slice Ids re-renders
|
|
2738
2752
|
* the component.
|
|
2739
2753
|
*
|
|
2740
|
-
* ```
|
|
2754
|
+
* ```jsx
|
|
2741
2755
|
* const store = createStore().setTable('pets', {
|
|
2742
2756
|
* fido: {species: 'dog'},
|
|
2743
2757
|
* felix: {species: 'cat'},
|
|
@@ -2762,7 +2776,7 @@ export function useIndexes(id?: Id): Indexes | undefined;
|
|
|
2762
2776
|
* This example creates a Provider context into which a default Indexes object
|
|
2763
2777
|
* is provided. A component within it then uses the useSliceIds hook.
|
|
2764
2778
|
*
|
|
2765
|
-
* ```
|
|
2779
|
+
* ```jsx
|
|
2766
2780
|
* const App = ({indexes}) => (
|
|
2767
2781
|
* <Provider indexes={indexes}>
|
|
2768
2782
|
* <Pane />
|
|
@@ -2787,7 +2801,7 @@ export function useIndexes(id?: Id): Indexes | undefined;
|
|
|
2787
2801
|
* This example creates a Provider context into which a default Indexes object
|
|
2788
2802
|
* is provided. A component within it then uses the useSliceIds hook.
|
|
2789
2803
|
*
|
|
2790
|
-
* ```
|
|
2804
|
+
* ```jsx
|
|
2791
2805
|
* const App = ({indexes}) => (
|
|
2792
2806
|
* <Provider indexesById={{petIndexes: indexes}}>
|
|
2793
2807
|
* <Pane />
|
|
@@ -2844,7 +2858,7 @@ export function useSliceIds(
|
|
|
2844
2858
|
* in the useSliceRowIds hook by reference. A change to the Row Ids in the Slice
|
|
2845
2859
|
* re-renders the component.
|
|
2846
2860
|
*
|
|
2847
|
-
* ```
|
|
2861
|
+
* ```jsx
|
|
2848
2862
|
* const store = createStore().setTable('pets', {
|
|
2849
2863
|
* fido: {species: 'dog'},
|
|
2850
2864
|
* felix: {species: 'cat'},
|
|
@@ -2871,7 +2885,7 @@ export function useSliceIds(
|
|
|
2871
2885
|
* This example creates a Provider context into which a default Indexes object
|
|
2872
2886
|
* is provided. A component within it then uses the useSliceRowIds hook.
|
|
2873
2887
|
*
|
|
2874
|
-
* ```
|
|
2888
|
+
* ```jsx
|
|
2875
2889
|
* const App = ({indexes}) => (
|
|
2876
2890
|
* <Provider indexes={indexes}>
|
|
2877
2891
|
* <Pane />
|
|
@@ -2898,7 +2912,7 @@ export function useSliceIds(
|
|
|
2898
2912
|
* This example creates a Provider context into which a default Indexes object
|
|
2899
2913
|
* is provided. A component within it then uses the useSliceRowIds hook.
|
|
2900
2914
|
*
|
|
2901
|
-
* ```
|
|
2915
|
+
* ```jsx
|
|
2902
2916
|
* const App = ({indexes}) => (
|
|
2903
2917
|
* <Provider indexesById={{petIndexes: indexes}}>
|
|
2904
2918
|
* <Pane />
|
|
@@ -2963,7 +2977,7 @@ export function useSliceRowIds(
|
|
|
2963
2977
|
* scoped to a single component. When the component is unmounted, the listener
|
|
2964
2978
|
* is removed from the Indexes object.
|
|
2965
2979
|
*
|
|
2966
|
-
* ```
|
|
2980
|
+
* ```jsx
|
|
2967
2981
|
* const App = ({indexes}) => (
|
|
2968
2982
|
* <Provider indexes={indexes}>
|
|
2969
2983
|
* <Pane />
|
|
@@ -3041,7 +3055,7 @@ export function useSliceIdsListener(
|
|
|
3041
3055
|
* is scoped to a single component. When the component is unmounted, the
|
|
3042
3056
|
* listener is removed from the Indexes object.
|
|
3043
3057
|
*
|
|
3044
|
-
* ```
|
|
3058
|
+
* ```jsx
|
|
3045
3059
|
* const App = ({indexes}) => (
|
|
3046
3060
|
* <Provider indexes={indexes}>
|
|
3047
3061
|
* <Pane />
|
|
@@ -3104,6 +3118,9 @@ export function useSliceRowIdsListener(
|
|
|
3104
3118
|
* them in an array in the optional second parameter, just as you would for any
|
|
3105
3119
|
* React hook with dependencies.
|
|
3106
3120
|
*
|
|
3121
|
+
* This hook ensures the Relationships object is destroyed whenever a new one is
|
|
3122
|
+
* created or the component is unmounted.
|
|
3123
|
+
*
|
|
3107
3124
|
* @param store A reference to the Store for which to create a new Relationships
|
|
3108
3125
|
* object.
|
|
3109
3126
|
* @param create An optional callback for performing post-creation steps on the
|
|
@@ -3117,7 +3134,7 @@ export function useSliceRowIdsListener(
|
|
|
3117
3134
|
* application. Even though the App component is rendered twice, the
|
|
3118
3135
|
* Relationships object creation only occurs once by default.
|
|
3119
3136
|
*
|
|
3120
|
-
* ```
|
|
3137
|
+
* ```jsx
|
|
3121
3138
|
* const App = () => {
|
|
3122
3139
|
* const store = useCreateStore(() =>
|
|
3123
3140
|
* createStore()
|
|
@@ -3157,7 +3174,7 @@ export function useSliceRowIdsListener(
|
|
|
3157
3174
|
* `remoteTableAndCellToLink` prop as a dependency, and so the Relationships
|
|
3158
3175
|
* object is created again on the second render.
|
|
3159
3176
|
*
|
|
3160
|
-
* ```
|
|
3177
|
+
* ```jsx
|
|
3161
3178
|
* const App = ({remoteTableAndCellToLink}) => {
|
|
3162
3179
|
* const store = useCreateStore(() =>
|
|
3163
3180
|
* createStore()
|
|
@@ -3231,7 +3248,7 @@ export function useCreateRelationships(
|
|
|
3231
3248
|
* to get a reference to the Relationships object again, without the need to
|
|
3232
3249
|
* have it passed as a prop.
|
|
3233
3250
|
*
|
|
3234
|
-
* ```
|
|
3251
|
+
* ```jsx
|
|
3235
3252
|
* const App = ({relationships}) => (
|
|
3236
3253
|
* <Provider relationships={relationships}>
|
|
3237
3254
|
* <Pane />
|
|
@@ -3253,7 +3270,7 @@ export function useCreateRelationships(
|
|
|
3253
3270
|
* hook with that Id to get a reference to the Relationships object again,
|
|
3254
3271
|
* without the need to have it passed as a prop.
|
|
3255
3272
|
*
|
|
3256
|
-
* ```
|
|
3273
|
+
* ```jsx
|
|
3257
3274
|
* const App = ({relationships}) => (
|
|
3258
3275
|
* <Provider relationshipsById={{petStore: relationships}}>
|
|
3259
3276
|
* <Pane />
|
|
@@ -3303,7 +3320,7 @@ export function useRelationships(id?: Id): Relationships | undefined;
|
|
|
3303
3320
|
* used in the useRemoteRowId hook by reference. A change to the remote Row Id
|
|
3304
3321
|
* re-renders the component.
|
|
3305
3322
|
*
|
|
3306
|
-
* ```
|
|
3323
|
+
* ```jsx
|
|
3307
3324
|
* const store = createStore()
|
|
3308
3325
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
3309
3326
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -3330,7 +3347,7 @@ export function useRelationships(id?: Id): Relationships | undefined;
|
|
|
3330
3347
|
* This example creates a Provider context into which a default Relationships
|
|
3331
3348
|
* object is provided. A component within it then uses the useRemoteRowId hook.
|
|
3332
3349
|
*
|
|
3333
|
-
* ```
|
|
3350
|
+
* ```jsx
|
|
3334
3351
|
* const App = ({relationships}) => (
|
|
3335
3352
|
* <Provider relationships={relationships}>
|
|
3336
3353
|
* <Pane />
|
|
@@ -3353,7 +3370,7 @@ export function useRelationships(id?: Id): Relationships | undefined;
|
|
|
3353
3370
|
* This example creates a Provider context into which a default Relationships
|
|
3354
3371
|
* object is provided. A component within it then uses the useRemoteRowId hook.
|
|
3355
3372
|
*
|
|
3356
|
-
* ```
|
|
3373
|
+
* ```jsx
|
|
3357
3374
|
* const App = ({relationships}) => (
|
|
3358
3375
|
* <Provider relationshipsById={{petRelationships: relationships}}>
|
|
3359
3376
|
* <Pane />
|
|
@@ -3410,7 +3427,7 @@ export function useRemoteRowId(
|
|
|
3410
3427
|
* used in the useLocalRowIds hook by reference. A change to the local Row Ids
|
|
3411
3428
|
* re-renders the component.
|
|
3412
3429
|
*
|
|
3413
|
-
* ```
|
|
3430
|
+
* ```jsx
|
|
3414
3431
|
* const store = createStore()
|
|
3415
3432
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
3416
3433
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -3439,7 +3456,7 @@ export function useRemoteRowId(
|
|
|
3439
3456
|
* This example creates a Provider context into which a default Relationships
|
|
3440
3457
|
* object is provided. A component within it then uses the useLocalRowIds hook.
|
|
3441
3458
|
*
|
|
3442
|
-
* ```
|
|
3459
|
+
* ```jsx
|
|
3443
3460
|
* const App = ({relationships}) => (
|
|
3444
3461
|
* <Provider relationships={relationships}>
|
|
3445
3462
|
* <Pane />
|
|
@@ -3464,7 +3481,7 @@ export function useRemoteRowId(
|
|
|
3464
3481
|
* This example creates a Provider context into which a default Relationships
|
|
3465
3482
|
* object is provided. A component within it then uses the useLocalRowIds hook.
|
|
3466
3483
|
*
|
|
3467
|
-
* ```
|
|
3484
|
+
* ```jsx
|
|
3468
3485
|
* const App = ({relationships}) => (
|
|
3469
3486
|
* <Provider relationshipsById={{petRelationships: relationships}}>
|
|
3470
3487
|
* <Pane />
|
|
@@ -3525,7 +3542,7 @@ export function useLocalRowIds(
|
|
|
3525
3542
|
* used in the useLinkedRowIds hook by reference. A change to the linked Row Ids
|
|
3526
3543
|
* re-renders the component.
|
|
3527
3544
|
*
|
|
3528
|
-
* ```
|
|
3545
|
+
* ```jsx
|
|
3529
3546
|
* const store = createStore().setTable('pets', {
|
|
3530
3547
|
* fido: {species: 'dog', next: 'felix'},
|
|
3531
3548
|
* felix: {species: 'cat', next: 'cujo'},
|
|
@@ -3557,7 +3574,7 @@ export function useLocalRowIds(
|
|
|
3557
3574
|
* This example creates a Provider context into which a default Relationships
|
|
3558
3575
|
* object is provided. A component within it then uses the useLinkedRowIds hook.
|
|
3559
3576
|
*
|
|
3560
|
-
* ```
|
|
3577
|
+
* ```jsx
|
|
3561
3578
|
* const App = ({relationships}) => (
|
|
3562
3579
|
* <Provider relationships={relationships}>
|
|
3563
3580
|
* <Pane />
|
|
@@ -3584,7 +3601,7 @@ export function useLocalRowIds(
|
|
|
3584
3601
|
* This example creates a Provider context into which a default Relationships
|
|
3585
3602
|
* object is provided. A component within it then uses the useLinkedRowIds hook.
|
|
3586
3603
|
*
|
|
3587
|
-
* ```
|
|
3604
|
+
* ```jsx
|
|
3588
3605
|
* const App = ({relationships}) => (
|
|
3589
3606
|
* <Provider relationshipsById={{petRelationships: relationships}}>
|
|
3590
3607
|
* <Pane />
|
|
@@ -3661,7 +3678,7 @@ export function useLinkedRowIds(
|
|
|
3661
3678
|
* is scoped to a single component. When the component is unmounted, the
|
|
3662
3679
|
* listener is removed from the Relationships object.
|
|
3663
3680
|
*
|
|
3664
|
-
* ```
|
|
3681
|
+
* ```jsx
|
|
3665
3682
|
* const App = ({relationships}) => (
|
|
3666
3683
|
* <Provider relationships={relationships}>
|
|
3667
3684
|
* <Pane />
|
|
@@ -3749,7 +3766,7 @@ export function useRemoteRowIdListener(
|
|
|
3749
3766
|
* is scoped to a single component. When the component is unmounted, the
|
|
3750
3767
|
* listener is removed from the Relationships object.
|
|
3751
3768
|
*
|
|
3752
|
-
* ```
|
|
3769
|
+
* ```jsx
|
|
3753
3770
|
* const App = ({relationships}) => (
|
|
3754
3771
|
* <Provider relationships={relationships}>
|
|
3755
3772
|
* <Pane />
|
|
@@ -3831,7 +3848,7 @@ export function useLocalRowIdsListener(
|
|
|
3831
3848
|
* is scoped to a single component. When the component is unmounted, the
|
|
3832
3849
|
* listener is removed from the Relationships object.
|
|
3833
3850
|
*
|
|
3834
|
-
* ```
|
|
3851
|
+
* ```jsx
|
|
3835
3852
|
* const App = ({relationships}) => (
|
|
3836
3853
|
* <Provider relationships={relationships}>
|
|
3837
3854
|
* <Pane />
|
|
@@ -3900,6 +3917,9 @@ export function useLinkedRowIdsListener(
|
|
|
3900
3917
|
* them in an array in the optional second parameter, just as you would for any
|
|
3901
3918
|
* React hook with dependencies.
|
|
3902
3919
|
*
|
|
3920
|
+
* This hook ensures the Checkpoints object is destroyed whenever a new one is
|
|
3921
|
+
* created or the component is unmounted.
|
|
3922
|
+
*
|
|
3903
3923
|
* @param store A reference to the Store for which to create a new Checkpoints
|
|
3904
3924
|
* object.
|
|
3905
3925
|
* @param create A function for performing the creation steps of the Checkpoints
|
|
@@ -3914,7 +3934,7 @@ export function useLinkedRowIdsListener(
|
|
|
3914
3934
|
* application. Even though the App component is rendered twice, the
|
|
3915
3935
|
* Checkpoints object creation only occurs once by default.
|
|
3916
3936
|
*
|
|
3917
|
-
* ```
|
|
3937
|
+
* ```jsx
|
|
3918
3938
|
* const App = () => {
|
|
3919
3939
|
* const store = useCreateStore(createStore);
|
|
3920
3940
|
* const checkpoints = useCreateCheckpoints(store, (store) => {
|
|
@@ -3941,7 +3961,7 @@ export function useLinkedRowIdsListener(
|
|
|
3941
3961
|
* dependency, and so the Checkpoints object is created again on the second
|
|
3942
3962
|
* render.
|
|
3943
3963
|
*
|
|
3944
|
-
* ```
|
|
3964
|
+
* ```jsx
|
|
3945
3965
|
* const App = ({size}) => {
|
|
3946
3966
|
* const store = useCreateStore(createStore);
|
|
3947
3967
|
* const checkpoints = useCreateCheckpoints(
|
|
@@ -3999,7 +4019,7 @@ export function useCreateCheckpoints(
|
|
|
3999
4019
|
* to get a reference to the Checkpoints object again, without the need to have
|
|
4000
4020
|
* it passed as a prop.
|
|
4001
4021
|
*
|
|
4002
|
-
* ```
|
|
4022
|
+
* ```jsx
|
|
4003
4023
|
* const App = ({checkpoints}) => (
|
|
4004
4024
|
* <Provider checkpoints={checkpoints}>
|
|
4005
4025
|
* <Pane />
|
|
@@ -4021,7 +4041,7 @@ export function useCreateCheckpoints(
|
|
|
4021
4041
|
* hook with that Id to get a reference to the Checkpoints object again, without
|
|
4022
4042
|
* the need to have it passed as a prop.
|
|
4023
4043
|
*
|
|
4024
|
-
* ```
|
|
4044
|
+
* ```jsx
|
|
4025
4045
|
* const App = ({checkpoints}) => (
|
|
4026
4046
|
* <Provider checkpointsById={{petStore: checkpoints}}>
|
|
4027
4047
|
* <Pane />
|
|
@@ -4070,7 +4090,7 @@ export function useCheckpoints(id?: Id): Checkpoints | undefined;
|
|
|
4070
4090
|
* used in the useCheckpointIds hook by reference. A change to the checkpoint
|
|
4071
4091
|
* Ids re-renders the component.
|
|
4072
4092
|
*
|
|
4073
|
-
* ```
|
|
4093
|
+
* ```jsx
|
|
4074
4094
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
4075
4095
|
* const checkpoints = createCheckpoints(store);
|
|
4076
4096
|
* const App = () => (
|
|
@@ -4095,7 +4115,7 @@ export function useCheckpoints(id?: Id): Checkpoints | undefined;
|
|
|
4095
4115
|
* object is provided. A component within it then uses the useCheckpointIds
|
|
4096
4116
|
* hook.
|
|
4097
4117
|
*
|
|
4098
|
-
* ```
|
|
4118
|
+
* ```jsx
|
|
4099
4119
|
* const App = ({checkpoints}) => (
|
|
4100
4120
|
* <Provider checkpoints={checkpoints}>
|
|
4101
4121
|
* <Pane />
|
|
@@ -4117,7 +4137,7 @@ export function useCheckpoints(id?: Id): Checkpoints | undefined;
|
|
|
4117
4137
|
* object is provided. A component within it then uses the useCheckpointIds
|
|
4118
4138
|
* hook.
|
|
4119
4139
|
*
|
|
4120
|
-
* ```
|
|
4140
|
+
* ```jsx
|
|
4121
4141
|
* const App = ({checkpoints}) => (
|
|
4122
4142
|
* <Provider checkpointsById={{petCheckpoints: checkpoints}}>
|
|
4123
4143
|
* <Pane />
|
|
@@ -4168,7 +4188,7 @@ export function useCheckpointIds(
|
|
|
4168
4188
|
* used in the useCheckpoint hook by reference. A change to the checkpoint label
|
|
4169
4189
|
* re-renders the component.
|
|
4170
4190
|
*
|
|
4171
|
-
* ```
|
|
4191
|
+
* ```jsx
|
|
4172
4192
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
4173
4193
|
* const checkpoints = createCheckpoints(store);
|
|
4174
4194
|
* const App = () => <span>{useCheckpoint('1', checkpoints)}</span>;
|
|
@@ -4188,7 +4208,7 @@ export function useCheckpointIds(
|
|
|
4188
4208
|
* object is provided. A component within it then uses the useCheckpoint
|
|
4189
4209
|
* hook.
|
|
4190
4210
|
*
|
|
4191
|
-
* ```
|
|
4211
|
+
* ```jsx
|
|
4192
4212
|
* const App = ({checkpoints}) => (
|
|
4193
4213
|
* <Provider checkpoints={checkpoints}>
|
|
4194
4214
|
* <Pane />
|
|
@@ -4210,7 +4230,7 @@ export function useCheckpointIds(
|
|
|
4210
4230
|
* object is provided. A component within it then uses the useCheckpoint
|
|
4211
4231
|
* hook.
|
|
4212
4232
|
*
|
|
4213
|
-
* ```
|
|
4233
|
+
* ```jsx
|
|
4214
4234
|
* const App = ({checkpoints}) => (
|
|
4215
4235
|
* <Provider checkpointsById={{petCheckpoints: checkpoints}}>
|
|
4216
4236
|
* <Pane />
|
|
@@ -4279,7 +4299,7 @@ export function useCheckpoint(
|
|
|
4279
4299
|
* This example uses the useSetCheckpointCallback hook to create an event
|
|
4280
4300
|
* handler which sets a checkpoint when the `span` element is clicked.
|
|
4281
4301
|
*
|
|
4282
|
-
* ```
|
|
4302
|
+
* ```jsx
|
|
4283
4303
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4284
4304
|
* const checkpoints = createCheckpoints(store);
|
|
4285
4305
|
* const App = () => {
|
|
@@ -4336,7 +4356,7 @@ export function useSetCheckpointCallback<Parameter>(
|
|
|
4336
4356
|
* which goes backward in the checkpoint stack when the `span` element is
|
|
4337
4357
|
* clicked.
|
|
4338
4358
|
*
|
|
4339
|
-
* ```
|
|
4359
|
+
* ```jsx
|
|
4340
4360
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4341
4361
|
* const checkpoints = createCheckpoints(store);
|
|
4342
4362
|
* const App = () => (
|
|
@@ -4384,7 +4404,7 @@ export function useGoBackwardCallback(
|
|
|
4384
4404
|
* which goes backward in the checkpoint stack when the `span` element is
|
|
4385
4405
|
* clicked.
|
|
4386
4406
|
*
|
|
4387
|
-
* ```
|
|
4407
|
+
* ```jsx
|
|
4388
4408
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4389
4409
|
* const checkpoints = createCheckpoints(store);
|
|
4390
4410
|
* const App = () => (
|
|
@@ -4461,7 +4481,7 @@ export function useGoForwardCallback(
|
|
|
4461
4481
|
* This example uses the useGoToCallback hook to create an event handler which
|
|
4462
4482
|
* moves to a checkpoint when the `span` element is clicked.
|
|
4463
4483
|
*
|
|
4464
|
-
* ```
|
|
4484
|
+
* ```jsx
|
|
4465
4485
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4466
4486
|
* const checkpoints = createCheckpoints(store);
|
|
4467
4487
|
* const App = () => {
|
|
@@ -4515,7 +4535,7 @@ export function useGoToCallback<Parameter>(
|
|
|
4515
4535
|
* @example
|
|
4516
4536
|
* This example uses the useUndoInformation hook to create an undo button.
|
|
4517
4537
|
*
|
|
4518
|
-
* ```
|
|
4538
|
+
* ```jsx
|
|
4519
4539
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4520
4540
|
* const checkpoints = createCheckpoints(store);
|
|
4521
4541
|
* const App = () => {
|
|
@@ -4561,7 +4581,7 @@ export function useUndoInformation(
|
|
|
4561
4581
|
* @example
|
|
4562
4582
|
* This example uses the useUndoInformation hook to create a redo button.
|
|
4563
4583
|
*
|
|
4564
|
-
* ```
|
|
4584
|
+
* ```jsx
|
|
4565
4585
|
* const store = createStore().setTables({pets: {nemo: {species: 'fish'}}});
|
|
4566
4586
|
* const checkpoints = createCheckpoints(store);
|
|
4567
4587
|
* const App = () => {
|
|
@@ -4618,7 +4638,7 @@ export function useRedoInformation(
|
|
|
4618
4638
|
* is scoped to a single component. When the component is unmounted, the
|
|
4619
4639
|
* listener is removed from the Store.
|
|
4620
4640
|
*
|
|
4621
|
-
* ```
|
|
4641
|
+
* ```jsx
|
|
4622
4642
|
* const App = ({checkpoints}) => (
|
|
4623
4643
|
* <Provider checkpoints={checkpoints}>
|
|
4624
4644
|
* <Pane />
|
|
@@ -4688,7 +4708,7 @@ export function useCheckpointIdsListener(
|
|
|
4688
4708
|
* is scoped to a single component. When the component is unmounted, the
|
|
4689
4709
|
* listener is removed from the Store.
|
|
4690
4710
|
*
|
|
4691
|
-
* ```
|
|
4711
|
+
* ```jsx
|
|
4692
4712
|
* const App = ({checkpoints}) => (
|
|
4693
4713
|
* <Provider checkpoints={checkpoints}>
|
|
4694
4714
|
* <Pane />
|
|
@@ -4751,6 +4771,9 @@ export function useCheckpointListener(
|
|
|
4751
4771
|
* an array in the fifth parameter. The Persister itself is used as a dependency
|
|
4752
4772
|
* by default.
|
|
4753
4773
|
*
|
|
4774
|
+
* This hook ensures the Persister object is destroyed whenever a new one is
|
|
4775
|
+
* created or the component is unmounted.
|
|
4776
|
+
*
|
|
4754
4777
|
* @param store A reference to the Store for which to create a new Persister
|
|
4755
4778
|
* object.
|
|
4756
4779
|
* @param create A function for performing the creation steps of the Persister
|
|
@@ -4769,7 +4792,7 @@ export function useCheckpointListener(
|
|
|
4769
4792
|
* Even though the App component is rendered twice, the Persister creation only
|
|
4770
4793
|
* occurs once by default.
|
|
4771
4794
|
*
|
|
4772
|
-
* ```
|
|
4795
|
+
* ```jsx
|
|
4773
4796
|
* const App = () => {
|
|
4774
4797
|
* const store = useCreateStore(createStore);
|
|
4775
4798
|
* const persister = useCreatePersister(
|
|
@@ -4795,10 +4818,12 @@ export function useCheckpointListener(
|
|
|
4795
4818
|
*
|
|
4796
4819
|
* // ... // !act
|
|
4797
4820
|
* ReactDOM.render(<App />, app); // !act
|
|
4798
|
-
* // No second
|
|
4821
|
+
* // No second Persister creation
|
|
4799
4822
|
*
|
|
4800
4823
|
* console.log(app.innerHTML);
|
|
4801
4824
|
* // -> '<span>{\"pets\":{\"fido\":{\"species\":\"dog\"}}}</span>'
|
|
4825
|
+
*
|
|
4826
|
+
* ReactDOM.unmountComponentAtNode(app); // !act
|
|
4802
4827
|
* ```
|
|
4803
4828
|
* @example
|
|
4804
4829
|
* This example creates a Persister at the top level of a React application. The
|
|
@@ -4806,7 +4831,7 @@ export function useCheckpointListener(
|
|
|
4806
4831
|
* useCreatePersister hook takes the `sessionKey` prop as a dependency, and so
|
|
4807
4832
|
* the Persister object is created again on the second render.
|
|
4808
4833
|
*
|
|
4809
|
-
* ```
|
|
4834
|
+
* ```jsx
|
|
4810
4835
|
* const App = ({sessionKey}) => {
|
|
4811
4836
|
* const store = useCreateStore(createStore);
|
|
4812
4837
|
* const persister = useCreatePersister(
|
|
@@ -4841,6 +4866,8 @@ export function useCheckpointListener(
|
|
|
4841
4866
|
* // ... // !act
|
|
4842
4867
|
* console.log(app.innerHTML);
|
|
4843
4868
|
* // -> '<span>{\"pets\":{\"cujo\":{\"species\":\"dog\"}}}</span>'
|
|
4869
|
+
*
|
|
4870
|
+
* ReactDOM.unmountComponentAtNode(app); // !act
|
|
4844
4871
|
* ```
|
|
4845
4872
|
* @category Persister hooks
|
|
4846
4873
|
*/
|
|
@@ -4853,13 +4880,17 @@ export function useCreatePersister(
|
|
|
4853
4880
|
): Persister;
|
|
4854
4881
|
|
|
4855
4882
|
/**
|
|
4856
|
-
* The ExtraProps type represents a set of arbitrary additional props
|
|
4883
|
+
* The ExtraProps type represents a set of arbitrary additional props.
|
|
4884
|
+
*
|
|
4885
|
+
* @category Props
|
|
4857
4886
|
*/
|
|
4858
4887
|
export type ExtraProps = {[propName: string]: any};
|
|
4859
4888
|
|
|
4860
4889
|
/**
|
|
4861
4890
|
* TablesProps props are used for components that refer to all the Tables in a
|
|
4862
4891
|
* Store, such as the TablesView component.
|
|
4892
|
+
*
|
|
4893
|
+
* @category Props
|
|
4863
4894
|
*/
|
|
4864
4895
|
export type TablesProps = {
|
|
4865
4896
|
/**
|
|
@@ -4891,6 +4922,8 @@ export type TablesProps = {
|
|
|
4891
4922
|
/**
|
|
4892
4923
|
* TableProps props are used for components that refer to a single Table in a
|
|
4893
4924
|
* Store, such as the TableView component.
|
|
4925
|
+
*
|
|
4926
|
+
* @category Props
|
|
4894
4927
|
*/
|
|
4895
4928
|
export type TableProps = {
|
|
4896
4929
|
/**
|
|
@@ -4926,6 +4959,8 @@ export type TableProps = {
|
|
|
4926
4959
|
/**
|
|
4927
4960
|
* RowProps props are used for components that refer to a single Row in a Table,
|
|
4928
4961
|
* such as the RowView component.
|
|
4962
|
+
*
|
|
4963
|
+
* @category Props
|
|
4929
4964
|
*/
|
|
4930
4965
|
export type RowProps = {
|
|
4931
4966
|
/**
|
|
@@ -4965,6 +5000,8 @@ export type RowProps = {
|
|
|
4965
5000
|
/**
|
|
4966
5001
|
* RowProps props are used for components that refer to a single Cell in a Row,
|
|
4967
5002
|
* such as the CellView component.
|
|
5003
|
+
*
|
|
5004
|
+
* @category Props
|
|
4968
5005
|
*/
|
|
4969
5006
|
export type CellProps = {
|
|
4970
5007
|
/**
|
|
@@ -4994,6 +5031,8 @@ export type CellProps = {
|
|
|
4994
5031
|
/**
|
|
4995
5032
|
* MetricProps props are used for components that refer to a single Metric in a
|
|
4996
5033
|
* Metrics object, such as the MetricView component.
|
|
5034
|
+
*
|
|
5035
|
+
* @category Props
|
|
4997
5036
|
*/
|
|
4998
5037
|
export type MetricProps = {
|
|
4999
5038
|
/**
|
|
@@ -5016,6 +5055,8 @@ export type MetricProps = {
|
|
|
5016
5055
|
/**
|
|
5017
5056
|
* IndexProps props are used for components that refer to a single Index in an
|
|
5018
5057
|
* Indexes object, such as the IndexView component.
|
|
5058
|
+
*
|
|
5059
|
+
* @category Props
|
|
5019
5060
|
*/
|
|
5020
5061
|
export type IndexProps = {
|
|
5021
5062
|
/**
|
|
@@ -5051,6 +5092,8 @@ export type IndexProps = {
|
|
|
5051
5092
|
/**
|
|
5052
5093
|
* IndexProps props are used for components that refer to a single Slice in an
|
|
5053
5094
|
* Index object, such as the SliceView component.
|
|
5095
|
+
*
|
|
5096
|
+
* @category Props
|
|
5054
5097
|
*/
|
|
5055
5098
|
export type SliceProps = {
|
|
5056
5099
|
/**
|
|
@@ -5091,6 +5134,8 @@ export type SliceProps = {
|
|
|
5091
5134
|
* RemoteRowProps props are used for components that refer to a single
|
|
5092
5135
|
* Relationship in an Relationships object, and where you want to render a
|
|
5093
5136
|
* remote Row based on a local Row, such as in the RemoteRowView component.
|
|
5137
|
+
*
|
|
5138
|
+
* @category Props
|
|
5094
5139
|
*/
|
|
5095
5140
|
export type RemoteRowProps = {
|
|
5096
5141
|
/**
|
|
@@ -5128,6 +5173,8 @@ export type RemoteRowProps = {
|
|
|
5128
5173
|
* LocalRowsProps props are used for components that refer to a single
|
|
5129
5174
|
* Relationship in an Relationships object, and where you want to render local
|
|
5130
5175
|
* Rows based on a remote Row, such as the LocalRowsView component.
|
|
5176
|
+
*
|
|
5177
|
+
* @category Props
|
|
5131
5178
|
*/
|
|
5132
5179
|
export type LocalRowsProps = {
|
|
5133
5180
|
/**
|
|
@@ -5170,6 +5217,8 @@ export type LocalRowsProps = {
|
|
|
5170
5217
|
* Relationship in an Relationships object, and where you want to render a
|
|
5171
5218
|
* linked list of Rows starting from a first Row, such as the LinkedRowsView
|
|
5172
5219
|
* component.
|
|
5220
|
+
*
|
|
5221
|
+
* @category Props
|
|
5173
5222
|
*/
|
|
5174
5223
|
export type LinkedRowsProps = {
|
|
5175
5224
|
/**
|
|
@@ -5210,6 +5259,8 @@ export type LinkedRowsProps = {
|
|
|
5210
5259
|
/**
|
|
5211
5260
|
* CheckpointProps props are used for components that refer to a single
|
|
5212
5261
|
* checkpoint in an Checkpoints object, such as the CheckpointView component.
|
|
5262
|
+
*
|
|
5263
|
+
* @category Props
|
|
5213
5264
|
*/
|
|
5214
5265
|
export type CheckpointProps = {
|
|
5215
5266
|
/**
|
|
@@ -5233,6 +5284,8 @@ export type CheckpointProps = {
|
|
|
5233
5284
|
* BackwardCheckpointsProps props are used for components that refer to a list
|
|
5234
5285
|
* of previous checkpoints in a Checkpoints object, such as the
|
|
5235
5286
|
* BackwardCheckpointsView component.
|
|
5287
|
+
*
|
|
5288
|
+
* @category Props
|
|
5236
5289
|
*/
|
|
5237
5290
|
export type BackwardCheckpointsProps = {
|
|
5238
5291
|
/**
|
|
@@ -5265,6 +5318,8 @@ export type BackwardCheckpointsProps = {
|
|
|
5265
5318
|
* CurrentCheckpointsProps props are used for components that refer to the
|
|
5266
5319
|
* current checkpoints in a Checkpoints object, such as the
|
|
5267
5320
|
* BackwardCheckpointsView component.
|
|
5321
|
+
*
|
|
5322
|
+
* @category Props
|
|
5268
5323
|
*/
|
|
5269
5324
|
export type CurrentCheckpointProps = {
|
|
5270
5325
|
/**
|
|
@@ -5293,6 +5348,8 @@ export type CurrentCheckpointProps = {
|
|
|
5293
5348
|
* ForwardCheckpointsProps props are used for components that refer to a list of
|
|
5294
5349
|
* future checkpoints in a Checkpoints object, such as the
|
|
5295
5350
|
* ForwardCheckpointsView component.
|
|
5351
|
+
*
|
|
5352
|
+
* @category Props
|
|
5296
5353
|
*/
|
|
5297
5354
|
export type ForwardCheckpointsProps = {
|
|
5298
5355
|
/**
|
|
@@ -5324,10 +5381,13 @@ export type ForwardCheckpointsProps = {
|
|
|
5324
5381
|
/**
|
|
5325
5382
|
* ProviderProps props are used with the Provider component, so that Store
|
|
5326
5383
|
* 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
|
-
*
|
|
5384
|
+
* the context of an application and used throughout.
|
|
5385
|
+
*
|
|
5386
|
+
* One of each type of object can be provided as a default within the context.
|
|
5387
|
+
* Additionally, multiple of each type of object can be provided in an Id-keyed
|
|
5388
|
+
* map to the `___ById` props.
|
|
5389
|
+
*
|
|
5390
|
+
* @category Props
|
|
5331
5391
|
*/
|
|
5332
5392
|
export type ProviderProps = {
|
|
5333
5393
|
/**
|
|
@@ -5385,6 +5445,8 @@ export type ProviderProps = {
|
|
|
5385
5445
|
/**
|
|
5386
5446
|
* ComponentReturnType is a simple alias for what a React component can return:
|
|
5387
5447
|
* either a ReactElement, or `null` for an empty component.
|
|
5448
|
+
*
|
|
5449
|
+
* @category Component
|
|
5388
5450
|
*/
|
|
5389
5451
|
export type ComponentReturnType = ReactElement<any, any> | null;
|
|
5390
5452
|
|
|
@@ -5398,9 +5460,12 @@ export type ComponentReturnType = ReactElement<any, any> | null;
|
|
|
5398
5460
|
* multiple of each type of object can be provided in an Id-keyed map to the
|
|
5399
5461
|
* `___ById` props.
|
|
5400
5462
|
*
|
|
5401
|
-
* Provider contexts can be nested
|
|
5402
|
-
* if an outer context contains a
|
|
5403
|
-
*
|
|
5463
|
+
* Provider contexts can be nested and the objects passed in will be merged. For
|
|
5464
|
+
* example, if an outer context contains a default Metrics object and an inner
|
|
5465
|
+
* context contains only a default Store, both the Metrics objects and the Store
|
|
5466
|
+
* will be visible within the inner context. If the outer context contains a
|
|
5467
|
+
* Store named by Id and the inner context contains a Store named by a different
|
|
5468
|
+
* Id, both will be visible within the inner context.
|
|
5404
5469
|
*
|
|
5405
5470
|
* @param props The props for this component.
|
|
5406
5471
|
* @returns A rendering of the child components.
|
|
@@ -5410,7 +5475,7 @@ export type ComponentReturnType = ReactElement<any, any> | null;
|
|
|
5410
5475
|
* it then render content from both, without the need to have them passed as
|
|
5411
5476
|
* props.
|
|
5412
5477
|
*
|
|
5413
|
-
* ```
|
|
5478
|
+
* ```jsx
|
|
5414
5479
|
* const App = ({store, metrics}) => (
|
|
5415
5480
|
* <Provider store={store} metricsById={{petStore: metrics}}>
|
|
5416
5481
|
* <Pane />
|
|
@@ -5434,6 +5499,49 @@ export type ComponentReturnType = ReactElement<any, any> | null;
|
|
|
5434
5499
|
* console.log(app.innerHTML);
|
|
5435
5500
|
* // -> '<span>5,4,5</span>'
|
|
5436
5501
|
* ```
|
|
5502
|
+
* @example
|
|
5503
|
+
* This example creates nested Provider contexts into which Store and Metrics
|
|
5504
|
+
* objects are provided, showing how visibility is merged.
|
|
5505
|
+
*
|
|
5506
|
+
* ```jsx
|
|
5507
|
+
* const App = ({petStore, metrics}) => (
|
|
5508
|
+
* <Provider storesById={{pet: petStore}} metrics={metrics}>
|
|
5509
|
+
* <OuterPane />
|
|
5510
|
+
* </Provider>
|
|
5511
|
+
* );
|
|
5512
|
+
* const OuterPane = () => {
|
|
5513
|
+
* const planetStore = useCreateStore(() =>
|
|
5514
|
+
* createStore().setTables({planets: {mars: {moons: 2}}}),
|
|
5515
|
+
* );
|
|
5516
|
+
* return (
|
|
5517
|
+
* <Provider storesById={{planet: planetStore}}>
|
|
5518
|
+
* <InnerPane />
|
|
5519
|
+
* </Provider>
|
|
5520
|
+
* );
|
|
5521
|
+
* };
|
|
5522
|
+
* const InnerPane = () => (
|
|
5523
|
+
* <span>
|
|
5524
|
+
* <CellView tableId="species" rowId="dog" cellId="price" store="pet" />,
|
|
5525
|
+
* {useMetric('highestPrice')},
|
|
5526
|
+
* <CellView
|
|
5527
|
+
* tableId="planets"
|
|
5528
|
+
* rowId="mars"
|
|
5529
|
+
* cellId="moons"
|
|
5530
|
+
* store="planet"
|
|
5531
|
+
* />
|
|
5532
|
+
* </span>
|
|
5533
|
+
* );
|
|
5534
|
+
*
|
|
5535
|
+
* const petStore = createStore();
|
|
5536
|
+
* petStore.setTable('species', {dog: {price: 5}, cat: {price: 4}});
|
|
5537
|
+
* const metrics = createMetrics(petStore);
|
|
5538
|
+
* metrics.setMetricDefinition('highestPrice', 'species', 'max', 'price');
|
|
5539
|
+
*
|
|
5540
|
+
* const app = document.createElement('div');
|
|
5541
|
+
* ReactDOM.render(<App petStore={petStore} metrics={metrics} />, app); // !act
|
|
5542
|
+
* console.log(app.innerHTML);
|
|
5543
|
+
* // -> '<span>5,5,2</span>'
|
|
5544
|
+
* ```
|
|
5437
5545
|
* @category Context components
|
|
5438
5546
|
*/
|
|
5439
5547
|
export function Provider(
|
|
@@ -5464,7 +5572,7 @@ export function Provider(
|
|
|
5464
5572
|
* CellView component by reference. A change to the data in the Store re-renders
|
|
5465
5573
|
* the component.
|
|
5466
5574
|
*
|
|
5467
|
-
* ```
|
|
5575
|
+
* ```jsx
|
|
5468
5576
|
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
5469
5577
|
* const App = () => (
|
|
5470
5578
|
* <span>
|
|
@@ -5486,7 +5594,7 @@ export function Provider(
|
|
|
5486
5594
|
* provided. The CellView component within it then renders the Cell (with its Id
|
|
5487
5595
|
* for readability).
|
|
5488
5596
|
*
|
|
5489
|
-
* ```
|
|
5597
|
+
* ```jsx
|
|
5490
5598
|
* const App = ({store}) => (
|
|
5491
5599
|
* <Provider store={store}>
|
|
5492
5600
|
* <Pane />
|
|
@@ -5509,7 +5617,7 @@ export function Provider(
|
|
|
5509
5617
|
* provided. The CellView component within it then attempts to render a
|
|
5510
5618
|
* non-existent Cell.
|
|
5511
5619
|
*
|
|
5512
|
-
* ```
|
|
5620
|
+
* ```jsx
|
|
5513
5621
|
* const App = ({store}) => (
|
|
5514
5622
|
* <Provider store={store}>
|
|
5515
5623
|
* <Pane />
|
|
@@ -5560,7 +5668,7 @@ export function CellView(props: CellProps): ComponentReturnType;
|
|
|
5560
5668
|
* RowView component by reference. A change to the data in the Store re-renders
|
|
5561
5669
|
* the component.
|
|
5562
5670
|
*
|
|
5563
|
-
* ```
|
|
5671
|
+
* ```jsx
|
|
5564
5672
|
* const store = createStore().setRow('pets', 'fido', {species: 'dog'});
|
|
5565
5673
|
* const App = () => (
|
|
5566
5674
|
* <div>
|
|
@@ -5582,7 +5690,7 @@ export function CellView(props: CellProps): ComponentReturnType;
|
|
|
5582
5690
|
* provided. The RowView component within it then renders the Row (with Ids for
|
|
5583
5691
|
* readability).
|
|
5584
5692
|
*
|
|
5585
|
-
* ```
|
|
5693
|
+
* ```jsx
|
|
5586
5694
|
* const App = ({store}) => (
|
|
5587
5695
|
* <Provider store={store}>
|
|
5588
5696
|
* <Pane />
|
|
@@ -5608,7 +5716,7 @@ export function CellView(props: CellProps): ComponentReturnType;
|
|
|
5608
5716
|
* provided. The RowView component within it then renders the Row with a custom
|
|
5609
5717
|
* Cell component and a custom props callback.
|
|
5610
5718
|
*
|
|
5611
|
-
* ```
|
|
5719
|
+
* ```jsx
|
|
5612
5720
|
* const App = ({store}) => (
|
|
5613
5721
|
* <Provider store={store}>
|
|
5614
5722
|
* <Pane />
|
|
@@ -5673,7 +5781,7 @@ export function RowView(props: RowProps): ComponentReturnType;
|
|
|
5673
5781
|
* TableView component by reference. A change to the data in the Store
|
|
5674
5782
|
* re-renders the component.
|
|
5675
5783
|
*
|
|
5676
|
-
* ```
|
|
5784
|
+
* ```jsx
|
|
5677
5785
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
5678
5786
|
* const App = () => (
|
|
5679
5787
|
* <div>
|
|
@@ -5695,7 +5803,7 @@ export function RowView(props: RowProps): ComponentReturnType;
|
|
|
5695
5803
|
* provided. The TableView component within it then renders the Table (with Ids
|
|
5696
5804
|
* for readability).
|
|
5697
5805
|
*
|
|
5698
|
-
* ```
|
|
5806
|
+
* ```jsx
|
|
5699
5807
|
* const App = ({store}) => (
|
|
5700
5808
|
* <Provider store={store}>
|
|
5701
5809
|
* <Pane />
|
|
@@ -5721,7 +5829,7 @@ export function RowView(props: RowProps): ComponentReturnType;
|
|
|
5721
5829
|
* provided. The TableView component within it then renders the Table with a
|
|
5722
5830
|
* custom Row component and a custom props callback.
|
|
5723
5831
|
*
|
|
5724
|
-
* ```
|
|
5832
|
+
* ```jsx
|
|
5725
5833
|
* const App = ({store}) => (
|
|
5726
5834
|
* <Provider store={store}>
|
|
5727
5835
|
* <Pane />
|
|
@@ -5781,7 +5889,7 @@ export function TableView(props: TableProps): ComponentReturnType;
|
|
|
5781
5889
|
* TablesView component by reference. A change to the data in the Store
|
|
5782
5890
|
* re-renders the component.
|
|
5783
5891
|
*
|
|
5784
|
-
* ```
|
|
5892
|
+
* ```jsx
|
|
5785
5893
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
5786
5894
|
* const App = () => (
|
|
5787
5895
|
* <div>
|
|
@@ -5803,7 +5911,7 @@ export function TableView(props: TableProps): ComponentReturnType;
|
|
|
5803
5911
|
* provided. The TablesView component within it then renders the Store (with Ids
|
|
5804
5912
|
* for readability).
|
|
5805
5913
|
*
|
|
5806
|
-
* ```
|
|
5914
|
+
* ```jsx
|
|
5807
5915
|
* const App = ({store}) => (
|
|
5808
5916
|
* <Provider store={store}>
|
|
5809
5917
|
* <Pane />
|
|
@@ -5829,7 +5937,7 @@ export function TableView(props: TableProps): ComponentReturnType;
|
|
|
5829
5937
|
* provided. The TablesView component within it then renders the Store with a
|
|
5830
5938
|
* custom Table component and a custom props callback.
|
|
5831
5939
|
*
|
|
5832
|
-
* ```
|
|
5940
|
+
* ```jsx
|
|
5833
5941
|
* const App = ({store}) => (
|
|
5834
5942
|
* <Provider store={store}>
|
|
5835
5943
|
* <Pane />
|
|
@@ -5882,7 +5990,7 @@ export function TablesView(props: TablesProps): ComponentReturnType;
|
|
|
5882
5990
|
* in the MetricView component hook by reference. A change to the Metric
|
|
5883
5991
|
* re-renders the component.
|
|
5884
5992
|
*
|
|
5885
|
-
* ```
|
|
5993
|
+
* ```jsx
|
|
5886
5994
|
* const store = createStore().setTable('species', {
|
|
5887
5995
|
* dog: {price: 5},
|
|
5888
5996
|
* cat: {price: 4},
|
|
@@ -5910,7 +6018,7 @@ export function TablesView(props: TablesProps): ComponentReturnType;
|
|
|
5910
6018
|
* is provided. The MetricView component within it then renders the Metric (with
|
|
5911
6019
|
* its Id for readability).
|
|
5912
6020
|
*
|
|
5913
|
-
* ```
|
|
6021
|
+
* ```jsx
|
|
5914
6022
|
* const App = ({metrics}) => (
|
|
5915
6023
|
* <Provider metrics={metrics}>
|
|
5916
6024
|
* <Pane />
|
|
@@ -5940,7 +6048,7 @@ export function TablesView(props: TablesProps): ComponentReturnType;
|
|
|
5940
6048
|
* is provided. The MetricView component within it then attempts to render a
|
|
5941
6049
|
* non-existent Metric.
|
|
5942
6050
|
*
|
|
5943
|
-
* ```
|
|
6051
|
+
* ```jsx
|
|
5944
6052
|
* const App = ({metrics}) => (
|
|
5945
6053
|
* <Provider metrics={metrics}>
|
|
5946
6054
|
* <Pane />
|
|
@@ -5993,7 +6101,7 @@ export function MetricView(props: MetricProps): ComponentReturnType;
|
|
|
5993
6101
|
* in the SliceView component by reference. A change to the Row Ids re-renders
|
|
5994
6102
|
* the component.
|
|
5995
6103
|
*
|
|
5996
|
-
* ```
|
|
6104
|
+
* ```jsx
|
|
5997
6105
|
* const store = createStore().setTable('pets', {
|
|
5998
6106
|
* fido: {species: 'dog'},
|
|
5999
6107
|
* felix: {species: 'cat'},
|
|
@@ -6025,7 +6133,7 @@ export function MetricView(props: MetricProps): ComponentReturnType;
|
|
|
6025
6133
|
* is provided. The SliceView component within it then renders the Slice (with
|
|
6026
6134
|
* Ids for readability).
|
|
6027
6135
|
*
|
|
6028
|
-
* ```
|
|
6136
|
+
* ```jsx
|
|
6029
6137
|
* const App = ({indexes}) => (
|
|
6030
6138
|
* <Provider indexes={indexes}>
|
|
6031
6139
|
* <Pane />
|
|
@@ -6054,7 +6162,7 @@ export function MetricView(props: MetricProps): ComponentReturnType;
|
|
|
6054
6162
|
* is provided. The SliceView component within it then renders the Slice with a
|
|
6055
6163
|
* custom Row component and a custom props callback.
|
|
6056
6164
|
*
|
|
6057
|
-
* ```
|
|
6165
|
+
* ```jsx
|
|
6058
6166
|
* const App = ({indexes}) => (
|
|
6059
6167
|
* <Provider indexes={indexes}>
|
|
6060
6168
|
* <Pane />
|
|
@@ -6120,7 +6228,7 @@ export function SliceView(props: SliceProps): ComponentReturnType;
|
|
|
6120
6228
|
* in the IndexView component by reference. A change to the Slice Ids re-renders
|
|
6121
6229
|
* the component.
|
|
6122
6230
|
*
|
|
6123
|
-
* ```
|
|
6231
|
+
* ```jsx
|
|
6124
6232
|
* const store = createStore().setTable('pets', {
|
|
6125
6233
|
* fido: {species: 'dog'},
|
|
6126
6234
|
* felix: {species: 'cat'},
|
|
@@ -6147,7 +6255,7 @@ export function SliceView(props: SliceProps): ComponentReturnType;
|
|
|
6147
6255
|
* is provided. The IndexView component within it then renders the Index (with
|
|
6148
6256
|
* Ids for readability).
|
|
6149
6257
|
*
|
|
6150
|
-
* ```
|
|
6258
|
+
* ```jsx
|
|
6151
6259
|
* const App = ({indexes}) => (
|
|
6152
6260
|
* <Provider indexes={indexes}>
|
|
6153
6261
|
* <Pane />
|
|
@@ -6176,7 +6284,7 @@ export function SliceView(props: SliceProps): ComponentReturnType;
|
|
|
6176
6284
|
* is provided. The IndexView component within it then renders the Index with a
|
|
6177
6285
|
* custom Slice component and a custom props callback.
|
|
6178
6286
|
*
|
|
6179
|
-
* ```
|
|
6287
|
+
* ```jsx
|
|
6180
6288
|
* const App = ({indexes}) => (
|
|
6181
6289
|
* <Provider indexes={indexes}>
|
|
6182
6290
|
* <Pane />
|
|
@@ -6243,7 +6351,7 @@ export function IndexView(props: IndexProps): ComponentReturnType;
|
|
|
6243
6351
|
* is used in the RemoteRowView component by reference. A change to the Row Ids
|
|
6244
6352
|
* re-renders the component.
|
|
6245
6353
|
*
|
|
6246
|
-
* ```
|
|
6354
|
+
* ```jsx
|
|
6247
6355
|
* const store = createStore()
|
|
6248
6356
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
6249
6357
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -6277,7 +6385,7 @@ export function IndexView(props: IndexProps): ComponentReturnType;
|
|
|
6277
6385
|
* object is provided. The RemoteRowView component within it then renders the
|
|
6278
6386
|
* remote Row (with Ids for readability).
|
|
6279
6387
|
*
|
|
6280
|
-
* ```
|
|
6388
|
+
* ```jsx
|
|
6281
6389
|
* const App = ({relationships}) => (
|
|
6282
6390
|
* <Provider relationships={relationships}>
|
|
6283
6391
|
* <Pane />
|
|
@@ -6309,7 +6417,7 @@ export function IndexView(props: IndexProps): ComponentReturnType;
|
|
|
6309
6417
|
* object is provided. The RemoteRowView component within it then renders the
|
|
6310
6418
|
* remote Row with a custom Row component and a custom props callback.
|
|
6311
6419
|
*
|
|
6312
|
-
* ```
|
|
6420
|
+
* ```jsx
|
|
6313
6421
|
* const App = ({relationships}) => (
|
|
6314
6422
|
* <Provider relationships={relationships}>
|
|
6315
6423
|
* <Pane />
|
|
@@ -6375,7 +6483,7 @@ export function RemoteRowView(props: RemoteRowProps): ComponentReturnType;
|
|
|
6375
6483
|
* is used in the LocalRowsView component by reference. A change to the Row Ids
|
|
6376
6484
|
* re-renders the component.
|
|
6377
6485
|
*
|
|
6378
|
-
* ```
|
|
6486
|
+
* ```jsx
|
|
6379
6487
|
* const store = createStore()
|
|
6380
6488
|
* .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
|
|
6381
6489
|
* .setTable('species', {wolf: {price: 10}, dog: {price: 5}});
|
|
@@ -6410,7 +6518,7 @@ export function RemoteRowView(props: RemoteRowProps): ComponentReturnType;
|
|
|
6410
6518
|
* object is provided. The LocalRowsView component within it then renders the
|
|
6411
6519
|
* local Row objects (with Ids for readability).
|
|
6412
6520
|
*
|
|
6413
|
-
* ```
|
|
6521
|
+
* ```jsx
|
|
6414
6522
|
* const App = ({relationships}) => (
|
|
6415
6523
|
* <Provider relationships={relationships}>
|
|
6416
6524
|
* <Pane />
|
|
@@ -6442,7 +6550,7 @@ export function RemoteRowView(props: RemoteRowProps): ComponentReturnType;
|
|
|
6442
6550
|
* object is provided. The LocalRowsView component within it then renders the
|
|
6443
6551
|
* local Row objects with a custom Row component and a custom props callback.
|
|
6444
6552
|
*
|
|
6445
|
-
* ```
|
|
6553
|
+
* ```jsx
|
|
6446
6554
|
* const App = ({relationships}) => (
|
|
6447
6555
|
* <Provider relationships={relationships}>
|
|
6448
6556
|
* <Pane />
|
|
@@ -6508,7 +6616,7 @@ export function LocalRowsView(props: LocalRowsProps): ComponentReturnType;
|
|
|
6508
6616
|
* is used in the LinkedRowsView component by reference. A change to the Row Ids
|
|
6509
6617
|
* re-renders the component.
|
|
6510
6618
|
*
|
|
6511
|
-
* ```
|
|
6619
|
+
* ```jsx
|
|
6512
6620
|
* const store = createStore().setTable('pets', {
|
|
6513
6621
|
* fido: {next: 'felix'},
|
|
6514
6622
|
* felix: {next: 'cujo'},
|
|
@@ -6546,7 +6654,7 @@ export function LocalRowsView(props: LocalRowsProps): ComponentReturnType;
|
|
|
6546
6654
|
* object is provided. The LinkedRowsView component within it then renders the
|
|
6547
6655
|
* local Row objects (with Ids for readability).
|
|
6548
6656
|
*
|
|
6549
|
-
* ```
|
|
6657
|
+
* ```jsx
|
|
6550
6658
|
* const App = ({relationships}) => (
|
|
6551
6659
|
* <Provider relationships={relationships}>
|
|
6552
6660
|
* <Pane />
|
|
@@ -6579,7 +6687,7 @@ export function LocalRowsView(props: LocalRowsProps): ComponentReturnType;
|
|
|
6579
6687
|
* object is provided. The LinkedRowsView component within it then renders the
|
|
6580
6688
|
* local Row objects with a custom Row component and a custom props callback.
|
|
6581
6689
|
*
|
|
6582
|
-
* ```
|
|
6690
|
+
* ```jsx
|
|
6583
6691
|
* const App = ({relationships}) => (
|
|
6584
6692
|
* <Provider relationships={relationships}>
|
|
6585
6693
|
* <Pane />
|
|
@@ -6639,7 +6747,7 @@ export function LinkedRowsView(props: LinkedRowsProps): ComponentReturnType;
|
|
|
6639
6747
|
* used in the CheckpointView component by reference to render a checkpoint with
|
|
6640
6748
|
* a label (with its Id for readability).
|
|
6641
6749
|
*
|
|
6642
|
-
* ```
|
|
6750
|
+
* ```jsx
|
|
6643
6751
|
* const store = createStore().setTable('pets', {fido: {species: 'dog'}});
|
|
6644
6752
|
* const checkpoints = createCheckpoints(store);
|
|
6645
6753
|
* const App = () => (
|
|
@@ -6696,7 +6804,7 @@ export function CheckpointView(props: CheckpointProps): ComponentReturnType;
|
|
|
6696
6804
|
* used in the BackwardCheckpointsView component by reference to render a list
|
|
6697
6805
|
* of previous checkpoints.
|
|
6698
6806
|
*
|
|
6699
|
-
* ```
|
|
6807
|
+
* ```jsx
|
|
6700
6808
|
* const store = createStore().setTable('pets', {fido: {color: 'brown'}});
|
|
6701
6809
|
* const checkpoints = createCheckpoints(store);
|
|
6702
6810
|
* const App = () => (
|
|
@@ -6726,7 +6834,7 @@ export function CheckpointView(props: CheckpointProps): ComponentReturnType;
|
|
|
6726
6834
|
* object is provided. The BackwardCheckpointsView component within it then
|
|
6727
6835
|
* renders the list of previous checkpoints (with Ids for readability).
|
|
6728
6836
|
*
|
|
6729
|
-
* ```
|
|
6837
|
+
* ```jsx
|
|
6730
6838
|
* const App = ({checkpoints}) => (
|
|
6731
6839
|
* <Provider checkpoints={checkpoints}>
|
|
6732
6840
|
* <Pane />
|
|
@@ -6758,7 +6866,7 @@ export function CheckpointView(props: CheckpointProps): ComponentReturnType;
|
|
|
6758
6866
|
* renders the list of previous checkpoints with a custom Row component and a
|
|
6759
6867
|
* custom props callback.
|
|
6760
6868
|
*
|
|
6761
|
-
* ```
|
|
6869
|
+
* ```jsx
|
|
6762
6870
|
* const App = ({checkpoints}) => (
|
|
6763
6871
|
* <Provider checkpoints={checkpoints}>
|
|
6764
6872
|
* <Pane />
|
|
@@ -6830,7 +6938,7 @@ export function BackwardCheckpointsView(
|
|
|
6830
6938
|
* used in the CurrentCheckpointView component by reference to render the
|
|
6831
6939
|
* current checkpoints.
|
|
6832
6940
|
*
|
|
6833
|
-
* ```
|
|
6941
|
+
* ```jsx
|
|
6834
6942
|
* const store = createStore().setTable('pets', {fido: {color: 'brown'}});
|
|
6835
6943
|
* const checkpoints = createCheckpoints(store);
|
|
6836
6944
|
* const App = () => (
|
|
@@ -6862,7 +6970,7 @@ export function BackwardCheckpointsView(
|
|
|
6862
6970
|
* object is provided. The CurrentCheckpointView component within it then
|
|
6863
6971
|
* renders current checkpoint (with its Id for readability).
|
|
6864
6972
|
*
|
|
6865
|
-
* ```
|
|
6973
|
+
* ```jsx
|
|
6866
6974
|
* const App = ({checkpoints}) => (
|
|
6867
6975
|
* <Provider checkpoints={checkpoints}>
|
|
6868
6976
|
* <Pane />
|
|
@@ -6891,7 +6999,7 @@ export function BackwardCheckpointsView(
|
|
|
6891
6999
|
* renders the list of future checkpoints with a custom Row component and a
|
|
6892
7000
|
* custom props callback.
|
|
6893
7001
|
*
|
|
6894
|
-
* ```
|
|
7002
|
+
* ```jsx
|
|
6895
7003
|
* const App = ({checkpoints}) => (
|
|
6896
7004
|
* <Provider checkpoints={checkpoints}>
|
|
6897
7005
|
* <Pane />
|
|
@@ -6966,7 +7074,7 @@ export function CurrentCheckpointView(
|
|
|
6966
7074
|
* used in the ForwardCheckpointsView component by reference to render a list
|
|
6967
7075
|
* of future checkpoints.
|
|
6968
7076
|
*
|
|
6969
|
-
* ```
|
|
7077
|
+
* ```jsx
|
|
6970
7078
|
* const store = createStore().setTable('pets', {fido: {color: 'brown'}});
|
|
6971
7079
|
* const checkpoints = createCheckpoints(store);
|
|
6972
7080
|
* const App = () => (
|
|
@@ -6997,7 +7105,7 @@ export function CurrentCheckpointView(
|
|
|
6997
7105
|
* object is provided. The ForwardCheckpointsView component within it then
|
|
6998
7106
|
* renders the list of future checkpoints (with Ids for readability).
|
|
6999
7107
|
*
|
|
7000
|
-
* ```
|
|
7108
|
+
* ```jsx
|
|
7001
7109
|
* const App = ({checkpoints}) => (
|
|
7002
7110
|
* <Provider checkpoints={checkpoints}>
|
|
7003
7111
|
* <Pane />
|
|
@@ -7029,7 +7137,7 @@ export function CurrentCheckpointView(
|
|
|
7029
7137
|
* renders the list of future checkpoints with a custom Row component and a
|
|
7030
7138
|
* custom props callback.
|
|
7031
7139
|
*
|
|
7032
|
-
* ```
|
|
7140
|
+
* ```jsx
|
|
7033
7141
|
* const App = ({checkpoints}) => (
|
|
7034
7142
|
* <Provider checkpoints={checkpoints}>
|
|
7035
7143
|
* <Pane />
|