d2coreui 23.0.52 → 23.0.54

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 +40 -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 +10 -1
  100. package/components/grid/columnUtils.js +11 -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 +45 -29
  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 +361 -12
  115. package/components/grid/dataGrid.js +201 -28
  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 +249 -4
  129. package/components/grid/extendedDataGrid.js +160 -19
  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
@@ -26,6 +26,7 @@ import LoadingOverlay from "d2coreui/components/grid/panel/loadingOverlay";
26
26
  import NoRecordsOverlay from "d2coreui/components/grid/panel/noRecordsOverlay";
27
27
  import at from "lodash/at";
28
28
  import ColumnTransfer from "d2coreui/components/grid/config/columnTransfer";
29
+ import { ColumnUtils } from "d2coreui/components/grid/columnUtils";
29
30
  import cloneDeep from "lodash/cloneDeep";
30
31
  import { RangeSelector } from "d2coreui/components/grid/cell/rangeSelector";
31
32
  import { CellControl } from "d2coreui/components/grid/cell/cellControl";
@@ -60,9 +61,9 @@ import WithCss from "../style/withCss";
60
61
  import { createStyles } from "antd-style";
61
62
  const useStyles = createStyles(({ css }) => {
62
63
  return {
63
- baseLayout: css `
64
- width: 100%;
65
- height: 100%;
64
+ baseLayout: css `
65
+ width: 100%;
66
+ height: 100%;
66
67
  `
67
68
  };
68
69
  });
@@ -85,6 +86,7 @@ const gridFrameworkComponents = {
85
86
  };
86
87
  const DataGridModule = {
87
88
  version: "34.3.1",
89
+ // @ts-ignore
88
90
  moduleName: `dataGridModule`,
89
91
  beans: [RangeSelector, CellControl, BeanAccessor],
90
92
  dependantModules: [],
@@ -97,16 +99,53 @@ provideGlobalGridOptions({
97
99
  theme: "legacy"
98
100
  });
99
101
  const rowStyleRuleCompiledExpressions = {};
102
+ /**
103
+ * Separator for joining several parts into one cell value (e.g. name and status).
104
+ * When a string cell value contains it (after the first character), clipboard copy of several rows and export
105
+ * replace every run of line breaks with a single space; copying a single focused cell keeps the line breaks.
106
+ */
100
107
  export const EXPORT_SEPARATOR = "\n";
101
108
  var NavigationEventEnum;
102
109
  (function (NavigationEventEnum) {
103
110
  NavigationEventEnum[NavigationEventEnum["KEYBOARD"] = 0] = "KEYBOARD";
104
111
  NavigationEventEnum[NavigationEventEnum["MOUSE"] = 1] = "MOUSE";
105
112
  })(NavigationEventEnum || (NavigationEventEnum = {}));
113
+ /**
114
+ * ag-grid (community modules, Balham theme derived from the antd theme tokens unless `theme` is given) wrapped in a
115
+ * card with a toolbar: custom buttons,
116
+ * export and settings menus, a search box and a pager. Adds D2000 column types (see {@link DataGridColDef}), rule-based
117
+ * row styling with configurable font size and row height, a table configuration panel, a columns configuration
118
+ * dialog, a row context menu with export, wildcard quick filter and an optional fill handle.
119
+ *
120
+ * Data are requested through `onLoadData`; use `rowData` (client-side row model) or an ag-grid `datasource`
121
+ * (infinite row model). Row objects must have a unique `id`. The grid state (paging, columns, row styles, date format)
122
+ * is not persisted by DataGrid itself; it reports changes through callbacks and expects the updated values back in
123
+ * props (`ExtendedDataGrid` from `d2coreui/components/grid/extendedDataGrid` keeps this state and reports it as one
124
+ * configuration object; storing it is still up to the caller).
125
+ *
126
+ * Keyboard: PageUp/PageDown/Home/End and arrows at page edges move across pages, Alt+arrows move the open cell editor,
127
+ * Ctrl+A selects the displayed rows, Ctrl+C copies the selected rows with a header line (when more than one is
128
+ * selected) or the focused cell,
129
+ * Ctrl+I / Ctrl+B copy the `objectId`/`id` or `objectName`/`name` column of the focused row.
130
+ *
131
+ * @example
132
+ * <DataGrid
133
+ * columnDefs={[{colId: "name", field: "name", headerName: "Name", group: "Object", type: "textColumnFilter"}]}
134
+ * rowData={rows}
135
+ * paging={{pageSize: 0}}
136
+ * rowStyleRules={rowStyleRules}
137
+ * onChangeRowStyleRules={setRowStyleRules}
138
+ * onLoadData={(callback) => loadRows().then((rows) => { setRows(rows); callback(rows.length); })}
139
+ * />
140
+ *
141
+ * @typeParam TData - row data type, see {@link DataGridProps}
142
+ */
106
143
  class DataGrid extends React.Component {
107
144
  constructor(props) {
108
145
  super(props);
146
+ /** Whether the initial `onLoadData` call has already been made. */
109
147
  this.firstLoadDone = false;
148
+ /** Pagination event received before the grid API was available, replayed once the grid is ready. */
110
149
  this.lastPaginationEvent = null;
111
150
  this.state = {
112
151
  pageIndex: 0,
@@ -144,6 +183,7 @@ class DataGrid extends React.Component {
144
183
  this.loadingOverlayRenderer = this.loadingOverlayRenderer.bind(this);
145
184
  this.changePagination = this.changePagination.bind(this);
146
185
  this.onColumnsChanged = this.onColumnsChanged.bind(this);
186
+ this.onNewColumnsLoaded = this.onNewColumnsLoaded.bind(this);
147
187
  this.onFilterModified = this.onFilterModified.bind(this);
148
188
  this.onFilterChanged = this.onFilterChanged.bind(this);
149
189
  this.onFilterConfirmed = this.onFilterConfirmed.bind(this);
@@ -431,6 +471,11 @@ class DataGrid extends React.Component {
431
471
  }
432
472
  return undefined;
433
473
  }
474
+ /**
475
+ * Case-insensitive `textCustomComparator` used by the grid's text filters; `contains` supports `*` and `?` wildcards.
476
+ * @param filter - ag-grid text filter type (`contains`, `notContains`, `equals`, `notEqual`, `startsWith`, `endsWith`)
477
+ * @returns whether `value` passes the filter
478
+ */
434
479
  textCustomComparator(filter, value, filterText) {
435
480
  const filterTextLowerCase = filterText.toLowerCase();
436
481
  const valueLowerCase = value.toString().toLowerCase();
@@ -453,6 +498,7 @@ class DataGrid extends React.Component {
453
498
  case 'equals':
454
499
  return valueLowerCase === filterTextLowerCase;
455
500
  case 'notEqual':
501
+ // noinspection EqualityComparisonWithCoercionJS
456
502
  return valueLowerCase != filterTextLowerCase;
457
503
  case 'startsWith':
458
504
  return valueLowerCase.indexOf(filterTextLowerCase) === 0;
@@ -460,6 +506,7 @@ class DataGrid extends React.Component {
460
506
  var index = valueLowerCase.lastIndexOf(filterTextLowerCase);
461
507
  return index >= 0 && index === (valueLowerCase.length - filterTextLowerCase.length);
462
508
  default:
509
+ // should never happen
463
510
  console.warn('invalid filter type ' + filter);
464
511
  return false;
465
512
  }
@@ -479,14 +526,18 @@ class DataGrid extends React.Component {
479
526
  }
480
527
  }, 0);
481
528
  }
529
+ // functionality when all data are loaded to table
482
530
  if (this.props.rowData && this.props.rowData !== prevProps.rowData) {
531
+ // keep filter model when data are changed
483
532
  if (this.props.filter && this.props.filter.getFilterModel) {
484
533
  this.gridApi.setFilterModel(this.props.filter.getFilterModel());
485
534
  this.gridApi.onFilterChanged();
486
535
  }
536
+ // keep sorting model when data are changed
487
537
  this.setSortModel(this.state.sortModel);
488
538
  this.gridApi.refreshClientSideRowModel("group");
489
539
  this.gridApi.redrawRows();
540
+ // keep selected rows when data are changed and rows are still present
490
541
  const selectedObjectsVisibleInGrid = this.props.rowData.filter((object) => {
491
542
  return this.props.selectedIds ? this.props.selectedIds.indexOf(object.id) >= 0 : false;
492
543
  });
@@ -502,7 +553,9 @@ class DataGrid extends React.Component {
502
553
  this.gridApi.deselectAll();
503
554
  }
504
555
  }
556
+ // functionality when chunks of data are dynamically loaded from server
505
557
  if (this.props.datasource && this.props.datasource !== prevProps.datasource) {
558
+ // resets grid data
506
559
  this.gridApi.updateGridOptions({ datasource: this.props.datasource });
507
560
  }
508
561
  this.updateRowHeight();
@@ -510,6 +563,11 @@ class DataGrid extends React.Component {
510
563
  componentWillUnmount() {
511
564
  window.removeEventListener('mouseup', this.onMouseUp);
512
565
  }
566
+ /**
567
+ * Applies a column state (order, width, visibility, pinning, sorting) to the grid, e.g. one saved from
568
+ * `onColumnsChanged`. Columns not in the state lose their sorting. No-op until the grid is ready.
569
+ * Note: it clears `sort` and `sortIndex` on the passed objects.
570
+ */
513
571
  setColumnState(columnModel) {
514
572
  var _a;
515
573
  const columnStates = [];
@@ -523,6 +581,10 @@ class DataGrid extends React.Component {
523
581
  }
524
582
  (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.applyColumnState({ state: columnStates, defaultState: { sort: null }, applyOrder: true });
525
583
  }
584
+ /**
585
+ * Sorts the grid by the given columns; array order defines the sort priority and all other columns are unsorted.
586
+ * No-op until the grid is ready.
587
+ */
526
588
  setSortModel(sortModel) {
527
589
  var _a;
528
590
  const columnState = [];
@@ -537,6 +599,7 @@ class DataGrid extends React.Component {
537
599
  }
538
600
  (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.applyColumnState({ state: columnState, defaultState: { sort: null }, applyOrder: true });
539
601
  }
602
+ /** Returns the sorted columns ordered by sort priority; empty until the grid is ready. */
540
603
  getSortModel() {
541
604
  var _a, _b;
542
605
  const columnState = (_b = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getColumnState()) !== null && _b !== void 0 ? _b : [];
@@ -553,6 +616,7 @@ class DataGrid extends React.Component {
553
616
  res.sort((a, b) => indexes[a.colId] - indexes[b.colId]);
554
617
  return res;
555
618
  }
619
+ /** Recomputes font size and row height from `rowStyleRules` and applies them if they changed. */
556
620
  updateRowHeight() {
557
621
  let rowAndFontHeight = this.calculateRowAndFontHeight(this.props.rowStyleRules);
558
622
  if (rowAndFontHeight.rowHeight !== this.state.rowHeight) {
@@ -562,6 +626,10 @@ class DataGrid extends React.Component {
562
626
  this.setState({ fontSize: rowAndFontHeight.fontSize });
563
627
  }
564
628
  }
629
+ /**
630
+ * Computes the font size and row height (pixels) defined by the `table-font-size` and `table-line-indentation`
631
+ * rules, falling back to the grid defaults.
632
+ */
565
633
  calculateRowAndFontHeight(rowStyleRules) {
566
634
  let rowHeightDelta = GRID_DEFAULT_ROW_HEIGHT_DELTA;
567
635
  let fontSize = GRID_DEFAULT_FONT_SIZE;
@@ -582,6 +650,7 @@ class DataGrid extends React.Component {
582
650
  }
583
651
  return { rowHeight: rowHeight, fontSize: fontSize };
584
652
  }
653
+ /** Synchronizes the table configuration panel visibility with the `tableConfigVisible` prop when it is set. */
585
654
  static getDerivedStateFromProps(props, state) {
586
655
  const newState = {};
587
656
  if (props.tableConfigVisible === true || props.tableConfigVisible === false) {
@@ -591,6 +660,7 @@ class DataGrid extends React.Component {
591
660
  }
592
661
  return newState;
593
662
  }
663
+ /** ag-grid `gridReady` handler: stores the grid API, forwards the event to `props.onGridReady` and initializes sort/column state. */
594
664
  onGridReady(gridReadyEvent) {
595
665
  const gridApi = gridReadyEvent.api;
596
666
  if (!this.gridApi || this.gridApi !== gridApi) {
@@ -605,17 +675,24 @@ class DataGrid extends React.Component {
605
675
  this.updateRowHeight();
606
676
  }
607
677
  window.addEventListener('mouseup', this.onMouseUp);
678
+ // fixing some cases when after onGridReady callback no onPaginationChanged callback is called
679
+ // and therefore no initial data loading (loadData()) occurs
608
680
  setTimeout(() => {
609
681
  if (!!this.lastPaginationEvent) {
610
682
  this.onPaginationChanged(this.lastPaginationEvent);
611
683
  }
612
684
  });
613
685
  }
686
+ /**
687
+ * ag-grid `paginationChanged` handler: updates the pager, reports page size changes through
688
+ * `paging.onPaginationChanged`, triggers the initial data load and forwards the event to `props.onPaginationChanged`.
689
+ */
614
690
  onPaginationChanged(event) {
615
691
  if (this.gridApi) {
616
692
  const currentPage = this.gridApi.paginationGetCurrentPage();
617
693
  const currentPageSize = this.gridApi.paginationGetPageSize();
618
694
  let recordsCount = this.props.paging.pageSize >= 0 ? (this.gridApi.paginationIsLastPageFound() ? this.gridApi.paginationGetRowCount() : 0) : this.gridApi.getDisplayedRowCount();
695
+ // process only when onGridReady passed
619
696
  if (this.state.pageSize !== currentPageSize) {
620
697
  if (this.props.paging.onPaginationChanged) {
621
698
  this.props.paging.onPaginationChanged(currentPageSize, this.props.paging.pageSize);
@@ -639,8 +716,10 @@ class DataGrid extends React.Component {
639
716
  this.props.onPaginationChanged(event);
640
717
  }
641
718
  }
719
+ /** ag-grid `viewportChanged` handler: adds `rowsScrollingDelta` (see {@link DataGridViewportChangedEvent}) and forwards the event to `props.onViewportChanged`. */
642
720
  onViewportChanged(event) {
643
721
  const dataGridEvent = event;
722
+ // calculation of the flag that last record is shown
644
723
  const rowsScrollingDelta = this.state.viewport[1] ? event.lastRow + 1 - this.state.viewport[1] : event.lastRow + 1;
645
724
  dataGridEvent.rowsScrollingDelta = rowsScrollingDelta;
646
725
  this.setState({ viewport: [event.firstRow + 1, event.lastRow + 1] });
@@ -648,6 +727,11 @@ class DataGrid extends React.Component {
648
727
  this.props.onViewportChanged(event);
649
728
  }
650
729
  }
730
+ /**
731
+ * Switches the paging mode at runtime (used by the table configuration panel) and reports it through
732
+ * `paging.onPaginationChanged`; the `paging.pageSize` prop is not changed. No-op until the grid is ready.
733
+ * @param pageSize - `-1` no paging, `0` automatic page size, positive number fixed rows per page
734
+ */
651
735
  changePagination(pageSize) {
652
736
  var _a, _b, _c;
653
737
  if (!this.gridApi) {
@@ -666,7 +750,9 @@ class DataGrid extends React.Component {
666
750
  }
667
751
  else if (pageSize === 0) {
668
752
  this.gridApi.updateGridOptions({ pagination: true, paginationAutoPageSize: true });
753
+ // handling AG-Grid bug caused by different previous pageSize state
669
754
  const rowHeight = (_c = (_b = (_a = gridApiWithPrivateAccess.beans.gos).getRowHeightAsNumber) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : 1;
755
+ // @ts-ignore
670
756
  const bodyHeight = gridApiWithPrivateAccess.beans.ctrlsSvc.params.center.viewportSizeFeature.getBodyHeight();
671
757
  let availablePageSize = 1000;
672
758
  if (bodyHeight > 0) {
@@ -676,6 +762,7 @@ class DataGrid extends React.Component {
676
762
  this.gridApi.updateGridOptions({ paginationPageSize: 1 });
677
763
  }
678
764
  else {
765
+ // special hack to remove setting page size
679
766
  this.gridApi.updateGridOptions({ paginationPageSize: null });
680
767
  }
681
768
  if (this.props.paging && this.props.paging.onPaginationChanged) {
@@ -689,6 +776,7 @@ class DataGrid extends React.Component {
689
776
  }
690
777
  }
691
778
  }
779
+ /** Requests showing/hiding milliseconds via `props.onShowMilliseconds` and redraws the rows once the parent calls back. */
692
780
  showMilliseconds(showMilis) {
693
781
  var _a, _b;
694
782
  (_b = (_a = this.props).onShowMilliseconds) === null || _b === void 0 ? void 0 : _b.call(_a, showMilis, () => {
@@ -696,11 +784,13 @@ class DataGrid extends React.Component {
696
784
  return;
697
785
  }
698
786
  if (!this.props.rowModelType || this.props.rowModelType === "clientSide") {
787
+ // table is shown
699
788
  this.gridApi.refreshClientSideRowModel("group");
700
789
  }
701
790
  this.gridApi.redrawRows();
702
791
  });
703
792
  }
793
+ /** Requests showing/hiding the year via `props.onShowYear` and redraws the rows once the parent calls back. */
704
794
  showYear(showYear) {
705
795
  var _a, _b;
706
796
  (_b = (_a = this.props).onShowYear) === null || _b === void 0 ? void 0 : _b.call(_a, showYear, () => {
@@ -708,11 +798,13 @@ class DataGrid extends React.Component {
708
798
  return;
709
799
  }
710
800
  if (!this.props.rowModelType || this.props.rowModelType === "clientSide") {
801
+ // table is shown
711
802
  this.gridApi.refreshClientSideRowModel("group");
712
803
  }
713
804
  this.gridApi.redrawRows();
714
805
  });
715
806
  }
807
+ /** Requests showing/hiding the UTC offset via `props.onShowUtcOffset` and redraws the rows once the parent calls back. */
716
808
  showUtcOffset(showUtcOffset) {
717
809
  var _a, _b;
718
810
  (_b = (_a = this.props).onShowUtcOffset) === null || _b === void 0 ? void 0 : _b.call(_a, showUtcOffset, () => {
@@ -720,11 +812,16 @@ class DataGrid extends React.Component {
720
812
  return;
721
813
  }
722
814
  if (!this.props.rowModelType || this.props.rowModelType === "clientSide") {
815
+ // table is shown
723
816
  this.gridApi.refreshClientSideRowModel("group");
724
817
  }
725
818
  this.gridApi.redrawRows();
726
819
  });
727
820
  }
821
+ /**
822
+ * Applies a new row height (and header/floating filter height derived from `fontSize`, unless given in props),
823
+ * redraws the grid (reloading an infinite datasource) and calls `props.onRowHeightChanged`.
824
+ */
728
825
  changeRowHeight(fontSize, rowHeight) {
729
826
  this.setState({ rowHeight: rowHeight }, () => {
730
827
  if (this.gridApi) {
@@ -740,6 +837,7 @@ class DataGrid extends React.Component {
740
837
  this.gridApi.redrawRows();
741
838
  if (this.props.rowModelType === "infinite" && this.props.datasource) {
742
839
  this.gridApi.setGridOption('rowHeight', rowHeight);
840
+ // redraws all server side loaded table data
743
841
  this.gridApi.updateGridOptions({ datasource: this.props.datasource });
744
842
  }
745
843
  }
@@ -748,11 +846,16 @@ class DataGrid extends React.Component {
748
846
  }
749
847
  });
750
848
  }
849
+ /** Shows the page with the given zero-based index. */
751
850
  onGoToPage(pageIndex) {
752
851
  if (this.gridApi) {
753
852
  this.gridApi.paginationGoToPage(pageIndex);
754
853
  }
755
854
  }
855
+ /**
856
+ * (Re)loads data: shows the loading overlay and calls `props.onLoadData`. No-op until the grid is ready.
857
+ * @param callback - called after `onLoadData` reports that loading has finished
858
+ */
756
859
  loadData(callback) {
757
860
  if (!this.gridApi) {
758
861
  return;
@@ -785,6 +888,7 @@ class DataGrid extends React.Component {
785
888
  }
786
889
  });
787
890
  }
891
+ /** Focuses (after a short delay) the first column of the last selected row, or of the first row when nothing is selected. */
788
892
  focus() {
789
893
  setTimeout(() => {
790
894
  var _a, _b, _c, _d;
@@ -798,9 +902,11 @@ class DataGrid extends React.Component {
798
902
  (_d = this.gridApi) === null || _d === void 0 ? void 0 : _d.setFocusedCell(selectedRowIndex, columnIdToFocus);
799
903
  }, 200);
800
904
  }
905
+ /** Returns `true` when the grid is ready and not destroyed. */
801
906
  isActive() {
802
907
  return !!this.gridApi && !this.gridApi.isDestroyed();
803
908
  }
909
+ /** Handler of ag-grid column visible/pinned/resized/moved events; stores the column state and calls `props.onColumnsChanged`. */
804
910
  onColumnsChanged(event) {
805
911
  const columnModel = event.api.getColumnState();
806
912
  if (this.props.onColumnsChanged) {
@@ -808,6 +914,19 @@ class DataGrid extends React.Component {
808
914
  }
809
915
  this.setState({ columnModel: columnModel });
810
916
  }
917
+ /**
918
+ * ag-grid `newColumnsLoaded` handler: refreshes the stored column state after `columnDefs` change, without calling
919
+ * `props.onColumnsChanged`, and forwards the event to `props.onNewColumnsLoaded`.
920
+ */
921
+ onNewColumnsLoaded(event) {
922
+ var _a, _b;
923
+ this.setState({ columnModel: event.api.getColumnState() });
924
+ (_b = (_a = this.props).onNewColumnsLoaded) === null || _b === void 0 ? void 0 : _b.call(_a, event);
925
+ }
926
+ /**
927
+ * Requests showing/hiding the floating column filters: re-applies `filter.getFilterModel()` and calls
928
+ * `filter.onColumnSearchVisible`; the actual visibility follows `filter.columnSearchVisible`.
929
+ */
811
930
  setColumnSearchVisible(visible) {
812
931
  if (this.gridApi && this.props.filter && this.props.filter.getFilterModel) {
813
932
  this.gridApi.setFilterModel(this.props.filter.getFilterModel());
@@ -835,6 +954,7 @@ class DataGrid extends React.Component {
835
954
  if (this.props.onSortChanged && this.gridApi) {
836
955
  const currentSortModel = this.getSortModel();
837
956
  if (!isEqual(this.state.sortModel, currentSortModel)) {
957
+ // propagate only changes to sorting
838
958
  this.setState({ sortModel: currentSortModel }, () => {
839
959
  if (this.props.onSortChanged) {
840
960
  this.props.onSortChanged(event);
@@ -843,19 +963,24 @@ class DataGrid extends React.Component {
843
963
  }
844
964
  }
845
965
  }
966
+ /** Requests opening/closing the table configuration panel via `props.onTableConfigVisible`; redraws the rows when it closes. */
846
967
  showTableConfiguration(show) {
847
968
  if (this.props.onTableConfigVisible) {
848
969
  this.props.onTableConfigVisible(show);
849
970
  }
850
971
  this.setState({ tableConfigVisible: show }, () => {
851
972
  if (this.gridApi && !this.state.tableConfigVisible) {
973
+ // redrawing rows after closing table configuration panel, probably not required any more,
974
+ // because config panel and table is shown simultaneously
852
975
  if (!this.props.rowModelType || this.props.rowModelType === "clientSide") {
976
+ // table is shown
853
977
  this.gridApi.refreshClientSideRowModel("group");
854
978
  }
855
979
  this.gridApi.redrawRows();
856
980
  }
857
981
  });
858
982
  }
983
+ /** Opens/closes the columns configuration dialog and calls `props.onColumnsConfigVisible`. */
859
984
  showColumnsConfig(show) {
860
985
  if (this.props.onColumnsConfigVisible) {
861
986
  this.props.onColumnsConfigVisible(show);
@@ -865,7 +990,7 @@ class DataGrid extends React.Component {
865
990
  }
866
991
  navigateToNextCell(params) {
867
992
  var _a;
868
- this.lastNavigationEvent = 0;
993
+ this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
869
994
  var suggestedNextCell = params.nextCellPosition;
870
995
  if (!this.gridApi) {
871
996
  return suggestedNextCell !== null && suggestedNextCell !== void 0 ? suggestedNextCell : params.previousCellPosition;
@@ -944,7 +1069,7 @@ class DataGrid extends React.Component {
944
1069
  indexToJump = focusedCell.rowIndex;
945
1070
  }
946
1071
  }
947
- this.lastNavigationEvent = 0;
1072
+ this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
948
1073
  this.indexToJump = indexToJump;
949
1074
  this.columnToJump = columnToJump;
950
1075
  setTimeout(() => {
@@ -969,7 +1094,7 @@ class DataGrid extends React.Component {
969
1094
  indexToJump = focusedCell.rowIndex;
970
1095
  }
971
1096
  }
972
- this.lastNavigationEvent = 0;
1097
+ this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
973
1098
  this.indexToJump = indexToJump;
974
1099
  this.columnToJump = columnToJump;
975
1100
  setTimeout(() => {
@@ -986,7 +1111,7 @@ class DataGrid extends React.Component {
986
1111
  this.gridApi.tabToPreviousCell();
987
1112
  break;
988
1113
  }
989
- else {
1114
+ else /*Key.ArrowRight*/ {
990
1115
  this.gridApi.tabToNextCell();
991
1116
  break;
992
1117
  }
@@ -994,7 +1119,7 @@ class DataGrid extends React.Component {
994
1119
  }
995
1120
  break;
996
1121
  case Key.PageDown:
997
- this.lastNavigationEvent = 0;
1122
+ this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
998
1123
  if (pageIndex < (totalPages - 1)) {
999
1124
  this.gridApi.paginationGoToNextPage();
1000
1125
  const focusedCell = this.gridApi.getFocusedCell();
@@ -1006,7 +1131,7 @@ class DataGrid extends React.Component {
1006
1131
  }
1007
1132
  break;
1008
1133
  case Key.PageUp:
1009
- this.lastNavigationEvent = 0;
1134
+ this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
1010
1135
  if (pageIndex > 0) {
1011
1136
  this.gridApi.paginationGoToPreviousPage();
1012
1137
  const focusedCell = this.gridApi.getFocusedCell();
@@ -1018,7 +1143,7 @@ class DataGrid extends React.Component {
1018
1143
  }
1019
1144
  break;
1020
1145
  case Key.End:
1021
- this.lastNavigationEvent = 0;
1146
+ this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
1022
1147
  if (pageIndex < (totalPages - 1)) {
1023
1148
  this.gridApi.paginationGoToLastPage();
1024
1149
  const focusedCell = this.gridApi.getFocusedCell();
@@ -1030,7 +1155,7 @@ class DataGrid extends React.Component {
1030
1155
  }
1031
1156
  break;
1032
1157
  case Key.Home:
1033
- this.lastNavigationEvent = 0;
1158
+ this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
1034
1159
  if (pageIndex > 0) {
1035
1160
  this.gridApi.paginationGoToFirstPage();
1036
1161
  const focusedCell = this.gridApi.getFocusedCell();
@@ -1139,6 +1264,11 @@ class DataGrid extends React.Component {
1139
1264
  (_l = (_k = this.props).onKeyPressed) === null || _l === void 0 ? void 0 : _l.call(_k, params.event, params.editing);
1140
1265
  return false;
1141
1266
  }
1267
+ /**
1268
+ * Returns the cell value as used for clipboard copy and export: the ag-grid cell value passed through the column's
1269
+ * `valueFormatter` (a string formatter is treated as a field path into the row data).
1270
+ * @param doNotReplaceNewline - keep line breaks in values containing {@link EXPORT_SEPARATOR} (otherwise replaced by a space)
1271
+ */
1142
1272
  getValue(column, row, doNotReplaceNewline) {
1143
1273
  var _a, _b;
1144
1274
  let formattedValue = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getCellValue({ rowNode: row, colKey: column });
@@ -1165,6 +1295,13 @@ class DataGrid extends React.Component {
1165
1295
  }
1166
1296
  return formattedValue;
1167
1297
  }
1298
+ /**
1299
+ * Collects the table content for export: a header row with the displayed column names followed by one row of
1300
+ * {@link DataGrid.getValue} values per record (all filtered and sorted rows, or only the selected ones when
1301
+ * `props.onlySelectedNodes` is set). With a non client-side row model it waits for rows to be loaded.
1302
+ * @param progressPopup - optional popup updated with the progress
1303
+ * @returns rows of cell strings; empty when the grid is not ready
1304
+ */
1168
1305
  async getExportContent(progressPopup, props) {
1169
1306
  if (!this.gridApi) {
1170
1307
  return [];
@@ -1256,21 +1393,29 @@ class DataGrid extends React.Component {
1256
1393
  } while (record.filter((cell) => !!cell).length === 0);
1257
1394
  tableContent.push(record);
1258
1395
  if (index % percentStep === 0) {
1396
+ // noinspection ES6MissingAwait
1259
1397
  progressPopup === null || progressPopup === void 0 ? void 0 : progressPopup.update(Math.floor(index / rowCount * 100) - 1);
1260
1398
  await TimeUtils.sleep(100);
1261
1399
  }
1262
1400
  }
1263
1401
  }
1402
+ // noinspection ES6MissingAwait
1264
1403
  progressPopup === null || progressPopup === void 0 ? void 0 : progressPopup.update(99);
1265
1404
  await TimeUtils.sleep(300);
1266
1405
  return tableContent;
1267
1406
  }
1407
+ /**
1408
+ * ag-grid `cellFocused` handler: selects the focused row (Shift+arrow extends/shrinks the selection), tracks the
1409
+ * fill handle cell and forwards the event to `props.onCellFocused`.
1410
+ */
1268
1411
  onCellFocused(event) {
1269
1412
  var _a, _b, _c, _d, _e;
1270
1413
  const row = event.rowIndex !== null ? (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getDisplayedRowAtIndex(event.rowIndex) : undefined;
1271
1414
  if (row) {
1272
- if (this.lastNavigationEvent === 0 && KeyboardUtils.isKeyPressed(Key.Shift) && this.lastCellFocus && this.lastCellFocus.rowIndex !== event.rowIndex) {
1415
+ if (this.lastNavigationEvent === 0 /* NavigationEventEnum.KEYBOARD */ && KeyboardUtils.isKeyPressed(Key.Shift) && this.lastCellFocus && this.lastCellFocus.rowIndex !== event.rowIndex) {
1416
+ // focusing new row with SHIFT key pressed
1273
1417
  if (!row.isSelected()) {
1418
+ // add to selection
1274
1419
  row.setSelected(true, false);
1275
1420
  }
1276
1421
  else if (((_b = this.lastCellFocus) === null || _b === void 0 ? void 0 : _b.rowIndex) !== null) {
@@ -1294,6 +1439,7 @@ class DataGrid extends React.Component {
1294
1439
  (_e = (_d = this.props).onCellFocused) === null || _e === void 0 ? void 0 : _e.call(_d, event);
1295
1440
  this.lastCellFocus = event;
1296
1441
  }
1442
+ /** ag-grid `cellMouseOver` handler: extends the fill handle range while dragging. */
1297
1443
  onCellMouseOver(e) {
1298
1444
  if (this.state.isDragging) {
1299
1445
  this.setState({ endCoord: { rowIndex: e.rowIndex, colId: e.column.getColId() } }, () => {
@@ -1302,9 +1448,14 @@ class DataGrid extends React.Component {
1302
1448
  });
1303
1449
  }
1304
1450
  }
1451
+ /**
1452
+ * ag-grid `cellMouseDown` handler: focuses the clicked cell, forwards the event to `props.onCellMouseDown` and
1453
+ * starts a fill handle drag when the bottom-right corner of the cell is pressed.
1454
+ */
1305
1455
  onCellMouseDown(e) {
1306
1456
  var _a, _b;
1307
- this.lastNavigationEvent = 1;
1457
+ this.lastNavigationEvent = 1 /* NavigationEventEnum.MOUSE */;
1458
+ // always focus clicked cell (also when using shift key)
1308
1459
  if (e.rowIndex !== null) {
1309
1460
  this.setFocusedCellDebounced(e.rowIndex, e.column, e.rowPinned !== null ? e.rowPinned : undefined);
1310
1461
  }
@@ -1323,6 +1474,7 @@ class DataGrid extends React.Component {
1323
1474
  }
1324
1475
  }
1325
1476
  }
1477
+ /** Window `mouseup` handler: finishes a fill handle drag and calls `props.onFillHandleComplete`. */
1326
1478
  onMouseUp() {
1327
1479
  var _a, _b, _c, _d;
1328
1480
  if (this.state.isDragging) {
@@ -1345,6 +1497,7 @@ class DataGrid extends React.Component {
1345
1497
  }
1346
1498
  }
1347
1499
  ;
1500
+ /** Focuses the given cell; debounced by 200 ms. */
1348
1501
  setFocusedCellDebounced(rowIndex, column, rowPinned) {
1349
1502
  var _a;
1350
1503
  (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.setFocusedCell(rowIndex, column, rowPinned);
@@ -1384,6 +1537,10 @@ class DataGrid extends React.Component {
1384
1537
  " ",
1385
1538
  i18n("Search"))));
1386
1539
  }
1540
+ /**
1541
+ * Replaces the grid's row data (client-side row model) without going through the `rowData` prop; intended for
1542
+ * {@link DataGridProps.rowDataManualMode}. No-op until the grid is ready.
1543
+ */
1387
1544
  setRowData(dataArray) {
1388
1545
  var _a;
1389
1546
  (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.updateGridOptions({ rowData: dataArray });
@@ -1399,6 +1556,7 @@ class DataGrid extends React.Component {
1399
1556
  this.props.onRowDataUpdated(event);
1400
1557
  }
1401
1558
  }
1559
+ /** ag-grid `getRowStyle` implementation: merges the matching `rowStyleRules` and then `props.getRowStyle`. */
1402
1560
  _getRowStyle(params) {
1403
1561
  const rowStyleRules = this.props.rowStyleRules;
1404
1562
  if (rowStyleRules) {
@@ -1459,9 +1617,11 @@ class DataGrid extends React.Component {
1459
1617
  }
1460
1618
  return DataGrid.EMPTY_STYLE;
1461
1619
  }
1620
+ /** ag-grid `getRowHeight` implementation: the current row height in pixels. */
1462
1621
  _getRowHeight() {
1463
1622
  return this.state.rowHeight;
1464
1623
  }
1624
+ /** Cell style applied to every adapted column: font size, right alignment for `alignRight` and the column's own `cellStyle`. */
1465
1625
  _getCellStyle(params) {
1466
1626
  var _a;
1467
1627
  const fontSize = this.state.fontSize;
@@ -1483,6 +1643,7 @@ class DataGrid extends React.Component {
1483
1643
  }
1484
1644
  return cellStyles;
1485
1645
  }
1646
+ /** Returns `props.defaultColDef` extended with the grid's keyboard handling (`suppressKeyboardEvent` is always overridden). */
1486
1647
  getDefaultColDefinition(colDef) {
1487
1648
  if (colDef) {
1488
1649
  return Object.assign(Object.assign({}, colDef), { suppressKeyboardEvent: this.suppressKeyboardEvent });
@@ -1504,6 +1665,7 @@ class DataGrid extends React.Component {
1504
1665
  onExport(start) {
1505
1666
  this.setState({ exporting: start });
1506
1667
  }
1668
+ /** Renders the toolbar row: toolbar with search, pager (or record range when paging is disabled) and `toolbar.extraContent`. */
1507
1669
  renderNavigationPanel() {
1508
1670
  var _a, _b, _c;
1509
1671
  return (React.createElement(React.Fragment, null,
@@ -1522,6 +1684,7 @@ class DataGrid extends React.Component {
1522
1684
  : undefined, (_c = this.props.toolbar) === null || _c === void 0 ? void 0 :
1523
1685
  _c.extraContent));
1524
1686
  }
1687
+ /** Renders the default toolbar: `toolbar.toolbarButtons`, export and settings menus, search field and search button. */
1525
1688
  renderToolBarWithSearch() {
1526
1689
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
1527
1690
  return (React.createElement(Space.Compact, { key: "filter-panel", className: "datagrid-autocomplete-input-group", style: { whiteSpace: "nowrap", flexGrow: 1, display: "flex" } }, (_a = this.props.toolbar) === null || _a === void 0 ? void 0 :
@@ -1554,6 +1717,7 @@ class DataGrid extends React.Component {
1554
1717
  } }, this.state.loading ? React.createElement(LoadingOutlined, null) : ((_p = (_o = this.props.search) === null || _o === void 0 ? void 0 : _o.searchButtonIcon) !== null && _p !== void 0 ? _p : (((_q = this.props.search) === null || _q === void 0 ? void 0 : _q.hidden) ? React.createElement(ReloadOutlined, null) :
1555
1718
  React.createElement(SearchOutlined, null))))));
1556
1719
  }
1720
+ /** Builds the toolbar settings menu (keys `columnFilter`, `autosizeAllColumns`, `columnsConfig`, `advancedConfig`), passed through `settingsMenu.renderer`. */
1557
1721
  getSettingsMenu() {
1558
1722
  var _a;
1559
1723
  let menuItems = [
@@ -1620,9 +1784,12 @@ class DataGrid extends React.Component {
1620
1784
  if (disableColumnDefsPreprocessing) {
1621
1785
  return columnDefs;
1622
1786
  }
1623
- const adaptedColumnDefs = columnDefs ? columnDefs.map((columnDef) => {
1787
+ const adaptColumnDefs = (columnDefs) => columnDefs.map((columnDef) => {
1624
1788
  var _a, _b, _c, _d;
1625
- const _e = columnDef, { group, floatingFilter, hide, cellEditorPopup, editable, headerComponent, headerComponentParams } = _e, rest = __rest(_e, ["group", "floatingFilter", "hide", "cellEditorPopup", "editable", "headerComponent", "headerComponentParams"]);
1789
+ if ("children" in columnDef) {
1790
+ return Object.assign(Object.assign({}, columnDef), { children: adaptColumnDefs(columnDef.children) });
1791
+ }
1792
+ const { group, floatingFilter, hide, cellEditorPopup, editable, headerComponent, headerComponentParams } = columnDef, rest = __rest(columnDef, ["group", "floatingFilter", "hide", "cellEditorPopup", "editable", "headerComponent", "headerComponentParams"]);
1626
1793
  let floatingFilterEnabledForColumn = !!floatingFilter;
1627
1794
  if (typeof columnDef.type === "string") {
1628
1795
  if (!!((_a = this.columnTypes[columnDef.type]) === null || _a === void 0 ? void 0 : _a.floatingFilter)) {
@@ -1643,21 +1810,19 @@ class DataGrid extends React.Component {
1643
1810
  'cell-has-handle': (p) => { var _a, _b; return ((_a = this.state.focusedCell) === null || _a === void 0 ? void 0 : _a.rowIndex) === p.rowIndex && ((_b = this.state.focusedCell) === null || _b === void 0 ? void 0 : _b.colId) === p.colDef.colId && !this.state.isDragging; },
1644
1811
  'cell-drag-selected': (params) => (this.state.startCoord !== null && this.state.endCoord !== null) ? this.isInRange(params.rowIndex, params.colDef.colId) : false,
1645
1812
  } });
1646
- }) : undefined;
1647
- if (adaptedColumnDefs) {
1648
- setTimeout(() => {
1649
- var _a, _b;
1650
- (_b = (_a = this.props).onColumnDefsAdapted) === null || _b === void 0 ? void 0 : _b.call(_a, adaptedColumnDefs);
1651
- }, 0);
1652
- }
1813
+ });
1814
+ const adaptedColumnDefs = adaptColumnDefs(columnDefs);
1815
+ setTimeout(() => {
1816
+ var _a, _b;
1817
+ (_b = (_a = this.props).onColumnDefsAdapted) === null || _b === void 0 ? void 0 : _b.call(_a, adaptedColumnDefs);
1818
+ }, 0);
1653
1819
  return adaptedColumnDefs;
1654
1820
  }
1655
1821
  isInRange(rowIndex, colId) {
1656
- var _a;
1657
1822
  const { startCoord, endCoord } = this.state;
1658
1823
  if (startCoord === null || endCoord === null)
1659
1824
  return false;
1660
- const allCols = ((_a = this.gridApi.getColumnDefs()) === null || _a === void 0 ? void 0 : _a.map(c => c.colId)) || [];
1825
+ const allCols = this.gridApi.getAllDisplayedColumns().map(c => c.getColId());
1661
1826
  const startColIdx = allCols.indexOf(startCoord.colId);
1662
1827
  const endColIdx = allCols.indexOf(endCoord.colId);
1663
1828
  const currentColIdx = allCols.indexOf(colId);
@@ -1683,11 +1848,15 @@ class DataGrid extends React.Component {
1683
1848
  key = "paginated-table";
1684
1849
  }
1685
1850
  else {
1851
+ // pagination is disabled
1686
1852
  passedProperties.pagination = false;
1687
1853
  key = "non-paginated-table";
1688
1854
  }
1855
+ // nejde
1689
1856
  const floatingFilterEnabled = !!filter && !!filter.columnSearchVisible;
1690
1857
  const adaptedColumnDefs = this.getAdaptedColumnDefs(columnDefs, floatingFilterEnabled, !!disableColumnDefsPreprocessing);
1858
+ // the configuration dialogs list columns only, groups are just headers in the grid
1859
+ const leafColumnDefs = ColumnUtils.getLeafColumnDefs(columnDefs);
1691
1860
  const customComponents = this.getCustomComponents(components);
1692
1861
  const debugMode = process.env.NODE_ENV === 'development';
1693
1862
  const bodyStyle = {
@@ -1713,6 +1882,7 @@ class DataGrid extends React.Component {
1713
1882
  var _a, _b, _c, _d;
1714
1883
  return React.createElement(Dropdown, { trigger: ["contextMenu"], getPopupContainer: (triggerNode) => {
1715
1884
  var _a;
1885
+ // very nasty trick how remove error of ResizeObservers infinite cycling - because popover (with dynamic size) is placed in in resizable panel
1716
1886
  const parentNode = ((_a = triggerNode === null || triggerNode === void 0 ? void 0 : triggerNode.parentNode) !== null && _a !== void 0 ? _a : document.body);
1717
1887
  return parentNode;
1718
1888
  }, menu: getContextMenu({
@@ -1737,7 +1907,7 @@ class DataGrid extends React.Component {
1737
1907
  React.createElement(ConfigProvider.ConfigContext.Consumer, null, (context) => {
1738
1908
  var _a;
1739
1909
  const defaultTheme = theme !== null && theme !== void 0 ? theme : this.getTheme((_a = context.theme) === null || _a === void 0 ? void 0 : _a.algorithm, styles.theme);
1740
- return (React.createElement(AgGridReact, Object.assign({ key: key, debug: debugMode, ref: gridRef, theme: defaultTheme, paginationPageSize: paginationPageSize, maxConcurrentDatasourceRequests: this.props.rowModelType === "infinite" ? 1 : undefined, onGridReady: this.onGridReady, onPaginationChanged: this.onPaginationChanged, onFilterModified: this.onFilterModified, onFilterChanged: this.onFilterChanged, onSortChanged: this.onSortChanged, defaultColDef: this.getDefaultColDefinition(defaultColDef), columnDefs: adaptedColumnDefs, rowData: !rowDataManualMode ? rowData : undefined }, passedProperties, { onCellFocused: this.onCellFocused, cellSelection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", rowSelection: rowSelection, suppressRowClickSelection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", suppressRowDeselection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", suppressPaginationPanel: true, getRowId: getRowId, maintainColumnOrder: true, components: customComponents, columnTypes: this.columnTypes, onColumnVisible: this.onColumnsChanged, onColumnPinned: this.onColumnsChanged, onColumnResized: this.onColumnsChanged, onColumnMoved: this.onColumnsChanged, onCellMouseOver: this.onCellMouseOver, onCellMouseDown: this.onCellMouseDown, navigateToNextCell: this.navigateToNextCell, onViewportChanged: this.onViewportChanged, onCellContextMenu: this.onCellContextMenu, loadingOverlayComponent: 'loadingOverlay', noRowsOverlayComponent: 'noRecordsOverlay', onRowDataUpdated: this.onRowDataUpdated, context: this.table_context, rowHeight: this.state.rowHeight, getRowStyle: this._getRowStyle, getRowHeight: this._getRowHeight, headerHeight: headerHeight !== undefined ? headerHeight : headerFilterRowHeight, floatingFiltersHeight: headerFilterRowHeight, suppressLoadingOverlay: this.props.loadingOverlayRenderer ? true : this.props.suppressLoadingOverlay, quickFilterParser: this.wildcardQuickFilter.quickFilterParser, quickFilterMatcher: this.wildcardQuickFilter.quickFilterMatcher })));
1910
+ return (React.createElement(AgGridReact, Object.assign({ key: key, debug: debugMode, ref: gridRef, theme: defaultTheme, paginationPageSize: paginationPageSize, maxConcurrentDatasourceRequests: this.props.rowModelType === "infinite" ? 1 : undefined, onGridReady: this.onGridReady, onPaginationChanged: this.onPaginationChanged, onFilterModified: this.onFilterModified, onFilterChanged: this.onFilterChanged, onSortChanged: this.onSortChanged, defaultColDef: this.getDefaultColDefinition(defaultColDef), columnDefs: adaptedColumnDefs, rowData: !rowDataManualMode ? rowData : undefined }, passedProperties, { onCellFocused: this.onCellFocused, cellSelection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", rowSelection: rowSelection, suppressRowClickSelection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", suppressRowDeselection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", suppressPaginationPanel: true, getRowId: getRowId, maintainColumnOrder: true, components: customComponents, columnTypes: this.columnTypes, onColumnVisible: this.onColumnsChanged, onColumnPinned: this.onColumnsChanged, onColumnResized: this.onColumnsChanged, onColumnMoved: this.onColumnsChanged, onNewColumnsLoaded: this.onNewColumnsLoaded, onCellMouseOver: this.onCellMouseOver, onCellMouseDown: this.onCellMouseDown, navigateToNextCell: this.navigateToNextCell, onViewportChanged: this.onViewportChanged, onCellContextMenu: this.onCellContextMenu, loadingOverlayComponent: 'loadingOverlay', noRowsOverlayComponent: 'noRecordsOverlay', onRowDataUpdated: this.onRowDataUpdated, context: this.table_context, rowHeight: this.state.rowHeight, getRowStyle: this._getRowStyle, getRowHeight: this._getRowHeight, headerHeight: headerHeight !== undefined ? headerHeight : headerFilterRowHeight, floatingFiltersHeight: headerFilterRowHeight, suppressLoadingOverlay: this.props.loadingOverlayRenderer ? true : this.props.suppressLoadingOverlay, quickFilterParser: this.wildcardQuickFilter.quickFilterParser, quickFilterMatcher: this.wildcardQuickFilter.quickFilterMatcher })));
1741
1911
  }),
1742
1912
  this.state.loading && this.props.loadingOverlayRenderer &&
1743
1913
  React.createElement("div", { className: "ag-overlay", "aria-hidden": "true" },
@@ -1747,8 +1917,8 @@ class DataGrid extends React.Component {
1747
1917
  }), tableOverlayRenderer === null || tableOverlayRenderer === void 0 ? void 0 :
1748
1918
  tableOverlayRenderer())),
1749
1919
  !!this.gridApi && !!this.gridApi && this.state.pageSize !== null &&
1750
- React.createElement(DataGridEditor, { dataGrid: this, gridApi: this.gridApi, columnDefinitions: columnDefs, columnModel: this.state.columnModel, visible: !!this.props.tableConfigVisible, onTableConfigVisible: this.showTableConfiguration, paginationPageSize: paging.pageSize, paginationDefaultPageSize: paging.defaultPageSize, currentPageSize: this.state.pageSize, showMilliseconds: !!this.props.showMilliseconds, defaultShowMilliseconds: !!this.props.defaultShowMilliseconds, showYear: !this.props.hideYear, defaultShowYear: !this.props.defaultHideYear, showUtcOffset: !!this.props.showUtcOffset, defaultShowUtcOffset: !!this.props.defaultShowUtcOffset, rowStyleRules: this.props.rowStyleRules, defaultRowStyleRules: this.props.defaultRowStyleRules, onChangeRowStyleRules: onChangeRowStyleRules }),
1751
- !!this.gridApi && React.createElement(ModalDialog, { mode: "OK_CANCEL", open: this.state.columnsConfigVisible, initialWidth: 700, initialHeight: this.state.columnTransferHeight, title: React.createElement("span", null,
1920
+ React.createElement(DataGridEditor, { dataGrid: this, gridApi: this.gridApi, columnDefinitions: leafColumnDefs, columnModel: this.state.columnModel, visible: !!this.props.tableConfigVisible, onTableConfigVisible: this.showTableConfiguration, paginationPageSize: paging.pageSize, paginationDefaultPageSize: paging.defaultPageSize, currentPageSize: this.state.pageSize, showMilliseconds: !!this.props.showMilliseconds, defaultShowMilliseconds: !!this.props.defaultShowMilliseconds, showYear: !this.props.hideYear, defaultShowYear: !this.props.defaultHideYear, showUtcOffset: !!this.props.showUtcOffset, defaultShowUtcOffset: !!this.props.defaultShowUtcOffset, rowStyleRules: this.props.rowStyleRules, defaultRowStyleRules: this.props.defaultRowStyleRules, onChangeRowStyleRules: onChangeRowStyleRules }),
1921
+ !!this.gridApi && React.createElement(ModalDialog, { mode: "OK_CANCEL" /* ModalDialogMode.OK_CANCEL */, open: this.state.columnsConfigVisible, initialWidth: 700, initialHeight: this.state.columnTransferHeight, title: React.createElement("span", null,
1752
1922
  React.createElement(ControlOutlined, { style: {
1753
1923
  color: "#faad14",
1754
1924
  fontSize: 22,
@@ -1766,9 +1936,10 @@ class DataGrid extends React.Component {
1766
1936
  }, onResize: ({ height }) => {
1767
1937
  this.setState({ columnTransferHeight: height });
1768
1938
  } },
1769
- React.createElement(ColumnTransfer, { columnDefinitions: columnDefs, columnModel: this.state.columnModel, gridApi: this.gridApi, height: this.state.columnTransferHeight - 154 }))));
1939
+ React.createElement(ColumnTransfer, { columnDefinitions: leafColumnDefs, columnModel: this.state.columnModel, gridApi: this.gridApi, height: this.state.columnTransferHeight - 154 }))));
1770
1940
  }
1771
1941
  }
1942
+ /** Default `paging` (automatic page size) and `rowStyleRules` ({@link tableDefaultRowStyleRules}). */
1772
1943
  DataGrid.defaultProps = {
1773
1944
  paging: {
1774
1945
  pageSize: 0,
@@ -1794,8 +1965,10 @@ function getAgGridThemeFromAntd(algorithm, token) {
1794
1965
  function agThemeEquals(newArgs, lastArgs) {
1795
1966
  const [newAlgo, newToken] = newArgs;
1796
1967
  const [lastAlgo, lastToken] = lastArgs;
1968
+ // Check algorithm reference (usually stable constants in Antd)
1797
1969
  if (newAlgo !== lastAlgo)
1798
1970
  return false;
1971
+ // Only compare the tokens you actually use in your function
1799
1972
  return (newToken.colorPrimary === lastToken.colorPrimary &&
1800
1973
  newToken.colorBgContainer === lastToken.colorBgContainer &&
1801
1974
  newToken.colorText === lastToken.colorText &&