@zengrid/core 1.0.1

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 (252) hide show
  1. package/README.md +55 -0
  2. package/dist/README.md +55 -0
  3. package/dist/index.cjs.default.js +1 -0
  4. package/dist/index.cjs.js +9882 -0
  5. package/dist/index.cjs.mjs +2 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.esm.js +9847 -0
  8. package/dist/package.json +49 -0
  9. package/dist/src/a11y/aria-manager.d.ts +171 -0
  10. package/dist/src/a11y/aria-manager.d.ts.map +1 -0
  11. package/dist/src/a11y/focus-manager.d.ts +124 -0
  12. package/dist/src/a11y/focus-manager.d.ts.map +1 -0
  13. package/dist/src/a11y/index.d.ts +8 -0
  14. package/dist/src/a11y/index.d.ts.map +1 -0
  15. package/dist/src/data/data-accessor/array-accessor.d.ts +38 -0
  16. package/dist/src/data/data-accessor/array-accessor.d.ts.map +1 -0
  17. package/dist/src/data/data-accessor/column-store-accessor.d.ts +41 -0
  18. package/dist/src/data/data-accessor/column-store-accessor.d.ts.map +1 -0
  19. package/dist/src/data/data-accessor/data-accessor.interface.d.ts +41 -0
  20. package/dist/src/data/data-accessor/data-accessor.interface.d.ts.map +1 -0
  21. package/dist/src/data/data-accessor/index.d.ts +9 -0
  22. package/dist/src/data/data-accessor/index.d.ts.map +1 -0
  23. package/dist/src/data/data-accessor/sparse-matrix-accessor.d.ts +39 -0
  24. package/dist/src/data/data-accessor/sparse-matrix-accessor.d.ts.map +1 -0
  25. package/dist/src/data/data-manager.d.ts +161 -0
  26. package/dist/src/data/data-manager.d.ts.map +1 -0
  27. package/dist/src/data/data-source.interface.d.ts +82 -0
  28. package/dist/src/data/data-source.interface.d.ts.map +1 -0
  29. package/dist/src/data/grid-data-model.d.ts +102 -0
  30. package/dist/src/data/grid-data-model.d.ts.map +1 -0
  31. package/dist/src/data/index-map/index-map.d.ts +30 -0
  32. package/dist/src/data/index-map/index-map.d.ts.map +1 -0
  33. package/dist/src/data/index-map/index-map.interface.d.ts +49 -0
  34. package/dist/src/data/index-map/index-map.interface.d.ts.map +1 -0
  35. package/dist/src/data/index-map/index.d.ts +7 -0
  36. package/dist/src/data/index-map/index.d.ts.map +1 -0
  37. package/dist/src/data/index.d.ts +9 -0
  38. package/dist/src/data/index.d.ts.map +1 -0
  39. package/dist/src/editing/cell-editor.interface.d.ts +87 -0
  40. package/dist/src/editing/cell-editor.interface.d.ts.map +1 -0
  41. package/dist/src/editing/date-editor.d.ts +67 -0
  42. package/dist/src/editing/date-editor.d.ts.map +1 -0
  43. package/dist/src/editing/editor-manager.d.ts +141 -0
  44. package/dist/src/editing/editor-manager.d.ts.map +1 -0
  45. package/dist/src/editing/index.d.ts +15 -0
  46. package/dist/src/editing/index.d.ts.map +1 -0
  47. package/dist/src/editing/number-editor.d.ts +68 -0
  48. package/dist/src/editing/number-editor.d.ts.map +1 -0
  49. package/dist/src/editing/select-editor.d.ts +53 -0
  50. package/dist/src/editing/select-editor.d.ts.map +1 -0
  51. package/dist/src/editing/text-editor.d.ts +69 -0
  52. package/dist/src/editing/text-editor.d.ts.map +1 -0
  53. package/dist/src/events/event-emitter.d.ts +90 -0
  54. package/dist/src/events/event-emitter.d.ts.map +1 -0
  55. package/dist/src/events/grid-events.d.ts +277 -0
  56. package/dist/src/events/grid-events.d.ts.map +1 -0
  57. package/dist/src/events/index.d.ts +6 -0
  58. package/dist/src/events/index.d.ts.map +1 -0
  59. package/dist/src/features/autofill/autofill-manager.d.ts +103 -0
  60. package/dist/src/features/autofill/autofill-manager.d.ts.map +1 -0
  61. package/dist/src/features/autofill/index.d.ts +6 -0
  62. package/dist/src/features/autofill/index.d.ts.map +1 -0
  63. package/dist/src/features/column-resize/auto-fit-calculator.d.ts +52 -0
  64. package/dist/src/features/column-resize/auto-fit-calculator.d.ts.map +1 -0
  65. package/dist/src/features/column-resize/column-resize-manager.d.ts +114 -0
  66. package/dist/src/features/column-resize/column-resize-manager.d.ts.map +1 -0
  67. package/dist/src/features/column-resize/column-resize-manager.interface.d.ts +167 -0
  68. package/dist/src/features/column-resize/column-resize-manager.interface.d.ts.map +1 -0
  69. package/dist/src/features/column-resize/column-resize.styles.css +30 -0
  70. package/dist/src/features/column-resize/index.d.ts +15 -0
  71. package/dist/src/features/column-resize/index.d.ts.map +1 -0
  72. package/dist/src/features/column-resize/resize-constraint-manager.d.ts +52 -0
  73. package/dist/src/features/column-resize/resize-constraint-manager.d.ts.map +1 -0
  74. package/dist/src/features/column-resize/resize-handle-renderer.d.ts +41 -0
  75. package/dist/src/features/column-resize/resize-handle-renderer.d.ts.map +1 -0
  76. package/dist/src/features/column-resize/resize-preview.d.ts +32 -0
  77. package/dist/src/features/column-resize/resize-preview.d.ts.map +1 -0
  78. package/dist/src/features/column-resize/resize-state-manager.d.ts +75 -0
  79. package/dist/src/features/column-resize/resize-state-manager.d.ts.map +1 -0
  80. package/dist/src/features/column-resize/resize-strategies.d.ts +26 -0
  81. package/dist/src/features/column-resize/resize-strategies.d.ts.map +1 -0
  82. package/dist/src/features/column-resize/resize-test-helper.d.ts +71 -0
  83. package/dist/src/features/column-resize/resize-test-helper.d.ts.map +1 -0
  84. package/dist/src/features/column-resize/resize-zone-detector.d.ts +32 -0
  85. package/dist/src/features/column-resize/resize-zone-detector.d.ts.map +1 -0
  86. package/dist/src/features/copy-paste/clipboard-manager.d.ts +116 -0
  87. package/dist/src/features/copy-paste/clipboard-manager.d.ts.map +1 -0
  88. package/dist/src/features/copy-paste/index.d.ts +6 -0
  89. package/dist/src/features/copy-paste/index.d.ts.map +1 -0
  90. package/dist/src/features/filtering/adapters/adapter.interface.d.ts +100 -0
  91. package/dist/src/features/filtering/adapters/adapter.interface.d.ts.map +1 -0
  92. package/dist/src/features/filtering/adapters/graphql-adapter.d.ts +124 -0
  93. package/dist/src/features/filtering/adapters/graphql-adapter.d.ts.map +1 -0
  94. package/dist/src/features/filtering/adapters/index.d.ts +11 -0
  95. package/dist/src/features/filtering/adapters/index.d.ts.map +1 -0
  96. package/dist/src/features/filtering/adapters/rest-adapter.d.ts +108 -0
  97. package/dist/src/features/filtering/adapters/rest-adapter.d.ts.map +1 -0
  98. package/dist/src/features/filtering/adapters/sql-adapter.d.ts +123 -0
  99. package/dist/src/features/filtering/adapters/sql-adapter.d.ts.map +1 -0
  100. package/dist/src/features/filtering/adapters/types.d.ts +201 -0
  101. package/dist/src/features/filtering/adapters/types.d.ts.map +1 -0
  102. package/dist/src/features/filtering/column-filter.d.ts +117 -0
  103. package/dist/src/features/filtering/column-filter.d.ts.map +1 -0
  104. package/dist/src/features/filtering/filter-autocomplete.d.ts +78 -0
  105. package/dist/src/features/filtering/filter-autocomplete.d.ts.map +1 -0
  106. package/dist/src/features/filtering/filter-cache.d.ts +113 -0
  107. package/dist/src/features/filtering/filter-cache.d.ts.map +1 -0
  108. package/dist/src/features/filtering/filter-compiler.d.ts +66 -0
  109. package/dist/src/features/filtering/filter-compiler.d.ts.map +1 -0
  110. package/dist/src/features/filtering/filter-export-manager.d.ts +131 -0
  111. package/dist/src/features/filtering/filter-export-manager.d.ts.map +1 -0
  112. package/dist/src/features/filtering/filter-index-manager.d.ts +126 -0
  113. package/dist/src/features/filtering/filter-index-manager.d.ts.map +1 -0
  114. package/dist/src/features/filtering/filter-manager.d.ts +408 -0
  115. package/dist/src/features/filtering/filter-manager.d.ts.map +1 -0
  116. package/dist/src/features/filtering/filter-optimizer.d.ts +101 -0
  117. package/dist/src/features/filtering/filter-optimizer.d.ts.map +1 -0
  118. package/dist/src/features/filtering/filter-query-parser.d.ts +69 -0
  119. package/dist/src/features/filtering/filter-query-parser.d.ts.map +1 -0
  120. package/dist/src/features/filtering/index.d.ts +20 -0
  121. package/dist/src/features/filtering/index.d.ts.map +1 -0
  122. package/dist/src/features/filtering/range-filter-optimizer.d.ts +138 -0
  123. package/dist/src/features/filtering/range-filter-optimizer.d.ts.map +1 -0
  124. package/dist/src/features/filtering/substring-filter.d.ts +90 -0
  125. package/dist/src/features/filtering/substring-filter.d.ts.map +1 -0
  126. package/dist/src/features/filtering/types.d.ts +204 -0
  127. package/dist/src/features/filtering/types.d.ts.map +1 -0
  128. package/dist/src/features/formulas/formula-calculator.d.ts +151 -0
  129. package/dist/src/features/formulas/formula-calculator.d.ts.map +1 -0
  130. package/dist/src/features/formulas/index.d.ts +6 -0
  131. package/dist/src/features/formulas/index.d.ts.map +1 -0
  132. package/dist/src/features/hit-testing/index.d.ts +7 -0
  133. package/dist/src/features/hit-testing/index.d.ts.map +1 -0
  134. package/dist/src/features/hit-testing/spatial-hit-tester.d.ts +137 -0
  135. package/dist/src/features/hit-testing/spatial-hit-tester.d.ts.map +1 -0
  136. package/dist/src/features/loading/index.d.ts +5 -0
  137. package/dist/src/features/loading/index.d.ts.map +1 -0
  138. package/dist/src/features/loading/loading-indicator.d.ts +79 -0
  139. package/dist/src/features/loading/loading-indicator.d.ts.map +1 -0
  140. package/dist/src/features/loading/loading.styles.css +413 -0
  141. package/dist/src/features/pagination/index.d.ts +5 -0
  142. package/dist/src/features/pagination/index.d.ts.map +1 -0
  143. package/dist/src/features/pagination/pagination.styles.css +288 -0
  144. package/dist/src/features/pagination/paginator.d.ts +89 -0
  145. package/dist/src/features/pagination/paginator.d.ts.map +1 -0
  146. package/dist/src/features/selection/index.d.ts +7 -0
  147. package/dist/src/features/selection/index.d.ts.map +1 -0
  148. package/dist/src/features/selection/selection-manager.d.ts +167 -0
  149. package/dist/src/features/selection/selection-manager.d.ts.map +1 -0
  150. package/dist/src/features/sorting/index.d.ts +13 -0
  151. package/dist/src/features/sorting/index.d.ts.map +1 -0
  152. package/dist/src/features/sorting/row-sorter.interface.d.ts +63 -0
  153. package/dist/src/features/sorting/row-sorter.interface.d.ts.map +1 -0
  154. package/dist/src/features/sorting/single-column-sorter.d.ts +75 -0
  155. package/dist/src/features/sorting/single-column-sorter.d.ts.map +1 -0
  156. package/dist/src/features/sorting/sort-manager.d.ts +132 -0
  157. package/dist/src/features/sorting/sort-manager.d.ts.map +1 -0
  158. package/dist/src/features/undo-redo/index.d.ts +8 -0
  159. package/dist/src/features/undo-redo/index.d.ts.map +1 -0
  160. package/dist/src/features/undo-redo/undo-redo-manager.d.ts +215 -0
  161. package/dist/src/features/undo-redo/undo-redo-manager.d.ts.map +1 -0
  162. package/dist/src/grid.d.ts +412 -0
  163. package/dist/src/grid.d.ts.map +1 -0
  164. package/dist/src/i18n/index.d.ts +8 -0
  165. package/dist/src/i18n/index.d.ts.map +1 -0
  166. package/dist/src/i18n/locale-manager.d.ts +123 -0
  167. package/dist/src/i18n/locale-manager.d.ts.map +1 -0
  168. package/dist/src/i18n/rtl-support.d.ts +120 -0
  169. package/dist/src/i18n/rtl-support.d.ts.map +1 -0
  170. package/dist/src/index.d.ts +38 -0
  171. package/dist/src/index.d.ts.map +1 -0
  172. package/dist/src/keyboard/index.d.ts +6 -0
  173. package/dist/src/keyboard/index.d.ts.map +1 -0
  174. package/dist/src/keyboard/keyboard-navigator.d.ts +171 -0
  175. package/dist/src/keyboard/keyboard-navigator.d.ts.map +1 -0
  176. package/dist/src/rendering/cache/index.d.ts +3 -0
  177. package/dist/src/rendering/cache/index.d.ts.map +1 -0
  178. package/dist/src/rendering/cache/renderer-cache.d.ts +100 -0
  179. package/dist/src/rendering/cache/renderer-cache.d.ts.map +1 -0
  180. package/dist/src/rendering/cache/renderer-cache.interface.d.ts +89 -0
  181. package/dist/src/rendering/cache/renderer-cache.interface.d.ts.map +1 -0
  182. package/dist/src/rendering/cell-pool/cell-pool.d.ts +36 -0
  183. package/dist/src/rendering/cell-pool/cell-pool.d.ts.map +1 -0
  184. package/dist/src/rendering/cell-pool/cell-pool.interface.d.ts +76 -0
  185. package/dist/src/rendering/cell-pool/cell-pool.interface.d.ts.map +1 -0
  186. package/dist/src/rendering/cell-pool/index.d.ts +6 -0
  187. package/dist/src/rendering/cell-pool/index.d.ts.map +1 -0
  188. package/dist/src/rendering/cell-positioner/cell-positioner.d.ts +46 -0
  189. package/dist/src/rendering/cell-positioner/cell-positioner.d.ts.map +1 -0
  190. package/dist/src/rendering/cell-positioner/cell-positioner.interface.d.ts +86 -0
  191. package/dist/src/rendering/cell-positioner/cell-positioner.interface.d.ts.map +1 -0
  192. package/dist/src/rendering/cell-positioner/index.d.ts +6 -0
  193. package/dist/src/rendering/cell-positioner/index.d.ts.map +1 -0
  194. package/dist/src/rendering/height-provider/height-provider.interface.d.ts +62 -0
  195. package/dist/src/rendering/height-provider/height-provider.interface.d.ts.map +1 -0
  196. package/dist/src/rendering/height-provider/index.d.ts +7 -0
  197. package/dist/src/rendering/height-provider/index.d.ts.map +1 -0
  198. package/dist/src/rendering/height-provider/uniform-height-provider.d.ts +31 -0
  199. package/dist/src/rendering/height-provider/uniform-height-provider.d.ts.map +1 -0
  200. package/dist/src/rendering/height-provider/variable-height-provider.d.ts +33 -0
  201. package/dist/src/rendering/height-provider/variable-height-provider.d.ts.map +1 -0
  202. package/dist/src/rendering/renderers/advanced-cell-renderer.d.ts +105 -0
  203. package/dist/src/rendering/renderers/advanced-cell-renderer.d.ts.map +1 -0
  204. package/dist/src/rendering/renderers/image-renderer.d.ts +60 -0
  205. package/dist/src/rendering/renderers/image-renderer.d.ts.map +1 -0
  206. package/dist/src/rendering/renderers/index.d.ts +13 -0
  207. package/dist/src/rendering/renderers/index.d.ts.map +1 -0
  208. package/dist/src/rendering/renderers/number-renderer.d.ts +71 -0
  209. package/dist/src/rendering/renderers/number-renderer.d.ts.map +1 -0
  210. package/dist/src/rendering/renderers/renderer-registry.d.ts +55 -0
  211. package/dist/src/rendering/renderers/renderer-registry.d.ts.map +1 -0
  212. package/dist/src/rendering/renderers/renderer.interface.d.ts +79 -0
  213. package/dist/src/rendering/renderers/renderer.interface.d.ts.map +1 -0
  214. package/dist/src/rendering/renderers/text-renderer.d.ts +20 -0
  215. package/dist/src/rendering/renderers/text-renderer.d.ts.map +1 -0
  216. package/dist/src/rendering/spatial-hit-tester.d.ts +108 -0
  217. package/dist/src/rendering/spatial-hit-tester.d.ts.map +1 -0
  218. package/dist/src/rendering/virtual-scroller/index.d.ts +6 -0
  219. package/dist/src/rendering/virtual-scroller/index.d.ts.map +1 -0
  220. package/dist/src/rendering/virtual-scroller/virtual-scroller.d.ts +56 -0
  221. package/dist/src/rendering/virtual-scroller/virtual-scroller.d.ts.map +1 -0
  222. package/dist/src/rendering/virtual-scroller/virtual-scroller.interface.d.ts +170 -0
  223. package/dist/src/rendering/virtual-scroller/virtual-scroller.interface.d.ts.map +1 -0
  224. package/dist/src/rendering/width-provider/index.d.ts +7 -0
  225. package/dist/src/rendering/width-provider/index.d.ts.map +1 -0
  226. package/dist/src/rendering/width-provider/uniform-width-provider.d.ts +31 -0
  227. package/dist/src/rendering/width-provider/uniform-width-provider.d.ts.map +1 -0
  228. package/dist/src/rendering/width-provider/variable-width-provider.d.ts +33 -0
  229. package/dist/src/rendering/width-provider/variable-width-provider.d.ts.map +1 -0
  230. package/dist/src/rendering/width-provider/width-provider.interface.d.ts +62 -0
  231. package/dist/src/rendering/width-provider/width-provider.interface.d.ts.map +1 -0
  232. package/dist/src/selection/hit-tester.d.ts +168 -0
  233. package/dist/src/selection/hit-tester.d.ts.map +1 -0
  234. package/dist/src/selection/hit-tester.interface.d.ts +108 -0
  235. package/dist/src/selection/hit-tester.interface.d.ts.map +1 -0
  236. package/dist/src/selection/index.d.ts +9 -0
  237. package/dist/src/selection/index.d.ts.map +1 -0
  238. package/dist/src/selection/range-utils.d.ts +219 -0
  239. package/dist/src/selection/range-utils.d.ts.map +1 -0
  240. package/dist/src/selection/range-utils.interface.d.ts +51 -0
  241. package/dist/src/selection/range-utils.interface.d.ts.map +1 -0
  242. package/dist/src/styles/grid.css +356 -0
  243. package/dist/src/styles.css +273 -0
  244. package/dist/src/touch/index.d.ts +6 -0
  245. package/dist/src/touch/index.d.ts.map +1 -0
  246. package/dist/src/touch/touch-handler.d.ts +167 -0
  247. package/dist/src/touch/touch-handler.d.ts.map +1 -0
  248. package/dist/src/types/index.d.ts +133 -0
  249. package/dist/src/types/index.d.ts.map +1 -0
  250. package/dist/src/types.d.ts +559 -0
  251. package/dist/src/types.d.ts.map +1 -0
  252. package/package.json +47 -0
@@ -0,0 +1,33 @@
1
+ import type { WidthProvider } from './width-provider.interface';
2
+ /**
3
+ * VariableWidthProvider - Variable widths using PrefixSumArray
4
+ *
5
+ * Supports different width for each column using prefix sums for efficient lookup.
6
+ * - O(1) for getWidth, getOffset, getTotalWidth
7
+ * - O(log n) for findIndexAtOffset (binary search)
8
+ * - O(n) for setWidth (updates all prefix sums after the changed index)
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const widths = [100, 150, 200, 100, 120];
13
+ * const provider = new VariableWidthProvider(widths);
14
+ * provider.getWidth(2); // 200
15
+ * provider.getOffset(2); // 250 (100 + 150)
16
+ * provider.findIndexAtOffset(300); // 2
17
+ * ```
18
+ */
19
+ export declare class VariableWidthProvider implements WidthProvider {
20
+ private widths;
21
+ /**
22
+ * Create a variable width provider
23
+ * @param widths - Array of widths for each column
24
+ */
25
+ constructor(widths: number[]);
26
+ getWidth(index: number): number;
27
+ getOffset(index: number): number;
28
+ getTotalWidth(): number;
29
+ findIndexAtOffset(offset: number): number;
30
+ setWidth(index: number, width: number): void;
31
+ get length(): number;
32
+ }
33
+ //# sourceMappingURL=variable-width-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variable-width-provider.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/rendering/width-provider/variable-width-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,qBAAsB,YAAW,aAAa;IACzD,OAAO,CAAC,MAAM,CAAiB;IAE/B;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE;IAQ5B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI/B,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIhC,aAAa,IAAI,MAAM;IAIvB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAIzC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAO5C,IAAI,MAAM,IAAI,MAAM,CAEnB;CACF"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * WidthProvider interface for configurable column width calculation
3
+ *
4
+ * Provides a strategy pattern for calculating column widths and positions.
5
+ * Implementations can provide uniform widths, variable widths, or custom logic.
6
+ */
7
+ export interface WidthProvider {
8
+ /**
9
+ * Get the width of a specific column
10
+ * @param index - Column index
11
+ * @returns Width in pixels
12
+ * @complexity O(1)
13
+ */
14
+ getWidth(index: number): number;
15
+ /**
16
+ * Get the X offset where a column starts
17
+ * @param index - Column index
18
+ * @returns Offset in pixels from left
19
+ * @complexity O(1) for uniform, O(1) for variable (cached)
20
+ */
21
+ getOffset(index: number): number;
22
+ /**
23
+ * Get the total width of all columns
24
+ * @returns Total width in pixels
25
+ * @complexity O(1)
26
+ */
27
+ getTotalWidth(): number;
28
+ /**
29
+ * Find which column contains a given X offset
30
+ * @param offset - X position in pixels
31
+ * @returns Column index at that offset
32
+ * @complexity O(1) for uniform, O(log n) for variable
33
+ */
34
+ findIndexAtOffset(offset: number): number;
35
+ /**
36
+ * Update the width of a specific column (optional)
37
+ * @param index - Column index
38
+ * @param width - New width in pixels
39
+ * @complexity Varies by implementation
40
+ */
41
+ setWidth?(index: number, width: number): void;
42
+ /**
43
+ * Total number of columns
44
+ */
45
+ readonly length: number;
46
+ }
47
+ /**
48
+ * Options for creating a width provider
49
+ */
50
+ export interface WidthProviderOptions {
51
+ /**
52
+ * Total number of columns
53
+ */
54
+ colCount: number;
55
+ /**
56
+ * Width value(s):
57
+ * - number: uniform width for all columns
58
+ * - number[]: individual widths per column
59
+ */
60
+ width: number | number[];
61
+ }
62
+ //# sourceMappingURL=width-provider.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"width-provider.interface.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/rendering/width-provider/width-provider.interface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhC;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEjC;;;;OAIG;IACH,aAAa,IAAI,MAAM,CAAC;IAExB;;;;;OAKG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1C;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9C;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC1B"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * @fileoverview Hit testing for mouse interaction with grid cells
3
+ * @module @zengrid/core/selection/hit-tester
4
+ */
5
+ import type { CellRef } from '../types';
6
+ import type { HitTestResult, HitTestOptions, IHeightProvider, IWidthProvider } from './hit-tester.interface';
7
+ /**
8
+ * HitTester - Determines which cell is at given coordinates
9
+ *
10
+ * Supports both uniform and variable cell sizes with optimal performance:
11
+ * - O(1) for uniform sizes
12
+ * - O(log n) for variable sizes (using binary search)
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const hitTester = new HitTester(heightProvider, widthProvider, {
17
+ * rowCount: 1000,
18
+ * colCount: 26
19
+ * });
20
+ *
21
+ * // Find cell at mouse position
22
+ * const result = hitTester.getCellAtPoint(150, 300);
23
+ * if (result.hit) {
24
+ * console.log(`Clicked cell: ${result.cell.row}, ${result.cell.col}`);
25
+ * }
26
+ * ```
27
+ */
28
+ export declare class HitTester {
29
+ private heightProvider;
30
+ private widthProvider;
31
+ private rowCount;
32
+ private colCount;
33
+ constructor(heightProvider: IHeightProvider, widthProvider: IWidthProvider, options: {
34
+ rowCount: number;
35
+ colCount: number;
36
+ });
37
+ /**
38
+ * Finds the cell at given point coordinates
39
+ *
40
+ * @param x - X coordinate (in grid space, not viewport)
41
+ * @param y - Y coordinate (in grid space, not viewport)
42
+ * @param options - Hit test options
43
+ * @returns Hit test result
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const result = hitTester.getCellAtPoint(150, 300);
48
+ * if (result.hit) {
49
+ * console.log(`Cell: ${result.cell.row}, ${result.cell.col}`);
50
+ * }
51
+ * ```
52
+ */
53
+ getCellAtPoint(x: number, y: number, options?: HitTestOptions): HitTestResult;
54
+ /**
55
+ * Finds the cell at point, returns null if outside grid
56
+ *
57
+ * @param x - X coordinate
58
+ * @param y - Y coordinate
59
+ * @returns Cell reference or null
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const cell = hitTester.getCellAtPointOrNull(150, 300);
64
+ * if (cell) {
65
+ * console.log(`Clicked: ${cell.row}, ${cell.col}`);
66
+ * }
67
+ * ```
68
+ */
69
+ getCellAtPointOrNull(x: number, y: number): CellRef | null;
70
+ /**
71
+ * Checks if a point is within the grid boundaries
72
+ *
73
+ * @param x - X coordinate
74
+ * @param y - Y coordinate
75
+ * @returns True if point is within grid
76
+ */
77
+ isPointInGrid(x: number, y: number): boolean;
78
+ /**
79
+ * Gets the bounding box of a cell
80
+ *
81
+ * @param row - Row index
82
+ * @param col - Column index
83
+ * @returns Bounding box { left, top, width, height }
84
+ */
85
+ getCellBounds(row: number, col: number): {
86
+ left: number;
87
+ top: number;
88
+ width: number;
89
+ height: number;
90
+ };
91
+ /**
92
+ * Checks if a point is within a specific cell
93
+ *
94
+ * @param x - X coordinate
95
+ * @param y - Y coordinate
96
+ * @param row - Row index
97
+ * @param col - Column index
98
+ * @returns True if point is within the cell
99
+ */
100
+ isPointInCell(x: number, y: number, row: number, col: number): boolean;
101
+ /**
102
+ * Gets the row at a given Y coordinate
103
+ *
104
+ * @param y - Y coordinate
105
+ * @returns Row index or -1 if outside
106
+ */
107
+ getRowAtY(y: number): number;
108
+ /**
109
+ * Gets the column at a given X coordinate
110
+ *
111
+ * @param x - X coordinate
112
+ * @returns Column index or -1 if outside
113
+ */
114
+ getColAtX(x: number): number;
115
+ /**
116
+ * Converts viewport coordinates to grid coordinates
117
+ *
118
+ * @param viewportX - X in viewport space
119
+ * @param viewportY - Y in viewport space
120
+ * @param scrollLeft - Horizontal scroll position
121
+ * @param scrollTop - Vertical scroll position
122
+ * @returns Grid coordinates { x, y }
123
+ */
124
+ viewportToGrid(viewportX: number, viewportY: number, scrollLeft: number, scrollTop: number): {
125
+ x: number;
126
+ y: number;
127
+ };
128
+ /**
129
+ * Converts grid coordinates to viewport coordinates
130
+ *
131
+ * @param gridX - X in grid space
132
+ * @param gridY - Y in grid space
133
+ * @param scrollLeft - Horizontal scroll position
134
+ * @param scrollTop - Vertical scroll position
135
+ * @returns Viewport coordinates { x, y }
136
+ */
137
+ gridToViewport(gridX: number, gridY: number, scrollLeft: number, scrollTop: number): {
138
+ x: number;
139
+ y: number;
140
+ };
141
+ /**
142
+ * Updates the grid dimensions
143
+ *
144
+ * @param rowCount - New row count
145
+ * @param colCount - New column count
146
+ */
147
+ updateDimensions(rowCount: number, colCount: number): void;
148
+ /**
149
+ * Gets current grid dimensions
150
+ *
151
+ * @returns { rowCount, colCount }
152
+ */
153
+ getDimensions(): {
154
+ rowCount: number;
155
+ colCount: number;
156
+ };
157
+ }
158
+ /**
159
+ * Creates a HitTester instance
160
+ *
161
+ * @param heightProvider - Provider for row heights
162
+ * @param widthProvider - Provider for column widths
163
+ * @param rowCount - Total number of rows
164
+ * @param colCount - Total number of columns
165
+ * @returns HitTester instance
166
+ */
167
+ export declare function createHitTester(heightProvider: IHeightProvider, widthProvider: IWidthProvider, rowCount: number, colCount: number): HitTester;
168
+ //# sourceMappingURL=hit-tester.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hit-tester.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/selection/hit-tester.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,EACf,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;gBAGvB,cAAc,EAAE,eAAe,EAC/B,aAAa,EAAE,cAAc,EAC7B,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAQjD;;;;;;;;;;;;;;;OAeG;IACH,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,aAAa;IAuDjF;;;;;;;;;;;;;;OAcG;IACH,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;IAK1D;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO;IAO5C;;;;;;OAMG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAarG;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAWtE;;;;;OAKG;IACH,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAK5B;;;;;OAKG;IACH,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAK5B;;;;;;;;OAQG;IACH,cAAc,CACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAO3B;;;;;;;;OAQG;IACH,cAAc,CACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAO3B;;;;;OAKG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAK1D;;;;OAIG;IACH,aAAa,IAAI;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;CAMxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,eAAe,EAC/B,aAAa,EAAE,cAAc,EAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,SAAS,CAEX"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @fileoverview Hit testing interfaces for mouse interaction
3
+ * @module @zengrid/core/selection/hit-tester
4
+ */
5
+ import type { CellRef } from '../types';
6
+ /**
7
+ * Result of a hit test operation
8
+ */
9
+ export interface HitTestResult {
10
+ /**
11
+ * Whether the point is within the grid
12
+ */
13
+ hit: boolean;
14
+ /**
15
+ * Cell reference if hit, undefined otherwise
16
+ */
17
+ cell?: CellRef;
18
+ /**
19
+ * Precise x offset within the cell (0-1, where 0 is left edge, 1 is right edge)
20
+ */
21
+ cellOffsetX?: number;
22
+ /**
23
+ * Precise y offset within the cell (0-1, where 0 is top edge, 1 is bottom edge)
24
+ */
25
+ cellOffsetY?: number;
26
+ /**
27
+ * Absolute x position of cell's left edge
28
+ */
29
+ cellLeft?: number;
30
+ /**
31
+ * Absolute y position of cell's top edge
32
+ */
33
+ cellTop?: number;
34
+ /**
35
+ * Cell width in pixels
36
+ */
37
+ cellWidth?: number;
38
+ /**
39
+ * Cell height in pixels
40
+ */
41
+ cellHeight?: number;
42
+ }
43
+ /**
44
+ * Options for hit testing
45
+ */
46
+ export interface HitTestOptions {
47
+ /**
48
+ * Whether to allow hits outside grid boundaries
49
+ * If true, returns nearest cell; if false, returns null
50
+ * @default false
51
+ */
52
+ allowOutside?: boolean;
53
+ /**
54
+ * Whether to include precise offset information
55
+ * @default false
56
+ */
57
+ includePreciseOffset?: boolean;
58
+ /**
59
+ * Scroll offset (if point is in viewport coordinates)
60
+ */
61
+ scrollOffset?: {
62
+ top: number;
63
+ left: number;
64
+ };
65
+ }
66
+ /**
67
+ * Interface for height providers (uniform or variable)
68
+ */
69
+ export interface IHeightProvider {
70
+ /**
71
+ * Get height of a specific row
72
+ */
73
+ getHeight(index: number): number;
74
+ /**
75
+ * Get offset to a specific row
76
+ */
77
+ getOffset(index: number): number;
78
+ /**
79
+ * Find row at given offset
80
+ */
81
+ findIndexAtOffset(offset: number): number;
82
+ /**
83
+ * Get total height of all rows
84
+ */
85
+ getTotalSize(): number;
86
+ }
87
+ /**
88
+ * Interface for width providers (uniform or variable)
89
+ */
90
+ export interface IWidthProvider {
91
+ /**
92
+ * Get width of a specific column
93
+ */
94
+ getWidth(index: number): number;
95
+ /**
96
+ * Get offset to a specific column
97
+ */
98
+ getOffset(index: number): number;
99
+ /**
100
+ * Find column at given offset
101
+ */
102
+ findIndexAtOffset(offset: number): number;
103
+ /**
104
+ * Get total width of all columns
105
+ */
106
+ getTotalSize(): number;
107
+ }
108
+ //# sourceMappingURL=hit-tester.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hit-tester.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/selection/hit-tester.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,YAAY,CAAC,EAAE;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEjC;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEjC;;OAEG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1C;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhC;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEjC;;OAEG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1C;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC;CACxB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @fileoverview Selection utilities
3
+ * @module @zengrid/core/selection
4
+ */
5
+ export * from './range-utils';
6
+ export * from './range-utils.interface';
7
+ export * from './hit-tester';
8
+ export * from './hit-tester.interface';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/selection/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,219 @@
1
+ /**
2
+ * @fileoverview Range utilities for selection system
3
+ * @module @zengrid/core/selection/range-utils
4
+ */
5
+ import type { CellRange, CellRef } from '../types';
6
+ import type { RangeIntersection, RangeSize, MergeRangesOptions } from './range-utils.interface';
7
+ /**
8
+ * Normalizes a cell range to ensure startRow <= endRow and startCol <= endCol
9
+ *
10
+ * @param range - Range to normalize
11
+ * @returns Normalized range
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const range = { startRow: 5, startCol: 3, endRow: 2, endCol: 1 };
16
+ * const normalized = normalizeRange(range);
17
+ * // { startRow: 2, startCol: 1, endRow: 5, endCol: 3 }
18
+ * ```
19
+ */
20
+ export declare function normalizeRange(range: CellRange): CellRange;
21
+ /**
22
+ * Checks if a cell is contained within a range
23
+ *
24
+ * @param range - Range to check
25
+ * @param row - Row index
26
+ * @param col - Column index
27
+ * @returns True if cell is within range
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const range = { startRow: 0, startCol: 0, endRow: 5, endCol: 5 };
32
+ * containsCell(range, 2, 3); // true
33
+ * containsCell(range, 6, 3); // false
34
+ * ```
35
+ */
36
+ export declare function containsCell(range: CellRange, row: number, col: number): boolean;
37
+ /**
38
+ * Checks if a cell reference is contained within a range
39
+ *
40
+ * @param range - Range to check
41
+ * @param cell - Cell reference
42
+ * @returns True if cell is within range
43
+ */
44
+ export declare function containsCellRef(range: CellRange, cell: CellRef): boolean;
45
+ /**
46
+ * Checks if two ranges intersect
47
+ *
48
+ * @param a - First range
49
+ * @param b - Second range
50
+ * @returns True if ranges intersect
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * const a = { startRow: 0, startCol: 0, endRow: 5, endCol: 5 };
55
+ * const b = { startRow: 3, startCol: 3, endRow: 8, endCol: 8 };
56
+ * rangesIntersect(a, b); // true
57
+ * ```
58
+ */
59
+ export declare function rangesIntersect(a: CellRange, b: CellRange): boolean;
60
+ /**
61
+ * Gets the intersection of two ranges
62
+ *
63
+ * @param a - First range
64
+ * @param b - Second range
65
+ * @returns Intersection result
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * const a = { startRow: 0, startCol: 0, endRow: 5, endCol: 5 };
70
+ * const b = { startRow: 3, startCol: 3, endRow: 8, endCol: 8 };
71
+ * const result = getRangeIntersection(a, b);
72
+ * // { intersects: true, intersection: { startRow: 3, startCol: 3, endRow: 5, endCol: 5 } }
73
+ * ```
74
+ */
75
+ export declare function getRangeIntersection(a: CellRange, b: CellRange): RangeIntersection;
76
+ /**
77
+ * Checks if range A completely contains range B
78
+ *
79
+ * @param a - Outer range
80
+ * @param b - Inner range
81
+ * @returns True if A contains B
82
+ */
83
+ export declare function rangeContains(a: CellRange, b: CellRange): boolean;
84
+ /**
85
+ * Gets the size of a range (number of rows and columns)
86
+ *
87
+ * @param range - Range to measure
88
+ * @returns Range size information
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * const range = { startRow: 0, startCol: 0, endRow: 5, endCol: 3 };
93
+ * getRangeSize(range);
94
+ * // { rows: 6, cols: 4, totalCells: 24 }
95
+ * ```
96
+ */
97
+ export declare function getRangeSize(range: CellRange): RangeSize;
98
+ /**
99
+ * Checks if a range is empty (zero size)
100
+ *
101
+ * @param range - Range to check
102
+ * @returns True if range has no cells
103
+ */
104
+ export declare function isRangeEmpty(range: CellRange): boolean;
105
+ /**
106
+ * Checks if a range is a single cell
107
+ *
108
+ * @param range - Range to check
109
+ * @returns True if range contains exactly one cell
110
+ */
111
+ export declare function isSingleCell(range: CellRange): boolean;
112
+ /**
113
+ * Creates a range from a single cell
114
+ *
115
+ * @param row - Row index
116
+ * @param col - Column index
117
+ * @returns Range containing single cell
118
+ */
119
+ export declare function cellToRange(row: number, col: number): CellRange;
120
+ /**
121
+ * Creates a range from a cell reference
122
+ *
123
+ * @param cell - Cell reference
124
+ * @returns Range containing single cell
125
+ */
126
+ export declare function cellRefToRange(cell: CellRef): CellRange;
127
+ /**
128
+ * Merges overlapping and optionally adjacent ranges
129
+ *
130
+ * @param ranges - Array of ranges to merge
131
+ * @param options - Merge options
132
+ * @returns Array of non-overlapping ranges
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * const ranges = [
137
+ * { startRow: 0, startCol: 0, endRow: 2, endCol: 2 },
138
+ * { startRow: 1, startCol: 1, endRow: 3, endCol: 3 },
139
+ * { startRow: 5, startCol: 5, endRow: 7, endCol: 7 }
140
+ * ];
141
+ * const merged = mergeRanges(ranges);
142
+ * // [
143
+ * // { startRow: 0, startCol: 0, endRow: 3, endCol: 3 },
144
+ * // { startRow: 5, startCol: 5, endRow: 7, endCol: 7 }
145
+ * // ]
146
+ * ```
147
+ */
148
+ export declare function mergeRanges(ranges: CellRange[], options?: MergeRangesOptions): CellRange[];
149
+ /**
150
+ * Checks if two ranges are adjacent (touching but not overlapping)
151
+ *
152
+ * @param a - First range
153
+ * @param b - Second range
154
+ * @returns True if ranges are adjacent
155
+ */
156
+ export declare function rangesAreAdjacent(a: CellRange, b: CellRange): boolean;
157
+ /**
158
+ * Expands a range by a specified number of rows and columns
159
+ *
160
+ * @param range - Range to expand
161
+ * @param rows - Number of rows to expand (can be negative to shrink)
162
+ * @param cols - Number of columns to expand (can be negative to shrink)
163
+ * @returns Expanded range
164
+ */
165
+ export declare function expandRange(range: CellRange, rows: number, cols: number): CellRange;
166
+ /**
167
+ * Clamps a range to fit within specified boundaries
168
+ *
169
+ * @param range - Range to clamp
170
+ * @param maxRow - Maximum row index
171
+ * @param maxCol - Maximum column index
172
+ * @returns Clamped range
173
+ */
174
+ export declare function clampRange(range: CellRange, maxRow: number, maxCol: number): CellRange;
175
+ /**
176
+ * Checks if two ranges are equal
177
+ *
178
+ * @param a - First range
179
+ * @param b - Second range
180
+ * @returns True if ranges are equal
181
+ */
182
+ export declare function rangesEqual(a: CellRange, b: CellRange): boolean;
183
+ /**
184
+ * Converts a range to a string representation
185
+ *
186
+ * @param range - Range to convert
187
+ * @returns String representation (e.g., "A1:B5")
188
+ */
189
+ export declare function rangeToString(range: CellRange): string;
190
+ /**
191
+ * Converts a cell reference to A1 notation
192
+ *
193
+ * @param cell - Cell reference
194
+ * @returns A1 notation (e.g., "B3")
195
+ */
196
+ export declare function cellRefToString(cell: CellRef): string;
197
+ /**
198
+ * Iterates over all cells in a range
199
+ *
200
+ * @param range - Range to iterate
201
+ * @param callback - Callback function called for each cell
202
+ *
203
+ * @example
204
+ * ```typescript
205
+ * const range = { startRow: 0, startCol: 0, endRow: 2, endCol: 2 };
206
+ * forEachCellInRange(range, (row, col) => {
207
+ * console.log(`Cell: ${row}, ${col}`);
208
+ * });
209
+ * ```
210
+ */
211
+ export declare function forEachCellInRange(range: CellRange, callback: (row: number, col: number) => void): void;
212
+ /**
213
+ * Gets all cell references in a range
214
+ *
215
+ * @param range - Range to get cells from
216
+ * @returns Array of cell references
217
+ */
218
+ export declare function getCellsInRange(range: CellRange): CellRef[];
219
+ //# sourceMappingURL=range-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"range-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/selection/range-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAEhG;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAO1D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAQhF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAExE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,OAAO,CAUnE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,iBAAiB,CAiBlF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,OAAO,CAUjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAUxD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAGtD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAGtD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAEvD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,OAAO,GAAE,kBAAuB,GAAG,SAAS,EAAE,CAoD9F;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,OAAO,CAiBrE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CASnF;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAStF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,OAAO,CAU/D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAOtD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAUrD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAQvG;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,EAAE,CAM3D"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @fileoverview Range utilities interfaces for selection system
3
+ * @module @zengrid/core/selection/range-utils
4
+ */
5
+ import type { CellRange } from '../types';
6
+ /**
7
+ * Result of range intersection check
8
+ */
9
+ export interface RangeIntersection {
10
+ /**
11
+ * Whether ranges intersect
12
+ */
13
+ intersects: boolean;
14
+ /**
15
+ * Intersection range if ranges intersect
16
+ */
17
+ intersection?: CellRange;
18
+ }
19
+ /**
20
+ * Range size information
21
+ */
22
+ export interface RangeSize {
23
+ /**
24
+ * Number of rows in range
25
+ */
26
+ rows: number;
27
+ /**
28
+ * Number of columns in range
29
+ */
30
+ cols: number;
31
+ /**
32
+ * Total cells in range
33
+ */
34
+ totalCells: number;
35
+ }
36
+ /**
37
+ * Options for merging ranges
38
+ */
39
+ export interface MergeRangesOptions {
40
+ /**
41
+ * Whether to merge adjacent (touching) ranges
42
+ * @default false
43
+ */
44
+ mergeAdjacent?: boolean;
45
+ /**
46
+ * Whether to sort ranges before merging
47
+ * @default true
48
+ */
49
+ sort?: boolean;
50
+ }
51
+ //# sourceMappingURL=range-utils.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"range-utils.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/selection/range-utils.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB"}