@toolbox-web/grid 0.2.8 → 0.3.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.
Files changed (273) hide show
  1. package/README.md +13 -13
  2. package/all.d.ts +25 -5659
  3. package/all.d.ts.map +1 -0
  4. package/all.js +524 -450
  5. package/all.js.map +1 -1
  6. package/index.d.ts +8 -2678
  7. package/index.d.ts.map +1 -0
  8. package/index.js +3929 -25
  9. package/index.js.map +1 -1
  10. package/lib/core/constants.d.ts +114 -0
  11. package/lib/core/constants.d.ts.map +1 -0
  12. package/lib/core/grid.d.ts +337 -0
  13. package/lib/core/grid.d.ts.map +1 -0
  14. package/lib/core/internal/aggregators.d.ts +67 -0
  15. package/lib/core/internal/aggregators.d.ts.map +1 -0
  16. package/lib/core/internal/column-state.d.ts +124 -0
  17. package/lib/core/internal/column-state.d.ts.map +1 -0
  18. package/lib/core/internal/columns.d.ts +107 -0
  19. package/lib/core/internal/columns.d.ts.map +1 -0
  20. package/lib/core/internal/dom-builder.d.ts +115 -0
  21. package/lib/core/internal/dom-builder.d.ts.map +1 -0
  22. package/lib/core/internal/editing.d.ts +76 -0
  23. package/lib/core/internal/editing.d.ts.map +1 -0
  24. package/lib/core/internal/editors.d.ts +8 -0
  25. package/lib/core/internal/editors.d.ts.map +1 -0
  26. package/lib/core/internal/event-delegation.d.ts +11 -0
  27. package/lib/core/internal/event-delegation.d.ts.map +1 -0
  28. package/lib/core/internal/grid-internals.d.ts +83 -0
  29. package/lib/core/internal/grid-internals.d.ts.map +1 -0
  30. package/lib/core/internal/header.d.ts +7 -0
  31. package/lib/core/internal/header.d.ts.map +1 -0
  32. package/lib/core/internal/idle-scheduler.d.ts +65 -0
  33. package/lib/core/internal/idle-scheduler.d.ts.map +1 -0
  34. package/lib/core/internal/inference.d.ts +12 -0
  35. package/lib/core/internal/inference.d.ts.map +1 -0
  36. package/lib/core/internal/keyboard.d.ts +18 -0
  37. package/lib/core/internal/keyboard.d.ts.map +1 -0
  38. package/lib/core/internal/resize.d.ts +3 -0
  39. package/lib/core/internal/resize.d.ts.map +1 -0
  40. package/lib/core/internal/rows.d.ts +35 -0
  41. package/lib/core/internal/rows.d.ts.map +1 -0
  42. package/lib/core/internal/sanitize.d.ts +13 -0
  43. package/lib/core/internal/sanitize.d.ts.map +1 -0
  44. package/lib/core/internal/shell.d.ts +228 -0
  45. package/lib/core/internal/shell.d.ts.map +1 -0
  46. package/lib/core/internal/sorting.d.ts +24 -0
  47. package/lib/core/internal/sorting.d.ts.map +1 -0
  48. package/lib/core/internal/touch-scroll.d.ts +54 -0
  49. package/lib/core/internal/touch-scroll.d.ts.map +1 -0
  50. package/lib/core/internal/utils.d.ts +38 -0
  51. package/lib/core/internal/utils.d.ts.map +1 -0
  52. package/lib/core/internal/virtualization.d.ts +66 -0
  53. package/lib/core/internal/virtualization.d.ts.map +1 -0
  54. package/lib/core/plugin/base-plugin.d.ts +616 -0
  55. package/lib/core/plugin/base-plugin.d.ts.map +1 -0
  56. package/lib/core/plugin/index.d.ts +11 -0
  57. package/lib/core/plugin/index.d.ts.map +1 -0
  58. package/lib/core/plugin/plugin-manager.d.ts +183 -0
  59. package/lib/core/plugin/plugin-manager.d.ts.map +1 -0
  60. package/lib/core/plugin/types.d.ts +196 -0
  61. package/lib/core/plugin/types.d.ts.map +1 -0
  62. package/lib/core/types.d.ts +841 -0
  63. package/lib/core/types.d.ts.map +1 -0
  64. package/lib/plugins/clipboard/ClipboardPlugin.d.ts +46 -0
  65. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -0
  66. package/lib/plugins/clipboard/copy.d.ts +47 -0
  67. package/lib/plugins/clipboard/copy.d.ts.map +1 -0
  68. package/lib/plugins/clipboard/index.d.ts +7 -0
  69. package/lib/plugins/clipboard/index.d.ts.map +1 -0
  70. package/lib/plugins/clipboard/index.js.map +1 -1
  71. package/lib/plugins/clipboard/paste.d.ts +25 -0
  72. package/lib/plugins/clipboard/paste.d.ts.map +1 -0
  73. package/lib/plugins/clipboard/types.d.ts +40 -0
  74. package/lib/plugins/clipboard/types.d.ts.map +1 -0
  75. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +54 -0
  76. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -0
  77. package/lib/plugins/column-virtualization/column-virtualization.d.ts +53 -0
  78. package/lib/plugins/column-virtualization/column-virtualization.d.ts.map +1 -0
  79. package/lib/plugins/column-virtualization/index.d.ts +7 -0
  80. package/lib/plugins/column-virtualization/index.d.ts.map +1 -0
  81. package/lib/plugins/column-virtualization/index.js.map +1 -1
  82. package/lib/plugins/column-virtualization/types.d.ts +41 -0
  83. package/lib/plugins/column-virtualization/types.d.ts.map +1 -0
  84. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +52 -0
  85. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -0
  86. package/lib/plugins/context-menu/index.d.ts +7 -0
  87. package/lib/plugins/context-menu/index.d.ts.map +1 -0
  88. package/lib/plugins/context-menu/index.js +24 -24
  89. package/lib/plugins/context-menu/index.js.map +1 -1
  90. package/lib/plugins/context-menu/menu.d.ts +38 -0
  91. package/lib/plugins/context-menu/menu.d.ts.map +1 -0
  92. package/lib/plugins/context-menu/types.d.ts +77 -0
  93. package/lib/plugins/context-menu/types.d.ts.map +1 -0
  94. package/lib/plugins/export/ExportPlugin.d.ts +53 -0
  95. package/lib/plugins/export/ExportPlugin.d.ts.map +1 -0
  96. package/lib/plugins/export/csv.d.ts +31 -0
  97. package/lib/plugins/export/csv.d.ts.map +1 -0
  98. package/lib/plugins/export/excel.d.ts +12 -0
  99. package/lib/plugins/export/excel.d.ts.map +1 -0
  100. package/lib/plugins/export/index.d.ts +7 -0
  101. package/lib/plugins/export/index.d.ts.map +1 -0
  102. package/lib/plugins/export/index.js.map +1 -1
  103. package/lib/plugins/export/types.d.ts +57 -0
  104. package/lib/plugins/export/types.d.ts.map +1 -0
  105. package/lib/plugins/filtering/FilteringPlugin.d.ts +128 -0
  106. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -0
  107. package/lib/plugins/filtering/filter-model.d.ts +38 -0
  108. package/lib/plugins/filtering/filter-model.d.ts.map +1 -0
  109. package/lib/plugins/filtering/index.d.ts +7 -0
  110. package/lib/plugins/filtering/index.d.ts.map +1 -0
  111. package/lib/plugins/filtering/index.js +5 -5
  112. package/lib/plugins/filtering/index.js.map +1 -1
  113. package/lib/plugins/filtering/types.d.ts +157 -0
  114. package/lib/plugins/filtering/types.d.ts.map +1 -0
  115. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +51 -0
  116. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -0
  117. package/lib/plugins/grouping-columns/grouping-columns.d.ts +41 -0
  118. package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +1 -0
  119. package/lib/plugins/grouping-columns/index.d.ts +7 -0
  120. package/lib/plugins/grouping-columns/index.d.ts.map +1 -0
  121. package/lib/plugins/grouping-columns/index.js +58 -42
  122. package/lib/plugins/grouping-columns/index.js.map +1 -1
  123. package/lib/plugins/grouping-columns/types.d.ts +91 -0
  124. package/lib/plugins/grouping-columns/types.d.ts.map +1 -0
  125. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +120 -0
  126. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -0
  127. package/lib/plugins/grouping-rows/grouping-rows.d.ts +51 -0
  128. package/lib/plugins/grouping-rows/grouping-rows.d.ts.map +1 -0
  129. package/lib/plugins/grouping-rows/index.d.ts +7 -0
  130. package/lib/plugins/grouping-rows/index.d.ts.map +1 -0
  131. package/lib/plugins/grouping-rows/index.js +51 -51
  132. package/lib/plugins/grouping-rows/index.js.map +1 -1
  133. package/lib/plugins/grouping-rows/types.d.ts +95 -0
  134. package/lib/plugins/grouping-rows/types.d.ts.map +1 -0
  135. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +147 -0
  136. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -0
  137. package/lib/plugins/master-detail/index.d.ts +7 -0
  138. package/lib/plugins/master-detail/index.d.ts.map +1 -0
  139. package/lib/plugins/master-detail/index.js +235 -78
  140. package/lib/plugins/master-detail/index.js.map +1 -1
  141. package/lib/plugins/master-detail/master-detail.d.ts +30 -0
  142. package/lib/plugins/master-detail/master-detail.d.ts.map +1 -0
  143. package/lib/plugins/master-detail/types.d.ts +40 -0
  144. package/lib/plugins/master-detail/types.d.ts.map +1 -0
  145. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +58 -0
  146. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -0
  147. package/lib/plugins/multi-sort/index.d.ts +7 -0
  148. package/lib/plugins/multi-sort/index.d.ts.map +1 -0
  149. package/lib/plugins/multi-sort/index.js.map +1 -1
  150. package/lib/plugins/multi-sort/multi-sort.d.ts +51 -0
  151. package/lib/plugins/multi-sort/multi-sort.d.ts.map +1 -0
  152. package/lib/plugins/multi-sort/types.d.ts +25 -0
  153. package/lib/plugins/multi-sort/types.d.ts.map +1 -0
  154. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +58 -0
  155. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -0
  156. package/lib/plugins/pinned-columns/index.d.ts +7 -0
  157. package/lib/plugins/pinned-columns/index.d.ts.map +1 -0
  158. package/lib/plugins/pinned-columns/index.js.map +1 -1
  159. package/lib/plugins/pinned-columns/pinned-columns.d.ts +62 -0
  160. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -0
  161. package/lib/plugins/pinned-columns/types.d.ts +20 -0
  162. package/lib/plugins/pinned-columns/types.d.ts.map +1 -0
  163. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +64 -0
  164. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -0
  165. package/lib/plugins/pinned-rows/index.d.ts +7 -0
  166. package/lib/plugins/pinned-rows/index.d.ts.map +1 -0
  167. package/lib/plugins/pinned-rows/index.js +1 -1
  168. package/lib/plugins/pinned-rows/index.js.map +1 -1
  169. package/lib/plugins/pinned-rows/pinned-rows.d.ts +43 -0
  170. package/lib/plugins/pinned-rows/pinned-rows.d.ts.map +1 -0
  171. package/lib/plugins/pinned-rows/types.d.ts +95 -0
  172. package/lib/plugins/pinned-rows/types.d.ts.map +1 -0
  173. package/lib/plugins/pivot/PivotPlugin.d.ts +94 -0
  174. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -0
  175. package/lib/plugins/pivot/index.d.ts +7 -0
  176. package/lib/plugins/pivot/index.d.ts.map +1 -0
  177. package/lib/plugins/pivot/index.js.map +1 -1
  178. package/lib/plugins/pivot/pivot-engine.d.ts +50 -0
  179. package/lib/plugins/pivot/pivot-engine.d.ts.map +1 -0
  180. package/lib/plugins/pivot/pivot-model.d.ts +6 -0
  181. package/lib/plugins/pivot/pivot-model.d.ts.map +1 -0
  182. package/lib/plugins/pivot/pivot-panel.d.ts +25 -0
  183. package/lib/plugins/pivot/pivot-panel.d.ts.map +1 -0
  184. package/lib/plugins/pivot/pivot-rows.d.ts +33 -0
  185. package/lib/plugins/pivot/pivot-rows.d.ts.map +1 -0
  186. package/lib/plugins/pivot/types.d.ts +62 -0
  187. package/lib/plugins/pivot/types.d.ts.map +1 -0
  188. package/lib/plugins/reorder/ReorderPlugin.d.ts +81 -0
  189. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -0
  190. package/lib/plugins/reorder/column-drag.d.ts +41 -0
  191. package/lib/plugins/reorder/column-drag.d.ts.map +1 -0
  192. package/lib/plugins/reorder/index.d.ts +7 -0
  193. package/lib/plugins/reorder/index.d.ts.map +1 -0
  194. package/lib/plugins/reorder/index.js +51 -48
  195. package/lib/plugins/reorder/index.js.map +1 -1
  196. package/lib/plugins/reorder/types.d.ts +54 -0
  197. package/lib/plugins/reorder/types.d.ts.map +1 -0
  198. package/lib/plugins/selection/SelectionPlugin.d.ts +77 -0
  199. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -0
  200. package/lib/plugins/selection/index.d.ts +8 -0
  201. package/lib/plugins/selection/index.d.ts.map +1 -0
  202. package/lib/plugins/selection/index.js +86 -75
  203. package/lib/plugins/selection/index.js.map +1 -1
  204. package/lib/plugins/selection/range-selection.d.ts +109 -0
  205. package/lib/plugins/selection/range-selection.d.ts.map +1 -0
  206. package/lib/plugins/selection/row-selection.d.ts +48 -0
  207. package/lib/plugins/selection/row-selection.d.ts.map +1 -0
  208. package/lib/plugins/selection/types.d.ts +80 -0
  209. package/lib/plugins/selection/types.d.ts.map +1 -0
  210. package/lib/plugins/server-side/ServerSidePlugin.d.ts +56 -0
  211. package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -0
  212. package/lib/plugins/server-side/cache.d.ts +14 -0
  213. package/lib/plugins/server-side/cache.d.ts.map +1 -0
  214. package/lib/plugins/server-side/datasource.d.ts +12 -0
  215. package/lib/plugins/server-side/datasource.d.ts.map +1 -0
  216. package/lib/plugins/server-side/index.d.ts +7 -0
  217. package/lib/plugins/server-side/index.d.ts.map +1 -0
  218. package/lib/plugins/server-side/index.js.map +1 -1
  219. package/lib/plugins/server-side/types.d.ts +43 -0
  220. package/lib/plugins/server-side/types.d.ts.map +1 -0
  221. package/lib/plugins/tree/TreePlugin.d.ts +49 -0
  222. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -0
  223. package/lib/plugins/tree/index.d.ts +8 -0
  224. package/lib/plugins/tree/index.d.ts.map +1 -0
  225. package/lib/plugins/tree/index.js.map +1 -1
  226. package/lib/plugins/tree/tree-data.d.ts +42 -0
  227. package/lib/plugins/tree/tree-data.d.ts.map +1 -0
  228. package/lib/plugins/tree/tree-detect.d.ts +24 -0
  229. package/lib/plugins/tree/tree-detect.d.ts.map +1 -0
  230. package/lib/plugins/tree/types.d.ts +61 -0
  231. package/lib/plugins/tree/types.d.ts.map +1 -0
  232. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +68 -0
  233. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -0
  234. package/lib/plugins/undo-redo/history.d.ts +64 -0
  235. package/lib/plugins/undo-redo/history.d.ts.map +1 -0
  236. package/lib/plugins/undo-redo/index.d.ts +7 -0
  237. package/lib/plugins/undo-redo/index.d.ts.map +1 -0
  238. package/lib/plugins/undo-redo/index.js.map +1 -1
  239. package/lib/plugins/undo-redo/types.d.ts +41 -0
  240. package/lib/plugins/undo-redo/types.d.ts.map +1 -0
  241. package/lib/plugins/visibility/VisibilityPlugin.d.ts +135 -0
  242. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -0
  243. package/lib/plugins/visibility/index.d.ts +8 -0
  244. package/lib/plugins/visibility/index.d.ts.map +1 -0
  245. package/lib/plugins/visibility/index.js.map +1 -1
  246. package/lib/plugins/visibility/types.d.ts +33 -0
  247. package/lib/plugins/visibility/types.d.ts.map +1 -0
  248. package/lib/plugins/visibility/visibility.d.ts +30 -0
  249. package/lib/plugins/visibility/visibility.d.ts.map +1 -0
  250. package/package.json +6 -2
  251. package/public.d.ts +52 -0
  252. package/public.d.ts.map +1 -0
  253. package/umd/grid.all.umd.js +32 -74
  254. package/umd/grid.all.umd.js.map +1 -1
  255. package/umd/grid.umd.js +22 -64
  256. package/umd/grid.umd.js.map +1 -1
  257. package/umd/plugins/context-menu.umd.js +1 -1
  258. package/umd/plugins/context-menu.umd.js.map +1 -1
  259. package/umd/plugins/filtering.umd.js +1 -1
  260. package/umd/plugins/filtering.umd.js.map +1 -1
  261. package/umd/plugins/grouping-columns.umd.js +1 -1
  262. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  263. package/umd/plugins/grouping-rows.umd.js +1 -1
  264. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  265. package/umd/plugins/master-detail.umd.js +1 -1
  266. package/umd/plugins/master-detail.umd.js.map +1 -1
  267. package/umd/plugins/pinned-rows.umd.js +1 -1
  268. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  269. package/umd/plugins/pivot.umd.js.map +1 -1
  270. package/umd/plugins/selection.umd.js +1 -1
  271. package/umd/plugins/selection.umd.js.map +1 -1
  272. package/index-YjW60MHD.js +0 -3235
  273. package/index-YjW60MHD.js.map +0 -1
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Column Virtualization Plugin Types
3
+ *
4
+ * Type definitions for horizontal column virtualization feature.
5
+ */
6
+ /** Configuration options for the column virtualization plugin */
7
+ export interface ColumnVirtualizationConfig {
8
+ /** Auto-enable when column count exceeds threshold (default: true) */
9
+ autoEnable?: boolean;
10
+ /** Column count threshold for auto-enabling (default: 30) */
11
+ threshold?: number;
12
+ /** Extra columns to render on each side for smooth scrolling (default: 3) */
13
+ overscan?: number;
14
+ }
15
+ /** Internal state managed by the column virtualization plugin */
16
+ export interface ColumnVirtualizationState {
17
+ /** Whether virtualization is currently active */
18
+ isVirtualized: boolean;
19
+ /** Index of first visible column */
20
+ startCol: number;
21
+ /** Index of last visible column */
22
+ endCol: number;
23
+ /** Current horizontal scroll position */
24
+ scrollLeft: number;
25
+ /** Total width of all columns */
26
+ totalWidth: number;
27
+ /** Array of individual column widths (px) */
28
+ columnWidths: number[];
29
+ /** Array of column left offsets (px) */
30
+ columnOffsets: number[];
31
+ }
32
+ /** Viewport information for visible columns */
33
+ export interface ColumnVirtualizationViewport {
34
+ /** Index of first visible column */
35
+ startCol: number;
36
+ /** Index of last visible column */
37
+ endCol: number;
38
+ /** Array of visible column indices */
39
+ visibleColumns: number[];
40
+ }
41
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/column-virtualization/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,iEAAiE;AACjE,MAAM,WAAW,0BAA0B;IACzC,sEAAsE;IACtE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,iEAAiE;AACjE,MAAM,WAAW,yBAAyB;IACxC,iDAAiD;IACjD,aAAa,EAAE,OAAO,CAAC;IACvB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,wCAAwC;IACxC,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,+CAA+C;AAC/C,MAAM,WAAW,4BAA4B;IAC3C,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B"}
@@ -0,0 +1,52 @@
1
+ import { BaseGridPlugin } from '../../core/plugin/base-plugin';
2
+ import { ContextMenuConfig, ContextMenuParams } from './types';
3
+ /**
4
+ * Context Menu Plugin for tbw-grid
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * new ContextMenuPlugin({
9
+ * enabled: true,
10
+ * items: [
11
+ * { id: 'edit', name: 'Edit', action: (params) => console.log('Edit', params) },
12
+ * { separator: true, id: 'sep', name: '' },
13
+ * { id: 'delete', name: 'Delete', action: (params) => console.log('Delete', params) },
14
+ * ],
15
+ * })
16
+ * ```
17
+ */
18
+ export declare class ContextMenuPlugin extends BaseGridPlugin<ContextMenuConfig> {
19
+ readonly name = "contextMenu";
20
+ readonly version = "1.0.0";
21
+ protected get defaultConfig(): Partial<ContextMenuConfig>;
22
+ private isOpen;
23
+ private position;
24
+ private params;
25
+ private menuElement;
26
+ attach(grid: import('../../core/plugin/base-plugin').GridElement): void;
27
+ detach(): void;
28
+ private installGlobalHandlers;
29
+ /**
30
+ * Clean up global handlers when the last instance detaches.
31
+ * Uses reference counting to ensure handlers persist while any grid uses the plugin.
32
+ */
33
+ private uninstallGlobalHandlers;
34
+ afterRender(): void;
35
+ /**
36
+ * Programmatically show the context menu at the specified position.
37
+ * @param x - X coordinate
38
+ * @param y - Y coordinate
39
+ * @param params - Partial context menu parameters
40
+ */
41
+ showMenu(x: number, y: number, params: Partial<ContextMenuParams>): void;
42
+ /**
43
+ * Hide the context menu.
44
+ */
45
+ hideMenu(): void;
46
+ /**
47
+ * Check if the context menu is currently open.
48
+ * @returns Whether the menu is open
49
+ */
50
+ isMenuOpen(): boolean;
51
+ }
52
+ //# sourceMappingURL=ContextMenuPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextMenuPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/context-menu/ContextMenuPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,KAAK,EAAE,iBAAiB,EAAmB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAkCrF;;;;;;;;;;;;;;GAcG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,iBAAiB,CAAC;IACtE,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,SAAkB,OAAO,WAAW;IAEpC,cAAuB,aAAa,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAIjE;IAGD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,WAAW,CAA4B;IAKtC,MAAM,CAAC,IAAI,EAAE,OAAO,+BAA+B,EAAE,WAAW,GAAG,IAAI;IAMvE,MAAM,IAAI,IAAI;IAavB,OAAO,CAAC,qBAAqB;IAqC7B;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAsBtB,WAAW,IAAI,IAAI;IA0F5B;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAmCxE;;OAEG;IACH,QAAQ,IAAI,IAAI;IAQhB;;;OAGG;IACH,UAAU,IAAI,OAAO;CAMtB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Context Menu Plugin Entry Point
3
+ * Re-exports plugin class and types for tree-shakeable imports.
4
+ */
5
+ export { ContextMenuPlugin } from './ContextMenuPlugin';
6
+ export type { ContextMenuItem, ContextMenuConfig, ContextMenuParams } from './types';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/context-menu/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
@@ -1,4 +1,4 @@
1
- const y = {
1
+ const C = {
2
2
  expand: "▶",
3
3
  collapse: "▼",
4
4
  sortAsc: "▲",
@@ -8,7 +8,7 @@ const y = {
8
8
  dragHandle: "⋮⋮",
9
9
  toolPanel: "☰"
10
10
  };
11
- class C {
11
+ class I {
12
12
  /** Plugin version - override in subclass if needed */
13
13
  version = "1.0.0";
14
14
  /** CSS styles to inject into the grid's shadow DOM */
@@ -133,7 +133,7 @@ class C {
133
133
  */
134
134
  get gridIcons() {
135
135
  const e = this.grid?.gridConfig?.icons ?? {};
136
- return { ...y, ...e };
136
+ return { ...C, ...e };
137
137
  }
138
138
  /**
139
139
  * Resolve an icon value to string or HTMLElement.
@@ -164,14 +164,14 @@ class C {
164
164
  }
165
165
  // #endregion
166
166
  }
167
- const I = ".tbw-context-menu{position:fixed;background:light-dark(#f5f5f5,#2a2a2a);color:light-dark(#222,#eee);border:1px solid light-dark(#d0d0d4,#454545);border-radius:4px;box-shadow:0 2px 10px #00000026;min-width:160px;padding:4px 0;z-index:10000;font-size:13px;font-family:system-ui,sans-serif}.tbw-context-menu-item{display:flex;align-items:center;padding:6px 12px;cursor:pointer;gap:8px}.tbw-context-menu-item:hover:not(.disabled){background:light-dark(#e8e8e8,#3a3a3a)}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:light-dark(#c00,#f66)}.tbw-context-menu-icon{width:16px;text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:light-dark(#888,#888);font-size:11px}.tbw-context-menu-arrow{font-size:10px;color:light-dark(#888,#888)}.tbw-context-menu-separator{height:1px;background:light-dark(#d0d0d4,#454545);margin:4px 0}";
168
- function x(s, e) {
167
+ const g = ".tbw-context-menu{position:fixed;background:light-dark(#f5f5f5,#2a2a2a);color:light-dark(#222,#eee);border:1px solid light-dark(#d0d0d4,#454545);border-radius:4px;box-shadow:0 2px 10px #00000026;min-width:160px;padding:4px 0;z-index:10000;font-size:13px;font-family:system-ui,sans-serif}.tbw-context-menu-item{display:flex;align-items:center;padding:6px 12px;cursor:pointer;gap:8px}.tbw-context-menu-item:hover:not(.disabled){background:light-dark(#e8e8e8,#3a3a3a)}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:light-dark(#c00,#f66)}.tbw-context-menu-icon{width:16px;text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:light-dark(#888,#888);font-size:11px}.tbw-context-menu-arrow{font-size:10px;color:light-dark(#888,#888)}.tbw-context-menu-separator{height:1px;background:light-dark(#d0d0d4,#454545);margin:4px 0}";
168
+ function w(s, e) {
169
169
  return (typeof s == "function" ? s(e) : s).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
170
170
  }
171
171
  function M(s, e) {
172
172
  return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
173
173
  }
174
- function w(s, e, n, i = y.submenuArrow) {
174
+ function v(s, e, n, i = C.submenuArrow) {
175
175
  const r = document.createElement("div");
176
176
  r.className = "tbw-context-menu", r.setAttribute("role", "menu");
177
177
  for (const o of s) {
@@ -196,7 +196,7 @@ function w(s, e, n, i = y.submenuArrow) {
196
196
  const l = document.createElement("span");
197
197
  l.className = "tbw-context-menu-arrow", typeof i == "string" ? l.innerHTML = i : i instanceof HTMLElement && l.appendChild(i.cloneNode(!0)), t.appendChild(l), t.addEventListener("mouseenter", () => {
198
198
  if (t.querySelector(".tbw-context-menu") || !o.subMenu) return;
199
- const h = x(o.subMenu, e), a = w(h, e, n, i);
199
+ const h = w(o.subMenu, e), a = v(h, e, n, i);
200
200
  a.classList.add("tbw-context-submenu"), a.style.position = "absolute", a.style.left = "100%", a.style.top = "0", t.style.position = "relative", t.appendChild(a);
201
201
  }), t.addEventListener("mouseleave", () => {
202
202
  const u = t.querySelector(".tbw-context-menu");
@@ -209,14 +209,14 @@ function w(s, e, n, i = y.submenuArrow) {
209
209
  }
210
210
  return r;
211
211
  }
212
- function E(s, e, n) {
212
+ function y(s, e, n) {
213
213
  s.style.position = "fixed", s.style.left = `${e}px`, s.style.top = `${n}px`, s.style.visibility = "hidden", s.style.zIndex = "10000";
214
214
  const i = s.getBoundingClientRect(), r = window.innerWidth, o = window.innerHeight;
215
215
  let t = e, c = n;
216
216
  e + i.width > r && (t = e - i.width), n + i.height > o && (c = n - i.height), t = Math.max(0, t), c = Math.max(0, c), s.style.left = `${t}px`, s.style.top = `${c}px`, s.style.visibility = "visible";
217
217
  }
218
- let f = null, p = null, m = null, g = 0;
219
- const b = [
218
+ let f = null, p = null, m = null, b = 0;
219
+ const x = [
220
220
  {
221
221
  id: "copy",
222
222
  name: "Copy",
@@ -234,12 +234,12 @@ const b = [
234
234
  }
235
235
  }
236
236
  ];
237
- class H extends C {
237
+ class H extends I {
238
238
  name = "contextMenu";
239
239
  version = "1.0.0";
240
240
  get defaultConfig() {
241
241
  return {
242
- items: b
242
+ items: x
243
243
  };
244
244
  }
245
245
  // #region Internal State
@@ -250,7 +250,7 @@ class H extends C {
250
250
  // #endregion
251
251
  // #region Lifecycle
252
252
  attach(e) {
253
- super.attach(e), this.installGlobalHandlers(), g++;
253
+ super.attach(e), this.installGlobalHandlers(), b++;
254
254
  }
255
255
  detach() {
256
256
  this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
@@ -258,7 +258,7 @@ class H extends C {
258
258
  // #endregion
259
259
  // #region Private Methods
260
260
  installGlobalHandlers() {
261
- !m && typeof document < "u" && (m = document.createElement("style"), m.id = "tbw-context-menu-styles", m.textContent = I, document.head.appendChild(m)), f || (f = () => {
261
+ !m && typeof document < "u" && typeof g == "string" && g && (m = document.createElement("style"), m.id = "tbw-context-menu-styles", m.textContent = g, document.head.appendChild(m)), f || (f = () => {
262
262
  document.querySelectorAll(".tbw-context-menu").forEach((n) => n.remove());
263
263
  }, document.addEventListener("click", f)), p || (p = (e) => {
264
264
  e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
@@ -269,7 +269,7 @@ class H extends C {
269
269
  * Uses reference counting to ensure handlers persist while any grid uses the plugin.
270
270
  */
271
271
  uninstallGlobalHandlers() {
272
- g--, !(g > 0) && (f && (document.removeEventListener("click", f), f = null), p && (document.removeEventListener("keydown", p), p = null), m && (m.remove(), m = null));
272
+ b--, !(b > 0) && (f && (document.removeEventListener("click", f), f = null), p && (document.removeEventListener("keydown", p), p = null), m && (m.remove(), m = null));
273
273
  }
274
274
  // #endregion
275
275
  // #region Hooks
@@ -283,14 +283,14 @@ class H extends C {
283
283
  const o = r.target, t = o.closest("[data-row][data-col]"), c = o.closest(".header-cell");
284
284
  let d;
285
285
  if (t) {
286
- const u = parseInt(t.getAttribute("data-row") ?? "-1", 10), h = parseInt(t.getAttribute("data-col") ?? "-1", 10), a = this.columns[h], v = this.rows[u];
286
+ const u = parseInt(t.getAttribute("data-row") ?? "-1", 10), h = parseInt(t.getAttribute("data-col") ?? "-1", 10), a = this.columns[h], E = this.rows[u];
287
287
  d = {
288
- row: v,
288
+ row: E,
289
289
  rowIndex: u,
290
290
  column: a,
291
291
  columnIndex: h,
292
292
  field: a?.field ?? "",
293
- value: v?.[a?.field] ?? null,
293
+ value: E?.[a?.field] ?? null,
294
294
  isHeader: !1,
295
295
  event: r
296
296
  };
@@ -309,15 +309,15 @@ class H extends C {
309
309
  } else
310
310
  return;
311
311
  this.params = d, this.position = { x: r.clientX, y: r.clientY };
312
- const l = x(this.config.items ?? b, d);
313
- l.length && (this.menuElement && this.menuElement.remove(), this.menuElement = w(
312
+ const l = w(this.config.items ?? x, d);
313
+ l.length && (this.menuElement && this.menuElement.remove(), this.menuElement = v(
314
314
  l,
315
315
  d,
316
316
  (u) => {
317
317
  u.action && u.action(d), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
318
318
  },
319
319
  this.gridIcons.submenuArrow
320
- ), document.body.appendChild(this.menuElement), E(this.menuElement, r.clientX, r.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: d, items: l }));
320
+ ), document.body.appendChild(this.menuElement), y(this.menuElement, r.clientX, r.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: d, items: l }));
321
321
  }));
322
322
  }
323
323
  // #endregion
@@ -338,15 +338,15 @@ class H extends C {
338
338
  value: i.value ?? null,
339
339
  isHeader: i.isHeader ?? !1,
340
340
  event: i.event ?? new MouseEvent("contextmenu")
341
- }, o = x(this.config.items ?? b, r);
342
- this.menuElement && this.menuElement.remove(), this.menuElement = w(
341
+ }, o = w(this.config.items ?? x, r);
342
+ this.menuElement && this.menuElement.remove(), this.menuElement = v(
343
343
  o,
344
344
  r,
345
345
  (t) => {
346
346
  t.action && t.action(r), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
347
347
  },
348
348
  this.gridIcons.submenuArrow
349
- ), document.body.appendChild(this.menuElement), E(this.menuElement, e, n), this.isOpen = !0;
349
+ ), document.body.appendChild(this.menuElement), y(this.menuElement, e, n), this.isOpen = !0;
350
350
  }
351
351
  /**
352
352
  * Hide the context menu.