@toolbox-web/grid 2.0.0-rc.1 → 2.0.0-rc.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/README.md +23 -6
- package/all.js +2 -2
- package/all.js.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/core/internal/sorting.d.ts +4 -0
- package/lib/core/plugin/base-plugin.d.ts +31 -0
- package/lib/core/plugin/plugin-manager.d.ts +4 -1
- package/lib/core/plugin/types.d.ts +2 -0
- package/lib/core/types.d.ts +20 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +8 -1
- package/lib/plugins/clipboard/index.js +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.js +1 -1
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/ExportPlugin.d.ts +8 -1
- package/lib/plugins/export/index.js +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +33 -1
- package/lib/plugins/grouping-rows/grouping-rows.d.ts +15 -1
- package/lib/plugins/grouping-rows/index.js +2 -2
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/PivotPlugin.d.ts +10 -0
- package/lib/plugins/pivot/index.js +1 -1
- 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/reorder-columns/index.js +1 -1
- package/lib/plugins/reorder-columns/index.js.map +1 -1
- package/lib/plugins/reorder-rows/RowReorderPlugin.d.ts +3 -0
- package/lib/plugins/reorder-rows/index.js +1 -1
- package/lib/plugins/reorder-rows/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/selection/index.js +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tooltip/index.js +1 -1
- package/lib/plugins/tooltip/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts +16 -0
- package/lib/plugins/tree/index.js +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/tree/types.d.ts +6 -0
- package/lib/plugins/undo-redo/index.js +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +1 -1
- 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/clipboard.umd.js +1 -1
- 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/export.umd.js +1 -1
- package/umd/plugins/export.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +1 -1
- package/umd/plugins/grouping-rows.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/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.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/reorder-rows.umd.js +1 -1
- package/umd/plugins/reorder-rows.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 +1 -1
- package/umd/plugins/server-side.umd.js.map +1 -1
- package/umd/plugins/tooltip.umd.js +1 -1
- package/umd/plugins/tooltip.umd.js.map +1 -1
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -711,10 +711,11 @@ export class MyPlugin extends BaseGridPlugin<MyPluginConfig> {
|
|
|
711
711
|
|
|
712
712
|
### Inter-Plugin Communication
|
|
713
713
|
|
|
714
|
-
Plugins can communicate with each other using
|
|
714
|
+
Plugins can communicate with each other using three systems:
|
|
715
715
|
|
|
716
716
|
1. **Event Bus** - For async notifications between plugins
|
|
717
717
|
2. **Query System** - For sync state retrieval
|
|
718
|
+
3. **Broadcast** - For events that both external consumers AND other plugins need
|
|
718
719
|
|
|
719
720
|
#### Event Bus
|
|
720
721
|
|
|
@@ -738,12 +739,23 @@ export class MyPlugin extends BaseGridPlugin<MyConfig> {
|
|
|
738
739
|
}
|
|
739
740
|
|
|
740
741
|
private doSomething(): void {
|
|
741
|
-
// Emit to other plugins (not DOM events)
|
|
742
|
+
// Emit to other plugins only (not DOM events)
|
|
742
743
|
this.emitPluginEvent('my-event', { data: 'value' });
|
|
744
|
+
|
|
745
|
+
// Emit to both plugins AND external addEventListener consumers
|
|
746
|
+
this.broadcast('sort-change', { sortModel: [...this.sortModel] });
|
|
743
747
|
}
|
|
744
748
|
}
|
|
745
749
|
```
|
|
746
750
|
|
|
751
|
+
**Choosing the right emission method:**
|
|
752
|
+
|
|
753
|
+
| Method | Audience | Use when |
|
|
754
|
+
| ------------------------------------ | ------------------ | -------------------------------------------------- |
|
|
755
|
+
| `this.emit(type, detail)` | External consumers | Consumer-facing events with no plugin subscribers |
|
|
756
|
+
| `this.emitPluginEvent(type, detail)` | Other plugins only | Plugin-internal notifications |
|
|
757
|
+
| `this.broadcast(type, detail)` | Both | State changes that both plugins and consumers need |
|
|
758
|
+
|
|
747
759
|
#### Query System
|
|
748
760
|
|
|
749
761
|
Respond to queries from other plugins:
|
|
@@ -784,10 +796,15 @@ const responses = grid.queryPlugins<boolean>({
|
|
|
784
796
|
|
|
785
797
|
**Built-in query types:**
|
|
786
798
|
|
|
787
|
-
| Query Type
|
|
788
|
-
|
|
|
789
|
-
| `
|
|
790
|
-
| `
|
|
799
|
+
| Query Type | Context | Response | Description |
|
|
800
|
+
| --------------------- | ------------------- | ------------------- | ------------------------------- |
|
|
801
|
+
| `sort:get-model` | — | `SortModel` | Get current sort model |
|
|
802
|
+
| `sort:set-model` | `SortModel` | — | Set sort model programmatically |
|
|
803
|
+
| `canMoveColumn` | `ColumnConfig` | `boolean` | Can the column be reordered? |
|
|
804
|
+
| `canMoveRow` | row object | `boolean` | Can the row be reordered? |
|
|
805
|
+
| `clipboard:copy` | — | — | Trigger copy action |
|
|
806
|
+
| `export:csv` | — | — | Trigger CSV export |
|
|
807
|
+
| `getContextMenuItems` | `ContextMenuParams` | `ContextMenuItem[]` | Get menu items for context menu |
|
|
791
808
|
|
|
792
809
|
Plugins can also define custom query types for their own inter-plugin communication.
|
|
793
810
|
|