@toolbox-web/grid 1.23.4 → 1.24.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 (207) hide show
  1. package/README.md +35 -6
  2. package/all.d.ts +2 -2
  3. package/all.d.ts.map +1 -1
  4. package/all.js +2 -2
  5. package/all.js.map +1 -1
  6. package/index.js +1 -1
  7. package/index.js.map +1 -1
  8. package/lib/core/grid.d.ts +21 -0
  9. package/lib/core/grid.d.ts.map +1 -1
  10. package/lib/core/internal/feature-hook.d.ts +8 -0
  11. package/lib/core/internal/feature-hook.d.ts.map +1 -0
  12. package/lib/core/plugin/base-plugin.d.ts +8 -2
  13. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  14. package/lib/core/plugin/types.d.ts +1 -1
  15. package/lib/core/types.d.ts +59 -0
  16. package/lib/core/types.d.ts.map +1 -1
  17. package/lib/features/clipboard.d.ts +8 -0
  18. package/lib/features/clipboard.d.ts.map +1 -0
  19. package/lib/features/clipboard.js +2 -0
  20. package/lib/features/clipboard.js.map +1 -0
  21. package/lib/features/column-virtualization.d.ts +8 -0
  22. package/lib/features/column-virtualization.d.ts.map +1 -0
  23. package/lib/features/column-virtualization.js +2 -0
  24. package/lib/features/column-virtualization.js.map +1 -0
  25. package/lib/features/context-menu.d.ts +8 -0
  26. package/lib/features/context-menu.d.ts.map +1 -0
  27. package/lib/features/context-menu.js +2 -0
  28. package/lib/features/context-menu.js.map +1 -0
  29. package/lib/features/editing.d.ts +8 -0
  30. package/lib/features/editing.d.ts.map +1 -0
  31. package/lib/features/editing.js +2 -0
  32. package/lib/features/editing.js.map +1 -0
  33. package/lib/features/export.d.ts +8 -0
  34. package/lib/features/export.d.ts.map +1 -0
  35. package/lib/features/export.js +2 -0
  36. package/lib/features/export.js.map +1 -0
  37. package/lib/features/filtering.d.ts +8 -0
  38. package/lib/features/filtering.d.ts.map +1 -0
  39. package/lib/features/filtering.js +2 -0
  40. package/lib/features/filtering.js.map +1 -0
  41. package/lib/features/grouping-columns.d.ts +8 -0
  42. package/lib/features/grouping-columns.d.ts.map +1 -0
  43. package/lib/features/grouping-columns.js +2 -0
  44. package/lib/features/grouping-columns.js.map +1 -0
  45. package/lib/features/grouping-rows.d.ts +8 -0
  46. package/lib/features/grouping-rows.d.ts.map +1 -0
  47. package/lib/features/grouping-rows.js +2 -0
  48. package/lib/features/grouping-rows.js.map +1 -0
  49. package/lib/features/magic-string.es-CkyDP9Ir.mjs.map +1 -0
  50. package/lib/features/master-detail.d.ts +8 -0
  51. package/lib/features/master-detail.d.ts.map +1 -0
  52. package/lib/features/master-detail.js +2 -0
  53. package/lib/features/master-detail.js.map +1 -0
  54. package/lib/features/multi-sort.d.ts +10 -0
  55. package/lib/features/multi-sort.d.ts.map +1 -0
  56. package/lib/features/multi-sort.js +2 -0
  57. package/lib/features/multi-sort.js.map +1 -0
  58. package/lib/features/pinned-columns.d.ts +18 -0
  59. package/lib/features/pinned-columns.d.ts.map +1 -0
  60. package/lib/features/pinned-columns.js +2 -0
  61. package/lib/features/pinned-columns.js.map +1 -0
  62. package/lib/features/pinned-rows.d.ts +8 -0
  63. package/lib/features/pinned-rows.d.ts.map +1 -0
  64. package/lib/features/pinned-rows.js +2 -0
  65. package/lib/features/pinned-rows.js.map +1 -0
  66. package/lib/features/pivot.d.ts +8 -0
  67. package/lib/features/pivot.d.ts.map +1 -0
  68. package/lib/features/pivot.js +2 -0
  69. package/lib/features/pivot.js.map +1 -0
  70. package/lib/features/print.d.ts +8 -0
  71. package/lib/features/print.d.ts.map +1 -0
  72. package/lib/features/print.js +2 -0
  73. package/lib/features/print.js.map +1 -0
  74. package/lib/features/registry.d.ts +50 -0
  75. package/lib/features/registry.d.ts.map +1 -0
  76. package/lib/features/registry.js +2 -0
  77. package/lib/features/registry.js.map +1 -0
  78. package/lib/features/registry.spec.js +5 -0
  79. package/lib/features/registry.spec.js.map +1 -0
  80. package/lib/features/reorder-columns.d.ts +10 -0
  81. package/lib/features/reorder-columns.d.ts.map +1 -0
  82. package/lib/features/reorder-columns.js +2 -0
  83. package/lib/features/reorder-columns.js.map +1 -0
  84. package/lib/features/reorder-rows.d.ts +10 -0
  85. package/lib/features/reorder-rows.d.ts.map +1 -0
  86. package/lib/features/reorder-rows.js +2 -0
  87. package/lib/features/reorder-rows.js.map +1 -0
  88. package/lib/features/responsive.d.ts +8 -0
  89. package/lib/features/responsive.d.ts.map +1 -0
  90. package/lib/features/responsive.js +2 -0
  91. package/lib/features/responsive.js.map +1 -0
  92. package/lib/features/selection.d.ts +8 -0
  93. package/lib/features/selection.d.ts.map +1 -0
  94. package/lib/features/selection.js +2 -0
  95. package/lib/features/selection.js.map +1 -0
  96. package/lib/features/server-side.d.ts +8 -0
  97. package/lib/features/server-side.d.ts.map +1 -0
  98. package/lib/features/server-side.js +2 -0
  99. package/lib/features/server-side.js.map +1 -0
  100. package/lib/features/tree.d.ts +8 -0
  101. package/lib/features/tree.d.ts.map +1 -0
  102. package/lib/features/tree.js +2 -0
  103. package/lib/features/tree.js.map +1 -0
  104. package/lib/features/undo-redo.d.ts +8 -0
  105. package/lib/features/undo-redo.d.ts.map +1 -0
  106. package/lib/features/undo-redo.js +2 -0
  107. package/lib/features/undo-redo.js.map +1 -0
  108. package/lib/features/visibility.d.ts +8 -0
  109. package/lib/features/visibility.d.ts.map +1 -0
  110. package/lib/features/visibility.js +2 -0
  111. package/lib/features/visibility.js.map +1 -0
  112. package/lib/plugins/clipboard/index.js +1 -1
  113. package/lib/plugins/clipboard/index.js.map +1 -1
  114. package/lib/plugins/column-virtualization/index.js +1 -1
  115. package/lib/plugins/column-virtualization/index.js.map +1 -1
  116. package/lib/plugins/context-menu/index.js +1 -1
  117. package/lib/plugins/context-menu/index.js.map +1 -1
  118. package/lib/plugins/editing/index.js +1 -1
  119. package/lib/plugins/editing/index.js.map +1 -1
  120. package/lib/plugins/export/index.js +1 -1
  121. package/lib/plugins/export/index.js.map +1 -1
  122. package/lib/plugins/filtering/index.js +1 -1
  123. package/lib/plugins/filtering/index.js.map +1 -1
  124. package/lib/plugins/filtering/types.d.ts +428 -27
  125. package/lib/plugins/filtering/types.d.ts.map +1 -1
  126. package/lib/plugins/grouping-columns/index.d.ts +1 -1
  127. package/lib/plugins/grouping-columns/index.js +1 -1
  128. package/lib/plugins/grouping-columns/index.js.map +1 -1
  129. package/lib/plugins/grouping-rows/index.d.ts +2 -2
  130. package/lib/plugins/grouping-rows/index.d.ts.map +1 -1
  131. package/lib/plugins/grouping-rows/index.js +1 -1
  132. package/lib/plugins/grouping-rows/index.js.map +1 -1
  133. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +2 -2
  134. package/lib/plugins/master-detail/index.js +1 -1
  135. package/lib/plugins/master-detail/index.js.map +1 -1
  136. package/lib/plugins/multi-sort/index.js +1 -1
  137. package/lib/plugins/multi-sort/index.js.map +1 -1
  138. package/lib/plugins/pinned-columns/index.js +1 -1
  139. package/lib/plugins/pinned-columns/index.js.map +1 -1
  140. package/lib/plugins/pinned-columns/types.d.ts +3 -3
  141. package/lib/plugins/pinned-rows/index.js +1 -1
  142. package/lib/plugins/pinned-rows/index.js.map +1 -1
  143. package/lib/plugins/pivot/index.js +1 -1
  144. package/lib/plugins/pivot/index.js.map +1 -1
  145. package/lib/plugins/print/index.js +1 -1
  146. package/lib/plugins/print/index.js.map +1 -1
  147. package/lib/plugins/{reorder → reorder-columns}/ReorderPlugin.d.ts +5 -3
  148. package/lib/plugins/reorder-columns/ReorderPlugin.d.ts.map +1 -0
  149. package/lib/plugins/reorder-columns/column-drag.d.ts.map +1 -0
  150. package/lib/plugins/{reorder → reorder-columns}/index.d.ts +2 -2
  151. package/lib/plugins/reorder-columns/index.d.ts.map +1 -0
  152. package/lib/plugins/reorder-columns/index.js +2 -0
  153. package/lib/plugins/reorder-columns/index.js.map +1 -0
  154. package/lib/plugins/{reorder → reorder-columns}/types.d.ts +5 -0
  155. package/lib/plugins/reorder-columns/types.d.ts.map +1 -0
  156. package/lib/plugins/{row-reorder → reorder-rows}/RowReorderPlugin.d.ts +5 -3
  157. package/lib/plugins/reorder-rows/RowReorderPlugin.d.ts.map +1 -0
  158. package/lib/plugins/{row-reorder → reorder-rows}/index.d.ts +2 -2
  159. package/lib/plugins/reorder-rows/index.d.ts.map +1 -0
  160. package/lib/plugins/reorder-rows/index.js +2 -0
  161. package/lib/plugins/reorder-rows/index.js.map +1 -0
  162. package/lib/plugins/{row-reorder → reorder-rows}/types.d.ts +5 -0
  163. package/lib/plugins/reorder-rows/types.d.ts.map +1 -0
  164. package/lib/plugins/responsive/ResponsivePlugin.d.ts +2 -2
  165. package/lib/plugins/responsive/index.js +1 -1
  166. package/lib/plugins/responsive/index.js.map +1 -1
  167. package/lib/plugins/selection/index.js +1 -1
  168. package/lib/plugins/selection/index.js.map +1 -1
  169. package/lib/plugins/server-side/index.js +1 -1
  170. package/lib/plugins/server-side/index.js.map +1 -1
  171. package/lib/plugins/tree/index.js +1 -1
  172. package/lib/plugins/tree/index.js.map +1 -1
  173. package/lib/plugins/undo-redo/index.js +1 -1
  174. package/lib/plugins/undo-redo/index.js.map +1 -1
  175. package/lib/plugins/visibility/VisibilityPlugin.d.ts +1 -1
  176. package/lib/plugins/visibility/index.js +1 -1
  177. package/lib/plugins/visibility/index.js.map +1 -1
  178. package/package.json +17 -2
  179. package/public.d.ts +9 -2
  180. package/public.d.ts.map +1 -1
  181. package/umd/grid.all.umd.js +1 -1
  182. package/umd/grid.all.umd.js.map +1 -1
  183. package/umd/grid.umd.js +1 -1
  184. package/umd/grid.umd.js.map +1 -1
  185. package/umd/plugins/master-detail.umd.js.map +1 -1
  186. package/umd/plugins/reorder-columns.umd.js +2 -0
  187. package/umd/plugins/reorder-columns.umd.js.map +1 -0
  188. package/umd/plugins/reorder-rows.umd.js +2 -0
  189. package/umd/plugins/reorder-rows.umd.js.map +1 -0
  190. package/umd/plugins/responsive.umd.js.map +1 -1
  191. package/umd/plugins/visibility.umd.js.map +1 -1
  192. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +0 -1
  193. package/lib/plugins/reorder/column-drag.d.ts.map +0 -1
  194. package/lib/plugins/reorder/index.d.ts.map +0 -1
  195. package/lib/plugins/reorder/index.js +0 -2
  196. package/lib/plugins/reorder/index.js.map +0 -1
  197. package/lib/plugins/reorder/types.d.ts.map +0 -1
  198. package/lib/plugins/row-reorder/RowReorderPlugin.d.ts.map +0 -1
  199. package/lib/plugins/row-reorder/index.d.ts.map +0 -1
  200. package/lib/plugins/row-reorder/index.js +0 -2
  201. package/lib/plugins/row-reorder/index.js.map +0 -1
  202. package/lib/plugins/row-reorder/types.d.ts.map +0 -1
  203. package/umd/plugins/reorder.umd.js +0 -2
  204. package/umd/plugins/reorder.umd.js.map +0 -1
  205. package/umd/plugins/row-reorder.umd.js +0 -2
  206. package/umd/plugins/row-reorder.umd.js.map +0 -1
  207. /package/lib/plugins/{reorder → reorder-columns}/column-drag.d.ts +0 -0
@@ -0,0 +1,10 @@
1
+ import { ReorderConfig } from '../plugins/reorder-columns';
2
+ declare module '../core/types' {
3
+ interface FeatureConfig {
4
+ /** Enable column drag-to-reorder. */
5
+ reorderColumns?: boolean | ReorderConfig;
6
+ /** @deprecated Use `reorderColumns` instead. */
7
+ reorder?: boolean | ReorderConfig;
8
+ }
9
+ }
10
+ //# sourceMappingURL=reorder-columns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reorder-columns.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/reorder-columns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG/E,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,qCAAqC;QACrC,cAAc,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;QACzC,gDAAgD;QAChD,OAAO,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;KACnC;CACF"}
@@ -0,0 +1,2 @@
1
+ import{ReorderPlugin as o}from"@toolbox-web/grid/plugins/reorder-columns";import{registerFeature as r}from"@toolbox-web/grid/features/registry";const e=r=>new o("boolean"==typeof r?{}:r??{});r("reorderColumns",e),r("reorder",e);
2
+ //# sourceMappingURL=reorder-columns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reorder-columns.js","sources":["../../../../../libs/grid/src/lib/features/reorder-columns.ts"],"sourcesContent":["/**\n * Column Reorder feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/reorder-columns';\n *\n * grid.gridConfig = { features: { reorderColumns: true } };\n * ```\n */\n\nimport { ReorderPlugin, type ReorderConfig } from '../plugins/reorder-columns';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable column drag-to-reorder. */\n reorderColumns?: boolean | ReorderConfig;\n /** @deprecated Use `reorderColumns` instead. */\n reorder?: boolean | ReorderConfig;\n }\n}\n\nconst factory = (config: unknown) => {\n const options = typeof config === 'boolean' ? {} : ((config as ReorderConfig) ?? {});\n return new ReorderPlugin(options);\n};\n\nregisterFeature('reorderColumns', factory);\nregisterFeature('reorder', factory);\n"],"names":["factory","config","ReorderPlugin","registerFeature"],"mappings":"gJAuBA,MAAMA,EAAWC,GAER,IAAIC,EADuB,kBAAXD,EAAuB,CAAA,EAAOA,GAA4B,CAAA,GAInFE,EAAgB,iBAAkBH,GAClCG,EAAgB,UAAWH"}
@@ -0,0 +1,10 @@
1
+ import { RowReorderConfig } from '../plugins/reorder-rows';
2
+ declare module '../core/types' {
3
+ interface FeatureConfig {
4
+ /** Enable row drag-to-reorder. */
5
+ reorderRows?: boolean | RowReorderConfig;
6
+ /** @deprecated Use `reorderRows` instead. */
7
+ rowReorder?: boolean | RowReorderConfig;
8
+ }
9
+ }
10
+ //# sourceMappingURL=reorder-rows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reorder-rows.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/reorder-rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGlF,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,kCAAkC;QAClC,WAAW,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;QACzC,6CAA6C;QAC7C,UAAU,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;KACzC;CACF"}
@@ -0,0 +1,2 @@
1
+ import{RowReorderPlugin as r}from"@toolbox-web/grid/plugins/reorder-rows";import{registerFeature as o}from"@toolbox-web/grid/features/registry";const e=o=>!0===o?new r:new r(o??void 0);o("reorderRows",e),o("rowReorder",e);
2
+ //# sourceMappingURL=reorder-rows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reorder-rows.js","sources":["../../../../../libs/grid/src/lib/features/reorder-rows.ts"],"sourcesContent":["/**\n * Row Reorder feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/reorder-rows';\n *\n * grid.gridConfig = { features: { reorderRows: true } };\n * ```\n */\n\nimport { RowReorderPlugin, type RowReorderConfig } from '../plugins/reorder-rows';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable row drag-to-reorder. */\n reorderRows?: boolean | RowReorderConfig;\n /** @deprecated Use `reorderRows` instead. */\n rowReorder?: boolean | RowReorderConfig;\n }\n}\n\nconst factory = (config: unknown) => {\n if (config === true) {\n return new RowReorderPlugin();\n }\n return new RowReorderPlugin((config as RowReorderConfig) ?? undefined);\n};\n\nregisterFeature('reorderRows', factory);\nregisterFeature('rowReorder', factory);\n"],"names":["factory","config","RowReorderPlugin","registerFeature"],"mappings":"gJAuBA,MAAMA,EAAWC,IACA,IAAXA,EACK,IAAIC,EAEN,IAAIA,EAAkBD,QAA+B,GAG9DE,EAAgB,cAAeH,GAC/BG,EAAgB,aAAcH"}
@@ -0,0 +1,8 @@
1
+ import { ResponsivePluginConfig } from '../plugins/responsive';
2
+ declare module '../core/types' {
3
+ interface FeatureConfig {
4
+ /** Enable responsive column hiding based on breakpoints. */
5
+ responsive?: boolean | ResponsivePluginConfig;
6
+ }
7
+ }
8
+ //# sourceMappingURL=responsive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/responsive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAoB,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAGtF,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,4DAA4D;QAC5D,UAAU,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;KAC/C;CACF"}
@@ -0,0 +1,2 @@
1
+ import{ResponsivePlugin as o}from"@toolbox-web/grid/plugins/responsive";import{registerFeature as e}from"@toolbox-web/grid/features/registry";e("responsive",e=>new o("boolean"==typeof e?{}:e??{}));
2
+ //# sourceMappingURL=responsive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responsive.js","sources":["../../../../../libs/grid/src/lib/features/responsive.ts"],"sourcesContent":["/**\n * Responsive feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/responsive';\n *\n * grid.gridConfig = { features: { responsive: true } };\n * ```\n */\n\nimport { ResponsivePlugin, type ResponsivePluginConfig } from '../plugins/responsive';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable responsive column hiding based on breakpoints. */\n responsive?: boolean | ResponsivePluginConfig;\n }\n}\n\nregisterFeature('responsive', (config) => {\n const options = typeof config === 'boolean' ? {} : ((config as ResponsivePluginConfig) ?? {});\n return new ResponsivePlugin(options);\n});\n"],"names":["registerFeature","config","ResponsivePlugin"],"mappings":"8IAqBAA,EAAgB,aAAeC,GAEtB,IAAIC,EADuB,kBAAXD,EAAuB,CAAA,EAAOA,GAAqC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { SelectionConfig } from '../plugins/selection';
2
+ declare module '../core/types' {
3
+ interface FeatureConfig<TRow> {
4
+ /** Enable cell/row/range selection. */
5
+ selection?: 'cell' | 'row' | 'range' | SelectionConfig<TRow>;
6
+ }
7
+ }
8
+ //# sourceMappingURL=selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG7E,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa,CAAC,IAAI;QAC1B,uCAAuC;QACvC,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;KAC9D;CACF"}
@@ -0,0 +1,2 @@
1
+ import{SelectionPlugin as o}from"@toolbox-web/grid/plugins/selection";import{registerFeature as e}from"@toolbox-web/grid/features/registry";e("selection",e=>new o("cell"===e||"row"===e||"range"===e?{mode:e}:e??void 0));
2
+ //# sourceMappingURL=selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection.js","sources":["../../../../../libs/grid/src/lib/features/selection.ts"],"sourcesContent":["/**\n * Selection feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/selection';\n *\n * grid.gridConfig = { features: { selection: 'range' } };\n * ```\n */\n\nimport { SelectionPlugin, type SelectionConfig } from '../plugins/selection';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig<TRow> {\n /** Enable cell/row/range selection. */\n selection?: 'cell' | 'row' | 'range' | SelectionConfig<TRow>;\n }\n}\n\nregisterFeature('selection', (config) => {\n if (config === 'cell' || config === 'row' || config === 'range') {\n return new SelectionPlugin({ mode: config });\n }\n return new SelectionPlugin(config ?? undefined);\n});\n"],"names":["registerFeature","config","SelectionPlugin","mode"],"mappings":"4IAqBAA,EAAgB,YAAcC,GAEnB,IAAIC,EADE,SAAXD,GAAgC,QAAXA,GAA+B,UAAXA,EAChB,CAAEE,KAAMF,GAEVA,QAAU"}
@@ -0,0 +1,8 @@
1
+ import { ServerSideConfig } from '../plugins/server-side';
2
+ declare module '../core/types' {
3
+ interface FeatureConfig {
4
+ /** Enable server-side data fetching, sorting, filtering, etc. */
5
+ serverSide?: ServerSideConfig;
6
+ }
7
+ }
8
+ //# sourceMappingURL=server-side.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-side.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/server-side.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAGjF,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,iEAAiE;QACjE,UAAU,CAAC,EAAE,gBAAgB,CAAC;KAC/B;CACF"}
@@ -0,0 +1,2 @@
1
+ import{ServerSidePlugin as r}from"@toolbox-web/grid/plugins/server-side";import{registerFeature as e}from"@toolbox-web/grid/features/registry";e("serverSide",e=>new r(e??void 0));
2
+ //# sourceMappingURL=server-side.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-side.js","sources":["../../../../../libs/grid/src/lib/features/server-side.ts"],"sourcesContent":["/**\n * Server-Side feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/server-side';\n *\n * grid.gridConfig = { features: { serverSide: { fetchRows: async (params) => ... } } };\n * ```\n */\n\nimport { ServerSidePlugin, type ServerSideConfig } from '../plugins/server-side';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable server-side data fetching, sorting, filtering, etc. */\n serverSide?: ServerSideConfig;\n }\n}\n\nregisterFeature('serverSide', (config) => {\n return new ServerSidePlugin((config as ServerSideConfig) ?? undefined);\n});\n"],"names":["registerFeature","config","ServerSidePlugin"],"mappings":"+IAqBAA,EAAgB,aAAeC,GACtB,IAAIC,EAAkBD,QAA+B"}
@@ -0,0 +1,8 @@
1
+ import { TreeConfig } from '../plugins/tree';
2
+ declare module '../core/types' {
3
+ interface FeatureConfig {
4
+ /** Enable tree (hierarchical) data display with expand/collapse. */
5
+ tree?: boolean | TreeConfig;
6
+ }
7
+ }
8
+ //# sourceMappingURL=tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG9D,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,oEAAoE;QACpE,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;KAC7B;CACF"}
@@ -0,0 +1,2 @@
1
+ import{TreePlugin as o}from"@toolbox-web/grid/plugins/tree";import{registerFeature as e}from"@toolbox-web/grid/features/registry";e("tree",e=>new o("boolean"==typeof e?{}:e??{}));
2
+ //# sourceMappingURL=tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.js","sources":["../../../../../libs/grid/src/lib/features/tree.ts"],"sourcesContent":["/**\n * Tree feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/tree';\n *\n * grid.gridConfig = { features: { tree: true } };\n * ```\n */\n\nimport { TreePlugin, type TreeConfig } from '../plugins/tree';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable tree (hierarchical) data display with expand/collapse. */\n tree?: boolean | TreeConfig;\n }\n}\n\nregisterFeature('tree', (config) => {\n const options = typeof config === 'boolean' ? {} : ((config as TreeConfig) ?? {});\n return new TreePlugin(options);\n});\n"],"names":["registerFeature","config","TreePlugin"],"mappings":"kIAqBAA,EAAgB,OAASC,GAEhB,IAAIC,EADuB,kBAAXD,EAAuB,CAAA,EAAOA,GAAyB,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { UndoRedoConfig } from '../plugins/undo-redo';
2
+ declare module '../core/types' {
3
+ interface FeatureConfig {
4
+ /** Enable undo/redo for cell edits. Requires `editing`. */
5
+ undoRedo?: boolean | UndoRedoConfig;
6
+ }
7
+ }
8
+ //# sourceMappingURL=undo-redo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undo-redo.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/undo-redo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3E,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,2DAA2D;QAC3D,QAAQ,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;KACrC;CACF"}
@@ -0,0 +1,2 @@
1
+ import{UndoRedoPlugin as o}from"@toolbox-web/grid/plugins/undo-redo";import{registerFeature as e}from"@toolbox-web/grid/features/registry";e("undoRedo",e=>new o("boolean"==typeof e?{}:e??{}));
2
+ //# sourceMappingURL=undo-redo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undo-redo.js","sources":["../../../../../libs/grid/src/lib/features/undo-redo.ts"],"sourcesContent":["/**\n * Undo/Redo feature for @toolbox-web/grid\n *\n * Requires the `editing` feature to be enabled.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/undo-redo';\n *\n * grid.gridConfig = { features: { editing: true, undoRedo: true } };\n * ```\n */\n\nimport { UndoRedoPlugin, type UndoRedoConfig } from '../plugins/undo-redo';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable undo/redo for cell edits. Requires `editing`. */\n undoRedo?: boolean | UndoRedoConfig;\n }\n}\n\nregisterFeature('undoRedo', (config) => {\n const options = typeof config === 'boolean' ? {} : ((config as UndoRedoConfig) ?? {});\n return new UndoRedoPlugin(options);\n});\n"],"names":["registerFeature","config","UndoRedoPlugin"],"mappings":"2IAuBAA,EAAgB,WAAaC,GAEpB,IAAIC,EADuB,kBAAXD,EAAuB,CAAA,EAAOA,GAA6B,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { VisibilityConfig } from '../plugins/visibility';
2
+ declare module '../core/types' {
3
+ interface FeatureConfig {
4
+ /** Enable column visibility toggling. */
5
+ visibility?: boolean | VisibilityConfig;
6
+ }
7
+ }
8
+ //# sourceMappingURL=visibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/visibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,yCAAyC;QACzC,UAAU,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;KACzC;CACF"}
@@ -0,0 +1,2 @@
1
+ import{VisibilityPlugin as i}from"@toolbox-web/grid/plugins/visibility";import{registerFeature as o}from"@toolbox-web/grid/features/registry";o("visibility",o=>new i("boolean"==typeof o?{}:o??{}));
2
+ //# sourceMappingURL=visibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visibility.js","sources":["../../../../../libs/grid/src/lib/features/visibility.ts"],"sourcesContent":["/**\n * Column Visibility feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/visibility';\n *\n * grid.gridConfig = { features: { visibility: true } };\n * ```\n */\n\nimport { VisibilityPlugin, type VisibilityConfig } from '../plugins/visibility';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable column visibility toggling. */\n visibility?: boolean | VisibilityConfig;\n }\n}\n\nregisterFeature('visibility', (config) => {\n const options = typeof config === 'boolean' ? {} : ((config as VisibilityConfig) ?? {});\n return new VisibilityPlugin(options);\n});\n"],"names":["registerFeature","config","VisibilityPlugin"],"mappings":"8IAqBAA,EAAgB,aAAeC,GAEtB,IAAIC,EADuB,kBAAXD,EAAuB,CAAA,EAAOA,GAA+B,CAAA"}
@@ -1,2 +1,2 @@
1
- const e='<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>',t={expand:"▶",collapse:"▼",sortAsc:"▲",sortDesc:"▼",sortNone:"⇅",submenuArrow:"▶",dragHandle:"⋮⋮",toolPanel:"☰",filter:e,filterActive:e,print:"🖨️"};class n{static dependencies;static manifest;version="undefined"!=typeof __GRID_VERSION__?__GRID_VERSION__:"dev";styles;cellRenderers;headerRenderers;cellEditors;grid;config;userConfig;#e;get defaultConfig(){return{}}constructor(e={}){this.userConfig=e}attach(e){this.#e?.abort(),this.#e=new AbortController,this.grid=e,this.config={...this.defaultConfig,...this.userConfig}}detach(){this.#e?.abort(),this.#e=void 0}getPlugin(e){return this.grid?.getPlugin(e)}emit(e,t){this.grid?.dispatchEvent?.(new CustomEvent(e,{detail:t,bubbles:!0}))}emitCancelable(e,t){const n=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0});return this.grid?.dispatchEvent?.(n),n.defaultPrevented}on(e,t){this.grid?._pluginManager?.subscribe(this,e,t)}off(e){this.grid?._pluginManager?.unsubscribe(this,e)}emitPluginEvent(e,t){this.grid?._pluginManager?.emitPluginEvent(e,t)}requestRender(){this.grid?.requestRender?.()}requestColumnsRender(){this.grid?.requestColumnsRender?.()}requestRenderWithFocus(){this.grid?.requestRenderWithFocus?.()}requestAfterRender(){this.grid?.requestAfterRender?.()}get rows(){return this.grid?.rows??[]}get sourceRows(){return this.grid?.sourceRows??[]}get columns(){return this.grid?.columns??[]}get visibleColumns(){return this.grid?._visibleColumns??[]}get gridElement(){return this.grid}get disconnectSignal(){return this.#e?.signal??this.grid?.disconnectSignal}get gridIcons(){const e=this.grid?.gridConfig?.icons??{};return{...t,...e}}get isAnimationEnabled(){const e=this.grid?.effectiveConfig?.animation?.mode??"reduced-motion";if(!1===e||"off"===e)return!1;if(!0===e||"on"===e)return!0;const t=this.gridElement;if(t){return"0"!==getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim()}return!0}get animationDuration(){const e=this.gridElement;if(e){const t=getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(),n=parseInt(t,10);if(!isNaN(n))return n}return 200}resolveIcon(e,t){return void 0!==t?t:this.gridIcons[e]}setIcon(e,t){"string"==typeof t?e.innerHTML=t:t instanceof HTMLElement&&(e.innerHTML="",e.appendChild(t.cloneNode(!0)))}warn(e){console.warn(`[tbw-grid:${this.name}] ${e}`)}}function i(e,t,n=!0){let i=e;if(n&&(i=i.filter(e=>!e.hidden&&!e.field.startsWith("__")&&!0!==e.meta?.utility)),t?.length){const e=new Set(t);i=i.filter(t=>e.has(t.field))}return i}function r(e){return null==e?"":e instanceof Date?e.toISOString():"object"==typeof e?JSON.stringify(e):String(e)}function o(e,t){const n=t.delimiter??"\t",i=t.newline??"\n",r=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),o=[];let s=[],l="",a=!1;for(let c=0;c<r.length;c++){const e=r[c];'"'!==e||a?'"'===e&&a?'"'===r[c+1]?(l+='"',c++):a=!1:e!==n||a?e!==i||a?l+=e:(s.push(l),l="",(s.length>1||s.some(e=>""!==e.trim()))&&o.push(s),s=[]):(s.push(l),l=""):a=!0}return s.push(l),(s.length>1||s.some(e=>""!==e.trim()))&&o.push(s),o}function s(e,t){const{rows:n,target:i,fields:r}=e;if(!i)return;const o=t.rows,s=t.effectiveConfig.columns??[],l=s.map(e=>e.field),a=/* @__PURE__ */new Map;s.forEach(e=>{a.set(e.field,!0===e.editable)});const c=[...o],d=i.bounds?i.bounds.endRow:1/0;n.forEach((e,t)=>{const n=i.row+t;if(!(n>d)){if(i.bounds){if(n>=c.length)return}else for(;n>=c.length;){const e={};l.forEach(t=>e[t]=""),c.push(e)}c[n]={...c[n]},e.forEach((e,t)=>{const i=r[t];i&&a.get(i)&&(c[n][i]=e)})}}),t.rows=c}class l extends n{static dependencies=[{name:"selection",required:!1,reason:"Enables copy/paste of selected cells instead of entire grid"}];name="clipboard";get defaultConfig(){return{includeHeaders:!1,delimiter:"\t",newline:"\n",quoteStrings:!1}}lastCopied=null;attach(e){super.attach(e);e.addEventListener("paste",e=>this.#t(e),{signal:this.disconnectSignal})}detach(){this.lastCopied=null}onKeyDown(e){return!(!e.ctrlKey&&!e.metaKey||"c"!==e.key)&&(e.preventDefault(),this.#n(e.target),!0)}#n(e){const t=this.#i();if(t&&0===t.ranges.length){const t=this.#r(e);if(!t)return;const n=this.columns[t.col];if(!n)return;return void this.copy({rowIndices:[t.row],columns:[n.field]})}this.copy()}#t(e){const t=e.clipboardData?.getData("text/plain");if(!t)return;e.preventDefault();const n=o(t,this.config),i=this.#i(),r=i?.ranges?.[0],s=r?.from.row??0,l=r?.from.col??0,a=r&&("range"===i?.mode||"row"===i?.mode)&&(r.from.row!==r.to.row||r.from.col!==r.to.col)?{endRow:r.to.row,endCol:r.to.col}:null,c=a?.endCol??this.visibleColumns.length-1,d=this.visibleColumns[l],u=d?{row:s,col:l,field:d.field,bounds:a}:null,h=[],g=n[0]?.length??0;for(let o=0;o<g&&l+o<=c;o++){const e=this.visibleColumns[l+o];e&&h.push(e.field)}const f={rows:n,text:t,target:u,fields:h};this.emit("paste",f),this.#o(f)}#o(e){if(!this.grid)return;const{pasteHandler:t}=this.config;if(null===t)return;(t??s)(e,this.grid)}#i(){const e=this.grid?.query("getSelection");return e?.[0]}#s(e){const t=this.#i();let n,r;if(e?.columns)n=i(this.columns,e.columns);else if(t?.ranges.length&&"row"!==t.mode){const e=t.ranges[t.ranges.length-1],r=Math.min(e.from.col,e.to.col),o=Math.max(e.from.col,e.to.col);n=i(this.visibleColumns.slice(r,o+1))}else n=i(this.columns);if(e?.rowIndices)r=function(e,t){return t?.length?[...t].sort((e,t)=>e-t).map(t=>e[t]).filter(e=>null!=e):e}(this.rows,e.rowIndices);else if(t?.ranges.length){const e=t.ranges[t.ranges.length-1],n=Math.min(e.from.row,e.to.row),i=Math.max(e.from.row,e.to.row);r=[];for(let t=n;t<=i;t++){const e=this.rows[t];e&&r.push(e)}}else r=this.rows;return{columns:n,rows:r}}#l(e,t,n){const i=n?.delimiter??this.config.delimiter??"\t",o=n?.newline??this.config.newline??"\n",s=n?.includeHeaders??this.config.includeHeaders??!1,l=n?.processCell??this.config.processCell,a=[];s&&a.push(e.map(e=>e.header||e.field).join(i));for(const c of t){const t=e.map(e=>{const t=c[e.field];return l?l(t,e.field,c):r(t)});a.push(t.join(i))}return a.join(o)}#r(e){const t=e.closest("[data-field-cache]");if(!t)return null;const n=t.dataset.fieldCache,i=t.dataset.row;if(!n||!i)return null;const r=parseInt(i,10);if(isNaN(r))return null;const o=this.columns.findIndex(e=>e.field===n);return-1===o?null:{row:r,col:o}}getSelectionAsText(e){const{columns:t,rows:n}=this.#s(e);return 0===t.length||0===n.length?"":this.#l(t,n,e)}async copy(e){const{columns:t,rows:n}=this.#s(e);if(0===t.length||0===n.length)return"";const i=this.#l(t,n,e);return await async function(e){try{return await navigator.clipboard.writeText(e),!0}catch(t){console.warn("[copyToClipboard] Clipboard API failed:",t);const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",n.style.pointerEvents="none",document.body.appendChild(n),n.select();const i=document.execCommand("copy");return document.body.removeChild(n),i}}(i),this.lastCopied={text:i,timestamp:Date.now()},this.emit("copy",{text:i,rowCount:n.length,columnCount:t.length}),i}async copyRows(e,t){return 0===e.length?"":this.copy({...t,rowIndices:e})}async paste(){const e=await async function(){try{return await navigator.clipboard.readText()}catch{return""}}();return e?o(e,this.config):null}getLastCopied(){return this.lastCopied}}export{l as ClipboardPlugin,s as defaultPasteHandler};
1
+ const e='<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>',t={expand:"▶",collapse:"▼",sortAsc:"▲",sortDesc:"▼",sortNone:"⇅",submenuArrow:"▶",dragHandle:"⋮⋮",toolPanel:"☰",filter:e,filterActive:e,print:"🖨️"};class n{static dependencies;static manifest;aliases;version="undefined"!=typeof __GRID_VERSION__?__GRID_VERSION__:"dev";styles;cellRenderers;headerRenderers;cellEditors;grid;config;userConfig;#e;get defaultConfig(){return{}}constructor(e={}){this.userConfig=e}attach(e){this.#e?.abort(),this.#e=new AbortController,this.grid=e,this.config={...this.defaultConfig,...this.userConfig}}detach(){this.#e?.abort(),this.#e=void 0}getPlugin(e){return this.grid?.getPlugin(e)}emit(e,t){this.grid?.dispatchEvent?.(new CustomEvent(e,{detail:t,bubbles:!0}))}emitCancelable(e,t){const n=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0});return this.grid?.dispatchEvent?.(n),n.defaultPrevented}on(e,t){this.grid?._pluginManager?.subscribe(this,e,t)}off(e){this.grid?._pluginManager?.unsubscribe(this,e)}emitPluginEvent(e,t){this.grid?._pluginManager?.emitPluginEvent(e,t)}requestRender(){this.grid?.requestRender?.()}requestColumnsRender(){this.grid?.requestColumnsRender?.()}requestRenderWithFocus(){this.grid?.requestRenderWithFocus?.()}requestAfterRender(){this.grid?.requestAfterRender?.()}get rows(){return this.grid?.rows??[]}get sourceRows(){return this.grid?.sourceRows??[]}get columns(){return this.grid?.columns??[]}get visibleColumns(){return this.grid?._visibleColumns??[]}get gridElement(){return this.grid}get disconnectSignal(){return this.#e?.signal??this.grid?.disconnectSignal}get gridIcons(){const e=this.grid?.gridConfig?.icons??{};return{...t,...e}}get isAnimationEnabled(){const e=this.grid?.effectiveConfig?.animation?.mode??"reduced-motion";if(!1===e||"off"===e)return!1;if(!0===e||"on"===e)return!0;const t=this.gridElement;if(t){return"0"!==getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim()}return!0}get animationDuration(){const e=this.gridElement;if(e){const t=getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(),n=parseInt(t,10);if(!isNaN(n))return n}return 200}resolveIcon(e,t){return void 0!==t?t:this.gridIcons[e]}setIcon(e,t){"string"==typeof t?e.innerHTML=t:t instanceof HTMLElement&&(e.innerHTML="",e.appendChild(t.cloneNode(!0)))}warn(e){console.warn(`[tbw-grid:${this.name}] ${e}`)}}function i(e,t,n=!0){let i=e;if(n&&(i=i.filter(e=>!e.hidden&&!e.field.startsWith("__")&&!0!==e.meta?.utility)),t?.length){const e=new Set(t);i=i.filter(t=>e.has(t.field))}return i}function r(e){return null==e?"":e instanceof Date?e.toISOString():"object"==typeof e?JSON.stringify(e):String(e)}function o(e,t){const n=t.delimiter??"\t",i=t.newline??"\n",r=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),o=[];let s=[],l="",a=!1;for(let c=0;c<r.length;c++){const e=r[c];'"'!==e||a?'"'===e&&a?'"'===r[c+1]?(l+='"',c++):a=!1:e!==n||a?e!==i||a?l+=e:(s.push(l),l="",(s.length>1||s.some(e=>""!==e.trim()))&&o.push(s),s=[]):(s.push(l),l=""):a=!0}return s.push(l),(s.length>1||s.some(e=>""!==e.trim()))&&o.push(s),o}function s(e,t){const{rows:n,target:i,fields:r}=e;if(!i)return;const o=t.rows,s=t.effectiveConfig.columns??[],l=s.map(e=>e.field),a=/* @__PURE__ */new Map;s.forEach(e=>{a.set(e.field,!0===e.editable)});const c=[...o],d=i.bounds?i.bounds.endRow:1/0;n.forEach((e,t)=>{const n=i.row+t;if(!(n>d)){if(i.bounds){if(n>=c.length)return}else for(;n>=c.length;){const e={};l.forEach(t=>e[t]=""),c.push(e)}c[n]={...c[n]},e.forEach((e,t)=>{const i=r[t];i&&a.get(i)&&(c[n][i]=e)})}}),t.rows=c}class l extends n{static dependencies=[{name:"selection",required:!1,reason:"Enables copy/paste of selected cells instead of entire grid"}];name="clipboard";get defaultConfig(){return{includeHeaders:!1,delimiter:"\t",newline:"\n",quoteStrings:!1}}lastCopied=null;attach(e){super.attach(e);e.addEventListener("paste",e=>this.#t(e),{signal:this.disconnectSignal})}detach(){this.lastCopied=null}onKeyDown(e){return!(!e.ctrlKey&&!e.metaKey||"c"!==e.key)&&(e.preventDefault(),this.#n(e.target),!0)}#n(e){const t=this.#i();if(t&&0===t.ranges.length){const t=this.#r(e);if(!t)return;const n=this.columns[t.col];if(!n)return;return void this.copy({rowIndices:[t.row],columns:[n.field]})}this.copy()}#t(e){const t=e.clipboardData?.getData("text/plain");if(!t)return;e.preventDefault();const n=o(t,this.config),i=this.#i(),r=i?.ranges?.[0],s=r?.from.row??0,l=r?.from.col??0,a=r&&("range"===i?.mode||"row"===i?.mode)&&(r.from.row!==r.to.row||r.from.col!==r.to.col)?{endRow:r.to.row,endCol:r.to.col}:null,c=a?.endCol??this.visibleColumns.length-1,d=this.visibleColumns[l],u=d?{row:s,col:l,field:d.field,bounds:a}:null,h=[],g=n[0]?.length??0;for(let o=0;o<g&&l+o<=c;o++){const e=this.visibleColumns[l+o];e&&h.push(e.field)}const f={rows:n,text:t,target:u,fields:h};this.emit("paste",f),this.#o(f)}#o(e){if(!this.grid)return;const{pasteHandler:t}=this.config;if(null===t)return;(t??s)(e,this.grid)}#i(){const e=this.grid?.query("getSelection");return e?.[0]}#s(e){const t=this.#i();let n,r;if(e?.columns)n=i(this.columns,e.columns);else if(t?.ranges.length&&"row"!==t.mode){const e=t.ranges[t.ranges.length-1],r=Math.min(e.from.col,e.to.col),o=Math.max(e.from.col,e.to.col);n=i(this.visibleColumns.slice(r,o+1))}else n=i(this.columns);if(e?.rowIndices)r=function(e,t){return t?.length?[...t].sort((e,t)=>e-t).map(t=>e[t]).filter(e=>null!=e):e}(this.rows,e.rowIndices);else if(t?.ranges.length){const e=t.ranges[t.ranges.length-1],n=Math.min(e.from.row,e.to.row),i=Math.max(e.from.row,e.to.row);r=[];for(let t=n;t<=i;t++){const e=this.rows[t];e&&r.push(e)}}else r=this.rows;return{columns:n,rows:r}}#l(e,t,n){const i=n?.delimiter??this.config.delimiter??"\t",o=n?.newline??this.config.newline??"\n",s=n?.includeHeaders??this.config.includeHeaders??!1,l=n?.processCell??this.config.processCell,a=[];s&&a.push(e.map(e=>e.header||e.field).join(i));for(const c of t){const t=e.map(e=>{const t=c[e.field];return l?l(t,e.field,c):r(t)});a.push(t.join(i))}return a.join(o)}#r(e){const t=e.closest("[data-field-cache]");if(!t)return null;const n=t.dataset.fieldCache,i=t.dataset.row;if(!n||!i)return null;const r=parseInt(i,10);if(isNaN(r))return null;const o=this.columns.findIndex(e=>e.field===n);return-1===o?null:{row:r,col:o}}getSelectionAsText(e){const{columns:t,rows:n}=this.#s(e);return 0===t.length||0===n.length?"":this.#l(t,n,e)}async copy(e){const{columns:t,rows:n}=this.#s(e);if(0===t.length||0===n.length)return"";const i=this.#l(t,n,e);return await async function(e){try{return await navigator.clipboard.writeText(e),!0}catch(t){console.warn("[copyToClipboard] Clipboard API failed:",t);const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",n.style.pointerEvents="none",document.body.appendChild(n),n.select();const i=document.execCommand("copy");return document.body.removeChild(n),i}}(i),this.lastCopied={text:i,timestamp:Date.now()},this.emit("copy",{text:i,rowCount:n.length,columnCount:t.length}),i}async copyRows(e,t){return 0===e.length?"":this.copy({...t,rowIndices:e})}async paste(){const e=await async function(){try{return await navigator.clipboard.readText()}catch{return""}}();return e?o(e,this.config):null}getLastCopied(){return this.lastCopied}}export{l as ClipboardPlugin,s as defaultPasteHandler};
2
2
  //# sourceMappingURL=index.js.map