@toolbox-web/grid 0.2.2 → 0.2.3

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.
Files changed (36) hide show
  1. package/README.md +46 -0
  2. package/all.d.ts +327 -178
  3. package/all.js +328 -287
  4. package/all.js.map +1 -1
  5. package/index.d.ts +219 -113
  6. package/index.js +1182 -1108
  7. package/index.js.map +1 -1
  8. package/lib/plugins/clipboard/index.js.map +1 -1
  9. package/lib/plugins/column-virtualization/index.js.map +1 -1
  10. package/lib/plugins/context-menu/index.js.map +1 -1
  11. package/lib/plugins/export/index.js.map +1 -1
  12. package/lib/plugins/filtering/index.js.map +1 -1
  13. package/lib/plugins/grouping-columns/index.js.map +1 -1
  14. package/lib/plugins/grouping-rows/index.js.map +1 -1
  15. package/lib/plugins/master-detail/index.js.map +1 -1
  16. package/lib/plugins/multi-sort/index.js.map +1 -1
  17. package/lib/plugins/pinned-columns/index.js +91 -48
  18. package/lib/plugins/pinned-columns/index.js.map +1 -1
  19. package/lib/plugins/pinned-rows/index.js.map +1 -1
  20. package/lib/plugins/pivot/index.js.map +1 -1
  21. package/lib/plugins/reorder/index.js +38 -35
  22. package/lib/plugins/reorder/index.js.map +1 -1
  23. package/lib/plugins/selection/index.js.map +1 -1
  24. package/lib/plugins/server-side/index.js.map +1 -1
  25. package/lib/plugins/tree/index.js.map +1 -1
  26. package/lib/plugins/undo-redo/index.js.map +1 -1
  27. package/lib/plugins/visibility/index.js.map +1 -1
  28. package/package.json +1 -1
  29. package/umd/grid.all.umd.js +19 -19
  30. package/umd/grid.all.umd.js.map +1 -1
  31. package/umd/grid.umd.js +16 -16
  32. package/umd/grid.umd.js.map +1 -1
  33. package/umd/plugins/pinned-columns.umd.js +1 -1
  34. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  35. package/umd/plugins/reorder.umd.js +1 -1
  36. package/umd/plugins/reorder.umd.js.map +1 -1
package/README.md CHANGED
@@ -423,6 +423,52 @@ export class MyPlugin extends BaseGridPlugin<MyPluginConfig> {
423
423
  }
424
424
  ```
425
425
 
426
+ ### Inter-Plugin Communication
427
+
428
+ Plugins can communicate with each other using the generic query system. This allows plugins to expose capabilities or constraints without the core knowing about specific plugin concepts.
429
+
430
+ **Responding to queries (in your plugin):**
431
+
432
+ ```typescript
433
+ import { BaseGridPlugin, PLUGIN_QUERIES, PluginQuery } from '@toolbox-web/grid';
434
+
435
+ export class MyPlugin extends BaseGridPlugin<MyConfig> {
436
+ override onPluginQuery(query: PluginQuery): unknown {
437
+ switch (query.type) {
438
+ case PLUGIN_QUERIES.CAN_MOVE_COLUMN:
439
+ // Veto column movement for locked columns
440
+ const column = query.context as ColumnConfig;
441
+ if (this.isLocked(column)) return false;
442
+ return undefined; // Let other plugins decide
443
+ default:
444
+ return undefined;
445
+ }
446
+ }
447
+ }
448
+ ```
449
+
450
+ **Querying other plugins:**
451
+
452
+ ```typescript
453
+ import { PLUGIN_QUERIES } from '@toolbox-web/grid';
454
+
455
+ // In your plugin or application code
456
+ const responses = grid.queryPlugins<boolean>({
457
+ type: PLUGIN_QUERIES.CAN_MOVE_COLUMN,
458
+ context: column,
459
+ });
460
+ const canMove = !responses.includes(false);
461
+ ```
462
+
463
+ **Built-in query types:**
464
+
465
+ | Query Type | Context | Response | Description |
466
+ | ------------------------ | ------------------- | ------------------- | ------------------------------- |
467
+ | `CAN_MOVE_COLUMN` | `ColumnConfig` | `boolean` | Can the column be reordered? |
468
+ | `GET_CONTEXT_MENU_ITEMS` | `ContextMenuParams` | `ContextMenuItem[]` | Get menu items for context menu |
469
+
470
+ Plugins can also define custom query types for their own inter-plugin communication.
471
+
426
472
  ### Accessing Plugin Instances
427
473
 
428
474
  Use `grid.getPlugin()` to get a plugin instance for inter-plugin communication or API access: