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
@@ -36,6 +36,30 @@ const useStyles = createStyles(({ css }) => {
36
36
  };
37
37
  });
38
38
  const CONFIGURATION_VERSION = 2;
39
+ /**
40
+ * {@link DataGrid} with a persistable {@link GridConfiguration}, optional side panels and batched live updates.
41
+ *
42
+ * It lays out a resizable filter panel (left), the grid with an optional control panel below it, and a detail
43
+ * panel (right); keeps column state, paging, row styling and date-time formatting in a configuration reported by
44
+ * `onChangeConfiguration`; and applies record changes pushed by {@link addRecord}, {@link updateRecord} and
45
+ * {@link removeRecord} as debounced ag-grid transactions. When `rowData` is passed, those transactions also
46
+ * modify that array in place.
47
+ *
48
+ * @typeParam T - row data type; rows are identified by `id`, which is also the ag-grid row id
49
+ * @example
50
+ * ```tsx
51
+ * <ExtendedDataGrid<Row>
52
+ * ref={(grid) => this.grid = grid ?? undefined}
53
+ * columnDefs={columnDefs}
54
+ * rowData={this.state.rows}
55
+ * defaultGridConfiguration={storedConfiguration ?? {pageSize: 0}}
56
+ * onChangeConfiguration={(configuration) => store(configuration)}
57
+ * onLoadData={(callback) => callback(this.state.rows.length)}
58
+ * />
59
+ * // later, on a pushed change:
60
+ * this.grid?.updateRecord(changedRow);
61
+ * ```
62
+ */
39
63
  class ExtendedDataGrid extends React.Component {
40
64
  constructor(props) {
41
65
  var _a;
@@ -60,6 +84,7 @@ class ExtendedDataGrid extends React.Component {
60
84
  gridConfiguration.defaultShowMilliseconds = gridConfigurationOk && props.defaultGridConfiguration.defaultShowMilliseconds ? props.defaultGridConfiguration.defaultShowMilliseconds : false;
61
85
  gridConfiguration.hideYear = gridConfigurationOk && props.defaultGridConfiguration.hideYear ? props.defaultGridConfiguration.hideYear : false;
62
86
  gridConfiguration.defaultHideYear = gridConfigurationOk && props.defaultGridConfiguration.defaultHideYear ? props.defaultGridConfiguration.defaultHideYear : false;
87
+ // defaults to true - a stored `false` has to survive, so absence is what falls back
63
88
  gridConfiguration.showUtcOffset = gridConfigurationOk && props.defaultGridConfiguration.showUtcOffset !== undefined ? props.defaultGridConfiguration.showUtcOffset : true;
64
89
  gridConfiguration.defaultShowUtcOffset = gridConfigurationOk && props.defaultGridConfiguration.defaultShowUtcOffset !== undefined ? props.defaultGridConfiguration.defaultShowUtcOffset : true;
65
90
  gridConfiguration.filterPanelWidth = gridConfigurationOk && props.defaultGridConfiguration.filterPanelWidth
@@ -68,12 +93,15 @@ class ExtendedDataGrid extends React.Component {
68
93
  gridConfiguration.detailPanelWidth = gridConfigurationOk && props.defaultGridConfiguration.detailPanelWidth ? props.defaultGridConfiguration.detailPanelWidth : 0;
69
94
  this.state = {
70
95
  gridConfiguration: gridConfiguration,
96
+ // search context
71
97
  searchString: "",
72
98
  searchHistory: props.search && props.search.initialSearchHistory ? [...props.search.initialSearchHistory] : [],
99
+ // visibility flags
73
100
  tableConfigVisible: false,
74
101
  defaultFilter: this.props.filterPanel && this.props.filterPanel.defaultFilter ? cloneDeep(this.props.filterPanel.defaultFilter) : undefined,
75
102
  filterChanged: false,
76
103
  tableNeedToBeReloaded: false,
104
+ // panel layout sizes
77
105
  sizes: [gridConfiguration.filterPanelWidth, undefined, gridConfiguration.detailPanelWidth],
78
106
  width: 0,
79
107
  };
@@ -124,10 +152,16 @@ class ExtendedDataGrid extends React.Component {
124
152
  this.resizeObserver.disconnect();
125
153
  }
126
154
  }
155
+ /** Returns the current configuration (the live object, not a copy). */
127
156
  getConfiguration() {
128
157
  return this.state.gridConfiguration;
129
158
  }
159
+ /**
160
+ * Returns the internally kept search string and a copy of the search history.
161
+ * @returns the search history ordered oldest first (reverse of the internal and `initialSearchHistory` order)
162
+ */
130
163
  getSearchContext() {
164
+ // reverse searchHistory before storing it
131
165
  const searchHistory = [...this.state.searchHistory];
132
166
  searchHistory.reverse();
133
167
  return {
@@ -135,13 +169,19 @@ class ExtendedDataGrid extends React.Component {
135
169
  searchHistory: searchHistory
136
170
  };
137
171
  }
172
+ /**
173
+ * Reloads the grid data by calling `onLoadData`. Pending record changes are discarded once the data are loaded.
174
+ * @param callback - called after `onLoadData` reports the loaded data
175
+ */
138
176
  loadData(callback) {
139
177
  var _a;
140
178
  (_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.loadData(callback);
141
179
  }
180
+ /** Whether the inner ag-grid exists and has not been destroyed. */
142
181
  isActive() {
143
182
  return !!this.dataGrid && this.dataGrid.isActive();
144
183
  }
184
+ /** Focuses a cell of the last selected row (or the first row) of the inner grid. */
145
185
  focus() {
146
186
  var _a;
147
187
  (_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.focus();
@@ -169,6 +209,7 @@ class ExtendedDataGrid extends React.Component {
169
209
  }
170
210
  this.props.onLoadData((recordsCount) => {
171
211
  this.dataLoaded = true;
212
+ // clear meanwhile dynamically added/removed/updated data records
172
213
  this.dataTransaction = { add: [], remove: [], update: [] };
173
214
  this.followLastRecord();
174
215
  callback(recordsCount);
@@ -195,7 +236,9 @@ class ExtendedDataGrid extends React.Component {
195
236
  _onSearch() {
196
237
  const currentSearchString = this.state.searchString;
197
238
  let searchHistory = this.state.searchHistory;
239
+ // remove search string from history
198
240
  searchHistory = searchHistory.filter((searchString) => searchString !== currentSearchString);
241
+ // add new search string to first position in history
199
242
  searchHistory.unshift(currentSearchString);
200
243
  searchHistory = searchHistory.slice(0, 10);
201
244
  this.setState({
@@ -218,21 +261,29 @@ class ExtendedDataGrid extends React.Component {
218
261
  }
219
262
  }
220
263
  }
264
+ /** Discards all queued, not yet applied record changes. */
221
265
  clearTransaction() {
222
266
  this.dataTransaction.add = [];
223
267
  this.dataTransaction.remove = [];
224
268
  this.dataTransaction.update = [];
225
269
  this.dataTransaction.addIndex = undefined;
226
270
  }
271
+ /** Removes all queued, not yet applied changes of the record with the id of `item`. */
227
272
  removeFromTransaction(item) {
228
273
  this.dataTransaction.add = this.dataTransaction.add.filter(value => value.id !== item.id);
229
274
  this.dataTransaction.remove = this.dataTransaction.remove.filter(value => value.id !== item.id);
230
275
  this.dataTransaction.update = this.dataTransaction.update.filter(value => value.id !== item.id);
231
276
  }
277
+ /** Whether the record is displayed in the grid or queued to be added. */
232
278
  hasRecord(id) {
233
279
  var _a;
234
280
  return !!((_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getRowNode(id + "")) || this.dataTransaction.add.some((value) => value.id === id);
235
281
  }
282
+ /**
283
+ * Queues a record to be added; it is applied with the next debounced batch.
284
+ * If a removal of the same record is queued, the record is updated instead.
285
+ * @param addIndex - row index to insert at; applies to the whole batch (the last value wins), rows are appended when not set
286
+ */
236
287
  addRecord(data, addIndex) {
237
288
  const markedToRemove = this.dataTransaction.remove.find((value => value.id === data.id));
238
289
  if (markedToRemove) {
@@ -250,14 +301,26 @@ class ExtendedDataGrid extends React.Component {
250
301
  this._updateDataDebounced();
251
302
  }
252
303
  }
304
+ /**
305
+ * Queues several records to be added, see {@link addRecord}.
306
+ * Note that a non-zero `addIndex` reverses `dataArray` in place.
307
+ */
253
308
  addRecords(dataArray, addIndex) {
254
309
  (addIndex ? dataArray.reverse() : dataArray).forEach(data => this.addRecord(data, addIndex));
255
310
  }
311
+ /** Replaces all grid data and discards queued record changes. */
256
312
  setRowData(dataArray) {
257
313
  var _a;
314
+ // reset transaction data received till this new data list is loaded,
315
+ // we can do it here, because communication is serialized in one thread
316
+ // and all push changes to new list data will come only after this method is finished
258
317
  this.dataTransaction = { add: [], remove: [], update: [] };
259
318
  (_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.setRowData(dataArray);
260
319
  }
320
+ /**
321
+ * Queues removal of the record with the id of `data`; it is applied with the next debounced batch.
322
+ * If the record is only queued to be added, that addition is cancelled. A removed row is deselected first.
323
+ */
261
324
  removeRecord(data) {
262
325
  const markedToAdd = this.dataTransaction.add.find((value => value.id === data.id));
263
326
  if (markedToAdd) {
@@ -271,17 +334,22 @@ class ExtendedDataGrid extends React.Component {
271
334
  this._updateDataDebounced();
272
335
  }
273
336
  }
337
+ /** Queues removal of several records, see {@link removeRecord}. */
274
338
  removeRecords(dataList) {
275
339
  dataList.forEach((data) => {
276
340
  this.removeRecord(data);
277
341
  });
278
342
  }
343
+ /**
344
+ * Queues a record change according to its `dataChangeState`: `CONFIGURED` adds the record, `REMOVED` removes it,
345
+ * anything else updates it. An update of a record that is not in the grid when the batch is applied adds it.
346
+ */
279
347
  updateRecord(data) {
280
348
  switch (data.dataChangeState) {
281
- case "DEF":
349
+ case "DEF" /* DataChangeStateEnum.CONFIGURED */:
282
350
  this.addRecord(data);
283
351
  break;
284
- case "UNDEF":
352
+ case "UNDEF" /* DataChangeStateEnum.REMOVED */:
285
353
  this.removeRecord(data);
286
354
  break;
287
355
  default:
@@ -299,12 +367,14 @@ class ExtendedDataGrid extends React.Component {
299
367
  break;
300
368
  }
301
369
  }
370
+ /** Queues several record changes, see {@link updateRecord}. */
302
371
  updateRecords(dataList) {
303
372
  dataList.forEach((data) => {
304
373
  this.updateRecord(data);
305
374
  });
306
375
  }
307
376
  _updateData() {
377
+ // remove duplicates, preserve last version of object
308
378
  this.dataTransaction.update.forEach(data => {
309
379
  const rowNode = this.gridApi ? this.gridApi.getRowNode(data.id + "") : null;
310
380
  if (rowNode) {
@@ -317,6 +387,7 @@ class ExtendedDataGrid extends React.Component {
317
387
  this.dataTransaction.add.push(data);
318
388
  }
319
389
  });
390
+ // we have already processed them
320
391
  this.dataTransaction.update = [];
321
392
  if (this.dataTransaction.add.length > 0 || this.dataTransaction.remove.length > 0) {
322
393
  this.dataTransaction.remove.forEach((object) => {
@@ -325,10 +396,12 @@ class ExtendedDataGrid extends React.Component {
325
396
  node.setSelected(false);
326
397
  }
327
398
  });
399
+ // upgrade grid
328
400
  if (this.gridApi) {
329
401
  this.gridApi.applyTransaction(this.dataTransaction);
330
402
  }
331
403
  if (this.props.rowData) {
404
+ // automatically updating client side array of records
332
405
  if (this.dataTransaction.addIndex !== undefined) {
333
406
  this.props.rowData.splice(this.dataTransaction.addIndex, 0, ...this.dataTransaction.add);
334
407
  }
@@ -348,6 +421,10 @@ class ExtendedDataGrid extends React.Component {
348
421
  this.props.onDataChanged();
349
422
  }
350
423
  }
424
+ /**
425
+ * Switches follow-last-record on or off and reports the change through `onChangeConfiguration`.
426
+ * Switching on applies {@link GridConfiguration.followLastRecordSortModel} (if set) and scrolls to the last row.
427
+ */
351
428
  enableFollowLastRecord(enable) {
352
429
  var _a;
353
430
  if (enable) {
@@ -364,11 +441,16 @@ class ExtendedDataGrid extends React.Component {
364
441
  }
365
442
  }
366
443
  }
444
+ /** Debounced (500 ms) variant of {@link followLastRecord}; used internally. */
367
445
  _followLastRecordDebounced() {
368
446
  if (this.state.gridConfiguration.followLastRecord && this.props.rowData && this.props.rowData.length > 0) {
369
447
  this.followLastRecord();
370
448
  }
371
449
  }
450
+ /**
451
+ * Scrolls to the last displayed row if {@link GridConfiguration.followLastRecord} is on and client-side `rowData`
452
+ * is not empty.
453
+ */
372
454
  followLastRecord() {
373
455
  if (this.state.gridConfiguration.followLastRecord && this.props.rowData && this.props.rowData.length > 0) {
374
456
  if (this.gridApi) {
@@ -382,24 +464,32 @@ class ExtendedDataGrid extends React.Component {
382
464
  }
383
465
  }
384
466
  }
467
+ /** Applies an ag-grid column state, including column order, through {@link DataGrid.setColumnState}. */
385
468
  setColumnModel(columnModel) {
386
469
  var _a;
387
470
  (_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.setColumnState(columnModel);
388
471
  }
472
+ /** Sorts by the given columns in the given order; all other columns become unsorted. */
389
473
  setSortModel(sortModel) {
390
474
  var _a;
391
475
  (_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.setSortModel(sortModel);
392
476
  }
477
+ /** Returns the current sort columns ordered by sort priority, or an empty array before the grid is ready. */
393
478
  getSortModel() {
394
479
  var _a, _b;
395
480
  return (_b = (_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.getSortModel()) !== null && _b !== void 0 ? _b : [];
396
481
  }
482
+ /** Internal ag-grid `rowDataUpdated` handler; forwards the event to `onRowDataUpdated`. */
397
483
  _onRowDataUpdated(event) {
398
484
  this._followLastRecordDebounced();
399
485
  if (this.props.onRowDataUpdated) {
400
486
  this.props.onRowDataUpdated(event);
401
487
  }
402
488
  }
489
+ /**
490
+ * Shows or collapses the filter panel. Showing a collapsed panel opens it with `filterPanel.defaultWidth` (250 if not set).
491
+ * The width is stored in the configuration but not reported through `onChangeConfiguration`.
492
+ */
403
493
  showFilterPanel(show) {
404
494
  var _a, _b;
405
495
  const { gridConfiguration, sizes } = this.state;
@@ -424,6 +514,10 @@ class ExtendedDataGrid extends React.Component {
424
514
  }
425
515
  }
426
516
  }
517
+ /**
518
+ * Shows or collapses the detail panel. Showing a collapsed panel opens it with `detailPanel.defaultWidth` (250 if not set).
519
+ * The width is stored in the configuration but not reported through `onChangeConfiguration`.
520
+ */
427
521
  showDetailPanel(show) {
428
522
  const { gridConfiguration, sizes } = this.state;
429
523
  const [filterPanelWidth, middleWidth, detailPanelWidth] = sizes;
@@ -447,6 +541,10 @@ class ExtendedDataGrid extends React.Component {
447
541
  }
448
542
  }
449
543
  }
544
+ /**
545
+ * Moves a single-row selection to the next or previous row and scrolls it into view; does nothing unless exactly one row
546
+ * is selected. Supported for client-side `rowData` and the `infinite` row model.
547
+ */
450
548
  selectNextPreviousRecord(previous) {
451
549
  var _a, _b, _c, _d;
452
550
  let selectedNodes = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getSelectedNodes();
@@ -471,6 +569,7 @@ class ExtendedDataGrid extends React.Component {
471
569
  }
472
570
  }
473
571
  }
572
+ /** Replaces the row style rules in the configuration and redraws the rows, without calling any change handler. */
474
573
  changeRowStyleRules(rowStyleRules) {
475
574
  this.state.gridConfiguration.rowStyleRules = rowStyleRules;
476
575
  this.setState({ gridConfiguration: this.state.gridConfiguration }, () => {
@@ -478,23 +577,30 @@ class ExtendedDataGrid extends React.Component {
478
577
  (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.redrawRows();
479
578
  });
480
579
  }
580
+ /** Internal handler of row style rule edits; applies them and calls `onChangeRowStyleRules`. */
481
581
  _onChangeRowStyleRules(rowStyleRules) {
482
582
  this.changeRowStyleRules(rowStyleRules);
483
583
  if (this.props.onChangeRowStyleRules) {
484
584
  this.props.onChangeRowStyleRules(rowStyleRules);
485
585
  }
486
586
  }
587
+ /**
588
+ * Tells the grid which filter the filter panel has applied, so that {@link FilterPanelRendererParams.filterChanged}
589
+ * reflects whether it differs from the default filter (`null` and `undefined` values are treated as equal).
590
+ */
487
591
  onPanelFilterApplied(newFilter) {
488
592
  const filterChanged = !isEqualWith(newFilter, this.state.defaultFilter, this.equalValues);
489
593
  if (filterChanged !== this.state.filterChanged) {
490
594
  this.setState({ filterChanged: filterChanged });
491
595
  }
492
596
  }
597
+ /** Returns the text of the column's applied text filter model, or an empty string. */
493
598
  getUiColumnFilterValue(colId) {
494
599
  var _a;
495
600
  const nameFilterModel = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getColumnFilterModel(colId);
496
601
  return nameFilterModel && nameFilterModel.filter ? nameFilterModel.filter : "";
497
602
  }
603
+ /** Clears the UI of the column's text filter without applying the change to the grid. */
498
604
  async removeUiColumnFilterValue(colId) {
499
605
  var _a;
500
606
  const filterInstance = await ((_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getColumnFilterInstance(colId));
@@ -502,9 +608,14 @@ class ExtendedDataGrid extends React.Component {
502
608
  const nameFilterModel = textFilterInstance.getModelFromUi();
503
609
  if (nameFilterModel) {
504
610
  nameFilterModel.filter = "";
611
+ // we need to hack this typescript protected declaration
612
+ // @ts-ignore
505
613
  textFilterInstance.resetUiToDefaults(false);
506
614
  }
507
615
  }
616
+ /**
617
+ * Applies the value currently entered in the column's filter UI to its filter model, without redrawing ag-grid.
618
+ */
508
619
  async applyUiColumnFilterValue(colId) {
509
620
  var _a, _b, _c;
510
621
  const filterInstance = await ((_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getColumnFilterInstance(colId));
@@ -568,10 +679,12 @@ class ExtendedDataGrid extends React.Component {
568
679
  }
569
680
  return undefined;
570
681
  }
682
+ /** Whether the filter panel is expanded (has a non-zero width). */
571
683
  isFilterPanelVisible() {
572
684
  var _a;
573
685
  return ((_a = this.state.gridConfiguration.filterPanelWidth) !== null && _a !== void 0 ? _a : 0) > 0;
574
686
  }
687
+ /** Renders the inner {@link DataGrid}; used by {@link render}. */
575
688
  renderDataGrid() {
576
689
  const _a = this.props, { defaultGridConfiguration, onGridReady, onLoadData, onSortChanged, onColumnsChanged, onSelectionChanged, onViewportChanged, onTableConfigVisible, toolbar, paging, filter, search, onChangeConfiguration, onDataChanged, onChangeRowStyleRules, filterPanel, controlPanel, detailPanel } = _a, rest = __rest(_a, ["defaultGridConfiguration", "onGridReady", "onLoadData", "onSortChanged", "onColumnsChanged", "onSelectionChanged", "onViewportChanged", "onTableConfigVisible", "toolbar", "paging", "filter", "search", "onChangeConfiguration", "onDataChanged", "onChangeRowStyleRules", "filterPanel", "controlPanel", "detailPanel"]);
577
690
  return (React.createElement(DataGrid, Object.assign({}, rest, { ref: (dataGrid) => {
@@ -676,6 +789,7 @@ class ExtendedDataGrid extends React.Component {
676
789
  }
677
790
  }
678
791
  }
792
+ /** Fills the `rowStyleRules` prop required by {@link DataGridProps}; rendering uses the rules from the configuration instead. */
679
793
  ExtendedDataGrid.defaultProps = {
680
794
  rowStyleRules: tableDefaultRowStyleRules()
681
795
  };