d2coreui 23.0.52 → 23.0.53

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 (280) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +154 -0
  3. package/components/clipboard/clipboardUtils.d.ts +11 -0
  4. package/components/clipboard/clipboardUtils.js +16 -4
  5. package/components/clipboard/clipboardUtils.js.map +1 -1
  6. package/components/codemirror/SyntaxHighlighter.d.ts +13 -0
  7. package/components/codemirror/SyntaxHighlighter.js +6 -1
  8. package/components/codemirror/SyntaxHighlighter.js.map +1 -1
  9. package/components/collapse/expandable.d.ts +10 -0
  10. package/components/collapse/expandable.js +4 -0
  11. package/components/collapse/expandable.js.map +1 -1
  12. package/components/color/colorPicker.d.ts +16 -0
  13. package/components/color/colorPicker.js +4 -0
  14. package/components/color/colorPicker.js.map +1 -1
  15. package/components/color/colorSwatch.d.ts +16 -0
  16. package/components/color/colorSwatch.js +23 -2
  17. package/components/color/colorSwatch.js.map +1 -1
  18. package/components/color/colorUtils.d.ts +9 -0
  19. package/components/color/colorUtils.js +15 -0
  20. package/components/color/colorUtils.js.map +1 -1
  21. package/components/date/dateRangeInput.d.ts +76 -0
  22. package/components/date/dateRangeInput.js +63 -12
  23. package/components/date/dateRangeInput.js.map +1 -1
  24. package/components/date/dateRangeInputAdvancedPanel.d.ts +27 -0
  25. package/components/date/dateRangeInputAdvancedPanel.js +7 -0
  26. package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
  27. package/components/date/dateRangeInputConfirm.d.ts +18 -0
  28. package/components/date/dateRangeInputConfirm.js +12 -0
  29. package/components/date/dateRangeInputConfirm.js.map +1 -1
  30. package/components/date/dateTimeInput.d.ts +99 -0
  31. package/components/date/dateTimeInput.js +78 -6
  32. package/components/date/dateTimeInput.js.map +1 -1
  33. package/components/date/durationInput.d.ts +37 -0
  34. package/components/date/durationInput.js +26 -3
  35. package/components/date/durationInput.js.map +1 -1
  36. package/components/date/savedIntervals.d.ts +63 -0
  37. package/components/date/savedIntervals.js +37 -0
  38. package/components/date/savedIntervals.js.map +1 -1
  39. package/components/date/savedIntervalsDialog.d.ts +13 -0
  40. package/components/date/savedIntervalsDialog.js +7 -2
  41. package/components/date/savedIntervalsDialog.js.map +1 -1
  42. package/components/form/NiceFormItem.d.ts +9 -0
  43. package/components/form/NiceFormItem.js +4 -0
  44. package/components/form/NiceFormItem.js.map +1 -1
  45. package/components/grid/cell/beanAccessor.d.ts +12 -0
  46. package/components/grid/cell/beanAccessor.js +8 -0
  47. package/components/grid/cell/beanAccessor.js.map +1 -1
  48. package/components/grid/cell/bigNumberCellEditor.d.ts +9 -0
  49. package/components/grid/cell/bigNumberCellEditor.js +19 -0
  50. package/components/grid/cell/bigNumberCellEditor.js.map +1 -1
  51. package/components/grid/cell/cellControl.d.ts +4 -0
  52. package/components/grid/cell/cellControl.js +14 -0
  53. package/components/grid/cell/cellControl.js.map +1 -1
  54. package/components/grid/cell/cellEditorUtils.d.ts +6 -0
  55. package/components/grid/cell/cellEditorUtils.js +6 -0
  56. package/components/grid/cell/cellEditorUtils.js.map +1 -1
  57. package/components/grid/cell/customEnumCellEditor.d.ts +6 -0
  58. package/components/grid/cell/customEnumCellEditor.js +10 -0
  59. package/components/grid/cell/customEnumCellEditor.js.map +1 -1
  60. package/components/grid/cell/dataGridCellEditorComponent.d.ts +26 -0
  61. package/components/grid/cell/dataGridCellEditorComponent.js +21 -0
  62. package/components/grid/cell/dataGridCellEditorComponent.js.map +1 -1
  63. package/components/grid/cell/dateCellEditor.d.ts +6 -0
  64. package/components/grid/cell/dateCellEditor.js +10 -0
  65. package/components/grid/cell/dateCellEditor.js.map +1 -1
  66. package/components/grid/cell/dragListenerFeature.d.ts +6 -0
  67. package/components/grid/cell/dragListenerFeature.js +6 -0
  68. package/components/grid/cell/dragListenerFeature.js.map +1 -1
  69. package/components/grid/cell/durationCellEditor.d.ts +6 -0
  70. package/components/grid/cell/durationCellEditor.js +14 -0
  71. package/components/grid/cell/durationCellEditor.js.map +1 -1
  72. package/components/grid/cell/hexaOctetStringCellEditor.d.ts +6 -0
  73. package/components/grid/cell/hexaOctetStringCellEditor.js +14 -0
  74. package/components/grid/cell/hexaOctetStringCellEditor.js.map +1 -1
  75. package/components/grid/cell/hexaValueCellEditor.d.ts +6 -0
  76. package/components/grid/cell/hexaValueCellEditor.js +14 -0
  77. package/components/grid/cell/hexaValueCellEditor.js.map +1 -1
  78. package/components/grid/cell/numberCellEditor.d.ts +6 -0
  79. package/components/grid/cell/numberCellEditor.js +15 -0
  80. package/components/grid/cell/numberCellEditor.js.map +1 -1
  81. package/components/grid/cell/rangeSelector.d.ts +7 -0
  82. package/components/grid/cell/rangeSelector.js +59 -5
  83. package/components/grid/cell/rangeSelector.js.map +1 -1
  84. package/components/grid/cell/simpleStatusTextCellEditor.d.ts +7 -0
  85. package/components/grid/cell/simpleStatusTextCellEditor.js +11 -0
  86. package/components/grid/cell/simpleStatusTextCellEditor.js.map +1 -1
  87. package/components/grid/cell/statusTextCellEditor.d.ts +7 -0
  88. package/components/grid/cell/statusTextCellEditor.js +17 -0
  89. package/components/grid/cell/statusTextCellEditor.js.map +1 -1
  90. package/components/grid/cell/tableDefaultRowStyleRules.d.ts +31 -0
  91. package/components/grid/cell/tableDefaultRowStyleRules.js +5 -0
  92. package/components/grid/cell/tableDefaultRowStyleRules.js.map +1 -1
  93. package/components/grid/cell/textCellEditor.d.ts +6 -0
  94. package/components/grid/cell/textCellEditor.js +15 -0
  95. package/components/grid/cell/textCellEditor.js.map +1 -1
  96. package/components/grid/cell/withAgGridHooks.d.ts +8 -0
  97. package/components/grid/cell/withAgGridHooks.js +8 -0
  98. package/components/grid/cell/withAgGridHooks.js.map +1 -1
  99. package/components/grid/columnUtils.d.ts +7 -0
  100. package/components/grid/columnUtils.js +7 -0
  101. package/components/grid/columnUtils.js.map +1 -1
  102. package/components/grid/config/columnTransfer.d.ts +18 -0
  103. package/components/grid/config/columnTransfer.js +14 -3
  104. package/components/grid/config/columnTransfer.js.map +1 -1
  105. package/components/grid/config/dataGridEditor.d.ts +31 -0
  106. package/components/grid/config/dataGridEditor.js +14 -2
  107. package/components/grid/config/dataGridEditor.js.map +1 -1
  108. package/components/grid/config/rowHeightCalculator.d.ts +11 -0
  109. package/components/grid/config/rowHeightCalculator.js +11 -0
  110. package/components/grid/config/rowHeightCalculator.js.map +1 -1
  111. package/components/grid/config/rowStylePicker.d.ts +19 -0
  112. package/components/grid/config/rowStylePicker.js +12 -0
  113. package/components/grid/config/rowStylePicker.js.map +1 -1
  114. package/components/grid/dataGrid.d.ts +331 -0
  115. package/components/grid/dataGrid.js +168 -11
  116. package/components/grid/dataGrid.js.map +1 -1
  117. package/components/grid/detail/detailHeaderPanel.d.ts +11 -0
  118. package/components/grid/detail/detailHeaderPanel.js +5 -0
  119. package/components/grid/detail/detailHeaderPanel.js.map +1 -1
  120. package/components/grid/export/contextMenu.d.ts +31 -0
  121. package/components/grid/export/contextMenu.js +8 -0
  122. package/components/grid/export/contextMenu.js.map +1 -1
  123. package/components/grid/export/progressPopup.d.ts +21 -0
  124. package/components/grid/export/progressPopup.js +17 -0
  125. package/components/grid/export/progressPopup.js.map +1 -1
  126. package/components/grid/export/worker/pdfExport.js +5 -0
  127. package/components/grid/export/worker/pdfExport.js.map +1 -1
  128. package/components/grid/extendedDataGrid.d.ts +240 -0
  129. package/components/grid/extendedDataGrid.js +116 -2
  130. package/components/grid/extendedDataGrid.js.map +1 -1
  131. package/components/grid/filter/customColumnFilter.d.ts +5 -0
  132. package/components/grid/filter/customColumnFilter.js +5 -0
  133. package/components/grid/filter/customColumnFilter.js.map +1 -1
  134. package/components/grid/filter/dataGridColumnFilter.d.ts +19 -0
  135. package/components/grid/filter/dataGridColumnFilter.js +19 -0
  136. package/components/grid/filter/dataGridColumnFilter.js.map +1 -1
  137. package/components/grid/filter/dateColumnFilter.d.ts +6 -0
  138. package/components/grid/filter/dateColumnFilter.js +6 -0
  139. package/components/grid/filter/dateColumnFilter.js.map +1 -1
  140. package/components/grid/filter/textColumnFilter.d.ts +6 -0
  141. package/components/grid/filter/textColumnFilter.js +6 -0
  142. package/components/grid/filter/textColumnFilter.js.map +1 -1
  143. package/components/grid/filter/wildcardQuickFilterEngine.d.ts +21 -0
  144. package/components/grid/filter/wildcardQuickFilterEngine.js +21 -0
  145. package/components/grid/filter/wildcardQuickFilterEngine.js.map +1 -1
  146. package/components/grid/header/simpleHeader.d.ts +17 -0
  147. package/components/grid/header/simpleHeader.js +20 -0
  148. package/components/grid/header/simpleHeader.js.map +1 -1
  149. package/components/grid/panel/dataGridPagination.d.ts +10 -0
  150. package/components/grid/panel/dataGridPagination.js +5 -0
  151. package/components/grid/panel/dataGridPagination.js.map +1 -1
  152. package/components/grid/panel/loadingOverlay.d.ts +5 -0
  153. package/components/grid/panel/loadingOverlay.js +4 -0
  154. package/components/grid/panel/loadingOverlay.js.map +1 -1
  155. package/components/grid/panel/noRecordsOverlay.d.ts +6 -0
  156. package/components/grid/panel/noRecordsOverlay.js +5 -0
  157. package/components/grid/panel/noRecordsOverlay.js.map +1 -1
  158. package/components/grid/panel/tablePagination.d.ts +4 -0
  159. package/components/grid/panel/tablePagination.js +4 -0
  160. package/components/grid/panel/tablePagination.js.map +1 -1
  161. package/components/icons/dropdownArrow.d.ts +3 -0
  162. package/components/icons/dropdownArrow.js +2 -0
  163. package/components/icons/dropdownArrow.js.map +1 -1
  164. package/components/icons/undoIcon.d.ts +2 -0
  165. package/components/icons/undoIcon.js +2 -0
  166. package/components/icons/undoIcon.js.map +1 -1
  167. package/components/input/autoCompleteInput.d.ts +29 -0
  168. package/components/input/autoCompleteInput.js +7 -0
  169. package/components/input/autoCompleteInput.js.map +1 -1
  170. package/components/input/draftUtils.d.ts +7 -0
  171. package/components/input/draftUtils.js +9 -0
  172. package/components/input/draftUtils.js.map +1 -1
  173. package/components/input/hexaFormattedInput.d.ts +9 -0
  174. package/components/input/hexaFormattedInput.js +3 -0
  175. package/components/input/hexaFormattedInput.js.map +1 -1
  176. package/components/input/mask/helpers.d.ts +27 -0
  177. package/components/input/mask/helpers.js +27 -0
  178. package/components/input/mask/helpers.js.map +1 -1
  179. package/components/input/mask/inputMaskCore.d.ts +80 -0
  180. package/components/input/mask/inputMaskCore.js +90 -0
  181. package/components/input/mask/inputMaskCore.js.map +1 -1
  182. package/components/input/mask/pattern.d.ts +24 -0
  183. package/components/input/mask/pattern.js +26 -0
  184. package/components/input/mask/pattern.js.map +1 -1
  185. package/components/input/maskedInput.d.ts +53 -0
  186. package/components/input/maskedInput.js +44 -4
  187. package/components/input/maskedInput.js.map +1 -1
  188. package/components/input/passwordInput.d.ts +7 -0
  189. package/components/input/passwordInput.js +8 -0
  190. package/components/input/passwordInput.js.map +1 -1
  191. package/components/input/simpleAutoComplete.d.ts +6 -0
  192. package/components/input/simpleAutoComplete.js +6 -0
  193. package/components/input/simpleAutoComplete.js.map +1 -1
  194. package/components/input/textarea/extractSpansOfClasses.d.ts +17 -0
  195. package/components/input/textarea/extractSpansOfClasses.js +26 -1
  196. package/components/input/textarea/extractSpansOfClasses.js.map +1 -1
  197. package/components/input/textarea/getRanges.d.ts +7 -0
  198. package/components/input/textarea/getRanges.js +11 -0
  199. package/components/input/textarea/getRanges.js.map +1 -1
  200. package/components/input/textarea/getType.d.ts +5 -0
  201. package/components/input/textarea/getType.js +5 -0
  202. package/components/input/textarea/getType.js.map +1 -1
  203. package/components/input/textarea/highlighedContents.d.ts +4 -0
  204. package/components/input/textarea/highlighedContents.js +5 -0
  205. package/components/input/textarea/highlighedContents.js.map +1 -1
  206. package/components/input/textarea/mentionsWithHighlighting.d.ts +25 -0
  207. package/components/input/textarea/mentionsWithHighlighting.js +14 -0
  208. package/components/input/textarea/mentionsWithHighlighting.js.map +1 -1
  209. package/components/keyboard/keyboardUtils.d.ts +6 -0
  210. package/components/keyboard/keyboardUtils.js +6 -0
  211. package/components/keyboard/keyboardUtils.js.map +1 -1
  212. package/components/modal/draggableModalProvider.d.ts +6 -0
  213. package/components/modal/draggableModalProvider.js +7 -0
  214. package/components/modal/draggableModalProvider.js.map +1 -1
  215. package/components/modal/impl/clamp.js +1 -0
  216. package/components/modal/impl/clamp.js.map +1 -1
  217. package/components/modal/impl/draggableModal.d.ts +1 -0
  218. package/components/modal/impl/draggableModal.js +6 -0
  219. package/components/modal/impl/draggableModal.js.map +1 -1
  220. package/components/modal/impl/draggableModalContext.js +1 -0
  221. package/components/modal/impl/draggableModalContext.js.map +1 -1
  222. package/components/modal/impl/draggableModalInner.js +12 -1
  223. package/components/modal/impl/draggableModalInner.js.map +1 -1
  224. package/components/modal/impl/draggableModalReducer.d.ts +7 -1
  225. package/components/modal/impl/draggableModalReducer.js +6 -1
  226. package/components/modal/impl/draggableModalReducer.js.map +1 -1
  227. package/components/modal/impl/draggableModalStyles.d.ts +17 -0
  228. package/components/modal/impl/draggableModalStyles.js +31 -0
  229. package/components/modal/impl/draggableModalStyles.js.map +1 -1
  230. package/components/modal/impl/getWindowSize.js +1 -0
  231. package/components/modal/impl/getWindowSize.js.map +1 -1
  232. package/components/modal/impl/index.js +1 -0
  233. package/components/modal/impl/index.js.map +1 -1
  234. package/components/modal/impl/resizeHandle.d.ts +1 -0
  235. package/components/modal/impl/resizeHandle.js +4 -1
  236. package/components/modal/impl/resizeHandle.js.map +1 -1
  237. package/components/modal/impl/useDrag.js +1 -0
  238. package/components/modal/impl/useDrag.js.map +1 -1
  239. package/components/modal/impl/usePrevious.js +1 -0
  240. package/components/modal/impl/usePrevious.js.map +1 -1
  241. package/components/modal/impl/useResize.js +1 -0
  242. package/components/modal/impl/useResize.js.map +1 -1
  243. package/components/modal/modalDialog.d.ts +85 -0
  244. package/components/modal/modalDialog.js +80 -10
  245. package/components/modal/modalDialog.js.map +1 -1
  246. package/components/picker/enumValuePicker.d.ts +17 -0
  247. package/components/picker/enumValuePicker.js +4 -0
  248. package/components/picker/enumValuePicker.js.map +1 -1
  249. package/components/platformSpecific.d.ts +17 -0
  250. package/components/platformSpecific.js +16 -0
  251. package/components/platformSpecific.js.map +1 -1
  252. package/components/scrollTo/onlyText.d.ts +5 -0
  253. package/components/scrollTo/onlyText.js +5 -0
  254. package/components/scrollTo/onlyText.js.map +1 -1
  255. package/components/scrollTo/scrollTo.d.ts +56 -0
  256. package/components/scrollTo/scrollTo.js +40 -3
  257. package/components/scrollTo/scrollTo.js.map +1 -1
  258. package/components/style/withCss.d.ts +15 -0
  259. package/components/style/withCss.js +6 -0
  260. package/components/style/withCss.js.map +1 -1
  261. package/components/table/dragSortingTable.d.ts +15 -0
  262. package/components/table/dragSortingTable.js +12 -0
  263. package/components/table/dragSortingTable.js.map +1 -1
  264. package/components/text/impl/innerSize.js +2 -0
  265. package/components/text/impl/innerSize.js.map +1 -1
  266. package/components/text/impl/series.d.ts +10 -0
  267. package/components/text/impl/series.js +10 -0
  268. package/components/text/impl/series.js.map +1 -1
  269. package/components/text/impl/shallowEqual.js +1 -0
  270. package/components/text/impl/shallowEqual.js.map +1 -1
  271. package/components/text/impl/whilst.d.ts +7 -0
  272. package/components/text/impl/whilst.js +7 -0
  273. package/components/text/impl/whilst.js.map +1 -1
  274. package/components/text/textFit.d.ts +24 -0
  275. package/components/text/textFit.js +29 -1
  276. package/components/text/textFit.js.map +1 -1
  277. package/i18n/componentsLocaleHolder.d.ts +9 -0
  278. package/i18n/componentsLocaleHolder.js +9 -0
  279. package/i18n/componentsLocaleHolder.js.map +1 -1
  280. package/package.json +66 -65
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Community replacement of ag-grid's enterprise cell range selection service, registered by `DataGrid`'s module as
3
+ * the `rangeSvc` bean. It lets the user select cell ranges by mouse drag (with auto-scroll), Ctrl/Cmd+drag adds
4
+ * further ranges unless multiple ranges are suppressed, and Shift+click/drag extends the latest range; ranges are
5
+ * cleared on pivot/row-group changes. On every change it also makes the grid's row selection match the rows covered
6
+ * by the ranges and dispatches `cellSelectionChanged` and `rangeSelectionChanged` events.
7
+ */
1
8
  export class RangeSelector extends BeanStub<"destroyed"> {
2
9
  constructor();
3
10
  beanName: string;
@@ -4,6 +4,13 @@ const SelectionMode = {
4
4
  NORMAL: 0,
5
5
  ALL_COLUMNS: 1,
6
6
  };
7
+ /**
8
+ * Community replacement of ag-grid's enterprise cell range selection service, registered by `DataGrid`'s module as
9
+ * the `rangeSvc` bean. It lets the user select cell ranges by mouse drag (with auto-scroll), Ctrl/Cmd+drag adds
10
+ * further ranges unless multiple ranges are suppressed, and Shift+click/drag extends the latest range; ranges are
11
+ * cleared on pivot/row-group changes. On every change it also makes the grid's row selection match the rows covered
12
+ * by the ranges and dispatches `cellSelectionChanged` and `rangeSelectionChanged` events.
13
+ */
7
14
  export class RangeSelector extends BeanStub {
8
15
  constructor() {
9
16
  super();
@@ -52,6 +59,7 @@ export class RangeSelector extends BeanStub {
52
59
  });
53
60
  });
54
61
  }
62
+ // Drag And Drop Target Methods
55
63
  onDragStart(mouseEvent) {
56
64
  var _a, _b;
57
65
  const gos = this.gos;
@@ -59,6 +67,7 @@ export class RangeSelector extends BeanStub {
59
67
  return;
60
68
  }
61
69
  const { ctrlKey, metaKey, shiftKey } = mouseEvent;
70
+ // ctrlKey for windows, metaKey for Apple
62
71
  const isMultiKey = ctrlKey || metaKey;
63
72
  const allowMulti = !_getSuppressMultiRanges(gos);
64
73
  const isMultiSelect = allowMulti ? isMultiKey : false;
@@ -66,6 +75,8 @@ export class RangeSelector extends BeanStub {
66
75
  if (!isMultiSelect && (!extendRange || _exists(_last(this.cellRanges).type))) {
67
76
  this.removeAllCellRanges(true);
68
77
  }
78
+ // The browser changes the Event target of cached events when working with the ShadowDOM
79
+ // so we need to retrieve the initial DragStartTarget.
69
80
  const startTarget = this.dragSvc.startTarget;
70
81
  if (startTarget) {
71
82
  this.updateValuesOnMove(startTarget);
@@ -79,6 +90,10 @@ export class RangeSelector extends BeanStub {
79
90
  if (!extendRange) {
80
91
  this.setNewestRangeStartCell(this.lastCellHovered);
81
92
  }
93
+ // if we didn't clear the ranges, then dragging means the user clicked, and when the
94
+ // user clicks it means a range of one cell was created. we need to extend this range
95
+ // rather than creating another range. otherwise we end up with two distinct ranges
96
+ // from a drag operation (one from click, and one from drag).
82
97
  if (this.cellRanges.length > 0) {
83
98
  this.draggingRange = _last(this.cellRanges);
84
99
  }
@@ -148,17 +163,23 @@ export class RangeSelector extends BeanStub {
148
163
  }
149
164
  this.dispatchChangedEvent(false, true, id);
150
165
  }
166
+ // Called for both columns loaded & column visibility events
151
167
  onColumnsChanged() {
168
+ // first move start column in last cell range (i.e. series chart range)
152
169
  this.refreshLastRangeStart();
153
170
  const allColumns = this.visibleCols.allCols;
171
+ // check that the columns in each range still exist and are visible
154
172
  for (const cellRange of this.cellRanges) {
155
173
  const beforeCols = cellRange.columns;
174
+ // remove hidden or removed cols from cell range
156
175
  cellRange.columns = cellRange.columns.filter((col) => col.isVisible() && allColumns.indexOf(col) !== -1);
157
176
  const colsInRangeChanged = !_areEqual(beforeCols, cellRange.columns);
158
177
  if (colsInRangeChanged) {
178
+ // notify users and other parts of grid (i.e. status panel) that range has changed
159
179
  this.dispatchChangedEvent(false, true, cellRange.id);
160
180
  }
161
181
  }
182
+ // Remove empty cell ranges
162
183
  const countBefore = this.cellRanges.length;
163
184
  this.cellRanges = this.cellRanges.filter((range) => range.columns.length > 0);
164
185
  if (countBefore > this.cellRanges.length) {
@@ -228,6 +249,7 @@ export class RangeSelector extends BeanStub {
228
249
  return;
229
250
  }
230
251
  const suppressMultiRangeSelections = _getSuppressMultiRanges(this.gos);
252
+ // if not appending, then clear previous range selections
231
253
  if (suppressMultiRangeSelections || !appendRange || _missing(this.cellRanges)) {
232
254
  this.removeAllCellRanges(true);
233
255
  }
@@ -278,7 +300,7 @@ export class RangeSelector extends BeanStub {
278
300
  stepsMoved++;
279
301
  }
280
302
  if (stepsMoved !== stepCount) {
281
- return;
303
+ return; // Could not move the desired number of rows
282
304
  }
283
305
  const cellPosition = Object.assign(Object.assign({}, currentRow), { column: this.getRangeLastColumn(cellRange) });
284
306
  this.updateRangeRowBoundary({ cellRange, boundary: isBottomUp ? 'start' : 'end', cellPosition });
@@ -288,7 +310,7 @@ export class RangeSelector extends BeanStub {
288
310
  if (delta === 0) {
289
311
  return;
290
312
  }
291
- const allColumns = this.getColumnsFromModel();
313
+ const allColumns = this.getColumnsFromModel(); // ordered visible columns
292
314
  if (!allColumns) {
293
315
  return;
294
316
  }
@@ -301,12 +323,14 @@ export class RangeSelector extends BeanStub {
301
323
  const endIdx = allColumns.indexOf(endColumn);
302
324
  const isRtlRange = endIdx < startIdx;
303
325
  if (isRtlRange) {
326
+ // if we are anchoring to the left and the range is rtl
327
+ // then we need to flip the start and end indices
304
328
  startIdx = endIdx;
305
329
  }
306
330
  const currentLength = columns.length;
307
331
  const targetLength = currentLength + delta;
308
332
  if (targetLength <= 0) {
309
- return;
333
+ return; // can't shrink to 0 or less
310
334
  }
311
335
  const newColumns = [];
312
336
  for (let i = startIdx; i < startIdx + targetLength; i++) {
@@ -316,8 +340,11 @@ export class RangeSelector extends BeanStub {
316
340
  }
317
341
  newColumns.push(col);
318
342
  }
343
+ // Only update if length actually changed
319
344
  if (newColumns.length === targetLength) {
320
345
  if (isRtlRange) {
346
+ // before we add changes to the range, the
347
+ // new range start should receive focus
321
348
  const newColumnToFocus = _last(newColumns);
322
349
  cellRange.startColumn = newColumnToFocus;
323
350
  this.focusCellOnNewColumn(cellRange, newColumnToFocus);
@@ -364,6 +391,7 @@ export class RangeSelector extends BeanStub {
364
391
  right: allColumns[_last(allIndices)],
365
392
  };
366
393
  }
394
+ // returns true if successful, false if not successful
367
395
  extendLatestRangeInDirection(event) {
368
396
  if (this.isEmpty() || !this.newestRangeStartCell) {
369
397
  return;
@@ -372,11 +400,13 @@ export class RangeSelector extends BeanStub {
372
400
  const ctrlKey = event.ctrlKey || event.metaKey;
373
401
  const lastRange = _last(this.cellRanges);
374
402
  const startCell = this.newestRangeStartCell;
403
+ // find the cell that is at the furthest away corner from the starting cell
375
404
  const endCellIndex = lastRange.endRow.rowIndex;
376
405
  const endCellFloating = lastRange.endRow.rowPinned;
377
406
  const endCellColumn = this.getRangeLastColumn(lastRange);
378
407
  const endCell = { column: endCellColumn, rowIndex: endCellIndex, rowPinned: endCellFloating };
379
408
  const newEndCell = this.cellNavigation.getNextCellToFocus(key, endCell, ctrlKey);
409
+ // if user is at end of grid, so no cell to extend to, we return false
380
410
  if (!newEndCell) {
381
411
  return;
382
412
  }
@@ -467,6 +497,7 @@ export class RangeSelector extends BeanStub {
467
497
  createCellRangeFromCellRangeParams(params) {
468
498
  return this.createPartialCellRangeFromRangeParams(params, false);
469
499
  }
500
+ // Range service can't normally support a range without columns, but charts can
470
501
  createPartialCellRangeFromRangeParams(params, allowEmptyColumns) {
471
502
  var _a;
472
503
  const { columns: paramColumns, columnStart, columnEnd, rowStartIndex, rowStartPinned, rowEndIndex, rowEndPinned, } = params;
@@ -489,6 +520,7 @@ export class RangeSelector extends BeanStub {
489
520
  if (!this.verifyCellRanges(gos)) {
490
521
  return;
491
522
  }
523
+ // when creating a new range via API we should reset the selection mode
492
524
  this.setSelectionMode(false);
493
525
  const newRange = this.createCellRangeFromCellRangeParams(params);
494
526
  if (newRange) {
@@ -515,8 +547,9 @@ export class RangeSelector extends BeanStub {
515
547
  return false;
516
548
  }
517
549
  if (len > 1) {
518
- return true;
550
+ return true; // Assumes a cell range must contain at least one cell
519
551
  }
552
+ // only one range, return true if range has more than one
520
553
  const range = this.cellRanges[0];
521
554
  const startRow = this.getRangeStartRow(range);
522
555
  const endRow = this.getRangeEndRow(range);
@@ -585,6 +618,7 @@ export class RangeSelector extends BeanStub {
585
618
  const isLastRow = cell.rowIndex === lastRow.rowIndex && _makeNull(cell.rowPinned) === _makeNull(lastRow.rowPinned);
586
619
  return isRightColumn && isLastRow;
587
620
  }
621
+ // returns the number of ranges this cell is in
588
622
  getCellRangeCount(cell) {
589
623
  if (this.isEmpty()) {
590
624
  return 0;
@@ -595,6 +629,7 @@ export class RangeSelector extends BeanStub {
595
629
  const firstRow = this.getRangeStartRow(cellRange);
596
630
  const lastRow = this.getRangeEndRow(cellRange);
597
631
  const thisRow = { rowIndex, rowPinned: rowPinned || null };
632
+ // compare rowPinned with == instead of === because it can be `null` or `undefined`
598
633
  const equalsFirstRow = thisRow.rowIndex === firstRow.rowIndex && thisRow.rowPinned == firstRow.rowPinned;
599
634
  const equalsLastRow = thisRow.rowIndex === lastRow.rowIndex && thisRow.rowPinned == lastRow.rowPinned;
600
635
  if (equalsFirstRow || equalsLastRow) {
@@ -605,6 +640,8 @@ export class RangeSelector extends BeanStub {
605
640
  return afterFirstRow && beforeLastRow;
606
641
  }
607
642
  intersectLastRange(fromMouseClick) {
643
+ // when ranges are created due to a mouse click without drag (happens in cellMouseListener)
644
+ // this method will be called with `fromMouseClick=true`.
608
645
  if (fromMouseClick && this.dragging) {
609
646
  return;
610
647
  }
@@ -624,14 +661,17 @@ export class RangeSelector extends BeanStub {
624
661
  const cols = range.columns;
625
662
  const intersectCols = cols.filter((col) => lastRange.columns.indexOf(col) === -1);
626
663
  if (intersectCols.length === cols.length) {
664
+ // No overlapping columns, retain previous range
627
665
  newRanges.push(range);
628
666
  continue;
629
667
  }
630
668
  if (_isRowBefore(intersectionEndRow, startRow) || _isRowBefore(endRow, intersectionStartRow)) {
669
+ // No overlapping rows, retain previous range
631
670
  newRanges.push(range);
632
671
  continue;
633
672
  }
634
673
  const rangeCountBefore = newRanges.length;
674
+ // Top
635
675
  if (_isRowBefore(startRow, intersectionStartRow)) {
636
676
  const top = {
637
677
  columns: [...cols],
@@ -641,6 +681,7 @@ export class RangeSelector extends BeanStub {
641
681
  };
642
682
  newRanges.push(top);
643
683
  }
684
+ // Left & Right (not contiguous with columns)
644
685
  if (intersectCols.length > 0) {
645
686
  const middle = {
646
687
  columns: intersectCols,
@@ -652,6 +693,7 @@ export class RangeSelector extends BeanStub {
652
693
  };
653
694
  newRanges.push(middle);
654
695
  }
696
+ // Bottom
655
697
  if (_isRowBefore(intersectionEndRow, endRow)) {
656
698
  newRanges.push({
657
699
  columns: [...cols],
@@ -661,10 +703,14 @@ export class RangeSelector extends BeanStub {
661
703
  });
662
704
  }
663
705
  if (newRanges.length - rangeCountBefore === 1) {
706
+ // Only one range result from the intersection.
707
+ // Copy the source range's id, since essentially we just reduced it's size
664
708
  newRanges[newRanges.length - 1].id = range.id;
665
709
  }
666
710
  }
667
711
  this.cellRanges = newRanges;
712
+ // when this is called because of a clickEvent and the ranges were changed
713
+ // we need to force a dragEnd event to update the UI.
668
714
  if (fromMouseClick) {
669
715
  this.dispatchChangedEvent(false, true);
670
716
  }
@@ -742,6 +788,9 @@ export class RangeSelector extends BeanStub {
742
788
  currentRow = _getRowBelow(this.beans, currentRow);
743
789
  }
744
790
  }
791
+ // as the user is dragging outside of the panel, the div starts to scroll, which in turn
792
+ // means we are selection more (or less) cells, but the mouse isn't moving, so we recalculate
793
+ // the selection my mimicking a new mouse event
745
794
  onBodyScroll() {
746
795
  if (this.dragging && this.lastMouseEvent) {
747
796
  this.onDragging(this.lastMouseEvent);
@@ -799,7 +848,7 @@ export class RangeSelector extends BeanStub {
799
848
  return isRowNumberCol(currentColumn);
800
849
  }
801
850
  dispatchChangedEvent(started, finished, id) {
802
- const allNodesToBeSelected = [];
851
+ const allNodesToBeSelected = []; // 1. Move OUTSIDE the loop
803
852
  this.cellRanges.map((cellRange) => {
804
853
  let currentRow = this.getRangeStartRow(cellRange);
805
854
  const lastRow = this.getRangeEndRow(cellRange);
@@ -901,19 +950,23 @@ export class RangeSelector extends BeanStub {
901
950
  focusSvc.setFocusedCell(Object.assign(Object.assign({}, row), { column: focusedCell.column, forceBrowserFocus: true, preventScrollOnBrowserFocus: true }));
902
951
  }
903
952
  }
953
+ // tests if this row selection is before the other row selection
904
954
  before(rowA, rowB) {
905
955
  switch (rowA.rowPinned) {
906
956
  case 'top':
957
+ // we we are floating top, and other isn't, then we are always before
907
958
  if (rowB.rowPinned !== 'top') {
908
959
  return true;
909
960
  }
910
961
  break;
911
962
  case 'bottom':
963
+ // if we are floating bottom, and the other isn't, then we are never before
912
964
  if (rowB.rowPinned !== 'bottom') {
913
965
  return false;
914
966
  }
915
967
  break;
916
968
  default:
969
+ // if we are not floating, but the other one is floating...
917
970
  if (_exists(rowB.rowPinned)) {
918
971
  return rowB.rowPinned !== 'top';
919
972
  }
@@ -925,6 +978,7 @@ export class RangeSelector extends BeanStub {
925
978
  return new DragListenerFeature(eContainer);
926
979
  }
927
980
  createCellRangeFeature(beans, ctrl) {
981
+ // return new CellRangeFeature(beans, ctrl);
928
982
  }
929
983
  }
930
984
  //# sourceMappingURL=rangeSelector.js.map