@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReorderPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/reorder/ReorderPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"ReorderPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/reorder/ReorderPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAI/D,OAAO,KAAK,EAAoB,aAAa,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,qBAAa,aAAc,SAAQ,cAAc,CAAC,aAAa,CAAC;IAC9D,gBAAgB;IAChB,QAAQ,CAAC,IAAI,aAAa;IAC1B,gBAAgB;IAChB,SAAkB,MAAM,SAAU;IAElC,gBAAgB;IAChB,cAAuB,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,CAI7D;IAED;;;OAGG;IACH,OAAO,KAAK,aAAa,GAQxB;IAED;;;OAGG;IACH,cAAuB,iBAAiB,IAAI,MAAM,CAMjD;IAGD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,SAAS,CAAuB;IAExC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAOhC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IASxB,gBAAgB;IACP,MAAM,CAAC,IAAI,EAAE,OAAO,+BAA+B,EAAE,WAAW,GAAG,IAAI;IAiBhF,gBAAgB;IACP,MAAM,IAAI,IAAI;IAUvB,gBAAgB;IACP,WAAW,IAAI,IAAI;IAiG5B;;;OAGG;IACM,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,IAAI;IAyCxD;;;OAGG;IACH,cAAc,IAAI,MAAM,EAAE;IAI1B;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAoBhD;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAIrC;;OAEG;IACH,gBAAgB,IAAI,IAAI;IAQxB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAS9B;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAmDnB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAgDnB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAqB1B"}
|
|
@@ -4,8 +4,8 @@ import { ColumnConfig } from '../../core/types';
|
|
|
4
4
|
* This checks column-level properties like lockPosition and suppressMovable.
|
|
5
5
|
*
|
|
6
6
|
* Note: For full movability checks including plugin constraints (e.g., pinned columns),
|
|
7
|
-
* use `grid.
|
|
8
|
-
*
|
|
7
|
+
* use `grid.query<boolean>('canMoveColumn', column)` which queries all plugins that
|
|
8
|
+
* declare the 'canMoveColumn' query in their manifest.
|
|
9
9
|
*
|
|
10
10
|
* @param column - The column configuration to check
|
|
11
11
|
* @returns True if the column can be moved based on its metadata
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function v(l) {
|
|
2
2
|
l && l.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
|
|
3
3
|
}
|
|
4
4
|
const C = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', E = document.createElement("template");
|
|
@@ -14,7 +14,7 @@ function y(l, e) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
const t = l._activeEditRows !== void 0 && l._activeEditRows !== -1;
|
|
17
|
-
t || l.refreshVirtualWindow(!1),
|
|
17
|
+
t || l.refreshVirtualWindow(!1), v(l._bodyEl), Array.from(l._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((a) => {
|
|
18
18
|
a.setAttribute("aria-selected", "false");
|
|
19
19
|
});
|
|
20
20
|
const i = l._focusRow, n = l._virtualization.start ?? 0, d = l._virtualization.end ?? l._rows.length;
|
|
@@ -60,11 +60,8 @@ const p = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentCo
|
|
|
60
60
|
filter: p,
|
|
61
61
|
filterActive: p,
|
|
62
62
|
print: "🖨️"
|
|
63
|
-
}, A = {
|
|
64
|
-
/** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
|
|
65
|
-
CAN_MOVE_COLUMN: "canMoveColumn"
|
|
66
63
|
};
|
|
67
|
-
class
|
|
64
|
+
class A {
|
|
68
65
|
/**
|
|
69
66
|
* Plugin dependencies - declare other plugins this one requires.
|
|
70
67
|
*
|
|
@@ -202,6 +199,63 @@ class O {
|
|
|
202
199
|
const i = new CustomEvent(e, { detail: t, bubbles: !0, cancelable: !0 });
|
|
203
200
|
return this.grid?.dispatchEvent?.(i), i.defaultPrevented;
|
|
204
201
|
}
|
|
202
|
+
// =========================================================================
|
|
203
|
+
// Event Bus - Plugin-to-Plugin Communication
|
|
204
|
+
// =========================================================================
|
|
205
|
+
/**
|
|
206
|
+
* Subscribe to an event from another plugin.
|
|
207
|
+
* The subscription is automatically cleaned up when this plugin is detached.
|
|
208
|
+
*
|
|
209
|
+
* @category Plugin Development
|
|
210
|
+
* @param eventType - The event type to listen for (e.g., 'filter-change')
|
|
211
|
+
* @param callback - The callback to invoke when the event is emitted
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* // In attach() or other initialization
|
|
216
|
+
* this.on('filter-change', (detail) => {
|
|
217
|
+
* console.log('Filter changed:', detail);
|
|
218
|
+
* });
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
on(e, t) {
|
|
222
|
+
this.grid?._pluginManager?.subscribe(this, e, t);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Unsubscribe from a plugin event.
|
|
226
|
+
*
|
|
227
|
+
* @category Plugin Development
|
|
228
|
+
* @param eventType - The event type to stop listening for
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```typescript
|
|
232
|
+
* this.off('filter-change');
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
off(e) {
|
|
236
|
+
this.grid?._pluginManager?.unsubscribe(this, e);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Emit an event to other plugins via the Event Bus.
|
|
240
|
+
* This is for inter-plugin communication only; it does NOT dispatch DOM events.
|
|
241
|
+
* Use `emit()` to dispatch DOM events that external consumers can listen to.
|
|
242
|
+
*
|
|
243
|
+
* @category Plugin Development
|
|
244
|
+
* @param eventType - The event type to emit (should be declared in manifest.events)
|
|
245
|
+
* @param detail - The event payload
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```typescript
|
|
249
|
+
* // Emit to other plugins (not DOM)
|
|
250
|
+
* this.emitPluginEvent('filter-change', { field: 'name', value: 'Alice' });
|
|
251
|
+
*
|
|
252
|
+
* // For DOM events that consumers can addEventListener to:
|
|
253
|
+
* this.emit('filter-change', { field: 'name', value: 'Alice' });
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
emitPluginEvent(e, t) {
|
|
257
|
+
this.grid?._pluginManager?.emitPluginEvent(e, t);
|
|
258
|
+
}
|
|
205
259
|
/**
|
|
206
260
|
* Request a re-render of the grid.
|
|
207
261
|
*/
|
|
@@ -368,17 +422,17 @@ function _(l) {
|
|
|
368
422
|
const e = l.meta ?? {};
|
|
369
423
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
370
424
|
}
|
|
371
|
-
function
|
|
425
|
+
function b(l, e, t) {
|
|
372
426
|
if (e === t || e < 0 || e >= l.length || t < 0 || t > l.length) return l;
|
|
373
427
|
const i = [...l], [n] = i.splice(e, 1);
|
|
374
428
|
return i.splice(t, 0, n), i;
|
|
375
429
|
}
|
|
376
|
-
const
|
|
377
|
-
class
|
|
430
|
+
const O = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
|
|
431
|
+
class R extends A {
|
|
378
432
|
/** @internal */
|
|
379
433
|
name = "reorder";
|
|
380
434
|
/** @internal */
|
|
381
|
-
styles =
|
|
435
|
+
styles = O;
|
|
382
436
|
/** @internal */
|
|
383
437
|
get defaultConfig() {
|
|
384
438
|
return {
|
|
@@ -409,10 +463,7 @@ class x extends O {
|
|
|
409
463
|
* Check if a column can be moved, considering both column config and plugin queries.
|
|
410
464
|
*/
|
|
411
465
|
canMoveColumnWithPlugins(e) {
|
|
412
|
-
return !e || !_(e) ? !1 : !this.grid.
|
|
413
|
-
type: A.CAN_MOVE_COLUMN,
|
|
414
|
-
context: e
|
|
415
|
-
}).includes(!1);
|
|
466
|
+
return !e || !_(e) ? !1 : !this.grid.query("canMoveColumn", e).includes(!1);
|
|
416
467
|
}
|
|
417
468
|
/**
|
|
418
469
|
* Clear all drag-related classes from header cells.
|
|
@@ -469,7 +520,7 @@ class x extends O {
|
|
|
469
520
|
const s = this.draggedField, o = this.draggedIndex, c = this.dropIndex;
|
|
470
521
|
if (!this.isDragging || s === null || o === null || c === null)
|
|
471
522
|
return;
|
|
472
|
-
const u = c > o ? c - 1 : c, f = this.getColumnOrder(), g =
|
|
523
|
+
const u = c > o ? c - 1 : c, f = this.getColumnOrder(), g = b(f, o, u), h = {
|
|
473
524
|
field: s,
|
|
474
525
|
fromIndex: o,
|
|
475
526
|
toIndex: u,
|
|
@@ -515,7 +566,7 @@ class x extends O {
|
|
|
515
566
|
moveColumn(e, t) {
|
|
516
567
|
const i = this.getColumnOrder(), n = i.indexOf(e);
|
|
517
568
|
if (n === -1) return;
|
|
518
|
-
const d =
|
|
569
|
+
const d = b(i, n, t);
|
|
519
570
|
this.emitCancelable("column-move", {
|
|
520
571
|
field: e,
|
|
521
572
|
fromIndex: n,
|
|
@@ -636,6 +687,6 @@ class x extends O {
|
|
|
636
687
|
// #endregion
|
|
637
688
|
}
|
|
638
689
|
export {
|
|
639
|
-
|
|
690
|
+
R as ReorderPlugin
|
|
640
691
|
};
|
|
641
692
|
//# sourceMappingURL=index.js.map
|