@toolbox-web/grid 0.6.0 → 1.0.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/README.md +79 -26
- package/all.js +731 -1739
- package/all.js.map +1 -1
- package/index.js +1382 -2410
- package/index.js.map +1 -1
- package/lib/core/constants.d.ts +8 -0
- package/lib/core/constants.d.ts.map +1 -1
- package/lib/core/grid.d.ts +704 -55
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/config-manager.d.ts +3 -7
- package/lib/core/internal/config-manager.d.ts.map +1 -1
- package/lib/core/internal/dom-builder.d.ts +2 -10
- package/lib/core/internal/dom-builder.d.ts.map +1 -1
- package/lib/core/internal/inference.d.ts.map +1 -1
- package/lib/core/internal/keyboard.d.ts.map +1 -1
- package/lib/core/internal/render-scheduler.d.ts +2 -0
- package/lib/core/internal/render-scheduler.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts +9 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts +41 -41
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +2 -15
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +33 -6
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +376 -68
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +89 -2
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.d.ts +2 -0
- package/lib/plugins/clipboard/index.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +24 -35
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +57 -2
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.d.ts +2 -0
- package/lib/plugins/column-virtualization/index.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +7 -17
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +75 -5
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.d.ts +3 -1
- package/lib/plugins/context-menu/index.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +15 -27
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +101 -9
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/editors.d.ts +9 -1
- package/lib/plugins/editing/editors.d.ts.map +1 -1
- package/lib/plugins/editing/index.d.ts +4 -2
- package/lib/plugins/editing/index.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +412 -279
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +88 -0
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/ExportPlugin.d.ts +73 -7
- package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
- package/lib/plugins/export/index.d.ts +2 -0
- package/lib/plugins/export/index.d.ts.map +1 -1
- package/lib/plugins/export/index.js +4 -19
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +98 -2
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.d.ts +2 -0
- package/lib/plugins/filtering/index.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +50 -58
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +80 -6
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.d.ts +2 -0
- package/lib/plugins/grouping-columns/index.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +10 -21
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +81 -5
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.d.ts +3 -1
- package/lib/plugins/grouping-rows/index.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +13 -21
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +90 -5
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.d.ts +2 -0
- package/lib/plugins/master-detail/index.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +11 -17
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +83 -2
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
- package/lib/plugins/multi-sort/index.d.ts +2 -0
- package/lib/plugins/multi-sort/index.d.ts.map +1 -1
- package/lib/plugins/multi-sort/index.js +11 -19
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +61 -2
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.d.ts +3 -1
- package/lib/plugins/pinned-columns/index.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +7 -17
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +71 -10
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.d.ts +3 -1
- package/lib/plugins/pinned-rows/index.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +5 -17
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/PivotPlugin.d.ts +81 -4
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.d.ts +2 -0
- package/lib/plugins/pivot/index.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +10 -17
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts +71 -3
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/reorder/index.d.ts +2 -0
- package/lib/plugins/reorder/index.d.ts.map +1 -1
- package/lib/plugins/reorder/index.js +8 -18
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/reorder/types.d.ts +0 -5
- package/lib/plugins/reorder/types.d.ts.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +84 -20
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +2 -1
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +70 -131
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +25 -4
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/ServerSidePlugin.d.ts +65 -4
- package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -1
- package/lib/plugins/server-side/index.d.ts +3 -1
- package/lib/plugins/server-side/index.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js +5 -17
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts +89 -2
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.d.ts +3 -2
- package/lib/plugins/tree/index.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +59 -94
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +66 -3
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.d.ts +3 -1
- package/lib/plugins/undo-redo/index.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js +5 -17
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +86 -2
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
- package/lib/plugins/visibility/index.d.ts +2 -0
- package/lib/plugins/visibility/index.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js +6 -17
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +30 -2
- 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 +11 -11
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/column-virtualization.umd.js.map +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.map +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/grouping-columns.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
- package/umd/plugins/pivot.umd.js.map +1 -1
- package/umd/plugins/reorder.umd.js +1 -1
- package/umd/plugins/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/server-side.umd.js.map +1 -1
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
- package/umd/plugins/undo-redo.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Context Menu Plugin Entry Point
|
|
3
3
|
* Re-exports plugin class and types for tree-shakeable imports.
|
|
4
|
+
*
|
|
5
|
+
* @module Plugins/Context Menu
|
|
4
6
|
*/
|
|
5
7
|
export { ContextMenuPlugin } from './ContextMenuPlugin';
|
|
6
|
-
export type {
|
|
8
|
+
export type { ContextMenuConfig, ContextMenuItem, ContextMenuParams } from './types';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/context-menu/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/context-menu/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -184,23 +184,6 @@ class I {
|
|
|
184
184
|
get gridElement() {
|
|
185
185
|
return this.grid;
|
|
186
186
|
}
|
|
187
|
-
/**
|
|
188
|
-
* Get the render root of the grid for DOM queries.
|
|
189
|
-
* @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
|
|
190
|
-
*
|
|
191
|
-
* With Shadow DOM removed, the grid element itself is the render root.
|
|
192
|
-
* All new code should use `this.gridElement` for DOM queries.
|
|
193
|
-
*
|
|
194
|
-
* @example
|
|
195
|
-
* // OLD (deprecated)
|
|
196
|
-
* const rows = this.shadowRoot?.querySelector('.rows');
|
|
197
|
-
*
|
|
198
|
-
* // NEW (preferred)
|
|
199
|
-
* const rows = this.gridElement.querySelector('.rows');
|
|
200
|
-
*/
|
|
201
|
-
get shadowRoot() {
|
|
202
|
-
return this.gridElement;
|
|
203
|
-
}
|
|
204
187
|
/**
|
|
205
188
|
* Get the disconnect signal for event listener cleanup.
|
|
206
189
|
* This signal is aborted when the grid disconnects from the DOM.
|
|
@@ -335,7 +318,7 @@ function x(r, e, t, n = C.submenuArrow) {
|
|
|
335
318
|
const s = document.createElement("span");
|
|
336
319
|
s.className = "tbw-context-menu-arrow", typeof n == "string" ? s.innerHTML = n : n instanceof HTMLElement && s.appendChild(n.cloneNode(!0)), i.appendChild(s), i.addEventListener("mouseenter", () => {
|
|
337
320
|
if (i.querySelector(".tbw-context-menu") || !o.subMenu) return;
|
|
338
|
-
const
|
|
321
|
+
const f = v(o.subMenu, e), c = x(f, e, t, n);
|
|
339
322
|
c.classList.add("tbw-context-submenu"), c.style.position = "absolute", c.style.left = "100%", c.style.top = "0", i.style.position = "relative", i.appendChild(c);
|
|
340
323
|
}), i.addEventListener("mouseleave", () => {
|
|
341
324
|
const u = i.querySelector(".tbw-context-menu");
|
|
@@ -354,7 +337,7 @@ function y(r, e, t) {
|
|
|
354
337
|
let i = e, d = t;
|
|
355
338
|
e + n.width > l && (i = e - n.width), t + n.height > o && (d = t - n.height), i = Math.max(0, i), d = Math.max(0, d), r.style.left = `${i}px`, r.style.top = `${d}px`, r.style.visibility = "visible";
|
|
356
339
|
}
|
|
357
|
-
let
|
|
340
|
+
let h = null, b = null, m = null, p = 0;
|
|
358
341
|
const w = [
|
|
359
342
|
{
|
|
360
343
|
id: "copy",
|
|
@@ -374,7 +357,9 @@ const w = [
|
|
|
374
357
|
}
|
|
375
358
|
];
|
|
376
359
|
class H extends I {
|
|
360
|
+
/** @internal */
|
|
377
361
|
name = "contextMenu";
|
|
362
|
+
/** @internal */
|
|
378
363
|
get defaultConfig() {
|
|
379
364
|
return {
|
|
380
365
|
items: w
|
|
@@ -387,18 +372,20 @@ class H extends I {
|
|
|
387
372
|
menuElement = null;
|
|
388
373
|
// #endregion
|
|
389
374
|
// #region Lifecycle
|
|
375
|
+
/** @internal */
|
|
390
376
|
attach(e) {
|
|
391
377
|
super.attach(e), this.installGlobalHandlers(), p++;
|
|
392
378
|
}
|
|
379
|
+
/** @internal */
|
|
393
380
|
detach() {
|
|
394
381
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
395
382
|
}
|
|
396
383
|
// #endregion
|
|
397
384
|
// #region Private Methods
|
|
398
385
|
installGlobalHandlers() {
|
|
399
|
-
!m && typeof document < "u" && typeof g == "string" && g && (m = document.createElement("style"), m.id = "tbw-context-menu-styles", m.textContent = g, document.head.appendChild(m)),
|
|
386
|
+
!m && typeof document < "u" && typeof g == "string" && g && (m = document.createElement("style"), m.id = "tbw-context-menu-styles", m.textContent = g, document.head.appendChild(m)), h || (h = () => {
|
|
400
387
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
401
|
-
}, document.addEventListener("click",
|
|
388
|
+
}, document.addEventListener("click", h)), b || (b = (e) => {
|
|
402
389
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((n) => n.remove());
|
|
403
390
|
}, document.addEventListener("keydown", b));
|
|
404
391
|
}
|
|
@@ -407,10 +394,11 @@ class H extends I {
|
|
|
407
394
|
* Uses reference counting to ensure handlers persist while any grid uses the plugin.
|
|
408
395
|
*/
|
|
409
396
|
uninstallGlobalHandlers() {
|
|
410
|
-
p--, !(p > 0) && (
|
|
397
|
+
p--, !(p > 0) && (h && (document.removeEventListener("click", h), h = null), b && (document.removeEventListener("keydown", b), b = null), m && (m.remove(), m = null));
|
|
411
398
|
}
|
|
412
399
|
// #endregion
|
|
413
400
|
// #region Hooks
|
|
401
|
+
/** @internal */
|
|
414
402
|
afterRender() {
|
|
415
403
|
const e = this.gridElement;
|
|
416
404
|
if (!e) return;
|
|
@@ -421,25 +409,25 @@ class H extends I {
|
|
|
421
409
|
const o = l.target, i = o.closest("[data-row][data-col]"), d = o.closest(".header-cell");
|
|
422
410
|
let a;
|
|
423
411
|
if (i) {
|
|
424
|
-
const u = parseInt(i.getAttribute("data-row") ?? "-1", 10),
|
|
412
|
+
const u = parseInt(i.getAttribute("data-row") ?? "-1", 10), f = parseInt(i.getAttribute("data-col") ?? "-1", 10), c = this.columns[f], E = this.rows[u];
|
|
425
413
|
a = {
|
|
426
414
|
row: E,
|
|
427
415
|
rowIndex: u,
|
|
428
416
|
column: c,
|
|
429
|
-
columnIndex:
|
|
417
|
+
columnIndex: f,
|
|
430
418
|
field: c?.field ?? "",
|
|
431
419
|
value: E?.[c?.field] ?? null,
|
|
432
420
|
isHeader: !1,
|
|
433
421
|
event: l
|
|
434
422
|
};
|
|
435
423
|
} else if (d) {
|
|
436
|
-
const u = parseInt(d.getAttribute("data-col") ?? "-1", 10),
|
|
424
|
+
const u = parseInt(d.getAttribute("data-col") ?? "-1", 10), f = this.columns[u];
|
|
437
425
|
a = {
|
|
438
426
|
row: null,
|
|
439
427
|
rowIndex: -1,
|
|
440
|
-
column:
|
|
428
|
+
column: f,
|
|
441
429
|
columnIndex: u,
|
|
442
|
-
field:
|
|
430
|
+
field: f?.field ?? "",
|
|
443
431
|
value: null,
|
|
444
432
|
isHeader: !0,
|
|
445
433
|
event: l
|