@toolbox-web/grid 1.3.0 → 1.3.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/all.js +469 -444
- package/all.js.map +1 -1
- package/index.js +242 -240
- package/index.js.map +1 -1
- package/lib/core/types.d.ts +4 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +18 -16
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +43 -41
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +24 -22
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.js +48 -46
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +22 -20
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +160 -125
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +20 -18
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +66 -64
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +51 -49
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +17 -15
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +24 -22
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +25 -23
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +49 -47
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js +24 -22
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +19 -17
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +38 -36
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +41 -39
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +34 -32
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +25 -23
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +22 -20
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +21 -19
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +19 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +9 -9
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const c = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', d = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -6,9 +6,11 @@ const a = {
|
|
|
6
6
|
sortNone: "⇅",
|
|
7
7
|
submenuArrow: "▶",
|
|
8
8
|
dragHandle: "⋮⋮",
|
|
9
|
-
toolPanel: "☰"
|
|
9
|
+
toolPanel: "☰",
|
|
10
|
+
filter: c,
|
|
11
|
+
filterActive: c
|
|
10
12
|
};
|
|
11
|
-
class
|
|
13
|
+
class u {
|
|
12
14
|
/**
|
|
13
15
|
* Plugin dependencies - declare other plugins this one requires.
|
|
14
16
|
*
|
|
@@ -232,7 +234,7 @@ class d {
|
|
|
232
234
|
*/
|
|
233
235
|
get gridIcons() {
|
|
234
236
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
235
|
-
return { ...
|
|
237
|
+
return { ...d, ...e };
|
|
236
238
|
}
|
|
237
239
|
// #region Animation Helpers
|
|
238
240
|
/**
|
|
@@ -311,35 +313,35 @@ class d {
|
|
|
311
313
|
function l(s, e) {
|
|
312
314
|
return Math.floor(s / e);
|
|
313
315
|
}
|
|
314
|
-
function
|
|
316
|
+
function h(s, e) {
|
|
315
317
|
return {
|
|
316
318
|
start: s * e,
|
|
317
319
|
end: (s + 1) * e
|
|
318
320
|
};
|
|
319
321
|
}
|
|
320
|
-
function
|
|
321
|
-
const o = l(s, t),
|
|
322
|
-
for (let n = o; n <=
|
|
323
|
-
|
|
324
|
-
return
|
|
322
|
+
function g(s, e, t) {
|
|
323
|
+
const o = l(s, t), r = l(e - 1, t), i = [];
|
|
324
|
+
for (let n = o; n <= r; n++)
|
|
325
|
+
i.push(n);
|
|
326
|
+
return i;
|
|
325
327
|
}
|
|
326
|
-
async function
|
|
327
|
-
const
|
|
328
|
+
async function a(s, e, t, o) {
|
|
329
|
+
const r = h(e, t);
|
|
328
330
|
return s.getRows({
|
|
329
|
-
startRow:
|
|
330
|
-
endRow:
|
|
331
|
+
startRow: r.start,
|
|
332
|
+
endRow: r.end,
|
|
331
333
|
sortModel: o.sortModel,
|
|
332
334
|
filterModel: o.filterModel
|
|
333
335
|
});
|
|
334
336
|
}
|
|
335
|
-
function
|
|
336
|
-
const o = l(s, e),
|
|
337
|
-
if (!
|
|
338
|
-
const
|
|
339
|
-
return i
|
|
337
|
+
function f(s, e, t) {
|
|
338
|
+
const o = l(s, e), r = t.get(o);
|
|
339
|
+
if (!r) return;
|
|
340
|
+
const i = s % e;
|
|
341
|
+
return r[i];
|
|
340
342
|
}
|
|
341
|
-
const
|
|
342
|
-
class
|
|
343
|
+
const R = 100;
|
|
344
|
+
class k extends u {
|
|
343
345
|
/** @internal */
|
|
344
346
|
name = "serverSide";
|
|
345
347
|
/** @internal */
|
|
@@ -370,15 +372,15 @@ class R extends d {
|
|
|
370
372
|
*/
|
|
371
373
|
loadRequiredBlocks() {
|
|
372
374
|
if (!this.dataSource) return;
|
|
373
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, o = { startRow: e._virtualization.start, endRow: e._virtualization.end },
|
|
374
|
-
for (const
|
|
375
|
-
if (!(this.loadedBlocks.has(
|
|
375
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, o = { startRow: e._virtualization.start, endRow: e._virtualization.end }, r = g(o.startRow, o.endRow, t);
|
|
376
|
+
for (const i of r)
|
|
377
|
+
if (!(this.loadedBlocks.has(i) || this.loadingBlocks.has(i))) {
|
|
376
378
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
377
379
|
break;
|
|
378
|
-
this.loadingBlocks.add(
|
|
379
|
-
this.loadedBlocks.set(
|
|
380
|
+
this.loadingBlocks.add(i), a(this.dataSource, i, t, {}).then((n) => {
|
|
381
|
+
this.loadedBlocks.set(i, n.rows), this.totalRowCount = n.totalRowCount, this.loadingBlocks.delete(i), this.requestRender(), this.loadRequiredBlocks();
|
|
380
382
|
}).catch(() => {
|
|
381
|
-
this.loadingBlocks.delete(
|
|
383
|
+
this.loadingBlocks.delete(i);
|
|
382
384
|
});
|
|
383
385
|
}
|
|
384
386
|
}
|
|
@@ -389,8 +391,8 @@ class R extends d {
|
|
|
389
391
|
if (!this.dataSource) return [...e];
|
|
390
392
|
const t = [];
|
|
391
393
|
for (let o = 0; o < this.totalRowCount; o++) {
|
|
392
|
-
const
|
|
393
|
-
t.push(
|
|
394
|
+
const r = f(o, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
395
|
+
t.push(r ?? { __loading: !0, __index: o });
|
|
394
396
|
}
|
|
395
397
|
return t;
|
|
396
398
|
}
|
|
@@ -398,7 +400,7 @@ class R extends d {
|
|
|
398
400
|
onScroll(e) {
|
|
399
401
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
400
402
|
this.loadRequiredBlocks();
|
|
401
|
-
},
|
|
403
|
+
}, R));
|
|
402
404
|
}
|
|
403
405
|
// #endregion
|
|
404
406
|
// #region Public API
|
|
@@ -409,7 +411,7 @@ class R extends d {
|
|
|
409
411
|
setDataSource(e) {
|
|
410
412
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
411
413
|
const t = this.config.cacheBlockSize ?? 100;
|
|
412
|
-
|
|
414
|
+
a(e, 0, t, {}).then((o) => {
|
|
413
415
|
this.loadedBlocks.set(0, o.rows), this.totalRowCount = o.totalRowCount, this.requestRender();
|
|
414
416
|
});
|
|
415
417
|
}
|
|
@@ -448,6 +450,6 @@ class R extends d {
|
|
|
448
450
|
// #endregion
|
|
449
451
|
}
|
|
450
452
|
export {
|
|
451
|
-
|
|
453
|
+
k as ServerSidePlugin
|
|
452
454
|
};
|
|
453
455
|
//# sourceMappingURL=index.js.map
|