@toolbox-web/grid 1.6.0 → 1.6.2
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 +561 -471
- package/all.js.map +1 -1
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +11 -0
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +136 -77
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +246 -250
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +11 -11
- package/lib/plugins/pivot/PivotPlugin.d.ts +2 -0
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +29 -27
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts +18 -0
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/row-reorder/index.js +132 -72
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +1 -1
- package/lib/plugins/visibility/index.js +7 -7
- package/package.json +1 -1
- package/themes/dg-theme-bootstrap.css +60 -33
- package/themes/dg-theme-material.css +83 -52
- package/themes/dg-theme-standard.css +80 -12
- package/themes/dg-theme-vibrant.css +78 -9
- package/umd/grid.all.umd.js +17 -17
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +1 -1
- package/umd/grid.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/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pivot.umd.js +1 -1
- package/umd/plugins/pivot.umd.js.map +1 -1
- package/umd/plugins/print.umd.js +1 -1
- package/umd/plugins/print.umd.js.map +1 -1
- package/umd/plugins/row-reorder.umd.js +1 -1
- package/umd/plugins/row-reorder.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
|
@@ -93,6 +93,17 @@ 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
|
+
* CSS variables to copy from the grid element to the context menu.
|
|
98
|
+
* Includes both base variables and context-menu specific overrides.
|
|
99
|
+
*/
|
|
100
|
+
private static readonly CSS_VARS_TO_COPY;
|
|
101
|
+
/**
|
|
102
|
+
* Copy CSS custom properties from the grid element to the menu element.
|
|
103
|
+
* This allows the context menu (appended to document.body) to inherit
|
|
104
|
+
* theme variables set on tbw-grid.
|
|
105
|
+
*/
|
|
106
|
+
private copyGridStyles;
|
|
96
107
|
private installGlobalHandlers;
|
|
97
108
|
/**
|
|
98
109
|
* Clean up global handlers when the last instance detaches.
|
|
@@ -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,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;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAoCtC;IAEF;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAqBtB,OAAO,CAAC,qBAAqB;IAqC7B;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAsB/B,gBAAgB;IACP,WAAW,IAAI,IAAI;IA2F5B;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAoCxE;;OAEG;IACH,QAAQ,IAAI,IAAI;IAQhB;;;OAGG;IACH,UAAU,IAAI,OAAO;CAMtB"}
|
|
@@ -311,59 +311,59 @@ class M {
|
|
|
311
311
|
}
|
|
312
312
|
// #endregion
|
|
313
313
|
}
|
|
314
|
-
const
|
|
315
|
-
function
|
|
314
|
+
const w = "@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:0 2px 10px var(--tbw-context-menu-shadow, 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}}";
|
|
315
|
+
function x(r, e) {
|
|
316
316
|
return (typeof r == "function" ? r(e) : r).filter((n) => !(n.hidden === !0 || typeof n.hidden == "function" && n.hidden(e)));
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function z(r, e) {
|
|
319
319
|
return r.disabled === !0 ? !0 : typeof r.disabled == "function" ? r.disabled(e) : !1;
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
for (const
|
|
325
|
-
if (
|
|
326
|
-
const
|
|
327
|
-
|
|
321
|
+
function v(r, e, t, n = I.submenuArrow) {
|
|
322
|
+
const s = document.createElement("div");
|
|
323
|
+
s.className = "tbw-context-menu", s.setAttribute("role", "menu");
|
|
324
|
+
for (const o of r) {
|
|
325
|
+
if (o.separator) {
|
|
326
|
+
const l = document.createElement("div");
|
|
327
|
+
l.className = "tbw-context-menu-separator", l.setAttribute("role", "separator"), s.appendChild(l);
|
|
328
328
|
continue;
|
|
329
329
|
}
|
|
330
330
|
const i = document.createElement("div");
|
|
331
|
-
i.className = "tbw-context-menu-item",
|
|
332
|
-
const
|
|
333
|
-
if (
|
|
334
|
-
const
|
|
335
|
-
|
|
331
|
+
i.className = "tbw-context-menu-item", o.cssClass && i.classList.add(o.cssClass), i.setAttribute("role", "menuitem"), i.setAttribute("data-id", o.id);
|
|
332
|
+
const c = z(o, e);
|
|
333
|
+
if (c && (i.classList.add("disabled"), i.setAttribute("aria-disabled", "true")), o.icon) {
|
|
334
|
+
const l = document.createElement("span");
|
|
335
|
+
l.className = "tbw-context-menu-icon", l.innerHTML = o.icon, i.appendChild(l);
|
|
336
336
|
}
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
339
|
-
const
|
|
340
|
-
|
|
337
|
+
const a = document.createElement("span");
|
|
338
|
+
if (a.className = "tbw-context-menu-label", a.textContent = o.name, i.appendChild(a), o.shortcut) {
|
|
339
|
+
const l = document.createElement("span");
|
|
340
|
+
l.className = "tbw-context-menu-shortcut", l.textContent = o.shortcut, i.appendChild(l);
|
|
341
341
|
}
|
|
342
|
-
if (
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
if (i.querySelector(".tbw-context-menu") || !
|
|
346
|
-
const
|
|
347
|
-
|
|
342
|
+
if (o.subMenu?.length) {
|
|
343
|
+
const l = document.createElement("span");
|
|
344
|
+
l.className = "tbw-context-menu-arrow", typeof n == "string" ? l.innerHTML = n : n instanceof HTMLElement && l.appendChild(n.cloneNode(!0)), i.appendChild(l), i.addEventListener("mouseenter", () => {
|
|
345
|
+
if (i.querySelector(".tbw-context-menu") || !o.subMenu) return;
|
|
346
|
+
const b = x(o.subMenu, e), d = v(b, e, t, n);
|
|
347
|
+
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);
|
|
348
348
|
}), i.addEventListener("mouseleave", () => {
|
|
349
|
-
const
|
|
350
|
-
|
|
349
|
+
const u = i.querySelector(".tbw-context-menu");
|
|
350
|
+
u && u.remove();
|
|
351
351
|
});
|
|
352
352
|
}
|
|
353
|
-
!
|
|
354
|
-
|
|
355
|
-
}),
|
|
353
|
+
!c && o.action && !o.subMenu && i.addEventListener("click", (l) => {
|
|
354
|
+
l.stopPropagation(), t(o);
|
|
355
|
+
}), s.appendChild(i);
|
|
356
356
|
}
|
|
357
|
-
return
|
|
357
|
+
return s;
|
|
358
358
|
}
|
|
359
359
|
function C(r, e, t) {
|
|
360
360
|
r.style.position = "fixed", r.style.left = `${e}px`, r.style.top = `${t}px`, r.style.visibility = "hidden", r.style.zIndex = "10000";
|
|
361
|
-
const n = r.getBoundingClientRect(),
|
|
362
|
-
let i = e,
|
|
363
|
-
e + n.width >
|
|
361
|
+
const n = r.getBoundingClientRect(), s = window.innerWidth, o = window.innerHeight;
|
|
362
|
+
let i = e, c = t;
|
|
363
|
+
e + n.width > s && (i = e - n.width), t + n.height > o && (c = t - n.height), i = Math.max(0, i), c = Math.max(0, c), r.style.left = `${i}px`, r.style.top = `${c}px`, r.style.visibility = "visible";
|
|
364
364
|
}
|
|
365
|
-
let
|
|
366
|
-
const
|
|
365
|
+
let h = null, f = null, m = null, g = 0;
|
|
366
|
+
const p = [
|
|
367
367
|
{
|
|
368
368
|
id: "copy",
|
|
369
369
|
name: "Copy",
|
|
@@ -381,13 +381,13 @@ const w = [
|
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
];
|
|
384
|
-
class
|
|
384
|
+
class S extends M {
|
|
385
385
|
/** @internal */
|
|
386
386
|
name = "contextMenu";
|
|
387
387
|
/** @internal */
|
|
388
388
|
get defaultConfig() {
|
|
389
389
|
return {
|
|
390
|
-
items:
|
|
390
|
+
items: p
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
393
|
// #region Internal State
|
|
@@ -399,7 +399,7 @@ class L extends M {
|
|
|
399
399
|
// #region Lifecycle
|
|
400
400
|
/** @internal */
|
|
401
401
|
attach(e) {
|
|
402
|
-
super.attach(e), this.installGlobalHandlers(),
|
|
402
|
+
super.attach(e), this.installGlobalHandlers(), g++;
|
|
403
403
|
}
|
|
404
404
|
/** @internal */
|
|
405
405
|
detach() {
|
|
@@ -407,19 +407,78 @@ class L extends M {
|
|
|
407
407
|
}
|
|
408
408
|
// #endregion
|
|
409
409
|
// #region Private Methods
|
|
410
|
+
/**
|
|
411
|
+
* CSS variables to copy from the grid element to the context menu.
|
|
412
|
+
* Includes both base variables and context-menu specific overrides.
|
|
413
|
+
*/
|
|
414
|
+
static CSS_VARS_TO_COPY = [
|
|
415
|
+
// Base palette (for themes that only set base vars)
|
|
416
|
+
"--tbw-color-panel-bg",
|
|
417
|
+
"--tbw-color-fg",
|
|
418
|
+
"--tbw-color-fg-muted",
|
|
419
|
+
"--tbw-color-border",
|
|
420
|
+
"--tbw-color-row-hover",
|
|
421
|
+
"--tbw-color-shadow",
|
|
422
|
+
"--tbw-color-danger",
|
|
423
|
+
"--tbw-border-radius",
|
|
424
|
+
"--tbw-font-family",
|
|
425
|
+
"--tbw-font-size-sm",
|
|
426
|
+
"--tbw-font-size-xs",
|
|
427
|
+
"--tbw-font-size-2xs",
|
|
428
|
+
"--tbw-spacing-xs",
|
|
429
|
+
"--tbw-icon-size",
|
|
430
|
+
"--tbw-menu-min-width",
|
|
431
|
+
"--tbw-menu-item-padding",
|
|
432
|
+
"--tbw-menu-item-gap",
|
|
433
|
+
// Context menu specific overrides
|
|
434
|
+
"--tbw-context-menu-bg",
|
|
435
|
+
"--tbw-context-menu-fg",
|
|
436
|
+
"--tbw-context-menu-border",
|
|
437
|
+
"--tbw-context-menu-radius",
|
|
438
|
+
"--tbw-context-menu-shadow",
|
|
439
|
+
"--tbw-context-menu-hover",
|
|
440
|
+
"--tbw-context-menu-danger",
|
|
441
|
+
"--tbw-context-menu-muted",
|
|
442
|
+
"--tbw-context-menu-min-width",
|
|
443
|
+
"--tbw-context-menu-font-size",
|
|
444
|
+
"--tbw-context-menu-font-family",
|
|
445
|
+
"--tbw-context-menu-item-padding",
|
|
446
|
+
"--tbw-context-menu-item-gap",
|
|
447
|
+
"--tbw-context-menu-icon-size",
|
|
448
|
+
"--tbw-context-menu-shortcut-size",
|
|
449
|
+
"--tbw-context-menu-arrow-size"
|
|
450
|
+
];
|
|
451
|
+
/**
|
|
452
|
+
* Copy CSS custom properties from the grid element to the menu element.
|
|
453
|
+
* This allows the context menu (appended to document.body) to inherit
|
|
454
|
+
* theme variables set on tbw-grid.
|
|
455
|
+
*/
|
|
456
|
+
copyGridStyles(e) {
|
|
457
|
+
const t = this.gridElement;
|
|
458
|
+
if (!t) return;
|
|
459
|
+
const n = getComputedStyle(t), s = [];
|
|
460
|
+
for (const o of S.CSS_VARS_TO_COPY) {
|
|
461
|
+
const i = n.getPropertyValue(o).trim();
|
|
462
|
+
i && s.push(`${o}: ${i}`);
|
|
463
|
+
}
|
|
464
|
+
if (s.length > 0) {
|
|
465
|
+
const o = e.getAttribute("style") || "";
|
|
466
|
+
e.setAttribute("style", o + s.join("; ") + ";");
|
|
467
|
+
}
|
|
468
|
+
}
|
|
410
469
|
installGlobalHandlers() {
|
|
411
|
-
!m && typeof document < "u" && typeof
|
|
470
|
+
!m && typeof document < "u" && typeof w == "string" && w && (m = document.createElement("style"), m.id = "tbw-context-menu-styles", m.textContent = w, document.head.appendChild(m)), h || (h = () => {
|
|
412
471
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
413
|
-
}, document.addEventListener("click",
|
|
472
|
+
}, document.addEventListener("click", h)), f || (f = (e) => {
|
|
414
473
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((n) => n.remove());
|
|
415
|
-
}, document.addEventListener("keydown",
|
|
474
|
+
}, document.addEventListener("keydown", f));
|
|
416
475
|
}
|
|
417
476
|
/**
|
|
418
477
|
* Clean up global handlers when the last instance detaches.
|
|
419
478
|
* Uses reference counting to ensure handlers persist while any grid uses the plugin.
|
|
420
479
|
*/
|
|
421
480
|
uninstallGlobalHandlers() {
|
|
422
|
-
|
|
481
|
+
g--, !(g > 0) && (h && (document.removeEventListener("click", h), h = null), f && (document.removeEventListener("keydown", f), f = null), m && (m.remove(), m = null));
|
|
423
482
|
}
|
|
424
483
|
// #endregion
|
|
425
484
|
// #region Hooks
|
|
@@ -429,46 +488,46 @@ class L extends M {
|
|
|
429
488
|
if (!e) return;
|
|
430
489
|
const t = e.children[0];
|
|
431
490
|
t && t.getAttribute("data-context-menu-bound") !== "true" && (t.setAttribute("data-context-menu-bound", "true"), t.addEventListener("contextmenu", (n) => {
|
|
432
|
-
const
|
|
433
|
-
|
|
434
|
-
const
|
|
435
|
-
let
|
|
491
|
+
const s = n;
|
|
492
|
+
s.preventDefault();
|
|
493
|
+
const o = s.target, i = o.closest("[data-row][data-col]"), c = o.closest(".header-cell");
|
|
494
|
+
let a;
|
|
436
495
|
if (i) {
|
|
437
|
-
const
|
|
438
|
-
|
|
496
|
+
const u = parseInt(i.getAttribute("data-row") ?? "-1", 10), b = parseInt(i.getAttribute("data-col") ?? "-1", 10), d = this.columns[b], E = this.rows[u];
|
|
497
|
+
a = {
|
|
439
498
|
row: E,
|
|
440
|
-
rowIndex:
|
|
441
|
-
column:
|
|
442
|
-
columnIndex:
|
|
443
|
-
field:
|
|
444
|
-
value: E?.[
|
|
499
|
+
rowIndex: u,
|
|
500
|
+
column: d,
|
|
501
|
+
columnIndex: b,
|
|
502
|
+
field: d?.field ?? "",
|
|
503
|
+
value: E?.[d?.field] ?? null,
|
|
445
504
|
isHeader: !1,
|
|
446
|
-
event:
|
|
505
|
+
event: s
|
|
447
506
|
};
|
|
448
|
-
} else if (
|
|
449
|
-
const
|
|
450
|
-
|
|
507
|
+
} else if (c) {
|
|
508
|
+
const u = parseInt(c.getAttribute("data-col") ?? "-1", 10), b = this.columns[u];
|
|
509
|
+
a = {
|
|
451
510
|
row: null,
|
|
452
511
|
rowIndex: -1,
|
|
453
|
-
column:
|
|
454
|
-
columnIndex:
|
|
455
|
-
field:
|
|
512
|
+
column: b,
|
|
513
|
+
columnIndex: u,
|
|
514
|
+
field: b?.field ?? "",
|
|
456
515
|
value: null,
|
|
457
516
|
isHeader: !0,
|
|
458
|
-
event:
|
|
517
|
+
event: s
|
|
459
518
|
};
|
|
460
519
|
} else
|
|
461
520
|
return;
|
|
462
|
-
this.params =
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
(
|
|
468
|
-
|
|
521
|
+
this.params = a, this.position = { x: s.clientX, y: s.clientY };
|
|
522
|
+
const l = x(this.config.items ?? p, a);
|
|
523
|
+
l.length && (this.menuElement && this.menuElement.remove(), this.menuElement = v(
|
|
524
|
+
l,
|
|
525
|
+
a,
|
|
526
|
+
(u) => {
|
|
527
|
+
u.action && u.action(a), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
469
528
|
},
|
|
470
529
|
this.gridIcons.submenuArrow
|
|
471
|
-
), document.body.appendChild(this.menuElement), C(this.menuElement,
|
|
530
|
+
), 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 }));
|
|
472
531
|
}));
|
|
473
532
|
}
|
|
474
533
|
// #endregion
|
|
@@ -480,7 +539,7 @@ class L extends M {
|
|
|
480
539
|
* @param params - Partial context menu parameters
|
|
481
540
|
*/
|
|
482
541
|
showMenu(e, t, n) {
|
|
483
|
-
const
|
|
542
|
+
const s = {
|
|
484
543
|
row: n.row ?? null,
|
|
485
544
|
rowIndex: n.rowIndex ?? -1,
|
|
486
545
|
column: n.column ?? null,
|
|
@@ -489,15 +548,15 @@ class L extends M {
|
|
|
489
548
|
value: n.value ?? null,
|
|
490
549
|
isHeader: n.isHeader ?? !1,
|
|
491
550
|
event: n.event ?? new MouseEvent("contextmenu")
|
|
492
|
-
},
|
|
493
|
-
this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
551
|
+
}, o = x(this.config.items ?? p, s);
|
|
552
|
+
this.menuElement && this.menuElement.remove(), this.menuElement = v(
|
|
553
|
+
o,
|
|
494
554
|
s,
|
|
495
|
-
l,
|
|
496
555
|
(i) => {
|
|
497
|
-
i.action && i.action(
|
|
556
|
+
i.action && i.action(s), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
498
557
|
},
|
|
499
558
|
this.gridIcons.submenuArrow
|
|
500
|
-
), document.body.appendChild(this.menuElement), C(this.menuElement, e, t), this.isOpen = !0;
|
|
559
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), C(this.menuElement, e, t), this.isOpen = !0;
|
|
501
560
|
}
|
|
502
561
|
/**
|
|
503
562
|
* Hide the context menu.
|
|
@@ -516,6 +575,6 @@ class L extends M {
|
|
|
516
575
|
// Styles are injected globally via installGlobalHandlers() since menu renders in document.body
|
|
517
576
|
}
|
|
518
577
|
export {
|
|
519
|
-
|
|
578
|
+
S as ContextMenuPlugin
|
|
520
579
|
};
|
|
521
580
|
//# sourceMappingURL=index.js.map
|