@toolbox-web/grid 1.2.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/README.md +80 -22
- package/all.js +619 -571
- package/all.js.map +1 -1
- package/index.js +362 -302
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +64 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/row-animation.d.ts +37 -0
- package/lib/core/internal/row-animation.d.ts.map +1 -0
- package/lib/core/types.d.ts +17 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +82 -76
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +1 -0
- package/lib/plugins/clipboard/types.d.ts.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/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +83 -52
- 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/SelectionPlugin.d.ts +13 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +1 -1
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +118 -85
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +50 -6
- package/lib/plugins/selection/types.d.ts.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 +21 -4
- package/public.d.ts +1 -1
- package/public.d.ts.map +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/clipboard.umd.js +5 -5
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const d = {
|
|
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>', u = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -6,9 +6,11 @@ const d = {
|
|
|
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 S {
|
|
12
14
|
/**
|
|
13
15
|
* Plugin dependencies - declare other plugins this one requires.
|
|
14
16
|
*
|
|
@@ -232,7 +234,7 @@ class u {
|
|
|
232
234
|
*/
|
|
233
235
|
get gridIcons() {
|
|
234
236
|
const t = this.grid?.gridConfig?.icons ?? {};
|
|
235
|
-
return { ...
|
|
237
|
+
return { ...u, ...t };
|
|
236
238
|
}
|
|
237
239
|
// #region Animation Helpers
|
|
238
240
|
/**
|
|
@@ -308,7 +310,7 @@ class u {
|
|
|
308
310
|
}
|
|
309
311
|
// #endregion
|
|
310
312
|
}
|
|
311
|
-
function
|
|
313
|
+
function h(n, t, e) {
|
|
312
314
|
const r = [...n.undoStack, t];
|
|
313
315
|
for (; r.length > e; )
|
|
314
316
|
r.shift();
|
|
@@ -318,7 +320,7 @@ function S(n, t, e) {
|
|
|
318
320
|
// Clear redo on new action
|
|
319
321
|
};
|
|
320
322
|
}
|
|
321
|
-
function
|
|
323
|
+
function s(n) {
|
|
322
324
|
if (n.undoStack.length === 0)
|
|
323
325
|
return { newState: n, action: null };
|
|
324
326
|
const t = [...n.undoStack], e = t.pop();
|
|
@@ -330,7 +332,7 @@ function a(n) {
|
|
|
330
332
|
action: e
|
|
331
333
|
} : { newState: n, action: null };
|
|
332
334
|
}
|
|
333
|
-
function
|
|
335
|
+
function d(n) {
|
|
334
336
|
if (n.redoStack.length === 0)
|
|
335
337
|
return { newState: n, action: null };
|
|
336
338
|
const t = [...n.redoStack], e = t.pop();
|
|
@@ -345,13 +347,13 @@ function s(n) {
|
|
|
345
347
|
function l(n) {
|
|
346
348
|
return n.undoStack.length > 0;
|
|
347
349
|
}
|
|
348
|
-
function
|
|
350
|
+
function k(n) {
|
|
349
351
|
return n.redoStack.length > 0;
|
|
350
352
|
}
|
|
351
|
-
function
|
|
353
|
+
function g() {
|
|
352
354
|
return { undoStack: [], redoStack: [] };
|
|
353
355
|
}
|
|
354
|
-
function
|
|
356
|
+
function f(n, t, e, r) {
|
|
355
357
|
return {
|
|
356
358
|
type: "cell-edit",
|
|
357
359
|
rowIndex: n,
|
|
@@ -361,7 +363,7 @@ function g(n, t, e, r) {
|
|
|
361
363
|
timestamp: Date.now()
|
|
362
364
|
};
|
|
363
365
|
}
|
|
364
|
-
class
|
|
366
|
+
class w extends S {
|
|
365
367
|
/**
|
|
366
368
|
* Plugin dependencies - UndoRedoPlugin requires EditingPlugin to track edits.
|
|
367
369
|
*
|
|
@@ -398,7 +400,7 @@ class f extends u {
|
|
|
398
400
|
onKeyDown(t) {
|
|
399
401
|
const e = (t.ctrlKey || t.metaKey) && t.key === "z" && !t.shiftKey, r = (t.ctrlKey || t.metaKey) && (t.key === "y" || t.key === "z" && t.shiftKey);
|
|
400
402
|
if (e) {
|
|
401
|
-
const o =
|
|
403
|
+
const o = s({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
402
404
|
if (o.action) {
|
|
403
405
|
const i = this.rows;
|
|
404
406
|
i[o.action.rowIndex] && (i[o.action.rowIndex][o.action.field] = o.action.oldValue), this.undoStack = o.newState.undoStack, this.redoStack = o.newState.redoStack, this.emit("undo", {
|
|
@@ -409,7 +411,7 @@ class f extends u {
|
|
|
409
411
|
return !0;
|
|
410
412
|
}
|
|
411
413
|
if (r) {
|
|
412
|
-
const o =
|
|
414
|
+
const o = d({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
413
415
|
if (o.action) {
|
|
414
416
|
const i = this.rows;
|
|
415
417
|
i[o.action.rowIndex] && (i[o.action.rowIndex][o.action.field] = o.action.newValue), this.undoStack = o.newState.undoStack, this.redoStack = o.newState.redoStack, this.emit("redo", {
|
|
@@ -432,12 +434,12 @@ class f extends u {
|
|
|
432
434
|
* @param newValue - The value after the edit
|
|
433
435
|
*/
|
|
434
436
|
recordEdit(t, e, r, o) {
|
|
435
|
-
const i =
|
|
437
|
+
const i = f(t, e, r, o), a = h(
|
|
436
438
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
437
439
|
i,
|
|
438
440
|
this.config.maxHistorySize ?? 100
|
|
439
441
|
);
|
|
440
|
-
this.undoStack =
|
|
442
|
+
this.undoStack = a.undoStack, this.redoStack = a.redoStack;
|
|
441
443
|
}
|
|
442
444
|
/**
|
|
443
445
|
* Programmatically undo the last action.
|
|
@@ -445,7 +447,7 @@ class f extends u {
|
|
|
445
447
|
* @returns The undone action, or null if nothing to undo
|
|
446
448
|
*/
|
|
447
449
|
undo() {
|
|
448
|
-
const t =
|
|
450
|
+
const t = s({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
449
451
|
if (t.action) {
|
|
450
452
|
const e = this.rows;
|
|
451
453
|
e[t.action.rowIndex] && (e[t.action.rowIndex][t.action.field] = t.action.oldValue), this.undoStack = t.newState.undoStack, this.redoStack = t.newState.redoStack, this.requestRender();
|
|
@@ -458,7 +460,7 @@ class f extends u {
|
|
|
458
460
|
* @returns The redone action, or null if nothing to redo
|
|
459
461
|
*/
|
|
460
462
|
redo() {
|
|
461
|
-
const t =
|
|
463
|
+
const t = d({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
462
464
|
if (t.action) {
|
|
463
465
|
const e = this.rows;
|
|
464
466
|
e[t.action.rowIndex] && (e[t.action.rowIndex][t.action.field] = t.action.newValue), this.undoStack = t.newState.undoStack, this.redoStack = t.newState.redoStack, this.requestRender();
|
|
@@ -475,13 +477,13 @@ class f extends u {
|
|
|
475
477
|
* Check if there are any actions that can be redone.
|
|
476
478
|
*/
|
|
477
479
|
canRedo() {
|
|
478
|
-
return
|
|
480
|
+
return k({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
479
481
|
}
|
|
480
482
|
/**
|
|
481
483
|
* Clear all undo/redo history.
|
|
482
484
|
*/
|
|
483
485
|
clearHistory() {
|
|
484
|
-
const t =
|
|
486
|
+
const t = g();
|
|
485
487
|
this.undoStack = t.undoStack, this.redoStack = t.redoStack;
|
|
486
488
|
}
|
|
487
489
|
/**
|
|
@@ -499,6 +501,6 @@ class f extends u {
|
|
|
499
501
|
// #endregion
|
|
500
502
|
}
|
|
501
503
|
export {
|
|
502
|
-
|
|
504
|
+
w as UndoRedoPlugin
|
|
503
505
|
};
|
|
504
506
|
//# sourceMappingURL=index.js.map
|