@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
package/README.md
CHANGED
|
@@ -557,24 +557,59 @@ export class MyPlugin extends BaseGridPlugin<MyPluginConfig> {
|
|
|
557
557
|
|
|
558
558
|
### Inter-Plugin Communication
|
|
559
559
|
|
|
560
|
-
Plugins can communicate with each other using
|
|
560
|
+
Plugins can communicate with each other using two systems:
|
|
561
561
|
|
|
562
|
-
**
|
|
562
|
+
1. **Event Bus** - For async notifications between plugins
|
|
563
|
+
2. **Query System** - For sync state retrieval
|
|
564
|
+
|
|
565
|
+
#### Event Bus
|
|
566
|
+
|
|
567
|
+
Emit and subscribe to plugin events (distinct from DOM events):
|
|
563
568
|
|
|
564
569
|
```typescript
|
|
565
|
-
import { BaseGridPlugin,
|
|
570
|
+
import { BaseGridPlugin, type PluginManifest } from '@toolbox-web/grid';
|
|
566
571
|
|
|
567
572
|
export class MyPlugin extends BaseGridPlugin<MyConfig> {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
573
|
+
// Declare events this plugin emits
|
|
574
|
+
static override readonly manifest: PluginManifest = {
|
|
575
|
+
events: [{ type: 'my-event', description: 'Emitted when something happens' }],
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
override attach(grid: GridElementRef): void {
|
|
579
|
+
super.attach(grid);
|
|
580
|
+
// Subscribe to events from other plugins
|
|
581
|
+
this.on('filter-change', (detail) => {
|
|
582
|
+
console.log('Filter changed:', detail);
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
private doSomething(): void {
|
|
587
|
+
// Emit to other plugins (not DOM events)
|
|
588
|
+
this.emitPluginEvent('my-event', { data: 'value' });
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
#### Query System
|
|
594
|
+
|
|
595
|
+
Respond to queries from other plugins:
|
|
596
|
+
|
|
597
|
+
```typescript
|
|
598
|
+
import { BaseGridPlugin, type PluginManifest, type PluginQuery } from '@toolbox-web/grid';
|
|
599
|
+
|
|
600
|
+
export class MyPlugin extends BaseGridPlugin<MyConfig> {
|
|
601
|
+
// Declare queries this plugin handles
|
|
602
|
+
static override readonly manifest: PluginManifest = {
|
|
603
|
+
queries: [{ type: 'canMoveColumn', description: 'Check if column can be moved' }],
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
override handleQuery(query: PluginQuery): unknown {
|
|
607
|
+
if (query.type === 'canMoveColumn') {
|
|
608
|
+
const column = query.context as ColumnConfig;
|
|
609
|
+
if (this.isLocked(column)) return false;
|
|
610
|
+
return undefined; // Let other plugins decide
|
|
577
611
|
}
|
|
612
|
+
return undefined;
|
|
578
613
|
}
|
|
579
614
|
}
|
|
580
615
|
```
|
|
@@ -582,14 +617,15 @@ export class MyPlugin extends BaseGridPlugin<MyConfig> {
|
|
|
582
617
|
**Querying other plugins:**
|
|
583
618
|
|
|
584
619
|
```typescript
|
|
585
|
-
|
|
620
|
+
// Simplified API
|
|
621
|
+
const responses = grid.query<boolean>('canMoveColumn', column);
|
|
622
|
+
const canMove = !responses.includes(false);
|
|
586
623
|
|
|
587
|
-
//
|
|
624
|
+
// Or full query object
|
|
588
625
|
const responses = grid.queryPlugins<boolean>({
|
|
589
626
|
type: PLUGIN_QUERIES.CAN_MOVE_COLUMN,
|
|
590
627
|
context: column,
|
|
591
628
|
});
|
|
592
|
-
const canMove = !responses.includes(false);
|
|
593
629
|
```
|
|
594
630
|
|
|
595
631
|
**Built-in query types:**
|