@1771technologies/lytenyte-pro 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -6
- package/dist/+types.d.ts +24 -4
- package/dist/cell-selection/cell-selection-driver.js +2 -1
- package/dist/cell-selection/cell-style-row.d.ts +2 -2
- package/dist/cell-selection/cell-style-row.js +1 -1
- package/dist/cell-selection/get-root-cell.js +3 -83
- package/dist/cell-selection/index.d.ts +0 -1
- package/dist/cell-selection/index.js +0 -1
- package/dist/cell-selection/split-cell-selection-rect.d.ts +8 -1
- package/dist/cell-selection/split-cell-selection-rect.js +13 -4
- package/dist/cell-selection/split-on-pivot.d.ts +3 -0
- package/dist/cell-selection/split-on-pivot.js +50 -0
- package/dist/cells/cell-editor.js +1 -1
- package/dist/cells/cell-spacer.d.ts +3 -0
- package/dist/cells/cell-spacer.js +37 -0
- package/dist/cells/cell.d.ts +1 -3
- package/dist/cells/cell.js +11 -9
- package/dist/column-manager/branch.js +1 -1
- package/dist/column-manager/leaf.js +1 -1
- package/dist/column-manager/move-handle.d.ts +0 -7
- package/dist/column-manager/move-handle.js +23 -6
- package/dist/filter-tree/leaf.js +3 -1
- package/dist/grid-box/+types.d.ts +2 -2
- package/dist/grid-box/item.js +3 -3
- package/dist/grid-box/use-aggregation-box-items.js +1 -2
- package/dist/grid-box/use-column-box-items.d.ts +2 -3
- package/dist/grid-box/use-column-box-items.js +3 -3
- package/dist/grid-box/use-row-group-box-items.d.ts +3 -3
- package/dist/grid-box/use-row-group-box-items.js +41 -5
- package/dist/grid.d.ts +1 -1
- package/dist/header/resize-handler.js +21 -15
- package/dist/license.js +1 -1
- package/dist/row-data-source-client/use-client-data-source-paginated.js +154 -164
- package/dist/row-data-source-client/use-client-data-source.js +144 -177
- package/dist/row-data-source-client/use-client-tree-data-source.js +119 -152
- package/dist/row-data-source-server/use-server-data-source.js +102 -120
- package/dist/rows/row/row.d.ts +1 -1
- package/dist/rows/row/row.js +11 -4
- package/dist/rows/rows-sections.js +1 -1
- package/dist/sort-manager/+types.d.ts +2 -0
- package/dist/sort-manager/hooks/use-sort-row-item.js +6 -6
- package/dist/sort-manager/utils/sort-item-to-sort-model.js +5 -0
- package/dist/sort-manager/utils/sort-model-to-sort-items.js +2 -1
- package/dist/state/+types.d.ts +8 -10
- package/dist/state/api/cell-root.d.ts +5 -0
- package/dist/state/api/cell-root.js +64 -0
- package/dist/state/api/edit-begin.js +5 -9
- package/dist/state/api/edit-is-cell-active.d.ts +1 -1
- package/dist/state/api/edit-is-cell-active.js +2 -7
- package/dist/state/api/focus-cell.js +2 -2
- package/dist/state/helpers/column-layout.d.ts +3 -3
- package/dist/state/helpers/column-layout.js +9 -15
- package/dist/state/helpers/get-full-width-callback.d.ts +1 -1
- package/dist/state/helpers/get-full-width-callback.js +2 -0
- package/dist/state/helpers/get-span-callback.d.ts +1 -1
- package/dist/state/helpers/get-span-callback.js +2 -0
- package/dist/state/helpers/row-layout/row-layout.d.ts +5 -4
- package/dist/state/helpers/row-layout/row-layout.js +112 -346
- package/dist/state/use-lytenyte.js +398 -334
- package/dist/viewport/viewport.js +3 -2
- package/main.css +27 -3
- package/package.json +7 -7
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import {} from "../+types.js";
|
|
2
2
|
import { useRef } from "react";
|
|
3
|
-
import { atom, createStore } from "@1771technologies/atom";
|
|
4
3
|
import { traverse } from "./tree/traverse.js";
|
|
5
|
-
import { dateComparator,
|
|
4
|
+
import { computed, dateComparator, effect, makeAtom, numberComparator, peek, signal, stringComparator, } from "@1771technologies/lytenyte-shared";
|
|
6
5
|
import { equal } from "@1771technologies/lytenyte-js-utils";
|
|
7
6
|
import { makeClientTree } from "./tree/client-tree.js";
|
|
8
7
|
import { computeFilteredRows } from "./filter/compute-filtered-rows.js";
|
|
9
8
|
import { builtIns } from "./built-ins/built-ins.js";
|
|
10
9
|
export function makeClientTreeDataSource(p) {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
return new Map(g(data).map((c, i) => [c, i]));
|
|
10
|
+
const data = signal(p.data);
|
|
11
|
+
const topData = signal(p.topData ?? []);
|
|
12
|
+
const bottomData = signal(p.bottomData ?? []);
|
|
13
|
+
const dataToSrc$ = computed(() => {
|
|
14
|
+
return new Map(data().map((c, i) => [c, i]));
|
|
17
15
|
});
|
|
18
16
|
const cache = new Map();
|
|
19
|
-
const centerNodes =
|
|
17
|
+
const centerNodes = computed(() => {
|
|
20
18
|
const nodes = [];
|
|
21
|
-
const d =
|
|
19
|
+
const d = data();
|
|
22
20
|
for (let i = 0; i < d.length; i++) {
|
|
23
21
|
if (!cache.has(i)) {
|
|
24
22
|
cache.set(i, {
|
|
@@ -33,39 +31,38 @@ export function makeClientTreeDataSource(p) {
|
|
|
33
31
|
}
|
|
34
32
|
return nodes;
|
|
35
33
|
});
|
|
36
|
-
const topNodes =
|
|
37
|
-
return
|
|
34
|
+
const topNodes = computed(() => {
|
|
35
|
+
return topData().map((c, i) => ({ data: c, id: `top-${i}`, kind: "leaf" }));
|
|
38
36
|
});
|
|
39
|
-
const botNodes =
|
|
40
|
-
return
|
|
37
|
+
const botNodes = computed(() => {
|
|
38
|
+
return bottomData().map((c, i) => ({ data: c, id: `bottom-${i}`, kind: "leaf" }));
|
|
41
39
|
});
|
|
42
|
-
const pinnedIdMap =
|
|
43
|
-
const combined = new Map([...
|
|
40
|
+
const pinnedIdMap = computed(() => {
|
|
41
|
+
const combined = new Map([...topNodes(), ...botNodes()].map((c) => [c.id, c]));
|
|
44
42
|
return combined;
|
|
45
43
|
});
|
|
46
|
-
const models =
|
|
44
|
+
const models = signal({
|
|
47
45
|
sort: [],
|
|
48
46
|
filter: {},
|
|
49
47
|
filterIn: {},
|
|
50
48
|
quickSearch: null,
|
|
51
49
|
agg: {},
|
|
52
50
|
groupExpansions: {},
|
|
53
|
-
columnPivotGroupExpansions: {},
|
|
54
51
|
});
|
|
55
|
-
const sortModel =
|
|
56
|
-
const filterModel =
|
|
57
|
-
const filterInModel =
|
|
58
|
-
const groupExpansions =
|
|
59
|
-
const aggModel =
|
|
60
|
-
const quickSearch =
|
|
61
|
-
const grid$ =
|
|
62
|
-
const snapshot =
|
|
63
|
-
const tree =
|
|
64
|
-
|
|
65
|
-
const grid =
|
|
66
|
-
const rows =
|
|
67
|
-
const filtered = computeFilteredRows(rows, grid,
|
|
68
|
-
const rowAggModel = Object.entries(
|
|
52
|
+
const sortModel = computed(() => models().sort);
|
|
53
|
+
const filterModel = computed(() => models().filter);
|
|
54
|
+
const filterInModel = computed(() => models().filterIn);
|
|
55
|
+
const groupExpansions = computed(() => models().groupExpansions);
|
|
56
|
+
const aggModel = computed(() => models().agg);
|
|
57
|
+
const quickSearch = computed(() => models().quickSearch);
|
|
58
|
+
const grid$ = signal(null);
|
|
59
|
+
const snapshot = signal(0);
|
|
60
|
+
const tree = computed(() => {
|
|
61
|
+
snapshot();
|
|
62
|
+
const grid = grid$();
|
|
63
|
+
const rows = centerNodes();
|
|
64
|
+
const filtered = computeFilteredRows(rows, grid, filterModel(), filterInModel(), quickSearch(), grid?.state.quickSearchSensitivity.get() ?? "case-sensitive", false);
|
|
65
|
+
const rowAggModel = Object.entries(aggModel()).map(([name, agg]) => {
|
|
69
66
|
if (typeof agg.fn === "function") {
|
|
70
67
|
const fn = agg.fn;
|
|
71
68
|
return {
|
|
@@ -88,11 +85,11 @@ export function makeClientTreeDataSource(p) {
|
|
|
88
85
|
rowIdLeaf: p.rowIdLeaf,
|
|
89
86
|
});
|
|
90
87
|
});
|
|
91
|
-
const sortComparator =
|
|
92
|
-
const model =
|
|
93
|
-
const grid =
|
|
88
|
+
const sortComparator = computed(() => {
|
|
89
|
+
const model = sortModel();
|
|
90
|
+
const grid = grid$();
|
|
94
91
|
if (!model.length || !grid)
|
|
95
|
-
return () => 0;
|
|
92
|
+
return { fn: () => 0 };
|
|
96
93
|
const comparator = (l, r) => {
|
|
97
94
|
let res = 0;
|
|
98
95
|
for (const sortSpec of model) {
|
|
@@ -131,27 +128,27 @@ export function makeClientTreeDataSource(p) {
|
|
|
131
128
|
}
|
|
132
129
|
return res;
|
|
133
130
|
};
|
|
134
|
-
return comparator;
|
|
131
|
+
return { fn: comparator };
|
|
135
132
|
});
|
|
136
|
-
const idToNode =
|
|
133
|
+
const idToNode = computed(() => {
|
|
137
134
|
const map = new Map();
|
|
138
|
-
traverse(
|
|
135
|
+
traverse(tree().root, (node) => {
|
|
139
136
|
map.set(node.id, node);
|
|
140
137
|
});
|
|
141
138
|
return map;
|
|
142
139
|
});
|
|
143
|
-
const initialized =
|
|
144
|
-
const flat =
|
|
145
|
-
if (!
|
|
140
|
+
const initialized = signal(false);
|
|
141
|
+
const flat = computed(() => {
|
|
142
|
+
if (!initialized())
|
|
146
143
|
return { flat: [], idMap: new Map(), idToIndexMap: new Map() };
|
|
147
144
|
const idMap = new Map();
|
|
148
145
|
const idToIndexMap = new Map();
|
|
149
146
|
const flattened = [];
|
|
150
|
-
const comparator =
|
|
151
|
-
const expansions =
|
|
152
|
-
const defaultExpansion =
|
|
153
|
-
let index =
|
|
154
|
-
traverse(
|
|
147
|
+
const comparator = sortComparator();
|
|
148
|
+
const expansions = groupExpansions();
|
|
149
|
+
const defaultExpansion = grid$()?.state.rowGroupDefaultExpansion.get() ?? false;
|
|
150
|
+
let index = topNodes().length;
|
|
151
|
+
traverse(tree().root, (node) => {
|
|
155
152
|
if (node.kind === 1) {
|
|
156
153
|
node.data.id = node.id;
|
|
157
154
|
flattened.push(node.data);
|
|
@@ -175,103 +172,77 @@ export function makeClientTreeDataSource(p) {
|
|
|
175
172
|
: defaultExpansion);
|
|
176
173
|
return expanded;
|
|
177
174
|
}
|
|
178
|
-
}, comparator);
|
|
175
|
+
}, comparator.fn);
|
|
179
176
|
return { flat: flattened, idMap, idToIndexMap };
|
|
180
177
|
});
|
|
181
|
-
const flatLength =
|
|
178
|
+
const flatLength = computed(() => flat().flat.length);
|
|
182
179
|
const cleanup = [];
|
|
183
180
|
const init = (grid) => {
|
|
184
181
|
while (cleanup.length)
|
|
185
182
|
cleanup.pop()?.();
|
|
186
|
-
|
|
183
|
+
grid$.set(grid);
|
|
187
184
|
const store = grid.state.rowDataStore;
|
|
188
185
|
// Monitor row count changes
|
|
189
|
-
const centerCount =
|
|
186
|
+
const centerCount = flatLength();
|
|
187
|
+
const top = topData().length;
|
|
188
|
+
const bottom = bottomData().length;
|
|
190
189
|
store.rowCenterCount.set(centerCount);
|
|
191
|
-
cleanup.push(rdsStore.sub(flatLength, () => {
|
|
192
|
-
const centerCount = rdsStore.get(flatLength);
|
|
193
|
-
store.rowCenterCount.set(centerCount);
|
|
194
|
-
grid.state.rowDataStore.rowClearCache();
|
|
195
|
-
}));
|
|
196
|
-
const top = rdsStore.get(topData).length;
|
|
197
190
|
store.rowTopCount.set(top);
|
|
198
|
-
cleanup.push(rdsStore.sub(topData, () => {
|
|
199
|
-
const top = rdsStore.get(topData).length;
|
|
200
|
-
store.rowTopCount.set(top);
|
|
201
|
-
grid.state.rowDataStore.rowClearCache();
|
|
202
|
-
}));
|
|
203
|
-
const bottom = rdsStore.get(bottomData).length;
|
|
204
191
|
store.rowBottomCount.set(bottom);
|
|
205
|
-
cleanup.push(
|
|
206
|
-
|
|
207
|
-
store.
|
|
192
|
+
cleanup.push(effect(() => {
|
|
193
|
+
store.rowCenterCount.set(flatLength());
|
|
194
|
+
store.rowTopCount.set(topData().length);
|
|
195
|
+
store.rowBottomCount.set(bottomData().length);
|
|
208
196
|
grid.state.rowDataStore.rowClearCache();
|
|
209
197
|
}));
|
|
210
198
|
const sort = grid.state.sortModel.get();
|
|
211
199
|
const filter = grid.state.filterModel.get();
|
|
212
200
|
const filterIn = grid.state.filterInModel.get();
|
|
213
|
-
const groupExpansions = grid.state.rowGroupExpansions.get();
|
|
214
201
|
const agg = grid.state.aggModel.get();
|
|
215
202
|
const quickSearch = grid.state.quickSearch.get();
|
|
216
|
-
const
|
|
217
|
-
|
|
203
|
+
const groupExpansions = grid.state.rowGroupExpansions.get();
|
|
204
|
+
models.set({
|
|
218
205
|
agg,
|
|
219
206
|
filter,
|
|
220
207
|
filterIn,
|
|
221
|
-
quickSearch,
|
|
222
208
|
groupExpansions,
|
|
209
|
+
quickSearch,
|
|
223
210
|
sort,
|
|
224
|
-
columnPivotGroupExpansions,
|
|
225
211
|
});
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
cleanup.push(grid.state.rowGroupModel.watch(() => {
|
|
247
|
-
rdsStore.set(models, (prev) => ({ ...prev, group: grid.state.rowGroupModel.get() }));
|
|
248
|
-
grid.state.rowDataStore.rowClearCache();
|
|
249
|
-
}));
|
|
250
|
-
// Row group expansions monitoring
|
|
251
|
-
cleanup.push(grid.state.rowGroupExpansions.watch(() => {
|
|
252
|
-
rdsStore.set(models, (prev) => ({
|
|
253
|
-
...prev,
|
|
254
|
-
groupExpansions: grid.state.rowGroupExpansions.get(),
|
|
255
|
-
}));
|
|
256
|
-
grid.state.rowDataStore.rowClearCache();
|
|
257
|
-
}));
|
|
258
|
-
// Agg model monitoring
|
|
259
|
-
cleanup.push(grid.state.aggModel.watch(() => {
|
|
260
|
-
rdsStore.set(models, (prev) => ({ ...prev, agg: grid.state.aggModel.get() }));
|
|
212
|
+
initialized.set(true);
|
|
213
|
+
cleanup.push(effect(() => {
|
|
214
|
+
models.set({
|
|
215
|
+
// @ts-expect-error The $ is defined, but only internally
|
|
216
|
+
sort: grid.state.sortModel.$(),
|
|
217
|
+
// @ts-expect-error The $ is defined, but only internally
|
|
218
|
+
agg: grid.state.aggModel.$(),
|
|
219
|
+
// @ts-expect-error The $ is defined, but only internally
|
|
220
|
+
filter: grid.state.filterModel.$(),
|
|
221
|
+
// @ts-expect-error The $ is defined, but only internally
|
|
222
|
+
group: grid.state.rowGroupModel.$(),
|
|
223
|
+
// @ts-expect-error The $ is defined, but only internally
|
|
224
|
+
groupExpansions: grid.state.rowGroupExpansions.$(),
|
|
225
|
+
// @ts-expect-error The $ is defined, but only internally
|
|
226
|
+
columnPivotGroupExpansions: grid.state.columnPivotColumnGroupExpansions.$(),
|
|
227
|
+
// @ts-expect-error The $ is defined, but only internally
|
|
228
|
+
filterIn: grid.state.filterInModel.$(),
|
|
229
|
+
// @ts-expect-error The $ is defined, but only internally
|
|
230
|
+
quickSearch: grid.state.quickSearch.$(),
|
|
231
|
+
});
|
|
261
232
|
grid.state.rowDataStore.rowClearCache();
|
|
262
233
|
}));
|
|
263
234
|
};
|
|
264
235
|
const rowById = (id) => {
|
|
265
|
-
const pinned =
|
|
236
|
+
const pinned = peek(pinnedIdMap);
|
|
266
237
|
if (pinned.has(id))
|
|
267
238
|
return pinned.get(id);
|
|
268
|
-
const t =
|
|
239
|
+
const t = peek(flat);
|
|
269
240
|
return t.idMap.get(id) ?? null;
|
|
270
241
|
};
|
|
271
242
|
const rowByIndex = (index) => {
|
|
272
|
-
const top =
|
|
273
|
-
const bot =
|
|
274
|
-
const center =
|
|
243
|
+
const top = peek(topNodes);
|
|
244
|
+
const bot = peek(botNodes);
|
|
245
|
+
const center = peek(flat).flat;
|
|
275
246
|
const topOffset = top.length;
|
|
276
247
|
const centerOffset = topOffset + center.length;
|
|
277
248
|
const botOffset = centerOffset + bot.length;
|
|
@@ -284,10 +255,10 @@ export function makeClientTreeDataSource(p) {
|
|
|
284
255
|
return null;
|
|
285
256
|
};
|
|
286
257
|
const rowUpdate = (updates) => {
|
|
287
|
-
const grid =
|
|
288
|
-
const d =
|
|
289
|
-
const idMap =
|
|
290
|
-
const dataToSrc =
|
|
258
|
+
const grid = peek(grid$);
|
|
259
|
+
const d = peek(data);
|
|
260
|
+
const idMap = peek(idToNode);
|
|
261
|
+
const dataToSrc = peek(dataToSrc$);
|
|
291
262
|
for (const [key, next] of updates.entries()) {
|
|
292
263
|
const row = typeof key === "string" ? rowById(key) : rowByIndex(key);
|
|
293
264
|
const treeNode = typeof key === "string" ? idMap.get(key) : null;
|
|
@@ -308,14 +279,14 @@ export function makeClientTreeDataSource(p) {
|
|
|
308
279
|
d[source] = next;
|
|
309
280
|
}
|
|
310
281
|
}
|
|
311
|
-
|
|
312
|
-
|
|
282
|
+
data.set([...d]);
|
|
283
|
+
snapshot.set((prev) => prev + 1);
|
|
313
284
|
grid.state.rowDataStore.rowClearCache();
|
|
314
285
|
};
|
|
315
286
|
const rowToIndex = (rowId) => {
|
|
316
|
-
const f =
|
|
317
|
-
const top =
|
|
318
|
-
const bot =
|
|
287
|
+
const f = peek(flat);
|
|
288
|
+
const top = peek(topNodes);
|
|
289
|
+
const bot = peek(botNodes);
|
|
319
290
|
const topCount = top.length;
|
|
320
291
|
const center = f.flat.length;
|
|
321
292
|
const rowIndex = f.idToIndexMap.get(rowId);
|
|
@@ -332,7 +303,7 @@ export function makeClientTreeDataSource(p) {
|
|
|
332
303
|
return null;
|
|
333
304
|
};
|
|
334
305
|
const rowAllChildIds = (rowId) => {
|
|
335
|
-
const t =
|
|
306
|
+
const t = peek(tree);
|
|
336
307
|
const ids = [];
|
|
337
308
|
const node = t.idToNode.get(rowId);
|
|
338
309
|
if (node?.kind === 2) {
|
|
@@ -350,10 +321,10 @@ export function makeClientTreeDataSource(p) {
|
|
|
350
321
|
rowAllChildIds,
|
|
351
322
|
rowUpdate,
|
|
352
323
|
inFilterItems: (c) => {
|
|
353
|
-
const grid =
|
|
324
|
+
const grid = peek(grid$);
|
|
354
325
|
if (!grid)
|
|
355
326
|
return [];
|
|
356
|
-
const data =
|
|
327
|
+
const data = peek(centerNodes);
|
|
357
328
|
const values = new Set(data.map((row) => {
|
|
358
329
|
const field = grid.api.columnField(c, row);
|
|
359
330
|
return field;
|
|
@@ -364,7 +335,7 @@ export function makeClientTreeDataSource(p) {
|
|
|
364
335
|
return [...values].map((x) => ({ id: `${x}`, label: `${x}`, value: x }));
|
|
365
336
|
},
|
|
366
337
|
rowAdd: (newRows, place = "end") => {
|
|
367
|
-
|
|
338
|
+
data.set((prev) => {
|
|
368
339
|
if (!newRows.length)
|
|
369
340
|
return prev;
|
|
370
341
|
let next;
|
|
@@ -378,7 +349,7 @@ export function makeClientTreeDataSource(p) {
|
|
|
378
349
|
}
|
|
379
350
|
return next;
|
|
380
351
|
});
|
|
381
|
-
const grid =
|
|
352
|
+
const grid = peek(grid$);
|
|
382
353
|
grid?.state.rowDataStore.rowClearCache();
|
|
383
354
|
},
|
|
384
355
|
rowDelete: (rows) => {
|
|
@@ -390,42 +361,38 @@ export function makeClientTreeDataSource(p) {
|
|
|
390
361
|
return rowById(c)?.data;
|
|
391
362
|
})
|
|
392
363
|
.filter((c) => !!c));
|
|
393
|
-
|
|
364
|
+
data.set((prev) => {
|
|
394
365
|
if (!rowData.size)
|
|
395
366
|
return prev;
|
|
396
367
|
return prev.filter((d) => !rowData.has(d));
|
|
397
368
|
});
|
|
398
|
-
const grid =
|
|
369
|
+
const grid = peek(grid$);
|
|
399
370
|
grid?.state.rowDataStore.rowClearCache();
|
|
400
371
|
},
|
|
401
372
|
rowSetBotData: (data) => {
|
|
402
|
-
|
|
403
|
-
const grid =
|
|
373
|
+
bottomData.set(data);
|
|
374
|
+
const grid = peek(grid$);
|
|
404
375
|
grid?.state.rowDataStore.rowClearCache();
|
|
405
376
|
},
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
const grid =
|
|
377
|
+
rowSetTopData: (data) => {
|
|
378
|
+
topData.set(data);
|
|
379
|
+
const grid = peek(grid$);
|
|
409
380
|
grid?.state.rowDataStore.rowClearCache();
|
|
410
381
|
},
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
const grid =
|
|
382
|
+
rowSetCenterData: (d) => {
|
|
383
|
+
data.set(d);
|
|
384
|
+
const grid = peek(grid$);
|
|
414
385
|
grid?.state.rowDataStore.rowClearCache();
|
|
415
386
|
},
|
|
416
387
|
rowExpand: (expansions) => {
|
|
417
|
-
const grid =
|
|
388
|
+
const grid = peek(grid$);
|
|
418
389
|
if (!grid)
|
|
419
390
|
return;
|
|
420
|
-
|
|
421
|
-
if (mode)
|
|
422
|
-
grid.state.columnPivotRowGroupExpansions.set((prev) => ({ ...prev, ...expansions }));
|
|
423
|
-
else
|
|
424
|
-
grid.state.rowGroupExpansions.set((prev) => ({ ...prev, ...expansions }));
|
|
391
|
+
grid.state.rowGroupExpansions.set((prev) => ({ ...prev, ...expansions }));
|
|
425
392
|
},
|
|
426
393
|
rowToIndex,
|
|
427
394
|
rowSelect: (params) => {
|
|
428
|
-
const grid =
|
|
395
|
+
const grid = peek(grid$);
|
|
429
396
|
if (!grid)
|
|
430
397
|
return;
|
|
431
398
|
if (params.mode === "none")
|
|
@@ -476,31 +443,31 @@ export function makeClientTreeDataSource(p) {
|
|
|
476
443
|
}
|
|
477
444
|
},
|
|
478
445
|
rowSelectAll: (params) => {
|
|
479
|
-
const grid =
|
|
446
|
+
const grid = peek(grid$);
|
|
480
447
|
if (!grid)
|
|
481
448
|
return;
|
|
482
449
|
if (params.deselect) {
|
|
483
450
|
grid.state.rowSelectedIds.set(new Set());
|
|
484
451
|
return;
|
|
485
452
|
}
|
|
486
|
-
const t =
|
|
453
|
+
const t = peek(tree);
|
|
487
454
|
grid.state.rowSelectedIds.set(new Set(t.idsAll));
|
|
488
455
|
},
|
|
489
456
|
rowData: (section) => {
|
|
490
457
|
const d = [];
|
|
491
458
|
if (section === "top" || section === "flat") {
|
|
492
|
-
d.push(...
|
|
459
|
+
d.push(...peek(topData));
|
|
493
460
|
}
|
|
494
461
|
if (section === "center" || section === "flat") {
|
|
495
|
-
d.push(...
|
|
462
|
+
d.push(...peek(data));
|
|
496
463
|
}
|
|
497
464
|
if (section === "bottom" || section === "flat") {
|
|
498
|
-
d.push(...
|
|
465
|
+
d.push(...peek(bottomData));
|
|
499
466
|
}
|
|
500
467
|
return d;
|
|
501
468
|
},
|
|
502
469
|
rowAreAllSelected: (rowId) => {
|
|
503
|
-
const g =
|
|
470
|
+
const g = grid$();
|
|
504
471
|
if (!g)
|
|
505
472
|
return false;
|
|
506
473
|
const selected = g.state.rowSelectedIds.get();
|
|
@@ -511,14 +478,14 @@ export function makeClientTreeDataSource(p) {
|
|
|
511
478
|
const childIds = new Set(rowAllChildIds(rowId));
|
|
512
479
|
return childIds.isSubsetOf(selected);
|
|
513
480
|
}
|
|
514
|
-
const f =
|
|
481
|
+
const f = tree();
|
|
515
482
|
return f.idsAll.isSubsetOf(selected);
|
|
516
483
|
},
|
|
517
484
|
},
|
|
518
485
|
{
|
|
519
|
-
top:
|
|
520
|
-
center:
|
|
521
|
-
bottom:
|
|
486
|
+
top: makeAtom(topData),
|
|
487
|
+
center: makeAtom(data),
|
|
488
|
+
bottom: makeAtom(bottomData),
|
|
522
489
|
},
|
|
523
490
|
];
|
|
524
491
|
}
|