@vuu-ui/vuu-data-local 2.1.18 → 2.1.19-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/package.json +10 -12
- package/cjs/array-data-source/aggregate-utils.js +0 -237
- package/cjs/array-data-source/aggregate-utils.js.map +0 -1
- package/cjs/array-data-source/array-data-source.js +0 -912
- package/cjs/array-data-source/array-data-source.js.map +0 -1
- package/cjs/array-data-source/array-data-utils.js +0 -62
- package/cjs/array-data-source/array-data-utils.js.map +0 -1
- package/cjs/array-data-source/group-utils.js +0 -187
- package/cjs/array-data-source/group-utils.js.map +0 -1
- package/cjs/array-data-source/sort-utils.js +0 -73
- package/cjs/array-data-source/sort-utils.js.map +0 -1
- package/cjs/index.js +0 -12
- package/cjs/index.js.map +0 -1
- package/cjs/json-data-source/JsonDataSource.js +0 -404
- package/cjs/json-data-source/JsonDataSource.js.map +0 -1
- package/cjs/tree-data-source/IconProvider.js +0 -28
- package/cjs/tree-data-source/IconProvider.js.map +0 -1
- package/cjs/tree-data-source/TreeDataSource.js +0 -434
- package/cjs/tree-data-source/TreeDataSource.js.map +0 -1
- package/esm/array-data-source/aggregate-utils.js +0 -235
- package/esm/array-data-source/aggregate-utils.js.map +0 -1
- package/esm/array-data-source/array-data-source.js +0 -910
- package/esm/array-data-source/array-data-source.js.map +0 -1
- package/esm/array-data-source/array-data-utils.js +0 -59
- package/esm/array-data-source/array-data-utils.js.map +0 -1
- package/esm/array-data-source/group-utils.js +0 -183
- package/esm/array-data-source/group-utils.js.map +0 -1
- package/esm/array-data-source/sort-utils.js +0 -69
- package/esm/array-data-source/sort-utils.js.map +0 -1
- package/esm/index.js +0 -4
- package/esm/index.js.map +0 -1
- package/esm/json-data-source/JsonDataSource.js +0 -402
- package/esm/json-data-source/JsonDataSource.js.map +0 -1
- package/esm/tree-data-source/IconProvider.js +0 -26
- package/esm/tree-data-source/IconProvider.js.map +0 -1
- package/esm/tree-data-source/TreeDataSource.js +0 -432
- package/esm/tree-data-source/TreeDataSource.js.map +0 -1
|
@@ -1,910 +0,0 @@
|
|
|
1
|
-
import { parseFilter, filterPredicate } from '@vuu-ui/vuu-filter-parser';
|
|
2
|
-
import { logger, EventEmitter, KeySet, NULL_RANGE, Range, uuid, buildColumnMap, withConfigDefaults, hasFilter, hasBaseFilter, hasSort, isGroupByChanged, hasGroupBy, getAddedItems, combineFilters, isConfigChanged, rangeNewItems, filterAsQuery, metadataKeys, vanillaConfig } from '@vuu-ui/vuu-utils';
|
|
3
|
-
import { aggregateData } from './aggregate-utils.js';
|
|
4
|
-
import { buildDataToClientMap, toClientRow } from './array-data-utils.js';
|
|
5
|
-
import { expandGroup, collapseGroup, groupRows } from './group-utils.js';
|
|
6
|
-
import { sortRows, sortComparator, binarySearch } from './sort-utils.js';
|
|
7
|
-
|
|
8
|
-
var __defProp = Object.defineProperty;
|
|
9
|
-
var __typeError = (msg) => {
|
|
10
|
-
throw TypeError(msg);
|
|
11
|
-
};
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
15
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
16
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
17
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
18
|
-
var _columnMap, _data, _freezeTimestamp, _keys, _links, _range, _status, _title;
|
|
19
|
-
const { debug, info } = logger("ArrayDataSource");
|
|
20
|
-
const { KEY } = metadataKeys;
|
|
21
|
-
const toDataSourceRow = (indexOfKeyColumn, index) => (data, idx) => {
|
|
22
|
-
const key = `${data[indexOfKeyColumn]}`;
|
|
23
|
-
index?.set(key, idx);
|
|
24
|
-
return [
|
|
25
|
-
idx,
|
|
26
|
-
idx,
|
|
27
|
-
true,
|
|
28
|
-
false,
|
|
29
|
-
1,
|
|
30
|
-
0,
|
|
31
|
-
key,
|
|
32
|
-
0,
|
|
33
|
-
0,
|
|
34
|
-
// ts
|
|
35
|
-
false,
|
|
36
|
-
// isNew
|
|
37
|
-
...data
|
|
38
|
-
];
|
|
39
|
-
};
|
|
40
|
-
const buildTableSchema = (columns, keyColumn) => {
|
|
41
|
-
const schema = {
|
|
42
|
-
columns: columns.map(({ name, serverDataType = "string" }) => ({
|
|
43
|
-
name,
|
|
44
|
-
serverDataType
|
|
45
|
-
})),
|
|
46
|
-
key: keyColumn ?? columns[0].name,
|
|
47
|
-
table: { module: "", table: "Array" }
|
|
48
|
-
};
|
|
49
|
-
return schema;
|
|
50
|
-
};
|
|
51
|
-
class ArrayDataSource extends EventEmitter {
|
|
52
|
-
constructor({
|
|
53
|
-
aggregations,
|
|
54
|
-
baseFilterSpec,
|
|
55
|
-
// different from RemoteDataSource
|
|
56
|
-
columnDescriptors,
|
|
57
|
-
data,
|
|
58
|
-
dataMap,
|
|
59
|
-
filterSpec,
|
|
60
|
-
groupBy,
|
|
61
|
-
keyColumn,
|
|
62
|
-
rangeChangeRowset = "delta",
|
|
63
|
-
sort,
|
|
64
|
-
title,
|
|
65
|
-
viewport
|
|
66
|
-
}) {
|
|
67
|
-
super();
|
|
68
|
-
__publicField(this, "clientCallback");
|
|
69
|
-
__publicField(this, "columnDescriptors");
|
|
70
|
-
/** sorted offsets of data within raw data, reflecting sort order
|
|
71
|
-
* of columns specified by client.
|
|
72
|
-
*/
|
|
73
|
-
__publicField(this, "dataIndices");
|
|
74
|
-
/** Map reflecting positions of data items in raw data */
|
|
75
|
-
__publicField(this, "dataMap");
|
|
76
|
-
__publicField(this, "groupMap");
|
|
77
|
-
/** the index of key field within raw data row */
|
|
78
|
-
__publicField(this, "key");
|
|
79
|
-
__publicField(this, "lastRangeServed", { from: 0, to: 0 });
|
|
80
|
-
__publicField(this, "rangeChangeRowset");
|
|
81
|
-
__publicField(this, "openTreeNodes", []);
|
|
82
|
-
// Experimental. There are some config changes - first concrete example is baseFilter applied to
|
|
83
|
-
// 'freeze' data, that should not immediately affect the displayed data, therefore not cause
|
|
84
|
-
// range reset.
|
|
85
|
-
__publicField(this, "preserveScrollPositionAcrossConfigChange", false);
|
|
86
|
-
/** Map reflecting positions of columns in client data sent to user */
|
|
87
|
-
__privateAdd(this, _columnMap);
|
|
88
|
-
__publicField(this, "_config", vanillaConfig);
|
|
89
|
-
__privateAdd(this, _data);
|
|
90
|
-
__privateAdd(this, _freezeTimestamp);
|
|
91
|
-
__privateAdd(this, _keys, new KeySet(NULL_RANGE));
|
|
92
|
-
__privateAdd(this, _links);
|
|
93
|
-
__privateAdd(this, _range, Range(0, 0));
|
|
94
|
-
__privateAdd(this, _status, "initialising");
|
|
95
|
-
__privateAdd(this, _title);
|
|
96
|
-
__publicField(this, "_menu");
|
|
97
|
-
__publicField(this, "selectedRows", /* @__PURE__ */ new Set());
|
|
98
|
-
__publicField(this, "index", /* @__PURE__ */ new Map());
|
|
99
|
-
__publicField(this, "tableSchema");
|
|
100
|
-
__publicField(this, "viewport");
|
|
101
|
-
__publicField(this, "processedData");
|
|
102
|
-
__publicField(this, "insert", (row) => {
|
|
103
|
-
const dataSourceRow = toDataSourceRow(this.key)(row, this.size);
|
|
104
|
-
__privateGet(this, _data).push(dataSourceRow);
|
|
105
|
-
const { from, to } = __privateGet(this, _range);
|
|
106
|
-
const [rowIdx] = dataSourceRow;
|
|
107
|
-
const isSorted = hasSort(this.config);
|
|
108
|
-
const isFiltered = hasFilter(this.config) || hasBaseFilter(this.config);
|
|
109
|
-
if (isSorted && isFiltered) {
|
|
110
|
-
const meetsFilterCriteria = this.getFilterPredicate();
|
|
111
|
-
if (meetsFilterCriteria(dataSourceRow)) {
|
|
112
|
-
this.insertIntoSortedData(dataSourceRow);
|
|
113
|
-
}
|
|
114
|
-
} else if (isSorted) {
|
|
115
|
-
this.insertIntoSortedData(dataSourceRow);
|
|
116
|
-
} else if (isFiltered) {
|
|
117
|
-
const meetsFilterCriteria = this.getFilterPredicate();
|
|
118
|
-
if (meetsFilterCriteria(dataSourceRow)) {
|
|
119
|
-
this.processedData?.push(dataSourceRow);
|
|
120
|
-
this.sendSizeUpdateToClient();
|
|
121
|
-
if (rowIdx >= from && rowIdx < to) {
|
|
122
|
-
this.sendRowsToClient();
|
|
123
|
-
}
|
|
124
|
-
this.emit("resize", __privateGet(this, _data).length);
|
|
125
|
-
}
|
|
126
|
-
} else {
|
|
127
|
-
this.sendSizeUpdateToClient();
|
|
128
|
-
if (rowIdx >= from && rowIdx < to) {
|
|
129
|
-
this.sendRowsToClient();
|
|
130
|
-
}
|
|
131
|
-
this.emit("resize", this.size);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
__publicField(this, "updateDataItem", (keyValue, columnName, value) => {
|
|
135
|
-
this.validateDataValue(columnName, value);
|
|
136
|
-
const colIndex = __privateGet(this, _columnMap)[columnName];
|
|
137
|
-
const dataColIndex = this.dataMap?.[columnName];
|
|
138
|
-
const dataIndex = this.indexOfRowWithKey(keyValue);
|
|
139
|
-
if (dataIndex !== -1 && dataColIndex !== void 0) {
|
|
140
|
-
const dataSourceRow = __privateGet(this, _data)[dataIndex];
|
|
141
|
-
dataSourceRow[colIndex] = value;
|
|
142
|
-
const { from, to } = __privateGet(this, _range);
|
|
143
|
-
const [rowIdx] = dataSourceRow;
|
|
144
|
-
if (rowIdx >= from && rowIdx < to) {
|
|
145
|
-
this.sendRowsToClient(false, dataSourceRow);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
__publicField(this, "indexOfRowWithKey", (key) => __privateGet(this, _data).findIndex((row) => row[KEY] === key));
|
|
150
|
-
__publicField(this, "update", (row, columnName) => {
|
|
151
|
-
const keyValue = row[this.key];
|
|
152
|
-
const dataColIndex = this.dataMap?.[columnName];
|
|
153
|
-
return this.updateDataItem(keyValue, columnName, row[dataColIndex]);
|
|
154
|
-
});
|
|
155
|
-
__publicField(this, "updateRow", (row, _columnName) => {
|
|
156
|
-
const keyValue = row[this.key];
|
|
157
|
-
const dataIndex = __privateGet(this, _data).findIndex((row2) => row2[KEY] === keyValue);
|
|
158
|
-
if (dataIndex !== -1) {
|
|
159
|
-
const dataSourceRow = toDataSourceRow(this.key)(row, dataIndex);
|
|
160
|
-
__privateGet(this, _data)[dataIndex] = dataSourceRow;
|
|
161
|
-
const { from, to } = __privateGet(this, _range);
|
|
162
|
-
const isFiltered = hasFilter(this.config) || hasBaseFilter(this.config);
|
|
163
|
-
const isSorted = hasSort(this.config);
|
|
164
|
-
if (isFiltered) {
|
|
165
|
-
const meetsFilterCriteria = this.getFilterPredicate();
|
|
166
|
-
if (meetsFilterCriteria(dataSourceRow) && this.processedData) {
|
|
167
|
-
const dataIndex2 = this.processedData.findIndex(
|
|
168
|
-
(row2) => row2[KEY] === keyValue
|
|
169
|
-
);
|
|
170
|
-
if (dataIndex2 !== -1) {
|
|
171
|
-
const existingRow = this.processedData[dataIndex2];
|
|
172
|
-
const newFilteredRow = existingRow.slice(0, 10).concat(dataSourceRow.slice(10));
|
|
173
|
-
this.processedData[dataIndex2] = newFilteredRow;
|
|
174
|
-
if (dataIndex2 >= from && dataIndex2 < to) {
|
|
175
|
-
this.sendRowsToClient(false, newFilteredRow);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
} else if (this.processedData) {
|
|
179
|
-
const dataIndex2 = this.processedData.findIndex(
|
|
180
|
-
(row2) => row2[KEY] === keyValue
|
|
181
|
-
);
|
|
182
|
-
if (dataIndex2 !== -1) {
|
|
183
|
-
console.log(`LAMF dataRow no longer in filter set`);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
} else if (isSorted) {
|
|
187
|
-
if (this.processedData) {
|
|
188
|
-
const dataIndex2 = this.processedData.findIndex(
|
|
189
|
-
(row2) => row2[KEY] === keyValue
|
|
190
|
-
);
|
|
191
|
-
if (dataIndex2 !== -1) {
|
|
192
|
-
const existingRow = this.processedData[dataIndex2];
|
|
193
|
-
const newSortedRow = existingRow.slice(0, 10).concat(dataSourceRow.slice(10));
|
|
194
|
-
this.processedData[dataIndex2] = newSortedRow;
|
|
195
|
-
if (dataIndex2 >= from && dataIndex2 < to) {
|
|
196
|
-
this.sendRowsToClient(false, newSortedRow);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
} else {
|
|
201
|
-
if (dataIndex >= from && dataIndex < to) {
|
|
202
|
-
this.sendRowsToClient(false, dataSourceRow);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
__publicField(this, "deleteRow", async (key) => {
|
|
208
|
-
const dataIndex = __privateGet(this, _data).findIndex((row) => row[KEY] === key);
|
|
209
|
-
let doomedIndex = void 0;
|
|
210
|
-
if (dataIndex !== -1) {
|
|
211
|
-
if (this.processedData) {
|
|
212
|
-
for (let i = 0; i < this.processedData.length; i++) {
|
|
213
|
-
if (this.processedData[i][KEY] === key) {
|
|
214
|
-
doomedIndex = i;
|
|
215
|
-
} else if (doomedIndex !== void 0) {
|
|
216
|
-
this.processedData[i][0] -= 1;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
if (doomedIndex !== void 0) {
|
|
220
|
-
this.processedData.splice(doomedIndex, 1);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
__privateGet(this, _data).splice(dataIndex, 1);
|
|
224
|
-
for (let i = dataIndex; i < __privateGet(this, _data).length; i++) {
|
|
225
|
-
__privateGet(this, _data)[i][0] -= 1;
|
|
226
|
-
}
|
|
227
|
-
this.sendSizeUpdateToClient();
|
|
228
|
-
const { from, to } = __privateGet(this, _range);
|
|
229
|
-
const deletedIndex = doomedIndex ?? dataIndex;
|
|
230
|
-
if (deletedIndex >= from && deletedIndex < to) {
|
|
231
|
-
__privateGet(this, _keys).reset(this.range.withBuffer);
|
|
232
|
-
this.sendRowsToClient(true);
|
|
233
|
-
}
|
|
234
|
-
this.emit("resize", this.size);
|
|
235
|
-
return true;
|
|
236
|
-
} else {
|
|
237
|
-
return "row not found";
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
if (!data || !columnDescriptors) {
|
|
241
|
-
throw Error(
|
|
242
|
-
"ArrayDataSource constructor called without data or without columnDescriptors"
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
this.columnDescriptors = columnDescriptors;
|
|
246
|
-
this.dataMap = dataMap;
|
|
247
|
-
this.key = keyColumn ? this.columnDescriptors.findIndex((col) => col.name === keyColumn) : 0;
|
|
248
|
-
this.rangeChangeRowset = rangeChangeRowset;
|
|
249
|
-
this.tableSchema = buildTableSchema(columnDescriptors, keyColumn);
|
|
250
|
-
this.viewport = viewport || uuid();
|
|
251
|
-
__privateSet(this, _title, title);
|
|
252
|
-
const columns = columnDescriptors.map((col) => col.name);
|
|
253
|
-
__privateSet(this, _columnMap, buildColumnMap(columns));
|
|
254
|
-
this.dataIndices = buildDataToClientMap(__privateGet(this, _columnMap), this.dataMap);
|
|
255
|
-
__privateSet(this, _data, data.map(toDataSourceRow(this.key, this.index)));
|
|
256
|
-
this.config = {
|
|
257
|
-
...this._config,
|
|
258
|
-
aggregations: aggregations || this._config.aggregations,
|
|
259
|
-
baseFilterSpec,
|
|
260
|
-
columns,
|
|
261
|
-
filterSpec: filterSpec || this._config.filterSpec,
|
|
262
|
-
groupBy: groupBy || this._config.groupBy,
|
|
263
|
-
sort: sort || this._config.sort
|
|
264
|
-
};
|
|
265
|
-
debug?.(`columnMap: ${JSON.stringify(__privateGet(this, _columnMap))}`);
|
|
266
|
-
}
|
|
267
|
-
async subscribe({
|
|
268
|
-
viewport = this.viewport ?? (this.viewport = uuid()),
|
|
269
|
-
columns,
|
|
270
|
-
aggregations,
|
|
271
|
-
baseFilterSpec,
|
|
272
|
-
range,
|
|
273
|
-
sort,
|
|
274
|
-
groupBy,
|
|
275
|
-
filterSpec
|
|
276
|
-
}, callback) {
|
|
277
|
-
this.clientCallback = callback;
|
|
278
|
-
this.viewport = viewport;
|
|
279
|
-
__privateSet(this, _status, "subscribed");
|
|
280
|
-
this.lastRangeServed = { from: 0, to: 0 };
|
|
281
|
-
let config = this._config;
|
|
282
|
-
const hasConfigProps = aggregations || columns || filterSpec || groupBy || sort;
|
|
283
|
-
if (hasConfigProps) {
|
|
284
|
-
config = {
|
|
285
|
-
...config,
|
|
286
|
-
aggregations: aggregations || this._config.aggregations,
|
|
287
|
-
baseFilterSpec: baseFilterSpec || this._config.baseFilterSpec,
|
|
288
|
-
columns: columns || this._config.columns,
|
|
289
|
-
filterSpec: filterSpec || this._config.filterSpec,
|
|
290
|
-
groupBy: groupBy || this._config.groupBy,
|
|
291
|
-
sort: sort || this._config.sort
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
const subscribedMessage = {
|
|
295
|
-
...config,
|
|
296
|
-
type: "subscribed",
|
|
297
|
-
clientViewportId: this.viewport,
|
|
298
|
-
range: __privateGet(this, _range),
|
|
299
|
-
tableSchema: this.tableSchema
|
|
300
|
-
};
|
|
301
|
-
this.clientCallback?.(subscribedMessage);
|
|
302
|
-
this.emit("subscribed", subscribedMessage);
|
|
303
|
-
if (hasConfigProps) {
|
|
304
|
-
this.config = config;
|
|
305
|
-
} else {
|
|
306
|
-
this.sendSizeUpdateToClient();
|
|
307
|
-
this.emit(
|
|
308
|
-
"resize",
|
|
309
|
-
this.processedData ? this.processedData.length : __privateGet(this, _data).length
|
|
310
|
-
);
|
|
311
|
-
if (range && !__privateGet(this, _range).equals(range)) {
|
|
312
|
-
this.range = range;
|
|
313
|
-
} else if (__privateGet(this, _range) !== NULL_RANGE) {
|
|
314
|
-
this.sendRowsToClient();
|
|
315
|
-
}
|
|
316
|
-
if (this.range.to !== 0) {
|
|
317
|
-
const pageCount = Math.ceil(
|
|
318
|
-
this.size / (this.range.to - this.range.from)
|
|
319
|
-
);
|
|
320
|
-
this.emit("page-count", pageCount);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
unsubscribe() {
|
|
325
|
-
__privateSet(this, _status, "unsubscribed");
|
|
326
|
-
this.emit("unsubscribed", this.viewport);
|
|
327
|
-
this.removeAllListeners();
|
|
328
|
-
this.clientCallback = void 0;
|
|
329
|
-
}
|
|
330
|
-
suspend() {
|
|
331
|
-
console.log(`[ArrayDataSource] suspend`);
|
|
332
|
-
if (__privateGet(this, _status) !== "unsubscribed") {
|
|
333
|
-
info?.(`suspend #${this.viewport}, current status ${__privateGet(this, _status)}`);
|
|
334
|
-
__privateSet(this, _status, "suspended");
|
|
335
|
-
this.emit("suspended", this.viewport);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
resume(callback) {
|
|
339
|
-
const isSuspended = __privateGet(this, _status) === "suspended";
|
|
340
|
-
info?.(`resume #${this.viewport}, current status ${__privateGet(this, _status)}`);
|
|
341
|
-
if (callback) {
|
|
342
|
-
this.clientCallback = callback;
|
|
343
|
-
}
|
|
344
|
-
if (isSuspended) {
|
|
345
|
-
__privateSet(this, _status, "subscribed");
|
|
346
|
-
}
|
|
347
|
-
this.emit("resumed", this.viewport);
|
|
348
|
-
if (this.selectedRows.size > 0) {
|
|
349
|
-
if (this.selectedRows.has("*")) {
|
|
350
|
-
this.emit("row-selection", this.size);
|
|
351
|
-
} else {
|
|
352
|
-
this.emit("row-selection", this.selectedRows.size);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
this.sendRowsToClient(true);
|
|
356
|
-
}
|
|
357
|
-
disable() {
|
|
358
|
-
this.emit("disabled", this.viewport);
|
|
359
|
-
}
|
|
360
|
-
enable() {
|
|
361
|
-
this.emit("enabled", this.viewport);
|
|
362
|
-
}
|
|
363
|
-
select(selectRequest) {
|
|
364
|
-
switch (selectRequest.type) {
|
|
365
|
-
case "SELECT_ROW": {
|
|
366
|
-
const { preserveExistingSelection, rowKey } = selectRequest;
|
|
367
|
-
if (!preserveExistingSelection) {
|
|
368
|
-
this.selectedRows.clear();
|
|
369
|
-
}
|
|
370
|
-
this.selectedRows.add(rowKey);
|
|
371
|
-
break;
|
|
372
|
-
}
|
|
373
|
-
case "DESELECT_ROW": {
|
|
374
|
-
const { preserveExistingSelection, rowKey } = selectRequest;
|
|
375
|
-
if (!preserveExistingSelection) {
|
|
376
|
-
this.selectedRows.clear();
|
|
377
|
-
} else if (this.selectedRows.has("*")) {
|
|
378
|
-
this.selectedRows.clear();
|
|
379
|
-
for (const key of this.index.keys()) {
|
|
380
|
-
if (key !== rowKey) {
|
|
381
|
-
this.selectedRows.add(key);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
} else {
|
|
385
|
-
this.selectedRows.delete(rowKey);
|
|
386
|
-
}
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
case "SELECT_ROW_RANGE": {
|
|
390
|
-
const { preserveExistingSelection, fromRowKey, toRowKey } = selectRequest;
|
|
391
|
-
if (!preserveExistingSelection) {
|
|
392
|
-
this.selectedRows.clear();
|
|
393
|
-
}
|
|
394
|
-
const fromIdx = this.index.get(fromRowKey);
|
|
395
|
-
const toIdx = this.index.get(toRowKey);
|
|
396
|
-
if (typeof fromIdx === "number" && typeof toIdx === "number") {
|
|
397
|
-
for (let i = fromIdx; i <= toIdx; i++) {
|
|
398
|
-
const { [KEY]: rowKey } = __privateGet(this, _data)[i];
|
|
399
|
-
this.selectedRows.add(rowKey);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
break;
|
|
403
|
-
}
|
|
404
|
-
case "SELECT_ALL": {
|
|
405
|
-
this.selectedRows.clear();
|
|
406
|
-
this.selectedRows.add("*");
|
|
407
|
-
break;
|
|
408
|
-
}
|
|
409
|
-
case "DESELECT_ALL": {
|
|
410
|
-
this.selectedRows.clear();
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
this.setRange(__privateGet(this, _range), true);
|
|
415
|
-
this.emit(
|
|
416
|
-
"row-selection",
|
|
417
|
-
selectRequest.type === "SELECT_ALL" ? this.size : this.selectedRows.size
|
|
418
|
-
);
|
|
419
|
-
}
|
|
420
|
-
getRowKey(keyOrIndex) {
|
|
421
|
-
if (typeof keyOrIndex === "string") {
|
|
422
|
-
return keyOrIndex;
|
|
423
|
-
}
|
|
424
|
-
const row = this.getRowAtIndex(keyOrIndex);
|
|
425
|
-
if (row === void 0) {
|
|
426
|
-
throw Error(`row not found at index ${keyOrIndex}`);
|
|
427
|
-
}
|
|
428
|
-
return row?.[KEY];
|
|
429
|
-
}
|
|
430
|
-
openTreeNode(keyOrIndex) {
|
|
431
|
-
const key = this.getRowKey(keyOrIndex);
|
|
432
|
-
this.openTreeNodes.push(key);
|
|
433
|
-
this.processedData = expandGroup(
|
|
434
|
-
this.openTreeNodes,
|
|
435
|
-
__privateGet(this, _data),
|
|
436
|
-
this._config.groupBy,
|
|
437
|
-
__privateGet(this, _columnMap),
|
|
438
|
-
this.groupMap,
|
|
439
|
-
this.processedData
|
|
440
|
-
);
|
|
441
|
-
this.setRange(__privateGet(this, _range).reset, true);
|
|
442
|
-
}
|
|
443
|
-
closeTreeNode(keyOrIndex) {
|
|
444
|
-
const key = this.getRowKey(keyOrIndex);
|
|
445
|
-
this.openTreeNodes = this.openTreeNodes.filter((value) => value !== key);
|
|
446
|
-
if (this.processedData) {
|
|
447
|
-
this.processedData = collapseGroup(key, this.processedData);
|
|
448
|
-
this.setRange(__privateGet(this, _range).reset, true);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
get pageSize() {
|
|
452
|
-
return __privateGet(this, _range).to - __privateGet(this, _range).from;
|
|
453
|
-
}
|
|
454
|
-
get links() {
|
|
455
|
-
return __privateGet(this, _links);
|
|
456
|
-
}
|
|
457
|
-
set links(links) {
|
|
458
|
-
__privateSet(this, _links, links);
|
|
459
|
-
if (links) {
|
|
460
|
-
this._clientCallback?.({
|
|
461
|
-
clientViewportId: this.viewport,
|
|
462
|
-
type: "vuu-links",
|
|
463
|
-
links
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
get menu() {
|
|
468
|
-
return this._menu;
|
|
469
|
-
}
|
|
470
|
-
get status() {
|
|
471
|
-
return __privateGet(this, _status);
|
|
472
|
-
}
|
|
473
|
-
get data() {
|
|
474
|
-
return __privateGet(this, _data);
|
|
475
|
-
}
|
|
476
|
-
// Only used by the UpdateGenerator
|
|
477
|
-
get currentData() {
|
|
478
|
-
return this.processedData ?? __privateGet(this, _data);
|
|
479
|
-
}
|
|
480
|
-
get table() {
|
|
481
|
-
return this.tableSchema.table;
|
|
482
|
-
}
|
|
483
|
-
get columns() {
|
|
484
|
-
return this._config.columns;
|
|
485
|
-
}
|
|
486
|
-
set columns(columns) {
|
|
487
|
-
}
|
|
488
|
-
get config() {
|
|
489
|
-
return this._config;
|
|
490
|
-
}
|
|
491
|
-
set config(config) {
|
|
492
|
-
const originalConfig = this._config;
|
|
493
|
-
const configChanges = this.applyConfig(config);
|
|
494
|
-
if (configChanges) {
|
|
495
|
-
if (config) {
|
|
496
|
-
const newConfig = config?.filterSpec?.filter && config?.filterSpec.filterStruct === void 0 ? {
|
|
497
|
-
...config,
|
|
498
|
-
filterSpec: {
|
|
499
|
-
filter: config.filterSpec.filter,
|
|
500
|
-
filterStruct: parseFilter(config.filterSpec.filter)
|
|
501
|
-
}
|
|
502
|
-
} : config;
|
|
503
|
-
this._config = withConfigDefaults(newConfig);
|
|
504
|
-
let processedData;
|
|
505
|
-
if (hasFilter(config) || hasBaseFilter(config)) {
|
|
506
|
-
const fn = this.getFilterPredicate();
|
|
507
|
-
processedData = __privateGet(this, _data).filter(fn);
|
|
508
|
-
}
|
|
509
|
-
if (configChanges.columnsChanged) {
|
|
510
|
-
this.processNewColumns(originalConfig.columns, config.columns);
|
|
511
|
-
}
|
|
512
|
-
if (hasSort(config)) {
|
|
513
|
-
processedData = sortRows(
|
|
514
|
-
processedData ?? __privateGet(this, _data),
|
|
515
|
-
config.sort,
|
|
516
|
-
__privateGet(this, _columnMap)
|
|
517
|
-
);
|
|
518
|
-
}
|
|
519
|
-
if (this.openTreeNodes.length > 0 && isGroupByChanged(originalConfig, config)) {
|
|
520
|
-
if (this._config.groupBy.length === 0) {
|
|
521
|
-
this.openTreeNodes.length = 0;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
if (hasGroupBy(config)) {
|
|
525
|
-
const [groupedData, groupMap] = groupRows(
|
|
526
|
-
processedData ?? __privateGet(this, _data),
|
|
527
|
-
config.groupBy,
|
|
528
|
-
__privateGet(this, _columnMap)
|
|
529
|
-
);
|
|
530
|
-
this.groupMap = groupMap;
|
|
531
|
-
processedData = groupedData;
|
|
532
|
-
if (this.openTreeNodes.length > 0) {
|
|
533
|
-
processedData = expandGroup(
|
|
534
|
-
this.openTreeNodes,
|
|
535
|
-
__privateGet(this, _data),
|
|
536
|
-
this._config.groupBy,
|
|
537
|
-
__privateGet(this, _columnMap),
|
|
538
|
-
this.groupMap,
|
|
539
|
-
processedData
|
|
540
|
-
);
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
if (processedData) {
|
|
544
|
-
this.processedData = this.indexProcessedData(processedData);
|
|
545
|
-
} else {
|
|
546
|
-
this.processedData = void 0;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
if (configChanges.filterChanged || configChanges.baseFilterChanged || configChanges.groupByChanged) {
|
|
550
|
-
requestAnimationFrame(() => {
|
|
551
|
-
this.emit("resize", this.size);
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
if (__privateGet(this, _status) === "subscribed") {
|
|
555
|
-
requestAnimationFrame(() => {
|
|
556
|
-
this.sendSizeUpdateToClient();
|
|
557
|
-
if (this.preserveScrollPositionAcrossConfigChange) {
|
|
558
|
-
this.preserveScrollPositionAcrossConfigChange = false;
|
|
559
|
-
} else {
|
|
560
|
-
this.setRange(__privateGet(this, _range).reset, true);
|
|
561
|
-
}
|
|
562
|
-
this.emit(
|
|
563
|
-
"config",
|
|
564
|
-
this._config,
|
|
565
|
-
this.range,
|
|
566
|
-
void 0,
|
|
567
|
-
configChanges
|
|
568
|
-
);
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
processNewColumns(originalColumns, columns) {
|
|
574
|
-
const addedColumns = getAddedItems(originalColumns, columns);
|
|
575
|
-
if (addedColumns.length > 0) ;
|
|
576
|
-
__privateSet(this, _columnMap, buildColumnMap(columns));
|
|
577
|
-
this.dataIndices = buildDataToClientMap(__privateGet(this, _columnMap), this.dataMap);
|
|
578
|
-
}
|
|
579
|
-
indexProcessedData(data) {
|
|
580
|
-
return data?.map((row, i) => {
|
|
581
|
-
const dolly = row.slice();
|
|
582
|
-
dolly[0] = i;
|
|
583
|
-
dolly[1] = i;
|
|
584
|
-
return dolly;
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
getFilterPredicate() {
|
|
588
|
-
const {
|
|
589
|
-
filterSpec: { filterStruct }
|
|
590
|
-
} = combineFilters(this._config);
|
|
591
|
-
if (filterStruct) {
|
|
592
|
-
return filterPredicate(__privateGet(this, _columnMap), filterStruct);
|
|
593
|
-
} else {
|
|
594
|
-
throw Error("filter must include filterStruct");
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
applyConfig(config, preserveExistingConfigAttributes = false) {
|
|
598
|
-
const { noChanges, ...otherChanges } = isConfigChanged(
|
|
599
|
-
this._config,
|
|
600
|
-
config
|
|
601
|
-
);
|
|
602
|
-
if (noChanges !== true) {
|
|
603
|
-
if (config) {
|
|
604
|
-
const newConfig = config?.filterSpec?.filter && config?.filterSpec.filterStruct === void 0 ? {
|
|
605
|
-
...config,
|
|
606
|
-
filterSpec: {
|
|
607
|
-
filter: config.filterSpec.filter,
|
|
608
|
-
filterStruct: parseFilter(config.filterSpec.filter)
|
|
609
|
-
}
|
|
610
|
-
} : config;
|
|
611
|
-
if (preserveExistingConfigAttributes) {
|
|
612
|
-
this._config = {
|
|
613
|
-
...this._config,
|
|
614
|
-
...config
|
|
615
|
-
};
|
|
616
|
-
} else {
|
|
617
|
-
this._config = withConfigDefaults(newConfig);
|
|
618
|
-
}
|
|
619
|
-
return otherChanges;
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
get columnMap() {
|
|
624
|
-
return __privateGet(this, _columnMap);
|
|
625
|
-
}
|
|
626
|
-
get selectedRowsCount() {
|
|
627
|
-
return this.selectedRows.size;
|
|
628
|
-
}
|
|
629
|
-
get size() {
|
|
630
|
-
return this.processedData?.length ?? __privateGet(this, _data).length;
|
|
631
|
-
}
|
|
632
|
-
get range() {
|
|
633
|
-
return __privateGet(this, _range);
|
|
634
|
-
}
|
|
635
|
-
set range(range) {
|
|
636
|
-
this.setRange(range);
|
|
637
|
-
}
|
|
638
|
-
delete(row) {
|
|
639
|
-
console.log(`delete row ${row.join(",")}`);
|
|
640
|
-
}
|
|
641
|
-
insertIntoSortedData(row) {
|
|
642
|
-
const indexedSortDefs = this.config.sort.sortDefs.map(
|
|
643
|
-
({ column, sortType }) => [this.columnMap[column], sortType]
|
|
644
|
-
);
|
|
645
|
-
const comparator = sortComparator(indexedSortDefs);
|
|
646
|
-
const insertPos = binarySearch(
|
|
647
|
-
this.processedData,
|
|
648
|
-
row,
|
|
649
|
-
comparator
|
|
650
|
-
);
|
|
651
|
-
this.sendSizeUpdateToClient();
|
|
652
|
-
if (insertPos === -1) {
|
|
653
|
-
this.processedData?.unshift(row);
|
|
654
|
-
if (this.processedData) {
|
|
655
|
-
this.processedData = this.indexProcessedData(this.processedData);
|
|
656
|
-
}
|
|
657
|
-
if (insertPos <= __privateGet(this, _range).to) {
|
|
658
|
-
this.sendRowsToClient(true);
|
|
659
|
-
}
|
|
660
|
-
if (this.processedData) {
|
|
661
|
-
this.emit("resize", this.processedData.length);
|
|
662
|
-
}
|
|
663
|
-
} else {
|
|
664
|
-
if (this.processedData) {
|
|
665
|
-
this.emit("resize", this.processedData.length);
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
validateDataValue(columnName, value) {
|
|
670
|
-
const columnDescriptor = this.columnDescriptors.find(
|
|
671
|
-
(col) => col.name === columnName
|
|
672
|
-
);
|
|
673
|
-
if (columnDescriptor) {
|
|
674
|
-
switch (columnDescriptor.serverDataType) {
|
|
675
|
-
case "int":
|
|
676
|
-
{
|
|
677
|
-
if (typeof value === "number") {
|
|
678
|
-
if (Math.floor(value) !== value) {
|
|
679
|
-
throw Error(`${columnName} is int but value = ${value}`);
|
|
680
|
-
}
|
|
681
|
-
} else if (typeof value === "string") {
|
|
682
|
-
const numericValue = parseFloat(value);
|
|
683
|
-
if (Math.floor(numericValue) !== numericValue) {
|
|
684
|
-
throw Error(`${columnName} is ${value} is not a valid integer`);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
break;
|
|
689
|
-
}
|
|
690
|
-
} else {
|
|
691
|
-
throw Error(`Unknown column ${columnName}`);
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
getRowByKey(key) {
|
|
695
|
-
const data = this.processedData ?? __privateGet(this, _data);
|
|
696
|
-
return data.find((row) => row[KEY] === key);
|
|
697
|
-
}
|
|
698
|
-
getRowAtIndex(rowIndex) {
|
|
699
|
-
return (this.processedData ?? __privateGet(this, _data))[rowIndex];
|
|
700
|
-
}
|
|
701
|
-
setRange(range, forceFullRefresh = false) {
|
|
702
|
-
if (range.from !== __privateGet(this, _range).from || range.to !== __privateGet(this, _range).to) {
|
|
703
|
-
const currentPageCount = Math.ceil(
|
|
704
|
-
this.size / (__privateGet(this, _range).to - __privateGet(this, _range).from)
|
|
705
|
-
);
|
|
706
|
-
const newPageCount = Math.ceil(this.size / (range.to - range.from));
|
|
707
|
-
__privateSet(this, _range, range);
|
|
708
|
-
const keysResequenced = __privateGet(this, _keys).reset(range.withBuffer);
|
|
709
|
-
this.sendRowsToClient(forceFullRefresh || keysResequenced);
|
|
710
|
-
requestAnimationFrame(() => {
|
|
711
|
-
if (newPageCount !== currentPageCount) {
|
|
712
|
-
this.emit("page-count", newPageCount);
|
|
713
|
-
}
|
|
714
|
-
this.emit("range", range);
|
|
715
|
-
});
|
|
716
|
-
} else if (forceFullRefresh) {
|
|
717
|
-
this.sendRowsToClient(forceFullRefresh);
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
sendSizeUpdateToClient() {
|
|
721
|
-
this.clientCallback?.({
|
|
722
|
-
clientViewportId: this.viewport,
|
|
723
|
-
mode: "size-only",
|
|
724
|
-
type: "viewport-update",
|
|
725
|
-
size: this.processedData ? this.processedData.length : __privateGet(this, _data).length
|
|
726
|
-
});
|
|
727
|
-
}
|
|
728
|
-
sendRowsToClient(forceFullRefresh = false, row) {
|
|
729
|
-
if (row) {
|
|
730
|
-
this.clientCallback?.({
|
|
731
|
-
clientViewportId: this.viewport,
|
|
732
|
-
mode: "update",
|
|
733
|
-
rows: [
|
|
734
|
-
toClientRow(row, __privateGet(this, _keys), this.selectedRows, this.dataIndices)
|
|
735
|
-
],
|
|
736
|
-
type: "viewport-update"
|
|
737
|
-
});
|
|
738
|
-
} else {
|
|
739
|
-
const rowRange = this.rangeChangeRowset === "delta" && !forceFullRefresh ? rangeNewItems(this.lastRangeServed, __privateGet(this, _range).withBuffer) : __privateGet(this, _range).withBuffer;
|
|
740
|
-
const data = this.processedData ?? __privateGet(this, _data);
|
|
741
|
-
const rowsWithinViewport = data.slice(rowRange.from, rowRange.to).map(
|
|
742
|
-
(row2) => toClientRow(row2, __privateGet(this, _keys), this.selectedRows, this.dataIndices)
|
|
743
|
-
);
|
|
744
|
-
this.clientCallback?.({
|
|
745
|
-
clientViewportId: this.viewport,
|
|
746
|
-
mode: "batch",
|
|
747
|
-
range: __privateGet(this, _range),
|
|
748
|
-
rows: rowsWithinViewport,
|
|
749
|
-
size: data.length,
|
|
750
|
-
type: "viewport-update"
|
|
751
|
-
});
|
|
752
|
-
this.lastRangeServed = {
|
|
753
|
-
from: __privateGet(this, _range).from,
|
|
754
|
-
// to: this.#range.to,
|
|
755
|
-
to: Math.min(
|
|
756
|
-
__privateGet(this, _range).to,
|
|
757
|
-
__privateGet(this, _range).from + rowsWithinViewport.length
|
|
758
|
-
)
|
|
759
|
-
};
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
get aggregations() {
|
|
763
|
-
return this._config.aggregations;
|
|
764
|
-
}
|
|
765
|
-
set aggregations(aggregations) {
|
|
766
|
-
this._config = {
|
|
767
|
-
...this._config,
|
|
768
|
-
aggregations
|
|
769
|
-
};
|
|
770
|
-
const targetData = this.processedData ?? __privateGet(this, _data);
|
|
771
|
-
const leafData = __privateGet(this, _data);
|
|
772
|
-
aggregateData(
|
|
773
|
-
aggregations,
|
|
774
|
-
targetData,
|
|
775
|
-
this._config.groupBy,
|
|
776
|
-
leafData,
|
|
777
|
-
__privateGet(this, _columnMap),
|
|
778
|
-
this.groupMap
|
|
779
|
-
);
|
|
780
|
-
this.setRange(__privateGet(this, _range).reset, true);
|
|
781
|
-
this.emit("config", this._config, this.range);
|
|
782
|
-
}
|
|
783
|
-
get sort() {
|
|
784
|
-
return this._config.sort;
|
|
785
|
-
}
|
|
786
|
-
set sort(sort) {
|
|
787
|
-
debug?.(`sort ${JSON.stringify(sort)}`);
|
|
788
|
-
this.config = {
|
|
789
|
-
...this._config,
|
|
790
|
-
sort
|
|
791
|
-
};
|
|
792
|
-
}
|
|
793
|
-
get baseFilter() {
|
|
794
|
-
return this._config.baseFilterSpec;
|
|
795
|
-
}
|
|
796
|
-
set baseFilter(baseFilter) {
|
|
797
|
-
debug?.(`baseFilter ${JSON.stringify(baseFilter)}`);
|
|
798
|
-
this.config = {
|
|
799
|
-
...this._config,
|
|
800
|
-
baseFilterSpec: baseFilter
|
|
801
|
-
};
|
|
802
|
-
}
|
|
803
|
-
get filter() {
|
|
804
|
-
return this._config.filterSpec;
|
|
805
|
-
}
|
|
806
|
-
set filter(filter) {
|
|
807
|
-
debug?.(`filter ${JSON.stringify(filter)}`);
|
|
808
|
-
this.config = {
|
|
809
|
-
...this._config,
|
|
810
|
-
filterSpec: filter
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
setFilter(filter) {
|
|
814
|
-
const dataSourceFilter = {
|
|
815
|
-
filter: filterAsQuery(filter),
|
|
816
|
-
filterStruct: filter
|
|
817
|
-
};
|
|
818
|
-
this.filter = dataSourceFilter;
|
|
819
|
-
}
|
|
820
|
-
clearFilter() {
|
|
821
|
-
this.filter = { filter: "" };
|
|
822
|
-
}
|
|
823
|
-
get groupBy() {
|
|
824
|
-
return this._config.groupBy;
|
|
825
|
-
}
|
|
826
|
-
set groupBy(groupBy) {
|
|
827
|
-
this.config = {
|
|
828
|
-
...this._config,
|
|
829
|
-
groupBy
|
|
830
|
-
};
|
|
831
|
-
}
|
|
832
|
-
get title() {
|
|
833
|
-
return __privateGet(this, _title) ?? `${this.table.module} ${this.table.table}`;
|
|
834
|
-
}
|
|
835
|
-
set title(title) {
|
|
836
|
-
__privateSet(this, _title, title);
|
|
837
|
-
this.emit("title-changed", this.viewport, title);
|
|
838
|
-
}
|
|
839
|
-
get _clientCallback() {
|
|
840
|
-
return this.clientCallback;
|
|
841
|
-
}
|
|
842
|
-
createLink({
|
|
843
|
-
parentVpId,
|
|
844
|
-
link: { fromColumn, toColumn }
|
|
845
|
-
}) {
|
|
846
|
-
console.log("create link", {
|
|
847
|
-
parentVpId,
|
|
848
|
-
fromColumn,
|
|
849
|
-
toColumn
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
|
-
removeLink() {
|
|
853
|
-
console.log("remove link");
|
|
854
|
-
}
|
|
855
|
-
async remoteProcedureCall() {
|
|
856
|
-
return Promise.reject();
|
|
857
|
-
}
|
|
858
|
-
async menuRpcCall(rpcRequest) {
|
|
859
|
-
console.log({ rpcRequest });
|
|
860
|
-
return new Promise(() => {
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
// All in BaseDataSource
|
|
864
|
-
freeze() {
|
|
865
|
-
if (!this.isFrozen) {
|
|
866
|
-
__privateSet(this, _freezeTimestamp, (/* @__PURE__ */ new Date()).getTime());
|
|
867
|
-
this.emit("freeze", true, __privateGet(this, _freezeTimestamp));
|
|
868
|
-
this.preserveScrollPositionAcrossConfigChange = true;
|
|
869
|
-
this.baseFilter = {
|
|
870
|
-
filter: `vuuCreatedTimestamp < ${__privateGet(this, _freezeTimestamp)}`
|
|
871
|
-
};
|
|
872
|
-
} else {
|
|
873
|
-
throw Error(
|
|
874
|
-
"[BaseDataSource] cannot freeze, dataSource is already frozen"
|
|
875
|
-
);
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
unfreeze() {
|
|
879
|
-
if (this.isFrozen) {
|
|
880
|
-
const freezeTimestamp = __privateGet(this, _freezeTimestamp);
|
|
881
|
-
__privateSet(this, _freezeTimestamp, void 0);
|
|
882
|
-
this.emit("freeze", false, freezeTimestamp);
|
|
883
|
-
this.preserveScrollPositionAcrossConfigChange = true;
|
|
884
|
-
this.baseFilter = {
|
|
885
|
-
filter: ""
|
|
886
|
-
};
|
|
887
|
-
} else {
|
|
888
|
-
throw Error(
|
|
889
|
-
"[BaseDataSource] cannot freeze, dataSource is already frozen"
|
|
890
|
-
);
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
get freezeTimestamp() {
|
|
894
|
-
return __privateGet(this, _freezeTimestamp);
|
|
895
|
-
}
|
|
896
|
-
get isFrozen() {
|
|
897
|
-
return typeof __privateGet(this, _freezeTimestamp) === "number";
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
_columnMap = new WeakMap();
|
|
901
|
-
_data = new WeakMap();
|
|
902
|
-
_freezeTimestamp = new WeakMap();
|
|
903
|
-
_keys = new WeakMap();
|
|
904
|
-
_links = new WeakMap();
|
|
905
|
-
_range = new WeakMap();
|
|
906
|
-
_status = new WeakMap();
|
|
907
|
-
_title = new WeakMap();
|
|
908
|
-
|
|
909
|
-
export { ArrayDataSource };
|
|
910
|
-
//# sourceMappingURL=array-data-source.js.map
|