tinybase 6.2.0-beta.2 → 6.2.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/min/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/omni/index.js +2411 -228
- package/omni/with-schemas/index.js +2411 -228
- package/package.json +1 -1
- package/readme.md +2 -2
- package/releases.md +16 -2
package/omni/index.js
CHANGED
|
@@ -5,50 +5,6 @@ import {readFile, writeFile} from 'fs/promises';
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import {Fragment, jsx, jsxs} from 'react/jsx-runtime';
|
|
7
7
|
import {Map as Map$1} from 'yjs';
|
|
8
|
-
import {
|
|
9
|
-
CellView,
|
|
10
|
-
ResultCellView,
|
|
11
|
-
useCell,
|
|
12
|
-
useCreatePersister,
|
|
13
|
-
useCreateStore,
|
|
14
|
-
useIndexes,
|
|
15
|
-
useIndexesIds,
|
|
16
|
-
useIndexesOrIndexesById,
|
|
17
|
-
useIndexIds,
|
|
18
|
-
useMetric,
|
|
19
|
-
useMetricIds,
|
|
20
|
-
useMetrics,
|
|
21
|
-
useMetricsIds,
|
|
22
|
-
useQueries,
|
|
23
|
-
useQueriesIds,
|
|
24
|
-
useQueryIds,
|
|
25
|
-
useRelationshipIds,
|
|
26
|
-
useRelationships,
|
|
27
|
-
useRelationshipsIds,
|
|
28
|
-
useRelationshipsOrRelationshipsById,
|
|
29
|
-
useRemoteRowId,
|
|
30
|
-
useResultRowCount,
|
|
31
|
-
useResultRowIds,
|
|
32
|
-
useResultSortedRowIds,
|
|
33
|
-
useResultTableCellIds,
|
|
34
|
-
useRowCount,
|
|
35
|
-
useRowIds,
|
|
36
|
-
useSetCellCallback,
|
|
37
|
-
useSetValueCallback,
|
|
38
|
-
useSliceIds,
|
|
39
|
-
useSliceRowIds,
|
|
40
|
-
useSortedRowIds,
|
|
41
|
-
useStore,
|
|
42
|
-
useStoreIds,
|
|
43
|
-
useStoreOrStoreById,
|
|
44
|
-
useTableCellIds,
|
|
45
|
-
useTableIds,
|
|
46
|
-
useValue,
|
|
47
|
-
useValueIds,
|
|
48
|
-
useValues,
|
|
49
|
-
ValueView,
|
|
50
|
-
} from '../ui-react/index.js';
|
|
51
|
-
export * from '../ui-react';
|
|
52
8
|
|
|
53
9
|
const getTypeOf = (thing) => typeof thing;
|
|
54
10
|
const TINYBASE = 'tinybase';
|
|
@@ -74,6 +30,7 @@ const SET = 'set';
|
|
|
74
30
|
const ADD = 'add';
|
|
75
31
|
const DEL = 'del';
|
|
76
32
|
const HAS = 'Has';
|
|
33
|
+
const _HAS = 'has';
|
|
77
34
|
const IDS = 'Ids';
|
|
78
35
|
const TABLE$1 = 'Table';
|
|
79
36
|
const TABLES = TABLE$1 + 's';
|
|
@@ -88,6 +45,18 @@ const VALUE = 'Value';
|
|
|
88
45
|
const VALUES = VALUE + 's';
|
|
89
46
|
const VALUE_IDS = VALUE + IDS;
|
|
90
47
|
const TRANSACTION = 'Transaction';
|
|
48
|
+
const PARTIAL = 'Partial';
|
|
49
|
+
const FINISH = 'Finish';
|
|
50
|
+
const STATUS = 'Status';
|
|
51
|
+
const METRIC = 'Metric';
|
|
52
|
+
const INDEX = 'Index';
|
|
53
|
+
const SLICE = 'Slice';
|
|
54
|
+
const RELATIONSHIP = 'Relationship';
|
|
55
|
+
const REMOTE_ROW_ID = 'Remote' + ROW + 'Id';
|
|
56
|
+
const LOCAL = 'Local';
|
|
57
|
+
const LINKED = 'Linked';
|
|
58
|
+
const QUERY = 'Query';
|
|
59
|
+
const CHECKPOINT = 'Checkpoint';
|
|
91
60
|
const CURRENT_TARGET = 'currentTarget';
|
|
92
61
|
const _VALUE = 'value';
|
|
93
62
|
const OPEN = 'open';
|
|
@@ -147,6 +116,8 @@ const tryCatch = async (action, then1, then2) => {
|
|
|
147
116
|
}
|
|
148
117
|
};
|
|
149
118
|
|
|
119
|
+
const arrayNew = (size2, cb) =>
|
|
120
|
+
arrayMap(new Array(size2).fill(0), (_, index) => cb(index));
|
|
150
121
|
const arrayHas = (array, value) => array.includes(value);
|
|
151
122
|
const arrayEvery = (array, cb) => array.every(cb);
|
|
152
123
|
const arrayIsEqual = (array1, array2) =>
|
|
@@ -170,6 +141,7 @@ const arrayPush = (array, ...values) => array.push(...values);
|
|
|
170
141
|
const arrayPop = (array) => array.pop();
|
|
171
142
|
const arrayUnshift = (array, ...values) => array.unshift(...values);
|
|
172
143
|
const arrayShift = (array) => array.shift();
|
|
144
|
+
const arrayWith = (array, index, value) => array.with(index, value);
|
|
173
145
|
|
|
174
146
|
const getCellOrValueType = (cellOrValue) => {
|
|
175
147
|
const type = getTypeOf(cellOrValue);
|
|
@@ -236,6 +208,19 @@ const objMap = (obj, cb) =>
|
|
|
236
208
|
const objValues = (obj) => object.values(obj);
|
|
237
209
|
const objSize = (obj) => size(objIds(obj));
|
|
238
210
|
const objIsEmpty = (obj) => isObject(obj) && objSize(obj) == 0;
|
|
211
|
+
const objIsEqual = (obj1, obj2) => {
|
|
212
|
+
const entries1 = objEntries(obj1);
|
|
213
|
+
return (
|
|
214
|
+
size(entries1) === objSize(obj2) &&
|
|
215
|
+
arrayEvery(entries1, ([index, value1]) =>
|
|
216
|
+
isObject(value1)
|
|
217
|
+
? isObject(obj2[index])
|
|
218
|
+
? objIsEqual(obj2[index], value1)
|
|
219
|
+
: false
|
|
220
|
+
: obj2[index] === value1,
|
|
221
|
+
)
|
|
222
|
+
);
|
|
223
|
+
};
|
|
239
224
|
const objEnsure = (obj, id, getDefaultValue) => {
|
|
240
225
|
if (!objHas(obj, id)) {
|
|
241
226
|
obj[id] = getDefaultValue();
|
|
@@ -6997,200 +6982,2229 @@ const getIndexStoreTableId = (indexes, indexId) => [
|
|
|
6997
6982
|
indexes?.getTableId(indexId),
|
|
6998
6983
|
];
|
|
6999
6984
|
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
return
|
|
6985
|
+
var Offsets = /* @__PURE__ */ ((Offsets2) => {
|
|
6986
|
+
Offsets2[(Offsets2['Store'] = 0)] = 'Store';
|
|
6987
|
+
Offsets2[(Offsets2['Metrics'] = 1)] = 'Metrics';
|
|
6988
|
+
Offsets2[(Offsets2['Indexes'] = 2)] = 'Indexes';
|
|
6989
|
+
Offsets2[(Offsets2['Relationships'] = 3)] = 'Relationships';
|
|
6990
|
+
Offsets2[(Offsets2['Queries'] = 4)] = 'Queries';
|
|
6991
|
+
Offsets2[(Offsets2['Checkpoints'] = 5)] = 'Checkpoints';
|
|
6992
|
+
Offsets2[(Offsets2['Persister'] = 6)] = 'Persister';
|
|
6993
|
+
Offsets2[(Offsets2['Synchronizer'] = 7)] = 'Synchronizer';
|
|
6994
|
+
return Offsets2;
|
|
6995
|
+
})(Offsets || {});
|
|
6996
|
+
const TINYBASE_CONTEXT = TINYBASE + '_uirc';
|
|
6997
|
+
const Context = GLOBAL[TINYBASE_CONTEXT]
|
|
6998
|
+
? /* istanbul ignore next */
|
|
6999
|
+
GLOBAL[TINYBASE_CONTEXT]
|
|
7000
|
+
: (GLOBAL[TINYBASE_CONTEXT] = createContext([]));
|
|
7001
|
+
const useThing = (id, offset) => {
|
|
7002
|
+
const contextValue = useContext(Context);
|
|
7003
|
+
return isUndefined(id)
|
|
7004
|
+
? contextValue[offset * 2]
|
|
7005
|
+
: isString(id)
|
|
7006
|
+
? objGet(contextValue[offset * 2 + 1], id)
|
|
7007
|
+
: id;
|
|
7010
7008
|
};
|
|
7011
|
-
const
|
|
7012
|
-
|
|
7013
|
-
|
|
7009
|
+
const useThings = (offset) => ({...useContext(Context)[offset * 2 + 1]});
|
|
7010
|
+
const useThingOrThingById = (thingOrThingId, offset) => {
|
|
7011
|
+
const thing = useThing(thingOrThingId, offset);
|
|
7012
|
+
return isUndefined(thingOrThingId) || isString(thingOrThingId)
|
|
7013
|
+
? thing
|
|
7014
|
+
: thingOrThingId;
|
|
7015
|
+
};
|
|
7016
|
+
const useProvideThing = (thingId, thing, offset) => {
|
|
7017
|
+
const {16: addExtraThingById, 17: delExtraThingById} = useContext(Context);
|
|
7018
|
+
useEffect(() => {
|
|
7019
|
+
addExtraThingById?.(offset, thingId, thing);
|
|
7020
|
+
return () => delExtraThingById?.(offset, thingId);
|
|
7021
|
+
}, [addExtraThingById, thingId, thing, offset, delExtraThingById]);
|
|
7022
|
+
};
|
|
7023
|
+
const useThingIds = (offset) =>
|
|
7024
|
+
objIds(useContext(Context)[offset * 2 + 1] ?? {});
|
|
7025
|
+
|
|
7026
|
+
const EMPTY_ARRAY = [];
|
|
7027
|
+
const DEFAULTS = [{}, [], [EMPTY_ARRAY, void 0, EMPTY_ARRAY], void 0, false, 0];
|
|
7028
|
+
const IS_EQUALS = [
|
|
7029
|
+
objIsEqual,
|
|
7030
|
+
arrayIsEqual,
|
|
7031
|
+
(
|
|
7032
|
+
[backwardIds1, currentId1, forwardIds1],
|
|
7033
|
+
[backwardIds2, currentId2, forwardIds2],
|
|
7034
|
+
) =>
|
|
7035
|
+
currentId1 === currentId2 &&
|
|
7036
|
+
arrayIsEqual(backwardIds1, backwardIds2) &&
|
|
7037
|
+
arrayIsEqual(forwardIds1, forwardIds2),
|
|
7038
|
+
];
|
|
7039
|
+
const isEqual = (thing1, thing2) => thing1 === thing2;
|
|
7040
|
+
const useCreate = (store, create, createDeps = EMPTY_ARRAY) => {
|
|
7041
|
+
const [, rerender] = useState();
|
|
7042
|
+
const [thing, setThing] = useState();
|
|
7043
|
+
useEffect(
|
|
7044
|
+
() => {
|
|
7045
|
+
const newThing = store ? create(store) : void 0;
|
|
7046
|
+
setThing(newThing);
|
|
7047
|
+
rerender([]);
|
|
7048
|
+
return newThing?.destroy;
|
|
7049
|
+
},
|
|
7014
7050
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7015
|
-
|
|
7051
|
+
[store, ...createDeps],
|
|
7016
7052
|
);
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
const
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
)
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
(sortAndOffset) => {
|
|
7035
|
-
setState(sortAndOffset);
|
|
7036
|
-
onChange?.(sortAndOffset);
|
|
7053
|
+
return thing;
|
|
7054
|
+
};
|
|
7055
|
+
const addAndDelListener = (thing, listenable, ...args) => {
|
|
7056
|
+
const listenerId = thing?.[ADD + listenable + LISTENER]?.(...args);
|
|
7057
|
+
return () => thing?.delListener?.(listenerId);
|
|
7058
|
+
};
|
|
7059
|
+
const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
7060
|
+
const lastResult = useRef(DEFAULTS[returnType]);
|
|
7061
|
+
const getResult = useCallback(
|
|
7062
|
+
() => {
|
|
7063
|
+
const nextResult =
|
|
7064
|
+
thing?.[(returnType == 4 /* Boolean */ ? _HAS : GET) + listenable]?.(
|
|
7065
|
+
...args,
|
|
7066
|
+
) ?? DEFAULTS[returnType];
|
|
7067
|
+
return !(IS_EQUALS[returnType] ?? isEqual)(nextResult, lastResult.current)
|
|
7068
|
+
? (lastResult.current = nextResult)
|
|
7069
|
+
: lastResult.current;
|
|
7037
7070
|
},
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
const handleSort = useCallbackOrUndefined(
|
|
7041
|
-
(cellId2) =>
|
|
7042
|
-
setStateAndChange([
|
|
7043
|
-
cellId2,
|
|
7044
|
-
cellId2 == currentCellId ? !currentDescending : false,
|
|
7045
|
-
currentOffset,
|
|
7046
|
-
]),
|
|
7047
|
-
[setStateAndChange, currentCellId, currentDescending, currentOffset],
|
|
7048
|
-
sortOnClick,
|
|
7071
|
+
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
7072
|
+
[thing, returnType, listenable, ...args],
|
|
7049
7073
|
);
|
|
7050
|
-
const
|
|
7051
|
-
(
|
|
7052
|
-
|
|
7074
|
+
const subscribe = useCallback(
|
|
7075
|
+
(listener) =>
|
|
7076
|
+
addAndDelListener(
|
|
7077
|
+
thing,
|
|
7078
|
+
(returnType == 4 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
|
|
7079
|
+
...args,
|
|
7080
|
+
listener,
|
|
7081
|
+
),
|
|
7082
|
+
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
7083
|
+
[thing, returnType, listenable, ...args],
|
|
7053
7084
|
);
|
|
7054
|
-
|
|
7055
|
-
paginator === true ? SortedTablePaginator : paginator;
|
|
7056
|
-
return [
|
|
7057
|
-
[currentCellId, currentDescending, currentOffset],
|
|
7058
|
-
handleSort,
|
|
7059
|
-
useMemo(
|
|
7060
|
-
() =>
|
|
7061
|
-
paginator === false
|
|
7062
|
-
? null
|
|
7063
|
-
: /* @__PURE__ */ jsx(PaginatorComponent, {
|
|
7064
|
-
offset: currentOffset,
|
|
7065
|
-
limit,
|
|
7066
|
-
total,
|
|
7067
|
-
onChange: handleChangeOffset,
|
|
7068
|
-
}),
|
|
7069
|
-
[
|
|
7070
|
-
paginator,
|
|
7071
|
-
PaginatorComponent,
|
|
7072
|
-
currentOffset,
|
|
7073
|
-
limit,
|
|
7074
|
-
total,
|
|
7075
|
-
handleChangeOffset,
|
|
7076
|
-
],
|
|
7077
|
-
),
|
|
7078
|
-
];
|
|
7085
|
+
return useSyncExternalStore(subscribe, getResult, getResult);
|
|
7079
7086
|
};
|
|
7080
|
-
const
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
headerRow === false
|
|
7115
|
-
? null
|
|
7116
|
-
: /* @__PURE__ */ jsx('thead', {
|
|
7117
|
-
children: /* @__PURE__ */ jsxs('tr', {
|
|
7118
|
-
children: [
|
|
7119
|
-
idColumn === false
|
|
7120
|
-
? null
|
|
7121
|
-
: /* @__PURE__ */ jsx(HtmlHeaderCell, {
|
|
7122
|
-
sort: sortAndOffset ?? [],
|
|
7123
|
-
label: 'Id',
|
|
7124
|
-
onClick: handleSort,
|
|
7125
|
-
}),
|
|
7126
|
-
objToArray(cells, ({label}, cellId) =>
|
|
7127
|
-
/* @__PURE__ */ jsx(
|
|
7128
|
-
HtmlHeaderCell,
|
|
7129
|
-
{
|
|
7130
|
-
cellId,
|
|
7131
|
-
label,
|
|
7132
|
-
sort: sortAndOffset ?? [],
|
|
7133
|
-
onClick: handleSort,
|
|
7134
|
-
},
|
|
7135
|
-
cellId,
|
|
7136
|
-
),
|
|
7137
|
-
),
|
|
7138
|
-
],
|
|
7139
|
-
}),
|
|
7140
|
-
}),
|
|
7141
|
-
/* @__PURE__ */ jsx('tbody', {
|
|
7142
|
-
children: arrayMap(rowIds, (rowId) =>
|
|
7143
|
-
/* @__PURE__ */ jsxs(
|
|
7144
|
-
'tr',
|
|
7145
|
-
{
|
|
7146
|
-
children: [
|
|
7147
|
-
idColumn === false
|
|
7148
|
-
? null
|
|
7149
|
-
: /* @__PURE__ */ jsx('th', {children: rowId}),
|
|
7150
|
-
objToArray(
|
|
7151
|
-
cells,
|
|
7152
|
-
({component: CellView2, getComponentProps}, cellId) =>
|
|
7153
|
-
/* @__PURE__ */ jsx(
|
|
7154
|
-
'td',
|
|
7155
|
-
{
|
|
7156
|
-
children: /* @__PURE__ */ jsx(CellView2, {
|
|
7157
|
-
...getProps(getComponentProps, rowId, cellId),
|
|
7158
|
-
...cellComponentProps,
|
|
7159
|
-
rowId,
|
|
7160
|
-
cellId,
|
|
7161
|
-
}),
|
|
7162
|
-
},
|
|
7163
|
-
cellId,
|
|
7164
|
-
),
|
|
7165
|
-
),
|
|
7166
|
-
],
|
|
7167
|
-
},
|
|
7168
|
-
rowId,
|
|
7087
|
+
const useListener = (
|
|
7088
|
+
listenable,
|
|
7089
|
+
thing,
|
|
7090
|
+
listener,
|
|
7091
|
+
listenerDeps = EMPTY_ARRAY,
|
|
7092
|
+
preArgs = EMPTY_ARRAY,
|
|
7093
|
+
...postArgs
|
|
7094
|
+
) =>
|
|
7095
|
+
useLayoutEffect(
|
|
7096
|
+
() =>
|
|
7097
|
+
addAndDelListener(thing, listenable, ...preArgs, listener, ...postArgs),
|
|
7098
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7099
|
+
[thing, listenable, ...preArgs, ...listenerDeps, ...postArgs],
|
|
7100
|
+
);
|
|
7101
|
+
const useSetCallback = (
|
|
7102
|
+
storeOrStoreId,
|
|
7103
|
+
settable,
|
|
7104
|
+
get,
|
|
7105
|
+
getDeps = EMPTY_ARRAY,
|
|
7106
|
+
then = getUndefined,
|
|
7107
|
+
thenDeps = EMPTY_ARRAY,
|
|
7108
|
+
...args
|
|
7109
|
+
) => {
|
|
7110
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
7111
|
+
return useCallback(
|
|
7112
|
+
(parameter) =>
|
|
7113
|
+
ifNotUndefined(store, (store2) =>
|
|
7114
|
+
ifNotUndefined(get(parameter, store2), (thing) =>
|
|
7115
|
+
then(
|
|
7116
|
+
store2[SET + settable](
|
|
7117
|
+
...argsOrGetArgs(args, store2, parameter),
|
|
7118
|
+
thing,
|
|
7119
|
+
),
|
|
7120
|
+
thing,
|
|
7169
7121
|
),
|
|
7170
7122
|
),
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7123
|
+
),
|
|
7124
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7125
|
+
[store, settable, ...getDeps, ...thenDeps, ...nonFunctionDeps(args)],
|
|
7126
|
+
);
|
|
7127
|
+
};
|
|
7128
|
+
const argsOrGetArgs = (args, store, parameter) =>
|
|
7129
|
+
arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
|
|
7130
|
+
const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
|
|
7131
|
+
const useDel = (
|
|
7132
|
+
storeOrStoreId,
|
|
7133
|
+
deletable,
|
|
7134
|
+
then = getUndefined,
|
|
7135
|
+
thenDeps = EMPTY_ARRAY,
|
|
7136
|
+
...args
|
|
7137
|
+
) => {
|
|
7138
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
7139
|
+
return useCallback(
|
|
7140
|
+
(parameter) =>
|
|
7141
|
+
then(store?.[DEL + deletable](...argsOrGetArgs(args, store, parameter))),
|
|
7142
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7143
|
+
[store, deletable, ...thenDeps, ...nonFunctionDeps(args)],
|
|
7144
|
+
);
|
|
7145
|
+
};
|
|
7146
|
+
const useCheckpointAction = (checkpointsOrCheckpointsId, action, arg) => {
|
|
7147
|
+
const checkpoints = useCheckpointsOrCheckpointsById(
|
|
7148
|
+
checkpointsOrCheckpointsId,
|
|
7149
|
+
);
|
|
7150
|
+
return useCallback(
|
|
7151
|
+
() => checkpoints?.[action](arg),
|
|
7152
|
+
[checkpoints, action, arg],
|
|
7153
|
+
);
|
|
7154
|
+
};
|
|
7155
|
+
const useSortedRowIdsImpl = (
|
|
7156
|
+
tableId,
|
|
7175
7157
|
cellId,
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7158
|
+
descending,
|
|
7159
|
+
offset,
|
|
7160
|
+
limit,
|
|
7161
|
+
storeOrStoreId,
|
|
7162
|
+
) =>
|
|
7163
|
+
useListenable(
|
|
7164
|
+
SORTED_ROW_IDS,
|
|
7165
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7166
|
+
1 /* Array */,
|
|
7167
|
+
[tableId, cellId, descending, offset, limit],
|
|
7168
|
+
);
|
|
7169
|
+
const useSortedRowIdsListenerImpl = (
|
|
7170
|
+
tableId,
|
|
7171
|
+
cellId,
|
|
7172
|
+
descending,
|
|
7173
|
+
offset,
|
|
7174
|
+
limit,
|
|
7175
|
+
listener,
|
|
7176
|
+
listenerDeps,
|
|
7177
|
+
mutator,
|
|
7178
|
+
storeOrStoreId,
|
|
7179
|
+
) =>
|
|
7180
|
+
useListener(
|
|
7181
|
+
SORTED_ROW_IDS,
|
|
7182
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7183
|
+
listener,
|
|
7184
|
+
listenerDeps,
|
|
7185
|
+
[tableId, cellId, descending, offset, limit],
|
|
7186
|
+
mutator,
|
|
7187
|
+
);
|
|
7188
|
+
const useCreateStore = (create, createDeps = EMPTY_ARRAY) =>
|
|
7189
|
+
useMemo(create, createDeps);
|
|
7190
|
+
const useStoreIds = () => useThingIds(Offsets.Store);
|
|
7191
|
+
const useStore = (id) => useThing(id, Offsets.Store);
|
|
7192
|
+
const useStores = () => useThings(Offsets.Store);
|
|
7193
|
+
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
7194
|
+
useThingOrThingById(storeOrStoreId, Offsets.Store);
|
|
7195
|
+
const useProvideStore = (storeId, store) =>
|
|
7196
|
+
useProvideThing(storeId, store, Offsets.Store);
|
|
7197
|
+
const useCreateMergeableStore = (create, createDeps = EMPTY_ARRAY) =>
|
|
7198
|
+
useMemo(create, createDeps);
|
|
7199
|
+
const useHasTables = (storeOrStoreId) =>
|
|
7200
|
+
useListenable(
|
|
7201
|
+
TABLES,
|
|
7202
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7203
|
+
4 /* Boolean */,
|
|
7204
|
+
[],
|
|
7205
|
+
);
|
|
7206
|
+
const useTables = (storeOrStoreId) =>
|
|
7207
|
+
useListenable(TABLES, useStoreOrStoreById(storeOrStoreId), 0 /* Object */);
|
|
7208
|
+
const useTableIds = (storeOrStoreId) =>
|
|
7209
|
+
useListenable(TABLE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
7210
|
+
const useHasTable = (tableId, storeOrStoreId) =>
|
|
7211
|
+
useListenable(TABLE$1, useStoreOrStoreById(storeOrStoreId), 4 /* Boolean */, [
|
|
7212
|
+
tableId,
|
|
7213
|
+
]);
|
|
7214
|
+
const useTable = (tableId, storeOrStoreId) =>
|
|
7215
|
+
useListenable(TABLE$1, useStoreOrStoreById(storeOrStoreId), 0 /* Object */, [
|
|
7216
|
+
tableId,
|
|
7217
|
+
]);
|
|
7218
|
+
const useTableCellIds = (tableId, storeOrStoreId) =>
|
|
7219
|
+
useListenable(
|
|
7220
|
+
TABLE$1 + CELL_IDS,
|
|
7221
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7222
|
+
1 /* Array */,
|
|
7223
|
+
[tableId],
|
|
7224
|
+
);
|
|
7225
|
+
const useHasTableCell = (tableId, cellId, storeOrStoreId) =>
|
|
7226
|
+
useListenable(
|
|
7227
|
+
TABLE$1 + CELL,
|
|
7228
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7229
|
+
4 /* Boolean */,
|
|
7230
|
+
[tableId, cellId],
|
|
7231
|
+
);
|
|
7232
|
+
const useRowCount = (tableId, storeOrStoreId) =>
|
|
7233
|
+
useListenable(
|
|
7234
|
+
ROW_COUNT,
|
|
7235
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7236
|
+
5 /* Number */,
|
|
7237
|
+
[tableId],
|
|
7238
|
+
);
|
|
7239
|
+
const useRowIds = (tableId, storeOrStoreId) =>
|
|
7240
|
+
useListenable(ROW_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */, [
|
|
7241
|
+
tableId,
|
|
7242
|
+
]);
|
|
7243
|
+
const useSortedRowIds = (
|
|
7244
|
+
tableIdOrArgs,
|
|
7245
|
+
cellIdOrStoreOrStoreId,
|
|
7246
|
+
descending,
|
|
7247
|
+
offset,
|
|
7248
|
+
limit,
|
|
7249
|
+
storeOrStoreId,
|
|
7250
|
+
) =>
|
|
7251
|
+
useSortedRowIdsImpl(
|
|
7252
|
+
...(isObject(tableIdOrArgs)
|
|
7253
|
+
? [
|
|
7254
|
+
tableIdOrArgs.tableId,
|
|
7255
|
+
tableIdOrArgs.cellId,
|
|
7256
|
+
tableIdOrArgs.descending ?? false,
|
|
7257
|
+
tableIdOrArgs.offset ?? 0,
|
|
7258
|
+
tableIdOrArgs.limit,
|
|
7259
|
+
cellIdOrStoreOrStoreId,
|
|
7260
|
+
]
|
|
7261
|
+
: [
|
|
7262
|
+
tableIdOrArgs,
|
|
7263
|
+
cellIdOrStoreOrStoreId,
|
|
7264
|
+
descending,
|
|
7265
|
+
offset,
|
|
7266
|
+
limit,
|
|
7267
|
+
storeOrStoreId,
|
|
7268
|
+
]),
|
|
7269
|
+
);
|
|
7270
|
+
const useHasRow = (tableId, rowId, storeOrStoreId) =>
|
|
7271
|
+
useListenable(ROW, useStoreOrStoreById(storeOrStoreId), 4 /* Boolean */, [
|
|
7272
|
+
tableId,
|
|
7273
|
+
rowId,
|
|
7274
|
+
]);
|
|
7275
|
+
const useRow = (tableId, rowId, storeOrStoreId) =>
|
|
7276
|
+
useListenable(ROW, useStoreOrStoreById(storeOrStoreId), 0 /* Object */, [
|
|
7277
|
+
tableId,
|
|
7278
|
+
rowId,
|
|
7279
|
+
]);
|
|
7280
|
+
const useCellIds = (tableId, rowId, storeOrStoreId) =>
|
|
7281
|
+
useListenable(CELL_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */, [
|
|
7282
|
+
tableId,
|
|
7283
|
+
rowId,
|
|
7284
|
+
]);
|
|
7285
|
+
const useHasCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
7286
|
+
useListenable(CELL, useStoreOrStoreById(storeOrStoreId), 4 /* Boolean */, [
|
|
7287
|
+
tableId,
|
|
7288
|
+
rowId,
|
|
7289
|
+
cellId,
|
|
7290
|
+
]);
|
|
7291
|
+
const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
7292
|
+
useListenable(
|
|
7293
|
+
CELL,
|
|
7294
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7295
|
+
3 /* CellOrValue */,
|
|
7296
|
+
[tableId, rowId, cellId],
|
|
7297
|
+
);
|
|
7298
|
+
const useHasValues = (storeOrStoreId) =>
|
|
7299
|
+
useListenable(
|
|
7300
|
+
VALUES,
|
|
7301
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7302
|
+
4 /* Boolean */,
|
|
7303
|
+
[],
|
|
7304
|
+
);
|
|
7305
|
+
const useValues = (storeOrStoreId) =>
|
|
7306
|
+
useListenable(VALUES, useStoreOrStoreById(storeOrStoreId), 0 /* Object */);
|
|
7307
|
+
const useValueIds = (storeOrStoreId) =>
|
|
7308
|
+
useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
7309
|
+
const useHasValue = (valueId, storeOrStoreId) =>
|
|
7310
|
+
useListenable(VALUE, useStoreOrStoreById(storeOrStoreId), 4 /* Boolean */, [
|
|
7311
|
+
valueId,
|
|
7312
|
+
]);
|
|
7313
|
+
const useValue = (valueId, storeOrStoreId) =>
|
|
7314
|
+
useListenable(
|
|
7315
|
+
VALUE,
|
|
7316
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7317
|
+
3 /* CellOrValue */,
|
|
7318
|
+
[valueId],
|
|
7319
|
+
);
|
|
7320
|
+
const useSetTablesCallback = (
|
|
7321
|
+
getTables,
|
|
7322
|
+
getTablesDeps,
|
|
7323
|
+
storeOrStoreId,
|
|
7324
|
+
then,
|
|
7325
|
+
thenDeps,
|
|
7326
|
+
) =>
|
|
7327
|
+
useSetCallback(
|
|
7328
|
+
storeOrStoreId,
|
|
7329
|
+
TABLES,
|
|
7330
|
+
getTables,
|
|
7331
|
+
getTablesDeps,
|
|
7332
|
+
then,
|
|
7333
|
+
thenDeps,
|
|
7334
|
+
);
|
|
7335
|
+
const useSetTableCallback = (
|
|
7336
|
+
tableId,
|
|
7337
|
+
getTable,
|
|
7338
|
+
getTableDeps,
|
|
7339
|
+
storeOrStoreId,
|
|
7340
|
+
then,
|
|
7341
|
+
thenDeps,
|
|
7342
|
+
) =>
|
|
7343
|
+
useSetCallback(
|
|
7344
|
+
storeOrStoreId,
|
|
7345
|
+
TABLE$1,
|
|
7346
|
+
getTable,
|
|
7347
|
+
getTableDeps,
|
|
7348
|
+
then,
|
|
7349
|
+
thenDeps,
|
|
7350
|
+
tableId,
|
|
7351
|
+
);
|
|
7352
|
+
const useSetRowCallback = (
|
|
7353
|
+
tableId,
|
|
7354
|
+
rowId,
|
|
7355
|
+
getRow,
|
|
7356
|
+
getRowDeps,
|
|
7357
|
+
storeOrStoreId,
|
|
7358
|
+
then,
|
|
7359
|
+
thenDeps,
|
|
7360
|
+
) =>
|
|
7361
|
+
useSetCallback(
|
|
7362
|
+
storeOrStoreId,
|
|
7363
|
+
ROW,
|
|
7364
|
+
getRow,
|
|
7365
|
+
getRowDeps,
|
|
7366
|
+
then,
|
|
7367
|
+
thenDeps,
|
|
7368
|
+
tableId,
|
|
7369
|
+
rowId,
|
|
7370
|
+
);
|
|
7371
|
+
const useAddRowCallback = (
|
|
7372
|
+
tableId,
|
|
7373
|
+
getRow,
|
|
7374
|
+
getRowDeps = EMPTY_ARRAY,
|
|
7375
|
+
storeOrStoreId,
|
|
7376
|
+
then = getUndefined,
|
|
7377
|
+
thenDeps = EMPTY_ARRAY,
|
|
7378
|
+
reuseRowIds = true,
|
|
7379
|
+
) => {
|
|
7380
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
7381
|
+
return useCallback(
|
|
7382
|
+
(parameter) =>
|
|
7383
|
+
ifNotUndefined(store, (store2) =>
|
|
7384
|
+
ifNotUndefined(getRow(parameter, store2), (row) =>
|
|
7385
|
+
then(
|
|
7386
|
+
store2.addRow(
|
|
7387
|
+
isFunction(tableId) ? tableId(parameter, store2) : tableId,
|
|
7388
|
+
row,
|
|
7389
|
+
reuseRowIds,
|
|
7390
|
+
),
|
|
7391
|
+
store2,
|
|
7392
|
+
row,
|
|
7393
|
+
),
|
|
7394
|
+
),
|
|
7395
|
+
),
|
|
7396
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7397
|
+
[store, tableId, ...getRowDeps, ...thenDeps, reuseRowIds],
|
|
7398
|
+
);
|
|
7399
|
+
};
|
|
7400
|
+
const useSetPartialRowCallback = (
|
|
7401
|
+
tableId,
|
|
7402
|
+
rowId,
|
|
7403
|
+
getPartialRow,
|
|
7404
|
+
getPartialRowDeps,
|
|
7405
|
+
storeOrStoreId,
|
|
7406
|
+
then,
|
|
7407
|
+
thenDeps,
|
|
7408
|
+
) =>
|
|
7409
|
+
useSetCallback(
|
|
7410
|
+
storeOrStoreId,
|
|
7411
|
+
PARTIAL + ROW,
|
|
7412
|
+
getPartialRow,
|
|
7413
|
+
getPartialRowDeps,
|
|
7414
|
+
then,
|
|
7415
|
+
thenDeps,
|
|
7416
|
+
tableId,
|
|
7417
|
+
rowId,
|
|
7418
|
+
);
|
|
7419
|
+
const useSetCellCallback = (
|
|
7420
|
+
tableId,
|
|
7421
|
+
rowId,
|
|
7422
|
+
cellId,
|
|
7423
|
+
getCell,
|
|
7424
|
+
getCellDeps,
|
|
7425
|
+
storeOrStoreId,
|
|
7426
|
+
then,
|
|
7427
|
+
thenDeps,
|
|
7428
|
+
) =>
|
|
7429
|
+
useSetCallback(
|
|
7430
|
+
storeOrStoreId,
|
|
7431
|
+
CELL,
|
|
7432
|
+
getCell,
|
|
7433
|
+
getCellDeps,
|
|
7434
|
+
then,
|
|
7435
|
+
thenDeps,
|
|
7436
|
+
tableId,
|
|
7437
|
+
rowId,
|
|
7438
|
+
cellId,
|
|
7439
|
+
);
|
|
7440
|
+
const useSetValuesCallback = (
|
|
7441
|
+
getValues,
|
|
7442
|
+
getValuesDeps,
|
|
7443
|
+
storeOrStoreId,
|
|
7444
|
+
then,
|
|
7445
|
+
thenDeps,
|
|
7446
|
+
) =>
|
|
7447
|
+
useSetCallback(
|
|
7448
|
+
storeOrStoreId,
|
|
7449
|
+
VALUES,
|
|
7450
|
+
getValues,
|
|
7451
|
+
getValuesDeps,
|
|
7452
|
+
then,
|
|
7453
|
+
thenDeps,
|
|
7454
|
+
);
|
|
7455
|
+
const useSetPartialValuesCallback = (
|
|
7456
|
+
getPartialValues,
|
|
7457
|
+
getPartialValuesDeps,
|
|
7458
|
+
storeOrStoreId,
|
|
7459
|
+
then,
|
|
7460
|
+
thenDeps,
|
|
7461
|
+
) =>
|
|
7462
|
+
useSetCallback(
|
|
7463
|
+
storeOrStoreId,
|
|
7464
|
+
PARTIAL + VALUES,
|
|
7465
|
+
getPartialValues,
|
|
7466
|
+
getPartialValuesDeps,
|
|
7467
|
+
then,
|
|
7468
|
+
thenDeps,
|
|
7469
|
+
);
|
|
7470
|
+
const useSetValueCallback = (
|
|
7471
|
+
valueId,
|
|
7472
|
+
getValue,
|
|
7473
|
+
getValueDeps,
|
|
7474
|
+
storeOrStoreId,
|
|
7475
|
+
then,
|
|
7476
|
+
thenDeps,
|
|
7477
|
+
) =>
|
|
7478
|
+
useSetCallback(
|
|
7479
|
+
storeOrStoreId,
|
|
7480
|
+
VALUE,
|
|
7481
|
+
getValue,
|
|
7482
|
+
getValueDeps,
|
|
7483
|
+
then,
|
|
7484
|
+
thenDeps,
|
|
7485
|
+
valueId,
|
|
7486
|
+
);
|
|
7487
|
+
const useDelTablesCallback = (storeOrStoreId, then, thenDeps) =>
|
|
7488
|
+
useDel(storeOrStoreId, TABLES, then, thenDeps);
|
|
7489
|
+
const useDelTableCallback = (tableId, storeOrStoreId, then, thenDeps) =>
|
|
7490
|
+
useDel(storeOrStoreId, TABLE$1, then, thenDeps, tableId);
|
|
7491
|
+
const useDelRowCallback = (tableId, rowId, storeOrStoreId, then, thenDeps) =>
|
|
7492
|
+
useDel(storeOrStoreId, ROW, then, thenDeps, tableId, rowId);
|
|
7493
|
+
const useDelCellCallback = (
|
|
7494
|
+
tableId,
|
|
7495
|
+
rowId,
|
|
7496
|
+
cellId,
|
|
7497
|
+
forceDel,
|
|
7498
|
+
storeOrStoreId,
|
|
7499
|
+
then,
|
|
7500
|
+
thenDeps,
|
|
7501
|
+
) =>
|
|
7502
|
+
useDel(
|
|
7503
|
+
storeOrStoreId,
|
|
7504
|
+
CELL,
|
|
7505
|
+
then,
|
|
7506
|
+
thenDeps,
|
|
7507
|
+
tableId,
|
|
7508
|
+
rowId,
|
|
7509
|
+
cellId,
|
|
7510
|
+
forceDel,
|
|
7511
|
+
);
|
|
7512
|
+
const useDelValuesCallback = (storeOrStoreId, then, thenDeps) =>
|
|
7513
|
+
useDel(storeOrStoreId, VALUES, then, thenDeps);
|
|
7514
|
+
const useDelValueCallback = (valueId, storeOrStoreId, then, thenDeps) =>
|
|
7515
|
+
useDel(storeOrStoreId, VALUE, then, thenDeps, valueId);
|
|
7516
|
+
const useHasTablesListener = (
|
|
7517
|
+
listener,
|
|
7518
|
+
listenerDeps,
|
|
7519
|
+
mutator,
|
|
7520
|
+
storeOrStoreId,
|
|
7521
|
+
) =>
|
|
7522
|
+
useListener(
|
|
7523
|
+
HAS + TABLES,
|
|
7524
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7525
|
+
listener,
|
|
7526
|
+
listenerDeps,
|
|
7527
|
+
[],
|
|
7528
|
+
mutator,
|
|
7529
|
+
);
|
|
7530
|
+
const useTablesListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
|
|
7531
|
+
useListener(
|
|
7532
|
+
TABLES,
|
|
7533
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7534
|
+
listener,
|
|
7535
|
+
listenerDeps,
|
|
7536
|
+
EMPTY_ARRAY,
|
|
7537
|
+
mutator,
|
|
7538
|
+
);
|
|
7539
|
+
const useTableIdsListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
|
|
7540
|
+
useListener(
|
|
7541
|
+
TABLE_IDS,
|
|
7542
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7543
|
+
listener,
|
|
7544
|
+
listenerDeps,
|
|
7545
|
+
EMPTY_ARRAY,
|
|
7546
|
+
mutator,
|
|
7547
|
+
);
|
|
7548
|
+
const useHasTableListener = (
|
|
7549
|
+
tableId,
|
|
7550
|
+
listener,
|
|
7551
|
+
listenerDeps,
|
|
7552
|
+
mutator,
|
|
7553
|
+
storeOrStoreId,
|
|
7554
|
+
) =>
|
|
7555
|
+
useListener(
|
|
7556
|
+
HAS + TABLE$1,
|
|
7557
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7558
|
+
listener,
|
|
7559
|
+
listenerDeps,
|
|
7560
|
+
[tableId],
|
|
7561
|
+
mutator,
|
|
7562
|
+
);
|
|
7563
|
+
const useTableListener = (
|
|
7564
|
+
tableId,
|
|
7565
|
+
listener,
|
|
7566
|
+
listenerDeps,
|
|
7567
|
+
mutator,
|
|
7568
|
+
storeOrStoreId,
|
|
7569
|
+
) =>
|
|
7570
|
+
useListener(
|
|
7571
|
+
TABLE$1,
|
|
7572
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7573
|
+
listener,
|
|
7574
|
+
listenerDeps,
|
|
7575
|
+
[tableId],
|
|
7576
|
+
mutator,
|
|
7577
|
+
);
|
|
7578
|
+
const useTableCellIdsListener = (
|
|
7579
|
+
tableId,
|
|
7580
|
+
listener,
|
|
7581
|
+
listenerDeps,
|
|
7582
|
+
mutator,
|
|
7583
|
+
storeOrStoreId,
|
|
7584
|
+
) =>
|
|
7585
|
+
useListener(
|
|
7586
|
+
TABLE$1 + CELL_IDS,
|
|
7587
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7588
|
+
listener,
|
|
7589
|
+
listenerDeps,
|
|
7590
|
+
[tableId],
|
|
7591
|
+
mutator,
|
|
7592
|
+
);
|
|
7593
|
+
const useHasTableCellListener = (
|
|
7594
|
+
tableId,
|
|
7595
|
+
cellId,
|
|
7596
|
+
listener,
|
|
7597
|
+
listenerDeps,
|
|
7598
|
+
mutator,
|
|
7599
|
+
storeOrStoreId,
|
|
7600
|
+
) =>
|
|
7601
|
+
useListener(
|
|
7602
|
+
HAS + TABLE$1 + CELL,
|
|
7603
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7604
|
+
listener,
|
|
7605
|
+
listenerDeps,
|
|
7606
|
+
[tableId, cellId],
|
|
7607
|
+
mutator,
|
|
7608
|
+
);
|
|
7609
|
+
const useRowCountListener = (
|
|
7610
|
+
tableId,
|
|
7611
|
+
listener,
|
|
7612
|
+
listenerDeps,
|
|
7613
|
+
mutator,
|
|
7614
|
+
storeOrStoreId,
|
|
7615
|
+
) =>
|
|
7616
|
+
useListener(
|
|
7617
|
+
ROW_COUNT,
|
|
7618
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7619
|
+
listener,
|
|
7620
|
+
listenerDeps,
|
|
7621
|
+
[tableId],
|
|
7622
|
+
mutator,
|
|
7623
|
+
);
|
|
7624
|
+
const useRowIdsListener = (
|
|
7625
|
+
tableId,
|
|
7626
|
+
listener,
|
|
7627
|
+
listenerDeps,
|
|
7628
|
+
mutator,
|
|
7629
|
+
storeOrStoreId,
|
|
7630
|
+
) =>
|
|
7631
|
+
useListener(
|
|
7632
|
+
ROW_IDS,
|
|
7633
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7634
|
+
listener,
|
|
7635
|
+
listenerDeps,
|
|
7636
|
+
[tableId],
|
|
7637
|
+
mutator,
|
|
7638
|
+
);
|
|
7639
|
+
const useSortedRowIdsListener = (
|
|
7640
|
+
tableIdOrArgs,
|
|
7641
|
+
cellIdOrListener,
|
|
7642
|
+
descendingOrListenerDeps,
|
|
7643
|
+
offsetOrMutator,
|
|
7644
|
+
limitOrStoreOrStoreId,
|
|
7645
|
+
listener,
|
|
7646
|
+
listenerDeps,
|
|
7647
|
+
mutator,
|
|
7648
|
+
storeOrStoreId,
|
|
7649
|
+
) =>
|
|
7650
|
+
useSortedRowIdsListenerImpl(
|
|
7651
|
+
...(isObject(tableIdOrArgs)
|
|
7652
|
+
? [
|
|
7653
|
+
tableIdOrArgs.tableId,
|
|
7654
|
+
tableIdOrArgs.cellId,
|
|
7655
|
+
tableIdOrArgs.descending ?? false,
|
|
7656
|
+
tableIdOrArgs.offset ?? 0,
|
|
7657
|
+
tableIdOrArgs.limit,
|
|
7658
|
+
cellIdOrListener,
|
|
7659
|
+
descendingOrListenerDeps,
|
|
7660
|
+
offsetOrMutator,
|
|
7661
|
+
limitOrStoreOrStoreId,
|
|
7662
|
+
]
|
|
7663
|
+
: [
|
|
7664
|
+
tableIdOrArgs,
|
|
7665
|
+
cellIdOrListener,
|
|
7666
|
+
descendingOrListenerDeps,
|
|
7667
|
+
offsetOrMutator,
|
|
7668
|
+
limitOrStoreOrStoreId,
|
|
7669
|
+
listener,
|
|
7670
|
+
listenerDeps,
|
|
7671
|
+
mutator,
|
|
7672
|
+
storeOrStoreId,
|
|
7673
|
+
]),
|
|
7674
|
+
);
|
|
7675
|
+
const useHasRowListener = (
|
|
7676
|
+
tableId,
|
|
7677
|
+
rowId,
|
|
7678
|
+
listener,
|
|
7679
|
+
listenerDeps,
|
|
7680
|
+
mutator,
|
|
7681
|
+
storeOrStoreId,
|
|
7682
|
+
) =>
|
|
7683
|
+
useListener(
|
|
7684
|
+
HAS + ROW,
|
|
7685
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7686
|
+
listener,
|
|
7687
|
+
listenerDeps,
|
|
7688
|
+
[tableId, rowId],
|
|
7689
|
+
mutator,
|
|
7690
|
+
);
|
|
7691
|
+
const useRowListener = (
|
|
7692
|
+
tableId,
|
|
7693
|
+
rowId,
|
|
7694
|
+
listener,
|
|
7695
|
+
listenerDeps,
|
|
7696
|
+
mutator,
|
|
7697
|
+
storeOrStoreId,
|
|
7698
|
+
) =>
|
|
7699
|
+
useListener(
|
|
7700
|
+
ROW,
|
|
7701
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7702
|
+
listener,
|
|
7703
|
+
listenerDeps,
|
|
7704
|
+
[tableId, rowId],
|
|
7705
|
+
mutator,
|
|
7706
|
+
);
|
|
7707
|
+
const useCellIdsListener = (
|
|
7708
|
+
tableId,
|
|
7709
|
+
rowId,
|
|
7710
|
+
listener,
|
|
7711
|
+
listenerDeps,
|
|
7712
|
+
mutator,
|
|
7713
|
+
storeOrStoreId,
|
|
7714
|
+
) =>
|
|
7715
|
+
useListener(
|
|
7716
|
+
CELL_IDS,
|
|
7717
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7718
|
+
listener,
|
|
7719
|
+
listenerDeps,
|
|
7720
|
+
[tableId, rowId],
|
|
7721
|
+
mutator,
|
|
7722
|
+
);
|
|
7723
|
+
const useHasCellListener = (
|
|
7724
|
+
tableId,
|
|
7725
|
+
rowId,
|
|
7726
|
+
cellId,
|
|
7727
|
+
listener,
|
|
7728
|
+
listenerDeps,
|
|
7729
|
+
mutator,
|
|
7730
|
+
storeOrStoreId,
|
|
7731
|
+
) =>
|
|
7732
|
+
useListener(
|
|
7733
|
+
HAS + CELL,
|
|
7734
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7735
|
+
listener,
|
|
7736
|
+
listenerDeps,
|
|
7737
|
+
[tableId, rowId, cellId],
|
|
7738
|
+
mutator,
|
|
7739
|
+
);
|
|
7740
|
+
const useCellListener = (
|
|
7741
|
+
tableId,
|
|
7742
|
+
rowId,
|
|
7743
|
+
cellId,
|
|
7744
|
+
listener,
|
|
7745
|
+
listenerDeps,
|
|
7746
|
+
mutator,
|
|
7747
|
+
storeOrStoreId,
|
|
7748
|
+
) =>
|
|
7749
|
+
useListener(
|
|
7750
|
+
CELL,
|
|
7751
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7752
|
+
listener,
|
|
7753
|
+
listenerDeps,
|
|
7754
|
+
[tableId, rowId, cellId],
|
|
7755
|
+
mutator,
|
|
7756
|
+
);
|
|
7757
|
+
const useHasValuesListener = (
|
|
7758
|
+
listener,
|
|
7759
|
+
listenerDeps,
|
|
7760
|
+
mutator,
|
|
7761
|
+
storeOrStoreId,
|
|
7762
|
+
) =>
|
|
7763
|
+
useListener(
|
|
7764
|
+
HAS + VALUES,
|
|
7765
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7766
|
+
listener,
|
|
7767
|
+
listenerDeps,
|
|
7768
|
+
[],
|
|
7769
|
+
mutator,
|
|
7770
|
+
);
|
|
7771
|
+
const useValuesListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
|
|
7772
|
+
useListener(
|
|
7773
|
+
VALUES,
|
|
7774
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7775
|
+
listener,
|
|
7776
|
+
listenerDeps,
|
|
7777
|
+
EMPTY_ARRAY,
|
|
7778
|
+
mutator,
|
|
7779
|
+
);
|
|
7780
|
+
const useValueIdsListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
|
|
7781
|
+
useListener(
|
|
7782
|
+
VALUE_IDS,
|
|
7783
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7784
|
+
listener,
|
|
7785
|
+
listenerDeps,
|
|
7786
|
+
EMPTY_ARRAY,
|
|
7787
|
+
mutator,
|
|
7788
|
+
);
|
|
7789
|
+
const useHasValueListener = (
|
|
7790
|
+
valueId,
|
|
7791
|
+
listener,
|
|
7792
|
+
listenerDeps,
|
|
7793
|
+
mutator,
|
|
7794
|
+
storeOrStoreId,
|
|
7795
|
+
) =>
|
|
7796
|
+
useListener(
|
|
7797
|
+
HAS + VALUE,
|
|
7798
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7799
|
+
listener,
|
|
7800
|
+
listenerDeps,
|
|
7801
|
+
[valueId],
|
|
7802
|
+
mutator,
|
|
7803
|
+
);
|
|
7804
|
+
const useValueListener = (
|
|
7805
|
+
valueId,
|
|
7806
|
+
listener,
|
|
7807
|
+
listenerDeps,
|
|
7808
|
+
mutator,
|
|
7809
|
+
storeOrStoreId,
|
|
7810
|
+
) =>
|
|
7811
|
+
useListener(
|
|
7812
|
+
VALUE,
|
|
7813
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7814
|
+
listener,
|
|
7815
|
+
listenerDeps,
|
|
7816
|
+
[valueId],
|
|
7817
|
+
mutator,
|
|
7818
|
+
);
|
|
7819
|
+
const useStartTransactionListener = (listener, listenerDeps, storeOrStoreId) =>
|
|
7820
|
+
useListener(
|
|
7821
|
+
'Start' + TRANSACTION,
|
|
7822
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7823
|
+
listener,
|
|
7824
|
+
listenerDeps,
|
|
7825
|
+
);
|
|
7826
|
+
const useWillFinishTransactionListener = (
|
|
7827
|
+
listener,
|
|
7828
|
+
listenerDeps,
|
|
7829
|
+
storeOrStoreId,
|
|
7830
|
+
) =>
|
|
7831
|
+
useListener(
|
|
7832
|
+
'Will' + FINISH + TRANSACTION,
|
|
7833
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7834
|
+
listener,
|
|
7835
|
+
listenerDeps,
|
|
7836
|
+
);
|
|
7837
|
+
const useDidFinishTransactionListener = (
|
|
7838
|
+
listener,
|
|
7839
|
+
listenerDeps,
|
|
7840
|
+
storeOrStoreId,
|
|
7841
|
+
) =>
|
|
7842
|
+
useListener(
|
|
7843
|
+
'Did' + FINISH + TRANSACTION,
|
|
7844
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
7845
|
+
listener,
|
|
7846
|
+
listenerDeps,
|
|
7847
|
+
);
|
|
7848
|
+
const useCreateMetrics = (store, create, createDeps) =>
|
|
7849
|
+
useCreate(store, create, createDeps);
|
|
7850
|
+
const useMetricsIds = () => useThingIds(Offsets.Metrics);
|
|
7851
|
+
const useMetrics = (id) => useThing(id, Offsets.Metrics);
|
|
7852
|
+
const useMetricsOrMetricsById = (metricsOrMetricsId) =>
|
|
7853
|
+
useThingOrThingById(metricsOrMetricsId, Offsets.Metrics);
|
|
7854
|
+
const useProvideMetrics = (metricsId, metrics) =>
|
|
7855
|
+
useProvideThing(metricsId, metrics, Offsets.Metrics);
|
|
7856
|
+
const useMetricIds = (metricsOrMetricsId) =>
|
|
7857
|
+
useListenable(
|
|
7858
|
+
METRIC + IDS,
|
|
7859
|
+
useMetricsOrMetricsById(metricsOrMetricsId),
|
|
7860
|
+
1 /* Array */,
|
|
7861
|
+
);
|
|
7862
|
+
const useMetric = (metricId, metricsOrMetricsId) =>
|
|
7863
|
+
useListenable(
|
|
7864
|
+
METRIC,
|
|
7865
|
+
useMetricsOrMetricsById(metricsOrMetricsId),
|
|
7866
|
+
3 /* CellOrValue */,
|
|
7867
|
+
[metricId],
|
|
7868
|
+
);
|
|
7869
|
+
const useMetricListener = (
|
|
7870
|
+
metricId,
|
|
7871
|
+
listener,
|
|
7872
|
+
listenerDeps,
|
|
7873
|
+
metricsOrMetricsId,
|
|
7874
|
+
) =>
|
|
7875
|
+
useListener(
|
|
7876
|
+
METRIC,
|
|
7877
|
+
useMetricsOrMetricsById(metricsOrMetricsId),
|
|
7878
|
+
listener,
|
|
7879
|
+
listenerDeps,
|
|
7880
|
+
[metricId],
|
|
7881
|
+
);
|
|
7882
|
+
const useCreateIndexes = (store, create, createDeps) =>
|
|
7883
|
+
useCreate(store, create, createDeps);
|
|
7884
|
+
const useIndexesIds = () => useThingIds(Offsets.Indexes);
|
|
7885
|
+
const useIndexes = (id) => useThing(id, Offsets.Indexes);
|
|
7886
|
+
const useIndexesOrIndexesById = (indexesOrIndexesId) =>
|
|
7887
|
+
useThingOrThingById(indexesOrIndexesId, Offsets.Indexes);
|
|
7888
|
+
const useProvideIndexes = (indexesId, indexes) =>
|
|
7889
|
+
useProvideThing(indexesId, indexes, Offsets.Indexes);
|
|
7890
|
+
const useSliceIds = (indexId, indexesOrIndexesId) =>
|
|
7891
|
+
useListenable(
|
|
7892
|
+
SLICE + IDS,
|
|
7893
|
+
useIndexesOrIndexesById(indexesOrIndexesId),
|
|
7894
|
+
1 /* Array */,
|
|
7895
|
+
[indexId],
|
|
7896
|
+
);
|
|
7897
|
+
const useIndexIds = (indexesOrIndexesId) =>
|
|
7898
|
+
useListenable(
|
|
7899
|
+
INDEX + IDS,
|
|
7900
|
+
useIndexesOrIndexesById(indexesOrIndexesId),
|
|
7901
|
+
1 /* Array */,
|
|
7902
|
+
);
|
|
7903
|
+
const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
|
|
7904
|
+
useListenable(
|
|
7905
|
+
SLICE + ROW_IDS,
|
|
7906
|
+
useIndexesOrIndexesById(indexesOrIndexesId),
|
|
7907
|
+
1 /* Array */,
|
|
7908
|
+
[indexId, sliceId],
|
|
7909
|
+
);
|
|
7910
|
+
const useSliceIdsListener = (
|
|
7911
|
+
indexId,
|
|
7912
|
+
listener,
|
|
7913
|
+
listenerDeps,
|
|
7914
|
+
indexesOrIndexesId,
|
|
7915
|
+
) =>
|
|
7916
|
+
useListener(
|
|
7917
|
+
SLICE + IDS,
|
|
7918
|
+
useIndexesOrIndexesById(indexesOrIndexesId),
|
|
7919
|
+
listener,
|
|
7920
|
+
listenerDeps,
|
|
7921
|
+
[indexId],
|
|
7922
|
+
);
|
|
7923
|
+
const useSliceRowIdsListener = (
|
|
7924
|
+
indexId,
|
|
7925
|
+
sliceId,
|
|
7926
|
+
listener,
|
|
7927
|
+
listenerDeps,
|
|
7928
|
+
indexesOrIndexesId,
|
|
7929
|
+
) =>
|
|
7930
|
+
useListener(
|
|
7931
|
+
SLICE + ROW_IDS,
|
|
7932
|
+
useIndexesOrIndexesById(indexesOrIndexesId),
|
|
7933
|
+
listener,
|
|
7934
|
+
listenerDeps,
|
|
7935
|
+
[indexId, sliceId],
|
|
7936
|
+
);
|
|
7937
|
+
const useCreateRelationships = (store, create, createDeps) =>
|
|
7938
|
+
useCreate(store, create, createDeps);
|
|
7939
|
+
const useRelationshipsIds = () => useThingIds(Offsets.Relationships);
|
|
7940
|
+
const useRelationships = (id) => useThing(id, Offsets.Relationships);
|
|
7941
|
+
const useRelationshipsOrRelationshipsById = (relationshipsOrRelationshipsId) =>
|
|
7942
|
+
useThingOrThingById(relationshipsOrRelationshipsId, Offsets.Relationships);
|
|
7943
|
+
const useProvideRelationships = (relationshipsId, relationships) =>
|
|
7944
|
+
useProvideThing(relationshipsId, relationships, Offsets.Relationships);
|
|
7945
|
+
const useRelationshipIds = (relationshipsOrRelationshipsId) =>
|
|
7946
|
+
useListenable(
|
|
7947
|
+
RELATIONSHIP + IDS,
|
|
7948
|
+
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
7949
|
+
1 /* Array */,
|
|
7950
|
+
);
|
|
7951
|
+
const useRemoteRowId = (
|
|
7952
|
+
relationshipId,
|
|
7953
|
+
localRowId,
|
|
7954
|
+
relationshipsOrRelationshipsId,
|
|
7955
|
+
) =>
|
|
7956
|
+
useListenable(
|
|
7957
|
+
REMOTE_ROW_ID,
|
|
7958
|
+
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
7959
|
+
3 /* CellOrValue */,
|
|
7960
|
+
[relationshipId, localRowId],
|
|
7961
|
+
);
|
|
7962
|
+
const useLocalRowIds = (
|
|
7963
|
+
relationshipId,
|
|
7964
|
+
remoteRowId,
|
|
7965
|
+
relationshipsOrRelationshipsId,
|
|
7966
|
+
) =>
|
|
7967
|
+
useListenable(
|
|
7968
|
+
LOCAL + ROW_IDS,
|
|
7969
|
+
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
7970
|
+
1 /* Array */,
|
|
7971
|
+
[relationshipId, remoteRowId],
|
|
7972
|
+
);
|
|
7973
|
+
const useLinkedRowIds = (
|
|
7974
|
+
relationshipId,
|
|
7975
|
+
firstRowId,
|
|
7976
|
+
relationshipsOrRelationshipsId,
|
|
7977
|
+
) =>
|
|
7978
|
+
useListenable(
|
|
7979
|
+
LINKED + ROW_IDS,
|
|
7980
|
+
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
7981
|
+
1 /* Array */,
|
|
7982
|
+
[relationshipId, firstRowId],
|
|
7983
|
+
);
|
|
7984
|
+
const useRemoteRowIdListener = (
|
|
7985
|
+
relationshipId,
|
|
7986
|
+
localRowId,
|
|
7987
|
+
listener,
|
|
7988
|
+
listenerDeps,
|
|
7989
|
+
relationshipsOrRelationshipsId,
|
|
7990
|
+
) =>
|
|
7991
|
+
useListener(
|
|
7992
|
+
REMOTE_ROW_ID,
|
|
7993
|
+
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
7994
|
+
listener,
|
|
7995
|
+
listenerDeps,
|
|
7996
|
+
[relationshipId, localRowId],
|
|
7997
|
+
);
|
|
7998
|
+
const useLocalRowIdsListener = (
|
|
7999
|
+
relationshipId,
|
|
8000
|
+
remoteRowId,
|
|
8001
|
+
listener,
|
|
8002
|
+
listenerDeps,
|
|
8003
|
+
relationshipsOrRelationshipsId,
|
|
8004
|
+
) =>
|
|
8005
|
+
useListener(
|
|
8006
|
+
LOCAL + ROW_IDS,
|
|
8007
|
+
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
8008
|
+
listener,
|
|
8009
|
+
listenerDeps,
|
|
8010
|
+
[relationshipId, remoteRowId],
|
|
8011
|
+
);
|
|
8012
|
+
const useLinkedRowIdsListener = (
|
|
8013
|
+
relationshipId,
|
|
8014
|
+
firstRowId,
|
|
8015
|
+
listener,
|
|
8016
|
+
listenerDeps,
|
|
8017
|
+
relationshipsOrRelationshipsId,
|
|
8018
|
+
) =>
|
|
8019
|
+
useListener(
|
|
8020
|
+
LINKED + ROW_IDS,
|
|
8021
|
+
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
8022
|
+
listener,
|
|
8023
|
+
listenerDeps,
|
|
8024
|
+
[relationshipId, firstRowId],
|
|
8025
|
+
);
|
|
8026
|
+
const useCreateQueries = (store, create, createDeps) =>
|
|
8027
|
+
useCreate(store, create, createDeps);
|
|
8028
|
+
const useQueriesIds = () => useThingIds(Offsets.Queries);
|
|
8029
|
+
const useQueries = (id) => useThing(id, Offsets.Queries);
|
|
8030
|
+
const useQueriesOrQueriesById = (queriesOrQueriesId) =>
|
|
8031
|
+
useThingOrThingById(queriesOrQueriesId, Offsets.Queries);
|
|
8032
|
+
const useProvideQueries = (queriesId, queries) =>
|
|
8033
|
+
useProvideThing(queriesId, queries, Offsets.Queries);
|
|
8034
|
+
const useQueryIds = (queriesOrQueriesId) =>
|
|
8035
|
+
useListenable(
|
|
8036
|
+
QUERY + IDS,
|
|
8037
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8038
|
+
1 /* Array */,
|
|
8039
|
+
);
|
|
8040
|
+
const useResultTable = (queryId, queriesOrQueriesId) =>
|
|
8041
|
+
useListenable(
|
|
8042
|
+
RESULT + TABLE$1,
|
|
8043
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8044
|
+
0 /* Object */,
|
|
8045
|
+
[queryId],
|
|
8046
|
+
);
|
|
8047
|
+
const useResultTableCellIds = (queryId, queriesOrQueriesId) =>
|
|
8048
|
+
useListenable(
|
|
8049
|
+
RESULT + TABLE$1 + CELL_IDS,
|
|
8050
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8051
|
+
1 /* Array */,
|
|
8052
|
+
[queryId],
|
|
8053
|
+
);
|
|
8054
|
+
const useResultRowCount = (queryId, queriesOrQueriesId) =>
|
|
8055
|
+
useListenable(
|
|
8056
|
+
RESULT + ROW_COUNT,
|
|
8057
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8058
|
+
5 /* Number */,
|
|
8059
|
+
[queryId],
|
|
8060
|
+
);
|
|
8061
|
+
const useResultRowIds = (queryId, queriesOrQueriesId) =>
|
|
8062
|
+
useListenable(
|
|
8063
|
+
RESULT + ROW_IDS,
|
|
8064
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8065
|
+
1 /* Array */,
|
|
8066
|
+
[queryId],
|
|
8067
|
+
);
|
|
8068
|
+
const useResultSortedRowIds = (
|
|
8069
|
+
queryId,
|
|
8070
|
+
cellId,
|
|
8071
|
+
descending,
|
|
8072
|
+
offset = 0,
|
|
8073
|
+
limit,
|
|
8074
|
+
queriesOrQueriesId,
|
|
8075
|
+
) =>
|
|
8076
|
+
useListenable(
|
|
8077
|
+
RESULT + SORTED_ROW_IDS,
|
|
8078
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8079
|
+
1 /* Array */,
|
|
8080
|
+
[queryId, cellId, descending, offset, limit],
|
|
8081
|
+
);
|
|
8082
|
+
const useResultRow = (queryId, rowId, queriesOrQueriesId) =>
|
|
8083
|
+
useListenable(
|
|
8084
|
+
RESULT + ROW,
|
|
8085
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8086
|
+
0 /* Object */,
|
|
8087
|
+
[queryId, rowId],
|
|
8088
|
+
);
|
|
8089
|
+
const useResultCellIds = (queryId, rowId, queriesOrQueriesId) =>
|
|
8090
|
+
useListenable(
|
|
8091
|
+
RESULT + CELL_IDS,
|
|
8092
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8093
|
+
1 /* Array */,
|
|
8094
|
+
[queryId, rowId],
|
|
8095
|
+
);
|
|
8096
|
+
const useResultCell = (queryId, rowId, cellId, queriesOrQueriesId) =>
|
|
8097
|
+
useListenable(
|
|
8098
|
+
RESULT + CELL,
|
|
8099
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8100
|
+
3 /* CellOrValue */,
|
|
8101
|
+
[queryId, rowId, cellId],
|
|
8102
|
+
);
|
|
8103
|
+
const useResultTableListener = (
|
|
8104
|
+
queryId,
|
|
8105
|
+
listener,
|
|
8106
|
+
listenerDeps,
|
|
8107
|
+
queriesOrQueriesId,
|
|
8108
|
+
) =>
|
|
8109
|
+
useListener(
|
|
8110
|
+
RESULT + TABLE$1,
|
|
8111
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8112
|
+
listener,
|
|
8113
|
+
listenerDeps,
|
|
8114
|
+
[queryId],
|
|
8115
|
+
);
|
|
8116
|
+
const useResultTableCellIdsListener = (
|
|
8117
|
+
queryId,
|
|
8118
|
+
listener,
|
|
8119
|
+
listenerDeps,
|
|
8120
|
+
queriesOrQueriesId,
|
|
8121
|
+
) =>
|
|
8122
|
+
useListener(
|
|
8123
|
+
RESULT + TABLE$1 + CELL_IDS,
|
|
8124
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8125
|
+
listener,
|
|
8126
|
+
listenerDeps,
|
|
8127
|
+
[queryId],
|
|
8128
|
+
);
|
|
8129
|
+
const useResultRowCountListener = (
|
|
8130
|
+
queryId,
|
|
8131
|
+
listener,
|
|
8132
|
+
listenerDeps,
|
|
8133
|
+
queriesOrQueriesId,
|
|
8134
|
+
) =>
|
|
8135
|
+
useListener(
|
|
8136
|
+
RESULT + ROW_COUNT,
|
|
8137
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8138
|
+
listener,
|
|
8139
|
+
listenerDeps,
|
|
8140
|
+
[queryId],
|
|
8141
|
+
);
|
|
8142
|
+
const useResultRowIdsListener = (
|
|
8143
|
+
queryId,
|
|
8144
|
+
listener,
|
|
8145
|
+
listenerDeps,
|
|
8146
|
+
queriesOrQueriesId,
|
|
8147
|
+
) =>
|
|
8148
|
+
useListener(
|
|
8149
|
+
RESULT + ROW_IDS,
|
|
8150
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8151
|
+
listener,
|
|
8152
|
+
listenerDeps,
|
|
8153
|
+
[queryId],
|
|
8154
|
+
);
|
|
8155
|
+
const useResultSortedRowIdsListener = (
|
|
8156
|
+
queryId,
|
|
8157
|
+
cellId,
|
|
8158
|
+
descending,
|
|
8159
|
+
offset,
|
|
8160
|
+
limit,
|
|
8161
|
+
listener,
|
|
8162
|
+
listenerDeps,
|
|
8163
|
+
queriesOrQueriesId,
|
|
8164
|
+
) =>
|
|
8165
|
+
useListener(
|
|
8166
|
+
RESULT + SORTED_ROW_IDS,
|
|
8167
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8168
|
+
listener,
|
|
8169
|
+
listenerDeps,
|
|
8170
|
+
[queryId, cellId, descending, offset, limit],
|
|
8171
|
+
);
|
|
8172
|
+
const useResultRowListener = (
|
|
8173
|
+
queryId,
|
|
8174
|
+
rowId,
|
|
8175
|
+
listener,
|
|
8176
|
+
listenerDeps,
|
|
8177
|
+
queriesOrQueriesId,
|
|
8178
|
+
) =>
|
|
8179
|
+
useListener(
|
|
8180
|
+
RESULT + ROW,
|
|
8181
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8182
|
+
listener,
|
|
8183
|
+
listenerDeps,
|
|
8184
|
+
[queryId, rowId],
|
|
8185
|
+
);
|
|
8186
|
+
const useResultCellIdsListener = (
|
|
8187
|
+
queryId,
|
|
8188
|
+
rowId,
|
|
8189
|
+
listener,
|
|
8190
|
+
listenerDeps,
|
|
8191
|
+
queriesOrQueriesId,
|
|
8192
|
+
) =>
|
|
8193
|
+
useListener(
|
|
8194
|
+
RESULT + CELL_IDS,
|
|
8195
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8196
|
+
listener,
|
|
8197
|
+
listenerDeps,
|
|
8198
|
+
[queryId, rowId],
|
|
8199
|
+
);
|
|
8200
|
+
const useResultCellListener = (
|
|
8201
|
+
queryId,
|
|
8202
|
+
rowId,
|
|
8203
|
+
cellId,
|
|
8204
|
+
listener,
|
|
8205
|
+
listenerDeps,
|
|
8206
|
+
queriesOrQueriesId,
|
|
8207
|
+
) =>
|
|
8208
|
+
useListener(
|
|
8209
|
+
RESULT + CELL,
|
|
8210
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
8211
|
+
listener,
|
|
8212
|
+
listenerDeps,
|
|
8213
|
+
[queryId, rowId, cellId],
|
|
8214
|
+
);
|
|
8215
|
+
const useCreateCheckpoints = (store, create, createDeps) =>
|
|
8216
|
+
useCreate(store, create, createDeps);
|
|
8217
|
+
const useCheckpointsIds = () => useThingIds(Offsets.Checkpoints);
|
|
8218
|
+
const useCheckpoints = (id) => useThing(id, Offsets.Checkpoints);
|
|
8219
|
+
const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
|
|
8220
|
+
useThingOrThingById(checkpointsOrCheckpointsId, Offsets.Checkpoints);
|
|
8221
|
+
const useProvideCheckpoints = (checkpointsId, checkpoints) =>
|
|
8222
|
+
useProvideThing(checkpointsId, checkpoints, Offsets.Checkpoints);
|
|
8223
|
+
const useCheckpointIds = (checkpointsOrCheckpointsId) =>
|
|
8224
|
+
useListenable(
|
|
8225
|
+
CHECKPOINT + IDS,
|
|
8226
|
+
useCheckpointsOrCheckpointsById(checkpointsOrCheckpointsId),
|
|
8227
|
+
2 /* Checkpoints */,
|
|
8228
|
+
);
|
|
8229
|
+
const useCheckpoint = (checkpointId, checkpointsOrCheckpointsId) =>
|
|
8230
|
+
useListenable(
|
|
8231
|
+
CHECKPOINT,
|
|
8232
|
+
useCheckpointsOrCheckpointsById(checkpointsOrCheckpointsId),
|
|
8233
|
+
3 /* CellOrValue */,
|
|
8234
|
+
[checkpointId],
|
|
8235
|
+
);
|
|
8236
|
+
const useSetCheckpointCallback = (
|
|
8237
|
+
getCheckpoint = getUndefined,
|
|
8238
|
+
getCheckpointDeps = EMPTY_ARRAY,
|
|
8239
|
+
checkpointsOrCheckpointsId,
|
|
8240
|
+
then = getUndefined,
|
|
8241
|
+
thenDeps = EMPTY_ARRAY,
|
|
8242
|
+
) => {
|
|
8243
|
+
const checkpoints = useCheckpointsOrCheckpointsById(
|
|
8244
|
+
checkpointsOrCheckpointsId,
|
|
8245
|
+
);
|
|
8246
|
+
return useCallback(
|
|
8247
|
+
(parameter) =>
|
|
8248
|
+
ifNotUndefined(checkpoints, (checkpoints2) => {
|
|
8249
|
+
const label = getCheckpoint(parameter);
|
|
8250
|
+
then(checkpoints2.addCheckpoint(label), checkpoints2, label);
|
|
8251
|
+
}),
|
|
8252
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8253
|
+
[checkpoints, ...getCheckpointDeps, ...thenDeps],
|
|
8254
|
+
);
|
|
8255
|
+
};
|
|
8256
|
+
const useGoBackwardCallback = (checkpointsOrCheckpointsId) =>
|
|
8257
|
+
useCheckpointAction(checkpointsOrCheckpointsId, 'goBackward');
|
|
8258
|
+
const useGoForwardCallback = (checkpointsOrCheckpointsId) =>
|
|
8259
|
+
useCheckpointAction(checkpointsOrCheckpointsId, 'goForward');
|
|
8260
|
+
const useGoToCallback = (
|
|
8261
|
+
getCheckpointId,
|
|
8262
|
+
getCheckpointIdDeps = EMPTY_ARRAY,
|
|
8263
|
+
checkpointsOrCheckpointsId,
|
|
8264
|
+
then = getUndefined,
|
|
8265
|
+
thenDeps = EMPTY_ARRAY,
|
|
8266
|
+
) => {
|
|
8267
|
+
const checkpoints = useCheckpointsOrCheckpointsById(
|
|
8268
|
+
checkpointsOrCheckpointsId,
|
|
8269
|
+
);
|
|
8270
|
+
return useCallback(
|
|
8271
|
+
(parameter) =>
|
|
8272
|
+
ifNotUndefined(checkpoints, (checkpoints2) =>
|
|
8273
|
+
ifNotUndefined(getCheckpointId(parameter), (checkpointId) =>
|
|
8274
|
+
then(checkpoints2.goTo(checkpointId), checkpointId),
|
|
8275
|
+
),
|
|
8276
|
+
),
|
|
8277
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8278
|
+
[checkpoints, ...getCheckpointIdDeps, ...thenDeps],
|
|
8279
|
+
);
|
|
8280
|
+
};
|
|
8281
|
+
const useUndoInformation = (checkpointsOrCheckpointsId) => {
|
|
8282
|
+
const checkpoints = useCheckpointsOrCheckpointsById(
|
|
8283
|
+
checkpointsOrCheckpointsId,
|
|
8284
|
+
);
|
|
8285
|
+
const [backwardIds, currentId] = useCheckpointIds(checkpoints);
|
|
8286
|
+
return [
|
|
8287
|
+
!arrayIsEmpty(backwardIds),
|
|
8288
|
+
useGoBackwardCallback(checkpoints),
|
|
8289
|
+
currentId,
|
|
8290
|
+
ifNotUndefined(currentId, (id) => checkpoints?.getCheckpoint(id)) ??
|
|
8291
|
+
EMPTY_STRING,
|
|
8292
|
+
];
|
|
8293
|
+
};
|
|
8294
|
+
const useRedoInformation = (checkpointsOrCheckpointsId) => {
|
|
8295
|
+
const checkpoints = useCheckpointsOrCheckpointsById(
|
|
8296
|
+
checkpointsOrCheckpointsId,
|
|
8297
|
+
);
|
|
8298
|
+
const [, , [forwardId]] = useCheckpointIds(checkpoints);
|
|
8299
|
+
return [
|
|
8300
|
+
!isUndefined(forwardId),
|
|
8301
|
+
useGoForwardCallback(checkpoints),
|
|
8302
|
+
forwardId,
|
|
8303
|
+
ifNotUndefined(forwardId, (id) => checkpoints?.getCheckpoint(id)) ??
|
|
8304
|
+
EMPTY_STRING,
|
|
8305
|
+
];
|
|
8306
|
+
};
|
|
8307
|
+
const useCheckpointIdsListener = (
|
|
8308
|
+
listener,
|
|
8309
|
+
listenerDeps,
|
|
8310
|
+
checkpointsOrCheckpointsId,
|
|
8311
|
+
) =>
|
|
8312
|
+
useListener(
|
|
8313
|
+
CHECKPOINT + IDS,
|
|
8314
|
+
useCheckpointsOrCheckpointsById(checkpointsOrCheckpointsId),
|
|
8315
|
+
listener,
|
|
8316
|
+
listenerDeps,
|
|
8317
|
+
);
|
|
8318
|
+
const useCheckpointListener = (
|
|
8319
|
+
checkpointId,
|
|
8320
|
+
listener,
|
|
8321
|
+
listenerDeps,
|
|
8322
|
+
checkpointsOrCheckpointsId,
|
|
8323
|
+
) =>
|
|
8324
|
+
useListener(
|
|
8325
|
+
CHECKPOINT,
|
|
8326
|
+
useCheckpointsOrCheckpointsById(checkpointsOrCheckpointsId),
|
|
8327
|
+
listener,
|
|
8328
|
+
listenerDeps,
|
|
8329
|
+
[checkpointId],
|
|
8330
|
+
);
|
|
8331
|
+
const useCreatePersister = (
|
|
8332
|
+
store,
|
|
8333
|
+
create,
|
|
8334
|
+
createDeps = EMPTY_ARRAY,
|
|
8335
|
+
then,
|
|
8336
|
+
thenDeps = EMPTY_ARRAY,
|
|
8337
|
+
destroy,
|
|
8338
|
+
destroyDeps = EMPTY_ARRAY,
|
|
8339
|
+
) => {
|
|
8340
|
+
const [, rerender] = useState();
|
|
8341
|
+
const [persister, setPersister] = useState();
|
|
8342
|
+
useEffect(
|
|
8343
|
+
() => {
|
|
8344
|
+
(async () => {
|
|
8345
|
+
const persister2 = store ? await create(store) : void 0;
|
|
8346
|
+
setPersister(persister2);
|
|
8347
|
+
if (persister2 && then) {
|
|
8348
|
+
(async () => {
|
|
8349
|
+
await then(persister2);
|
|
8350
|
+
rerender([]);
|
|
8351
|
+
})();
|
|
8352
|
+
}
|
|
8353
|
+
})();
|
|
8354
|
+
},
|
|
8355
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8356
|
+
[store, ...createDeps, ...thenDeps],
|
|
8357
|
+
);
|
|
8358
|
+
useEffect(
|
|
8359
|
+
() => () => {
|
|
8360
|
+
if (persister) {
|
|
8361
|
+
persister.destroy();
|
|
8362
|
+
destroy?.(persister);
|
|
8363
|
+
}
|
|
8364
|
+
},
|
|
8365
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8366
|
+
[persister, ...destroyDeps],
|
|
8367
|
+
);
|
|
8368
|
+
return persister;
|
|
8369
|
+
};
|
|
8370
|
+
const usePersisterIds = () => useThingIds(Offsets.Persister);
|
|
8371
|
+
const usePersister = (id) => useThing(id, Offsets.Persister);
|
|
8372
|
+
const usePersisterOrPersisterById = (persisterOrPersisterId) =>
|
|
8373
|
+
useThingOrThingById(persisterOrPersisterId, Offsets.Persister);
|
|
8374
|
+
const useProvidePersister = (persisterId, persister) =>
|
|
8375
|
+
useProvideThing(persisterId, persister, Offsets.Persister);
|
|
8376
|
+
const usePersisterStatus = (persisterOrPersisterId) =>
|
|
8377
|
+
useListenable(
|
|
8378
|
+
STATUS,
|
|
8379
|
+
usePersisterOrPersisterById(persisterOrPersisterId),
|
|
8380
|
+
5 /* Number */,
|
|
8381
|
+
[],
|
|
8382
|
+
);
|
|
8383
|
+
const usePersisterStatusListener = (
|
|
8384
|
+
listener,
|
|
8385
|
+
listenerDeps,
|
|
8386
|
+
persisterOrPersisterId,
|
|
8387
|
+
) =>
|
|
8388
|
+
useListener(
|
|
8389
|
+
STATUS,
|
|
8390
|
+
usePersisterOrPersisterById(persisterOrPersisterId),
|
|
8391
|
+
listener,
|
|
8392
|
+
listenerDeps,
|
|
8393
|
+
[],
|
|
8394
|
+
);
|
|
8395
|
+
const useCreateSynchronizer = (
|
|
8396
|
+
store,
|
|
8397
|
+
create,
|
|
8398
|
+
createDeps = EMPTY_ARRAY,
|
|
8399
|
+
destroy,
|
|
8400
|
+
destroyDeps = EMPTY_ARRAY,
|
|
8401
|
+
) => {
|
|
8402
|
+
const [synchronizer, setSynchronizer] = useState();
|
|
8403
|
+
useEffect(
|
|
8404
|
+
() => {
|
|
8405
|
+
(async () => {
|
|
8406
|
+
const synchronizer2 = store ? await create(store) : void 0;
|
|
8407
|
+
setSynchronizer(synchronizer2);
|
|
8408
|
+
})();
|
|
8409
|
+
},
|
|
8410
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8411
|
+
[store, ...createDeps],
|
|
8412
|
+
);
|
|
8413
|
+
useEffect(
|
|
8414
|
+
() => () => {
|
|
8415
|
+
if (synchronizer) {
|
|
8416
|
+
synchronizer.destroy();
|
|
8417
|
+
destroy?.(synchronizer);
|
|
8418
|
+
}
|
|
8419
|
+
},
|
|
8420
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8421
|
+
[synchronizer, ...destroyDeps],
|
|
8422
|
+
);
|
|
8423
|
+
return synchronizer;
|
|
8424
|
+
};
|
|
8425
|
+
const useSynchronizerIds = () => useThingIds(Offsets.Synchronizer);
|
|
8426
|
+
const useSynchronizer = (id) => useThing(id, Offsets.Synchronizer);
|
|
8427
|
+
const useSynchronizerOrSynchronizerById = (synchronizerOrSynchronizerId) =>
|
|
8428
|
+
useThingOrThingById(synchronizerOrSynchronizerId, Offsets.Synchronizer);
|
|
8429
|
+
const useProvideSynchronizer = (persisterId, persister) =>
|
|
8430
|
+
useProvideThing(persisterId, persister, Offsets.Synchronizer);
|
|
8431
|
+
const useSynchronizerStatus = (synchronizerOrSynchronizerId) =>
|
|
8432
|
+
useListenable(
|
|
8433
|
+
STATUS,
|
|
8434
|
+
useSynchronizerOrSynchronizerById(synchronizerOrSynchronizerId),
|
|
8435
|
+
5 /* Number */,
|
|
8436
|
+
[],
|
|
8437
|
+
);
|
|
8438
|
+
const useSynchronizerStatusListener = (
|
|
8439
|
+
listener,
|
|
8440
|
+
listenerDeps,
|
|
8441
|
+
synchronizerOrSynchronizerId,
|
|
8442
|
+
) =>
|
|
8443
|
+
useListener(
|
|
8444
|
+
STATUS,
|
|
8445
|
+
useSynchronizerOrSynchronizerById(synchronizerOrSynchronizerId),
|
|
8446
|
+
listener,
|
|
8447
|
+
listenerDeps,
|
|
8448
|
+
[],
|
|
8449
|
+
);
|
|
8450
|
+
|
|
8451
|
+
const mergeParentThings = (
|
|
8452
|
+
offset,
|
|
8453
|
+
parentValue,
|
|
8454
|
+
defaultThing,
|
|
8455
|
+
thingsById,
|
|
8456
|
+
extraThingsById,
|
|
8457
|
+
) => [
|
|
8458
|
+
defaultThing ?? parentValue[offset * 2],
|
|
8459
|
+
{
|
|
8460
|
+
...parentValue[offset * 2 + 1],
|
|
8461
|
+
...thingsById,
|
|
8462
|
+
...extraThingsById[offset],
|
|
8463
|
+
},
|
|
8464
|
+
];
|
|
8465
|
+
const tableView = (
|
|
8466
|
+
{
|
|
8467
|
+
tableId,
|
|
8468
|
+
store,
|
|
8469
|
+
rowComponent: Row = RowView,
|
|
8470
|
+
getRowComponentProps,
|
|
8471
|
+
customCellIds,
|
|
8472
|
+
separator,
|
|
8473
|
+
debugIds,
|
|
8474
|
+
},
|
|
8475
|
+
rowIds,
|
|
8476
|
+
) =>
|
|
8477
|
+
wrap(
|
|
8478
|
+
arrayMap(rowIds, (rowId) =>
|
|
8479
|
+
/* @__PURE__ */ jsx(
|
|
8480
|
+
Row,
|
|
8481
|
+
{
|
|
8482
|
+
...getProps(getRowComponentProps, rowId),
|
|
8483
|
+
tableId,
|
|
8484
|
+
rowId,
|
|
8485
|
+
customCellIds,
|
|
8486
|
+
store,
|
|
8487
|
+
debugIds,
|
|
8488
|
+
},
|
|
8489
|
+
rowId,
|
|
8490
|
+
),
|
|
8491
|
+
),
|
|
8492
|
+
separator,
|
|
8493
|
+
debugIds,
|
|
8494
|
+
tableId,
|
|
8495
|
+
);
|
|
8496
|
+
const resultTableView = (
|
|
8497
|
+
{
|
|
8498
|
+
queryId,
|
|
8499
|
+
queries,
|
|
8500
|
+
resultRowComponent: ResultRow = ResultRowView,
|
|
8501
|
+
getResultRowComponentProps,
|
|
8502
|
+
separator,
|
|
8503
|
+
debugIds,
|
|
8504
|
+
},
|
|
8505
|
+
rowIds,
|
|
8506
|
+
) =>
|
|
8507
|
+
wrap(
|
|
8508
|
+
arrayMap(rowIds, (rowId) =>
|
|
8509
|
+
/* @__PURE__ */ jsx(
|
|
8510
|
+
ResultRow,
|
|
8511
|
+
{
|
|
8512
|
+
...getProps(getResultRowComponentProps, rowId),
|
|
8513
|
+
queryId,
|
|
8514
|
+
rowId,
|
|
8515
|
+
queries,
|
|
8516
|
+
debugIds,
|
|
8517
|
+
},
|
|
8518
|
+
rowId,
|
|
8519
|
+
),
|
|
8520
|
+
),
|
|
8521
|
+
separator,
|
|
8522
|
+
debugIds,
|
|
8523
|
+
queryId,
|
|
8524
|
+
);
|
|
8525
|
+
const useComponentPerRow = (
|
|
8526
|
+
{
|
|
8527
|
+
relationshipId,
|
|
8528
|
+
relationships,
|
|
8529
|
+
rowComponent: Row = RowView,
|
|
8530
|
+
getRowComponentProps,
|
|
8531
|
+
separator,
|
|
8532
|
+
debugIds,
|
|
8533
|
+
},
|
|
8534
|
+
getRowIdsHook,
|
|
8535
|
+
rowId,
|
|
8536
|
+
) => {
|
|
8537
|
+
const [resolvedRelationships, store, localTableId] =
|
|
8538
|
+
getRelationshipsStoreTableIds(
|
|
8539
|
+
useRelationshipsOrRelationshipsById(relationships),
|
|
8540
|
+
relationshipId,
|
|
8541
|
+
);
|
|
8542
|
+
const rowIds = getRowIdsHook(relationshipId, rowId, resolvedRelationships);
|
|
8543
|
+
return wrap(
|
|
8544
|
+
arrayMap(rowIds, (rowId2) =>
|
|
8545
|
+
/* @__PURE__ */ jsx(
|
|
8546
|
+
Row,
|
|
8547
|
+
{
|
|
8548
|
+
...getProps(getRowComponentProps, rowId2),
|
|
8549
|
+
tableId: localTableId,
|
|
8550
|
+
rowId: rowId2,
|
|
8551
|
+
store,
|
|
8552
|
+
debugIds,
|
|
8553
|
+
},
|
|
8554
|
+
rowId2,
|
|
8555
|
+
),
|
|
8556
|
+
),
|
|
8557
|
+
separator,
|
|
8558
|
+
debugIds,
|
|
8559
|
+
rowId,
|
|
8560
|
+
);
|
|
8561
|
+
};
|
|
8562
|
+
const getUseCheckpointView =
|
|
8563
|
+
(getCheckpoints) =>
|
|
8564
|
+
({
|
|
8565
|
+
checkpoints,
|
|
8566
|
+
checkpointComponent: Checkpoint = CheckpointView,
|
|
8567
|
+
getCheckpointComponentProps,
|
|
8568
|
+
separator,
|
|
8569
|
+
debugIds,
|
|
8570
|
+
}) => {
|
|
8571
|
+
const resolvedCheckpoints = useCheckpointsOrCheckpointsById(checkpoints);
|
|
8572
|
+
return wrap(
|
|
8573
|
+
arrayMap(
|
|
8574
|
+
getCheckpoints(useCheckpointIds(resolvedCheckpoints)),
|
|
8575
|
+
(checkpointId) =>
|
|
8576
|
+
/* @__PURE__ */ jsx(
|
|
8577
|
+
Checkpoint,
|
|
8578
|
+
{
|
|
8579
|
+
...getProps(getCheckpointComponentProps, checkpointId),
|
|
8580
|
+
checkpoints: resolvedCheckpoints,
|
|
8581
|
+
checkpointId,
|
|
8582
|
+
debugIds,
|
|
8583
|
+
},
|
|
8584
|
+
checkpointId,
|
|
8585
|
+
),
|
|
8586
|
+
),
|
|
8587
|
+
separator,
|
|
8588
|
+
);
|
|
8589
|
+
};
|
|
8590
|
+
const Provider = ({
|
|
8591
|
+
store,
|
|
8592
|
+
storesById,
|
|
8593
|
+
metrics,
|
|
8594
|
+
metricsById,
|
|
8595
|
+
indexes,
|
|
8596
|
+
indexesById,
|
|
8597
|
+
relationships,
|
|
8598
|
+
relationshipsById,
|
|
8599
|
+
queries,
|
|
8600
|
+
queriesById,
|
|
8601
|
+
checkpoints,
|
|
8602
|
+
checkpointsById,
|
|
8603
|
+
persister,
|
|
8604
|
+
persistersById,
|
|
8605
|
+
synchronizer,
|
|
8606
|
+
synchronizersById,
|
|
8607
|
+
children,
|
|
8608
|
+
}) => {
|
|
8609
|
+
const parentValue = useContext(Context);
|
|
8610
|
+
const [extraThingsById, setExtraThingsById] = useState(() =>
|
|
8611
|
+
arrayNew(8, () => ({})),
|
|
8612
|
+
);
|
|
8613
|
+
const addExtraThingById = useCallback(
|
|
8614
|
+
(thingOffset, id, thing) =>
|
|
8615
|
+
setExtraThingsById((extraThingsById2) =>
|
|
8616
|
+
objGet(extraThingsById2[thingOffset], id) == thing
|
|
8617
|
+
? extraThingsById2
|
|
8618
|
+
: arrayWith(extraThingsById2, thingOffset, {
|
|
8619
|
+
...extraThingsById2[thingOffset],
|
|
8620
|
+
[id]: thing,
|
|
8621
|
+
}),
|
|
8622
|
+
),
|
|
8623
|
+
[],
|
|
8624
|
+
);
|
|
8625
|
+
const delExtraThingById = useCallback(
|
|
8626
|
+
(thingOffset, id) =>
|
|
8627
|
+
setExtraThingsById((extraThingsById2) =>
|
|
8628
|
+
!objHas(extraThingsById2[thingOffset], id)
|
|
8629
|
+
? extraThingsById2
|
|
8630
|
+
: arrayWith(
|
|
8631
|
+
extraThingsById2,
|
|
8632
|
+
thingOffset,
|
|
8633
|
+
objDel(extraThingsById2[thingOffset], id),
|
|
8634
|
+
),
|
|
8635
|
+
),
|
|
8636
|
+
[],
|
|
8637
|
+
);
|
|
8638
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
8639
|
+
value: useMemo(
|
|
8640
|
+
() => [
|
|
8641
|
+
...mergeParentThings(
|
|
8642
|
+
0 /* Store */,
|
|
8643
|
+
parentValue,
|
|
8644
|
+
store,
|
|
8645
|
+
storesById,
|
|
8646
|
+
extraThingsById,
|
|
8647
|
+
),
|
|
8648
|
+
...mergeParentThings(
|
|
8649
|
+
1 /* Metrics */,
|
|
8650
|
+
parentValue,
|
|
8651
|
+
metrics,
|
|
8652
|
+
metricsById,
|
|
8653
|
+
extraThingsById,
|
|
8654
|
+
),
|
|
8655
|
+
...mergeParentThings(
|
|
8656
|
+
2 /* Indexes */,
|
|
8657
|
+
parentValue,
|
|
8658
|
+
indexes,
|
|
8659
|
+
indexesById,
|
|
8660
|
+
extraThingsById,
|
|
8661
|
+
),
|
|
8662
|
+
...mergeParentThings(
|
|
8663
|
+
3 /* Relationships */,
|
|
8664
|
+
parentValue,
|
|
8665
|
+
relationships,
|
|
8666
|
+
relationshipsById,
|
|
8667
|
+
extraThingsById,
|
|
8668
|
+
),
|
|
8669
|
+
...mergeParentThings(
|
|
8670
|
+
4 /* Queries */,
|
|
8671
|
+
parentValue,
|
|
8672
|
+
queries,
|
|
8673
|
+
queriesById,
|
|
8674
|
+
extraThingsById,
|
|
8675
|
+
),
|
|
8676
|
+
...mergeParentThings(
|
|
8677
|
+
5 /* Checkpoints */,
|
|
8678
|
+
parentValue,
|
|
8679
|
+
checkpoints,
|
|
8680
|
+
checkpointsById,
|
|
8681
|
+
extraThingsById,
|
|
8682
|
+
),
|
|
8683
|
+
...mergeParentThings(
|
|
8684
|
+
6 /* Persister */,
|
|
8685
|
+
parentValue,
|
|
8686
|
+
persister,
|
|
8687
|
+
persistersById,
|
|
8688
|
+
extraThingsById,
|
|
8689
|
+
),
|
|
8690
|
+
...mergeParentThings(
|
|
8691
|
+
7 /* Synchronizer */,
|
|
8692
|
+
parentValue,
|
|
8693
|
+
synchronizer,
|
|
8694
|
+
synchronizersById,
|
|
8695
|
+
extraThingsById,
|
|
8696
|
+
),
|
|
8697
|
+
addExtraThingById,
|
|
8698
|
+
delExtraThingById,
|
|
8699
|
+
],
|
|
8700
|
+
[
|
|
8701
|
+
extraThingsById,
|
|
8702
|
+
store,
|
|
8703
|
+
storesById,
|
|
8704
|
+
metrics,
|
|
8705
|
+
metricsById,
|
|
8706
|
+
indexes,
|
|
8707
|
+
indexesById,
|
|
8708
|
+
relationships,
|
|
8709
|
+
relationshipsById,
|
|
8710
|
+
queries,
|
|
8711
|
+
queriesById,
|
|
8712
|
+
checkpoints,
|
|
8713
|
+
checkpointsById,
|
|
8714
|
+
persister,
|
|
8715
|
+
persistersById,
|
|
8716
|
+
synchronizer,
|
|
8717
|
+
synchronizersById,
|
|
8718
|
+
parentValue,
|
|
8719
|
+
addExtraThingById,
|
|
8720
|
+
delExtraThingById,
|
|
8721
|
+
],
|
|
8722
|
+
),
|
|
8723
|
+
children,
|
|
8724
|
+
});
|
|
8725
|
+
};
|
|
8726
|
+
const wrap = (children, separator, encloseWithId, id) => {
|
|
8727
|
+
const separated =
|
|
8728
|
+
isUndefined(separator) || !isArray(children)
|
|
8729
|
+
? children
|
|
8730
|
+
: arrayMap(children, (child, c) => (c > 0 ? [separator, child] : child));
|
|
8731
|
+
return encloseWithId ? [id, ':{', separated, '}'] : separated;
|
|
8732
|
+
};
|
|
8733
|
+
const useCustomOrDefaultCellIds = (customCellIds, tableId, rowId, store) => {
|
|
8734
|
+
const defaultCellIds = useCellIds(tableId, rowId, store);
|
|
8735
|
+
return customCellIds ?? defaultCellIds;
|
|
8736
|
+
};
|
|
8737
|
+
const CellView = ({tableId, rowId, cellId, store, debugIds}) =>
|
|
8738
|
+
wrap(
|
|
8739
|
+
EMPTY_STRING + (useCell(tableId, rowId, cellId, store) ?? EMPTY_STRING),
|
|
8740
|
+
void 0,
|
|
8741
|
+
debugIds,
|
|
8742
|
+
cellId,
|
|
8743
|
+
);
|
|
8744
|
+
const RowView = ({
|
|
8745
|
+
tableId,
|
|
8746
|
+
rowId,
|
|
8747
|
+
store,
|
|
8748
|
+
cellComponent: Cell = CellView,
|
|
8749
|
+
getCellComponentProps,
|
|
8750
|
+
customCellIds,
|
|
8751
|
+
separator,
|
|
8752
|
+
debugIds,
|
|
8753
|
+
}) =>
|
|
8754
|
+
wrap(
|
|
8755
|
+
arrayMap(
|
|
8756
|
+
useCustomOrDefaultCellIds(customCellIds, tableId, rowId, store),
|
|
8757
|
+
(cellId) =>
|
|
8758
|
+
/* @__PURE__ */ jsx(
|
|
8759
|
+
Cell,
|
|
8760
|
+
{
|
|
8761
|
+
...getProps(getCellComponentProps, cellId),
|
|
8762
|
+
tableId,
|
|
8763
|
+
rowId,
|
|
8764
|
+
cellId,
|
|
8765
|
+
store,
|
|
8766
|
+
debugIds,
|
|
8767
|
+
},
|
|
8768
|
+
cellId,
|
|
8769
|
+
),
|
|
8770
|
+
),
|
|
8771
|
+
separator,
|
|
8772
|
+
debugIds,
|
|
8773
|
+
rowId,
|
|
8774
|
+
);
|
|
8775
|
+
const TableView$1 = (props) =>
|
|
8776
|
+
tableView(props, useRowIds(props.tableId, props.store));
|
|
8777
|
+
const SortedTableView = ({cellId, descending, offset, limit, ...props}) =>
|
|
8778
|
+
tableView(
|
|
8779
|
+
props,
|
|
8780
|
+
useSortedRowIds(
|
|
8781
|
+
props.tableId,
|
|
8782
|
+
cellId,
|
|
8783
|
+
descending,
|
|
8784
|
+
offset,
|
|
8785
|
+
limit,
|
|
8786
|
+
props.store,
|
|
8787
|
+
),
|
|
8788
|
+
);
|
|
8789
|
+
const TablesView = ({
|
|
8790
|
+
store,
|
|
8791
|
+
tableComponent: Table = TableView$1,
|
|
8792
|
+
getTableComponentProps,
|
|
8793
|
+
separator,
|
|
8794
|
+
debugIds,
|
|
8795
|
+
}) =>
|
|
8796
|
+
wrap(
|
|
8797
|
+
arrayMap(useTableIds(store), (tableId) =>
|
|
8798
|
+
/* @__PURE__ */ jsx(
|
|
8799
|
+
Table,
|
|
8800
|
+
{
|
|
8801
|
+
...getProps(getTableComponentProps, tableId),
|
|
8802
|
+
tableId,
|
|
8803
|
+
store,
|
|
8804
|
+
debugIds,
|
|
8805
|
+
},
|
|
8806
|
+
tableId,
|
|
8807
|
+
),
|
|
8808
|
+
),
|
|
8809
|
+
separator,
|
|
8810
|
+
);
|
|
8811
|
+
const ValueView = ({valueId, store, debugIds}) =>
|
|
8812
|
+
wrap(
|
|
8813
|
+
EMPTY_STRING + (useValue(valueId, store) ?? EMPTY_STRING),
|
|
8814
|
+
void 0,
|
|
8815
|
+
debugIds,
|
|
8816
|
+
valueId,
|
|
8817
|
+
);
|
|
8818
|
+
const ValuesView$1 = ({
|
|
8819
|
+
store,
|
|
8820
|
+
valueComponent: Value = ValueView,
|
|
8821
|
+
getValueComponentProps,
|
|
8822
|
+
separator,
|
|
8823
|
+
debugIds,
|
|
8824
|
+
}) =>
|
|
8825
|
+
wrap(
|
|
8826
|
+
arrayMap(useValueIds(store), (valueId) =>
|
|
8827
|
+
/* @__PURE__ */ jsx(
|
|
8828
|
+
Value,
|
|
8829
|
+
{
|
|
8830
|
+
...getProps(getValueComponentProps, valueId),
|
|
8831
|
+
valueId,
|
|
8832
|
+
store,
|
|
8833
|
+
debugIds,
|
|
8834
|
+
},
|
|
8835
|
+
valueId,
|
|
8836
|
+
),
|
|
8837
|
+
),
|
|
8838
|
+
separator,
|
|
8839
|
+
);
|
|
8840
|
+
const MetricView = ({metricId, metrics, debugIds}) =>
|
|
8841
|
+
wrap(
|
|
8842
|
+
useMetric(metricId, metrics) ?? EMPTY_STRING,
|
|
8843
|
+
void 0,
|
|
8844
|
+
debugIds,
|
|
8845
|
+
metricId,
|
|
8846
|
+
);
|
|
8847
|
+
const SliceView$1 = ({
|
|
8848
|
+
indexId,
|
|
8849
|
+
sliceId,
|
|
8850
|
+
indexes,
|
|
8851
|
+
rowComponent: Row = RowView,
|
|
8852
|
+
getRowComponentProps,
|
|
8853
|
+
separator,
|
|
8854
|
+
debugIds,
|
|
8855
|
+
}) => {
|
|
8856
|
+
const [resolvedIndexes, store, tableId] = getIndexStoreTableId(
|
|
8857
|
+
useIndexesOrIndexesById(indexes),
|
|
8858
|
+
indexId,
|
|
8859
|
+
);
|
|
8860
|
+
const rowIds = useSliceRowIds(indexId, sliceId, resolvedIndexes);
|
|
8861
|
+
return wrap(
|
|
8862
|
+
arrayMap(rowIds, (rowId) =>
|
|
8863
|
+
/* @__PURE__ */ jsx(
|
|
8864
|
+
Row,
|
|
8865
|
+
{
|
|
8866
|
+
...getProps(getRowComponentProps, rowId),
|
|
8867
|
+
tableId,
|
|
8868
|
+
rowId,
|
|
8869
|
+
store,
|
|
8870
|
+
debugIds,
|
|
8871
|
+
},
|
|
8872
|
+
rowId,
|
|
8873
|
+
),
|
|
8874
|
+
),
|
|
8875
|
+
separator,
|
|
8876
|
+
debugIds,
|
|
8877
|
+
sliceId,
|
|
8878
|
+
);
|
|
8879
|
+
};
|
|
8880
|
+
const IndexView$1 = ({
|
|
8881
|
+
indexId,
|
|
8882
|
+
indexes,
|
|
8883
|
+
sliceComponent: Slice = SliceView$1,
|
|
8884
|
+
getSliceComponentProps,
|
|
8885
|
+
separator,
|
|
8886
|
+
debugIds,
|
|
8887
|
+
}) =>
|
|
8888
|
+
wrap(
|
|
8889
|
+
arrayMap(useSliceIds(indexId, indexes), (sliceId) =>
|
|
8890
|
+
/* @__PURE__ */ jsx(
|
|
8891
|
+
Slice,
|
|
8892
|
+
{
|
|
8893
|
+
...getProps(getSliceComponentProps, sliceId),
|
|
8894
|
+
indexId,
|
|
8895
|
+
sliceId,
|
|
8896
|
+
indexes,
|
|
8897
|
+
debugIds,
|
|
8898
|
+
},
|
|
8899
|
+
sliceId,
|
|
8900
|
+
),
|
|
8901
|
+
),
|
|
8902
|
+
separator,
|
|
8903
|
+
debugIds,
|
|
8904
|
+
indexId,
|
|
8905
|
+
);
|
|
8906
|
+
const RemoteRowView = ({
|
|
8907
|
+
relationshipId,
|
|
8908
|
+
localRowId,
|
|
8909
|
+
relationships,
|
|
8910
|
+
rowComponent: Row = RowView,
|
|
8911
|
+
getRowComponentProps,
|
|
8912
|
+
debugIds,
|
|
8913
|
+
}) => {
|
|
8914
|
+
const [resolvedRelationships, store, , remoteTableId] =
|
|
8915
|
+
getRelationshipsStoreTableIds(
|
|
8916
|
+
useRelationshipsOrRelationshipsById(relationships),
|
|
8917
|
+
relationshipId,
|
|
8918
|
+
);
|
|
8919
|
+
const rowId = useRemoteRowId(
|
|
8920
|
+
relationshipId,
|
|
8921
|
+
localRowId,
|
|
8922
|
+
resolvedRelationships,
|
|
8923
|
+
);
|
|
8924
|
+
return wrap(
|
|
8925
|
+
isUndefined(remoteTableId) || isUndefined(rowId)
|
|
8926
|
+
? null
|
|
8927
|
+
: /* @__PURE__ */ jsx(
|
|
8928
|
+
Row,
|
|
8929
|
+
{
|
|
8930
|
+
...getProps(getRowComponentProps, rowId),
|
|
8931
|
+
tableId: remoteTableId,
|
|
8932
|
+
rowId,
|
|
8933
|
+
store,
|
|
8934
|
+
debugIds,
|
|
8935
|
+
},
|
|
8936
|
+
rowId,
|
|
8937
|
+
),
|
|
8938
|
+
void 0,
|
|
8939
|
+
debugIds,
|
|
8940
|
+
localRowId,
|
|
8941
|
+
);
|
|
8942
|
+
};
|
|
8943
|
+
const LocalRowsView = (props) =>
|
|
8944
|
+
useComponentPerRow(props, useLocalRowIds, props.remoteRowId);
|
|
8945
|
+
const LinkedRowsView = (props) =>
|
|
8946
|
+
useComponentPerRow(props, useLinkedRowIds, props.firstRowId);
|
|
8947
|
+
const ResultCellView = ({queryId, rowId, cellId, queries, debugIds}) =>
|
|
8948
|
+
wrap(
|
|
8949
|
+
EMPTY_STRING +
|
|
8950
|
+
(useResultCell(queryId, rowId, cellId, queries) ?? EMPTY_STRING),
|
|
8951
|
+
void 0,
|
|
8952
|
+
debugIds,
|
|
8953
|
+
cellId,
|
|
8954
|
+
);
|
|
8955
|
+
const ResultRowView = ({
|
|
8956
|
+
queryId,
|
|
8957
|
+
rowId,
|
|
8958
|
+
queries,
|
|
8959
|
+
resultCellComponent: ResultCell = ResultCellView,
|
|
8960
|
+
getResultCellComponentProps,
|
|
8961
|
+
separator,
|
|
8962
|
+
debugIds,
|
|
8963
|
+
}) =>
|
|
8964
|
+
wrap(
|
|
8965
|
+
arrayMap(useResultCellIds(queryId, rowId, queries), (cellId) =>
|
|
8966
|
+
/* @__PURE__ */ jsx(
|
|
8967
|
+
ResultCell,
|
|
8968
|
+
{
|
|
8969
|
+
...getProps(getResultCellComponentProps, cellId),
|
|
8970
|
+
queryId,
|
|
8971
|
+
rowId,
|
|
8972
|
+
cellId,
|
|
8973
|
+
queries,
|
|
8974
|
+
debugIds,
|
|
8975
|
+
},
|
|
8976
|
+
cellId,
|
|
8977
|
+
),
|
|
8978
|
+
),
|
|
8979
|
+
separator,
|
|
8980
|
+
debugIds,
|
|
8981
|
+
rowId,
|
|
8982
|
+
);
|
|
8983
|
+
const ResultTableView = (props) =>
|
|
8984
|
+
resultTableView(props, useResultRowIds(props.queryId, props.queries));
|
|
8985
|
+
const ResultSortedTableView = ({cellId, descending, offset, limit, ...props}) =>
|
|
8986
|
+
resultTableView(
|
|
8987
|
+
props,
|
|
8988
|
+
useResultSortedRowIds(
|
|
8989
|
+
props.queryId,
|
|
8990
|
+
cellId,
|
|
8991
|
+
descending,
|
|
8992
|
+
offset,
|
|
8993
|
+
limit,
|
|
8994
|
+
props.queries,
|
|
8995
|
+
),
|
|
8996
|
+
);
|
|
8997
|
+
const CheckpointView = ({checkpoints, checkpointId, debugIds}) =>
|
|
8998
|
+
wrap(
|
|
8999
|
+
useCheckpoint(checkpointId, checkpoints) ?? EMPTY_STRING,
|
|
9000
|
+
void 0,
|
|
9001
|
+
debugIds,
|
|
9002
|
+
checkpointId,
|
|
9003
|
+
);
|
|
9004
|
+
const BackwardCheckpointsView = getUseCheckpointView(
|
|
9005
|
+
(checkpointIds) => checkpointIds[0],
|
|
9006
|
+
);
|
|
9007
|
+
const CurrentCheckpointView = getUseCheckpointView((checkpointIds) =>
|
|
9008
|
+
isUndefined(checkpointIds[1]) ? [] : [checkpointIds[1]],
|
|
9009
|
+
);
|
|
9010
|
+
const ForwardCheckpointsView = getUseCheckpointView(
|
|
9011
|
+
(checkpointIds) => checkpointIds[2],
|
|
9012
|
+
);
|
|
9013
|
+
|
|
9014
|
+
const EDITABLE = 'editable';
|
|
9015
|
+
const LEFT_ARROW = '\u2190';
|
|
9016
|
+
const UP_ARROW = '\u2191';
|
|
9017
|
+
const RIGHT_ARROW = '\u2192';
|
|
9018
|
+
const DOWN_ARROW = '\u2193';
|
|
9019
|
+
const useDottedCellIds = (tableId, store) =>
|
|
9020
|
+
arrayMap(useTableCellIds(tableId, store), (cellId) => tableId + DOT + cellId);
|
|
9021
|
+
const useCallbackOrUndefined = (callback, deps, test) => {
|
|
9022
|
+
const returnCallback = useCallback(callback, deps);
|
|
9023
|
+
return test ? returnCallback : void 0;
|
|
9024
|
+
};
|
|
9025
|
+
const useParams = (...args) =>
|
|
9026
|
+
useMemo(
|
|
9027
|
+
() => args,
|
|
9028
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9029
|
+
args,
|
|
9030
|
+
);
|
|
9031
|
+
const useStoreCellComponentProps = (store, tableId) =>
|
|
9032
|
+
useMemo(() => ({store, tableId}), [store, tableId]);
|
|
9033
|
+
const useQueriesCellComponentProps = (queries, queryId) =>
|
|
9034
|
+
useMemo(() => ({queries, queryId}), [queries, queryId]);
|
|
9035
|
+
const useSortingAndPagination = (
|
|
9036
|
+
cellId,
|
|
9037
|
+
descending = false,
|
|
9038
|
+
sortOnClick,
|
|
9039
|
+
offset = 0,
|
|
9040
|
+
limit,
|
|
9041
|
+
total,
|
|
9042
|
+
paginator,
|
|
9043
|
+
onChange,
|
|
9044
|
+
) => {
|
|
9045
|
+
const [[currentCellId, currentDescending, currentOffset], setState] =
|
|
9046
|
+
useState([cellId, descending, offset]);
|
|
9047
|
+
const setStateAndChange = useCallback(
|
|
9048
|
+
(sortAndOffset) => {
|
|
9049
|
+
setState(sortAndOffset);
|
|
9050
|
+
onChange?.(sortAndOffset);
|
|
9051
|
+
},
|
|
9052
|
+
[onChange],
|
|
9053
|
+
);
|
|
9054
|
+
const handleSort = useCallbackOrUndefined(
|
|
9055
|
+
(cellId2) =>
|
|
9056
|
+
setStateAndChange([
|
|
9057
|
+
cellId2,
|
|
9058
|
+
cellId2 == currentCellId ? !currentDescending : false,
|
|
9059
|
+
currentOffset,
|
|
9060
|
+
]),
|
|
9061
|
+
[setStateAndChange, currentCellId, currentDescending, currentOffset],
|
|
9062
|
+
sortOnClick,
|
|
9063
|
+
);
|
|
9064
|
+
const handleChangeOffset = useCallback(
|
|
9065
|
+
(offset2) => setStateAndChange([currentCellId, currentDescending, offset2]),
|
|
9066
|
+
[setStateAndChange, currentCellId, currentDescending],
|
|
9067
|
+
);
|
|
9068
|
+
const PaginatorComponent =
|
|
9069
|
+
paginator === true ? SortedTablePaginator : paginator;
|
|
9070
|
+
return [
|
|
9071
|
+
[currentCellId, currentDescending, currentOffset],
|
|
9072
|
+
handleSort,
|
|
9073
|
+
useMemo(
|
|
9074
|
+
() =>
|
|
9075
|
+
paginator === false
|
|
9076
|
+
? null
|
|
9077
|
+
: /* @__PURE__ */ jsx(PaginatorComponent, {
|
|
9078
|
+
offset: currentOffset,
|
|
9079
|
+
limit,
|
|
9080
|
+
total,
|
|
9081
|
+
onChange: handleChangeOffset,
|
|
9082
|
+
}),
|
|
9083
|
+
[
|
|
9084
|
+
paginator,
|
|
9085
|
+
PaginatorComponent,
|
|
9086
|
+
currentOffset,
|
|
9087
|
+
limit,
|
|
9088
|
+
total,
|
|
9089
|
+
handleChangeOffset,
|
|
9090
|
+
],
|
|
9091
|
+
),
|
|
9092
|
+
];
|
|
9093
|
+
};
|
|
9094
|
+
const useCells = (defaultCellIds, customCells, defaultCellComponent) =>
|
|
9095
|
+
useMemo(() => {
|
|
9096
|
+
const cellIds = customCells ?? defaultCellIds;
|
|
9097
|
+
return objMap(
|
|
9098
|
+
isArray(cellIds)
|
|
9099
|
+
? objNew(arrayMap(cellIds, (cellId) => [cellId, cellId]))
|
|
9100
|
+
: cellIds,
|
|
9101
|
+
(labelOrCustomCell, cellId) => ({
|
|
9102
|
+
...{label: cellId, component: defaultCellComponent},
|
|
9103
|
+
...(isString(labelOrCustomCell)
|
|
9104
|
+
? {label: labelOrCustomCell}
|
|
9105
|
+
: labelOrCustomCell),
|
|
9106
|
+
}),
|
|
9107
|
+
);
|
|
9108
|
+
}, [customCells, defaultCellComponent, defaultCellIds]);
|
|
9109
|
+
const HtmlTable = ({
|
|
9110
|
+
className,
|
|
9111
|
+
headerRow,
|
|
9112
|
+
idColumn,
|
|
9113
|
+
params: [
|
|
9114
|
+
cells,
|
|
9115
|
+
cellComponentProps,
|
|
9116
|
+
rowIds,
|
|
9117
|
+
sortAndOffset,
|
|
9118
|
+
handleSort,
|
|
9119
|
+
paginatorComponent,
|
|
9120
|
+
],
|
|
9121
|
+
}) =>
|
|
9122
|
+
/* @__PURE__ */ jsxs('table', {
|
|
9123
|
+
className,
|
|
9124
|
+
children: [
|
|
9125
|
+
paginatorComponent
|
|
9126
|
+
? /* @__PURE__ */ jsx('caption', {children: paginatorComponent})
|
|
9127
|
+
: null,
|
|
9128
|
+
headerRow === false
|
|
9129
|
+
? null
|
|
9130
|
+
: /* @__PURE__ */ jsx('thead', {
|
|
9131
|
+
children: /* @__PURE__ */ jsxs('tr', {
|
|
9132
|
+
children: [
|
|
9133
|
+
idColumn === false
|
|
9134
|
+
? null
|
|
9135
|
+
: /* @__PURE__ */ jsx(HtmlHeaderCell, {
|
|
9136
|
+
sort: sortAndOffset ?? [],
|
|
9137
|
+
label: 'Id',
|
|
9138
|
+
onClick: handleSort,
|
|
9139
|
+
}),
|
|
9140
|
+
objToArray(cells, ({label}, cellId) =>
|
|
9141
|
+
/* @__PURE__ */ jsx(
|
|
9142
|
+
HtmlHeaderCell,
|
|
9143
|
+
{
|
|
9144
|
+
cellId,
|
|
9145
|
+
label,
|
|
9146
|
+
sort: sortAndOffset ?? [],
|
|
9147
|
+
onClick: handleSort,
|
|
9148
|
+
},
|
|
9149
|
+
cellId,
|
|
9150
|
+
),
|
|
9151
|
+
),
|
|
9152
|
+
],
|
|
9153
|
+
}),
|
|
9154
|
+
}),
|
|
9155
|
+
/* @__PURE__ */ jsx('tbody', {
|
|
9156
|
+
children: arrayMap(rowIds, (rowId) =>
|
|
9157
|
+
/* @__PURE__ */ jsxs(
|
|
9158
|
+
'tr',
|
|
9159
|
+
{
|
|
9160
|
+
children: [
|
|
9161
|
+
idColumn === false
|
|
9162
|
+
? null
|
|
9163
|
+
: /* @__PURE__ */ jsx('th', {children: rowId}),
|
|
9164
|
+
objToArray(
|
|
9165
|
+
cells,
|
|
9166
|
+
({component: CellView2, getComponentProps}, cellId) =>
|
|
9167
|
+
/* @__PURE__ */ jsx(
|
|
9168
|
+
'td',
|
|
9169
|
+
{
|
|
9170
|
+
children: /* @__PURE__ */ jsx(CellView2, {
|
|
9171
|
+
...getProps(getComponentProps, rowId, cellId),
|
|
9172
|
+
...cellComponentProps,
|
|
9173
|
+
rowId,
|
|
9174
|
+
cellId,
|
|
9175
|
+
}),
|
|
9176
|
+
},
|
|
9177
|
+
cellId,
|
|
9178
|
+
),
|
|
9179
|
+
),
|
|
9180
|
+
],
|
|
9181
|
+
},
|
|
9182
|
+
rowId,
|
|
9183
|
+
),
|
|
9184
|
+
),
|
|
9185
|
+
}),
|
|
9186
|
+
],
|
|
9187
|
+
});
|
|
9188
|
+
const HtmlHeaderCell = ({
|
|
9189
|
+
cellId,
|
|
9190
|
+
sort: [sortCellId, sortDescending],
|
|
9191
|
+
label = cellId ?? EMPTY_STRING,
|
|
9192
|
+
onClick,
|
|
9193
|
+
}) =>
|
|
9194
|
+
/* @__PURE__ */ jsxs('th', {
|
|
9195
|
+
onClick: useCallbackOrUndefined(
|
|
9196
|
+
() => onClick?.(cellId),
|
|
9197
|
+
[onClick, cellId],
|
|
9198
|
+
onClick,
|
|
9199
|
+
),
|
|
9200
|
+
className:
|
|
9201
|
+
isUndefined(sortDescending) || sortCellId != cellId
|
|
9202
|
+
? void 0
|
|
9203
|
+
: `sorted ${sortDescending ? 'de' : 'a'}scending`,
|
|
9204
|
+
children: [
|
|
9205
|
+
isUndefined(sortDescending) || sortCellId != cellId
|
|
9206
|
+
? null
|
|
9207
|
+
: (sortDescending ? DOWN_ARROW : UP_ARROW) + ' ',
|
|
7194
9208
|
label,
|
|
7195
9209
|
],
|
|
7196
9210
|
});
|
|
@@ -8350,7 +10364,10 @@ const Inspector = ({position = 'right', open = false}) => {
|
|
|
8350
10364
|
};
|
|
8351
10365
|
|
|
8352
10366
|
export {
|
|
10367
|
+
BackwardCheckpointsView,
|
|
8353
10368
|
broadcastChanges,
|
|
10369
|
+
CellView,
|
|
10370
|
+
CheckpointView,
|
|
8354
10371
|
createAutomergePersister,
|
|
8355
10372
|
createBroadcastChannelSynchronizer,
|
|
8356
10373
|
createCheckpoints,
|
|
@@ -8386,28 +10403,194 @@ export {
|
|
|
8386
10403
|
createWsServerSimple,
|
|
8387
10404
|
createWsSynchronizer,
|
|
8388
10405
|
createYjsPersister,
|
|
10406
|
+
CurrentCheckpointView,
|
|
8389
10407
|
defaultSorter,
|
|
8390
10408
|
EditableCellView,
|
|
8391
10409
|
EditableValueView,
|
|
10410
|
+
ForwardCheckpointsView,
|
|
8392
10411
|
getHlcFunctions,
|
|
8393
10412
|
getRandomValues,
|
|
8394
10413
|
getUniqueId$1 as getUniqueId,
|
|
8395
10414
|
getWsServerDurableObjectFetch,
|
|
8396
10415
|
hasStoreInStorage,
|
|
10416
|
+
IndexView$1 as IndexView,
|
|
8397
10417
|
Inspector,
|
|
10418
|
+
LinkedRowsView,
|
|
8398
10419
|
loadStoreFromStorage,
|
|
10420
|
+
LocalRowsView,
|
|
8399
10421
|
Message,
|
|
10422
|
+
MetricView,
|
|
8400
10423
|
objectStoreMatch,
|
|
8401
10424
|
Persists,
|
|
10425
|
+
Provider,
|
|
8402
10426
|
RelationshipInHtmlTable,
|
|
10427
|
+
RemoteRowView,
|
|
10428
|
+
ResultCellView,
|
|
10429
|
+
ResultRowView,
|
|
8403
10430
|
ResultSortedTableInHtmlTable,
|
|
10431
|
+
ResultSortedTableView,
|
|
8404
10432
|
ResultTableInHtmlTable,
|
|
10433
|
+
ResultTableView,
|
|
10434
|
+
RowView,
|
|
8405
10435
|
SliceInHtmlTable,
|
|
10436
|
+
SliceView$1 as SliceView,
|
|
8406
10437
|
SortedTableInHtmlTable,
|
|
8407
10438
|
SortedTablePaginator,
|
|
10439
|
+
SortedTableView,
|
|
8408
10440
|
Status,
|
|
8409
10441
|
TableInHtmlTable,
|
|
10442
|
+
TablesView,
|
|
10443
|
+
TableView$1 as TableView,
|
|
8410
10444
|
TinyBasePartyKitServer,
|
|
10445
|
+
useAddRowCallback,
|
|
10446
|
+
useCell,
|
|
10447
|
+
useCellIds,
|
|
10448
|
+
useCellIdsListener,
|
|
10449
|
+
useCellListener,
|
|
10450
|
+
useCheckpoint,
|
|
10451
|
+
useCheckpointIds,
|
|
10452
|
+
useCheckpointIdsListener,
|
|
10453
|
+
useCheckpointListener,
|
|
10454
|
+
useCheckpoints,
|
|
10455
|
+
useCheckpointsIds,
|
|
10456
|
+
useCheckpointsOrCheckpointsById,
|
|
10457
|
+
useCreateCheckpoints,
|
|
10458
|
+
useCreateIndexes,
|
|
10459
|
+
useCreateMergeableStore,
|
|
10460
|
+
useCreateMetrics,
|
|
10461
|
+
useCreatePersister,
|
|
10462
|
+
useCreateQueries,
|
|
10463
|
+
useCreateRelationships,
|
|
10464
|
+
useCreateStore,
|
|
10465
|
+
useCreateSynchronizer,
|
|
10466
|
+
useDelCellCallback,
|
|
10467
|
+
useDelRowCallback,
|
|
10468
|
+
useDelTableCallback,
|
|
10469
|
+
useDelTablesCallback,
|
|
10470
|
+
useDelValueCallback,
|
|
10471
|
+
useDelValuesCallback,
|
|
10472
|
+
useDidFinishTransactionListener,
|
|
10473
|
+
useGoBackwardCallback,
|
|
10474
|
+
useGoForwardCallback,
|
|
10475
|
+
useGoToCallback,
|
|
10476
|
+
useHasCell,
|
|
10477
|
+
useHasCellListener,
|
|
10478
|
+
useHasRow,
|
|
10479
|
+
useHasRowListener,
|
|
10480
|
+
useHasTable,
|
|
10481
|
+
useHasTableCell,
|
|
10482
|
+
useHasTableCellListener,
|
|
10483
|
+
useHasTableListener,
|
|
10484
|
+
useHasTables,
|
|
10485
|
+
useHasTablesListener,
|
|
10486
|
+
useHasValue,
|
|
10487
|
+
useHasValueListener,
|
|
10488
|
+
useHasValues,
|
|
10489
|
+
useHasValuesListener,
|
|
10490
|
+
useIndexes,
|
|
10491
|
+
useIndexesIds,
|
|
10492
|
+
useIndexesOrIndexesById,
|
|
10493
|
+
useIndexIds,
|
|
10494
|
+
useLinkedRowIds,
|
|
10495
|
+
useLinkedRowIdsListener,
|
|
10496
|
+
useLocalRowIds,
|
|
10497
|
+
useLocalRowIdsListener,
|
|
10498
|
+
useMetric,
|
|
10499
|
+
useMetricIds,
|
|
10500
|
+
useMetricListener,
|
|
10501
|
+
useMetrics,
|
|
10502
|
+
useMetricsIds,
|
|
10503
|
+
useMetricsOrMetricsById,
|
|
10504
|
+
usePersister,
|
|
10505
|
+
usePersisterIds,
|
|
10506
|
+
usePersisterOrPersisterById,
|
|
10507
|
+
usePersisterStatus,
|
|
10508
|
+
usePersisterStatusListener,
|
|
10509
|
+
useProvideCheckpoints,
|
|
10510
|
+
useProvideIndexes,
|
|
10511
|
+
useProvideMetrics,
|
|
10512
|
+
useProvidePersister,
|
|
10513
|
+
useProvideQueries,
|
|
10514
|
+
useProvideRelationships,
|
|
10515
|
+
useProvideStore,
|
|
10516
|
+
useProvideSynchronizer,
|
|
10517
|
+
useQueries,
|
|
10518
|
+
useQueriesIds,
|
|
10519
|
+
useQueriesOrQueriesById,
|
|
10520
|
+
useQueryIds,
|
|
10521
|
+
useRedoInformation,
|
|
10522
|
+
useRelationshipIds,
|
|
10523
|
+
useRelationships,
|
|
10524
|
+
useRelationshipsIds,
|
|
10525
|
+
useRelationshipsOrRelationshipsById,
|
|
10526
|
+
useRemoteRowId,
|
|
10527
|
+
useRemoteRowIdListener,
|
|
10528
|
+
useResultCell,
|
|
10529
|
+
useResultCellIds,
|
|
10530
|
+
useResultCellIdsListener,
|
|
10531
|
+
useResultCellListener,
|
|
10532
|
+
useResultRow,
|
|
10533
|
+
useResultRowCount,
|
|
10534
|
+
useResultRowCountListener,
|
|
10535
|
+
useResultRowIds,
|
|
10536
|
+
useResultRowIdsListener,
|
|
10537
|
+
useResultRowListener,
|
|
10538
|
+
useResultSortedRowIds,
|
|
10539
|
+
useResultSortedRowIdsListener,
|
|
10540
|
+
useResultTable,
|
|
10541
|
+
useResultTableCellIds,
|
|
10542
|
+
useResultTableCellIdsListener,
|
|
10543
|
+
useResultTableListener,
|
|
10544
|
+
useRow,
|
|
10545
|
+
useRowCount,
|
|
10546
|
+
useRowCountListener,
|
|
10547
|
+
useRowIds,
|
|
10548
|
+
useRowIdsListener,
|
|
10549
|
+
useRowListener,
|
|
10550
|
+
useSetCellCallback,
|
|
10551
|
+
useSetCheckpointCallback,
|
|
10552
|
+
useSetPartialRowCallback,
|
|
10553
|
+
useSetPartialValuesCallback,
|
|
10554
|
+
useSetRowCallback,
|
|
10555
|
+
useSetTableCallback,
|
|
10556
|
+
useSetTablesCallback,
|
|
10557
|
+
useSetValueCallback,
|
|
10558
|
+
useSetValuesCallback,
|
|
10559
|
+
useSliceIds,
|
|
10560
|
+
useSliceIdsListener,
|
|
10561
|
+
useSliceRowIds,
|
|
10562
|
+
useSliceRowIdsListener,
|
|
10563
|
+
useSortedRowIds,
|
|
10564
|
+
useSortedRowIdsListener,
|
|
10565
|
+
useSortedRowIdsListenerImpl,
|
|
10566
|
+
useStartTransactionListener,
|
|
10567
|
+
useStore,
|
|
10568
|
+
useStoreIds,
|
|
10569
|
+
useStoreOrStoreById,
|
|
10570
|
+
useStores,
|
|
10571
|
+
useSynchronizer,
|
|
10572
|
+
useSynchronizerIds,
|
|
10573
|
+
useSynchronizerOrSynchronizerById,
|
|
10574
|
+
useSynchronizerStatus,
|
|
10575
|
+
useSynchronizerStatusListener,
|
|
10576
|
+
useTable,
|
|
10577
|
+
useTableCellIds,
|
|
10578
|
+
useTableCellIdsListener,
|
|
10579
|
+
useTableIds,
|
|
10580
|
+
useTableIdsListener,
|
|
10581
|
+
useTableListener,
|
|
10582
|
+
useTables,
|
|
10583
|
+
useTablesListener,
|
|
10584
|
+
useUndoInformation,
|
|
10585
|
+
useValue,
|
|
10586
|
+
useValueIds,
|
|
10587
|
+
useValueIdsListener,
|
|
10588
|
+
useValueListener,
|
|
10589
|
+
useValues,
|
|
10590
|
+
useValuesListener,
|
|
10591
|
+
useWillFinishTransactionListener,
|
|
8411
10592
|
ValuesInHtmlTable,
|
|
10593
|
+
ValuesView$1 as ValuesView,
|
|
10594
|
+
ValueView,
|
|
8412
10595
|
WsServerDurableObject,
|
|
8413
10596
|
};
|