tinybase 2.0.0-beta.2 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/checkpoints.js +1 -1
- package/lib/checkpoints.js.gz +0 -0
- package/lib/debug/checkpoints.js +1 -4
- package/lib/debug/indexes.js +1 -3
- package/lib/debug/metrics.js +1 -4
- package/lib/debug/queries.d.ts +61 -296
- package/lib/debug/queries.js +59 -201
- package/lib/debug/relationships.js +1 -4
- package/lib/debug/store.d.ts +112 -90
- package/lib/debug/store.js +90 -149
- package/lib/debug/tinybase.js +130 -333
- package/lib/debug/ui-react.d.ts +81 -81
- package/lib/debug/ui-react.js +138 -173
- package/lib/indexes.js +1 -1
- package/lib/indexes.js.gz +0 -0
- package/lib/metrics.js +1 -1
- package/lib/metrics.js.gz +0 -0
- package/lib/queries.d.ts +61 -296
- package/lib/queries.js +1 -1
- package/lib/queries.js.gz +0 -0
- package/lib/relationships.js +1 -1
- package/lib/relationships.js.gz +0 -0
- package/lib/store.d.ts +112 -90
- package/lib/store.js +1 -1
- package/lib/store.js.gz +0 -0
- package/lib/tinybase.js +1 -1
- package/lib/tinybase.js.gz +0 -0
- package/lib/ui-react.d.ts +81 -81
- package/lib/ui-react.js +1 -1
- 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/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/queries.js +1 -1
- package/lib/umd/queries.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 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/package.json +9 -9
- package/readme.md +2 -2
package/lib/debug/store.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export type Cell = string | number | boolean;
|
|
|
94
94
|
*
|
|
95
95
|
* This is used when describing a Cell that is present _or_ that is not present
|
|
96
96
|
* - such as when it has been deleted, or when describing a previous state where
|
|
97
|
-
*
|
|
97
|
+
* the Cell value has since been added.
|
|
98
98
|
*
|
|
99
99
|
* @category Store
|
|
100
100
|
*/
|
|
@@ -293,14 +293,17 @@ export type RowIdsListener = (store: Store, tableId: Id) => void;
|
|
|
293
293
|
*
|
|
294
294
|
* When called, a SortedRowIdsListener is given a reference to the Store, the Id
|
|
295
295
|
* of the Table whose Row Ids sorting changed, the Cell Id being used to sort
|
|
296
|
-
* them,
|
|
297
|
-
*
|
|
298
|
-
*
|
|
296
|
+
* them, whether descending or not, and the offset and limit of the number of
|
|
297
|
+
* Ids returned, for pagination purposes. It also receives the sorted array of
|
|
298
|
+
* Ids itself, so that you can use them in the listener without the additional
|
|
299
|
+
* cost of an explicit call to getSortedRowIds.
|
|
299
300
|
*
|
|
300
301
|
* @param store A reference to the Store that changed.
|
|
301
302
|
* @param tableId The Id of the Table whose sorted Row Ids changed.
|
|
302
303
|
* @param cellId The Id of the Cell whose values were used for the sorting.
|
|
303
304
|
* @param descending Whether the sorting was in descending order.
|
|
305
|
+
* @param offset The number of Row Ids skipped.
|
|
306
|
+
* @param limit The maximum number of Row Ids returned.
|
|
304
307
|
* @param sortedRowIds The sorted Row Ids themselves.
|
|
305
308
|
* @category Listener
|
|
306
309
|
* @since v2.0.0
|
|
@@ -310,6 +313,8 @@ export type SortedRowIdsListener = (
|
|
|
310
313
|
tableId: Id,
|
|
311
314
|
cellId: Id | undefined,
|
|
312
315
|
descending: boolean,
|
|
316
|
+
offset: number,
|
|
317
|
+
limit: number | undefined,
|
|
313
318
|
sortedRowIds: Ids,
|
|
314
319
|
) => void;
|
|
315
320
|
|
|
@@ -827,9 +832,7 @@ export interface Store {
|
|
|
827
832
|
* The getTableIds method returns the Ids of every Table in the Store.
|
|
828
833
|
*
|
|
829
834
|
* Note that this returns a copy of, rather than a reference, to the list of
|
|
830
|
-
* Ids, so changes made to the list are not made to the Store itself.
|
|
831
|
-
* v2.0.0, the order is significant: this method will return the Ids in the
|
|
832
|
-
* order in which each Table was added.
|
|
835
|
+
* Ids, so changes made to the list are not made to the Store itself.
|
|
833
836
|
*
|
|
834
837
|
* @returns An array of the Ids of every Table in the Store.
|
|
835
838
|
* @example
|
|
@@ -894,9 +897,7 @@ export interface Store {
|
|
|
894
897
|
* The getRowIds method returns the Ids of every Row in a given Table.
|
|
895
898
|
*
|
|
896
899
|
* Note that this returns a copy of, rather than a reference, to the list of
|
|
897
|
-
* Ids, so changes made to the list are not made to the Store itself.
|
|
898
|
-
* v2.0.0, the order is significant: this method will return the Ids in the
|
|
899
|
-
* order in which each Row was added.
|
|
900
|
+
* Ids, so changes made to the list are not made to the Store itself.
|
|
900
901
|
*
|
|
901
902
|
* @param tableId The Id of the Table in the Store.
|
|
902
903
|
* @returns An array of the Ids of every Row in the Table.
|
|
@@ -931,7 +932,9 @@ export interface Store {
|
|
|
931
932
|
* sorted according to the values in a specified Cell.
|
|
932
933
|
*
|
|
933
934
|
* The sorting of the rows is alphanumeric, and you can indicate whether it
|
|
934
|
-
* should be in descending order.
|
|
935
|
+
* should be in descending order. The `offset` and `limit` parameters are used
|
|
936
|
+
* to paginate results, but default to `0` and `undefined` to return all
|
|
937
|
+
* available Row Ids if not specified.
|
|
935
938
|
*
|
|
936
939
|
* Note that every call to this method will perform the sorting afresh - there
|
|
937
940
|
* is no caching of the results - and so you are advised to memoize the
|
|
@@ -945,6 +948,10 @@ export interface Store {
|
|
|
945
948
|
* @param cellId The Id of the Cell whose values are used for the sorting, or
|
|
946
949
|
* `undefined` to by sort the Row Id itself.
|
|
947
950
|
* @param descending Whether the sorting should be in descending order.
|
|
951
|
+
* @param offset The number of Row Ids to skip for pagination purposes, if
|
|
952
|
+
* any.
|
|
953
|
+
* @param limit The maximum number of Row Ids to return, or `undefined` for
|
|
954
|
+
* all.
|
|
948
955
|
* @returns An array of the sorted Ids of every Row in the Table.
|
|
949
956
|
* @example
|
|
950
957
|
* This example retrieves sorted Row Ids in a Table.
|
|
@@ -974,6 +981,25 @@ export interface Store {
|
|
|
974
981
|
* // -> ['cujo', 'fido', 'felix']
|
|
975
982
|
* ```
|
|
976
983
|
* @example
|
|
984
|
+
* This example retrieves two pages of Row Ids in a Table.
|
|
985
|
+
*
|
|
986
|
+
* ```js
|
|
987
|
+
* const store = createStore().setTables({
|
|
988
|
+
* pets: {
|
|
989
|
+
* fido: {price: 6},
|
|
990
|
+
* felix: {price: 5},
|
|
991
|
+
* mickey: {price: 2},
|
|
992
|
+
* tom: {price: 4},
|
|
993
|
+
* carnaby: {price: 3},
|
|
994
|
+
* lowly: {price: 1},
|
|
995
|
+
* },
|
|
996
|
+
* });
|
|
997
|
+
* console.log(store.getSortedRowIds('pets', 'price', false, 0, 2));
|
|
998
|
+
* // -> ['lowly', 'mickey']
|
|
999
|
+
* console.log(store.getSortedRowIds('pets', 'price', false, 2, 2));
|
|
1000
|
+
* // -> ['carnaby', 'tom']
|
|
1001
|
+
* ```
|
|
1002
|
+
* @example
|
|
977
1003
|
* This example retrieves Row Ids sorted by their own value, since the
|
|
978
1004
|
* `cellId` parameter is undefined.
|
|
979
1005
|
*
|
|
@@ -1000,7 +1026,13 @@ export interface Store {
|
|
|
1000
1026
|
* @category Getter
|
|
1001
1027
|
* @since v2.0.0
|
|
1002
1028
|
*/
|
|
1003
|
-
getSortedRowIds(
|
|
1029
|
+
getSortedRowIds(
|
|
1030
|
+
tableId: Id,
|
|
1031
|
+
cellId?: Id,
|
|
1032
|
+
descending?: boolean,
|
|
1033
|
+
offset?: number,
|
|
1034
|
+
limit?: number,
|
|
1035
|
+
): Ids;
|
|
1004
1036
|
|
|
1005
1037
|
/**
|
|
1006
1038
|
* The getRow method returns an object containing the entire data of a single
|
|
@@ -1044,9 +1076,7 @@ export interface Store {
|
|
|
1044
1076
|
* given Table.
|
|
1045
1077
|
*
|
|
1046
1078
|
* Note that this returns a copy of, rather than a reference, to the list of
|
|
1047
|
-
* Ids, so changes made to the list are not made to the Store itself.
|
|
1048
|
-
* v2.0.0, the order is significant: this method will return the Ids in the
|
|
1049
|
-
* order in which each Cell was added.
|
|
1079
|
+
* Ids, so changes made to the list are not made to the Store itself.
|
|
1050
1080
|
*
|
|
1051
1081
|
* @param tableId The Id of the Table in the Store.
|
|
1052
1082
|
* @param rowId The Id of the Row in the Table.
|
|
@@ -2212,12 +2242,6 @@ export interface Store {
|
|
|
2212
2242
|
* removed. To listen to all changes in the Store, use the addTablesListener
|
|
2213
2243
|
* method.
|
|
2214
2244
|
*
|
|
2215
|
-
* Since v2.0.0, you can use the optional `trackReorder` parameter to
|
|
2216
|
-
* additionally track when the set of Ids has not changed, but the order has -
|
|
2217
|
-
* for example when a Table from the middle of the Store is removed and then
|
|
2218
|
-
* added back within the same transaction. This behavior is disabled by
|
|
2219
|
-
* default due to the potential performance cost of detecting such changes.
|
|
2220
|
-
*
|
|
2221
2245
|
* Use the optional mutator parameter to indicate that there is code in the
|
|
2222
2246
|
* listener that will mutate Store data. If set to `false` (or omitted), such
|
|
2223
2247
|
* mutations will be silently ignored. All relevant mutator listeners (with
|
|
@@ -2228,9 +2252,6 @@ export interface Store {
|
|
|
2228
2252
|
*
|
|
2229
2253
|
* @param listener The function that will be called whenever the Table Ids in
|
|
2230
2254
|
* the Store change.
|
|
2231
|
-
* @param trackReorder An optional boolean that indicates that the listener
|
|
2232
|
-
* should be called if the set of Ids remains the same but their order
|
|
2233
|
-
* changes.
|
|
2234
2255
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
2235
2256
|
* Store data.
|
|
2236
2257
|
* @returns A unique Id for the listener that can later be used to call it
|
|
@@ -2260,7 +2281,6 @@ export interface Store {
|
|
|
2260
2281
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
2261
2282
|
* const listenerId = store.addTableIdsListener(
|
|
2262
2283
|
* (store) => store.setCell('meta', 'update', 'store', true),
|
|
2263
|
-
* false, // track reorder
|
|
2264
2284
|
* true, // mutator
|
|
2265
2285
|
* );
|
|
2266
2286
|
*
|
|
@@ -2272,11 +2292,7 @@ export interface Store {
|
|
|
2272
2292
|
* ```
|
|
2273
2293
|
* @category Listener
|
|
2274
2294
|
*/
|
|
2275
|
-
addTableIdsListener(
|
|
2276
|
-
listener: TableIdsListener,
|
|
2277
|
-
trackReorder?: boolean,
|
|
2278
|
-
mutator?: boolean,
|
|
2279
|
-
): Id;
|
|
2295
|
+
addTableIdsListener(listener: TableIdsListener, mutator?: boolean): Id;
|
|
2280
2296
|
|
|
2281
2297
|
/**
|
|
2282
2298
|
* The addTableListener method registers a listener function with the Store
|
|
@@ -2389,12 +2405,6 @@ export interface Store {
|
|
|
2389
2405
|
* method's first parameter) or changes to any Table (by providing a `null`
|
|
2390
2406
|
* wildcard).
|
|
2391
2407
|
*
|
|
2392
|
-
* Since v2.0.0, you can use the optional `trackReorder` parameter to
|
|
2393
|
-
* additionally track when the set of Ids has not changed, but the order has -
|
|
2394
|
-
* for example when a Row from the middle of the Table is removed and then
|
|
2395
|
-
* added back within the same transaction. This behavior is disabled by
|
|
2396
|
-
* default due to the potential performance cost of detecting such changes.
|
|
2397
|
-
*
|
|
2398
2408
|
* Use the optional mutator parameter to indicate that there is code in the
|
|
2399
2409
|
* listener that will mutate Store data. If set to `false` (or omitted), such
|
|
2400
2410
|
* mutations will be silently ignored. All relevant mutator listeners (with
|
|
@@ -2406,9 +2416,6 @@ export interface Store {
|
|
|
2406
2416
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
2407
2417
|
* @param listener The function that will be called whenever the Row Ids in
|
|
2408
2418
|
* the Table change.
|
|
2409
|
-
* @param trackReorder An optional boolean that indicates that the listener
|
|
2410
|
-
* should be called if the set of Ids remains the same but their order
|
|
2411
|
-
* changes.
|
|
2412
2419
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
2413
2420
|
* Store data.
|
|
2414
2421
|
* @returns A unique Id for the listener that can later be used to call it
|
|
@@ -2431,36 +2438,6 @@ export interface Store {
|
|
|
2431
2438
|
* store.delListener(listenerId);
|
|
2432
2439
|
* ```
|
|
2433
2440
|
* @example
|
|
2434
|
-
* This example registers a listener that responds to a change of order in the
|
|
2435
|
-
* rows of a specific Table, even though the set of Ids themselves has not
|
|
2436
|
-
* changed.
|
|
2437
|
-
*
|
|
2438
|
-
* ```js
|
|
2439
|
-
* const store = createStore().setTables({
|
|
2440
|
-
* pets: {
|
|
2441
|
-
* fido: {species: 'dog'},
|
|
2442
|
-
* felix: {species: 'cat'},
|
|
2443
|
-
* },
|
|
2444
|
-
* });
|
|
2445
|
-
* const listenerId = store.addRowIdsListener(
|
|
2446
|
-
* 'pets',
|
|
2447
|
-
* (store) => {
|
|
2448
|
-
* console.log('Row Ids or order for pets table changed');
|
|
2449
|
-
* console.log(store.getRowIds('pets'));
|
|
2450
|
-
* },
|
|
2451
|
-
* true, // track reorder
|
|
2452
|
-
* );
|
|
2453
|
-
*
|
|
2454
|
-
* store.transaction(() => {
|
|
2455
|
-
* store.delRow('pets', 'fido');
|
|
2456
|
-
* store.setRow('pets', 'fido', {species: 'dog'});
|
|
2457
|
-
* });
|
|
2458
|
-
* // -> 'Row Ids or order for pets table changed'
|
|
2459
|
-
* // -> ['felix', 'fido']
|
|
2460
|
-
*
|
|
2461
|
-
* store.delListener(listenerId);
|
|
2462
|
-
* ```
|
|
2463
|
-
* @example
|
|
2464
2441
|
* This example registers a listener that responds to any change to the Row
|
|
2465
2442
|
* Ids of any Table.
|
|
2466
2443
|
*
|
|
@@ -2489,7 +2466,6 @@ export interface Store {
|
|
|
2489
2466
|
* const listenerId = store.addRowIdsListener(
|
|
2490
2467
|
* 'pets',
|
|
2491
2468
|
* (store, tableId) => store.setCell('meta', 'update', tableId, true),
|
|
2492
|
-
* false, // track reorder
|
|
2493
2469
|
* true, // mutator
|
|
2494
2470
|
* );
|
|
2495
2471
|
*
|
|
@@ -2504,20 +2480,21 @@ export interface Store {
|
|
|
2504
2480
|
addRowIdsListener(
|
|
2505
2481
|
tableId: IdOrNull,
|
|
2506
2482
|
listener: RowIdsListener,
|
|
2507
|
-
trackReorder?: boolean,
|
|
2508
2483
|
mutator?: boolean,
|
|
2509
2484
|
): Id;
|
|
2510
2485
|
|
|
2511
2486
|
/**
|
|
2512
2487
|
* The addSortedRowIdsListener method registers a listener function with the
|
|
2513
|
-
* Store that will be called whenever sorted
|
|
2488
|
+
* Store that will be called whenever sorted (and optionally, paginated) Row
|
|
2489
|
+
* Ids in a Table change.
|
|
2514
2490
|
*
|
|
2515
2491
|
* The provided listener is a SortedRowIdsListener function, and will be
|
|
2516
2492
|
* called with a reference to the Store, the Id of the Table whose Row Ids
|
|
2517
|
-
* sorting changed, the Cell Id being used to sort them,
|
|
2518
|
-
*
|
|
2519
|
-
*
|
|
2520
|
-
* call to
|
|
2493
|
+
* sorting changed, the Cell Id being used to sort them, whether descending or
|
|
2494
|
+
* not, and the offset and limit of the number of Ids returned, for pagination
|
|
2495
|
+
* purposes. It also receives the sorted array of Ids itself, so that you can
|
|
2496
|
+
* use them in the listener without the additional cost of an explicit call to
|
|
2497
|
+
* getSortedRowIds.
|
|
2521
2498
|
*
|
|
2522
2499
|
* Such a listener is called when a Row is added or removed, but also when a
|
|
2523
2500
|
* value in the specified Cell (somewhere in the Table) has changed enough to
|
|
@@ -2527,6 +2504,11 @@ export interface Store {
|
|
|
2527
2504
|
* of detecting changes to the sorting). You can only listen to a single
|
|
2528
2505
|
* specified Table, sorted by a single specified Cell.
|
|
2529
2506
|
*
|
|
2507
|
+
* The sorting of the rows is alphanumeric, and you can indicate whether it
|
|
2508
|
+
* should be in descending order. The `offset` and `limit` parameters are used
|
|
2509
|
+
* to paginate results, but default to `0` and `undefined` to return all
|
|
2510
|
+
* available Row Ids if not specified.
|
|
2511
|
+
*
|
|
2530
2512
|
* Use the optional mutator parameter to indicate that there is code in the
|
|
2531
2513
|
* listener that will mutate Store data. If set to `false` (or omitted), such
|
|
2532
2514
|
* mutations will be silently ignored. All relevant mutator listeners (with
|
|
@@ -2539,6 +2521,10 @@ export interface Store {
|
|
|
2539
2521
|
* @param cellId The Id of the Cell whose values are used for the sorting, or
|
|
2540
2522
|
* `undefined` to by sort the Row Id itself.
|
|
2541
2523
|
* @param descending Whether the sorting should be in descending order.
|
|
2524
|
+
* @param offset The number of Row Ids to skip for pagination purposes, if
|
|
2525
|
+
* any.
|
|
2526
|
+
* @param limit The maximum number of Row Ids to return, or `undefined` for
|
|
2527
|
+
* all.
|
|
2542
2528
|
* @param listener The function that will be called whenever the sorted Row
|
|
2543
2529
|
* Ids in the Table change.
|
|
2544
2530
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
@@ -2563,7 +2549,9 @@ export interface Store {
|
|
|
2563
2549
|
* 'pets',
|
|
2564
2550
|
* 'species',
|
|
2565
2551
|
* false,
|
|
2566
|
-
*
|
|
2552
|
+
* 0,
|
|
2553
|
+
* undefined,
|
|
2554
|
+
* (store, tableId, cellId, descending, offset, limit, sortedRowIds) => {
|
|
2567
2555
|
* console.log(`Sorted Row Ids for ${tableId} table changed`);
|
|
2568
2556
|
* console.log(sortedRowIds);
|
|
2569
2557
|
* // ^ cheaper than calling getSortedRowIds again
|
|
@@ -2577,6 +2565,43 @@ export interface Store {
|
|
|
2577
2565
|
* store.delListener(listenerId);
|
|
2578
2566
|
* ```
|
|
2579
2567
|
* @example
|
|
2568
|
+
* This 111example registers a listener that responds to any change to a
|
|
2569
|
+
* paginated section of the sorted Row Ids of a specific Table.
|
|
2570
|
+
*
|
|
2571
|
+
* ```js
|
|
2572
|
+
* const store = createStore().setTables({
|
|
2573
|
+
* pets: {
|
|
2574
|
+
* fido: {price: 6},
|
|
2575
|
+
* felix: {price: 5},
|
|
2576
|
+
* mickey: {price: 2},
|
|
2577
|
+
* tom: {price: 4},
|
|
2578
|
+
* carnaby: {price: 3},
|
|
2579
|
+
* lowly: {price: 1},
|
|
2580
|
+
* },
|
|
2581
|
+
* });
|
|
2582
|
+
*
|
|
2583
|
+
* const listenerId = store.addSortedRowIdsListener(
|
|
2584
|
+
* 'pets',
|
|
2585
|
+
* 'price',
|
|
2586
|
+
* false,
|
|
2587
|
+
* 0,
|
|
2588
|
+
* 3,
|
|
2589
|
+
* (store, tableId, cellId, descending, offset, limit, sortedRowIds) => {
|
|
2590
|
+
* console.log(`First three sorted Row Ids for ${tableId} table changed`);
|
|
2591
|
+
* console.log(sortedRowIds);
|
|
2592
|
+
* // ^ cheaper than calling getSortedRowIds again
|
|
2593
|
+
* },
|
|
2594
|
+
* );
|
|
2595
|
+
* console.log(store.getSortedRowIds('pets', 'price', false, 0, 3));
|
|
2596
|
+
* // -> ['lowly', 'mickey', 'carnaby']
|
|
2597
|
+
*
|
|
2598
|
+
* store.setCell('pets', 'carnaby', 'price', 4.5);
|
|
2599
|
+
* // -> 'First three sorted Row Ids for pets table changed'
|
|
2600
|
+
* // -> ['lowly', 'mickey', 'tom']
|
|
2601
|
+
*
|
|
2602
|
+
* store.delListener(listenerId);
|
|
2603
|
+
* ```
|
|
2604
|
+
* @example
|
|
2580
2605
|
* This example registers a listener that responds to any change to the sorted
|
|
2581
2606
|
* Row Ids of a specific Table. The Row Ids are sorted by their own value,
|
|
2582
2607
|
* since the `cellId` parameter is explicitly undefined.
|
|
@@ -2595,7 +2620,9 @@ export interface Store {
|
|
|
2595
2620
|
* 'pets',
|
|
2596
2621
|
* undefined,
|
|
2597
2622
|
* false,
|
|
2598
|
-
*
|
|
2623
|
+
* 0,
|
|
2624
|
+
* undefined,
|
|
2625
|
+
* (store, tableId, cellId, descending, offset, limit, sortedRowIds) => {
|
|
2599
2626
|
* console.log(`Sorted Row Ids for ${tableId} table changed`);
|
|
2600
2627
|
* console.log(sortedRowIds);
|
|
2601
2628
|
* // ^ cheaper than calling getSortedRowIds again
|
|
@@ -2627,7 +2654,9 @@ export interface Store {
|
|
|
2627
2654
|
* 'pets',
|
|
2628
2655
|
* 'species',
|
|
2629
2656
|
* false,
|
|
2630
|
-
*
|
|
2657
|
+
* 0,
|
|
2658
|
+
* undefined,
|
|
2659
|
+
* (store, tableId, cellId, descending, offset, limit, sortedRowIds) => {
|
|
2631
2660
|
* console.log(`Sorted Row Ids for ${tableId} table changed`);
|
|
2632
2661
|
* console.log(sortedRowIds);
|
|
2633
2662
|
* // ^ cheaper than calling getSortedRowIds again
|
|
@@ -2655,6 +2684,8 @@ export interface Store {
|
|
|
2655
2684
|
* 'pets',
|
|
2656
2685
|
* 'species',
|
|
2657
2686
|
* false,
|
|
2687
|
+
* 0,
|
|
2688
|
+
* undefined,
|
|
2658
2689
|
* (store, tableId) => store.setCell('meta', 'sorted', tableId, true),
|
|
2659
2690
|
* true, // mutator
|
|
2660
2691
|
* );
|
|
@@ -2672,6 +2703,8 @@ export interface Store {
|
|
|
2672
2703
|
tableId: Id,
|
|
2673
2704
|
cellId: Id | undefined,
|
|
2674
2705
|
descending: boolean,
|
|
2706
|
+
offset: number,
|
|
2707
|
+
limit: number | undefined,
|
|
2675
2708
|
listener: SortedRowIdsListener,
|
|
2676
2709
|
mutator?: boolean,
|
|
2677
2710
|
): Id;
|
|
@@ -2806,12 +2839,6 @@ export interface Store {
|
|
|
2806
2839
|
* Table, any Row in a specific Table, a specific Row in any Table, or any Row
|
|
2807
2840
|
* in any Table.
|
|
2808
2841
|
*
|
|
2809
|
-
* Since v2.0.0, you can use the optional `trackReorder` parameter to
|
|
2810
|
-
* additionally track when the set of Ids has not changed, but the order has -
|
|
2811
|
-
* for example when a Cell from the middle of the Row is removed and then
|
|
2812
|
-
* added back within the same transaction. This behavior is disabled by
|
|
2813
|
-
* default due to the potential performance cost of detecting such changes.
|
|
2814
|
-
*
|
|
2815
2842
|
* Use the optional mutator parameter to indicate that there is code in the
|
|
2816
2843
|
* listener that will mutate Store data. If set to `false` (or omitted), such
|
|
2817
2844
|
* mutations will be silently ignored. All relevant mutator listeners (with
|
|
@@ -2824,9 +2851,6 @@ export interface Store {
|
|
|
2824
2851
|
* @param rowId The Id of the Row to listen to, or `null` as a wildcard.
|
|
2825
2852
|
* @param listener The function that will be called whenever the Cell Ids in
|
|
2826
2853
|
* the Row change.
|
|
2827
|
-
* @param trackReorder An optional boolean that indicates that the listener
|
|
2828
|
-
* should be called if the set of Ids remains the same but their order
|
|
2829
|
-
* changes.
|
|
2830
2854
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
2831
2855
|
* Store data.
|
|
2832
2856
|
* @returns A unique Id for the listener that can later be used to call it
|
|
@@ -2883,7 +2907,6 @@ export interface Store {
|
|
|
2883
2907
|
* 'fido',
|
|
2884
2908
|
* (store, tableId, rowId) =>
|
|
2885
2909
|
* store.setCell('meta', 'update', `${tableId}_${rowId}`, true),
|
|
2886
|
-
* false, // track reorder
|
|
2887
2910
|
* true, // mutator
|
|
2888
2911
|
* );
|
|
2889
2912
|
*
|
|
@@ -2899,7 +2922,6 @@ export interface Store {
|
|
|
2899
2922
|
tableId: IdOrNull,
|
|
2900
2923
|
rowId: IdOrNull,
|
|
2901
2924
|
listener: CellIdsListener,
|
|
2902
|
-
trackReorder?: boolean,
|
|
2903
2925
|
mutator?: boolean,
|
|
2904
2926
|
): Id;
|
|
2905
2927
|
|