tinybase 6.5.2 → 6.6.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/@types/ui-react-dom/index.d.ts +153 -20
- package/@types/ui-react-dom/with-schemas/index.d.ts +72 -20
- package/@types/ui-react-inspector/index.d.ts +7 -0
- package/@types/ui-react-inspector/with-schemas/index.d.ts +26 -1925
- 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/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom/index.js +1 -1
- package/min/ui-react-dom/index.js.gz +0 -0
- package/min/ui-react-dom/with-schemas/index.js +1 -1
- package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/omni/index.js +2003 -1156
- package/omni/with-schemas/index.js +2003 -1156
- package/package.json +4 -4
- package/readme.md +2 -2
- package/ui-react/index.js +397 -368
- package/ui-react/with-schemas/index.js +397 -368
- package/ui-react-dom/index.js +873 -436
- package/ui-react-dom/with-schemas/index.js +873 -436
- package/ui-react-inspector/index.js +1717 -544
- package/ui-react-inspector/with-schemas/index.js +1717 -544
package/omni/index.js
CHANGED
|
@@ -62,6 +62,7 @@ const _VALUE = 'value';
|
|
|
62
62
|
const OPEN = 'open';
|
|
63
63
|
const MESSAGE = 'message';
|
|
64
64
|
const ERROR = 'error';
|
|
65
|
+
const EXTRA = 'extra';
|
|
65
66
|
const T = 't';
|
|
66
67
|
const V = 'v';
|
|
67
68
|
const UNDEFINED = '\uFFFC';
|
|
@@ -159,7 +160,13 @@ const setOrDelCell = (store, tableId, rowId, cellId, cell) =>
|
|
|
159
160
|
const setOrDelValue = (store, valueId, value) =>
|
|
160
161
|
isUndefined(value) ? store.delValue(valueId) : store.setValue(valueId, value);
|
|
161
162
|
const getTypeCase = (type, stringCase, numberCase, booleanCase) =>
|
|
162
|
-
type == STRING
|
|
163
|
+
type == STRING
|
|
164
|
+
? stringCase
|
|
165
|
+
: type == NUMBER
|
|
166
|
+
? numberCase
|
|
167
|
+
: type == BOOLEAN
|
|
168
|
+
? booleanCase
|
|
169
|
+
: null;
|
|
163
170
|
|
|
164
171
|
const collSizeN = (collSizer) => (coll) =>
|
|
165
172
|
arrayReduce(collValues(coll), (total, coll2) => total + collSizer(coll2), 0);
|
|
@@ -7086,17 +7093,6 @@ const getIndexStoreTableId = (indexes, indexId) => [
|
|
|
7086
7093
|
indexes?.getTableId(indexId),
|
|
7087
7094
|
];
|
|
7088
7095
|
|
|
7089
|
-
var Offsets = /* @__PURE__ */ ((Offsets2) => {
|
|
7090
|
-
Offsets2[(Offsets2['Store'] = 0)] = 'Store';
|
|
7091
|
-
Offsets2[(Offsets2['Metrics'] = 1)] = 'Metrics';
|
|
7092
|
-
Offsets2[(Offsets2['Indexes'] = 2)] = 'Indexes';
|
|
7093
|
-
Offsets2[(Offsets2['Relationships'] = 3)] = 'Relationships';
|
|
7094
|
-
Offsets2[(Offsets2['Queries'] = 4)] = 'Queries';
|
|
7095
|
-
Offsets2[(Offsets2['Checkpoints'] = 5)] = 'Checkpoints';
|
|
7096
|
-
Offsets2[(Offsets2['Persister'] = 6)] = 'Persister';
|
|
7097
|
-
Offsets2[(Offsets2['Synchronizer'] = 7)] = 'Synchronizer';
|
|
7098
|
-
return Offsets2;
|
|
7099
|
-
})(Offsets || {});
|
|
7100
7096
|
const TINYBASE_CONTEXT = TINYBASE + '_uirc';
|
|
7101
7097
|
const Context = GLOBAL[TINYBASE_CONTEXT]
|
|
7102
7098
|
? /* istanbul ignore next */
|
|
@@ -7127,6 +7123,165 @@ const useProvideThing = (thingId, thing, offset) => {
|
|
|
7127
7123
|
const useThingIds = (offset) =>
|
|
7128
7124
|
objIds(useContext(Context)[offset * 2 + 1] ?? {});
|
|
7129
7125
|
|
|
7126
|
+
const OFFSET_STORE = 0;
|
|
7127
|
+
const OFFSET_METRICS = 1;
|
|
7128
|
+
const OFFSET_INDEXES = 2;
|
|
7129
|
+
const OFFSET_RELATIONSHIPS = 3;
|
|
7130
|
+
const OFFSET_QUERIES = 4;
|
|
7131
|
+
const OFFSET_CHECKPOINTS = 5;
|
|
7132
|
+
const OFFSET_PERSISTER = 6;
|
|
7133
|
+
const OFFSET_SYNCHRONIZER = 7;
|
|
7134
|
+
const mergeParentThings = (
|
|
7135
|
+
offset,
|
|
7136
|
+
parentValue,
|
|
7137
|
+
defaultThing,
|
|
7138
|
+
thingsById,
|
|
7139
|
+
extraThingsById,
|
|
7140
|
+
) => [
|
|
7141
|
+
defaultThing ?? parentValue[offset * 2],
|
|
7142
|
+
{
|
|
7143
|
+
...parentValue[offset * 2 + 1],
|
|
7144
|
+
...thingsById,
|
|
7145
|
+
...extraThingsById[offset],
|
|
7146
|
+
},
|
|
7147
|
+
];
|
|
7148
|
+
const Provider = ({
|
|
7149
|
+
store,
|
|
7150
|
+
storesById,
|
|
7151
|
+
metrics,
|
|
7152
|
+
metricsById,
|
|
7153
|
+
indexes,
|
|
7154
|
+
indexesById,
|
|
7155
|
+
relationships,
|
|
7156
|
+
relationshipsById,
|
|
7157
|
+
queries,
|
|
7158
|
+
queriesById,
|
|
7159
|
+
checkpoints,
|
|
7160
|
+
checkpointsById,
|
|
7161
|
+
persister,
|
|
7162
|
+
persistersById,
|
|
7163
|
+
synchronizer,
|
|
7164
|
+
synchronizersById,
|
|
7165
|
+
children,
|
|
7166
|
+
}) => {
|
|
7167
|
+
const parentValue = useContext(Context);
|
|
7168
|
+
const [extraThingsById, setExtraThingsById] = useState(() =>
|
|
7169
|
+
arrayNew(8, () => ({})),
|
|
7170
|
+
);
|
|
7171
|
+
const addExtraThingById = useCallback(
|
|
7172
|
+
(thingOffset, id, thing) =>
|
|
7173
|
+
setExtraThingsById((extraThingsById2) =>
|
|
7174
|
+
objGet(extraThingsById2[thingOffset], id) == thing
|
|
7175
|
+
? extraThingsById2
|
|
7176
|
+
: arrayWith(extraThingsById2, thingOffset, {
|
|
7177
|
+
...extraThingsById2[thingOffset],
|
|
7178
|
+
[id]: thing,
|
|
7179
|
+
}),
|
|
7180
|
+
),
|
|
7181
|
+
[],
|
|
7182
|
+
);
|
|
7183
|
+
const delExtraThingById = useCallback(
|
|
7184
|
+
(thingOffset, id) =>
|
|
7185
|
+
setExtraThingsById((extraThingsById2) =>
|
|
7186
|
+
!objHas(extraThingsById2[thingOffset], id)
|
|
7187
|
+
? extraThingsById2
|
|
7188
|
+
: arrayWith(
|
|
7189
|
+
extraThingsById2,
|
|
7190
|
+
thingOffset,
|
|
7191
|
+
objDel(extraThingsById2[thingOffset], id),
|
|
7192
|
+
),
|
|
7193
|
+
),
|
|
7194
|
+
[],
|
|
7195
|
+
);
|
|
7196
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
7197
|
+
value: useMemo(
|
|
7198
|
+
() => [
|
|
7199
|
+
...mergeParentThings(
|
|
7200
|
+
OFFSET_STORE,
|
|
7201
|
+
parentValue,
|
|
7202
|
+
store,
|
|
7203
|
+
storesById,
|
|
7204
|
+
extraThingsById,
|
|
7205
|
+
),
|
|
7206
|
+
...mergeParentThings(
|
|
7207
|
+
OFFSET_METRICS,
|
|
7208
|
+
parentValue,
|
|
7209
|
+
metrics,
|
|
7210
|
+
metricsById,
|
|
7211
|
+
extraThingsById,
|
|
7212
|
+
),
|
|
7213
|
+
...mergeParentThings(
|
|
7214
|
+
OFFSET_INDEXES,
|
|
7215
|
+
parentValue,
|
|
7216
|
+
indexes,
|
|
7217
|
+
indexesById,
|
|
7218
|
+
extraThingsById,
|
|
7219
|
+
),
|
|
7220
|
+
...mergeParentThings(
|
|
7221
|
+
OFFSET_RELATIONSHIPS,
|
|
7222
|
+
parentValue,
|
|
7223
|
+
relationships,
|
|
7224
|
+
relationshipsById,
|
|
7225
|
+
extraThingsById,
|
|
7226
|
+
),
|
|
7227
|
+
...mergeParentThings(
|
|
7228
|
+
OFFSET_QUERIES,
|
|
7229
|
+
parentValue,
|
|
7230
|
+
queries,
|
|
7231
|
+
queriesById,
|
|
7232
|
+
extraThingsById,
|
|
7233
|
+
),
|
|
7234
|
+
...mergeParentThings(
|
|
7235
|
+
OFFSET_CHECKPOINTS,
|
|
7236
|
+
parentValue,
|
|
7237
|
+
checkpoints,
|
|
7238
|
+
checkpointsById,
|
|
7239
|
+
extraThingsById,
|
|
7240
|
+
),
|
|
7241
|
+
...mergeParentThings(
|
|
7242
|
+
OFFSET_PERSISTER,
|
|
7243
|
+
parentValue,
|
|
7244
|
+
persister,
|
|
7245
|
+
persistersById,
|
|
7246
|
+
extraThingsById,
|
|
7247
|
+
),
|
|
7248
|
+
...mergeParentThings(
|
|
7249
|
+
OFFSET_SYNCHRONIZER,
|
|
7250
|
+
parentValue,
|
|
7251
|
+
synchronizer,
|
|
7252
|
+
synchronizersById,
|
|
7253
|
+
extraThingsById,
|
|
7254
|
+
),
|
|
7255
|
+
addExtraThingById,
|
|
7256
|
+
delExtraThingById,
|
|
7257
|
+
],
|
|
7258
|
+
[
|
|
7259
|
+
extraThingsById,
|
|
7260
|
+
store,
|
|
7261
|
+
storesById,
|
|
7262
|
+
metrics,
|
|
7263
|
+
metricsById,
|
|
7264
|
+
indexes,
|
|
7265
|
+
indexesById,
|
|
7266
|
+
relationships,
|
|
7267
|
+
relationshipsById,
|
|
7268
|
+
queries,
|
|
7269
|
+
queriesById,
|
|
7270
|
+
checkpoints,
|
|
7271
|
+
checkpointsById,
|
|
7272
|
+
persister,
|
|
7273
|
+
persistersById,
|
|
7274
|
+
synchronizer,
|
|
7275
|
+
synchronizersById,
|
|
7276
|
+
parentValue,
|
|
7277
|
+
addExtraThingById,
|
|
7278
|
+
delExtraThingById,
|
|
7279
|
+
],
|
|
7280
|
+
),
|
|
7281
|
+
children,
|
|
7282
|
+
});
|
|
7283
|
+
};
|
|
7284
|
+
|
|
7130
7285
|
const EMPTY_ARRAY = [];
|
|
7131
7286
|
const DEFAULTS = [{}, [], [EMPTY_ARRAY, void 0, EMPTY_ARRAY], void 0, false, 0];
|
|
7132
7287
|
const IS_EQUALS = [
|
|
@@ -7291,13 +7446,13 @@ const useSortedRowIdsListenerImpl = (
|
|
|
7291
7446
|
);
|
|
7292
7447
|
const useCreateStore = (create, createDeps = EMPTY_ARRAY) =>
|
|
7293
7448
|
useMemo(create, createDeps);
|
|
7294
|
-
const useStoreIds = () => useThingIds(
|
|
7295
|
-
const useStore = (id) => useThing(id,
|
|
7296
|
-
const useStores = () => useThings(
|
|
7449
|
+
const useStoreIds = () => useThingIds(OFFSET_STORE);
|
|
7450
|
+
const useStore = (id) => useThing(id, OFFSET_STORE);
|
|
7451
|
+
const useStores = () => useThings(OFFSET_STORE);
|
|
7297
7452
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
7298
|
-
useThingOrThingById(storeOrStoreId,
|
|
7453
|
+
useThingOrThingById(storeOrStoreId, OFFSET_STORE);
|
|
7299
7454
|
const useProvideStore = (storeId, store) =>
|
|
7300
|
-
useProvideThing(storeId, store,
|
|
7455
|
+
useProvideThing(storeId, store, OFFSET_STORE);
|
|
7301
7456
|
const useCreateMergeableStore = (create, createDeps = EMPTY_ARRAY) =>
|
|
7302
7457
|
useMemo(create, createDeps);
|
|
7303
7458
|
const useHasTables = (storeOrStoreId) =>
|
|
@@ -7951,12 +8106,12 @@ const useDidFinishTransactionListener = (
|
|
|
7951
8106
|
);
|
|
7952
8107
|
const useCreateMetrics = (store, create, createDeps) =>
|
|
7953
8108
|
useCreate(store, create, createDeps);
|
|
7954
|
-
const useMetricsIds = () => useThingIds(
|
|
7955
|
-
const useMetrics = (id) => useThing(id,
|
|
8109
|
+
const useMetricsIds = () => useThingIds(OFFSET_METRICS);
|
|
8110
|
+
const useMetrics = (id) => useThing(id, OFFSET_METRICS);
|
|
7956
8111
|
const useMetricsOrMetricsById = (metricsOrMetricsId) =>
|
|
7957
|
-
useThingOrThingById(metricsOrMetricsId,
|
|
8112
|
+
useThingOrThingById(metricsOrMetricsId, OFFSET_METRICS);
|
|
7958
8113
|
const useProvideMetrics = (metricsId, metrics) =>
|
|
7959
|
-
useProvideThing(metricsId, metrics,
|
|
8114
|
+
useProvideThing(metricsId, metrics, OFFSET_METRICS);
|
|
7960
8115
|
const useMetricIds = (metricsOrMetricsId) =>
|
|
7961
8116
|
useListenable(
|
|
7962
8117
|
METRIC + IDS,
|
|
@@ -7985,12 +8140,12 @@ const useMetricListener = (
|
|
|
7985
8140
|
);
|
|
7986
8141
|
const useCreateIndexes = (store, create, createDeps) =>
|
|
7987
8142
|
useCreate(store, create, createDeps);
|
|
7988
|
-
const useIndexesIds = () => useThingIds(
|
|
7989
|
-
const useIndexes = (id) => useThing(id,
|
|
8143
|
+
const useIndexesIds = () => useThingIds(OFFSET_INDEXES);
|
|
8144
|
+
const useIndexes = (id) => useThing(id, OFFSET_INDEXES);
|
|
7990
8145
|
const useIndexesOrIndexesById = (indexesOrIndexesId) =>
|
|
7991
|
-
useThingOrThingById(indexesOrIndexesId,
|
|
8146
|
+
useThingOrThingById(indexesOrIndexesId, OFFSET_INDEXES);
|
|
7992
8147
|
const useProvideIndexes = (indexesId, indexes) =>
|
|
7993
|
-
useProvideThing(indexesId, indexes,
|
|
8148
|
+
useProvideThing(indexesId, indexes, OFFSET_INDEXES);
|
|
7994
8149
|
const useSliceIds = (indexId, indexesOrIndexesId) =>
|
|
7995
8150
|
useListenable(
|
|
7996
8151
|
SLICE + IDS,
|
|
@@ -8040,12 +8195,12 @@ const useSliceRowIdsListener = (
|
|
|
8040
8195
|
);
|
|
8041
8196
|
const useCreateRelationships = (store, create, createDeps) =>
|
|
8042
8197
|
useCreate(store, create, createDeps);
|
|
8043
|
-
const useRelationshipsIds = () => useThingIds(
|
|
8044
|
-
const useRelationships = (id) => useThing(id,
|
|
8198
|
+
const useRelationshipsIds = () => useThingIds(OFFSET_RELATIONSHIPS);
|
|
8199
|
+
const useRelationships = (id) => useThing(id, OFFSET_RELATIONSHIPS);
|
|
8045
8200
|
const useRelationshipsOrRelationshipsById = (relationshipsOrRelationshipsId) =>
|
|
8046
|
-
useThingOrThingById(relationshipsOrRelationshipsId,
|
|
8201
|
+
useThingOrThingById(relationshipsOrRelationshipsId, OFFSET_RELATIONSHIPS);
|
|
8047
8202
|
const useProvideRelationships = (relationshipsId, relationships) =>
|
|
8048
|
-
useProvideThing(relationshipsId, relationships,
|
|
8203
|
+
useProvideThing(relationshipsId, relationships, OFFSET_RELATIONSHIPS);
|
|
8049
8204
|
const useRelationshipIds = (relationshipsOrRelationshipsId) =>
|
|
8050
8205
|
useListenable(
|
|
8051
8206
|
RELATIONSHIP + IDS,
|
|
@@ -8129,12 +8284,12 @@ const useLinkedRowIdsListener = (
|
|
|
8129
8284
|
);
|
|
8130
8285
|
const useCreateQueries = (store, create, createDeps) =>
|
|
8131
8286
|
useCreate(store, create, createDeps);
|
|
8132
|
-
const useQueriesIds = () => useThingIds(
|
|
8133
|
-
const useQueries = (id) => useThing(id,
|
|
8287
|
+
const useQueriesIds = () => useThingIds(OFFSET_QUERIES);
|
|
8288
|
+
const useQueries = (id) => useThing(id, OFFSET_QUERIES);
|
|
8134
8289
|
const useQueriesOrQueriesById = (queriesOrQueriesId) =>
|
|
8135
|
-
useThingOrThingById(queriesOrQueriesId,
|
|
8290
|
+
useThingOrThingById(queriesOrQueriesId, OFFSET_QUERIES);
|
|
8136
8291
|
const useProvideQueries = (queriesId, queries) =>
|
|
8137
|
-
useProvideThing(queriesId, queries,
|
|
8292
|
+
useProvideThing(queriesId, queries, OFFSET_QUERIES);
|
|
8138
8293
|
const useQueryIds = (queriesOrQueriesId) =>
|
|
8139
8294
|
useListenable(
|
|
8140
8295
|
QUERY + IDS,
|
|
@@ -8318,12 +8473,12 @@ const useResultCellListener = (
|
|
|
8318
8473
|
);
|
|
8319
8474
|
const useCreateCheckpoints = (store, create, createDeps) =>
|
|
8320
8475
|
useCreate(store, create, createDeps);
|
|
8321
|
-
const useCheckpointsIds = () => useThingIds(
|
|
8322
|
-
const useCheckpoints = (id) => useThing(id,
|
|
8476
|
+
const useCheckpointsIds = () => useThingIds(OFFSET_CHECKPOINTS);
|
|
8477
|
+
const useCheckpoints = (id) => useThing(id, OFFSET_CHECKPOINTS);
|
|
8323
8478
|
const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
|
|
8324
|
-
useThingOrThingById(checkpointsOrCheckpointsId,
|
|
8479
|
+
useThingOrThingById(checkpointsOrCheckpointsId, OFFSET_CHECKPOINTS);
|
|
8325
8480
|
const useProvideCheckpoints = (checkpointsId, checkpoints) =>
|
|
8326
|
-
useProvideThing(checkpointsId, checkpoints,
|
|
8481
|
+
useProvideThing(checkpointsId, checkpoints, OFFSET_CHECKPOINTS);
|
|
8327
8482
|
const useCheckpointIds = (checkpointsOrCheckpointsId) =>
|
|
8328
8483
|
useListenable(
|
|
8329
8484
|
CHECKPOINT + IDS,
|
|
@@ -8471,12 +8626,12 @@ const useCreatePersister = (
|
|
|
8471
8626
|
);
|
|
8472
8627
|
return persister;
|
|
8473
8628
|
};
|
|
8474
|
-
const usePersisterIds = () => useThingIds(
|
|
8475
|
-
const usePersister = (id) => useThing(id,
|
|
8629
|
+
const usePersisterIds = () => useThingIds(OFFSET_PERSISTER);
|
|
8630
|
+
const usePersister = (id) => useThing(id, OFFSET_PERSISTER);
|
|
8476
8631
|
const usePersisterOrPersisterById = (persisterOrPersisterId) =>
|
|
8477
|
-
useThingOrThingById(persisterOrPersisterId,
|
|
8632
|
+
useThingOrThingById(persisterOrPersisterId, OFFSET_PERSISTER);
|
|
8478
8633
|
const useProvidePersister = (persisterId, persister) =>
|
|
8479
|
-
useProvideThing(persisterId, persister,
|
|
8634
|
+
useProvideThing(persisterId, persister, OFFSET_PERSISTER);
|
|
8480
8635
|
const usePersisterStatus = (persisterOrPersisterId) =>
|
|
8481
8636
|
useListenable(
|
|
8482
8637
|
STATUS,
|
|
@@ -8526,12 +8681,12 @@ const useCreateSynchronizer = (
|
|
|
8526
8681
|
);
|
|
8527
8682
|
return synchronizer;
|
|
8528
8683
|
};
|
|
8529
|
-
const useSynchronizerIds = () => useThingIds(
|
|
8530
|
-
const useSynchronizer = (id) => useThing(id,
|
|
8684
|
+
const useSynchronizerIds = () => useThingIds(OFFSET_SYNCHRONIZER);
|
|
8685
|
+
const useSynchronizer = (id) => useThing(id, OFFSET_SYNCHRONIZER);
|
|
8531
8686
|
const useSynchronizerOrSynchronizerById = (synchronizerOrSynchronizerId) =>
|
|
8532
|
-
useThingOrThingById(synchronizerOrSynchronizerId,
|
|
8687
|
+
useThingOrThingById(synchronizerOrSynchronizerId, OFFSET_SYNCHRONIZER);
|
|
8533
8688
|
const useProvideSynchronizer = (persisterId, persister) =>
|
|
8534
|
-
useProvideThing(persisterId, persister,
|
|
8689
|
+
useProvideThing(persisterId, persister, OFFSET_SYNCHRONIZER);
|
|
8535
8690
|
const useSynchronizerStatus = (synchronizerOrSynchronizerId) =>
|
|
8536
8691
|
useListenable(
|
|
8537
8692
|
STATUS,
|
|
@@ -8552,281 +8707,314 @@ const useSynchronizerStatusListener = (
|
|
|
8552
8707
|
[],
|
|
8553
8708
|
);
|
|
8554
8709
|
|
|
8555
|
-
const
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
const
|
|
8570
|
-
{
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
)
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8710
|
+
const useStoreCellComponentProps = (store, tableId) =>
|
|
8711
|
+
useMemo(() => ({store, tableId}), [store, tableId]);
|
|
8712
|
+
const useQueriesCellComponentProps = (queries, queryId) =>
|
|
8713
|
+
useMemo(() => ({queries, queryId}), [queries, queryId]);
|
|
8714
|
+
const useCallbackOrUndefined = (callback, deps, test) => {
|
|
8715
|
+
const returnCallback = useCallback(callback, deps);
|
|
8716
|
+
return test ? returnCallback : void 0;
|
|
8717
|
+
};
|
|
8718
|
+
const useParams = (...args) =>
|
|
8719
|
+
useMemo(
|
|
8720
|
+
() => args,
|
|
8721
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8722
|
+
args,
|
|
8723
|
+
);
|
|
8724
|
+
const useCells = (defaultCellIds, customCells, defaultCellComponent) =>
|
|
8725
|
+
useMemo(() => {
|
|
8726
|
+
const cellIds = customCells ?? defaultCellIds;
|
|
8727
|
+
return objMap(
|
|
8728
|
+
isArray(cellIds)
|
|
8729
|
+
? objNew(arrayMap(cellIds, (cellId) => [cellId, cellId]))
|
|
8730
|
+
: cellIds,
|
|
8731
|
+
(labelOrCustomCell, cellId) => ({
|
|
8732
|
+
...{label: cellId, component: defaultCellComponent},
|
|
8733
|
+
...(isString(labelOrCustomCell)
|
|
8734
|
+
? {label: labelOrCustomCell}
|
|
8735
|
+
: labelOrCustomCell),
|
|
8736
|
+
}),
|
|
8737
|
+
);
|
|
8738
|
+
}, [customCells, defaultCellComponent, defaultCellIds]);
|
|
8739
|
+
|
|
8740
|
+
const UP_ARROW = '\u2191';
|
|
8741
|
+
const DOWN_ARROW = '\u2193';
|
|
8742
|
+
const EDITABLE = 'editable';
|
|
8743
|
+
const extraRowCells = (extraRowCells2 = [], extraRowCellProps, after = 0) =>
|
|
8744
|
+
arrayMap(extraRowCells2, ({component: Component}, index) =>
|
|
8745
|
+
/* @__PURE__ */ jsx(
|
|
8746
|
+
'td',
|
|
8747
|
+
{
|
|
8748
|
+
className: EXTRA,
|
|
8749
|
+
children: /* @__PURE__ */ jsx(Component, {...extraRowCellProps}),
|
|
8750
|
+
},
|
|
8751
|
+
extraKey(index, after),
|
|
8595
8752
|
),
|
|
8596
|
-
separator,
|
|
8597
|
-
debugIds,
|
|
8598
|
-
tableId,
|
|
8599
8753
|
);
|
|
8600
|
-
const
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
debugIds,
|
|
8608
|
-
},
|
|
8609
|
-
rowIds,
|
|
8610
|
-
) =>
|
|
8611
|
-
wrap(
|
|
8612
|
-
arrayMap(rowIds, (rowId) =>
|
|
8613
|
-
/* @__PURE__ */ jsx(
|
|
8614
|
-
ResultRow,
|
|
8615
|
-
{
|
|
8616
|
-
...getProps(getResultRowComponentProps, rowId),
|
|
8617
|
-
queryId,
|
|
8618
|
-
rowId,
|
|
8619
|
-
queries,
|
|
8620
|
-
debugIds,
|
|
8621
|
-
},
|
|
8622
|
-
rowId,
|
|
8623
|
-
),
|
|
8754
|
+
const extraKey = (index, after) => (after ? '>' : '<') + index;
|
|
8755
|
+
const extraHeaders = (extraCells = [], after = 0) =>
|
|
8756
|
+
arrayMap(extraCells, ({label}, index) =>
|
|
8757
|
+
/* @__PURE__ */ jsx(
|
|
8758
|
+
'th',
|
|
8759
|
+
{className: EXTRA, children: label},
|
|
8760
|
+
extraKey(index, after),
|
|
8624
8761
|
),
|
|
8625
|
-
separator,
|
|
8626
|
-
debugIds,
|
|
8627
|
-
queryId,
|
|
8628
8762
|
);
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
const [resolvedRelationships, store, localTableId] =
|
|
8642
|
-
getRelationshipsStoreTableIds(
|
|
8643
|
-
useRelationshipsOrRelationshipsById(relationships),
|
|
8644
|
-
relationshipId,
|
|
8645
|
-
);
|
|
8646
|
-
const rowIds = getRowIdsHook(relationshipId, rowId, resolvedRelationships);
|
|
8647
|
-
return wrap(
|
|
8648
|
-
arrayMap(rowIds, (rowId2) =>
|
|
8649
|
-
/* @__PURE__ */ jsx(
|
|
8650
|
-
Row,
|
|
8651
|
-
{
|
|
8652
|
-
...getProps(getRowComponentProps, rowId2),
|
|
8653
|
-
tableId: localTableId,
|
|
8654
|
-
rowId: rowId2,
|
|
8655
|
-
store,
|
|
8656
|
-
debugIds,
|
|
8657
|
-
},
|
|
8658
|
-
rowId2,
|
|
8659
|
-
),
|
|
8763
|
+
|
|
8764
|
+
const HtmlHeaderCell = ({
|
|
8765
|
+
cellId,
|
|
8766
|
+
sort: [sortCellId, sortDescending],
|
|
8767
|
+
label = cellId ?? EMPTY_STRING,
|
|
8768
|
+
onClick,
|
|
8769
|
+
}) =>
|
|
8770
|
+
/* @__PURE__ */ jsxs('th', {
|
|
8771
|
+
onClick: useCallbackOrUndefined(
|
|
8772
|
+
() => onClick?.(cellId),
|
|
8773
|
+
[onClick, cellId],
|
|
8774
|
+
onClick,
|
|
8660
8775
|
),
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8776
|
+
className:
|
|
8777
|
+
isUndefined(sortDescending) || sortCellId != cellId
|
|
8778
|
+
? void 0
|
|
8779
|
+
: `sorted ${sortDescending ? 'de' : 'a'}scending`,
|
|
8780
|
+
children: [
|
|
8781
|
+
isUndefined(sortDescending) || sortCellId != cellId
|
|
8782
|
+
? null
|
|
8783
|
+
: (sortDescending ? DOWN_ARROW : UP_ARROW) + ' ',
|
|
8784
|
+
label,
|
|
8785
|
+
],
|
|
8786
|
+
});
|
|
8787
|
+
const HtmlTable = ({
|
|
8788
|
+
className,
|
|
8789
|
+
headerRow,
|
|
8790
|
+
idColumn,
|
|
8791
|
+
params: [
|
|
8792
|
+
cells,
|
|
8793
|
+
cellComponentProps,
|
|
8794
|
+
rowIds,
|
|
8795
|
+
extraCellsBefore,
|
|
8796
|
+
extraCellsAfter,
|
|
8797
|
+
sortAndOffset,
|
|
8798
|
+
handleSort,
|
|
8799
|
+
paginatorComponent,
|
|
8800
|
+
],
|
|
8801
|
+
}) =>
|
|
8802
|
+
/* @__PURE__ */ jsxs('table', {
|
|
8803
|
+
className,
|
|
8804
|
+
children: [
|
|
8805
|
+
paginatorComponent
|
|
8806
|
+
? /* @__PURE__ */ jsx('caption', {children: paginatorComponent})
|
|
8807
|
+
: null,
|
|
8808
|
+
headerRow === false
|
|
8809
|
+
? null
|
|
8810
|
+
: /* @__PURE__ */ jsx('thead', {
|
|
8811
|
+
children: /* @__PURE__ */ jsxs('tr', {
|
|
8812
|
+
children: [
|
|
8813
|
+
extraHeaders(extraCellsBefore),
|
|
8814
|
+
idColumn === false
|
|
8815
|
+
? null
|
|
8816
|
+
: /* @__PURE__ */ jsx(HtmlHeaderCell, {
|
|
8817
|
+
sort: sortAndOffset ?? [],
|
|
8818
|
+
label: 'Id',
|
|
8819
|
+
onClick: handleSort,
|
|
8820
|
+
}),
|
|
8821
|
+
objToArray(cells, ({label}, cellId) =>
|
|
8822
|
+
/* @__PURE__ */ jsx(
|
|
8823
|
+
HtmlHeaderCell,
|
|
8824
|
+
{
|
|
8825
|
+
cellId,
|
|
8826
|
+
label,
|
|
8827
|
+
sort: sortAndOffset ?? [],
|
|
8828
|
+
onClick: handleSort,
|
|
8829
|
+
},
|
|
8830
|
+
cellId,
|
|
8831
|
+
),
|
|
8832
|
+
),
|
|
8833
|
+
extraHeaders(extraCellsAfter, 1),
|
|
8834
|
+
],
|
|
8835
|
+
}),
|
|
8836
|
+
}),
|
|
8837
|
+
/* @__PURE__ */ jsx('tbody', {
|
|
8838
|
+
children: arrayMap(rowIds, (rowId) => {
|
|
8839
|
+
const rowProps = {...cellComponentProps, rowId};
|
|
8840
|
+
return /* @__PURE__ */ jsxs(
|
|
8841
|
+
'tr',
|
|
8682
8842
|
{
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8843
|
+
children: [
|
|
8844
|
+
extraRowCells(extraCellsBefore, rowProps),
|
|
8845
|
+
idColumn === false
|
|
8846
|
+
? null
|
|
8847
|
+
: /* @__PURE__ */ jsx('th', {title: rowId, children: rowId}),
|
|
8848
|
+
objToArray(
|
|
8849
|
+
cells,
|
|
8850
|
+
({component: CellView, getComponentProps}, cellId) =>
|
|
8851
|
+
/* @__PURE__ */ jsx(
|
|
8852
|
+
'td',
|
|
8853
|
+
{
|
|
8854
|
+
children: /* @__PURE__ */ jsx(CellView, {
|
|
8855
|
+
...getProps(getComponentProps, rowId, cellId),
|
|
8856
|
+
...rowProps,
|
|
8857
|
+
cellId,
|
|
8858
|
+
}),
|
|
8859
|
+
},
|
|
8860
|
+
cellId,
|
|
8861
|
+
),
|
|
8862
|
+
),
|
|
8863
|
+
extraRowCells(extraCellsAfter, rowProps, 1),
|
|
8864
|
+
],
|
|
8687
8865
|
},
|
|
8688
|
-
|
|
8689
|
-
)
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
};
|
|
8694
|
-
const
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
indexesById,
|
|
8701
|
-
relationships,
|
|
8702
|
-
relationshipsById,
|
|
8703
|
-
queries,
|
|
8704
|
-
queriesById,
|
|
8705
|
-
checkpoints,
|
|
8706
|
-
checkpointsById,
|
|
8707
|
-
persister,
|
|
8708
|
-
persistersById,
|
|
8709
|
-
synchronizer,
|
|
8710
|
-
synchronizersById,
|
|
8711
|
-
children,
|
|
8866
|
+
rowId,
|
|
8867
|
+
);
|
|
8868
|
+
}),
|
|
8869
|
+
}),
|
|
8870
|
+
],
|
|
8871
|
+
});
|
|
8872
|
+
const EditableThing = ({
|
|
8873
|
+
thing,
|
|
8874
|
+
onThingChange,
|
|
8875
|
+
className,
|
|
8876
|
+
hasSchema,
|
|
8877
|
+
showType = true,
|
|
8712
8878
|
}) => {
|
|
8713
|
-
const
|
|
8714
|
-
const [
|
|
8715
|
-
|
|
8716
|
-
);
|
|
8717
|
-
const
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8879
|
+
const [thingType, setThingType] = useState();
|
|
8880
|
+
const [currentThing, setCurrentThing] = useState();
|
|
8881
|
+
const [stringThing, setStringThing] = useState();
|
|
8882
|
+
const [numberThing, setNumberThing] = useState();
|
|
8883
|
+
const [booleanThing, setBooleanThing] = useState();
|
|
8884
|
+
if (currentThing !== thing) {
|
|
8885
|
+
setThingType(getCellOrValueType(thing));
|
|
8886
|
+
setCurrentThing(thing);
|
|
8887
|
+
setStringThing(String(thing));
|
|
8888
|
+
setNumberThing(Number(thing) || 0);
|
|
8889
|
+
setBooleanThing(Boolean(thing));
|
|
8890
|
+
}
|
|
8891
|
+
const handleThingChange = useCallback(
|
|
8892
|
+
(thing2, setTypedThing) => {
|
|
8893
|
+
setTypedThing(thing2);
|
|
8894
|
+
setCurrentThing(thing2);
|
|
8895
|
+
onThingChange(thing2);
|
|
8896
|
+
},
|
|
8897
|
+
[onThingChange],
|
|
8728
8898
|
);
|
|
8729
|
-
const
|
|
8730
|
-
(
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8899
|
+
const handleTypeChange = useCallback(() => {
|
|
8900
|
+
if (!hasSchema?.()) {
|
|
8901
|
+
const nextType = getTypeCase(thingType, NUMBER, BOOLEAN, STRING);
|
|
8902
|
+
const thing2 = getTypeCase(
|
|
8903
|
+
nextType,
|
|
8904
|
+
stringThing,
|
|
8905
|
+
numberThing,
|
|
8906
|
+
booleanThing,
|
|
8907
|
+
);
|
|
8908
|
+
setThingType(nextType);
|
|
8909
|
+
setCurrentThing(thing2);
|
|
8910
|
+
onThingChange(thing2);
|
|
8911
|
+
}
|
|
8912
|
+
}, [
|
|
8913
|
+
hasSchema,
|
|
8914
|
+
onThingChange,
|
|
8915
|
+
stringThing,
|
|
8916
|
+
numberThing,
|
|
8917
|
+
booleanThing,
|
|
8918
|
+
thingType,
|
|
8919
|
+
]);
|
|
8920
|
+
const widget = getTypeCase(
|
|
8921
|
+
thingType,
|
|
8922
|
+
/* @__PURE__ */ jsx(
|
|
8923
|
+
'input',
|
|
8924
|
+
{
|
|
8925
|
+
value: stringThing,
|
|
8926
|
+
onChange: useCallback(
|
|
8927
|
+
(event) =>
|
|
8928
|
+
handleThingChange(
|
|
8929
|
+
String(event[CURRENT_TARGET][_VALUE]),
|
|
8930
|
+
setStringThing,
|
|
8738
8931
|
),
|
|
8739
|
-
|
|
8740
|
-
[],
|
|
8741
|
-
);
|
|
8742
|
-
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
8743
|
-
value: useMemo(
|
|
8744
|
-
() => [
|
|
8745
|
-
...mergeParentThings(
|
|
8746
|
-
0 /* Store */,
|
|
8747
|
-
parentValue,
|
|
8748
|
-
store,
|
|
8749
|
-
storesById,
|
|
8750
|
-
extraThingsById,
|
|
8751
|
-
),
|
|
8752
|
-
...mergeParentThings(
|
|
8753
|
-
1 /* Metrics */,
|
|
8754
|
-
parentValue,
|
|
8755
|
-
metrics,
|
|
8756
|
-
metricsById,
|
|
8757
|
-
extraThingsById,
|
|
8758
|
-
),
|
|
8759
|
-
...mergeParentThings(
|
|
8760
|
-
2 /* Indexes */,
|
|
8761
|
-
parentValue,
|
|
8762
|
-
indexes,
|
|
8763
|
-
indexesById,
|
|
8764
|
-
extraThingsById,
|
|
8765
|
-
),
|
|
8766
|
-
...mergeParentThings(
|
|
8767
|
-
3 /* Relationships */,
|
|
8768
|
-
parentValue,
|
|
8769
|
-
relationships,
|
|
8770
|
-
relationshipsById,
|
|
8771
|
-
extraThingsById,
|
|
8772
|
-
),
|
|
8773
|
-
...mergeParentThings(
|
|
8774
|
-
4 /* Queries */,
|
|
8775
|
-
parentValue,
|
|
8776
|
-
queries,
|
|
8777
|
-
queriesById,
|
|
8778
|
-
extraThingsById,
|
|
8779
|
-
),
|
|
8780
|
-
...mergeParentThings(
|
|
8781
|
-
5 /* Checkpoints */,
|
|
8782
|
-
parentValue,
|
|
8783
|
-
checkpoints,
|
|
8784
|
-
checkpointsById,
|
|
8785
|
-
extraThingsById,
|
|
8932
|
+
[handleThingChange],
|
|
8786
8933
|
),
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8934
|
+
},
|
|
8935
|
+
thingType,
|
|
8936
|
+
),
|
|
8937
|
+
/* @__PURE__ */ jsx(
|
|
8938
|
+
'input',
|
|
8939
|
+
{
|
|
8940
|
+
type: 'number',
|
|
8941
|
+
value: numberThing,
|
|
8942
|
+
onChange: useCallback(
|
|
8943
|
+
(event) =>
|
|
8944
|
+
handleThingChange(
|
|
8945
|
+
Number(event[CURRENT_TARGET][_VALUE] || 0),
|
|
8946
|
+
setNumberThing,
|
|
8947
|
+
),
|
|
8948
|
+
[handleThingChange],
|
|
8793
8949
|
),
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8950
|
+
},
|
|
8951
|
+
thingType,
|
|
8952
|
+
),
|
|
8953
|
+
/* @__PURE__ */ jsx(
|
|
8954
|
+
'input',
|
|
8955
|
+
{
|
|
8956
|
+
type: 'checkbox',
|
|
8957
|
+
checked: booleanThing,
|
|
8958
|
+
onChange: useCallback(
|
|
8959
|
+
(event) =>
|
|
8960
|
+
handleThingChange(
|
|
8961
|
+
Boolean(event[CURRENT_TARGET].checked),
|
|
8962
|
+
setBooleanThing,
|
|
8963
|
+
),
|
|
8964
|
+
[handleThingChange],
|
|
8800
8965
|
),
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
],
|
|
8804
|
-
[
|
|
8805
|
-
extraThingsById,
|
|
8806
|
-
store,
|
|
8807
|
-
storesById,
|
|
8808
|
-
metrics,
|
|
8809
|
-
metricsById,
|
|
8810
|
-
indexes,
|
|
8811
|
-
indexesById,
|
|
8812
|
-
relationships,
|
|
8813
|
-
relationshipsById,
|
|
8814
|
-
queries,
|
|
8815
|
-
queriesById,
|
|
8816
|
-
checkpoints,
|
|
8817
|
-
checkpointsById,
|
|
8818
|
-
persister,
|
|
8819
|
-
persistersById,
|
|
8820
|
-
synchronizer,
|
|
8821
|
-
synchronizersById,
|
|
8822
|
-
parentValue,
|
|
8823
|
-
addExtraThingById,
|
|
8824
|
-
delExtraThingById,
|
|
8825
|
-
],
|
|
8966
|
+
},
|
|
8967
|
+
thingType,
|
|
8826
8968
|
),
|
|
8827
|
-
|
|
8969
|
+
);
|
|
8970
|
+
return /* @__PURE__ */ jsxs('div', {
|
|
8971
|
+
className,
|
|
8972
|
+
children: [
|
|
8973
|
+
showType && widget
|
|
8974
|
+
? /* @__PURE__ */ jsx('button', {
|
|
8975
|
+
title: thingType,
|
|
8976
|
+
className: thingType,
|
|
8977
|
+
onClick: handleTypeChange,
|
|
8978
|
+
children: thingType,
|
|
8979
|
+
})
|
|
8980
|
+
: null,
|
|
8981
|
+
widget,
|
|
8982
|
+
],
|
|
8828
8983
|
});
|
|
8829
8984
|
};
|
|
8985
|
+
|
|
8986
|
+
const EditableCellView = ({
|
|
8987
|
+
tableId,
|
|
8988
|
+
rowId,
|
|
8989
|
+
cellId,
|
|
8990
|
+
store,
|
|
8991
|
+
className,
|
|
8992
|
+
showType,
|
|
8993
|
+
}) =>
|
|
8994
|
+
/* @__PURE__ */ jsx(EditableThing, {
|
|
8995
|
+
thing: useCell(tableId, rowId, cellId, store),
|
|
8996
|
+
onThingChange: useSetCellCallback(
|
|
8997
|
+
tableId,
|
|
8998
|
+
rowId,
|
|
8999
|
+
cellId,
|
|
9000
|
+
(cell) => cell,
|
|
9001
|
+
[],
|
|
9002
|
+
store,
|
|
9003
|
+
),
|
|
9004
|
+
className: className ?? EDITABLE + CELL,
|
|
9005
|
+
showType,
|
|
9006
|
+
hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
|
|
9007
|
+
});
|
|
9008
|
+
|
|
9009
|
+
const EditableValueView = ({valueId, store, className, showType}) =>
|
|
9010
|
+
/* @__PURE__ */ jsx(EditableThing, {
|
|
9011
|
+
thing: useValue(valueId, store),
|
|
9012
|
+
onThingChange: useSetValueCallback(valueId, (value) => value, [], store),
|
|
9013
|
+
className: className ?? EDITABLE + VALUE,
|
|
9014
|
+
showType,
|
|
9015
|
+
hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
|
|
9016
|
+
});
|
|
9017
|
+
|
|
8830
9018
|
const wrap = (children, separator, encloseWithId, id) => {
|
|
8831
9019
|
const separated =
|
|
8832
9020
|
isUndefined(separator) || !isArray(children)
|
|
@@ -8834,10 +9022,53 @@ const wrap = (children, separator, encloseWithId, id) => {
|
|
|
8834
9022
|
: arrayMap(children, (child, c) => (c > 0 ? [separator, child] : child));
|
|
8835
9023
|
return encloseWithId ? [id, ':{', separated, '}'] : separated;
|
|
8836
9024
|
};
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
9025
|
+
|
|
9026
|
+
const CheckpointView = ({checkpoints, checkpointId, debugIds}) =>
|
|
9027
|
+
wrap(
|
|
9028
|
+
useCheckpoint(checkpointId, checkpoints) ?? EMPTY_STRING,
|
|
9029
|
+
void 0,
|
|
9030
|
+
debugIds,
|
|
9031
|
+
checkpointId,
|
|
9032
|
+
);
|
|
9033
|
+
|
|
9034
|
+
const ResultCellView = ({queryId, rowId, cellId, queries, debugIds}) =>
|
|
9035
|
+
wrap(
|
|
9036
|
+
EMPTY_STRING +
|
|
9037
|
+
(useResultCell(queryId, rowId, cellId, queries) ?? EMPTY_STRING),
|
|
9038
|
+
void 0,
|
|
9039
|
+
debugIds,
|
|
9040
|
+
cellId,
|
|
9041
|
+
);
|
|
9042
|
+
|
|
9043
|
+
const ResultRowView = ({
|
|
9044
|
+
queryId,
|
|
9045
|
+
rowId,
|
|
9046
|
+
queries,
|
|
9047
|
+
resultCellComponent: ResultCell = ResultCellView,
|
|
9048
|
+
getResultCellComponentProps,
|
|
9049
|
+
separator,
|
|
9050
|
+
debugIds,
|
|
9051
|
+
}) =>
|
|
9052
|
+
wrap(
|
|
9053
|
+
arrayMap(useResultCellIds(queryId, rowId, queries), (cellId) =>
|
|
9054
|
+
/* @__PURE__ */ jsx(
|
|
9055
|
+
ResultCell,
|
|
9056
|
+
{
|
|
9057
|
+
...getProps(getResultCellComponentProps, cellId),
|
|
9058
|
+
queryId,
|
|
9059
|
+
rowId,
|
|
9060
|
+
cellId,
|
|
9061
|
+
queries,
|
|
9062
|
+
debugIds,
|
|
9063
|
+
},
|
|
9064
|
+
cellId,
|
|
9065
|
+
),
|
|
9066
|
+
),
|
|
9067
|
+
separator,
|
|
9068
|
+
debugIds,
|
|
9069
|
+
rowId,
|
|
9070
|
+
);
|
|
9071
|
+
|
|
8841
9072
|
const CellView = ({tableId, rowId, cellId, store, debugIds}) =>
|
|
8842
9073
|
wrap(
|
|
8843
9074
|
EMPTY_STRING + (useCell(tableId, rowId, cellId, store) ?? EMPTY_STRING),
|
|
@@ -8845,6 +9076,12 @@ const CellView = ({tableId, rowId, cellId, store, debugIds}) =>
|
|
|
8845
9076
|
debugIds,
|
|
8846
9077
|
cellId,
|
|
8847
9078
|
);
|
|
9079
|
+
|
|
9080
|
+
const useCustomOrDefaultCellIds = (customCellIds, tableId, rowId, store) => {
|
|
9081
|
+
const defaultCellIds = useCellIds(tableId, rowId, store);
|
|
9082
|
+
return customCellIds ?? defaultCellIds;
|
|
9083
|
+
};
|
|
9084
|
+
|
|
8848
9085
|
const RowView = ({
|
|
8849
9086
|
tableId,
|
|
8850
9087
|
rowId,
|
|
@@ -8876,93 +9113,20 @@ const RowView = ({
|
|
|
8876
9113
|
debugIds,
|
|
8877
9114
|
rowId,
|
|
8878
9115
|
);
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
descending,
|
|
8888
|
-
offset,
|
|
8889
|
-
limit,
|
|
8890
|
-
props.store,
|
|
8891
|
-
),
|
|
8892
|
-
);
|
|
8893
|
-
const TablesView = ({
|
|
8894
|
-
store,
|
|
8895
|
-
tableComponent: Table = TableView$1,
|
|
8896
|
-
getTableComponentProps,
|
|
8897
|
-
separator,
|
|
8898
|
-
debugIds,
|
|
8899
|
-
}) =>
|
|
8900
|
-
wrap(
|
|
8901
|
-
arrayMap(useTableIds(store), (tableId) =>
|
|
8902
|
-
/* @__PURE__ */ jsx(
|
|
8903
|
-
Table,
|
|
8904
|
-
{
|
|
8905
|
-
...getProps(getTableComponentProps, tableId),
|
|
8906
|
-
tableId,
|
|
8907
|
-
store,
|
|
8908
|
-
debugIds,
|
|
8909
|
-
},
|
|
8910
|
-
tableId,
|
|
8911
|
-
),
|
|
8912
|
-
),
|
|
9116
|
+
|
|
9117
|
+
const tableView = (
|
|
9118
|
+
{
|
|
9119
|
+
tableId,
|
|
9120
|
+
store,
|
|
9121
|
+
rowComponent: Row = RowView,
|
|
9122
|
+
getRowComponentProps,
|
|
9123
|
+
customCellIds,
|
|
8913
9124
|
separator,
|
|
8914
|
-
);
|
|
8915
|
-
const ValueView = ({valueId, store, debugIds}) =>
|
|
8916
|
-
wrap(
|
|
8917
|
-
EMPTY_STRING + (useValue(valueId, store) ?? EMPTY_STRING),
|
|
8918
|
-
void 0,
|
|
8919
9125
|
debugIds,
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
store,
|
|
8924
|
-
valueComponent: Value = ValueView,
|
|
8925
|
-
getValueComponentProps,
|
|
8926
|
-
separator,
|
|
8927
|
-
debugIds,
|
|
8928
|
-
}) =>
|
|
8929
|
-
wrap(
|
|
8930
|
-
arrayMap(useValueIds(store), (valueId) =>
|
|
8931
|
-
/* @__PURE__ */ jsx(
|
|
8932
|
-
Value,
|
|
8933
|
-
{
|
|
8934
|
-
...getProps(getValueComponentProps, valueId),
|
|
8935
|
-
valueId,
|
|
8936
|
-
store,
|
|
8937
|
-
debugIds,
|
|
8938
|
-
},
|
|
8939
|
-
valueId,
|
|
8940
|
-
),
|
|
8941
|
-
),
|
|
8942
|
-
separator,
|
|
8943
|
-
);
|
|
8944
|
-
const MetricView = ({metricId, metrics, debugIds}) =>
|
|
9126
|
+
},
|
|
9127
|
+
rowIds,
|
|
9128
|
+
) =>
|
|
8945
9129
|
wrap(
|
|
8946
|
-
useMetric(metricId, metrics) ?? EMPTY_STRING,
|
|
8947
|
-
void 0,
|
|
8948
|
-
debugIds,
|
|
8949
|
-
metricId,
|
|
8950
|
-
);
|
|
8951
|
-
const SliceView$1 = ({
|
|
8952
|
-
indexId,
|
|
8953
|
-
sliceId,
|
|
8954
|
-
indexes,
|
|
8955
|
-
rowComponent: Row = RowView,
|
|
8956
|
-
getRowComponentProps,
|
|
8957
|
-
separator,
|
|
8958
|
-
debugIds,
|
|
8959
|
-
}) => {
|
|
8960
|
-
const [resolvedIndexes, store, tableId] = getIndexStoreTableId(
|
|
8961
|
-
useIndexesOrIndexesById(indexes),
|
|
8962
|
-
indexId,
|
|
8963
|
-
);
|
|
8964
|
-
const rowIds = useSliceRowIds(indexId, sliceId, resolvedIndexes);
|
|
8965
|
-
return wrap(
|
|
8966
9130
|
arrayMap(rowIds, (rowId) =>
|
|
8967
9131
|
/* @__PURE__ */ jsx(
|
|
8968
9132
|
Row,
|
|
@@ -8970,6 +9134,7 @@ const SliceView$1 = ({
|
|
|
8970
9134
|
...getProps(getRowComponentProps, rowId),
|
|
8971
9135
|
tableId,
|
|
8972
9136
|
rowId,
|
|
9137
|
+
customCellIds,
|
|
8973
9138
|
store,
|
|
8974
9139
|
debugIds,
|
|
8975
9140
|
},
|
|
@@ -8978,340 +9143,316 @@ const SliceView$1 = ({
|
|
|
8978
9143
|
),
|
|
8979
9144
|
separator,
|
|
8980
9145
|
debugIds,
|
|
8981
|
-
|
|
9146
|
+
tableId,
|
|
8982
9147
|
);
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
}
|
|
9148
|
+
const resultTableView = (
|
|
9149
|
+
{
|
|
9150
|
+
queryId,
|
|
9151
|
+
queries,
|
|
9152
|
+
resultRowComponent: ResultRow = ResultRowView,
|
|
9153
|
+
getResultRowComponentProps,
|
|
9154
|
+
separator,
|
|
9155
|
+
debugIds,
|
|
9156
|
+
},
|
|
9157
|
+
rowIds,
|
|
9158
|
+
) =>
|
|
8992
9159
|
wrap(
|
|
8993
|
-
arrayMap(
|
|
9160
|
+
arrayMap(rowIds, (rowId) =>
|
|
8994
9161
|
/* @__PURE__ */ jsx(
|
|
8995
|
-
|
|
9162
|
+
ResultRow,
|
|
8996
9163
|
{
|
|
8997
|
-
...getProps(
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9164
|
+
...getProps(getResultRowComponentProps, rowId),
|
|
9165
|
+
queryId,
|
|
9166
|
+
rowId,
|
|
9167
|
+
queries,
|
|
9001
9168
|
debugIds,
|
|
9002
9169
|
},
|
|
9003
|
-
|
|
9170
|
+
rowId,
|
|
9004
9171
|
),
|
|
9005
9172
|
),
|
|
9006
9173
|
separator,
|
|
9007
9174
|
debugIds,
|
|
9008
|
-
|
|
9175
|
+
queryId,
|
|
9009
9176
|
);
|
|
9010
|
-
const
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
|
|
9177
|
+
const useComponentPerRow = (
|
|
9178
|
+
{
|
|
9179
|
+
relationshipId,
|
|
9180
|
+
relationships,
|
|
9181
|
+
rowComponent: Row = RowView,
|
|
9182
|
+
getRowComponentProps,
|
|
9183
|
+
separator,
|
|
9184
|
+
debugIds,
|
|
9185
|
+
},
|
|
9186
|
+
getRowIdsHook,
|
|
9187
|
+
rowId,
|
|
9188
|
+
) => {
|
|
9189
|
+
const [resolvedRelationships, store, localTableId] =
|
|
9019
9190
|
getRelationshipsStoreTableIds(
|
|
9020
9191
|
useRelationshipsOrRelationshipsById(relationships),
|
|
9021
9192
|
relationshipId,
|
|
9022
9193
|
);
|
|
9023
|
-
const
|
|
9024
|
-
relationshipId,
|
|
9025
|
-
localRowId,
|
|
9026
|
-
resolvedRelationships,
|
|
9027
|
-
);
|
|
9194
|
+
const rowIds = getRowIdsHook(relationshipId, rowId, resolvedRelationships);
|
|
9028
9195
|
return wrap(
|
|
9029
|
-
|
|
9030
|
-
? null
|
|
9031
|
-
: /* @__PURE__ */ jsx(
|
|
9032
|
-
Row,
|
|
9033
|
-
{
|
|
9034
|
-
...getProps(getRowComponentProps, rowId),
|
|
9035
|
-
tableId: remoteTableId,
|
|
9036
|
-
rowId,
|
|
9037
|
-
store,
|
|
9038
|
-
debugIds,
|
|
9039
|
-
},
|
|
9040
|
-
rowId,
|
|
9041
|
-
),
|
|
9042
|
-
void 0,
|
|
9043
|
-
debugIds,
|
|
9044
|
-
localRowId,
|
|
9045
|
-
);
|
|
9046
|
-
};
|
|
9047
|
-
const LocalRowsView = (props) =>
|
|
9048
|
-
useComponentPerRow(props, useLocalRowIds, props.remoteRowId);
|
|
9049
|
-
const LinkedRowsView = (props) =>
|
|
9050
|
-
useComponentPerRow(props, useLinkedRowIds, props.firstRowId);
|
|
9051
|
-
const ResultCellView = ({queryId, rowId, cellId, queries, debugIds}) =>
|
|
9052
|
-
wrap(
|
|
9053
|
-
EMPTY_STRING +
|
|
9054
|
-
(useResultCell(queryId, rowId, cellId, queries) ?? EMPTY_STRING),
|
|
9055
|
-
void 0,
|
|
9056
|
-
debugIds,
|
|
9057
|
-
cellId,
|
|
9058
|
-
);
|
|
9059
|
-
const ResultRowView = ({
|
|
9060
|
-
queryId,
|
|
9061
|
-
rowId,
|
|
9062
|
-
queries,
|
|
9063
|
-
resultCellComponent: ResultCell = ResultCellView,
|
|
9064
|
-
getResultCellComponentProps,
|
|
9065
|
-
separator,
|
|
9066
|
-
debugIds,
|
|
9067
|
-
}) =>
|
|
9068
|
-
wrap(
|
|
9069
|
-
arrayMap(useResultCellIds(queryId, rowId, queries), (cellId) =>
|
|
9196
|
+
arrayMap(rowIds, (rowId2) =>
|
|
9070
9197
|
/* @__PURE__ */ jsx(
|
|
9071
|
-
|
|
9198
|
+
Row,
|
|
9072
9199
|
{
|
|
9073
|
-
...getProps(
|
|
9074
|
-
|
|
9075
|
-
rowId,
|
|
9076
|
-
|
|
9077
|
-
queries,
|
|
9200
|
+
...getProps(getRowComponentProps, rowId2),
|
|
9201
|
+
tableId: localTableId,
|
|
9202
|
+
rowId: rowId2,
|
|
9203
|
+
store,
|
|
9078
9204
|
debugIds,
|
|
9079
9205
|
},
|
|
9080
|
-
|
|
9206
|
+
rowId2,
|
|
9081
9207
|
),
|
|
9082
9208
|
),
|
|
9083
9209
|
separator,
|
|
9084
9210
|
debugIds,
|
|
9085
9211
|
rowId,
|
|
9086
9212
|
);
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
descending,
|
|
9096
|
-
offset,
|
|
9097
|
-
limit,
|
|
9098
|
-
props.queries,
|
|
9099
|
-
),
|
|
9100
|
-
);
|
|
9101
|
-
const CheckpointView = ({checkpoints, checkpointId, debugIds}) =>
|
|
9102
|
-
wrap(
|
|
9103
|
-
useCheckpoint(checkpointId, checkpoints) ?? EMPTY_STRING,
|
|
9104
|
-
void 0,
|
|
9213
|
+
};
|
|
9214
|
+
const getUseCheckpointView =
|
|
9215
|
+
(getCheckpoints) =>
|
|
9216
|
+
({
|
|
9217
|
+
checkpoints,
|
|
9218
|
+
checkpointComponent: Checkpoint = CheckpointView,
|
|
9219
|
+
getCheckpointComponentProps,
|
|
9220
|
+
separator,
|
|
9105
9221
|
debugIds,
|
|
9106
|
-
|
|
9107
|
-
|
|
9222
|
+
}) => {
|
|
9223
|
+
const resolvedCheckpoints = useCheckpointsOrCheckpointsById(checkpoints);
|
|
9224
|
+
return wrap(
|
|
9225
|
+
arrayMap(
|
|
9226
|
+
getCheckpoints(useCheckpointIds(resolvedCheckpoints)),
|
|
9227
|
+
(checkpointId) =>
|
|
9228
|
+
/* @__PURE__ */ jsx(
|
|
9229
|
+
Checkpoint,
|
|
9230
|
+
{
|
|
9231
|
+
...getProps(getCheckpointComponentProps, checkpointId),
|
|
9232
|
+
checkpoints: resolvedCheckpoints,
|
|
9233
|
+
checkpointId,
|
|
9234
|
+
debugIds,
|
|
9235
|
+
},
|
|
9236
|
+
checkpointId,
|
|
9237
|
+
),
|
|
9238
|
+
),
|
|
9239
|
+
separator,
|
|
9240
|
+
);
|
|
9241
|
+
};
|
|
9242
|
+
|
|
9108
9243
|
const BackwardCheckpointsView = getUseCheckpointView(
|
|
9109
9244
|
(checkpointIds) => checkpointIds[0],
|
|
9110
9245
|
);
|
|
9246
|
+
|
|
9111
9247
|
const CurrentCheckpointView = getUseCheckpointView((checkpointIds) =>
|
|
9112
9248
|
isUndefined(checkpointIds[1]) ? [] : [checkpointIds[1]],
|
|
9113
9249
|
);
|
|
9250
|
+
|
|
9114
9251
|
const ForwardCheckpointsView = getUseCheckpointView(
|
|
9115
9252
|
(checkpointIds) => checkpointIds[2],
|
|
9116
9253
|
);
|
|
9117
9254
|
|
|
9118
|
-
const
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
useMemo(
|
|
9131
|
-
() => args,
|
|
9132
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9133
|
-
args,
|
|
9134
|
-
);
|
|
9135
|
-
const useStoreCellComponentProps = (store, tableId) =>
|
|
9136
|
-
useMemo(() => ({store, tableId}), [store, tableId]);
|
|
9137
|
-
const useQueriesCellComponentProps = (queries, queryId) =>
|
|
9138
|
-
useMemo(() => ({queries, queryId}), [queries, queryId]);
|
|
9139
|
-
const useSortingAndPagination = (
|
|
9140
|
-
cellId,
|
|
9141
|
-
descending = false,
|
|
9142
|
-
sortOnClick,
|
|
9143
|
-
offset = 0,
|
|
9144
|
-
limit,
|
|
9145
|
-
total,
|
|
9146
|
-
paginator,
|
|
9147
|
-
onChange,
|
|
9148
|
-
) => {
|
|
9149
|
-
const [[currentCellId, currentDescending, currentOffset], setState] =
|
|
9150
|
-
useState([cellId, descending, offset]);
|
|
9151
|
-
const setStateAndChange = useCallback(
|
|
9152
|
-
(sortAndOffset) => {
|
|
9153
|
-
setState(sortAndOffset);
|
|
9154
|
-
onChange?.(sortAndOffset);
|
|
9155
|
-
},
|
|
9156
|
-
[onChange],
|
|
9157
|
-
);
|
|
9158
|
-
const handleSort = useCallbackOrUndefined(
|
|
9159
|
-
(cellId2) =>
|
|
9160
|
-
setStateAndChange([
|
|
9161
|
-
cellId2,
|
|
9162
|
-
cellId2 == currentCellId ? !currentDescending : false,
|
|
9163
|
-
currentOffset,
|
|
9164
|
-
]),
|
|
9165
|
-
[setStateAndChange, currentCellId, currentDescending, currentOffset],
|
|
9166
|
-
sortOnClick,
|
|
9167
|
-
);
|
|
9168
|
-
const handleChangeOffset = useCallback(
|
|
9169
|
-
(offset2) => setStateAndChange([currentCellId, currentDescending, offset2]),
|
|
9170
|
-
[setStateAndChange, currentCellId, currentDescending],
|
|
9255
|
+
const SliceView$1 = ({
|
|
9256
|
+
indexId,
|
|
9257
|
+
sliceId,
|
|
9258
|
+
indexes,
|
|
9259
|
+
rowComponent: Row = RowView,
|
|
9260
|
+
getRowComponentProps,
|
|
9261
|
+
separator,
|
|
9262
|
+
debugIds,
|
|
9263
|
+
}) => {
|
|
9264
|
+
const [resolvedIndexes, store, tableId] = getIndexStoreTableId(
|
|
9265
|
+
useIndexesOrIndexesById(indexes),
|
|
9266
|
+
indexId,
|
|
9171
9267
|
);
|
|
9172
|
-
const
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
}),
|
|
9187
|
-
[
|
|
9188
|
-
paginator,
|
|
9189
|
-
PaginatorComponent,
|
|
9190
|
-
currentOffset,
|
|
9191
|
-
limit,
|
|
9192
|
-
total,
|
|
9193
|
-
handleChangeOffset,
|
|
9194
|
-
],
|
|
9268
|
+
const rowIds = useSliceRowIds(indexId, sliceId, resolvedIndexes);
|
|
9269
|
+
return wrap(
|
|
9270
|
+
arrayMap(rowIds, (rowId) =>
|
|
9271
|
+
/* @__PURE__ */ jsx(
|
|
9272
|
+
Row,
|
|
9273
|
+
{
|
|
9274
|
+
...getProps(getRowComponentProps, rowId),
|
|
9275
|
+
tableId,
|
|
9276
|
+
rowId,
|
|
9277
|
+
store,
|
|
9278
|
+
debugIds,
|
|
9279
|
+
},
|
|
9280
|
+
rowId,
|
|
9281
|
+
),
|
|
9195
9282
|
),
|
|
9196
|
-
|
|
9283
|
+
separator,
|
|
9284
|
+
debugIds,
|
|
9285
|
+
sliceId,
|
|
9286
|
+
);
|
|
9197
9287
|
};
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
? null
|
|
9267
|
-
: /* @__PURE__ */ jsx('th', {children: rowId}),
|
|
9268
|
-
objToArray(
|
|
9269
|
-
cells,
|
|
9270
|
-
({component: CellView2, getComponentProps}, cellId) =>
|
|
9271
|
-
/* @__PURE__ */ jsx(
|
|
9272
|
-
'td',
|
|
9273
|
-
{
|
|
9274
|
-
children: /* @__PURE__ */ jsx(CellView2, {
|
|
9275
|
-
...getProps(getComponentProps, rowId, cellId),
|
|
9276
|
-
...cellComponentProps,
|
|
9277
|
-
rowId,
|
|
9278
|
-
cellId,
|
|
9279
|
-
}),
|
|
9280
|
-
},
|
|
9281
|
-
cellId,
|
|
9282
|
-
),
|
|
9283
|
-
),
|
|
9284
|
-
],
|
|
9285
|
-
},
|
|
9288
|
+
|
|
9289
|
+
const IndexView$1 = ({
|
|
9290
|
+
indexId,
|
|
9291
|
+
indexes,
|
|
9292
|
+
sliceComponent: Slice = SliceView$1,
|
|
9293
|
+
getSliceComponentProps,
|
|
9294
|
+
separator,
|
|
9295
|
+
debugIds,
|
|
9296
|
+
}) =>
|
|
9297
|
+
wrap(
|
|
9298
|
+
arrayMap(useSliceIds(indexId, indexes), (sliceId) =>
|
|
9299
|
+
/* @__PURE__ */ jsx(
|
|
9300
|
+
Slice,
|
|
9301
|
+
{
|
|
9302
|
+
...getProps(getSliceComponentProps, sliceId),
|
|
9303
|
+
indexId,
|
|
9304
|
+
sliceId,
|
|
9305
|
+
indexes,
|
|
9306
|
+
debugIds,
|
|
9307
|
+
},
|
|
9308
|
+
sliceId,
|
|
9309
|
+
),
|
|
9310
|
+
),
|
|
9311
|
+
separator,
|
|
9312
|
+
debugIds,
|
|
9313
|
+
indexId,
|
|
9314
|
+
);
|
|
9315
|
+
|
|
9316
|
+
const LinkedRowsView = (props) =>
|
|
9317
|
+
useComponentPerRow(props, useLinkedRowIds, props.firstRowId);
|
|
9318
|
+
|
|
9319
|
+
const LocalRowsView = (props) =>
|
|
9320
|
+
useComponentPerRow(props, useLocalRowIds, props.remoteRowId);
|
|
9321
|
+
|
|
9322
|
+
const MetricView = ({metricId, metrics, debugIds}) =>
|
|
9323
|
+
wrap(
|
|
9324
|
+
useMetric(metricId, metrics) ?? EMPTY_STRING,
|
|
9325
|
+
void 0,
|
|
9326
|
+
debugIds,
|
|
9327
|
+
metricId,
|
|
9328
|
+
);
|
|
9329
|
+
|
|
9330
|
+
const RemoteRowView = ({
|
|
9331
|
+
relationshipId,
|
|
9332
|
+
localRowId,
|
|
9333
|
+
relationships,
|
|
9334
|
+
rowComponent: Row = RowView,
|
|
9335
|
+
getRowComponentProps,
|
|
9336
|
+
debugIds,
|
|
9337
|
+
}) => {
|
|
9338
|
+
const [resolvedRelationships, store, , remoteTableId] =
|
|
9339
|
+
getRelationshipsStoreTableIds(
|
|
9340
|
+
useRelationshipsOrRelationshipsById(relationships),
|
|
9341
|
+
relationshipId,
|
|
9342
|
+
);
|
|
9343
|
+
const rowId = useRemoteRowId(
|
|
9344
|
+
relationshipId,
|
|
9345
|
+
localRowId,
|
|
9346
|
+
resolvedRelationships,
|
|
9347
|
+
);
|
|
9348
|
+
return wrap(
|
|
9349
|
+
isUndefined(remoteTableId) || isUndefined(rowId)
|
|
9350
|
+
? null
|
|
9351
|
+
: /* @__PURE__ */ jsx(
|
|
9352
|
+
Row,
|
|
9353
|
+
{
|
|
9354
|
+
...getProps(getRowComponentProps, rowId),
|
|
9355
|
+
tableId: remoteTableId,
|
|
9286
9356
|
rowId,
|
|
9287
|
-
|
|
9357
|
+
store,
|
|
9358
|
+
debugIds,
|
|
9359
|
+
},
|
|
9360
|
+
rowId,
|
|
9288
9361
|
),
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
|
|
9362
|
+
void 0,
|
|
9363
|
+
debugIds,
|
|
9364
|
+
localRowId,
|
|
9365
|
+
);
|
|
9366
|
+
};
|
|
9367
|
+
|
|
9368
|
+
const ResultSortedTableView = ({cellId, descending, offset, limit, ...props}) =>
|
|
9369
|
+
resultTableView(
|
|
9370
|
+
props,
|
|
9371
|
+
useResultSortedRowIds(
|
|
9372
|
+
props.queryId,
|
|
9373
|
+
cellId,
|
|
9374
|
+
descending,
|
|
9375
|
+
offset,
|
|
9376
|
+
limit,
|
|
9377
|
+
props.queries,
|
|
9378
|
+
),
|
|
9379
|
+
);
|
|
9380
|
+
|
|
9381
|
+
const ResultTableView = (props) =>
|
|
9382
|
+
resultTableView(props, useResultRowIds(props.queryId, props.queries));
|
|
9383
|
+
|
|
9384
|
+
const SortedTableView = ({cellId, descending, offset, limit, ...props}) =>
|
|
9385
|
+
tableView(
|
|
9386
|
+
props,
|
|
9387
|
+
useSortedRowIds(
|
|
9388
|
+
props.tableId,
|
|
9389
|
+
cellId,
|
|
9390
|
+
descending,
|
|
9391
|
+
offset,
|
|
9392
|
+
limit,
|
|
9393
|
+
props.store,
|
|
9394
|
+
),
|
|
9395
|
+
);
|
|
9396
|
+
|
|
9397
|
+
const TableView$1 = (props) =>
|
|
9398
|
+
tableView(props, useRowIds(props.tableId, props.store));
|
|
9399
|
+
|
|
9400
|
+
const TablesView$1 = ({
|
|
9401
|
+
store,
|
|
9402
|
+
tableComponent: Table = TableView$1,
|
|
9403
|
+
getTableComponentProps,
|
|
9404
|
+
separator,
|
|
9405
|
+
debugIds,
|
|
9297
9406
|
}) =>
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9407
|
+
wrap(
|
|
9408
|
+
arrayMap(useTableIds(store), (tableId) =>
|
|
9409
|
+
/* @__PURE__ */ jsx(
|
|
9410
|
+
Table,
|
|
9411
|
+
{
|
|
9412
|
+
...getProps(getTableComponentProps, tableId),
|
|
9413
|
+
tableId,
|
|
9414
|
+
store,
|
|
9415
|
+
debugIds,
|
|
9416
|
+
},
|
|
9417
|
+
tableId,
|
|
9418
|
+
),
|
|
9303
9419
|
),
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9420
|
+
separator,
|
|
9421
|
+
);
|
|
9422
|
+
|
|
9423
|
+
const ValueView = ({valueId, store, debugIds}) =>
|
|
9424
|
+
wrap(
|
|
9425
|
+
EMPTY_STRING + (useValue(valueId, store) ?? EMPTY_STRING),
|
|
9426
|
+
void 0,
|
|
9427
|
+
debugIds,
|
|
9428
|
+
valueId,
|
|
9429
|
+
);
|
|
9430
|
+
|
|
9431
|
+
const ValuesView$1 = ({
|
|
9432
|
+
store,
|
|
9433
|
+
valueComponent: Value = ValueView,
|
|
9434
|
+
getValueComponentProps,
|
|
9435
|
+
separator,
|
|
9436
|
+
debugIds,
|
|
9437
|
+
}) =>
|
|
9438
|
+
wrap(
|
|
9439
|
+
arrayMap(useValueIds(store), (valueId) =>
|
|
9440
|
+
/* @__PURE__ */ jsx(
|
|
9441
|
+
Value,
|
|
9442
|
+
{
|
|
9443
|
+
...getProps(getValueComponentProps, valueId),
|
|
9444
|
+
valueId,
|
|
9445
|
+
store,
|
|
9446
|
+
debugIds,
|
|
9447
|
+
},
|
|
9448
|
+
valueId,
|
|
9449
|
+
),
|
|
9450
|
+
),
|
|
9451
|
+
separator,
|
|
9452
|
+
);
|
|
9453
|
+
|
|
9454
|
+
const useDottedCellIds = (tableId, store) =>
|
|
9455
|
+
arrayMap(useTableCellIds(tableId, store), (cellId) => tableId + DOT + cellId);
|
|
9315
9456
|
const RelationshipInHtmlRow = ({
|
|
9316
9457
|
localRowId,
|
|
9317
9458
|
params: [
|
|
@@ -9322,17 +9463,31 @@ const RelationshipInHtmlRow = ({
|
|
|
9322
9463
|
relationshipId,
|
|
9323
9464
|
relationships,
|
|
9324
9465
|
store,
|
|
9466
|
+
extraCellsBefore,
|
|
9467
|
+
extraCellsAfter,
|
|
9325
9468
|
],
|
|
9326
9469
|
}) => {
|
|
9327
9470
|
const remoteRowId = useRemoteRowId(relationshipId, localRowId, relationships);
|
|
9471
|
+
const rowProps = {
|
|
9472
|
+
tableId: localTableId ?? '',
|
|
9473
|
+
rowId: localRowId,
|
|
9474
|
+
store,
|
|
9475
|
+
};
|
|
9328
9476
|
return /* @__PURE__ */ jsxs('tr', {
|
|
9329
9477
|
children: [
|
|
9478
|
+
extraRowCells(extraCellsBefore, rowProps),
|
|
9330
9479
|
idColumn === false
|
|
9331
9480
|
? null
|
|
9332
9481
|
: /* @__PURE__ */ jsxs(Fragment, {
|
|
9333
9482
|
children: [
|
|
9334
|
-
/* @__PURE__ */ jsx('th', {
|
|
9335
|
-
|
|
9483
|
+
/* @__PURE__ */ jsx('th', {
|
|
9484
|
+
title: localRowId,
|
|
9485
|
+
children: localRowId,
|
|
9486
|
+
}),
|
|
9487
|
+
/* @__PURE__ */ jsx('th', {
|
|
9488
|
+
title: remoteRowId,
|
|
9489
|
+
children: remoteRowId,
|
|
9490
|
+
}),
|
|
9336
9491
|
],
|
|
9337
9492
|
}),
|
|
9338
9493
|
objToArray(
|
|
@@ -9362,145 +9517,215 @@ const RelationshipInHtmlRow = ({
|
|
|
9362
9517
|
);
|
|
9363
9518
|
},
|
|
9364
9519
|
),
|
|
9520
|
+
extraRowCells(extraCellsAfter, rowProps, 1),
|
|
9521
|
+
],
|
|
9522
|
+
});
|
|
9523
|
+
};
|
|
9524
|
+
const RelationshipInHtmlTable = ({
|
|
9525
|
+
relationshipId,
|
|
9526
|
+
relationships,
|
|
9527
|
+
editable,
|
|
9528
|
+
customCells,
|
|
9529
|
+
extraCellsBefore,
|
|
9530
|
+
extraCellsAfter,
|
|
9531
|
+
className,
|
|
9532
|
+
headerRow,
|
|
9533
|
+
idColumn = true,
|
|
9534
|
+
}) => {
|
|
9535
|
+
const [resolvedRelationships, store, localTableId, remoteTableId] =
|
|
9536
|
+
getRelationshipsStoreTableIds(
|
|
9537
|
+
useRelationshipsOrRelationshipsById(relationships),
|
|
9538
|
+
relationshipId,
|
|
9539
|
+
);
|
|
9540
|
+
const cells = useCells(
|
|
9541
|
+
[
|
|
9542
|
+
...useDottedCellIds(localTableId, store),
|
|
9543
|
+
...useDottedCellIds(remoteTableId, store),
|
|
9544
|
+
],
|
|
9545
|
+
customCells,
|
|
9546
|
+
editable ? EditableCellView : CellView,
|
|
9547
|
+
);
|
|
9548
|
+
const params = useParams(
|
|
9549
|
+
idColumn,
|
|
9550
|
+
cells,
|
|
9551
|
+
localTableId,
|
|
9552
|
+
remoteTableId,
|
|
9553
|
+
relationshipId,
|
|
9554
|
+
resolvedRelationships,
|
|
9555
|
+
store,
|
|
9556
|
+
extraCellsBefore,
|
|
9557
|
+
extraCellsAfter,
|
|
9558
|
+
);
|
|
9559
|
+
return /* @__PURE__ */ jsxs('table', {
|
|
9560
|
+
className,
|
|
9561
|
+
children: [
|
|
9562
|
+
headerRow === false
|
|
9563
|
+
? null
|
|
9564
|
+
: /* @__PURE__ */ jsx('thead', {
|
|
9565
|
+
children: /* @__PURE__ */ jsxs('tr', {
|
|
9566
|
+
children: [
|
|
9567
|
+
extraHeaders(extraCellsBefore),
|
|
9568
|
+
idColumn === false
|
|
9569
|
+
? null
|
|
9570
|
+
: /* @__PURE__ */ jsxs(Fragment, {
|
|
9571
|
+
children: [
|
|
9572
|
+
/* @__PURE__ */ jsxs('th', {
|
|
9573
|
+
children: [localTableId, '.Id'],
|
|
9574
|
+
}),
|
|
9575
|
+
/* @__PURE__ */ jsxs('th', {
|
|
9576
|
+
children: [remoteTableId, '.Id'],
|
|
9577
|
+
}),
|
|
9578
|
+
],
|
|
9579
|
+
}),
|
|
9580
|
+
objToArray(cells, ({label}, cellId) =>
|
|
9581
|
+
/* @__PURE__ */ jsx('th', {children: label}, cellId),
|
|
9582
|
+
),
|
|
9583
|
+
extraHeaders(extraCellsAfter, 1),
|
|
9584
|
+
],
|
|
9585
|
+
}),
|
|
9586
|
+
}),
|
|
9587
|
+
/* @__PURE__ */ jsx('tbody', {
|
|
9588
|
+
children: arrayMap(useRowIds(localTableId, store), (localRowId) =>
|
|
9589
|
+
/* @__PURE__ */ jsx(
|
|
9590
|
+
RelationshipInHtmlRow,
|
|
9591
|
+
{
|
|
9592
|
+
localRowId,
|
|
9593
|
+
params,
|
|
9594
|
+
},
|
|
9595
|
+
localRowId,
|
|
9596
|
+
),
|
|
9597
|
+
),
|
|
9598
|
+
}),
|
|
9365
9599
|
],
|
|
9366
9600
|
});
|
|
9367
9601
|
};
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9602
|
+
|
|
9603
|
+
const LEFT_ARROW = '\u2190';
|
|
9604
|
+
const RIGHT_ARROW = '\u2192';
|
|
9605
|
+
const useSortingAndPagination = (
|
|
9606
|
+
cellId,
|
|
9607
|
+
descending = false,
|
|
9608
|
+
sortOnClick,
|
|
9609
|
+
offset = 0,
|
|
9610
|
+
limit,
|
|
9611
|
+
total,
|
|
9612
|
+
paginator,
|
|
9613
|
+
onChange,
|
|
9614
|
+
) => {
|
|
9615
|
+
const [[currentCellId, currentDescending, currentOffset], setState] =
|
|
9616
|
+
useState([cellId, descending, offset]);
|
|
9617
|
+
const setStateAndChange = useCallback(
|
|
9618
|
+
(sortAndOffset) => {
|
|
9619
|
+
setState(sortAndOffset);
|
|
9620
|
+
onChange?.(sortAndOffset);
|
|
9621
|
+
},
|
|
9622
|
+
[onChange],
|
|
9623
|
+
);
|
|
9624
|
+
const handleSort = useCallbackOrUndefined(
|
|
9625
|
+
(cellId2) =>
|
|
9626
|
+
setStateAndChange([
|
|
9627
|
+
cellId2,
|
|
9628
|
+
cellId2 == currentCellId ? !currentDescending : false,
|
|
9629
|
+
currentOffset,
|
|
9630
|
+
]),
|
|
9631
|
+
[setStateAndChange, currentCellId, currentDescending, currentOffset],
|
|
9632
|
+
sortOnClick,
|
|
9633
|
+
);
|
|
9634
|
+
const handleChangeOffset = useCallback(
|
|
9635
|
+
(offset2) => setStateAndChange([currentCellId, currentDescending, offset2]),
|
|
9636
|
+
[setStateAndChange, currentCellId, currentDescending],
|
|
9637
|
+
);
|
|
9638
|
+
const PaginatorComponent =
|
|
9639
|
+
paginator === true ? SortedTablePaginator : paginator;
|
|
9640
|
+
return [
|
|
9641
|
+
[currentCellId, currentDescending, currentOffset],
|
|
9642
|
+
handleSort,
|
|
9643
|
+
useMemo(
|
|
9644
|
+
() =>
|
|
9645
|
+
paginator === false
|
|
9646
|
+
? null
|
|
9647
|
+
: /* @__PURE__ */ jsx(PaginatorComponent, {
|
|
9648
|
+
offset: currentOffset,
|
|
9649
|
+
limit,
|
|
9650
|
+
total,
|
|
9651
|
+
onChange: handleChangeOffset,
|
|
9652
|
+
}),
|
|
9653
|
+
[
|
|
9654
|
+
paginator,
|
|
9655
|
+
PaginatorComponent,
|
|
9656
|
+
currentOffset,
|
|
9657
|
+
limit,
|
|
9658
|
+
total,
|
|
9659
|
+
handleChangeOffset,
|
|
9660
|
+
],
|
|
9661
|
+
),
|
|
9662
|
+
];
|
|
9663
|
+
};
|
|
9664
|
+
const SortedTablePaginator = ({
|
|
9665
|
+
onChange,
|
|
9666
|
+
total,
|
|
9667
|
+
offset = 0,
|
|
9668
|
+
limit = total,
|
|
9669
|
+
singular = 'row',
|
|
9670
|
+
plural = singular + 's',
|
|
9374
9671
|
}) => {
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
const [numberThing, setNumberThing] = useState();
|
|
9379
|
-
const [booleanThing, setBooleanThing] = useState();
|
|
9380
|
-
if (currentThing !== thing) {
|
|
9381
|
-
setThingType(getCellOrValueType(thing));
|
|
9382
|
-
setCurrentThing(thing);
|
|
9383
|
-
setStringThing(String(thing));
|
|
9384
|
-
setNumberThing(Number(thing) || 0);
|
|
9385
|
-
setBooleanThing(Boolean(thing));
|
|
9672
|
+
if (offset > total || offset < 0) {
|
|
9673
|
+
offset = 0;
|
|
9674
|
+
onChange(0);
|
|
9386
9675
|
}
|
|
9387
|
-
const
|
|
9388
|
-
(
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
onThingChange(thing2);
|
|
9392
|
-
},
|
|
9393
|
-
[onThingChange],
|
|
9676
|
+
const handlePrevClick = useCallbackOrUndefined(
|
|
9677
|
+
() => onChange(offset - limit),
|
|
9678
|
+
[onChange, offset, limit],
|
|
9679
|
+
offset > 0,
|
|
9394
9680
|
);
|
|
9395
|
-
const
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
numberThing,
|
|
9402
|
-
booleanThing,
|
|
9403
|
-
);
|
|
9404
|
-
setThingType(nextType);
|
|
9405
|
-
setCurrentThing(thing2);
|
|
9406
|
-
onThingChange(thing2);
|
|
9407
|
-
}
|
|
9408
|
-
}, [
|
|
9409
|
-
hasSchema,
|
|
9410
|
-
onThingChange,
|
|
9411
|
-
stringThing,
|
|
9412
|
-
numberThing,
|
|
9413
|
-
booleanThing,
|
|
9414
|
-
thingType,
|
|
9415
|
-
]);
|
|
9416
|
-
return /* @__PURE__ */ jsxs('div', {
|
|
9417
|
-
className,
|
|
9681
|
+
const handleNextClick = useCallbackOrUndefined(
|
|
9682
|
+
() => onChange(offset + limit),
|
|
9683
|
+
[onChange, offset, limit],
|
|
9684
|
+
offset + limit < total,
|
|
9685
|
+
);
|
|
9686
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
9418
9687
|
children: [
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
/* @__PURE__ */ jsx(
|
|
9444
|
-
'input',
|
|
9445
|
-
{
|
|
9446
|
-
type: 'number',
|
|
9447
|
-
value: numberThing,
|
|
9448
|
-
onChange: useCallback(
|
|
9449
|
-
(event) =>
|
|
9450
|
-
handleThingChange(
|
|
9451
|
-
Number(event[CURRENT_TARGET][_VALUE] || 0),
|
|
9452
|
-
setNumberThing,
|
|
9453
|
-
),
|
|
9454
|
-
[handleThingChange],
|
|
9455
|
-
),
|
|
9456
|
-
},
|
|
9457
|
-
thingType,
|
|
9458
|
-
),
|
|
9459
|
-
/* @__PURE__ */ jsx(
|
|
9460
|
-
'input',
|
|
9461
|
-
{
|
|
9462
|
-
type: 'checkbox',
|
|
9463
|
-
checked: booleanThing,
|
|
9464
|
-
onChange: useCallback(
|
|
9465
|
-
(event) =>
|
|
9466
|
-
handleThingChange(
|
|
9467
|
-
Boolean(event[CURRENT_TARGET].checked),
|
|
9468
|
-
setBooleanThing,
|
|
9469
|
-
),
|
|
9470
|
-
[handleThingChange],
|
|
9471
|
-
),
|
|
9472
|
-
},
|
|
9473
|
-
thingType,
|
|
9474
|
-
),
|
|
9475
|
-
),
|
|
9688
|
+
total > limit &&
|
|
9689
|
+
/* @__PURE__ */ jsxs(Fragment, {
|
|
9690
|
+
children: [
|
|
9691
|
+
/* @__PURE__ */ jsx('button', {
|
|
9692
|
+
className: 'previous',
|
|
9693
|
+
disabled: offset == 0,
|
|
9694
|
+
onClick: handlePrevClick,
|
|
9695
|
+
children: LEFT_ARROW,
|
|
9696
|
+
}),
|
|
9697
|
+
/* @__PURE__ */ jsx('button', {
|
|
9698
|
+
className: 'next',
|
|
9699
|
+
disabled: offset + limit >= total,
|
|
9700
|
+
onClick: handleNextClick,
|
|
9701
|
+
children: RIGHT_ARROW,
|
|
9702
|
+
}),
|
|
9703
|
+
offset + 1,
|
|
9704
|
+
' to ',
|
|
9705
|
+
mathMin(total, offset + limit),
|
|
9706
|
+
' of ',
|
|
9707
|
+
],
|
|
9708
|
+
}),
|
|
9709
|
+
total,
|
|
9710
|
+
' ',
|
|
9711
|
+
total != 1 ? plural : singular,
|
|
9476
9712
|
],
|
|
9477
9713
|
});
|
|
9478
9714
|
};
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
params: useParams(
|
|
9483
|
-
useCells(
|
|
9484
|
-
useTableCellIds(tableId, store),
|
|
9485
|
-
customCells,
|
|
9486
|
-
editable ? EditableCellView : CellView,
|
|
9487
|
-
),
|
|
9488
|
-
useStoreCellComponentProps(store, tableId),
|
|
9489
|
-
useRowIds(tableId, store),
|
|
9490
|
-
),
|
|
9491
|
-
});
|
|
9492
|
-
const SortedTableInHtmlTable = ({
|
|
9493
|
-
tableId,
|
|
9715
|
+
|
|
9716
|
+
const ResultSortedTableInHtmlTable = ({
|
|
9717
|
+
queryId,
|
|
9494
9718
|
cellId,
|
|
9495
9719
|
descending,
|
|
9496
9720
|
offset,
|
|
9497
9721
|
limit,
|
|
9498
|
-
|
|
9499
|
-
editable,
|
|
9722
|
+
queries,
|
|
9500
9723
|
sortOnClick,
|
|
9501
9724
|
paginator = false,
|
|
9502
|
-
onChange,
|
|
9503
9725
|
customCells,
|
|
9726
|
+
extraCellsBefore,
|
|
9727
|
+
extraCellsAfter,
|
|
9728
|
+
onChange,
|
|
9504
9729
|
...props
|
|
9505
9730
|
}) => {
|
|
9506
9731
|
const [sortAndOffset, handleSort, paginatorComponent] =
|
|
@@ -9510,7 +9735,7 @@ const SortedTableInHtmlTable = ({
|
|
|
9510
9735
|
sortOnClick,
|
|
9511
9736
|
offset,
|
|
9512
9737
|
limit,
|
|
9513
|
-
|
|
9738
|
+
useResultRowCount(queryId, queries),
|
|
9514
9739
|
paginator,
|
|
9515
9740
|
onChange,
|
|
9516
9741
|
);
|
|
@@ -9518,72 +9743,52 @@ const SortedTableInHtmlTable = ({
|
|
|
9518
9743
|
...props,
|
|
9519
9744
|
params: useParams(
|
|
9520
9745
|
useCells(
|
|
9521
|
-
|
|
9746
|
+
useResultTableCellIds(queryId, queries),
|
|
9522
9747
|
customCells,
|
|
9523
|
-
|
|
9748
|
+
ResultCellView,
|
|
9524
9749
|
),
|
|
9525
|
-
|
|
9526
|
-
|
|
9750
|
+
useQueriesCellComponentProps(queries, queryId),
|
|
9751
|
+
useResultSortedRowIds(queryId, ...sortAndOffset, limit, queries),
|
|
9752
|
+
extraCellsBefore,
|
|
9753
|
+
extraCellsAfter,
|
|
9527
9754
|
sortAndOffset,
|
|
9528
9755
|
handleSort,
|
|
9529
9756
|
paginatorComponent,
|
|
9530
9757
|
),
|
|
9531
9758
|
});
|
|
9532
|
-
};
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
}) =>
|
|
9542
|
-
/* @__PURE__ */
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
}),
|
|
9556
|
-
}),
|
|
9557
|
-
/* @__PURE__ */ jsx('tbody', {
|
|
9558
|
-
children: arrayMap(useValueIds(store), (valueId) =>
|
|
9559
|
-
/* @__PURE__ */ jsxs(
|
|
9560
|
-
'tr',
|
|
9561
|
-
{
|
|
9562
|
-
children: [
|
|
9563
|
-
idColumn === false
|
|
9564
|
-
? null
|
|
9565
|
-
: /* @__PURE__ */ jsx('th', {children: valueId}),
|
|
9566
|
-
/* @__PURE__ */ jsx('td', {
|
|
9567
|
-
children: /* @__PURE__ */ jsx(Value, {
|
|
9568
|
-
...getProps(getValueComponentProps, valueId),
|
|
9569
|
-
valueId,
|
|
9570
|
-
store,
|
|
9571
|
-
}),
|
|
9572
|
-
}),
|
|
9573
|
-
],
|
|
9574
|
-
},
|
|
9575
|
-
valueId,
|
|
9576
|
-
),
|
|
9577
|
-
),
|
|
9578
|
-
}),
|
|
9579
|
-
],
|
|
9759
|
+
};
|
|
9760
|
+
|
|
9761
|
+
const ResultTableInHtmlTable = ({
|
|
9762
|
+
queryId,
|
|
9763
|
+
queries,
|
|
9764
|
+
customCells,
|
|
9765
|
+
extraCellsBefore,
|
|
9766
|
+
extraCellsAfter,
|
|
9767
|
+
...props
|
|
9768
|
+
}) =>
|
|
9769
|
+
/* @__PURE__ */ jsx(HtmlTable, {
|
|
9770
|
+
...props,
|
|
9771
|
+
params: useParams(
|
|
9772
|
+
useCells(
|
|
9773
|
+
useResultTableCellIds(queryId, queries),
|
|
9774
|
+
customCells,
|
|
9775
|
+
ResultCellView,
|
|
9776
|
+
),
|
|
9777
|
+
useQueriesCellComponentProps(queries, queryId),
|
|
9778
|
+
useResultRowIds(queryId, queries),
|
|
9779
|
+
extraCellsBefore,
|
|
9780
|
+
extraCellsAfter,
|
|
9781
|
+
),
|
|
9580
9782
|
});
|
|
9783
|
+
|
|
9581
9784
|
const SliceInHtmlTable = ({
|
|
9582
9785
|
indexId,
|
|
9583
9786
|
sliceId,
|
|
9584
9787
|
indexes,
|
|
9585
9788
|
editable,
|
|
9586
9789
|
customCells,
|
|
9790
|
+
extraCellsBefore,
|
|
9791
|
+
extraCellsAfter,
|
|
9587
9792
|
...props
|
|
9588
9793
|
}) => {
|
|
9589
9794
|
const [resolvedIndexes, store, tableId] = getIndexStoreTableId(
|
|
@@ -9600,105 +9805,26 @@ const SliceInHtmlTable = ({
|
|
|
9600
9805
|
),
|
|
9601
9806
|
useStoreCellComponentProps(store, tableId),
|
|
9602
9807
|
useSliceRowIds(indexId, sliceId, resolvedIndexes),
|
|
9808
|
+
extraCellsBefore,
|
|
9809
|
+
extraCellsAfter,
|
|
9603
9810
|
),
|
|
9604
9811
|
});
|
|
9605
9812
|
};
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
editable,
|
|
9610
|
-
customCells,
|
|
9611
|
-
className,
|
|
9612
|
-
headerRow,
|
|
9613
|
-
idColumn = true,
|
|
9614
|
-
}) => {
|
|
9615
|
-
const [resolvedRelationships, store, localTableId, remoteTableId] =
|
|
9616
|
-
getRelationshipsStoreTableIds(
|
|
9617
|
-
useRelationshipsOrRelationshipsById(relationships),
|
|
9618
|
-
relationshipId,
|
|
9619
|
-
);
|
|
9620
|
-
const cells = useCells(
|
|
9621
|
-
[
|
|
9622
|
-
...useDottedCellIds(localTableId, store),
|
|
9623
|
-
...useDottedCellIds(remoteTableId, store),
|
|
9624
|
-
],
|
|
9625
|
-
customCells,
|
|
9626
|
-
editable ? EditableCellView : CellView,
|
|
9627
|
-
);
|
|
9628
|
-
const params = useParams(
|
|
9629
|
-
idColumn,
|
|
9630
|
-
cells,
|
|
9631
|
-
localTableId,
|
|
9632
|
-
remoteTableId,
|
|
9633
|
-
relationshipId,
|
|
9634
|
-
resolvedRelationships,
|
|
9635
|
-
store,
|
|
9636
|
-
);
|
|
9637
|
-
return /* @__PURE__ */ jsxs('table', {
|
|
9638
|
-
className,
|
|
9639
|
-
children: [
|
|
9640
|
-
headerRow === false
|
|
9641
|
-
? null
|
|
9642
|
-
: /* @__PURE__ */ jsx('thead', {
|
|
9643
|
-
children: /* @__PURE__ */ jsxs('tr', {
|
|
9644
|
-
children: [
|
|
9645
|
-
idColumn === false
|
|
9646
|
-
? null
|
|
9647
|
-
: /* @__PURE__ */ jsxs(Fragment, {
|
|
9648
|
-
children: [
|
|
9649
|
-
/* @__PURE__ */ jsxs('th', {
|
|
9650
|
-
children: [localTableId, '.Id'],
|
|
9651
|
-
}),
|
|
9652
|
-
/* @__PURE__ */ jsxs('th', {
|
|
9653
|
-
children: [remoteTableId, '.Id'],
|
|
9654
|
-
}),
|
|
9655
|
-
],
|
|
9656
|
-
}),
|
|
9657
|
-
objToArray(cells, ({label}, cellId) =>
|
|
9658
|
-
/* @__PURE__ */ jsx('th', {children: label}, cellId),
|
|
9659
|
-
),
|
|
9660
|
-
],
|
|
9661
|
-
}),
|
|
9662
|
-
}),
|
|
9663
|
-
/* @__PURE__ */ jsx('tbody', {
|
|
9664
|
-
children: arrayMap(useRowIds(localTableId, store), (localRowId) =>
|
|
9665
|
-
/* @__PURE__ */ jsx(
|
|
9666
|
-
RelationshipInHtmlRow,
|
|
9667
|
-
{
|
|
9668
|
-
localRowId,
|
|
9669
|
-
params,
|
|
9670
|
-
},
|
|
9671
|
-
localRowId,
|
|
9672
|
-
),
|
|
9673
|
-
),
|
|
9674
|
-
}),
|
|
9675
|
-
],
|
|
9676
|
-
});
|
|
9677
|
-
};
|
|
9678
|
-
const ResultTableInHtmlTable = ({queryId, queries, customCells, ...props}) =>
|
|
9679
|
-
/* @__PURE__ */ jsx(HtmlTable, {
|
|
9680
|
-
...props,
|
|
9681
|
-
params: useParams(
|
|
9682
|
-
useCells(
|
|
9683
|
-
useResultTableCellIds(queryId, queries),
|
|
9684
|
-
customCells,
|
|
9685
|
-
ResultCellView,
|
|
9686
|
-
),
|
|
9687
|
-
useQueriesCellComponentProps(queries, queryId),
|
|
9688
|
-
useResultRowIds(queryId, queries),
|
|
9689
|
-
),
|
|
9690
|
-
});
|
|
9691
|
-
const ResultSortedTableInHtmlTable = ({
|
|
9692
|
-
queryId,
|
|
9813
|
+
|
|
9814
|
+
const SortedTableInHtmlTable = ({
|
|
9815
|
+
tableId,
|
|
9693
9816
|
cellId,
|
|
9694
9817
|
descending,
|
|
9695
9818
|
offset,
|
|
9696
9819
|
limit,
|
|
9697
|
-
|
|
9820
|
+
store,
|
|
9821
|
+
editable,
|
|
9698
9822
|
sortOnClick,
|
|
9699
9823
|
paginator = false,
|
|
9700
|
-
customCells,
|
|
9701
9824
|
onChange,
|
|
9825
|
+
customCells,
|
|
9826
|
+
extraCellsBefore,
|
|
9827
|
+
extraCellsAfter,
|
|
9702
9828
|
...props
|
|
9703
9829
|
}) => {
|
|
9704
9830
|
const [sortAndOffset, handleSort, paginatorComponent] =
|
|
@@ -9708,7 +9834,7 @@ const ResultSortedTableInHtmlTable = ({
|
|
|
9708
9834
|
sortOnClick,
|
|
9709
9835
|
offset,
|
|
9710
9836
|
limit,
|
|
9711
|
-
|
|
9837
|
+
useRowCount(tableId, store),
|
|
9712
9838
|
paginator,
|
|
9713
9839
|
onChange,
|
|
9714
9840
|
);
|
|
@@ -9716,99 +9842,117 @@ const ResultSortedTableInHtmlTable = ({
|
|
|
9716
9842
|
...props,
|
|
9717
9843
|
params: useParams(
|
|
9718
9844
|
useCells(
|
|
9719
|
-
|
|
9845
|
+
useTableCellIds(tableId, store),
|
|
9720
9846
|
customCells,
|
|
9721
|
-
|
|
9847
|
+
editable ? EditableCellView : CellView,
|
|
9722
9848
|
),
|
|
9723
|
-
|
|
9724
|
-
|
|
9849
|
+
useStoreCellComponentProps(store, tableId),
|
|
9850
|
+
useSortedRowIds(tableId, ...sortAndOffset, limit, store),
|
|
9851
|
+
extraCellsBefore,
|
|
9852
|
+
extraCellsAfter,
|
|
9725
9853
|
sortAndOffset,
|
|
9726
9854
|
handleSort,
|
|
9727
9855
|
paginatorComponent,
|
|
9728
9856
|
),
|
|
9729
9857
|
});
|
|
9730
9858
|
};
|
|
9731
|
-
|
|
9859
|
+
|
|
9860
|
+
const TableInHtmlTable = ({
|
|
9732
9861
|
tableId,
|
|
9733
|
-
rowId,
|
|
9734
|
-
cellId,
|
|
9735
9862
|
store,
|
|
9736
|
-
|
|
9737
|
-
|
|
9863
|
+
editable,
|
|
9864
|
+
customCells,
|
|
9865
|
+
extraCellsBefore,
|
|
9866
|
+
extraCellsAfter,
|
|
9867
|
+
...props
|
|
9738
9868
|
}) =>
|
|
9739
|
-
/* @__PURE__ */ jsx(
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
store,
|
|
9869
|
+
/* @__PURE__ */ jsx(HtmlTable, {
|
|
9870
|
+
...props,
|
|
9871
|
+
params: useParams(
|
|
9872
|
+
useCells(
|
|
9873
|
+
useTableCellIds(tableId, store),
|
|
9874
|
+
customCells,
|
|
9875
|
+
editable ? EditableCellView : CellView,
|
|
9876
|
+
),
|
|
9877
|
+
useStoreCellComponentProps(store, tableId),
|
|
9878
|
+
useRowIds(tableId, store),
|
|
9879
|
+
extraCellsBefore,
|
|
9880
|
+
extraCellsAfter,
|
|
9748
9881
|
),
|
|
9749
|
-
className: className ?? EDITABLE + CELL,
|
|
9750
|
-
showType,
|
|
9751
|
-
hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
|
|
9752
|
-
});
|
|
9753
|
-
const EditableValueView = ({valueId, store, className, showType}) =>
|
|
9754
|
-
/* @__PURE__ */ jsx(EditableThing, {
|
|
9755
|
-
thing: useValue(valueId, store),
|
|
9756
|
-
onThingChange: useSetValueCallback(valueId, (value) => value, [], store),
|
|
9757
|
-
className: className ?? EDITABLE + VALUE,
|
|
9758
|
-
showType,
|
|
9759
|
-
hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
|
|
9760
9882
|
});
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
offset > 0,
|
|
9777
|
-
);
|
|
9778
|
-
const handleNextClick = useCallbackOrUndefined(
|
|
9779
|
-
() => onChange(offset + limit),
|
|
9780
|
-
[onChange, offset, limit],
|
|
9781
|
-
offset + limit < total,
|
|
9883
|
+
|
|
9884
|
+
const extraValueCells = (
|
|
9885
|
+
extraValueCells2 = [],
|
|
9886
|
+
extraValueCellProps,
|
|
9887
|
+
after = 0,
|
|
9888
|
+
) =>
|
|
9889
|
+
arrayMap(extraValueCells2, ({component: Component}, index) =>
|
|
9890
|
+
/* @__PURE__ */ jsx(
|
|
9891
|
+
'td',
|
|
9892
|
+
{
|
|
9893
|
+
className: EXTRA,
|
|
9894
|
+
children: /* @__PURE__ */ jsx(Component, {...extraValueCellProps}),
|
|
9895
|
+
},
|
|
9896
|
+
extraKey(index, after),
|
|
9897
|
+
),
|
|
9782
9898
|
);
|
|
9783
|
-
|
|
9899
|
+
const ValuesInHtmlTable = ({
|
|
9900
|
+
store,
|
|
9901
|
+
editable = false,
|
|
9902
|
+
valueComponent: Value = editable ? EditableValueView : ValueView,
|
|
9903
|
+
getValueComponentProps,
|
|
9904
|
+
extraCellsBefore,
|
|
9905
|
+
extraCellsAfter,
|
|
9906
|
+
className,
|
|
9907
|
+
headerRow,
|
|
9908
|
+
idColumn,
|
|
9909
|
+
}) =>
|
|
9910
|
+
/* @__PURE__ */ jsxs('table', {
|
|
9911
|
+
className,
|
|
9784
9912
|
children: [
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
/* @__PURE__ */
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
onClick: handleNextClick,
|
|
9798
|
-
children: RIGHT_ARROW,
|
|
9913
|
+
headerRow === false
|
|
9914
|
+
? null
|
|
9915
|
+
: /* @__PURE__ */ jsx('thead', {
|
|
9916
|
+
children: /* @__PURE__ */ jsxs('tr', {
|
|
9917
|
+
children: [
|
|
9918
|
+
extraHeaders(extraCellsBefore),
|
|
9919
|
+
idColumn === false
|
|
9920
|
+
? null
|
|
9921
|
+
: /* @__PURE__ */ jsx('th', {children: 'Id'}),
|
|
9922
|
+
/* @__PURE__ */ jsx('th', {children: VALUE}),
|
|
9923
|
+
extraHeaders(extraCellsAfter, 1),
|
|
9924
|
+
],
|
|
9799
9925
|
}),
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9926
|
+
}),
|
|
9927
|
+
/* @__PURE__ */ jsx('tbody', {
|
|
9928
|
+
children: arrayMap(useValueIds(store), (valueId) => {
|
|
9929
|
+
const valueProps = {valueId, store};
|
|
9930
|
+
return /* @__PURE__ */ jsxs(
|
|
9931
|
+
'tr',
|
|
9932
|
+
{
|
|
9933
|
+
children: [
|
|
9934
|
+
extraValueCells(extraCellsBefore, valueProps),
|
|
9935
|
+
idColumn === false
|
|
9936
|
+
? null
|
|
9937
|
+
: /* @__PURE__ */ jsx('th', {
|
|
9938
|
+
title: valueId,
|
|
9939
|
+
children: valueId,
|
|
9940
|
+
}),
|
|
9941
|
+
/* @__PURE__ */ jsx('td', {
|
|
9942
|
+
children: /* @__PURE__ */ jsx(Value, {
|
|
9943
|
+
...getProps(getValueComponentProps, valueId),
|
|
9944
|
+
...valueProps,
|
|
9945
|
+
}),
|
|
9946
|
+
}),
|
|
9947
|
+
extraValueCells(extraCellsAfter, valueProps, 1),
|
|
9948
|
+
],
|
|
9949
|
+
},
|
|
9950
|
+
valueId,
|
|
9951
|
+
);
|
|
9805
9952
|
}),
|
|
9806
|
-
|
|
9807
|
-
' ',
|
|
9808
|
-
total != 1 ? plural : singular,
|
|
9953
|
+
}),
|
|
9809
9954
|
],
|
|
9810
9955
|
});
|
|
9811
|
-
};
|
|
9812
9956
|
|
|
9813
9957
|
const UNIQUE_ID = 'tinybaseInspector';
|
|
9814
9958
|
const TITLE = 'TinyBase Inspector';
|
|
@@ -9842,16 +9986,9 @@ const Nub = ({s}) => {
|
|
|
9842
9986
|
title: TITLE,
|
|
9843
9987
|
'data-position': position,
|
|
9844
9988
|
});
|
|
9845
|
-
};
|
|
9846
|
-
|
|
9847
|
-
const Details = ({
|
|
9848
|
-
uniqueId,
|
|
9849
|
-
summary,
|
|
9850
|
-
editable,
|
|
9851
|
-
handleEditable,
|
|
9852
|
-
children,
|
|
9853
|
-
s,
|
|
9854
|
-
}) => {
|
|
9989
|
+
};
|
|
9990
|
+
|
|
9991
|
+
const Details = ({uniqueId, title, editable, handleEditable, children, s}) => {
|
|
9855
9992
|
const open = !!useCell(STATE_TABLE, uniqueId, OPEN_CELL, s);
|
|
9856
9993
|
const handleToggle = useSetCellCallback(
|
|
9857
9994
|
STATE_TABLE,
|
|
@@ -9867,16 +10004,17 @@ const Details = ({
|
|
|
9867
10004
|
children: [
|
|
9868
10005
|
/* @__PURE__ */ jsxs('summary', {
|
|
9869
10006
|
children: [
|
|
9870
|
-
|
|
10007
|
+
/* @__PURE__ */ jsx('span', {children: title}),
|
|
9871
10008
|
handleEditable
|
|
9872
10009
|
? /* @__PURE__ */ jsx('img', {
|
|
9873
10010
|
onClick: handleEditable,
|
|
9874
10011
|
className: editable ? 'done' : 'edit',
|
|
10012
|
+
title: editable ? 'Done editing' : 'Edit',
|
|
9875
10013
|
})
|
|
9876
10014
|
: null,
|
|
9877
10015
|
],
|
|
9878
10016
|
}),
|
|
9879
|
-
children,
|
|
10017
|
+
/* @__PURE__ */ jsx('div', {children}),
|
|
9880
10018
|
],
|
|
9881
10019
|
});
|
|
9882
10020
|
};
|
|
@@ -9884,7 +10022,7 @@ const Details = ({
|
|
|
9884
10022
|
const IndexView = ({indexes, indexesId, indexId, s}) =>
|
|
9885
10023
|
/* @__PURE__ */ jsx(Details, {
|
|
9886
10024
|
uniqueId: getUniqueId('i', indexesId, indexId),
|
|
9887
|
-
|
|
10025
|
+
title: 'Index: ' + indexId,
|
|
9888
10026
|
s,
|
|
9889
10027
|
children: arrayMap(useSliceIds(indexId, indexes), (sliceId) =>
|
|
9890
10028
|
/* @__PURE__ */ jsx(
|
|
@@ -9905,7 +10043,7 @@ const SliceView = ({indexes, indexesId, indexId, sliceId, s}) => {
|
|
|
9905
10043
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
9906
10044
|
return /* @__PURE__ */ jsx(Details, {
|
|
9907
10045
|
uniqueId,
|
|
9908
|
-
|
|
10046
|
+
title: 'Slice: ' + sliceId,
|
|
9909
10047
|
editable,
|
|
9910
10048
|
handleEditable,
|
|
9911
10049
|
s,
|
|
@@ -9924,7 +10062,7 @@ const IndexesView = ({indexesId, s}) => {
|
|
|
9924
10062
|
? null
|
|
9925
10063
|
: /* @__PURE__ */ jsx(Details, {
|
|
9926
10064
|
uniqueId: getUniqueId('i', indexesId),
|
|
9927
|
-
|
|
10065
|
+
title: 'Indexes: ' + (indexesId ?? DEFAULT),
|
|
9928
10066
|
s,
|
|
9929
10067
|
children: arrayIsEmpty(indexIds)
|
|
9930
10068
|
? 'No indexes defined'
|
|
@@ -9946,7 +10084,7 @@ const IndexesView = ({indexesId, s}) => {
|
|
|
9946
10084
|
const MetricRow = ({metrics, metricId}) =>
|
|
9947
10085
|
/* @__PURE__ */ jsxs('tr', {
|
|
9948
10086
|
children: [
|
|
9949
|
-
/* @__PURE__ */ jsx('th', {children: metricId}),
|
|
10087
|
+
/* @__PURE__ */ jsx('th', {title: metricId, children: metricId}),
|
|
9950
10088
|
/* @__PURE__ */ jsx('td', {children: metrics?.getTableId(metricId)}),
|
|
9951
10089
|
/* @__PURE__ */ jsx('td', {children: useMetric(metricId, metrics)}),
|
|
9952
10090
|
],
|
|
@@ -9958,7 +10096,7 @@ const MetricsView = ({metricsId, s}) => {
|
|
|
9958
10096
|
? null
|
|
9959
10097
|
: /* @__PURE__ */ jsx(Details, {
|
|
9960
10098
|
uniqueId: getUniqueId('m', metricsId),
|
|
9961
|
-
|
|
10099
|
+
title: 'Metrics: ' + (metricsId ?? DEFAULT),
|
|
9962
10100
|
s,
|
|
9963
10101
|
children: arrayIsEmpty(metricIds)
|
|
9964
10102
|
? 'No metrics defined'
|
|
@@ -10000,7 +10138,7 @@ const QueryView = ({queries, queriesId, queryId, s}) => {
|
|
|
10000
10138
|
);
|
|
10001
10139
|
return /* @__PURE__ */ jsx(Details, {
|
|
10002
10140
|
uniqueId,
|
|
10003
|
-
|
|
10141
|
+
title: 'Query: ' + queryId,
|
|
10004
10142
|
s,
|
|
10005
10143
|
children: /* @__PURE__ */ jsx(ResultSortedTableInHtmlTable, {
|
|
10006
10144
|
queryId,
|
|
@@ -10022,7 +10160,7 @@ const QueriesView = ({queriesId, s}) => {
|
|
|
10022
10160
|
? null
|
|
10023
10161
|
: /* @__PURE__ */ jsx(Details, {
|
|
10024
10162
|
uniqueId: getUniqueId('q', queriesId),
|
|
10025
|
-
|
|
10163
|
+
title: 'Queries: ' + (queriesId ?? DEFAULT),
|
|
10026
10164
|
s,
|
|
10027
10165
|
children: arrayIsEmpty(queryIds)
|
|
10028
10166
|
? 'No queries defined'
|
|
@@ -10051,7 +10189,7 @@ const RelationshipView = ({
|
|
|
10051
10189
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
10052
10190
|
return /* @__PURE__ */ jsx(Details, {
|
|
10053
10191
|
uniqueId,
|
|
10054
|
-
|
|
10192
|
+
title: 'Relationship: ' + relationshipId,
|
|
10055
10193
|
editable,
|
|
10056
10194
|
handleEditable,
|
|
10057
10195
|
s,
|
|
@@ -10069,7 +10207,7 @@ const RelationshipsView = ({relationshipsId, s}) => {
|
|
|
10069
10207
|
? null
|
|
10070
10208
|
: /* @__PURE__ */ jsx(Details, {
|
|
10071
10209
|
uniqueId: getUniqueId('r', relationshipsId),
|
|
10072
|
-
|
|
10210
|
+
title: 'Relationships: ' + (relationshipsId ?? DEFAULT),
|
|
10073
10211
|
s,
|
|
10074
10212
|
children: arrayIsEmpty(relationshipIds)
|
|
10075
10213
|
? 'No relationships defined'
|
|
@@ -10088,6 +10226,312 @@ const RelationshipsView = ({relationshipsId, s}) => {
|
|
|
10088
10226
|
});
|
|
10089
10227
|
};
|
|
10090
10228
|
|
|
10229
|
+
const getNewIdFromSuggestedId = (suggestedId, has) => {
|
|
10230
|
+
let newId;
|
|
10231
|
+
let suffix = 0;
|
|
10232
|
+
while (
|
|
10233
|
+
has(
|
|
10234
|
+
(newId =
|
|
10235
|
+
suggestedId +
|
|
10236
|
+
(suffix > 0 ? ' (copy' + (suffix > 1 ? ' ' + suffix : '') + ')' : '')),
|
|
10237
|
+
)
|
|
10238
|
+
) {
|
|
10239
|
+
suffix++;
|
|
10240
|
+
}
|
|
10241
|
+
return newId;
|
|
10242
|
+
};
|
|
10243
|
+
const ConfirmableActions = ({actions, ...props}) => {
|
|
10244
|
+
const [confirming, setConfirming] = useState();
|
|
10245
|
+
const handleDone = useCallback(() => setConfirming(null), []);
|
|
10246
|
+
useEffect(() => {
|
|
10247
|
+
if (confirming != null) {
|
|
10248
|
+
const handleKeyDown = (e) => {
|
|
10249
|
+
if (confirming != null && e.key === 'Escape') {
|
|
10250
|
+
e.preventDefault();
|
|
10251
|
+
handleDone();
|
|
10252
|
+
}
|
|
10253
|
+
};
|
|
10254
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
10255
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
10256
|
+
}
|
|
10257
|
+
}, [confirming, handleDone]);
|
|
10258
|
+
if (confirming != null) {
|
|
10259
|
+
const [, , Component] = actions[confirming];
|
|
10260
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
10261
|
+
children: [
|
|
10262
|
+
/* @__PURE__ */ jsx(Component, {onDone: handleDone, ...props}),
|
|
10263
|
+
/* @__PURE__ */ jsx('img', {
|
|
10264
|
+
onClick: handleDone,
|
|
10265
|
+
title: 'Cancel',
|
|
10266
|
+
className: 'cancel',
|
|
10267
|
+
}),
|
|
10268
|
+
],
|
|
10269
|
+
});
|
|
10270
|
+
} else {
|
|
10271
|
+
return actions.map(([icon, title], index) =>
|
|
10272
|
+
/* @__PURE__ */ jsx(
|
|
10273
|
+
'img',
|
|
10274
|
+
{
|
|
10275
|
+
title,
|
|
10276
|
+
className: icon,
|
|
10277
|
+
onClick: () => setConfirming(index),
|
|
10278
|
+
},
|
|
10279
|
+
index,
|
|
10280
|
+
),
|
|
10281
|
+
);
|
|
10282
|
+
}
|
|
10283
|
+
};
|
|
10284
|
+
const NewId = ({onDone, suggestedId, has, set, prompt = 'New Id'}) => {
|
|
10285
|
+
const [newId, setNewId] = useState(suggestedId);
|
|
10286
|
+
const [newIdOk, setNewIdOk] = useState(true);
|
|
10287
|
+
const [previousSuggestedId, setPreviousSuggestedNewId] =
|
|
10288
|
+
useState(suggestedId);
|
|
10289
|
+
const handleNewIdChange = (e) => {
|
|
10290
|
+
setNewId(e.target.value);
|
|
10291
|
+
setNewIdOk(!has(e.target.value));
|
|
10292
|
+
};
|
|
10293
|
+
const handleClick = useCallback(() => {
|
|
10294
|
+
if (has(newId)) {
|
|
10295
|
+
setNewIdOk(false);
|
|
10296
|
+
} else {
|
|
10297
|
+
set(newId);
|
|
10298
|
+
onDone();
|
|
10299
|
+
}
|
|
10300
|
+
}, [onDone, setNewIdOk, has, set, newId]);
|
|
10301
|
+
const handleKeyDown = useCallback(
|
|
10302
|
+
(e) => {
|
|
10303
|
+
if (e.key === 'Enter') {
|
|
10304
|
+
e.preventDefault();
|
|
10305
|
+
handleClick();
|
|
10306
|
+
}
|
|
10307
|
+
},
|
|
10308
|
+
[handleClick],
|
|
10309
|
+
);
|
|
10310
|
+
if (suggestedId != previousSuggestedId) {
|
|
10311
|
+
setNewId(suggestedId);
|
|
10312
|
+
setPreviousSuggestedNewId(suggestedId);
|
|
10313
|
+
}
|
|
10314
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
10315
|
+
children: [
|
|
10316
|
+
prompt + ': ',
|
|
10317
|
+
/* @__PURE__ */ jsx('input', {
|
|
10318
|
+
type: 'text',
|
|
10319
|
+
value: newId,
|
|
10320
|
+
onChange: handleNewIdChange,
|
|
10321
|
+
onKeyDown: handleKeyDown,
|
|
10322
|
+
autoFocus: true,
|
|
10323
|
+
}),
|
|
10324
|
+
' ',
|
|
10325
|
+
/* @__PURE__ */ jsx('img', {
|
|
10326
|
+
onClick: handleClick,
|
|
10327
|
+
title: newIdOk ? 'Confirm' : 'Id already exists',
|
|
10328
|
+
className: newIdOk ? 'ok' : 'okDis',
|
|
10329
|
+
}),
|
|
10330
|
+
],
|
|
10331
|
+
});
|
|
10332
|
+
};
|
|
10333
|
+
const Delete = ({onClick, prompt = 'Delete'}) => {
|
|
10334
|
+
const handleKeyDown = useCallback(
|
|
10335
|
+
(e) => {
|
|
10336
|
+
if (e.key === 'Enter') {
|
|
10337
|
+
e.preventDefault();
|
|
10338
|
+
onClick();
|
|
10339
|
+
}
|
|
10340
|
+
},
|
|
10341
|
+
[onClick],
|
|
10342
|
+
);
|
|
10343
|
+
useEffect(() => {
|
|
10344
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
10345
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
10346
|
+
}, [handleKeyDown]);
|
|
10347
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
10348
|
+
children: [
|
|
10349
|
+
prompt,
|
|
10350
|
+
'? ',
|
|
10351
|
+
/* @__PURE__ */ jsx('img', {onClick, title: 'Confirm', className: 'ok'}),
|
|
10352
|
+
],
|
|
10353
|
+
});
|
|
10354
|
+
};
|
|
10355
|
+
const Actions = ({left, right}) =>
|
|
10356
|
+
/* @__PURE__ */ jsxs('div', {
|
|
10357
|
+
className: 'actions',
|
|
10358
|
+
children: [
|
|
10359
|
+
/* @__PURE__ */ jsx('div', {children: left}),
|
|
10360
|
+
/* @__PURE__ */ jsx('div', {children: right}),
|
|
10361
|
+
],
|
|
10362
|
+
});
|
|
10363
|
+
|
|
10364
|
+
const useHasTableCallback = (storeOrStoreId) => {
|
|
10365
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10366
|
+
return useCallback((tableId) => store?.hasTable(tableId) ?? false, [store]);
|
|
10367
|
+
};
|
|
10368
|
+
const AddTable = ({onDone, store}) => {
|
|
10369
|
+
const has = useHasTableCallback(store);
|
|
10370
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10371
|
+
onDone,
|
|
10372
|
+
suggestedId: getNewIdFromSuggestedId('table', has),
|
|
10373
|
+
has,
|
|
10374
|
+
set: useSetTableCallback(
|
|
10375
|
+
(newId) => newId,
|
|
10376
|
+
() => ({row: {cell: ''}}),
|
|
10377
|
+
[],
|
|
10378
|
+
store,
|
|
10379
|
+
),
|
|
10380
|
+
prompt: 'Add table',
|
|
10381
|
+
});
|
|
10382
|
+
};
|
|
10383
|
+
const DeleteTables = ({onDone, store}) =>
|
|
10384
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10385
|
+
onClick: useDelTablesCallback(store, onDone),
|
|
10386
|
+
prompt: 'Delete all tables',
|
|
10387
|
+
});
|
|
10388
|
+
const TablesActions = ({store}) =>
|
|
10389
|
+
/* @__PURE__ */ jsx(Actions, {
|
|
10390
|
+
left: /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10391
|
+
actions: [['add', 'Add table', AddTable]],
|
|
10392
|
+
store,
|
|
10393
|
+
}),
|
|
10394
|
+
right: useHasTables(store)
|
|
10395
|
+
? /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10396
|
+
actions: [['delete', 'Delete all tables', DeleteTables]],
|
|
10397
|
+
store,
|
|
10398
|
+
})
|
|
10399
|
+
: null,
|
|
10400
|
+
});
|
|
10401
|
+
const AddRow = ({onDone, tableId, store}) => {
|
|
10402
|
+
const has = useHasRowCallback(store, tableId);
|
|
10403
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10404
|
+
onDone,
|
|
10405
|
+
suggestedId: getNewIdFromSuggestedId('row', has),
|
|
10406
|
+
has,
|
|
10407
|
+
set: useSetRowCallback(
|
|
10408
|
+
tableId,
|
|
10409
|
+
(newId) => newId,
|
|
10410
|
+
(_, store2) =>
|
|
10411
|
+
objNew(
|
|
10412
|
+
arrayMap(store2.getTableCellIds(tableId), (cellId) => [cellId, '']),
|
|
10413
|
+
),
|
|
10414
|
+
),
|
|
10415
|
+
prompt: 'Add row',
|
|
10416
|
+
});
|
|
10417
|
+
};
|
|
10418
|
+
const CloneTable = ({onDone, tableId, store: storeOrStoreId}) => {
|
|
10419
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10420
|
+
const has = useHasTableCallback(store);
|
|
10421
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10422
|
+
onDone,
|
|
10423
|
+
suggestedId: getNewIdFromSuggestedId(tableId, has),
|
|
10424
|
+
has,
|
|
10425
|
+
set: useSetTableCallback(
|
|
10426
|
+
(tableId2) => tableId2,
|
|
10427
|
+
(_, store2) => store2.getTable(tableId),
|
|
10428
|
+
),
|
|
10429
|
+
prompt: 'Clone table to',
|
|
10430
|
+
});
|
|
10431
|
+
};
|
|
10432
|
+
const DeleteTable = ({onDone, tableId, store}) =>
|
|
10433
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10434
|
+
onClick: useDelTableCallback(tableId, store, onDone),
|
|
10435
|
+
prompt: 'Delete table',
|
|
10436
|
+
});
|
|
10437
|
+
const TableActions1 = ({tableId, store}) =>
|
|
10438
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10439
|
+
actions: [['add', 'Add row', AddRow]],
|
|
10440
|
+
store,
|
|
10441
|
+
tableId,
|
|
10442
|
+
});
|
|
10443
|
+
const TableActions2 = ({tableId, store}) =>
|
|
10444
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10445
|
+
actions: [
|
|
10446
|
+
['clone', 'Clone table', CloneTable],
|
|
10447
|
+
['delete', 'Delete table', DeleteTable],
|
|
10448
|
+
],
|
|
10449
|
+
store,
|
|
10450
|
+
tableId,
|
|
10451
|
+
});
|
|
10452
|
+
const useHasRowCallback = (storeOrStoreId, tableId) => {
|
|
10453
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10454
|
+
return useCallback(
|
|
10455
|
+
(rowId) => store?.hasRow(tableId, rowId) ?? false,
|
|
10456
|
+
[store, tableId],
|
|
10457
|
+
);
|
|
10458
|
+
};
|
|
10459
|
+
const AddCell = ({onDone, tableId, rowId, store: storeOrStoreId}) => {
|
|
10460
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10461
|
+
const has = useCallback(
|
|
10462
|
+
(cellId) => store.hasCell(tableId, rowId, cellId),
|
|
10463
|
+
[store, tableId, rowId],
|
|
10464
|
+
);
|
|
10465
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10466
|
+
onDone,
|
|
10467
|
+
suggestedId: getNewIdFromSuggestedId('cell', has),
|
|
10468
|
+
has,
|
|
10469
|
+
set: useSetCellCallback(
|
|
10470
|
+
tableId,
|
|
10471
|
+
rowId,
|
|
10472
|
+
(newId) => newId,
|
|
10473
|
+
() => '',
|
|
10474
|
+
[],
|
|
10475
|
+
store,
|
|
10476
|
+
),
|
|
10477
|
+
prompt: 'Add cell',
|
|
10478
|
+
});
|
|
10479
|
+
};
|
|
10480
|
+
const CloneRow = ({onDone, tableId, rowId, store: storeOrStoreId}) => {
|
|
10481
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10482
|
+
const has = useHasRowCallback(store, tableId);
|
|
10483
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10484
|
+
onDone,
|
|
10485
|
+
suggestedId: getNewIdFromSuggestedId(rowId, has),
|
|
10486
|
+
has,
|
|
10487
|
+
set: useSetRowCallback(
|
|
10488
|
+
tableId,
|
|
10489
|
+
(newId) => newId,
|
|
10490
|
+
(_, store2) => store2.getRow(tableId, rowId),
|
|
10491
|
+
[rowId],
|
|
10492
|
+
),
|
|
10493
|
+
prompt: 'Clone row to',
|
|
10494
|
+
});
|
|
10495
|
+
};
|
|
10496
|
+
const DeleteRow = ({onDone, tableId, rowId, store}) =>
|
|
10497
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10498
|
+
onClick: useDelRowCallback(tableId, rowId, store, onDone),
|
|
10499
|
+
prompt: 'Delete row',
|
|
10500
|
+
});
|
|
10501
|
+
const RowActions = ({tableId, rowId, store}) =>
|
|
10502
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10503
|
+
actions: [
|
|
10504
|
+
['add', 'Add cell', AddCell],
|
|
10505
|
+
['clone', 'Clone row', CloneRow],
|
|
10506
|
+
['delete', 'Delete row', DeleteRow],
|
|
10507
|
+
],
|
|
10508
|
+
store,
|
|
10509
|
+
tableId,
|
|
10510
|
+
rowId,
|
|
10511
|
+
});
|
|
10512
|
+
const CellDelete = ({onDone, tableId, rowId, cellId, store}) =>
|
|
10513
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10514
|
+
onClick: useDelCellCallback(tableId, rowId, cellId, true, store, onDone),
|
|
10515
|
+
prompt: 'Delete cell',
|
|
10516
|
+
});
|
|
10517
|
+
const CellActions = ({tableId, rowId, cellId, store}) =>
|
|
10518
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10519
|
+
actions: [['delete', 'Delete cell', CellDelete]],
|
|
10520
|
+
store,
|
|
10521
|
+
tableId,
|
|
10522
|
+
rowId,
|
|
10523
|
+
cellId,
|
|
10524
|
+
});
|
|
10525
|
+
|
|
10526
|
+
const rowActions = [{label: '', component: RowActions}];
|
|
10527
|
+
const EditableCellViewWithActions = (props) =>
|
|
10528
|
+
/* @__PURE__ */ jsxs(Fragment, {
|
|
10529
|
+
children: [
|
|
10530
|
+
/* @__PURE__ */ jsx(EditableCellView, {...props}),
|
|
10531
|
+
useHasCell(props.tableId, props.rowId, props.cellId, props.store) &&
|
|
10532
|
+
/* @__PURE__ */ jsx(CellActions, {...props}),
|
|
10533
|
+
],
|
|
10534
|
+
});
|
|
10091
10535
|
const TableView = ({tableId, store, storeId, s}) => {
|
|
10092
10536
|
const uniqueId = getUniqueId('t', storeId, tableId);
|
|
10093
10537
|
const [cellId, descending, offset] = jsonParse(
|
|
@@ -10102,66 +10546,183 @@ const TableView = ({tableId, store, storeId, s}) => {
|
|
|
10102
10546
|
s,
|
|
10103
10547
|
);
|
|
10104
10548
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
10105
|
-
|
|
10549
|
+
const CellComponent = editable ? EditableCellViewWithActions : CellView;
|
|
10550
|
+
return /* @__PURE__ */ jsxs(Details, {
|
|
10106
10551
|
uniqueId,
|
|
10107
|
-
|
|
10552
|
+
title: TABLE$1 + ': ' + tableId,
|
|
10108
10553
|
editable,
|
|
10109
10554
|
handleEditable,
|
|
10110
10555
|
s,
|
|
10111
|
-
children:
|
|
10112
|
-
|
|
10556
|
+
children: [
|
|
10557
|
+
/* @__PURE__ */ jsx(SortedTableInHtmlTable, {
|
|
10558
|
+
tableId,
|
|
10559
|
+
store,
|
|
10560
|
+
cellId,
|
|
10561
|
+
descending,
|
|
10562
|
+
offset,
|
|
10563
|
+
limit: 10,
|
|
10564
|
+
paginator: true,
|
|
10565
|
+
sortOnClick: true,
|
|
10566
|
+
onChange: handleChange,
|
|
10567
|
+
editable,
|
|
10568
|
+
extraCellsAfter: editable ? rowActions : [],
|
|
10569
|
+
customCells: objNew(
|
|
10570
|
+
arrayMap(useTableCellIds(tableId, store), (cellId2) => [
|
|
10571
|
+
cellId2,
|
|
10572
|
+
{label: cellId2, component: CellComponent},
|
|
10573
|
+
]),
|
|
10574
|
+
),
|
|
10575
|
+
}),
|
|
10576
|
+
editable
|
|
10577
|
+
? /* @__PURE__ */ jsxs('div', {
|
|
10578
|
+
className: 'actions',
|
|
10579
|
+
children: [
|
|
10580
|
+
/* @__PURE__ */ jsx('div', {
|
|
10581
|
+
children: /* @__PURE__ */ jsx(TableActions1, {tableId, store}),
|
|
10582
|
+
}),
|
|
10583
|
+
/* @__PURE__ */ jsx('div', {
|
|
10584
|
+
children: /* @__PURE__ */ jsx(TableActions2, {tableId, store}),
|
|
10585
|
+
}),
|
|
10586
|
+
],
|
|
10587
|
+
})
|
|
10588
|
+
: null,
|
|
10589
|
+
],
|
|
10590
|
+
});
|
|
10591
|
+
};
|
|
10592
|
+
const TablesView = ({store, storeId, s}) => {
|
|
10593
|
+
const uniqueId = getUniqueId('ts', storeId);
|
|
10594
|
+
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
10595
|
+
const tableIds = useTableIds(store);
|
|
10596
|
+
return /* @__PURE__ */ jsxs(Details, {
|
|
10597
|
+
uniqueId,
|
|
10598
|
+
title: TABLES,
|
|
10599
|
+
editable,
|
|
10600
|
+
handleEditable,
|
|
10601
|
+
s,
|
|
10602
|
+
children: [
|
|
10603
|
+
arrayIsEmpty(tableIds)
|
|
10604
|
+
? /* @__PURE__ */ jsx('caption', {children: 'No tables.'})
|
|
10605
|
+
: sortedIdsMap(tableIds, (tableId) =>
|
|
10606
|
+
/* @__PURE__ */ jsx(
|
|
10607
|
+
TableView,
|
|
10608
|
+
{
|
|
10609
|
+
store,
|
|
10610
|
+
storeId,
|
|
10611
|
+
tableId,
|
|
10612
|
+
s,
|
|
10613
|
+
},
|
|
10614
|
+
tableId,
|
|
10615
|
+
),
|
|
10616
|
+
),
|
|
10617
|
+
editable ? /* @__PURE__ */ jsx(TablesActions, {store}) : null,
|
|
10618
|
+
],
|
|
10619
|
+
});
|
|
10620
|
+
};
|
|
10621
|
+
|
|
10622
|
+
const useHasValueCallback = (storeOrStoreId) => {
|
|
10623
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10624
|
+
return useCallback((valueId) => store?.hasValue(valueId) ?? false, [store]);
|
|
10625
|
+
};
|
|
10626
|
+
const AddValue = ({onDone, store}) => {
|
|
10627
|
+
const has = useHasValueCallback(store);
|
|
10628
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10629
|
+
onDone,
|
|
10630
|
+
suggestedId: getNewIdFromSuggestedId('value', has),
|
|
10631
|
+
has,
|
|
10632
|
+
set: useSetValueCallback(
|
|
10633
|
+
(newId) => newId,
|
|
10634
|
+
() => '',
|
|
10635
|
+
[],
|
|
10636
|
+
store,
|
|
10637
|
+
),
|
|
10638
|
+
prompt: 'Add value',
|
|
10639
|
+
});
|
|
10640
|
+
};
|
|
10641
|
+
const DeleteValues = ({onDone, store}) =>
|
|
10642
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10643
|
+
onClick: useDelValuesCallback(store, onDone),
|
|
10644
|
+
prompt: 'Delete all values',
|
|
10645
|
+
});
|
|
10646
|
+
const ValuesActions = ({store}) =>
|
|
10647
|
+
/* @__PURE__ */ jsx(Actions, {
|
|
10648
|
+
left: /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10649
|
+
actions: [['add', 'Add value', AddValue]],
|
|
10113
10650
|
store,
|
|
10114
|
-
cellId,
|
|
10115
|
-
descending,
|
|
10116
|
-
offset,
|
|
10117
|
-
limit: 10,
|
|
10118
|
-
paginator: true,
|
|
10119
|
-
sortOnClick: true,
|
|
10120
|
-
onChange: handleChange,
|
|
10121
|
-
editable,
|
|
10122
10651
|
}),
|
|
10652
|
+
right: useHasValues(store)
|
|
10653
|
+
? /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10654
|
+
actions: [['delete', 'Delete all values', DeleteValues]],
|
|
10655
|
+
store,
|
|
10656
|
+
})
|
|
10657
|
+
: null,
|
|
10658
|
+
});
|
|
10659
|
+
const CloneValue = ({onDone, valueId, store}) => {
|
|
10660
|
+
const has = useHasValueCallback(store);
|
|
10661
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10662
|
+
onDone,
|
|
10663
|
+
suggestedId: getNewIdFromSuggestedId(valueId, has),
|
|
10664
|
+
has,
|
|
10665
|
+
set: useSetValueCallback(
|
|
10666
|
+
(newId) => newId,
|
|
10667
|
+
(_, store2) => store2.getValue(valueId) ?? '',
|
|
10668
|
+
[valueId],
|
|
10669
|
+
store,
|
|
10670
|
+
),
|
|
10671
|
+
prompt: 'Clone value to',
|
|
10123
10672
|
});
|
|
10124
10673
|
};
|
|
10674
|
+
const DeleteValue = ({onDone, valueId, store}) =>
|
|
10675
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10676
|
+
onClick: useDelValueCallback(valueId, store, onDone),
|
|
10677
|
+
prompt: 'Delete value',
|
|
10678
|
+
});
|
|
10679
|
+
const ValueActions = ({valueId, store}) =>
|
|
10680
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10681
|
+
actions: [
|
|
10682
|
+
['clone', 'Clone value', CloneValue],
|
|
10683
|
+
['delete', 'Delete value', DeleteValue],
|
|
10684
|
+
],
|
|
10685
|
+
store,
|
|
10686
|
+
valueId,
|
|
10687
|
+
});
|
|
10688
|
+
|
|
10689
|
+
const valueActions = [{label: '', component: ValueActions}];
|
|
10125
10690
|
const ValuesView = ({store, storeId, s}) => {
|
|
10126
10691
|
const uniqueId = getUniqueId('v', storeId);
|
|
10127
10692
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
10128
|
-
return
|
|
10129
|
-
|
|
10130
|
-
:
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10693
|
+
return /* @__PURE__ */ jsxs(Details, {
|
|
10694
|
+
uniqueId,
|
|
10695
|
+
title: VALUES,
|
|
10696
|
+
editable,
|
|
10697
|
+
handleEditable,
|
|
10698
|
+
s,
|
|
10699
|
+
children: [
|
|
10700
|
+
arrayIsEmpty(useValueIds(store))
|
|
10701
|
+
? /* @__PURE__ */ jsx('caption', {children: 'No values.'})
|
|
10702
|
+
: /* @__PURE__ */ jsx(ValuesInHtmlTable, {
|
|
10703
|
+
store,
|
|
10704
|
+
editable,
|
|
10705
|
+
extraCellsAfter: editable ? valueActions : [],
|
|
10706
|
+
}),
|
|
10707
|
+
editable ? /* @__PURE__ */ jsx(ValuesActions, {store}) : null,
|
|
10708
|
+
],
|
|
10709
|
+
});
|
|
10138
10710
|
};
|
|
10711
|
+
|
|
10139
10712
|
const StoreView = ({storeId, s}) => {
|
|
10140
10713
|
const store = useStore(storeId);
|
|
10141
|
-
const tableIds = useTableIds(store);
|
|
10142
10714
|
return isUndefined(store)
|
|
10143
10715
|
? null
|
|
10144
10716
|
: /* @__PURE__ */ jsxs(Details, {
|
|
10145
10717
|
uniqueId: getUniqueId('s', storeId),
|
|
10146
|
-
|
|
10718
|
+
title:
|
|
10147
10719
|
(store.isMergeable() ? 'Mergeable' : '') +
|
|
10148
10720
|
'Store: ' +
|
|
10149
10721
|
(storeId ?? DEFAULT),
|
|
10150
10722
|
s,
|
|
10151
10723
|
children: [
|
|
10152
10724
|
/* @__PURE__ */ jsx(ValuesView, {storeId, store, s}),
|
|
10153
|
-
|
|
10154
|
-
/* @__PURE__ */ jsx(
|
|
10155
|
-
TableView,
|
|
10156
|
-
{
|
|
10157
|
-
store,
|
|
10158
|
-
storeId,
|
|
10159
|
-
tableId,
|
|
10160
|
-
s,
|
|
10161
|
-
},
|
|
10162
|
-
tableId,
|
|
10163
|
-
),
|
|
10164
|
-
),
|
|
10725
|
+
/* @__PURE__ */ jsx(TablesView, {storeId, store, s}),
|
|
10165
10726
|
],
|
|
10166
10727
|
});
|
|
10167
10728
|
};
|
|
@@ -10282,6 +10843,7 @@ class ErrorBoundary extends PureComponent {
|
|
|
10282
10843
|
|
|
10283
10844
|
const Header = ({s}) => {
|
|
10284
10845
|
const position = useValue(POSITION_VALUE, s) ?? 1;
|
|
10846
|
+
const handleClick = () => open('https://tinybase.org', '_blank');
|
|
10285
10847
|
const handleClose = useSetValueCallback(OPEN_VALUE, () => false, [], s);
|
|
10286
10848
|
const handleDock = useSetValueCallback(
|
|
10287
10849
|
POSITION_VALUE,
|
|
@@ -10291,7 +10853,11 @@ const Header = ({s}) => {
|
|
|
10291
10853
|
);
|
|
10292
10854
|
return /* @__PURE__ */ jsxs('header', {
|
|
10293
10855
|
children: [
|
|
10294
|
-
/* @__PURE__ */ jsx('img', {
|
|
10856
|
+
/* @__PURE__ */ jsx('img', {
|
|
10857
|
+
className: 'flat',
|
|
10858
|
+
title: TITLE,
|
|
10859
|
+
onClick: handleClick,
|
|
10860
|
+
}),
|
|
10295
10861
|
/* @__PURE__ */ jsx('span', {children: TITLE}),
|
|
10296
10862
|
arrayMap(POSITIONS, (name, p) =>
|
|
10297
10863
|
p == position
|
|
@@ -10306,7 +10872,11 @@ const Header = ({s}) => {
|
|
|
10306
10872
|
p,
|
|
10307
10873
|
),
|
|
10308
10874
|
),
|
|
10309
|
-
/* @__PURE__ */ jsx('img', {
|
|
10875
|
+
/* @__PURE__ */ jsx('img', {
|
|
10876
|
+
className: 'flat',
|
|
10877
|
+
onClick: handleClose,
|
|
10878
|
+
title: 'Close',
|
|
10879
|
+
}),
|
|
10310
10880
|
],
|
|
10311
10881
|
});
|
|
10312
10882
|
};
|
|
@@ -10329,70 +10899,237 @@ const Panel = ({s}) => {
|
|
|
10329
10899
|
var img =
|
|
10330
10900
|
"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e";
|
|
10331
10901
|
|
|
10332
|
-
const
|
|
10333
|
-
const PRE_CSS = 'content:url("';
|
|
10902
|
+
const PRE_CSS = 'url("';
|
|
10334
10903
|
const POST_CSS = '")';
|
|
10335
|
-
const
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10904
|
+
const getCssSvg = (path, color = 'white') => ({
|
|
10905
|
+
content:
|
|
10906
|
+
PRE_CSS +
|
|
10907
|
+
`data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960' fill='${color}'><path d='${path}' /></svg>` +
|
|
10908
|
+
POST_CSS,
|
|
10909
|
+
});
|
|
10910
|
+
const VERTICAL_THIN = 'v560h120v-560h-120Z';
|
|
10911
|
+
const VERTICAL_THICK = 'v560h360v-560h-360Z';
|
|
10912
|
+
const HORIZONTAL_THIN = 'v120h560v-120h-560Z';
|
|
10913
|
+
const HORIZONTAL_THICK = 'v360h560v-360h-560Z';
|
|
10914
|
+
const LOGO_SVG = {content: PRE_CSS + img + POST_CSS};
|
|
10340
10915
|
const POSITIONS_SVG = arrayMap(
|
|
10341
10916
|
[
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
[30, 30, 40, 40],
|
|
10917
|
+
`M200-760${VERTICAL_THIN} M400-760${VERTICAL_THICK}`,
|
|
10918
|
+
`M200-760${HORIZONTAL_THIN} M200-560${HORIZONTAL_THICK}`,
|
|
10919
|
+
`M200-760${HORIZONTAL_THICK} M200-320${HORIZONTAL_THIN}`,
|
|
10920
|
+
`M200-760${VERTICAL_THICK} M640-760${VERTICAL_THIN}`,
|
|
10347
10921
|
],
|
|
10348
|
-
(
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10922
|
+
(path) =>
|
|
10923
|
+
getCssSvg(
|
|
10924
|
+
'M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z' +
|
|
10925
|
+
path,
|
|
10926
|
+
),
|
|
10927
|
+
);
|
|
10928
|
+
arrayPush(
|
|
10929
|
+
POSITIONS_SVG,
|
|
10930
|
+
getCssSvg(
|
|
10931
|
+
'M120-120v-200h80v120h120v80H120Zm520 0v-80h120v-120h80v200H640ZM120-640v-200h200v80H200v120h-80Zm640 0v-120H640v-80h200v200h-80Z',
|
|
10932
|
+
),
|
|
10933
|
+
);
|
|
10934
|
+
const CLOSE_SVG = getCssSvg(
|
|
10935
|
+
'm336-280-56-56 144-144-144-143 56-56 144 144 143-144 56 56-144 143 144 144-56 56-143-144-144 144Z',
|
|
10936
|
+
);
|
|
10937
|
+
const EDIT_SVG = getCssSvg(
|
|
10938
|
+
'M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z',
|
|
10939
|
+
);
|
|
10940
|
+
const DONE_SVG = getCssSvg(
|
|
10941
|
+
'm622-453-56-56 82-82-57-57-82 82-56-56 195-195q12-12 26.5-17.5T705-840q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L622-453ZM200-200h57l195-195-28-29-29-28-195 195v57ZM792-56 509-338 290-120H120v-169l219-219L56-792l57-57 736 736-57 57Zm-32-648-56-56 56 56Zm-169 56 57 57-57-57ZM424-424l-29-28 57 57-28-29Z',
|
|
10942
|
+
);
|
|
10943
|
+
const ADD_SVG = getCssSvg(
|
|
10944
|
+
'M440-280h80v-160h160v-80H520v-160h-80v160H280v80h160v160ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z',
|
|
10945
|
+
);
|
|
10946
|
+
const CLONE_SVG = getCssSvg(
|
|
10947
|
+
'M520-400h80v-120h120v-80H600v-120h-80v120H400v80h120v120ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z',
|
|
10948
|
+
);
|
|
10949
|
+
const DELETE_SVG = getCssSvg(
|
|
10950
|
+
'M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z',
|
|
10951
|
+
);
|
|
10952
|
+
const OK_SVG = getCssSvg(
|
|
10953
|
+
'm424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z',
|
|
10954
|
+
'rgb(127,255,127)',
|
|
10955
|
+
);
|
|
10956
|
+
const OK_SVG_DISABLED = getCssSvg(
|
|
10957
|
+
'm40-120 440-760 440 760H40Zm138-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Zm40-100Z',
|
|
10958
|
+
'rgb(255,255,127)',
|
|
10959
|
+
);
|
|
10960
|
+
const CANCEL_SVG = getCssSvg(
|
|
10961
|
+
'm336-280 144-144 144 144 56-56-144-144 144-144-56-56-144 144-144-144-56 56 144 144-144 144 56 56ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z',
|
|
10962
|
+
'rgb(255,127,127)',
|
|
10963
|
+
);
|
|
10964
|
+
const DOWN_SVG = getCssSvg(
|
|
10965
|
+
'M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z',
|
|
10966
|
+
);
|
|
10967
|
+
const RIGHT_SVG = getCssSvg(
|
|
10968
|
+
'M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z',
|
|
10352
10969
|
);
|
|
10353
|
-
const CLOSE_SVG = PRE + `<path d='M20 20l60 60M20 80l60-60' />` + POST;
|
|
10354
|
-
const EDIT_SVG = PRE + `<path d='${PENCIL}' />` + POST;
|
|
10355
|
-
const DONE_SVG = PRE + `<path d='${PENCIL}M20 20l60 60' />` + POST;
|
|
10356
10970
|
|
|
10357
10971
|
const SCROLLBAR = '*::-webkit-scrollbar';
|
|
10972
|
+
const BACKGROUND = 'background';
|
|
10973
|
+
const WIDTH = 'width';
|
|
10974
|
+
const MAX_WIDTH = 'max-' + WIDTH;
|
|
10975
|
+
const MIN_WIDTH = 'min-' + WIDTH;
|
|
10976
|
+
const HEIGHT = 'height';
|
|
10977
|
+
const BORDER = 'border';
|
|
10978
|
+
const BORDER_RADIUS = BORDER + '-radius';
|
|
10979
|
+
const PADDING = 'padding';
|
|
10980
|
+
const MARGIN = 'margin';
|
|
10981
|
+
const MARGIN_RIGHT = MARGIN + '-right';
|
|
10982
|
+
const TOP = 'top';
|
|
10983
|
+
const BOTTOM = 'bottom';
|
|
10984
|
+
const LEFT = 'left';
|
|
10985
|
+
const RIGHT = 'right';
|
|
10986
|
+
const COLOR = 'color';
|
|
10987
|
+
const POSITION = 'position';
|
|
10988
|
+
const BOX_SHADOW = 'box-shadow';
|
|
10989
|
+
const FONT_SIZE = 'font-size';
|
|
10990
|
+
const DISPLAY = 'display';
|
|
10991
|
+
const OVERFLOW = 'overflow';
|
|
10992
|
+
const CURSOR = 'cursor';
|
|
10993
|
+
const VERTICAL_ALIGN = 'vertical-align';
|
|
10994
|
+
const TEXT_ALIGN = 'text-align';
|
|
10995
|
+
const JUSTIFY_CONTENT = 'justify-content';
|
|
10996
|
+
const FIXED = 'fixed';
|
|
10997
|
+
const REVERT = 'revert';
|
|
10998
|
+
const UNSET = 'unset';
|
|
10999
|
+
const NONE = 'none';
|
|
11000
|
+
const FLEX = 'flex';
|
|
11001
|
+
const POINTER = 'pointer';
|
|
11002
|
+
const AUTO = 'auto';
|
|
11003
|
+
const HIDDEN = 'hidden';
|
|
11004
|
+
const NOWRAP = 'nowrap';
|
|
11005
|
+
const oklch = (lPercent, remainder = '% 0.01 ' + cssVar('hue')) =>
|
|
11006
|
+
`oklch(${lPercent}${remainder})`;
|
|
11007
|
+
const cssVar = (name) => `var(--${name})`;
|
|
11008
|
+
const rem = (...rems) => `${rems.join('rem ')}rem`;
|
|
11009
|
+
const px = (...pxs) => `${pxs.join('px ')}px`;
|
|
11010
|
+
const vw = (vw2 = 100) => `${vw2}vw`;
|
|
11011
|
+
const vh = (vh2 = 100) => `${vh2}vh`;
|
|
10358
11012
|
const APP_STYLESHEET = arrayJoin(
|
|
10359
11013
|
objToArray(
|
|
10360
11014
|
{
|
|
10361
|
-
'':
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
11015
|
+
'': {
|
|
11016
|
+
all: 'initial',
|
|
11017
|
+
[FONT_SIZE]: rem(0.75),
|
|
11018
|
+
[POSITION]: FIXED,
|
|
11019
|
+
'font-family': 'inter,sans-serif',
|
|
11020
|
+
'z-index': 999999,
|
|
11021
|
+
'--bg': oklch(20),
|
|
11022
|
+
'--bg2': oklch(15),
|
|
11023
|
+
'--bg3': oklch(25),
|
|
11024
|
+
'--bg4': oklch(30),
|
|
11025
|
+
'--fg': oklch(85),
|
|
11026
|
+
'--fg2': oklch(60),
|
|
11027
|
+
['--' + BORDER]: px(1) + ' solid ' + cssVar('bg4'),
|
|
11028
|
+
['--' + BOX_SHADOW]: px(0, 1, 2, 0) + ' #0007',
|
|
11029
|
+
},
|
|
11030
|
+
'*': {all: REVERT},
|
|
11031
|
+
'*::before': {all: REVERT},
|
|
11032
|
+
'*::after': {all: REVERT},
|
|
11033
|
+
[SCROLLBAR]: {[WIDTH]: rem(0.5), [HEIGHT]: rem(0.5)},
|
|
11034
|
+
[SCROLLBAR + '-thumb']: {[BACKGROUND]: cssVar('bg4')},
|
|
11035
|
+
[SCROLLBAR + '-thumb:hover']: {[BACKGROUND]: cssVar('bg4')},
|
|
11036
|
+
[SCROLLBAR + '-corner']: {[BACKGROUND]: NONE},
|
|
11037
|
+
[SCROLLBAR + '-track']: {[BACKGROUND]: NONE},
|
|
11038
|
+
img: {
|
|
11039
|
+
[WIDTH]: rem(0.8),
|
|
11040
|
+
[HEIGHT]: rem(0.8),
|
|
11041
|
+
[VERTICAL_ALIGN]: 'text-' + BOTTOM,
|
|
11042
|
+
[CURSOR]: POINTER,
|
|
11043
|
+
[MARGIN]: px(-2.5, 2, -2.5, 0),
|
|
11044
|
+
[PADDING]: px(2),
|
|
11045
|
+
[BORDER]: cssVar(BORDER),
|
|
11046
|
+
[BACKGROUND]: cssVar('bg3'),
|
|
11047
|
+
[BOX_SHADOW]: cssVar(BOX_SHADOW),
|
|
11048
|
+
[BORDER_RADIUS]: rem(0.25),
|
|
11049
|
+
},
|
|
11050
|
+
'img.flat': {[BORDER]: NONE, [BACKGROUND]: NONE, [BOX_SHADOW]: NONE},
|
|
10371
11051
|
// Nub
|
|
10372
|
-
'>img':
|
|
11052
|
+
'>img': {
|
|
11053
|
+
[PADDING]: rem(0.25),
|
|
11054
|
+
[BOTTOM]: 0,
|
|
11055
|
+
[RIGHT]: 0,
|
|
11056
|
+
[POSITION]: FIXED,
|
|
11057
|
+
[HEIGHT]: UNSET,
|
|
11058
|
+
[MARGIN]: 0,
|
|
11059
|
+
...LOGO_SVG,
|
|
11060
|
+
},
|
|
10373
11061
|
...objNew(
|
|
10374
|
-
arrayMap(
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
11062
|
+
arrayMap(
|
|
11063
|
+
[
|
|
11064
|
+
{[BOTTOM]: 0, [LEFT]: 0},
|
|
11065
|
+
{[TOP]: 0, [RIGHT]: 0},
|
|
11066
|
+
],
|
|
11067
|
+
(css, p) => [`>img[data-position='${p}']`, css],
|
|
11068
|
+
),
|
|
10378
11069
|
),
|
|
10379
11070
|
// Panel
|
|
10380
|
-
main:
|
|
11071
|
+
main: {
|
|
11072
|
+
[DISPLAY]: FLEX,
|
|
11073
|
+
[COLOR]: cssVar('fg'),
|
|
11074
|
+
[BACKGROUND]: cssVar('bg'),
|
|
11075
|
+
[OVERFLOW]: HIDDEN,
|
|
11076
|
+
[POSITION]: FIXED,
|
|
11077
|
+
[BOX_SHADOW]: cssVar(BOX_SHADOW),
|
|
11078
|
+
'flex-direction': 'column',
|
|
11079
|
+
},
|
|
10381
11080
|
...objNew(
|
|
10382
11081
|
arrayMap(
|
|
10383
11082
|
[
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
11083
|
+
{
|
|
11084
|
+
[BOTTOM]: 0,
|
|
11085
|
+
[LEFT]: 0,
|
|
11086
|
+
[WIDTH]: vw(35),
|
|
11087
|
+
[HEIGHT]: vh(),
|
|
11088
|
+
[BORDER + '-' + RIGHT]: cssVar(BORDER),
|
|
11089
|
+
},
|
|
11090
|
+
{
|
|
11091
|
+
[TOP]: 0,
|
|
11092
|
+
[RIGHT]: 0,
|
|
11093
|
+
[WIDTH]: vw(),
|
|
11094
|
+
[HEIGHT]: vh(30),
|
|
11095
|
+
[BORDER + '-' + BOTTOM]: cssVar(BORDER),
|
|
11096
|
+
},
|
|
11097
|
+
{
|
|
11098
|
+
[BOTTOM]: 0,
|
|
11099
|
+
[LEFT]: 0,
|
|
11100
|
+
[WIDTH]: vw(),
|
|
11101
|
+
[HEIGHT]: vh(30),
|
|
11102
|
+
[BORDER + '-' + TOP]: cssVar(BORDER),
|
|
11103
|
+
},
|
|
11104
|
+
{
|
|
11105
|
+
[TOP]: 0,
|
|
11106
|
+
[RIGHT]: 0,
|
|
11107
|
+
[WIDTH]: vw(35),
|
|
11108
|
+
[HEIGHT]: vh(),
|
|
11109
|
+
[BORDER + '-' + LEFT]: cssVar(BORDER),
|
|
11110
|
+
},
|
|
11111
|
+
{[TOP]: 0, [RIGHT]: 0, [WIDTH]: vw(), [HEIGHT]: vh()},
|
|
10389
11112
|
],
|
|
10390
11113
|
(css, p) => [`main[data-position='${p}']`, css],
|
|
10391
11114
|
),
|
|
10392
11115
|
),
|
|
10393
11116
|
// Header
|
|
10394
|
-
header:
|
|
10395
|
-
|
|
11117
|
+
header: {
|
|
11118
|
+
[DISPLAY]: FLEX,
|
|
11119
|
+
[PADDING]: rem(0.5),
|
|
11120
|
+
[BOX_SHADOW]: cssVar(BOX_SHADOW),
|
|
11121
|
+
[BACKGROUND]: oklch(30, '% 0.008 var(--hue) / .5'),
|
|
11122
|
+
[WIDTH]: 'calc(100% - .5rem)',
|
|
11123
|
+
[POSITION]: 'absolute',
|
|
11124
|
+
[BORDER + '-' + BOTTOM]: cssVar(BORDER),
|
|
11125
|
+
'align-items': 'center',
|
|
11126
|
+
'backdrop-filter': 'blur(4px)',
|
|
11127
|
+
},
|
|
11128
|
+
'header>img:nth-of-type(1)': {
|
|
11129
|
+
[HEIGHT]: rem(1),
|
|
11130
|
+
[WIDTH]: rem(1),
|
|
11131
|
+
...LOGO_SVG,
|
|
11132
|
+
},
|
|
10396
11133
|
'header>img:nth-of-type(6)': CLOSE_SVG,
|
|
10397
11134
|
...objNew(
|
|
10398
11135
|
arrayMap(POSITIONS_SVG, (SVG, p) => [
|
|
@@ -10400,42 +11137,140 @@ const APP_STYLESHEET = arrayJoin(
|
|
|
10400
11137
|
SVG,
|
|
10401
11138
|
]),
|
|
10402
11139
|
),
|
|
10403
|
-
'header>span':
|
|
10404
|
-
|
|
11140
|
+
'header>span': {
|
|
11141
|
+
[OVERFLOW]: HIDDEN,
|
|
11142
|
+
[FLEX]: 1,
|
|
11143
|
+
'font-weight': 800,
|
|
11144
|
+
'white-space': NOWRAP,
|
|
11145
|
+
'text-overflow': 'ellipsis',
|
|
11146
|
+
},
|
|
10405
11147
|
// Body
|
|
10406
|
-
article:
|
|
10407
|
-
details:
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
11148
|
+
article: {[OVERFLOW]: AUTO, [FLEX]: 1, [PADDING + '-' + TOP]: rem(2)},
|
|
11149
|
+
details: {
|
|
11150
|
+
[MARGIN]: rem(0.5),
|
|
11151
|
+
[BORDER]: cssVar(BORDER),
|
|
11152
|
+
[BORDER_RADIUS]: rem(0.25),
|
|
11153
|
+
},
|
|
11154
|
+
summary: {
|
|
11155
|
+
[BACKGROUND]: cssVar('bg3'),
|
|
11156
|
+
[MARGIN]: px(-1),
|
|
11157
|
+
[BORDER]: cssVar(BORDER),
|
|
11158
|
+
[PADDING]: rem(0.25, 0.125),
|
|
11159
|
+
[DISPLAY]: FLEX,
|
|
11160
|
+
[BORDER_RADIUS]: rem(0.25),
|
|
11161
|
+
'user-select': NONE,
|
|
11162
|
+
[JUSTIFY_CONTENT]: 'space-between',
|
|
11163
|
+
'align-items': 'center',
|
|
11164
|
+
},
|
|
11165
|
+
'summary>span::before': {
|
|
11166
|
+
[DISPLAY]: 'inline-block',
|
|
11167
|
+
[VERTICAL_ALIGN]: 'sub',
|
|
11168
|
+
[MARGIN]: px(2),
|
|
11169
|
+
[WIDTH]: rem(1),
|
|
11170
|
+
[HEIGHT]: rem(1),
|
|
11171
|
+
...RIGHT_SVG,
|
|
11172
|
+
},
|
|
11173
|
+
'details[open]>summary': {
|
|
11174
|
+
'border-bottom-left-radius': 0,
|
|
11175
|
+
'border-bottom-right-radius': 0,
|
|
11176
|
+
[MARGIN + '-' + BOTTOM]: 0,
|
|
11177
|
+
},
|
|
11178
|
+
'details[open]>summary>span::before': DOWN_SVG,
|
|
11179
|
+
'details>summary img': {[DISPLAY]: NONE},
|
|
11180
|
+
'details[open]>summary img': {
|
|
11181
|
+
[DISPLAY]: UNSET,
|
|
11182
|
+
[MARGIN + '-' + LEFT]: rem(0.25),
|
|
11183
|
+
},
|
|
11184
|
+
'details>div': {[OVERFLOW]: AUTO},
|
|
11185
|
+
caption: {
|
|
11186
|
+
[COLOR]: cssVar('fg2'),
|
|
11187
|
+
[PADDING]: rem(0.25, 0.5),
|
|
11188
|
+
[TEXT_ALIGN]: LEFT,
|
|
11189
|
+
'white-space': NOWRAP,
|
|
11190
|
+
},
|
|
11191
|
+
'caption button': {
|
|
11192
|
+
[WIDTH]: rem(1.5),
|
|
11193
|
+
[BORDER]: NONE,
|
|
11194
|
+
[BACKGROUND]: NONE,
|
|
11195
|
+
[COLOR]: cssVar('fg'),
|
|
11196
|
+
[PADDING]: 0,
|
|
11197
|
+
[CURSOR]: POINTER,
|
|
11198
|
+
},
|
|
11199
|
+
'caption button[disabled]': {[COLOR]: cssVar('fg2')},
|
|
11200
|
+
'.actions': {
|
|
11201
|
+
[PADDING]: rem(0.75, 0.5),
|
|
11202
|
+
[MARGIN]: 0,
|
|
11203
|
+
[DISPLAY]: FLEX,
|
|
11204
|
+
[BORDER + '-' + TOP]: cssVar(BORDER),
|
|
11205
|
+
[JUSTIFY_CONTENT]: 'space-between',
|
|
11206
|
+
},
|
|
10415
11207
|
// tables
|
|
10416
|
-
table:
|
|
10417
|
-
|
|
10418
|
-
'
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
'
|
|
11208
|
+
table: {
|
|
11209
|
+
[MIN_WIDTH]: '100%',
|
|
11210
|
+
'border-collapse': 'collapse',
|
|
11211
|
+
'table-layout': FIXED,
|
|
11212
|
+
},
|
|
11213
|
+
thead: {[BACKGROUND]: cssVar('bg')},
|
|
11214
|
+
[`th,#${UNIQUE_ID} td`]: {
|
|
11215
|
+
[OVERFLOW]: HIDDEN,
|
|
11216
|
+
[PADDING]: rem(0.25, 0.5),
|
|
11217
|
+
[MAX_WIDTH]: rem(20),
|
|
11218
|
+
[BORDER]: cssVar(BORDER),
|
|
11219
|
+
'text-overflow': 'ellipsis',
|
|
11220
|
+
'white-space': NOWRAP,
|
|
11221
|
+
'border-width': px(1, 0, 0),
|
|
11222
|
+
[TEXT_ALIGN]: LEFT,
|
|
11223
|
+
},
|
|
11224
|
+
'th:first-child': {
|
|
11225
|
+
[WIDTH]: rem(3),
|
|
11226
|
+
[MIN_WIDTH]: rem(3),
|
|
11227
|
+
[MAX_WIDTH]: rem(3),
|
|
11228
|
+
},
|
|
11229
|
+
'th.sorted': {[BACKGROUND]: cssVar('bg3')},
|
|
11230
|
+
'td.extra': {[TEXT_ALIGN]: RIGHT},
|
|
11231
|
+
'tbody button': {
|
|
11232
|
+
[BACKGROUND]: NONE,
|
|
11233
|
+
[BORDER]: NONE,
|
|
11234
|
+
[FONT_SIZE]: 0,
|
|
11235
|
+
[WIDTH]: rem(0.8),
|
|
11236
|
+
[HEIGHT]: rem(0.8),
|
|
11237
|
+
[COLOR]: cssVar('fg2'),
|
|
11238
|
+
[MARGIN]: rem(0, 0.25, 0, -0.25),
|
|
11239
|
+
'line-height': rem(0.8),
|
|
11240
|
+
},
|
|
11241
|
+
'tbody button:first-letter': {[FONT_SIZE]: rem(0.8)},
|
|
11242
|
+
input: {
|
|
11243
|
+
[BACKGROUND]: cssVar('bg2'),
|
|
11244
|
+
[COLOR]: UNSET,
|
|
11245
|
+
[PADDING]: px(4),
|
|
11246
|
+
[BORDER]: 0,
|
|
11247
|
+
[MARGIN]: px(-4, 0),
|
|
11248
|
+
[FONT_SIZE]: UNSET,
|
|
11249
|
+
[MAX_WIDTH]: rem(6),
|
|
11250
|
+
},
|
|
11251
|
+
'input:focus': {'outline-width': 0},
|
|
11252
|
+
'input[type="number"]': {[WIDTH]: rem(3)},
|
|
11253
|
+
'input[type="checkbox"]': {[VERTICAL_ALIGN]: px(-2)},
|
|
11254
|
+
'.editableCell': {[DISPLAY]: 'inline-block', [MARGIN_RIGHT]: px(2)},
|
|
11255
|
+
'button.next': {[MARGIN_RIGHT]: rem(0.5)},
|
|
11256
|
+
'img.edit': EDIT_SVG,
|
|
11257
|
+
'img.done': DONE_SVG,
|
|
11258
|
+
'img.add': ADD_SVG,
|
|
11259
|
+
'img.clone': CLONE_SVG,
|
|
11260
|
+
'img.delete': DELETE_SVG,
|
|
11261
|
+
'img.ok': OK_SVG,
|
|
11262
|
+
'img.okDis': OK_SVG_DISABLED,
|
|
11263
|
+
'img.cancel': CANCEL_SVG,
|
|
11264
|
+
'span.warn': {[MARGIN]: rem(2, 0.25), [COLOR]: '#d81b60'},
|
|
10433
11265
|
},
|
|
10434
|
-
(style, selector) =>
|
|
11266
|
+
(style, selector) =>
|
|
11267
|
+
`#${UNIQUE_ID} ${selector}{${arrayJoin(
|
|
11268
|
+
objToArray(style, (value, property) => `${property}:${value};`),
|
|
11269
|
+
)}}`,
|
|
10435
11270
|
),
|
|
10436
11271
|
);
|
|
10437
11272
|
|
|
10438
|
-
const Inspector = ({position = 'right', open = false}) => {
|
|
11273
|
+
const Inspector = ({position = 'right', open = false, hue = 270}) => {
|
|
10439
11274
|
const s = useCreateStore(createStore);
|
|
10440
11275
|
const index = POSITIONS.indexOf(position);
|
|
10441
11276
|
useCreatePersister(
|
|
@@ -10462,7 +11297,9 @@ const Inspector = ({position = 'right', open = false}) => {
|
|
|
10462
11297
|
/* @__PURE__ */ jsx(Panel, {s}),
|
|
10463
11298
|
],
|
|
10464
11299
|
}),
|
|
10465
|
-
/* @__PURE__ */
|
|
11300
|
+
/* @__PURE__ */ jsxs('style', {
|
|
11301
|
+
children: [`#${UNIQUE_ID}{--hue:${hue}}`, APP_STYLESHEET],
|
|
11302
|
+
}),
|
|
10466
11303
|
],
|
|
10467
11304
|
});
|
|
10468
11305
|
};
|
|
@@ -10538,8 +11375,17 @@ export {
|
|
|
10538
11375
|
Message,
|
|
10539
11376
|
MetricView,
|
|
10540
11377
|
objectStoreMatch,
|
|
11378
|
+
OFFSET_CHECKPOINTS,
|
|
11379
|
+
OFFSET_INDEXES,
|
|
11380
|
+
OFFSET_METRICS,
|
|
11381
|
+
OFFSET_PERSISTER,
|
|
11382
|
+
OFFSET_QUERIES,
|
|
11383
|
+
OFFSET_RELATIONSHIPS,
|
|
11384
|
+
OFFSET_STORE,
|
|
11385
|
+
OFFSET_SYNCHRONIZER,
|
|
10541
11386
|
Persists,
|
|
10542
11387
|
Provider,
|
|
11388
|
+
RelationshipInHtmlRow,
|
|
10543
11389
|
RelationshipInHtmlTable,
|
|
10544
11390
|
RemoteRowView,
|
|
10545
11391
|
ResultCellView,
|
|
@@ -10556,7 +11402,7 @@ export {
|
|
|
10556
11402
|
SortedTableView,
|
|
10557
11403
|
Status,
|
|
10558
11404
|
TableInHtmlTable,
|
|
10559
|
-
TablesView,
|
|
11405
|
+
TablesView$1 as TablesView,
|
|
10560
11406
|
TableView$1 as TableView,
|
|
10561
11407
|
TinyBasePartyKitServer,
|
|
10562
11408
|
useAddRowCallback,
|
|
@@ -10680,6 +11526,7 @@ export {
|
|
|
10680
11526
|
useSortedRowIds,
|
|
10681
11527
|
useSortedRowIdsListener,
|
|
10682
11528
|
useSortedRowIdsListenerImpl,
|
|
11529
|
+
useSortingAndPagination,
|
|
10683
11530
|
useStartTransactionListener,
|
|
10684
11531
|
useStore,
|
|
10685
11532
|
useStoreIds,
|