tinybase 9.1.0-beta.0 → 9.1.0-beta.1
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/common/index.d.ts +17 -2
- package/@types/common/with-schemas/index.d.ts +18 -2
- package/@types/store/index.d.ts +37 -7
- package/@types/store/with-schemas/index.d.ts +38 -7
- package/@types/ui-react/index.d.ts +6 -2
- package/@types/ui-react/with-schemas/index.d.ts +7 -2
- package/@types/ui-solid/index.d.ts +9 -2
- package/@types/ui-solid/with-schemas/index.d.ts +10 -2
- package/@types/ui-svelte/index.d.ts +50 -2
- package/@types/ui-svelte/with-schemas/index.d.ts +88 -25
- package/index.js +34 -6
- package/mergeable-store/index.js +34 -6
- package/mergeable-store/with-schemas/index.js +34 -6
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/mergeable-store/index.js +1 -1
- package/min/mergeable-store/index.js.gz +0 -0
- package/min/mergeable-store/with-schemas/index.js +1 -1
- package/min/mergeable-store/with-schemas/index.js.gz +0 -0
- 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/store/index.js +1 -1
- package/min/store/index.js.gz +0 -0
- package/min/store/with-schemas/index.js +1 -1
- package/min/store/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-dom-charts/index.js +1 -1
- package/min/ui-react-dom-charts/index.js.gz +0 -0
- package/min/ui-react-dom-charts/with-schemas/index.js +1 -1
- package/min/ui-react-dom-charts/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/min/ui-solid/index.js +1 -1
- package/min/ui-solid/index.js.gz +0 -0
- package/min/ui-solid/with-schemas/index.js +1 -1
- package/min/ui-solid/with-schemas/index.js.gz +0 -0
- package/min/ui-solid-dom/index.js +1 -1
- package/min/ui-solid-dom/index.js.gz +0 -0
- package/min/ui-solid-dom/with-schemas/index.js +1 -1
- package/min/ui-solid-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-solid-inspector/index.js +1 -1
- package/min/ui-solid-inspector/index.js.gz +0 -0
- package/min/ui-solid-inspector/with-schemas/index.js +1 -1
- package/min/ui-solid-inspector/with-schemas/index.js.gz +0 -0
- package/min/ui-svelte/index.js +1 -1
- package/min/ui-svelte/index.js.gz +0 -0
- package/min/ui-svelte/with-schemas/index.js +1 -1
- package/min/ui-svelte/with-schemas/index.js.gz +0 -0
- package/min/ui-svelte-dom/index.js +1 -1
- package/min/ui-svelte-dom/index.js.gz +0 -0
- package/min/ui-svelte-dom/with-schemas/index.js +1 -1
- package/min/ui-svelte-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-svelte-inspector/index.js +1 -1
- package/min/ui-svelte-inspector/index.js.gz +0 -0
- package/min/ui-svelte-inspector/with-schemas/index.js +1 -1
- package/min/ui-svelte-inspector/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/omni/index.js +34 -6
- package/omni/with-schemas/index.js +34 -6
- package/package.json +3 -3
- package/releases.md +1 -1
- package/store/index.js +34 -6
- package/store/with-schemas/index.js +34 -6
- package/ui-react/index.js +36 -6
- package/ui-react/with-schemas/index.js +36 -6
- package/ui-react-dom/index.js +24 -4
- package/ui-react-dom/with-schemas/index.js +24 -4
- package/ui-react-dom-charts/index.js +24 -4
- package/ui-react-dom-charts/with-schemas/index.js +24 -4
- package/ui-react-inspector/index.js +58 -10
- package/ui-react-inspector/with-schemas/index.js +58 -10
- package/ui-solid/index.js +32 -2
- package/ui-solid/with-schemas/index.js +32 -2
- package/ui-solid-dom/index.js +17 -1
- package/ui-solid-dom/with-schemas/index.js +17 -1
- package/ui-solid-inspector/index.js +51 -7
- package/ui-solid-inspector/with-schemas/index.js +51 -7
- package/ui-svelte/index.js +73 -31
- package/ui-svelte/with-schemas/index.js +73 -31
- package/ui-svelte-dom/index.js +35 -14
- package/ui-svelte-dom/with-schemas/index.js +35 -14
- package/ui-svelte-inspector/index.js +69 -20
- package/ui-svelte-inspector/with-schemas/index.js +69 -20
- package/with-schemas/index.js +34 -6
|
@@ -49,12 +49,25 @@ const GLOBAL = globalThis;
|
|
|
49
49
|
const isNullish = (thing) => thing == null;
|
|
50
50
|
const isUndefined = (thing) => thing === void 0;
|
|
51
51
|
const hasWindow = () => !isUndefined(GLOBAL.window);
|
|
52
|
+
const ifNotNullish = getIfNotFunction(isNullish);
|
|
52
53
|
const ifNotUndefined = getIfNotFunction(isUndefined);
|
|
53
54
|
const isString = (thing) => getTypeOf(thing) == STRING;
|
|
54
55
|
const isFunction = (thing) => getTypeOf(thing) == FUNCTION;
|
|
55
56
|
const noop = () => {};
|
|
56
57
|
|
|
57
58
|
const object = Object;
|
|
59
|
+
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
60
|
+
const isObject = (obj) =>
|
|
61
|
+
!isNullish(obj) &&
|
|
62
|
+
ifNotNullish(
|
|
63
|
+
getPrototypeOf(obj),
|
|
64
|
+
(objPrototype) =>
|
|
65
|
+
objPrototype == object.prototype ||
|
|
66
|
+
isNullish(getPrototypeOf(objPrototype)),
|
|
67
|
+
|
|
68
|
+
/* istanbul ignore next */
|
|
69
|
+
() => true,
|
|
70
|
+
);
|
|
58
71
|
const objIds = object.keys;
|
|
59
72
|
const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
|
|
60
73
|
|
|
@@ -250,25 +263,45 @@ const getRowIds = (tableId, storeOrStoreId) =>
|
|
|
250
263
|
]);
|
|
251
264
|
|
|
252
265
|
const getSortedRowIds = (
|
|
253
|
-
|
|
254
|
-
|
|
266
|
+
tableIdOrArgs,
|
|
267
|
+
cellIdOrStoreOrStoreId,
|
|
255
268
|
descending = false,
|
|
256
269
|
offset = 0,
|
|
257
270
|
limit,
|
|
271
|
+
sorter,
|
|
258
272
|
storeOrStoreId,
|
|
259
273
|
) =>
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
274
|
+
isObject(tableIdOrArgs)
|
|
275
|
+
? createListenable(
|
|
276
|
+
resolveStore(cellIdOrStoreOrStoreId),
|
|
277
|
+
SORTED_ROW_IDS,
|
|
278
|
+
EMPTY_ARR,
|
|
279
|
+
() => [tableIdOrArgs],
|
|
280
|
+
)
|
|
281
|
+
: createListenable(
|
|
282
|
+
resolveStore(storeOrStoreId),
|
|
283
|
+
SORTED_ROW_IDS,
|
|
284
|
+
EMPTY_ARR,
|
|
285
|
+
() =>
|
|
286
|
+
isUndefined(sorter)
|
|
287
|
+
? [
|
|
288
|
+
maybeGet(tableIdOrArgs),
|
|
289
|
+
maybeGet(cellIdOrStoreOrStoreId),
|
|
290
|
+
maybeGet(descending),
|
|
291
|
+
maybeGet(offset),
|
|
292
|
+
maybeGet(limit),
|
|
293
|
+
]
|
|
294
|
+
: [
|
|
295
|
+
{
|
|
296
|
+
tableId: maybeGet(tableIdOrArgs),
|
|
297
|
+
cellId: maybeGet(cellIdOrStoreOrStoreId),
|
|
298
|
+
descending: maybeGet(descending) ?? false,
|
|
299
|
+
offset: maybeGet(offset) ?? 0,
|
|
300
|
+
limit: maybeGet(limit),
|
|
301
|
+
sorter,
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
);
|
|
272
305
|
|
|
273
306
|
const hasRow = (tableId, rowId, storeOrStoreId) =>
|
|
274
307
|
createListenable(
|
|
@@ -820,28 +853,36 @@ const onRowIds = (tableId, listener, mutator, storeOrStoreId) =>
|
|
|
820
853
|
);
|
|
821
854
|
|
|
822
855
|
const onSortedRowIds = (
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
856
|
+
tableIdOrArgs,
|
|
857
|
+
cellIdOrListener,
|
|
858
|
+
descendingOrMutator,
|
|
859
|
+
offsetOrStoreOrStoreId,
|
|
827
860
|
limit,
|
|
828
861
|
listener,
|
|
829
862
|
mutator,
|
|
830
863
|
storeOrStoreId,
|
|
831
864
|
) =>
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
865
|
+
isObject(tableIdOrArgs)
|
|
866
|
+
? addListenerEffect(
|
|
867
|
+
resolveStore(offsetOrStoreOrStoreId),
|
|
868
|
+
SORTED_ROW_IDS,
|
|
869
|
+
cellIdOrListener,
|
|
870
|
+
() => [tableIdOrArgs],
|
|
871
|
+
descendingOrMutator,
|
|
872
|
+
)
|
|
873
|
+
: addListenerEffect(
|
|
874
|
+
resolveStore(storeOrStoreId),
|
|
875
|
+
SORTED_ROW_IDS,
|
|
876
|
+
listener,
|
|
877
|
+
() => [
|
|
878
|
+
maybeGet(tableIdOrArgs),
|
|
879
|
+
maybeGet(cellIdOrListener),
|
|
880
|
+
maybeGet(descendingOrMutator),
|
|
881
|
+
maybeGet(offsetOrStoreOrStoreId),
|
|
882
|
+
maybeGet(limit),
|
|
883
|
+
],
|
|
884
|
+
mutator,
|
|
885
|
+
);
|
|
845
886
|
|
|
846
887
|
const onHasRow = (tableId, rowId, listener, mutator, storeOrStoreId) =>
|
|
847
888
|
addListenerEffect(
|
|
@@ -2263,6 +2304,7 @@ function SortedTableView($$anchor, $$props) {
|
|
|
2263
2304
|
() => $$props.descending ?? false,
|
|
2264
2305
|
() => $$props.offset ?? 0,
|
|
2265
2306
|
() => $$props.limit,
|
|
2307
|
+
undefined,
|
|
2266
2308
|
() => $$props.store,
|
|
2267
2309
|
);
|
|
2268
2310
|
|
package/ui-svelte-dom/index.js
CHANGED
|
@@ -206,25 +206,45 @@ const getRowIds = (tableId, storeOrStoreId) =>
|
|
|
206
206
|
]);
|
|
207
207
|
|
|
208
208
|
const getSortedRowIds = (
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
tableIdOrArgs,
|
|
210
|
+
cellIdOrStoreOrStoreId,
|
|
211
211
|
descending = false,
|
|
212
212
|
offset = 0,
|
|
213
213
|
limit,
|
|
214
|
+
sorter,
|
|
214
215
|
storeOrStoreId,
|
|
215
216
|
) =>
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
217
|
+
isObject(tableIdOrArgs)
|
|
218
|
+
? createListenable(
|
|
219
|
+
resolveStore(cellIdOrStoreOrStoreId),
|
|
220
|
+
SORTED_ROW_IDS,
|
|
221
|
+
EMPTY_ARR,
|
|
222
|
+
() => [tableIdOrArgs],
|
|
223
|
+
)
|
|
224
|
+
: createListenable(
|
|
225
|
+
resolveStore(storeOrStoreId),
|
|
226
|
+
SORTED_ROW_IDS,
|
|
227
|
+
EMPTY_ARR,
|
|
228
|
+
() =>
|
|
229
|
+
isUndefined(sorter)
|
|
230
|
+
? [
|
|
231
|
+
maybeGet(tableIdOrArgs),
|
|
232
|
+
maybeGet(cellIdOrStoreOrStoreId),
|
|
233
|
+
maybeGet(descending),
|
|
234
|
+
maybeGet(offset),
|
|
235
|
+
maybeGet(limit),
|
|
236
|
+
]
|
|
237
|
+
: [
|
|
238
|
+
{
|
|
239
|
+
tableId: maybeGet(tableIdOrArgs),
|
|
240
|
+
cellId: maybeGet(cellIdOrStoreOrStoreId),
|
|
241
|
+
descending: maybeGet(descending) ?? false,
|
|
242
|
+
offset: maybeGet(offset) ?? 0,
|
|
243
|
+
limit: maybeGet(limit),
|
|
244
|
+
sorter,
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
);
|
|
228
248
|
|
|
229
249
|
const getCell = (tableId, rowId, cellId, storeOrStoreId) => {
|
|
230
250
|
const getStore2 = resolveStore(storeOrStoreId);
|
|
@@ -2042,6 +2062,7 @@ function SortedTableInHtmlTable($$anchor, $$props) {
|
|
|
2042
2062
|
() => sorting.sortAndOffset[1],
|
|
2043
2063
|
() => sorting.sortAndOffset[2],
|
|
2044
2064
|
() => $$props.limit,
|
|
2065
|
+
undefined,
|
|
2045
2066
|
() => $$props.store,
|
|
2046
2067
|
);
|
|
2047
2068
|
const defaultCellComponent = $.derived(() =>
|
|
@@ -206,25 +206,45 @@ const getRowIds = (tableId, storeOrStoreId) =>
|
|
|
206
206
|
]);
|
|
207
207
|
|
|
208
208
|
const getSortedRowIds = (
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
tableIdOrArgs,
|
|
210
|
+
cellIdOrStoreOrStoreId,
|
|
211
211
|
descending = false,
|
|
212
212
|
offset = 0,
|
|
213
213
|
limit,
|
|
214
|
+
sorter,
|
|
214
215
|
storeOrStoreId,
|
|
215
216
|
) =>
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
217
|
+
isObject(tableIdOrArgs)
|
|
218
|
+
? createListenable(
|
|
219
|
+
resolveStore(cellIdOrStoreOrStoreId),
|
|
220
|
+
SORTED_ROW_IDS,
|
|
221
|
+
EMPTY_ARR,
|
|
222
|
+
() => [tableIdOrArgs],
|
|
223
|
+
)
|
|
224
|
+
: createListenable(
|
|
225
|
+
resolveStore(storeOrStoreId),
|
|
226
|
+
SORTED_ROW_IDS,
|
|
227
|
+
EMPTY_ARR,
|
|
228
|
+
() =>
|
|
229
|
+
isUndefined(sorter)
|
|
230
|
+
? [
|
|
231
|
+
maybeGet(tableIdOrArgs),
|
|
232
|
+
maybeGet(cellIdOrStoreOrStoreId),
|
|
233
|
+
maybeGet(descending),
|
|
234
|
+
maybeGet(offset),
|
|
235
|
+
maybeGet(limit),
|
|
236
|
+
]
|
|
237
|
+
: [
|
|
238
|
+
{
|
|
239
|
+
tableId: maybeGet(tableIdOrArgs),
|
|
240
|
+
cellId: maybeGet(cellIdOrStoreOrStoreId),
|
|
241
|
+
descending: maybeGet(descending) ?? false,
|
|
242
|
+
offset: maybeGet(offset) ?? 0,
|
|
243
|
+
limit: maybeGet(limit),
|
|
244
|
+
sorter,
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
);
|
|
228
248
|
|
|
229
249
|
const getCell = (tableId, rowId, cellId, storeOrStoreId) => {
|
|
230
250
|
const getStore2 = resolveStore(storeOrStoreId);
|
|
@@ -2042,6 +2062,7 @@ function SortedTableInHtmlTable($$anchor, $$props) {
|
|
|
2042
2062
|
() => sorting.sortAndOffset[1],
|
|
2043
2063
|
() => sorting.sortAndOffset[2],
|
|
2044
2064
|
() => $$props.limit,
|
|
2065
|
+
undefined,
|
|
2045
2066
|
() => $$props.store,
|
|
2046
2067
|
);
|
|
2047
2068
|
const defaultCellComponent = $.derived(() =>
|
|
@@ -2094,13 +2094,36 @@ const createStore = () => {
|
|
|
2094
2094
|
listener,
|
|
2095
2095
|
mutator,
|
|
2096
2096
|
) => {
|
|
2097
|
-
|
|
2097
|
+
const [descending, offset, limit, sorter] = otherArgs;
|
|
2098
|
+
let sortedRowIds = getSortedRowIds(
|
|
2099
|
+
tableId,
|
|
2100
|
+
cellId,
|
|
2101
|
+
descending,
|
|
2102
|
+
offset,
|
|
2103
|
+
limit,
|
|
2104
|
+
sorter,
|
|
2105
|
+
);
|
|
2098
2106
|
return addListener(
|
|
2099
2107
|
() => {
|
|
2100
|
-
const newSortedRowIds = getSortedRowIds(
|
|
2108
|
+
const newSortedRowIds = getSortedRowIds(
|
|
2109
|
+
tableId,
|
|
2110
|
+
cellId,
|
|
2111
|
+
descending,
|
|
2112
|
+
offset,
|
|
2113
|
+
limit,
|
|
2114
|
+
sorter,
|
|
2115
|
+
);
|
|
2101
2116
|
if (!arrayIsEqual(newSortedRowIds, sortedRowIds)) {
|
|
2102
2117
|
sortedRowIds = newSortedRowIds;
|
|
2103
|
-
listener(
|
|
2118
|
+
listener(
|
|
2119
|
+
store,
|
|
2120
|
+
tableId,
|
|
2121
|
+
cellId,
|
|
2122
|
+
descending,
|
|
2123
|
+
offset,
|
|
2124
|
+
limit,
|
|
2125
|
+
sortedRowIds,
|
|
2126
|
+
);
|
|
2104
2127
|
}
|
|
2105
2128
|
},
|
|
2106
2129
|
sortedRowIdsListeners[mutator ? 1 : 0],
|
|
@@ -2154,6 +2177,7 @@ const createStore = () => {
|
|
|
2154
2177
|
descending,
|
|
2155
2178
|
offset = 0,
|
|
2156
2179
|
limit,
|
|
2180
|
+
sorter = defaultSorter,
|
|
2157
2181
|
) =>
|
|
2158
2182
|
isObject(tableIdOrArgs)
|
|
2159
2183
|
? getSortedRowIds(
|
|
@@ -2162,16 +2186,19 @@ const createStore = () => {
|
|
|
2162
2186
|
tableIdOrArgs.descending,
|
|
2163
2187
|
tableIdOrArgs.offset,
|
|
2164
2188
|
tableIdOrArgs.limit,
|
|
2189
|
+
tableIdOrArgs.sorter,
|
|
2165
2190
|
)
|
|
2166
2191
|
: arrayMap(
|
|
2167
2192
|
slice(
|
|
2168
2193
|
arraySort(
|
|
2169
2194
|
mapMap(mapGet(tablesMap, id(tableIdOrArgs)), (row, rowId) => [
|
|
2170
|
-
isUndefined(cellId)
|
|
2195
|
+
isUndefined(cellId)
|
|
2196
|
+
? rowId
|
|
2197
|
+
: decodeIfJson(mapGet(row, id(cellId))),
|
|
2171
2198
|
rowId,
|
|
2172
2199
|
]),
|
|
2173
2200
|
([cell1], [cell2]) =>
|
|
2174
|
-
|
|
2201
|
+
sorter(cell1, cell2) * (descending ? -1 : 1),
|
|
2175
2202
|
),
|
|
2176
2203
|
offset,
|
|
2177
2204
|
isUndefined(limit) ? limit : offset + limit,
|
|
@@ -2649,6 +2676,7 @@ const createStore = () => {
|
|
|
2649
2676
|
tableIdOrArgs.descending ?? false,
|
|
2650
2677
|
tableIdOrArgs.offset ?? 0,
|
|
2651
2678
|
tableIdOrArgs.limit,
|
|
2679
|
+
tableIdOrArgs.sorter,
|
|
2652
2680
|
],
|
|
2653
2681
|
cellIdOrListener,
|
|
2654
2682
|
descendingOrMutator,
|
|
@@ -2656,7 +2684,7 @@ const createStore = () => {
|
|
|
2656
2684
|
: addSortedRowIdsListenerImpl(
|
|
2657
2685
|
tableIdOrArgs,
|
|
2658
2686
|
cellIdOrListener,
|
|
2659
|
-
[descendingOrMutator, offset, limit],
|
|
2687
|
+
[descendingOrMutator, offset, limit, void 0],
|
|
2660
2688
|
listener,
|
|
2661
2689
|
mutator,
|
|
2662
2690
|
);
|
|
@@ -3037,25 +3065,45 @@ const getRowIds = (tableId, storeOrStoreId) =>
|
|
|
3037
3065
|
]);
|
|
3038
3066
|
|
|
3039
3067
|
const getSortedRowIds = (
|
|
3040
|
-
|
|
3041
|
-
|
|
3068
|
+
tableIdOrArgs,
|
|
3069
|
+
cellIdOrStoreOrStoreId,
|
|
3042
3070
|
descending = false,
|
|
3043
3071
|
offset = 0,
|
|
3044
3072
|
limit,
|
|
3073
|
+
sorter,
|
|
3045
3074
|
storeOrStoreId,
|
|
3046
3075
|
) =>
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3076
|
+
isObject(tableIdOrArgs)
|
|
3077
|
+
? createListenable(
|
|
3078
|
+
resolveStore(cellIdOrStoreOrStoreId),
|
|
3079
|
+
SORTED_ROW_IDS,
|
|
3080
|
+
EMPTY_ARR,
|
|
3081
|
+
() => [tableIdOrArgs],
|
|
3082
|
+
)
|
|
3083
|
+
: createListenable(
|
|
3084
|
+
resolveStore(storeOrStoreId),
|
|
3085
|
+
SORTED_ROW_IDS,
|
|
3086
|
+
EMPTY_ARR,
|
|
3087
|
+
() =>
|
|
3088
|
+
isUndefined(sorter)
|
|
3089
|
+
? [
|
|
3090
|
+
maybeGet$1(tableIdOrArgs),
|
|
3091
|
+
maybeGet$1(cellIdOrStoreOrStoreId),
|
|
3092
|
+
maybeGet$1(descending),
|
|
3093
|
+
maybeGet$1(offset),
|
|
3094
|
+
maybeGet$1(limit),
|
|
3095
|
+
]
|
|
3096
|
+
: [
|
|
3097
|
+
{
|
|
3098
|
+
tableId: maybeGet$1(tableIdOrArgs),
|
|
3099
|
+
cellId: maybeGet$1(cellIdOrStoreOrStoreId),
|
|
3100
|
+
descending: maybeGet$1(descending) ?? false,
|
|
3101
|
+
offset: maybeGet$1(offset) ?? 0,
|
|
3102
|
+
limit: maybeGet$1(limit),
|
|
3103
|
+
sorter,
|
|
3104
|
+
},
|
|
3105
|
+
],
|
|
3106
|
+
);
|
|
3059
3107
|
const getCellIds = (tableId, rowId, storeOrStoreId) =>
|
|
3060
3108
|
createListenable(resolveStore(storeOrStoreId), CELL_IDS, EMPTY_ARR, () => [
|
|
3061
3109
|
maybeGet$1(tableId),
|
|
@@ -5045,6 +5093,7 @@ function SortedTableInHtmlTable($$anchor, $$props) {
|
|
|
5045
5093
|
() => sorting.sortAndOffset[1],
|
|
5046
5094
|
() => sorting.sortAndOffset[2],
|
|
5047
5095
|
() => $$props.limit,
|
|
5096
|
+
undefined,
|
|
5048
5097
|
() => $$props.store,
|
|
5049
5098
|
);
|
|
5050
5099
|
const defaultCellComponent = $.derived(() =>
|
|
@@ -2094,13 +2094,36 @@ const createStore = () => {
|
|
|
2094
2094
|
listener,
|
|
2095
2095
|
mutator,
|
|
2096
2096
|
) => {
|
|
2097
|
-
|
|
2097
|
+
const [descending, offset, limit, sorter] = otherArgs;
|
|
2098
|
+
let sortedRowIds = getSortedRowIds(
|
|
2099
|
+
tableId,
|
|
2100
|
+
cellId,
|
|
2101
|
+
descending,
|
|
2102
|
+
offset,
|
|
2103
|
+
limit,
|
|
2104
|
+
sorter,
|
|
2105
|
+
);
|
|
2098
2106
|
return addListener(
|
|
2099
2107
|
() => {
|
|
2100
|
-
const newSortedRowIds = getSortedRowIds(
|
|
2108
|
+
const newSortedRowIds = getSortedRowIds(
|
|
2109
|
+
tableId,
|
|
2110
|
+
cellId,
|
|
2111
|
+
descending,
|
|
2112
|
+
offset,
|
|
2113
|
+
limit,
|
|
2114
|
+
sorter,
|
|
2115
|
+
);
|
|
2101
2116
|
if (!arrayIsEqual(newSortedRowIds, sortedRowIds)) {
|
|
2102
2117
|
sortedRowIds = newSortedRowIds;
|
|
2103
|
-
listener(
|
|
2118
|
+
listener(
|
|
2119
|
+
store,
|
|
2120
|
+
tableId,
|
|
2121
|
+
cellId,
|
|
2122
|
+
descending,
|
|
2123
|
+
offset,
|
|
2124
|
+
limit,
|
|
2125
|
+
sortedRowIds,
|
|
2126
|
+
);
|
|
2104
2127
|
}
|
|
2105
2128
|
},
|
|
2106
2129
|
sortedRowIdsListeners[mutator ? 1 : 0],
|
|
@@ -2154,6 +2177,7 @@ const createStore = () => {
|
|
|
2154
2177
|
descending,
|
|
2155
2178
|
offset = 0,
|
|
2156
2179
|
limit,
|
|
2180
|
+
sorter = defaultSorter,
|
|
2157
2181
|
) =>
|
|
2158
2182
|
isObject(tableIdOrArgs)
|
|
2159
2183
|
? getSortedRowIds(
|
|
@@ -2162,16 +2186,19 @@ const createStore = () => {
|
|
|
2162
2186
|
tableIdOrArgs.descending,
|
|
2163
2187
|
tableIdOrArgs.offset,
|
|
2164
2188
|
tableIdOrArgs.limit,
|
|
2189
|
+
tableIdOrArgs.sorter,
|
|
2165
2190
|
)
|
|
2166
2191
|
: arrayMap(
|
|
2167
2192
|
slice(
|
|
2168
2193
|
arraySort(
|
|
2169
2194
|
mapMap(mapGet(tablesMap, id(tableIdOrArgs)), (row, rowId) => [
|
|
2170
|
-
isUndefined(cellId)
|
|
2195
|
+
isUndefined(cellId)
|
|
2196
|
+
? rowId
|
|
2197
|
+
: decodeIfJson(mapGet(row, id(cellId))),
|
|
2171
2198
|
rowId,
|
|
2172
2199
|
]),
|
|
2173
2200
|
([cell1], [cell2]) =>
|
|
2174
|
-
|
|
2201
|
+
sorter(cell1, cell2) * (descending ? -1 : 1),
|
|
2175
2202
|
),
|
|
2176
2203
|
offset,
|
|
2177
2204
|
isUndefined(limit) ? limit : offset + limit,
|
|
@@ -2649,6 +2676,7 @@ const createStore = () => {
|
|
|
2649
2676
|
tableIdOrArgs.descending ?? false,
|
|
2650
2677
|
tableIdOrArgs.offset ?? 0,
|
|
2651
2678
|
tableIdOrArgs.limit,
|
|
2679
|
+
tableIdOrArgs.sorter,
|
|
2652
2680
|
],
|
|
2653
2681
|
cellIdOrListener,
|
|
2654
2682
|
descendingOrMutator,
|
|
@@ -2656,7 +2684,7 @@ const createStore = () => {
|
|
|
2656
2684
|
: addSortedRowIdsListenerImpl(
|
|
2657
2685
|
tableIdOrArgs,
|
|
2658
2686
|
cellIdOrListener,
|
|
2659
|
-
[descendingOrMutator, offset, limit],
|
|
2687
|
+
[descendingOrMutator, offset, limit, void 0],
|
|
2660
2688
|
listener,
|
|
2661
2689
|
mutator,
|
|
2662
2690
|
);
|
|
@@ -3037,25 +3065,45 @@ const getRowIds = (tableId, storeOrStoreId) =>
|
|
|
3037
3065
|
]);
|
|
3038
3066
|
|
|
3039
3067
|
const getSortedRowIds = (
|
|
3040
|
-
|
|
3041
|
-
|
|
3068
|
+
tableIdOrArgs,
|
|
3069
|
+
cellIdOrStoreOrStoreId,
|
|
3042
3070
|
descending = false,
|
|
3043
3071
|
offset = 0,
|
|
3044
3072
|
limit,
|
|
3073
|
+
sorter,
|
|
3045
3074
|
storeOrStoreId,
|
|
3046
3075
|
) =>
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3076
|
+
isObject(tableIdOrArgs)
|
|
3077
|
+
? createListenable(
|
|
3078
|
+
resolveStore(cellIdOrStoreOrStoreId),
|
|
3079
|
+
SORTED_ROW_IDS,
|
|
3080
|
+
EMPTY_ARR,
|
|
3081
|
+
() => [tableIdOrArgs],
|
|
3082
|
+
)
|
|
3083
|
+
: createListenable(
|
|
3084
|
+
resolveStore(storeOrStoreId),
|
|
3085
|
+
SORTED_ROW_IDS,
|
|
3086
|
+
EMPTY_ARR,
|
|
3087
|
+
() =>
|
|
3088
|
+
isUndefined(sorter)
|
|
3089
|
+
? [
|
|
3090
|
+
maybeGet$1(tableIdOrArgs),
|
|
3091
|
+
maybeGet$1(cellIdOrStoreOrStoreId),
|
|
3092
|
+
maybeGet$1(descending),
|
|
3093
|
+
maybeGet$1(offset),
|
|
3094
|
+
maybeGet$1(limit),
|
|
3095
|
+
]
|
|
3096
|
+
: [
|
|
3097
|
+
{
|
|
3098
|
+
tableId: maybeGet$1(tableIdOrArgs),
|
|
3099
|
+
cellId: maybeGet$1(cellIdOrStoreOrStoreId),
|
|
3100
|
+
descending: maybeGet$1(descending) ?? false,
|
|
3101
|
+
offset: maybeGet$1(offset) ?? 0,
|
|
3102
|
+
limit: maybeGet$1(limit),
|
|
3103
|
+
sorter,
|
|
3104
|
+
},
|
|
3105
|
+
],
|
|
3106
|
+
);
|
|
3059
3107
|
const getCellIds = (tableId, rowId, storeOrStoreId) =>
|
|
3060
3108
|
createListenable(resolveStore(storeOrStoreId), CELL_IDS, EMPTY_ARR, () => [
|
|
3061
3109
|
maybeGet$1(tableId),
|
|
@@ -5045,6 +5093,7 @@ function SortedTableInHtmlTable($$anchor, $$props) {
|
|
|
5045
5093
|
() => sorting.sortAndOffset[1],
|
|
5046
5094
|
() => sorting.sortAndOffset[2],
|
|
5047
5095
|
() => $$props.limit,
|
|
5096
|
+
undefined,
|
|
5048
5097
|
() => $$props.store,
|
|
5049
5098
|
);
|
|
5050
5099
|
const defaultCellComponent = $.derived(() =>
|
package/with-schemas/index.js
CHANGED
|
@@ -2153,13 +2153,36 @@ const createStore = () => {
|
|
|
2153
2153
|
listener,
|
|
2154
2154
|
mutator,
|
|
2155
2155
|
) => {
|
|
2156
|
-
|
|
2156
|
+
const [descending, offset, limit, sorter] = otherArgs;
|
|
2157
|
+
let sortedRowIds = getSortedRowIds(
|
|
2158
|
+
tableId,
|
|
2159
|
+
cellId,
|
|
2160
|
+
descending,
|
|
2161
|
+
offset,
|
|
2162
|
+
limit,
|
|
2163
|
+
sorter,
|
|
2164
|
+
);
|
|
2157
2165
|
return addListener(
|
|
2158
2166
|
() => {
|
|
2159
|
-
const newSortedRowIds = getSortedRowIds(
|
|
2167
|
+
const newSortedRowIds = getSortedRowIds(
|
|
2168
|
+
tableId,
|
|
2169
|
+
cellId,
|
|
2170
|
+
descending,
|
|
2171
|
+
offset,
|
|
2172
|
+
limit,
|
|
2173
|
+
sorter,
|
|
2174
|
+
);
|
|
2160
2175
|
if (!arrayIsEqual(newSortedRowIds, sortedRowIds)) {
|
|
2161
2176
|
sortedRowIds = newSortedRowIds;
|
|
2162
|
-
listener(
|
|
2177
|
+
listener(
|
|
2178
|
+
store,
|
|
2179
|
+
tableId,
|
|
2180
|
+
cellId,
|
|
2181
|
+
descending,
|
|
2182
|
+
offset,
|
|
2183
|
+
limit,
|
|
2184
|
+
sortedRowIds,
|
|
2185
|
+
);
|
|
2163
2186
|
}
|
|
2164
2187
|
},
|
|
2165
2188
|
sortedRowIdsListeners[mutator ? 1 : 0],
|
|
@@ -2213,6 +2236,7 @@ const createStore = () => {
|
|
|
2213
2236
|
descending,
|
|
2214
2237
|
offset = 0,
|
|
2215
2238
|
limit,
|
|
2239
|
+
sorter = defaultSorter,
|
|
2216
2240
|
) =>
|
|
2217
2241
|
isObject(tableIdOrArgs)
|
|
2218
2242
|
? getSortedRowIds(
|
|
@@ -2221,16 +2245,19 @@ const createStore = () => {
|
|
|
2221
2245
|
tableIdOrArgs.descending,
|
|
2222
2246
|
tableIdOrArgs.offset,
|
|
2223
2247
|
tableIdOrArgs.limit,
|
|
2248
|
+
tableIdOrArgs.sorter,
|
|
2224
2249
|
)
|
|
2225
2250
|
: arrayMap(
|
|
2226
2251
|
slice(
|
|
2227
2252
|
arraySort(
|
|
2228
2253
|
mapMap(mapGet(tablesMap, id(tableIdOrArgs)), (row, rowId) => [
|
|
2229
|
-
isUndefined(cellId)
|
|
2254
|
+
isUndefined(cellId)
|
|
2255
|
+
? rowId
|
|
2256
|
+
: decodeIfJson(mapGet(row, id(cellId))),
|
|
2230
2257
|
rowId,
|
|
2231
2258
|
]),
|
|
2232
2259
|
([cell1], [cell2]) =>
|
|
2233
|
-
|
|
2260
|
+
sorter(cell1, cell2) * (descending ? -1 : 1),
|
|
2234
2261
|
),
|
|
2235
2262
|
offset,
|
|
2236
2263
|
isUndefined(limit) ? limit : offset + limit,
|
|
@@ -2708,6 +2735,7 @@ const createStore = () => {
|
|
|
2708
2735
|
tableIdOrArgs.descending ?? false,
|
|
2709
2736
|
tableIdOrArgs.offset ?? 0,
|
|
2710
2737
|
tableIdOrArgs.limit,
|
|
2738
|
+
tableIdOrArgs.sorter,
|
|
2711
2739
|
],
|
|
2712
2740
|
cellIdOrListener,
|
|
2713
2741
|
descendingOrMutator,
|
|
@@ -2715,7 +2743,7 @@ const createStore = () => {
|
|
|
2715
2743
|
: addSortedRowIdsListenerImpl(
|
|
2716
2744
|
tableIdOrArgs,
|
|
2717
2745
|
cellIdOrListener,
|
|
2718
|
-
[descendingOrMutator, offset, limit],
|
|
2746
|
+
[descendingOrMutator, offset, limit, void 0],
|
|
2719
2747
|
listener,
|
|
2720
2748
|
mutator,
|
|
2721
2749
|
);
|