@toolbox-web/grid 1.6.2 → 1.8.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 +51 -15
- package/all.js +267 -158
- package/all.js.map +1 -1
- package/index.js +866 -722
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +68 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +182 -1
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/index.d.ts +1 -1
- package/lib/core/plugin/index.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +56 -1
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +36 -0
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +1349 -31
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +140 -87
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +64 -7
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +123 -65
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +6 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +95 -13
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +91 -34
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +6 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +192 -123
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +57 -0
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +7 -2
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +142 -60
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +69 -12
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +70 -13
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +3 -3
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +106 -36
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +57 -0
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +57 -0
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/PrintPlugin.d.ts.map +1 -1
- package/lib/plugins/print/index.js +58 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/reorder/column-drag.d.ts +2 -2
- package/lib/plugins/reorder/index.js +68 -17
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts +6 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +1 -1
- package/lib/plugins/responsive/index.js +125 -54
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +169 -112
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +14 -2
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +84 -7
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +79 -22
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts +7 -1
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +140 -58
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +6 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js +79 -10
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +57 -0
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +80 -2
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +25 -25
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +15 -15
- 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/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +2 -2
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.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/reorder.umd.js +1 -1
- package/umd/plugins/reorder.umd.js.map +1 -1
- package/umd/plugins/responsive.umd.js +1 -1
- package/umd/plugins/responsive.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.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 +1 -1
- package/umd/plugins/undo-redo.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginManifest, BaseGridPlugin, CellClickEvent, GridElement } from '../../core/plugin/base-plugin';
|
|
1
|
+
import { PluginManifest, PluginQuery, BaseGridPlugin, CellClickEvent, GridElement } from '../../core/plugin/base-plugin';
|
|
2
2
|
import { ColumnConfig, RowElementInternal } from '../../core/types';
|
|
3
3
|
import { EditingConfig } from './types';
|
|
4
4
|
/**
|
|
@@ -111,6 +111,11 @@ export declare class EditingPlugin<T = unknown> extends BaseGridPlugin<EditingCo
|
|
|
111
111
|
attach(grid: GridElement): void;
|
|
112
112
|
/** @internal */
|
|
113
113
|
detach(): void;
|
|
114
|
+
/**
|
|
115
|
+
* Handle plugin queries.
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
handleQuery(query: PluginQuery): unknown;
|
|
114
119
|
/**
|
|
115
120
|
* Handle cell clicks - start editing if configured for click mode.
|
|
116
121
|
* Both click and dblclick events come through this handler.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditingPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/editing/EditingPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"EditingPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/editing/EditingPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACtG,OAAO,KAAK,EACV,YAAY,EAIZ,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAA4C,aAAa,EAAkC,MAAM,SAAS,CAAC;AAMvH;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;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIvC;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI1D;;;OAGG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAYvC;;;OAGG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIxC;;;;OAIG;IACH,gBAAgB,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAexC;;;;;OAKG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAepD;;;;;OAKG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IA2CrC;;;OAGG;IACH,mBAAmB,IAAI,IAAI;IAM3B;;OAEG;IACH,mBAAmB,IAAI,IAAI;CA6d5B"}
|
|
@@ -2,23 +2,23 @@ const R = "data-animating", A = {
|
|
|
2
2
|
change: "--tbw-row-change-duration",
|
|
3
3
|
insert: "--tbw-row-insert-duration",
|
|
4
4
|
remove: "--tbw-row-remove-duration"
|
|
5
|
-
},
|
|
5
|
+
}, P = {
|
|
6
6
|
change: 500,
|
|
7
7
|
insert: 300,
|
|
8
8
|
remove: 200
|
|
9
9
|
};
|
|
10
|
-
function
|
|
10
|
+
function T(s) {
|
|
11
11
|
const e = s.trim().toLowerCase();
|
|
12
12
|
return e.endsWith("ms") ? parseFloat(e) : e.endsWith("s") ? parseFloat(e) * 1e3 : parseFloat(e);
|
|
13
13
|
}
|
|
14
14
|
function I(s, e) {
|
|
15
15
|
const i = A[e], t = getComputedStyle(s).getPropertyValue(i);
|
|
16
16
|
if (t) {
|
|
17
|
-
const r =
|
|
17
|
+
const r = T(t);
|
|
18
18
|
if (!isNaN(r) && r > 0)
|
|
19
19
|
return r;
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return P[e];
|
|
22
22
|
}
|
|
23
23
|
function D(s, e, i) {
|
|
24
24
|
s.removeAttribute(R), s.offsetWidth, s.setAttribute(R, e);
|
|
@@ -178,6 +178,63 @@ class O {
|
|
|
178
178
|
const t = new CustomEvent(e, { detail: i, bubbles: !0, cancelable: !0 });
|
|
179
179
|
return this.grid?.dispatchEvent?.(t), t.defaultPrevented;
|
|
180
180
|
}
|
|
181
|
+
// =========================================================================
|
|
182
|
+
// Event Bus - Plugin-to-Plugin Communication
|
|
183
|
+
// =========================================================================
|
|
184
|
+
/**
|
|
185
|
+
* Subscribe to an event from another plugin.
|
|
186
|
+
* The subscription is automatically cleaned up when this plugin is detached.
|
|
187
|
+
*
|
|
188
|
+
* @category Plugin Development
|
|
189
|
+
* @param eventType - The event type to listen for (e.g., 'filter-change')
|
|
190
|
+
* @param callback - The callback to invoke when the event is emitted
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```typescript
|
|
194
|
+
* // In attach() or other initialization
|
|
195
|
+
* this.on('filter-change', (detail) => {
|
|
196
|
+
* console.log('Filter changed:', detail);
|
|
197
|
+
* });
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
on(e, i) {
|
|
201
|
+
this.grid?._pluginManager?.subscribe(this, e, i);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Unsubscribe from a plugin event.
|
|
205
|
+
*
|
|
206
|
+
* @category Plugin Development
|
|
207
|
+
* @param eventType - The event type to stop listening for
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* this.off('filter-change');
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
off(e) {
|
|
215
|
+
this.grid?._pluginManager?.unsubscribe(this, e);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Emit an event to other plugins via the Event Bus.
|
|
219
|
+
* This is for inter-plugin communication only; it does NOT dispatch DOM events.
|
|
220
|
+
* Use `emit()` to dispatch DOM events that external consumers can listen to.
|
|
221
|
+
*
|
|
222
|
+
* @category Plugin Development
|
|
223
|
+
* @param eventType - The event type to emit (should be declared in manifest.events)
|
|
224
|
+
* @param detail - The event payload
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```typescript
|
|
228
|
+
* // Emit to other plugins (not DOM)
|
|
229
|
+
* this.emitPluginEvent('filter-change', { field: 'name', value: 'Alice' });
|
|
230
|
+
*
|
|
231
|
+
* // For DOM events that consumers can addEventListener to:
|
|
232
|
+
* this.emit('filter-change', { field: 'name', value: 'Alice' });
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
emitPluginEvent(e, i) {
|
|
236
|
+
this.grid?._pluginManager?.emitPluginEvent(e, i);
|
|
237
|
+
}
|
|
181
238
|
/**
|
|
182
239
|
* Request a re-render of the grid.
|
|
183
240
|
*/
|
|
@@ -355,13 +412,13 @@ function H(s) {
|
|
|
355
412
|
}), t;
|
|
356
413
|
};
|
|
357
414
|
}
|
|
358
|
-
function
|
|
415
|
+
function G() {
|
|
359
416
|
return (s) => {
|
|
360
417
|
const e = document.createElement("input");
|
|
361
418
|
return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
|
|
362
419
|
};
|
|
363
420
|
}
|
|
364
|
-
function
|
|
421
|
+
function x(s) {
|
|
365
422
|
return (e) => {
|
|
366
423
|
const i = s.editorParams, t = document.createElement("input");
|
|
367
424
|
return t.type = "date", e.value instanceof Date && (t.valueAsDate = e.value), i?.min && (t.min = i.min), i?.max && (t.max = i.max), i?.placeholder && (t.placeholder = i.placeholder), t.addEventListener("change", () => e.commit(t.valueAsDate)), t.addEventListener("keydown", (r) => {
|
|
@@ -405,9 +462,9 @@ function z(s) {
|
|
|
405
462
|
case "number":
|
|
406
463
|
return H(s);
|
|
407
464
|
case "boolean":
|
|
408
|
-
return
|
|
465
|
+
return G();
|
|
409
466
|
case "date":
|
|
410
|
-
return
|
|
467
|
+
return x(s);
|
|
411
468
|
case "select":
|
|
412
469
|
return $(s);
|
|
413
470
|
default:
|
|
@@ -444,13 +501,13 @@ function E(s, e) {
|
|
|
444
501
|
}
|
|
445
502
|
function k(s) {
|
|
446
503
|
}
|
|
447
|
-
function
|
|
504
|
+
function W(s, e, i) {
|
|
448
505
|
const t = s.querySelector("input,textarea,select");
|
|
449
506
|
t && (t.addEventListener("blur", () => {
|
|
450
507
|
i(E(t, e));
|
|
451
508
|
}), t instanceof HTMLInputElement && t.type === "checkbox" ? t.addEventListener("change", () => i(t.checked)) : t instanceof HTMLSelectElement && t.addEventListener("change", () => i(E(t, e))));
|
|
452
509
|
}
|
|
453
|
-
class
|
|
510
|
+
class K extends O {
|
|
454
511
|
/**
|
|
455
512
|
* Plugin manifest - declares owned properties for configuration validation.
|
|
456
513
|
* @internal
|
|
@@ -473,6 +530,18 @@ class W extends O {
|
|
|
473
530
|
level: "column",
|
|
474
531
|
description: 'the "editorParams" column property'
|
|
475
532
|
}
|
|
533
|
+
],
|
|
534
|
+
events: [
|
|
535
|
+
{
|
|
536
|
+
type: "cell-edit-committed",
|
|
537
|
+
description: "Emitted when a cell edit is committed (for plugin-to-plugin coordination)"
|
|
538
|
+
}
|
|
539
|
+
],
|
|
540
|
+
queries: [
|
|
541
|
+
{
|
|
542
|
+
type: "isEditing",
|
|
543
|
+
description: "Returns whether any cell is currently being edited"
|
|
544
|
+
}
|
|
476
545
|
]
|
|
477
546
|
};
|
|
478
547
|
/** @internal */
|
|
@@ -534,6 +603,14 @@ class W extends O {
|
|
|
534
603
|
detach() {
|
|
535
604
|
this.#e = -1, this.#s = -1, this.#r.clear(), this.#t.clear(), this.#n.clear(), super.detach();
|
|
536
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* Handle plugin queries.
|
|
608
|
+
* @internal
|
|
609
|
+
*/
|
|
610
|
+
handleQuery(e) {
|
|
611
|
+
if (e.type === "isEditing")
|
|
612
|
+
return this.#e !== -1;
|
|
613
|
+
}
|
|
537
614
|
// #endregion
|
|
538
615
|
// #region Event Handlers (event distribution)
|
|
539
616
|
/**
|
|
@@ -874,7 +951,12 @@ class W extends O {
|
|
|
874
951
|
firstTimeForRow: c,
|
|
875
952
|
updateRow: f
|
|
876
953
|
})) return;
|
|
877
|
-
r[n] = t, l && this.#t.add(l), this.#a()
|
|
954
|
+
r[n] = t, l && this.#t.add(l), this.#a(), this.emitPluginEvent("cell-edit-committed", {
|
|
955
|
+
rowIndex: e,
|
|
956
|
+
field: n,
|
|
957
|
+
oldValue: o,
|
|
958
|
+
newValue: t
|
|
959
|
+
});
|
|
878
960
|
const d = a.findRenderedRowElement?.(e);
|
|
879
961
|
d && (d.classList.add("changed"), D(d, "change"));
|
|
880
962
|
}
|
|
@@ -920,7 +1002,7 @@ class W extends O {
|
|
|
920
1002
|
cancel: h,
|
|
921
1003
|
updateRow: l
|
|
922
1004
|
}, w = b(u);
|
|
923
|
-
typeof w == "string" ? (p.innerHTML = w,
|
|
1005
|
+
typeof w == "string" ? (p.innerHTML = w, W(p, t, d)) : w instanceof Node && p.appendChild(w), o || queueMicrotask(() => {
|
|
924
1006
|
p.querySelector(_)?.focus({ preventScroll: !0 });
|
|
925
1007
|
});
|
|
926
1008
|
} else if (b && typeof b == "object") {
|
|
@@ -1005,7 +1087,7 @@ class W extends O {
|
|
|
1005
1087
|
// #endregion
|
|
1006
1088
|
}
|
|
1007
1089
|
export {
|
|
1008
|
-
|
|
1090
|
+
K as EditingPlugin,
|
|
1009
1091
|
z as defaultEditorFor
|
|
1010
1092
|
};
|
|
1011
1093
|
//# sourceMappingURL=index.js.map
|