tinybase 4.4.0-beta.1 → 4.4.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/cjs/store.cjs +1 -1
- package/lib/cjs/store.cjs.gz +0 -0
- package/lib/cjs/tinybase.cjs +1 -1
- package/lib/cjs/tinybase.cjs.gz +0 -0
- package/lib/cjs/tools.cjs +1 -1
- package/lib/cjs/tools.cjs.gz +0 -0
- package/lib/cjs/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/store.cjs +1 -1
- package/lib/cjs-es6/store.cjs.gz +0 -0
- package/lib/cjs-es6/tinybase.cjs +1 -1
- package/lib/cjs-es6/tinybase.cjs.gz +0 -0
- package/lib/cjs-es6/tools.cjs +1 -1
- package/lib/cjs-es6/tools.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/debug/store.js +1 -1
- package/lib/debug/tinybase.js +1 -1
- package/lib/debug/tools.js +355 -14
- package/lib/debug/ui-react-dom.js +1 -1
- package/lib/debug/ui-react.js +284 -71
- package/lib/es6/store.js +1 -1
- package/lib/es6/store.js.gz +0 -0
- package/lib/es6/tinybase.js +1 -1
- package/lib/es6/tinybase.js.gz +0 -0
- package/lib/es6/tools.js +1 -1
- package/lib/es6/tools.js.gz +0 -0
- package/lib/es6/ui-react-dom-debug.js +1 -1
- package/lib/es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- 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/tools.js +1 -1
- package/lib/tools.js.gz +0 -0
- package/lib/types/store.d.ts +1 -1
- package/lib/types/tools.d.ts +2 -2
- package/lib/types/ui-react.d.ts +1163 -52
- package/lib/types/with-schemas/store.d.ts +1 -1
- package/lib/types/with-schemas/tools.d.ts +2 -2
- package/lib/types/with-schemas/ui-react.d.ts +1353 -65
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.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/tools.js +1 -1
- package/lib/umd/tools.js.gz +0 -0
- package/lib/umd/ui-react-dom-debug.js +1 -1
- package/lib/umd/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/store.js +1 -1
- package/lib/umd-es6/store.js.gz +0 -0
- package/lib/umd-es6/tinybase.js +1 -1
- package/lib/umd-es6/tinybase.js.gz +0 -0
- package/lib/umd-es6/tools.js +1 -1
- package/lib/umd-es6/tools.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom-debug.js +1 -1
- package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +20 -20
- package/readme.md +13 -13
|
@@ -53,6 +53,7 @@ const TYPE = 'type';
|
|
|
53
53
|
const DEFAULT = 'default';
|
|
54
54
|
const LISTENER = 'Listener';
|
|
55
55
|
const ADD = 'add';
|
|
56
|
+
const HAS = 'Has';
|
|
56
57
|
const IDS = 'Ids';
|
|
57
58
|
const TABLE = 'Table';
|
|
58
59
|
const TABLES = TABLE + 's';
|
|
@@ -65,7 +66,6 @@ const CELL_IDS = CELL + IDS;
|
|
|
65
66
|
const VALUE = 'Value';
|
|
66
67
|
const VALUES = VALUE + 's';
|
|
67
68
|
const VALUE_IDS = VALUE + IDS;
|
|
68
|
-
const HAS = 'Has';
|
|
69
69
|
const CURRENT_TARGET = 'currentTarget';
|
|
70
70
|
const _VALUE = 'value';
|
|
71
71
|
const id = (key) => EMPTY_STRING + key;
|
package/lib/debug/ui-react.js
CHANGED
|
@@ -7,6 +7,8 @@ const LISTENER = 'Listener';
|
|
|
7
7
|
const RESULT = 'Result';
|
|
8
8
|
const GET = 'get';
|
|
9
9
|
const ADD = 'add';
|
|
10
|
+
const HAS = 'Has';
|
|
11
|
+
const _HAS = 'has';
|
|
10
12
|
const IDS = 'Ids';
|
|
11
13
|
const TABLE = 'Table';
|
|
12
14
|
const TABLES = TABLE + 's';
|
|
@@ -81,10 +83,14 @@ const {
|
|
|
81
83
|
useCallback: useCallback$1,
|
|
82
84
|
useEffect,
|
|
83
85
|
useMemo: useMemo$1,
|
|
86
|
+
useLayoutEffect: useLayoutEffect$1,
|
|
84
87
|
useRef: useRef$1,
|
|
85
88
|
useState: useState$1,
|
|
86
89
|
} = React;
|
|
87
|
-
const
|
|
90
|
+
const EMPTY_ARRAY = [];
|
|
91
|
+
const EMPTY_OBJECT = {};
|
|
92
|
+
const DEFAULT_CHECKPOINT_IDS = [[], void 0, []];
|
|
93
|
+
const useCreate = (store, create, createDeps = EMPTY_ARRAY) => {
|
|
88
94
|
const thing = useMemo$1(
|
|
89
95
|
() => create(store),
|
|
90
96
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -97,19 +103,21 @@ const useListenable = (
|
|
|
97
103
|
listenable,
|
|
98
104
|
thing,
|
|
99
105
|
defaulted,
|
|
100
|
-
args =
|
|
106
|
+
args = EMPTY_ARRAY,
|
|
101
107
|
getFromListenerArg,
|
|
108
|
+
getterPrefix = GET,
|
|
109
|
+
listenerPrefix = EMPTY_STRING,
|
|
102
110
|
) => {
|
|
103
111
|
const [, rerender] = useState$1();
|
|
104
112
|
const getResult = useCallback$1(
|
|
105
|
-
() => thing?.[
|
|
113
|
+
() => thing?.[getterPrefix + listenable]?.(...args) ?? defaulted,
|
|
106
114
|
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
107
|
-
[thing, ...args],
|
|
115
|
+
[thing, listenable, ...args, defaulted],
|
|
108
116
|
);
|
|
109
117
|
const result = useRef$1();
|
|
110
118
|
useMemo$1(() => (result.current = getResult()), [getResult]);
|
|
111
119
|
useListener(
|
|
112
|
-
listenable,
|
|
120
|
+
listenerPrefix + listenable,
|
|
113
121
|
thing,
|
|
114
122
|
(...listenerArgs) => {
|
|
115
123
|
result.current = isUndefined(getFromListenerArg)
|
|
@@ -117,7 +125,7 @@ const useListenable = (
|
|
|
117
125
|
: listenerArgs[getFromListenerArg];
|
|
118
126
|
rerender([]);
|
|
119
127
|
},
|
|
120
|
-
[],
|
|
128
|
+
[getResult, getFromListenerArg],
|
|
121
129
|
args,
|
|
122
130
|
);
|
|
123
131
|
return result.current;
|
|
@@ -126,30 +134,25 @@ const useListener = (
|
|
|
126
134
|
listenable,
|
|
127
135
|
thing,
|
|
128
136
|
listener,
|
|
129
|
-
listenerDeps =
|
|
130
|
-
preArgs =
|
|
137
|
+
listenerDeps = EMPTY_ARRAY,
|
|
138
|
+
preArgs = EMPTY_ARRAY,
|
|
131
139
|
...postArgs
|
|
132
|
-
) =>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
() => () => thing?.delListener(listenerId),
|
|
142
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
143
|
-
deps,
|
|
144
|
-
);
|
|
145
|
-
};
|
|
140
|
+
) =>
|
|
141
|
+
useLayoutEffect$1(() => {
|
|
142
|
+
const listenerId = thing?.[ADD + listenable + LISTENER]?.(
|
|
143
|
+
...preArgs,
|
|
144
|
+
listener,
|
|
145
|
+
...postArgs,
|
|
146
|
+
);
|
|
147
|
+
return () => thing?.delListener(listenerId);
|
|
148
|
+
}, [thing, listenable, ...preArgs, ...listenerDeps, ...postArgs]);
|
|
146
149
|
const useSetCallback = (
|
|
147
150
|
storeOrStoreId,
|
|
148
151
|
settable,
|
|
149
152
|
get,
|
|
150
|
-
getDeps =
|
|
153
|
+
getDeps = EMPTY_ARRAY,
|
|
151
154
|
then = getUndefined,
|
|
152
|
-
thenDeps =
|
|
155
|
+
thenDeps = EMPTY_ARRAY,
|
|
153
156
|
...args
|
|
154
157
|
) => {
|
|
155
158
|
const store = useStoreOrStoreById(storeOrStoreId);
|
|
@@ -168,7 +171,7 @@ const useDel = (
|
|
|
168
171
|
storeOrStoreId,
|
|
169
172
|
deletable,
|
|
170
173
|
then = getUndefined,
|
|
171
|
-
thenDeps =
|
|
174
|
+
thenDeps = EMPTY_ARRAY,
|
|
172
175
|
...args
|
|
173
176
|
) => {
|
|
174
177
|
const store = useStoreOrStoreById(storeOrStoreId);
|
|
@@ -188,26 +191,60 @@ const useCheckpointAction = (checkpointsOrCheckpointsId, action, arg) => {
|
|
|
188
191
|
[checkpoints, action, arg],
|
|
189
192
|
);
|
|
190
193
|
};
|
|
191
|
-
const useCreateStore = (create, createDeps =
|
|
194
|
+
const useCreateStore = (create, createDeps = EMPTY_ARRAY) =>
|
|
192
195
|
useMemo$1(create, createDeps);
|
|
193
196
|
const useStoreIds = () => useThingIds(1);
|
|
197
|
+
const useHasTables = (storeOrStoreId) =>
|
|
198
|
+
useListenable(
|
|
199
|
+
TABLES,
|
|
200
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
201
|
+
false,
|
|
202
|
+
[],
|
|
203
|
+
1,
|
|
204
|
+
_HAS,
|
|
205
|
+
HAS,
|
|
206
|
+
);
|
|
194
207
|
const useTables = (storeOrStoreId) =>
|
|
195
|
-
useListenable(TABLES, useStoreOrStoreById(storeOrStoreId),
|
|
208
|
+
useListenable(TABLES, useStoreOrStoreById(storeOrStoreId), EMPTY_OBJECT);
|
|
196
209
|
const useTableIds = (storeOrStoreId) =>
|
|
197
|
-
useListenable(TABLE_IDS, useStoreOrStoreById(storeOrStoreId),
|
|
210
|
+
useListenable(TABLE_IDS, useStoreOrStoreById(storeOrStoreId), EMPTY_ARRAY);
|
|
211
|
+
const useHasTable = (tableId, storeOrStoreId) =>
|
|
212
|
+
useListenable(
|
|
213
|
+
TABLE,
|
|
214
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
215
|
+
false,
|
|
216
|
+
[tableId],
|
|
217
|
+
2,
|
|
218
|
+
_HAS,
|
|
219
|
+
HAS,
|
|
220
|
+
);
|
|
198
221
|
const useTable = (tableId, storeOrStoreId) =>
|
|
199
|
-
useListenable(TABLE, useStoreOrStoreById(storeOrStoreId),
|
|
222
|
+
useListenable(TABLE, useStoreOrStoreById(storeOrStoreId), EMPTY_OBJECT, [
|
|
223
|
+
tableId,
|
|
224
|
+
]);
|
|
200
225
|
const useTableCellIds = (tableId, storeOrStoreId) =>
|
|
201
226
|
useListenable(
|
|
202
227
|
TABLE + CELL_IDS,
|
|
203
228
|
useStoreOrStoreById(storeOrStoreId),
|
|
204
|
-
|
|
229
|
+
EMPTY_ARRAY,
|
|
205
230
|
[tableId],
|
|
206
231
|
);
|
|
232
|
+
const useHasTableCell = (tableId, cellId, storeOrStoreId) =>
|
|
233
|
+
useListenable(
|
|
234
|
+
TABLE + CELL,
|
|
235
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
236
|
+
false,
|
|
237
|
+
[tableId, cellId],
|
|
238
|
+
3,
|
|
239
|
+
_HAS,
|
|
240
|
+
HAS,
|
|
241
|
+
);
|
|
207
242
|
const useRowCount = (tableId, storeOrStoreId) =>
|
|
208
|
-
useListenable(ROW_COUNT, useStoreOrStoreById(storeOrStoreId),
|
|
243
|
+
useListenable(ROW_COUNT, useStoreOrStoreById(storeOrStoreId), 0, [tableId]);
|
|
209
244
|
const useRowIds = (tableId, storeOrStoreId) =>
|
|
210
|
-
useListenable(ROW_IDS, useStoreOrStoreById(storeOrStoreId),
|
|
245
|
+
useListenable(ROW_IDS, useStoreOrStoreById(storeOrStoreId), EMPTY_ARRAY, [
|
|
246
|
+
tableId,
|
|
247
|
+
]);
|
|
211
248
|
const useSortedRowIds = (
|
|
212
249
|
tableId,
|
|
213
250
|
cellId,
|
|
@@ -219,18 +256,39 @@ const useSortedRowIds = (
|
|
|
219
256
|
useListenable(
|
|
220
257
|
SORTED_ROW_IDS,
|
|
221
258
|
useStoreOrStoreById(storeOrStoreId),
|
|
222
|
-
|
|
259
|
+
EMPTY_ARRAY,
|
|
223
260
|
[tableId, cellId, descending, offset, limit],
|
|
224
261
|
6,
|
|
225
262
|
);
|
|
263
|
+
const useHasRow = (tableId, rowId, storeOrStoreId) =>
|
|
264
|
+
useListenable(
|
|
265
|
+
ROW,
|
|
266
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
267
|
+
false,
|
|
268
|
+
[tableId, rowId],
|
|
269
|
+
3,
|
|
270
|
+
_HAS,
|
|
271
|
+
HAS,
|
|
272
|
+
);
|
|
226
273
|
const useRow = (tableId, rowId, storeOrStoreId) =>
|
|
227
|
-
useListenable(ROW, useStoreOrStoreById(storeOrStoreId),
|
|
274
|
+
useListenable(ROW, useStoreOrStoreById(storeOrStoreId), EMPTY_OBJECT, [
|
|
275
|
+
tableId,
|
|
276
|
+
rowId,
|
|
277
|
+
]);
|
|
228
278
|
const useCellIds = (tableId, rowId, storeOrStoreId) =>
|
|
279
|
+
useListenable(CELL_IDS, useStoreOrStoreById(storeOrStoreId), EMPTY_ARRAY, [
|
|
280
|
+
tableId,
|
|
281
|
+
rowId,
|
|
282
|
+
]);
|
|
283
|
+
const useHasCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
229
284
|
useListenable(
|
|
230
|
-
|
|
285
|
+
CELL,
|
|
231
286
|
useStoreOrStoreById(storeOrStoreId),
|
|
232
|
-
|
|
233
|
-
[tableId, rowId],
|
|
287
|
+
false,
|
|
288
|
+
[tableId, rowId, cellId],
|
|
289
|
+
4,
|
|
290
|
+
_HAS,
|
|
291
|
+
HAS,
|
|
234
292
|
);
|
|
235
293
|
const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
236
294
|
useListenable(
|
|
@@ -240,10 +298,30 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
|
240
298
|
[tableId, rowId, cellId],
|
|
241
299
|
4,
|
|
242
300
|
);
|
|
301
|
+
const useHasValues = (storeOrStoreId) =>
|
|
302
|
+
useListenable(
|
|
303
|
+
VALUES,
|
|
304
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
305
|
+
false,
|
|
306
|
+
[],
|
|
307
|
+
1,
|
|
308
|
+
_HAS,
|
|
309
|
+
HAS,
|
|
310
|
+
);
|
|
243
311
|
const useValues = (storeOrStoreId) =>
|
|
244
|
-
useListenable(VALUES, useStoreOrStoreById(storeOrStoreId),
|
|
312
|
+
useListenable(VALUES, useStoreOrStoreById(storeOrStoreId), EMPTY_OBJECT);
|
|
245
313
|
const useValueIds = (storeOrStoreId) =>
|
|
246
|
-
useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId),
|
|
314
|
+
useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), EMPTY_ARRAY);
|
|
315
|
+
const useHasValue = (valueId, storeOrStoreId) =>
|
|
316
|
+
useListenable(
|
|
317
|
+
VALUE,
|
|
318
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
319
|
+
false,
|
|
320
|
+
[valueId],
|
|
321
|
+
2,
|
|
322
|
+
_HAS,
|
|
323
|
+
HAS,
|
|
324
|
+
);
|
|
247
325
|
const useValue = (valueId, storeOrStoreId) =>
|
|
248
326
|
useListenable(VALUE, useStoreOrStoreById(storeOrStoreId), void 0, [valueId]);
|
|
249
327
|
const useSetTablesCallback = (
|
|
@@ -300,10 +378,10 @@ const useSetRowCallback = (
|
|
|
300
378
|
const useAddRowCallback = (
|
|
301
379
|
tableId,
|
|
302
380
|
getRow,
|
|
303
|
-
getRowDeps =
|
|
381
|
+
getRowDeps = EMPTY_ARRAY,
|
|
304
382
|
storeOrStoreId,
|
|
305
383
|
then = getUndefined,
|
|
306
|
-
thenDeps =
|
|
384
|
+
thenDeps = EMPTY_ARRAY,
|
|
307
385
|
reuseRowIds = true,
|
|
308
386
|
) => {
|
|
309
387
|
const store = useStoreOrStoreById(storeOrStoreId);
|
|
@@ -434,13 +512,27 @@ const useDelValuesCallback = (storeOrStoreId, then, thenDeps) =>
|
|
|
434
512
|
useDel(storeOrStoreId, VALUES, then, thenDeps);
|
|
435
513
|
const useDelValueCallback = (valueId, storeOrStoreId, then, thenDeps) =>
|
|
436
514
|
useDel(storeOrStoreId, VALUE, then, thenDeps, valueId);
|
|
515
|
+
const useHasTablesListener = (
|
|
516
|
+
listener,
|
|
517
|
+
listenerDeps,
|
|
518
|
+
mutator,
|
|
519
|
+
storeOrStoreId,
|
|
520
|
+
) =>
|
|
521
|
+
useListener(
|
|
522
|
+
HAS + TABLES,
|
|
523
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
524
|
+
listener,
|
|
525
|
+
listenerDeps,
|
|
526
|
+
[],
|
|
527
|
+
mutator,
|
|
528
|
+
);
|
|
437
529
|
const useTablesListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
|
|
438
530
|
useListener(
|
|
439
531
|
TABLES,
|
|
440
532
|
useStoreOrStoreById(storeOrStoreId),
|
|
441
533
|
listener,
|
|
442
534
|
listenerDeps,
|
|
443
|
-
|
|
535
|
+
EMPTY_ARRAY,
|
|
444
536
|
mutator,
|
|
445
537
|
);
|
|
446
538
|
const useTableIdsListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
|
|
@@ -449,7 +541,22 @@ const useTableIdsListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
|
|
|
449
541
|
useStoreOrStoreById(storeOrStoreId),
|
|
450
542
|
listener,
|
|
451
543
|
listenerDeps,
|
|
452
|
-
|
|
544
|
+
EMPTY_ARRAY,
|
|
545
|
+
mutator,
|
|
546
|
+
);
|
|
547
|
+
const useHasTableListener = (
|
|
548
|
+
tableId,
|
|
549
|
+
listener,
|
|
550
|
+
listenerDeps,
|
|
551
|
+
mutator,
|
|
552
|
+
storeOrStoreId,
|
|
553
|
+
) =>
|
|
554
|
+
useListener(
|
|
555
|
+
HAS + TABLE,
|
|
556
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
557
|
+
listener,
|
|
558
|
+
listenerDeps,
|
|
559
|
+
[tableId],
|
|
453
560
|
mutator,
|
|
454
561
|
);
|
|
455
562
|
const useTableListener = (
|
|
@@ -482,6 +589,22 @@ const useTableCellIdsListener = (
|
|
|
482
589
|
[tableId],
|
|
483
590
|
mutator,
|
|
484
591
|
);
|
|
592
|
+
const useHasTableCellListener = (
|
|
593
|
+
tableId,
|
|
594
|
+
cellId,
|
|
595
|
+
listener,
|
|
596
|
+
listenerDeps,
|
|
597
|
+
mutator,
|
|
598
|
+
storeOrStoreId,
|
|
599
|
+
) =>
|
|
600
|
+
useListener(
|
|
601
|
+
HAS + TABLE + CELL,
|
|
602
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
603
|
+
listener,
|
|
604
|
+
listenerDeps,
|
|
605
|
+
[tableId, cellId],
|
|
606
|
+
mutator,
|
|
607
|
+
);
|
|
485
608
|
const useRowCountListener = (
|
|
486
609
|
tableId,
|
|
487
610
|
listener,
|
|
@@ -531,6 +654,22 @@ const useSortedRowIdsListener = (
|
|
|
531
654
|
[tableId, cellId, descending, offset, limit],
|
|
532
655
|
mutator,
|
|
533
656
|
);
|
|
657
|
+
const useHasRowListener = (
|
|
658
|
+
tableId,
|
|
659
|
+
rowId,
|
|
660
|
+
listener,
|
|
661
|
+
listenerDeps,
|
|
662
|
+
mutator,
|
|
663
|
+
storeOrStoreId,
|
|
664
|
+
) =>
|
|
665
|
+
useListener(
|
|
666
|
+
HAS + ROW,
|
|
667
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
668
|
+
listener,
|
|
669
|
+
listenerDeps,
|
|
670
|
+
[tableId, rowId],
|
|
671
|
+
mutator,
|
|
672
|
+
);
|
|
534
673
|
const useRowListener = (
|
|
535
674
|
tableId,
|
|
536
675
|
rowId,
|
|
@@ -563,6 +702,23 @@ const useCellIdsListener = (
|
|
|
563
702
|
[tableId, rowId],
|
|
564
703
|
mutator,
|
|
565
704
|
);
|
|
705
|
+
const useHasCellListener = (
|
|
706
|
+
tableId,
|
|
707
|
+
rowId,
|
|
708
|
+
cellId,
|
|
709
|
+
listener,
|
|
710
|
+
listenerDeps,
|
|
711
|
+
mutator,
|
|
712
|
+
storeOrStoreId,
|
|
713
|
+
) =>
|
|
714
|
+
useListener(
|
|
715
|
+
HAS + CELL,
|
|
716
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
717
|
+
listener,
|
|
718
|
+
listenerDeps,
|
|
719
|
+
[tableId, rowId, cellId],
|
|
720
|
+
mutator,
|
|
721
|
+
);
|
|
566
722
|
const useCellListener = (
|
|
567
723
|
tableId,
|
|
568
724
|
rowId,
|
|
@@ -580,13 +736,27 @@ const useCellListener = (
|
|
|
580
736
|
[tableId, rowId, cellId],
|
|
581
737
|
mutator,
|
|
582
738
|
);
|
|
739
|
+
const useHasValuesListener = (
|
|
740
|
+
listener,
|
|
741
|
+
listenerDeps,
|
|
742
|
+
mutator,
|
|
743
|
+
storeOrStoreId,
|
|
744
|
+
) =>
|
|
745
|
+
useListener(
|
|
746
|
+
HAS + VALUES,
|
|
747
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
748
|
+
listener,
|
|
749
|
+
listenerDeps,
|
|
750
|
+
[],
|
|
751
|
+
mutator,
|
|
752
|
+
);
|
|
583
753
|
const useValuesListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
|
|
584
754
|
useListener(
|
|
585
755
|
VALUES,
|
|
586
756
|
useStoreOrStoreById(storeOrStoreId),
|
|
587
757
|
listener,
|
|
588
758
|
listenerDeps,
|
|
589
|
-
|
|
759
|
+
EMPTY_ARRAY,
|
|
590
760
|
mutator,
|
|
591
761
|
);
|
|
592
762
|
const useValueIdsListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
|
|
@@ -595,7 +765,22 @@ const useValueIdsListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
|
|
|
595
765
|
useStoreOrStoreById(storeOrStoreId),
|
|
596
766
|
listener,
|
|
597
767
|
listenerDeps,
|
|
598
|
-
|
|
768
|
+
EMPTY_ARRAY,
|
|
769
|
+
mutator,
|
|
770
|
+
);
|
|
771
|
+
const useHasValueListener = (
|
|
772
|
+
valueId,
|
|
773
|
+
listener,
|
|
774
|
+
listenerDeps,
|
|
775
|
+
mutator,
|
|
776
|
+
storeOrStoreId,
|
|
777
|
+
) =>
|
|
778
|
+
useListener(
|
|
779
|
+
HAS + VALUE,
|
|
780
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
781
|
+
listener,
|
|
782
|
+
listenerDeps,
|
|
783
|
+
[valueId],
|
|
599
784
|
mutator,
|
|
600
785
|
);
|
|
601
786
|
const useValueListener = (
|
|
@@ -646,7 +831,11 @@ const useCreateMetrics = (store, create, createDeps) =>
|
|
|
646
831
|
useCreate(store, create, createDeps);
|
|
647
832
|
const useMetricsIds = () => useThingIds(3);
|
|
648
833
|
const useMetricIds = (metricsOrMetricsId) =>
|
|
649
|
-
useListenable(
|
|
834
|
+
useListenable(
|
|
835
|
+
'MetricIds',
|
|
836
|
+
useMetricsOrMetricsById(metricsOrMetricsId),
|
|
837
|
+
EMPTY_ARRAY,
|
|
838
|
+
);
|
|
650
839
|
const useMetric = (metricId, metricsOrMetricsId) =>
|
|
651
840
|
useListenable('Metric', useMetricsOrMetricsById(metricsOrMetricsId), void 0, [
|
|
652
841
|
metricId,
|
|
@@ -671,16 +860,20 @@ const useSliceIds = (indexId, indexesOrIndexesId) =>
|
|
|
671
860
|
useListenable(
|
|
672
861
|
'SliceIds',
|
|
673
862
|
useIndexesOrIndexesById(indexesOrIndexesId),
|
|
674
|
-
|
|
863
|
+
EMPTY_ARRAY,
|
|
675
864
|
[indexId],
|
|
676
865
|
);
|
|
677
866
|
const useIndexIds = (indexesOrIndexesId) =>
|
|
678
|
-
useListenable(
|
|
867
|
+
useListenable(
|
|
868
|
+
'IndexIds',
|
|
869
|
+
useIndexesOrIndexesById(indexesOrIndexesId),
|
|
870
|
+
EMPTY_ARRAY,
|
|
871
|
+
);
|
|
679
872
|
const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
|
|
680
873
|
useListenable(
|
|
681
874
|
'Slice' + ROW_IDS,
|
|
682
875
|
useIndexesOrIndexesById(indexesOrIndexesId),
|
|
683
|
-
|
|
876
|
+
EMPTY_ARRAY,
|
|
684
877
|
[indexId, sliceId],
|
|
685
878
|
);
|
|
686
879
|
const useSliceIdsListener = (
|
|
@@ -717,7 +910,7 @@ const useRelationshipIds = (relationshipsOrRelationshipsId) =>
|
|
|
717
910
|
useListenable(
|
|
718
911
|
'RelationshipIds',
|
|
719
912
|
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
720
|
-
|
|
913
|
+
EMPTY_ARRAY,
|
|
721
914
|
);
|
|
722
915
|
const useRemoteRowId = (
|
|
723
916
|
relationshipId,
|
|
@@ -738,7 +931,7 @@ const useLocalRowIds = (
|
|
|
738
931
|
useListenable(
|
|
739
932
|
'Local' + ROW_IDS,
|
|
740
933
|
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
741
|
-
|
|
934
|
+
EMPTY_ARRAY,
|
|
742
935
|
[relationshipId, remoteRowId],
|
|
743
936
|
);
|
|
744
937
|
const useLinkedRowIds = (
|
|
@@ -749,7 +942,7 @@ const useLinkedRowIds = (
|
|
|
749
942
|
useListenable(
|
|
750
943
|
'Linked' + ROW_IDS,
|
|
751
944
|
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
752
|
-
|
|
945
|
+
EMPTY_ARRAY,
|
|
753
946
|
[relationshipId, firstRowId],
|
|
754
947
|
);
|
|
755
948
|
const useRemoteRowIdListener = (
|
|
@@ -798,33 +991,37 @@ const useCreateQueries = (store, create, createDeps) =>
|
|
|
798
991
|
useCreate(store, create, createDeps);
|
|
799
992
|
const useQueriesIds = () => useThingIds(9);
|
|
800
993
|
const useQueryIds = (queriesOrQueriesId) =>
|
|
801
|
-
useListenable(
|
|
994
|
+
useListenable(
|
|
995
|
+
'QueryIds',
|
|
996
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
997
|
+
EMPTY_ARRAY,
|
|
998
|
+
);
|
|
802
999
|
const useResultTable = (queryId, queriesOrQueriesId) =>
|
|
803
1000
|
useListenable(
|
|
804
1001
|
RESULT + TABLE,
|
|
805
1002
|
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
806
|
-
|
|
1003
|
+
EMPTY_OBJECT,
|
|
807
1004
|
[queryId],
|
|
808
1005
|
);
|
|
809
1006
|
const useResultTableCellIds = (queryId, queriesOrQueriesId) =>
|
|
810
1007
|
useListenable(
|
|
811
1008
|
RESULT + TABLE + CELL_IDS,
|
|
812
1009
|
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
813
|
-
|
|
1010
|
+
EMPTY_ARRAY,
|
|
814
1011
|
[queryId],
|
|
815
1012
|
);
|
|
816
1013
|
const useResultRowCount = (queryId, queriesOrQueriesId) =>
|
|
817
1014
|
useListenable(
|
|
818
1015
|
RESULT + ROW_COUNT,
|
|
819
1016
|
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
820
|
-
|
|
1017
|
+
0,
|
|
821
1018
|
[queryId],
|
|
822
1019
|
);
|
|
823
1020
|
const useResultRowIds = (queryId, queriesOrQueriesId) =>
|
|
824
1021
|
useListenable(
|
|
825
1022
|
RESULT + ROW_IDS,
|
|
826
1023
|
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
827
|
-
|
|
1024
|
+
EMPTY_ARRAY,
|
|
828
1025
|
[queryId],
|
|
829
1026
|
);
|
|
830
1027
|
const useResultSortedRowIds = (
|
|
@@ -838,20 +1035,22 @@ const useResultSortedRowIds = (
|
|
|
838
1035
|
useListenable(
|
|
839
1036
|
RESULT + SORTED_ROW_IDS,
|
|
840
1037
|
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
841
|
-
|
|
1038
|
+
EMPTY_ARRAY,
|
|
842
1039
|
[queryId, cellId, descending, offset, limit],
|
|
843
1040
|
6,
|
|
844
1041
|
);
|
|
845
1042
|
const useResultRow = (queryId, rowId, queriesOrQueriesId) =>
|
|
846
|
-
useListenable(
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
1043
|
+
useListenable(
|
|
1044
|
+
RESULT + ROW,
|
|
1045
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1046
|
+
EMPTY_OBJECT,
|
|
1047
|
+
[queryId, rowId],
|
|
1048
|
+
);
|
|
850
1049
|
const useResultCellIds = (queryId, rowId, queriesOrQueriesId) =>
|
|
851
1050
|
useListenable(
|
|
852
1051
|
RESULT + CELL_IDS,
|
|
853
1052
|
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
854
|
-
|
|
1053
|
+
EMPTY_ARRAY,
|
|
855
1054
|
[queryId, rowId],
|
|
856
1055
|
);
|
|
857
1056
|
const useResultCell = (queryId, rowId, cellId, queriesOrQueriesId) =>
|
|
@@ -980,7 +1179,7 @@ const useCheckpointIds = (checkpointsOrCheckpointsId) =>
|
|
|
980
1179
|
useListenable(
|
|
981
1180
|
'CheckpointIds',
|
|
982
1181
|
useCheckpointsOrCheckpointsById(checkpointsOrCheckpointsId),
|
|
983
|
-
|
|
1182
|
+
DEFAULT_CHECKPOINT_IDS,
|
|
984
1183
|
);
|
|
985
1184
|
const useCheckpoint = (checkpointId, checkpointsOrCheckpointsId) =>
|
|
986
1185
|
useListenable(
|
|
@@ -991,10 +1190,10 @@ const useCheckpoint = (checkpointId, checkpointsOrCheckpointsId) =>
|
|
|
991
1190
|
);
|
|
992
1191
|
const useSetCheckpointCallback = (
|
|
993
1192
|
getCheckpoint = getUndefined,
|
|
994
|
-
getCheckpointDeps =
|
|
1193
|
+
getCheckpointDeps = EMPTY_ARRAY,
|
|
995
1194
|
checkpointsOrCheckpointsId,
|
|
996
1195
|
then = getUndefined,
|
|
997
|
-
thenDeps =
|
|
1196
|
+
thenDeps = EMPTY_ARRAY,
|
|
998
1197
|
) => {
|
|
999
1198
|
const checkpoints = useCheckpointsOrCheckpointsById(
|
|
1000
1199
|
checkpointsOrCheckpointsId,
|
|
@@ -1015,10 +1214,10 @@ const useGoForwardCallback = (checkpointsOrCheckpointsId) =>
|
|
|
1015
1214
|
useCheckpointAction(checkpointsOrCheckpointsId, 'goForward');
|
|
1016
1215
|
const useGoToCallback = (
|
|
1017
1216
|
getCheckpointId,
|
|
1018
|
-
getCheckpointIdDeps =
|
|
1217
|
+
getCheckpointIdDeps = EMPTY_ARRAY,
|
|
1019
1218
|
checkpointsOrCheckpointsId,
|
|
1020
1219
|
then = getUndefined,
|
|
1021
|
-
thenDeps =
|
|
1220
|
+
thenDeps = EMPTY_ARRAY,
|
|
1022
1221
|
) => {
|
|
1023
1222
|
const checkpoints = useCheckpointsOrCheckpointsById(
|
|
1024
1223
|
checkpointsOrCheckpointsId,
|
|
@@ -1087,11 +1286,11 @@ const useCheckpointListener = (
|
|
|
1087
1286
|
const useCreatePersister = (
|
|
1088
1287
|
store,
|
|
1089
1288
|
create,
|
|
1090
|
-
createDeps =
|
|
1289
|
+
createDeps = EMPTY_ARRAY,
|
|
1091
1290
|
then,
|
|
1092
|
-
thenDeps =
|
|
1291
|
+
thenDeps = EMPTY_ARRAY,
|
|
1093
1292
|
destroy,
|
|
1094
|
-
destroyDeps =
|
|
1293
|
+
destroyDeps = EMPTY_ARRAY,
|
|
1095
1294
|
) => {
|
|
1096
1295
|
const [, rerender] = useState$1();
|
|
1097
1296
|
const persister = useMemo$1(
|
|
@@ -1628,6 +1827,20 @@ export {
|
|
|
1628
1827
|
useGoBackwardCallback,
|
|
1629
1828
|
useGoForwardCallback,
|
|
1630
1829
|
useGoToCallback,
|
|
1830
|
+
useHasCell,
|
|
1831
|
+
useHasCellListener,
|
|
1832
|
+
useHasRow,
|
|
1833
|
+
useHasRowListener,
|
|
1834
|
+
useHasTable,
|
|
1835
|
+
useHasTableCell,
|
|
1836
|
+
useHasTableCellListener,
|
|
1837
|
+
useHasTableListener,
|
|
1838
|
+
useHasTables,
|
|
1839
|
+
useHasTablesListener,
|
|
1840
|
+
useHasValue,
|
|
1841
|
+
useHasValueListener,
|
|
1842
|
+
useHasValues,
|
|
1843
|
+
useHasValuesListener,
|
|
1631
1844
|
useIndexIds,
|
|
1632
1845
|
useIndexes,
|
|
1633
1846
|
useIndexesIds,
|