tinybase 9.0.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-react-dom/index.d.ts +10 -10
- package/@types/ui-react-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-react-dom-charts/index.d.ts +7 -7
- package/@types/ui-react-dom-charts/with-schemas/index.d.ts +7 -7
- package/@types/ui-react-inspector/index.d.ts +1 -1
- package/@types/ui-react-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-solid/index.d.ts +9 -2
- package/@types/ui-solid/with-schemas/index.d.ts +10 -2
- package/@types/ui-solid-dom/index.d.ts +10 -10
- package/@types/ui-solid-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-solid-inspector/index.d.ts +1 -1
- package/@types/ui-solid-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-svelte/index.d.ts +50 -2
- package/@types/ui-svelte/with-schemas/index.d.ts +88 -25
- package/@types/ui-svelte-dom/index.d.ts +10 -10
- package/@types/ui-svelte-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-svelte-inspector/index.d.ts +1 -1
- package/@types/ui-svelte-inspector/with-schemas/index.d.ts +1 -1
- 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/readme.md +14 -14
- package/releases.md +59 -59
- 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
|
@@ -2176,13 +2176,36 @@ const createStore = () => {
|
|
|
2176
2176
|
listener,
|
|
2177
2177
|
mutator,
|
|
2178
2178
|
) => {
|
|
2179
|
-
|
|
2179
|
+
const [descending, offset, limit, sorter] = otherArgs;
|
|
2180
|
+
let sortedRowIds = getSortedRowIds(
|
|
2181
|
+
tableId,
|
|
2182
|
+
cellId,
|
|
2183
|
+
descending,
|
|
2184
|
+
offset,
|
|
2185
|
+
limit,
|
|
2186
|
+
sorter,
|
|
2187
|
+
);
|
|
2180
2188
|
return addListener(
|
|
2181
2189
|
() => {
|
|
2182
|
-
const newSortedRowIds = getSortedRowIds(
|
|
2190
|
+
const newSortedRowIds = getSortedRowIds(
|
|
2191
|
+
tableId,
|
|
2192
|
+
cellId,
|
|
2193
|
+
descending,
|
|
2194
|
+
offset,
|
|
2195
|
+
limit,
|
|
2196
|
+
sorter,
|
|
2197
|
+
);
|
|
2183
2198
|
if (!arrayIsEqual(newSortedRowIds, sortedRowIds)) {
|
|
2184
2199
|
sortedRowIds = newSortedRowIds;
|
|
2185
|
-
listener(
|
|
2200
|
+
listener(
|
|
2201
|
+
store,
|
|
2202
|
+
tableId,
|
|
2203
|
+
cellId,
|
|
2204
|
+
descending,
|
|
2205
|
+
offset,
|
|
2206
|
+
limit,
|
|
2207
|
+
sortedRowIds,
|
|
2208
|
+
);
|
|
2186
2209
|
}
|
|
2187
2210
|
},
|
|
2188
2211
|
sortedRowIdsListeners[mutator ? 1 : 0],
|
|
@@ -2236,6 +2259,7 @@ const createStore = () => {
|
|
|
2236
2259
|
descending,
|
|
2237
2260
|
offset = 0,
|
|
2238
2261
|
limit,
|
|
2262
|
+
sorter = defaultSorter,
|
|
2239
2263
|
) =>
|
|
2240
2264
|
isObject(tableIdOrArgs)
|
|
2241
2265
|
? getSortedRowIds(
|
|
@@ -2244,16 +2268,19 @@ const createStore = () => {
|
|
|
2244
2268
|
tableIdOrArgs.descending,
|
|
2245
2269
|
tableIdOrArgs.offset,
|
|
2246
2270
|
tableIdOrArgs.limit,
|
|
2271
|
+
tableIdOrArgs.sorter,
|
|
2247
2272
|
)
|
|
2248
2273
|
: arrayMap(
|
|
2249
2274
|
slice(
|
|
2250
2275
|
arraySort(
|
|
2251
2276
|
mapMap(mapGet(tablesMap, id(tableIdOrArgs)), (row, rowId) => [
|
|
2252
|
-
isUndefined(cellId)
|
|
2277
|
+
isUndefined(cellId)
|
|
2278
|
+
? rowId
|
|
2279
|
+
: decodeIfJson(mapGet(row, id(cellId))),
|
|
2253
2280
|
rowId,
|
|
2254
2281
|
]),
|
|
2255
2282
|
([cell1], [cell2]) =>
|
|
2256
|
-
|
|
2283
|
+
sorter(cell1, cell2) * (descending ? -1 : 1),
|
|
2257
2284
|
),
|
|
2258
2285
|
offset,
|
|
2259
2286
|
isUndefined(limit) ? limit : offset + limit,
|
|
@@ -2731,6 +2758,7 @@ const createStore = () => {
|
|
|
2731
2758
|
tableIdOrArgs.descending ?? false,
|
|
2732
2759
|
tableIdOrArgs.offset ?? 0,
|
|
2733
2760
|
tableIdOrArgs.limit,
|
|
2761
|
+
tableIdOrArgs.sorter,
|
|
2734
2762
|
],
|
|
2735
2763
|
cellIdOrListener,
|
|
2736
2764
|
descendingOrMutator,
|
|
@@ -2738,7 +2766,7 @@ const createStore = () => {
|
|
|
2738
2766
|
: addSortedRowIdsListenerImpl(
|
|
2739
2767
|
tableIdOrArgs,
|
|
2740
2768
|
cellIdOrListener,
|
|
2741
|
-
[descendingOrMutator, offset, limit],
|
|
2769
|
+
[descendingOrMutator, offset, limit, void 0],
|
|
2742
2770
|
listener,
|
|
2743
2771
|
mutator,
|
|
2744
2772
|
);
|
|
@@ -3145,13 +3173,25 @@ const useSortedRowIdsImpl = (
|
|
|
3145
3173
|
descending,
|
|
3146
3174
|
offset,
|
|
3147
3175
|
limit,
|
|
3176
|
+
sorter,
|
|
3148
3177
|
storeOrStoreId,
|
|
3149
3178
|
) =>
|
|
3150
3179
|
useListenable(
|
|
3151
3180
|
SORTED_ROW_IDS,
|
|
3152
3181
|
useStoreOrStoreById(storeOrStoreId),
|
|
3153
3182
|
1 /* Array */,
|
|
3154
|
-
|
|
3183
|
+
isUndefined(sorter)
|
|
3184
|
+
? [tableId, cellId, descending, offset, limit]
|
|
3185
|
+
: [
|
|
3186
|
+
() => ({
|
|
3187
|
+
tableId: getThing(tableId),
|
|
3188
|
+
cellId: getThing(cellId),
|
|
3189
|
+
descending: getThing(descending) ?? false,
|
|
3190
|
+
offset: getThing(offset) ?? 0,
|
|
3191
|
+
limit: getThing(limit),
|
|
3192
|
+
sorter: getThing(sorter),
|
|
3193
|
+
}),
|
|
3194
|
+
],
|
|
3155
3195
|
);
|
|
3156
3196
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
3157
3197
|
useThingOrThingById(storeOrStoreId, OFFSET_STORE);
|
|
@@ -3179,6 +3219,7 @@ const useSortedRowIds = (
|
|
|
3179
3219
|
descending,
|
|
3180
3220
|
offset,
|
|
3181
3221
|
limit,
|
|
3222
|
+
sorter,
|
|
3182
3223
|
storeOrStoreId,
|
|
3183
3224
|
) =>
|
|
3184
3225
|
isObject(tableIdOrArgs)
|
|
@@ -3188,6 +3229,7 @@ const useSortedRowIds = (
|
|
|
3188
3229
|
tableIdOrArgs.descending ?? false,
|
|
3189
3230
|
tableIdOrArgs.offset ?? 0,
|
|
3190
3231
|
tableIdOrArgs.limit,
|
|
3232
|
+
() => tableIdOrArgs.sorter,
|
|
3191
3233
|
cellIdOrStoreOrStoreId,
|
|
3192
3234
|
)
|
|
3193
3235
|
: useSortedRowIdsImpl(
|
|
@@ -3196,6 +3238,7 @@ const useSortedRowIds = (
|
|
|
3196
3238
|
descending,
|
|
3197
3239
|
offset,
|
|
3198
3240
|
limit,
|
|
3241
|
+
isUndefined(sorter) ? void 0 : () => sorter,
|
|
3199
3242
|
storeOrStoreId,
|
|
3200
3243
|
);
|
|
3201
3244
|
const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
@@ -4197,6 +4240,7 @@ const SortedTableInHtmlTable = (props) => {
|
|
|
4197
4240
|
() => sortAndOffset()[1],
|
|
4198
4241
|
() => sortAndOffset()[2],
|
|
4199
4242
|
() => props.limit,
|
|
4243
|
+
void 0,
|
|
4200
4244
|
() => props.store,
|
|
4201
4245
|
),
|
|
4202
4246
|
props.extraCellsBefore,
|
|
@@ -2176,13 +2176,36 @@ const createStore = () => {
|
|
|
2176
2176
|
listener,
|
|
2177
2177
|
mutator,
|
|
2178
2178
|
) => {
|
|
2179
|
-
|
|
2179
|
+
const [descending, offset, limit, sorter] = otherArgs;
|
|
2180
|
+
let sortedRowIds = getSortedRowIds(
|
|
2181
|
+
tableId,
|
|
2182
|
+
cellId,
|
|
2183
|
+
descending,
|
|
2184
|
+
offset,
|
|
2185
|
+
limit,
|
|
2186
|
+
sorter,
|
|
2187
|
+
);
|
|
2180
2188
|
return addListener(
|
|
2181
2189
|
() => {
|
|
2182
|
-
const newSortedRowIds = getSortedRowIds(
|
|
2190
|
+
const newSortedRowIds = getSortedRowIds(
|
|
2191
|
+
tableId,
|
|
2192
|
+
cellId,
|
|
2193
|
+
descending,
|
|
2194
|
+
offset,
|
|
2195
|
+
limit,
|
|
2196
|
+
sorter,
|
|
2197
|
+
);
|
|
2183
2198
|
if (!arrayIsEqual(newSortedRowIds, sortedRowIds)) {
|
|
2184
2199
|
sortedRowIds = newSortedRowIds;
|
|
2185
|
-
listener(
|
|
2200
|
+
listener(
|
|
2201
|
+
store,
|
|
2202
|
+
tableId,
|
|
2203
|
+
cellId,
|
|
2204
|
+
descending,
|
|
2205
|
+
offset,
|
|
2206
|
+
limit,
|
|
2207
|
+
sortedRowIds,
|
|
2208
|
+
);
|
|
2186
2209
|
}
|
|
2187
2210
|
},
|
|
2188
2211
|
sortedRowIdsListeners[mutator ? 1 : 0],
|
|
@@ -2236,6 +2259,7 @@ const createStore = () => {
|
|
|
2236
2259
|
descending,
|
|
2237
2260
|
offset = 0,
|
|
2238
2261
|
limit,
|
|
2262
|
+
sorter = defaultSorter,
|
|
2239
2263
|
) =>
|
|
2240
2264
|
isObject(tableIdOrArgs)
|
|
2241
2265
|
? getSortedRowIds(
|
|
@@ -2244,16 +2268,19 @@ const createStore = () => {
|
|
|
2244
2268
|
tableIdOrArgs.descending,
|
|
2245
2269
|
tableIdOrArgs.offset,
|
|
2246
2270
|
tableIdOrArgs.limit,
|
|
2271
|
+
tableIdOrArgs.sorter,
|
|
2247
2272
|
)
|
|
2248
2273
|
: arrayMap(
|
|
2249
2274
|
slice(
|
|
2250
2275
|
arraySort(
|
|
2251
2276
|
mapMap(mapGet(tablesMap, id(tableIdOrArgs)), (row, rowId) => [
|
|
2252
|
-
isUndefined(cellId)
|
|
2277
|
+
isUndefined(cellId)
|
|
2278
|
+
? rowId
|
|
2279
|
+
: decodeIfJson(mapGet(row, id(cellId))),
|
|
2253
2280
|
rowId,
|
|
2254
2281
|
]),
|
|
2255
2282
|
([cell1], [cell2]) =>
|
|
2256
|
-
|
|
2283
|
+
sorter(cell1, cell2) * (descending ? -1 : 1),
|
|
2257
2284
|
),
|
|
2258
2285
|
offset,
|
|
2259
2286
|
isUndefined(limit) ? limit : offset + limit,
|
|
@@ -2731,6 +2758,7 @@ const createStore = () => {
|
|
|
2731
2758
|
tableIdOrArgs.descending ?? false,
|
|
2732
2759
|
tableIdOrArgs.offset ?? 0,
|
|
2733
2760
|
tableIdOrArgs.limit,
|
|
2761
|
+
tableIdOrArgs.sorter,
|
|
2734
2762
|
],
|
|
2735
2763
|
cellIdOrListener,
|
|
2736
2764
|
descendingOrMutator,
|
|
@@ -2738,7 +2766,7 @@ const createStore = () => {
|
|
|
2738
2766
|
: addSortedRowIdsListenerImpl(
|
|
2739
2767
|
tableIdOrArgs,
|
|
2740
2768
|
cellIdOrListener,
|
|
2741
|
-
[descendingOrMutator, offset, limit],
|
|
2769
|
+
[descendingOrMutator, offset, limit, void 0],
|
|
2742
2770
|
listener,
|
|
2743
2771
|
mutator,
|
|
2744
2772
|
);
|
|
@@ -3145,13 +3173,25 @@ const useSortedRowIdsImpl = (
|
|
|
3145
3173
|
descending,
|
|
3146
3174
|
offset,
|
|
3147
3175
|
limit,
|
|
3176
|
+
sorter,
|
|
3148
3177
|
storeOrStoreId,
|
|
3149
3178
|
) =>
|
|
3150
3179
|
useListenable(
|
|
3151
3180
|
SORTED_ROW_IDS,
|
|
3152
3181
|
useStoreOrStoreById(storeOrStoreId),
|
|
3153
3182
|
1 /* Array */,
|
|
3154
|
-
|
|
3183
|
+
isUndefined(sorter)
|
|
3184
|
+
? [tableId, cellId, descending, offset, limit]
|
|
3185
|
+
: [
|
|
3186
|
+
() => ({
|
|
3187
|
+
tableId: getThing(tableId),
|
|
3188
|
+
cellId: getThing(cellId),
|
|
3189
|
+
descending: getThing(descending) ?? false,
|
|
3190
|
+
offset: getThing(offset) ?? 0,
|
|
3191
|
+
limit: getThing(limit),
|
|
3192
|
+
sorter: getThing(sorter),
|
|
3193
|
+
}),
|
|
3194
|
+
],
|
|
3155
3195
|
);
|
|
3156
3196
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
3157
3197
|
useThingOrThingById(storeOrStoreId, OFFSET_STORE);
|
|
@@ -3179,6 +3219,7 @@ const useSortedRowIds = (
|
|
|
3179
3219
|
descending,
|
|
3180
3220
|
offset,
|
|
3181
3221
|
limit,
|
|
3222
|
+
sorter,
|
|
3182
3223
|
storeOrStoreId,
|
|
3183
3224
|
) =>
|
|
3184
3225
|
isObject(tableIdOrArgs)
|
|
@@ -3188,6 +3229,7 @@ const useSortedRowIds = (
|
|
|
3188
3229
|
tableIdOrArgs.descending ?? false,
|
|
3189
3230
|
tableIdOrArgs.offset ?? 0,
|
|
3190
3231
|
tableIdOrArgs.limit,
|
|
3232
|
+
() => tableIdOrArgs.sorter,
|
|
3191
3233
|
cellIdOrStoreOrStoreId,
|
|
3192
3234
|
)
|
|
3193
3235
|
: useSortedRowIdsImpl(
|
|
@@ -3196,6 +3238,7 @@ const useSortedRowIds = (
|
|
|
3196
3238
|
descending,
|
|
3197
3239
|
offset,
|
|
3198
3240
|
limit,
|
|
3241
|
+
isUndefined(sorter) ? void 0 : () => sorter,
|
|
3199
3242
|
storeOrStoreId,
|
|
3200
3243
|
);
|
|
3201
3244
|
const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
@@ -4197,6 +4240,7 @@ const SortedTableInHtmlTable = (props) => {
|
|
|
4197
4240
|
() => sortAndOffset()[1],
|
|
4198
4241
|
() => sortAndOffset()[2],
|
|
4199
4242
|
() => props.limit,
|
|
4243
|
+
void 0,
|
|
4200
4244
|
() => props.store,
|
|
4201
4245
|
),
|
|
4202
4246
|
props.extraCellsBefore,
|
package/ui-svelte/index.js
CHANGED
|
@@ -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
|
|
|
@@ -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(() =>
|