@toolbox-web/grid 1.13.0 → 1.14.0
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 +1483 -1403
- package/all.js.map +1 -1
- package/index.js +11 -4
- package/index.js.map +1 -1
- package/lib/core/internal/row-animation.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +1 -1
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +44 -1
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +69 -8
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.d.ts +1 -1
- package/lib/plugins/clipboard/index.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +257 -192
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +31 -0
- package/lib/plugins/clipboard/types.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +8 -0
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +75 -60
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/context-menu/types.d.ts +7 -0
- package/lib/plugins/context-menu/types.d.ts.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/editors.d.ts +2 -2
- package/lib/plugins/editing/editors.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +420 -381
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +6 -23
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
- package/lib/plugins/export/index.js +75 -66
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.d.ts +1 -1
- package/lib/plugins/filtering/index.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +1 -0
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +118 -87
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pinned-rows/pinned-rows.d.ts +2 -1
- package/lib/plugins/pinned-rows/pinned-rows.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/types.d.ts +23 -2
- package/lib/plugins/pinned-rows/types.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +147 -139
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/shared/data-collection.d.ts +33 -0
- package/lib/plugins/shared/data-collection.d.ts.map +1 -0
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +23 -23
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +2 -2
- 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/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.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/export.umd.js +7 -7
- package/umd/plugins/export.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
|
@@ -93,6 +93,14 @@ export declare class ContextMenuPlugin extends BaseGridPlugin<ContextMenuConfig>
|
|
|
93
93
|
attach(grid: import('../../core/plugin/base-plugin').GridElement): void;
|
|
94
94
|
/** @internal */
|
|
95
95
|
detach(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Sync selection with the right-clicked row.
|
|
98
|
+
* If the right-clicked row is already selected, keeps the multi-selection.
|
|
99
|
+
* If not, selects only the right-clicked row (standard behavior in file managers / spreadsheets).
|
|
100
|
+
*
|
|
101
|
+
* @returns Sorted array of selected row indices after sync
|
|
102
|
+
*/
|
|
103
|
+
private syncSelectionOnContextMenu;
|
|
96
104
|
/**
|
|
97
105
|
* CSS variables to copy from the grid element to the context menu.
|
|
98
106
|
* Includes both base variables and context-menu specific overrides.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/context-menu/ContextMenuPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,KAAK,EAAE,iBAAiB,EAAmB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAkCrF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,iBAAiB,CAAC;IACtE,gBAAgB;IAChB,QAAQ,CAAC,IAAI,iBAAiB;IAE9B,gBAAgB;IAChB,cAAuB,aAAa,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAIjE;IAGD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,WAAW,CAA4B;IAK/C,gBAAgB;IACP,MAAM,CAAC,IAAI,EAAE,OAAO,+BAA+B,EAAE,WAAW,GAAG,IAAI;IAMhF,gBAAgB;IACP,MAAM,IAAI,IAAI;IAavB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAoCtC;IAEF;;;;OAIG;IACH,OAAO,CAAC,cAAc;IA2BtB,OAAO,CAAC,qBAAqB;IAqC7B;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAsB/B,gBAAgB;IACP,WAAW,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"ContextMenuPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/context-menu/ContextMenuPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,KAAK,EAAE,iBAAiB,EAAmB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAkCrF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,iBAAiB,CAAC;IACtE,gBAAgB;IAChB,QAAQ,CAAC,IAAI,iBAAiB;IAE9B,gBAAgB;IAChB,cAAuB,aAAa,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAIjE;IAGD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,WAAW,CAA4B;IAK/C,gBAAgB;IACP,MAAM,CAAC,IAAI,EAAE,OAAO,+BAA+B,EAAE,WAAW,GAAG,IAAI;IAMhF,gBAAgB;IACP,MAAM,IAAI,IAAI;IAavB;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;IAoBlC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAoCtC;IAEF;;;;OAIG;IACH,OAAO,CAAC,cAAc;IA2BtB,OAAO,CAAC,qBAAqB;IAqC7B;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAsB/B,gBAAgB;IACP,WAAW,IAAI,IAAI;IAoG5B;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAqCxE;;OAEG;IACH,QAAQ,IAAI,IAAI;IAQhB;;;OAGG;IACH,UAAU,IAAI,OAAO;CAMtB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const E = '<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>', I = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -7,11 +7,11 @@ const y = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentCo
|
|
|
7
7
|
submenuArrow: "▶",
|
|
8
8
|
dragHandle: "⋮⋮",
|
|
9
9
|
toolPanel: "☰",
|
|
10
|
-
filter:
|
|
11
|
-
filterActive:
|
|
10
|
+
filter: E,
|
|
11
|
+
filterActive: E,
|
|
12
12
|
print: "🖨️"
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class R {
|
|
15
15
|
/**
|
|
16
16
|
* Plugin dependencies - declare other plugins this one requires.
|
|
17
17
|
*
|
|
@@ -378,19 +378,19 @@ class S {
|
|
|
378
378
|
// #endregion
|
|
379
379
|
}
|
|
380
380
|
const g = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:var(--tbw-context-menu-shadow, 0 2px 10px var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
|
|
381
|
-
function x(
|
|
382
|
-
return (typeof
|
|
381
|
+
function x(r, e) {
|
|
382
|
+
return (typeof r == "function" ? r(e) : r).filter((n) => !(n.hidden === !0 || typeof n.hidden == "function" && n.hidden(e)));
|
|
383
383
|
}
|
|
384
|
-
function z(
|
|
385
|
-
return
|
|
384
|
+
function z(r, e) {
|
|
385
|
+
return r.disabled === !0 ? !0 : typeof r.disabled == "function" ? r.disabled(e) : !1;
|
|
386
386
|
}
|
|
387
|
-
function v(
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
for (const o of
|
|
387
|
+
function v(r, e, t, n = I.submenuArrow) {
|
|
388
|
+
const s = document.createElement("div");
|
|
389
|
+
s.className = "tbw-context-menu", s.setAttribute("role", "menu");
|
|
390
|
+
for (const o of r) {
|
|
391
391
|
if (o.separator) {
|
|
392
392
|
const l = document.createElement("div");
|
|
393
|
-
l.className = "tbw-context-menu-separator", l.setAttribute("role", "separator"),
|
|
393
|
+
l.className = "tbw-context-menu-separator", l.setAttribute("role", "separator"), s.appendChild(l);
|
|
394
394
|
continue;
|
|
395
395
|
}
|
|
396
396
|
const i = document.createElement("div");
|
|
@@ -400,8 +400,8 @@ function v(s, e, t, n = I.submenuArrow) {
|
|
|
400
400
|
const l = document.createElement("span");
|
|
401
401
|
l.className = "tbw-context-menu-icon", l.innerHTML = o.icon, i.appendChild(l);
|
|
402
402
|
}
|
|
403
|
-
const
|
|
404
|
-
if (
|
|
403
|
+
const a = document.createElement("span");
|
|
404
|
+
if (a.className = "tbw-context-menu-label", a.textContent = o.name, i.appendChild(a), o.shortcut) {
|
|
405
405
|
const l = document.createElement("span");
|
|
406
406
|
l.className = "tbw-context-menu-shortcut", l.textContent = o.shortcut, i.appendChild(l);
|
|
407
407
|
}
|
|
@@ -412,21 +412,21 @@ function v(s, e, t, n = I.submenuArrow) {
|
|
|
412
412
|
const b = x(o.subMenu, e), d = v(b, e, t, n);
|
|
413
413
|
d.classList.add("tbw-context-submenu"), d.style.position = "absolute", d.style.left = "100%", d.style.top = "0", i.style.position = "relative", i.appendChild(d);
|
|
414
414
|
}), i.addEventListener("mouseleave", () => {
|
|
415
|
-
const
|
|
416
|
-
|
|
415
|
+
const c = i.querySelector(".tbw-context-menu");
|
|
416
|
+
c && c.remove();
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
419
|
!u && o.action && !o.subMenu && i.addEventListener("click", (l) => {
|
|
420
420
|
l.stopPropagation(), t(o);
|
|
421
|
-
}),
|
|
421
|
+
}), s.appendChild(i);
|
|
422
422
|
}
|
|
423
|
-
return
|
|
423
|
+
return s;
|
|
424
424
|
}
|
|
425
|
-
function C(
|
|
426
|
-
|
|
427
|
-
const n =
|
|
425
|
+
function C(r, e, t) {
|
|
426
|
+
r.style.position = "fixed", r.style.left = `${e}px`, r.style.top = `${t}px`, r.style.visibility = "hidden", r.style.zIndex = "10000";
|
|
427
|
+
const n = r.getBoundingClientRect(), s = window.innerWidth, o = window.innerHeight;
|
|
428
428
|
let i = e, u = t;
|
|
429
|
-
e + n.width >
|
|
429
|
+
e + n.width > s && (i = e - n.width), t + n.height > o && (u = t - n.height), i = Math.max(0, i), u = Math.max(0, u), r.style.left = `${i}px`, r.style.top = `${u}px`, r.style.visibility = "visible";
|
|
430
430
|
}
|
|
431
431
|
let h = null, f = null, m = null, w = 0;
|
|
432
432
|
const p = [
|
|
@@ -434,20 +434,20 @@ const p = [
|
|
|
434
434
|
id: "copy",
|
|
435
435
|
name: "Copy",
|
|
436
436
|
shortcut: "Ctrl+C",
|
|
437
|
-
action: (
|
|
438
|
-
|
|
437
|
+
action: (r) => {
|
|
438
|
+
r.grid?.plugins?.clipboard?.copy?.();
|
|
439
439
|
}
|
|
440
440
|
},
|
|
441
441
|
{ separator: !0, id: "sep1", name: "" },
|
|
442
442
|
{
|
|
443
443
|
id: "export-csv",
|
|
444
444
|
name: "Export CSV",
|
|
445
|
-
action: (
|
|
446
|
-
|
|
445
|
+
action: (r) => {
|
|
446
|
+
r.grid?.plugins?.export?.exportCsv?.();
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
449
|
];
|
|
450
|
-
class
|
|
450
|
+
class S extends R {
|
|
451
451
|
/** @internal */
|
|
452
452
|
name = "contextMenu";
|
|
453
453
|
/** @internal */
|
|
@@ -473,6 +473,18 @@ class M extends S {
|
|
|
473
473
|
}
|
|
474
474
|
// #endregion
|
|
475
475
|
// #region Private Methods
|
|
476
|
+
/**
|
|
477
|
+
* Sync selection with the right-clicked row.
|
|
478
|
+
* If the right-clicked row is already selected, keeps the multi-selection.
|
|
479
|
+
* If not, selects only the right-clicked row (standard behavior in file managers / spreadsheets).
|
|
480
|
+
*
|
|
481
|
+
* @returns Sorted array of selected row indices after sync
|
|
482
|
+
*/
|
|
483
|
+
syncSelectionOnContextMenu(e) {
|
|
484
|
+
if (e < 0) return [];
|
|
485
|
+
const n = this.grid?.query("getSelectedRowIndices")?.[0];
|
|
486
|
+
return n ? n.includes(e) ? n : (this.grid?.query("selectRows", [e]), [e]) : [e];
|
|
487
|
+
}
|
|
476
488
|
/**
|
|
477
489
|
* CSS variables to copy from the grid element to the context menu.
|
|
478
490
|
* Includes both base variables and context-menu specific overrides.
|
|
@@ -522,15 +534,15 @@ class M extends S {
|
|
|
522
534
|
copyGridStyles(e) {
|
|
523
535
|
const t = this.gridElement;
|
|
524
536
|
if (!t) return;
|
|
525
|
-
const n = getComputedStyle(t),
|
|
526
|
-
o &&
|
|
527
|
-
for (const i of
|
|
537
|
+
const n = getComputedStyle(t), s = [], o = n.getPropertyValue("color-scheme").trim();
|
|
538
|
+
o && s.push(`color-scheme: ${o}`);
|
|
539
|
+
for (const i of S.CSS_VARS_TO_COPY) {
|
|
528
540
|
const u = n.getPropertyValue(i).trim();
|
|
529
|
-
u &&
|
|
541
|
+
u && s.push(`${i}: ${u}`);
|
|
530
542
|
}
|
|
531
|
-
if (
|
|
543
|
+
if (s.length > 0) {
|
|
532
544
|
const i = e.getAttribute("style") || "";
|
|
533
|
-
e.setAttribute("style", i +
|
|
545
|
+
e.setAttribute("style", i + s.join("; ") + ";");
|
|
534
546
|
}
|
|
535
547
|
}
|
|
536
548
|
installGlobalHandlers() {
|
|
@@ -555,46 +567,48 @@ class M extends S {
|
|
|
555
567
|
if (!e) return;
|
|
556
568
|
const t = e.querySelector(".tbw-grid-root");
|
|
557
569
|
t && t.getAttribute("data-context-menu-bound") !== "true" && (t.setAttribute("data-context-menu-bound", "true"), t.addEventListener("contextmenu", (n) => {
|
|
558
|
-
const
|
|
559
|
-
|
|
560
|
-
const o =
|
|
561
|
-
let
|
|
570
|
+
const s = n;
|
|
571
|
+
s.preventDefault();
|
|
572
|
+
const o = s.target, i = o.closest("[data-row][data-col]"), u = o.closest(".header-cell");
|
|
573
|
+
let a;
|
|
562
574
|
if (i) {
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
row:
|
|
566
|
-
rowIndex:
|
|
575
|
+
const c = parseInt(i.getAttribute("data-row") ?? "-1", 10), b = parseInt(i.getAttribute("data-col") ?? "-1", 10), d = this.columns[b], y = this.rows[c], M = this.syncSelectionOnContextMenu(c);
|
|
576
|
+
a = {
|
|
577
|
+
row: y,
|
|
578
|
+
rowIndex: c,
|
|
567
579
|
column: d,
|
|
568
580
|
columnIndex: b,
|
|
569
581
|
field: d?.field ?? "",
|
|
570
|
-
value:
|
|
582
|
+
value: y?.[d?.field] ?? null,
|
|
571
583
|
isHeader: !1,
|
|
572
|
-
event:
|
|
584
|
+
event: s,
|
|
585
|
+
selectedRows: M
|
|
573
586
|
};
|
|
574
587
|
} else if (u) {
|
|
575
|
-
const
|
|
576
|
-
|
|
588
|
+
const c = parseInt(u.getAttribute("data-col") ?? "-1", 10), b = this.columns[c];
|
|
589
|
+
a = {
|
|
577
590
|
row: null,
|
|
578
591
|
rowIndex: -1,
|
|
579
592
|
column: b,
|
|
580
|
-
columnIndex:
|
|
593
|
+
columnIndex: c,
|
|
581
594
|
field: b?.field ?? "",
|
|
582
595
|
value: null,
|
|
583
596
|
isHeader: !0,
|
|
584
|
-
event:
|
|
597
|
+
event: s,
|
|
598
|
+
selectedRows: []
|
|
585
599
|
};
|
|
586
600
|
} else
|
|
587
601
|
return;
|
|
588
|
-
this.params =
|
|
589
|
-
const l = x(this.config.items ?? p,
|
|
602
|
+
this.params = a, this.position = { x: s.clientX, y: s.clientY };
|
|
603
|
+
const l = x(this.config.items ?? p, a);
|
|
590
604
|
l.length && (this.menuElement && this.menuElement.remove(), this.menuElement = v(
|
|
591
605
|
l,
|
|
592
|
-
|
|
593
|
-
(
|
|
594
|
-
|
|
606
|
+
a,
|
|
607
|
+
(c) => {
|
|
608
|
+
c.action && c.action(a), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
595
609
|
},
|
|
596
610
|
this.gridIcons.submenuArrow
|
|
597
|
-
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), C(this.menuElement,
|
|
611
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), C(this.menuElement, s.clientX, s.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: a, items: l }));
|
|
598
612
|
}));
|
|
599
613
|
}
|
|
600
614
|
// #endregion
|
|
@@ -606,7 +620,7 @@ class M extends S {
|
|
|
606
620
|
* @param params - Partial context menu parameters
|
|
607
621
|
*/
|
|
608
622
|
showMenu(e, t, n) {
|
|
609
|
-
const
|
|
623
|
+
const s = {
|
|
610
624
|
row: n.row ?? null,
|
|
611
625
|
rowIndex: n.rowIndex ?? -1,
|
|
612
626
|
column: n.column ?? null,
|
|
@@ -614,13 +628,14 @@ class M extends S {
|
|
|
614
628
|
field: n.field ?? "",
|
|
615
629
|
value: n.value ?? null,
|
|
616
630
|
isHeader: n.isHeader ?? !1,
|
|
617
|
-
event: n.event ?? new MouseEvent("contextmenu")
|
|
618
|
-
|
|
631
|
+
event: n.event ?? new MouseEvent("contextmenu"),
|
|
632
|
+
selectedRows: n.selectedRows ?? []
|
|
633
|
+
}, o = x(this.config.items ?? p, s);
|
|
619
634
|
this.menuElement && this.menuElement.remove(), this.menuElement = v(
|
|
620
635
|
o,
|
|
621
|
-
|
|
636
|
+
s,
|
|
622
637
|
(i) => {
|
|
623
|
-
i.action && i.action(
|
|
638
|
+
i.action && i.action(s), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
624
639
|
},
|
|
625
640
|
this.gridIcons.submenuArrow
|
|
626
641
|
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), C(this.menuElement, e, t), this.isOpen = !0;
|
|
@@ -642,6 +657,6 @@ class M extends S {
|
|
|
642
657
|
// Styles are injected globally via installGlobalHandlers() since menu renders in document.body
|
|
643
658
|
}
|
|
644
659
|
export {
|
|
645
|
-
|
|
660
|
+
S as ContextMenuPlugin
|
|
646
661
|
};
|
|
647
662
|
//# sourceMappingURL=index.js.map
|