@highcharts/grid-pro 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/css/grid-pro.css +93 -90
  2. package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js +2 -0
  3. package/es-modules/Accessibility/Options/LangDefaults.js +6 -1
  4. package/es-modules/Accessibility/Utils/ChartUtilities.js +3 -3
  5. package/es-modules/Core/Chart/Chart.js +1 -1
  6. package/es-modules/Core/Color/ColorString.d.ts +25 -0
  7. package/es-modules/Core/Color/ColorType.d.ts +43 -0
  8. package/es-modules/Core/Color/GradientColor.d.ts +57 -0
  9. package/es-modules/Core/Globals.js +1 -1
  10. package/es-modules/Core/Renderer/AlignObject.d.ts +37 -0
  11. package/es-modules/Core/Renderer/BBoxObject.d.ts +40 -0
  12. package/es-modules/Core/Renderer/CSSObject.d.ts +130 -0
  13. package/es-modules/Core/Renderer/DOMElementType.d.ts +36 -0
  14. package/es-modules/Core/Renderer/DashStyleValue.d.ts +28 -0
  15. package/es-modules/Core/Renderer/FontMetricsObject.d.ts +38 -0
  16. package/es-modules/Core/Renderer/HTML/HTMLAttributes.d.ts +57 -0
  17. package/es-modules/Core/Renderer/PolygonBoxObject.d.ts +19 -0
  18. package/es-modules/Core/Renderer/Position3DObject.d.ts +35 -0
  19. package/es-modules/Core/Renderer/PositionObject.d.ts +28 -0
  20. package/es-modules/Core/Renderer/RectangleObject.d.ts +35 -0
  21. package/es-modules/Core/Renderer/RendererType.d.ts +53 -0
  22. package/es-modules/Core/Renderer/SVG/ButtonThemeObject.d.ts +43 -0
  23. package/es-modules/Core/Renderer/SVG/SVGArc3D.d.ts +44 -0
  24. package/es-modules/Core/Renderer/SVG/SVGAttributes.d.ts +147 -0
  25. package/es-modules/Core/Renderer/SVG/SVGAttributes3D.d.ts +42 -0
  26. package/es-modules/Core/Renderer/SVG/SVGCuboid.d.ts +42 -0
  27. package/es-modules/Core/Renderer/SVG/SVGElementBase.d.ts +31 -0
  28. package/es-modules/Core/Renderer/SVG/SVGPath.d.ts +97 -0
  29. package/es-modules/Core/Renderer/SVG/SVGPath3D.d.ts +40 -0
  30. package/es-modules/Core/Renderer/SVG/SVGRendererBase.d.ts +31 -0
  31. package/es-modules/Core/Renderer/SVG/SymbolOptions.d.ts +41 -0
  32. package/es-modules/Core/Renderer/SVG/SymbolType.d.ts +50 -0
  33. package/es-modules/Core/Renderer/ShadowOptionsObject.d.ts +40 -0
  34. package/es-modules/Core/Renderer/SizeObject.d.ts +28 -0
  35. package/es-modules/Core/Templating.js +6 -7
  36. package/es-modules/Data/Connectors/DataConnector.js +3 -2
  37. package/es-modules/Data/Connectors/DataConnectorOptions.d.ts +1 -1
  38. package/es-modules/Data/DataTable.d.ts +1 -1
  39. package/es-modules/Data/DataTable.js +3 -2
  40. package/es-modules/Data/DataTableCore.js +15 -6
  41. package/es-modules/Grid/Core/Accessibility/Accessibility.d.ts +13 -15
  42. package/es-modules/Grid/Core/Credits.d.ts +0 -2
  43. package/es-modules/Grid/Core/Defaults.d.ts +20 -17
  44. package/es-modules/Grid/Core/Defaults.js +116 -114
  45. package/es-modules/Grid/Core/Globals.d.ts +108 -32
  46. package/es-modules/Grid/Core/Globals.js +98 -111
  47. package/es-modules/Grid/Core/Grid.d.ts +51 -17
  48. package/es-modules/Grid/Core/Grid.js +369 -79
  49. package/es-modules/Grid/Core/GridUtils.d.ts +96 -89
  50. package/es-modules/Grid/Core/GridUtils.js +143 -155
  51. package/es-modules/Grid/Core/Options.d.ts +3 -7
  52. package/es-modules/Grid/Core/Pagination/Icons.d.ts +4 -4
  53. package/es-modules/Grid/Core/Pagination/Pagination.d.ts +32 -57
  54. package/es-modules/Grid/Core/Pagination/Pagination.js +206 -214
  55. package/es-modules/Grid/Core/Pagination/PaginationOptions.d.ts +22 -15
  56. package/es-modules/Grid/Core/Querying/PaginationController.d.ts +32 -9
  57. package/es-modules/Grid/Core/Querying/PaginationController.js +58 -18
  58. package/es-modules/Grid/Core/Querying/SortingController.d.ts +7 -15
  59. package/es-modules/Grid/Core/Querying/SortingController.js +2 -3
  60. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.d.ts +1 -1
  61. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.js +32 -4
  62. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilteringTypes.d.ts +3 -3
  63. package/es-modules/Grid/Core/Table/Actions/ColumnSorting.d.ts +3 -5
  64. package/es-modules/Grid/Core/Table/Actions/ColumnSorting.js +1 -5
  65. package/es-modules/Grid/Core/Table/Body/TableCell.d.ts +14 -10
  66. package/es-modules/Grid/Core/Table/Body/TableCell.js +22 -25
  67. package/es-modules/Grid/Core/Table/Body/TableRow.d.ts +0 -2
  68. package/es-modules/Grid/Core/Table/Cell.js +30 -0
  69. package/es-modules/Grid/Core/Table/CellContent/TextContent.d.ts +2 -7
  70. package/es-modules/Grid/Core/Table/CellContent/TextContent.js +25 -14
  71. package/es-modules/Grid/Core/Table/Column.d.ts +7 -9
  72. package/es-modules/Grid/Core/Table/Column.js +23 -1
  73. package/es-modules/Grid/Core/Table/ColumnResizing/AdjacentResizingMode.js +2 -2
  74. package/es-modules/Grid/Core/Table/ColumnResizing/ColumnResizing.d.ts +30 -23
  75. package/es-modules/Grid/Core/Table/ColumnResizing/ColumnResizing.js +39 -39
  76. package/es-modules/Grid/Core/Table/ColumnResizing/DistributedResizingMode.js +1 -1
  77. package/es-modules/Grid/Core/Table/ColumnResizing/IndependentResizingMode.js +2 -2
  78. package/es-modules/Grid/Core/Table/ColumnResizing/ResizingMode.d.ts +6 -1
  79. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.js +10 -0
  80. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/FilterPopup.d.ts +2 -2
  81. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/StateHelpers.d.ts +26 -24
  82. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/StateHelpers.js +37 -39
  83. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/FilterToolbarButton.d.ts +1 -1
  84. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/MenuToolbarButton.d.ts +1 -1
  85. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.d.ts +1 -1
  86. package/es-modules/Grid/Core/Table/Header/HeaderCell.js +3 -4
  87. package/es-modules/Grid/Core/Table/Header/HeaderRow.d.ts +0 -2
  88. package/es-modules/Grid/Core/Table/Header/TableHeader.d.ts +0 -2
  89. package/es-modules/Grid/Core/Table/Table.d.ts +11 -13
  90. package/es-modules/Grid/Core/Table/Table.js +9 -5
  91. package/es-modules/Grid/Core/UI/Button.d.ts +1 -1
  92. package/es-modules/Grid/Core/UI/ContextMenu.d.ts +1 -1
  93. package/es-modules/Grid/Core/UI/ContextMenu.js +1 -1
  94. package/es-modules/Grid/Core/UI/ContextMenuButton.d.ts +39 -44
  95. package/es-modules/Grid/Core/UI/ContextMenuButton.js +4 -4
  96. package/es-modules/Grid/Core/UI/Popup.d.ts +17 -19
  97. package/es-modules/Grid/Core/UI/Popup.js +2 -1
  98. package/es-modules/Grid/Core/UI/SvgIcons.d.ts +49 -50
  99. package/es-modules/Grid/Core/UI/SvgIcons.js +114 -123
  100. package/es-modules/Grid/Core/UI/ToolbarButton.d.ts +46 -52
  101. package/es-modules/Grid/Core/UI/ToolbarButton.js +4 -3
  102. package/es-modules/Grid/Pro/CellEditing/CellEditing.d.ts +6 -8
  103. package/es-modules/Grid/Pro/CellEditing/CellEditing.js +8 -11
  104. package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.d.ts +27 -1
  105. package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.js +149 -149
  106. package/es-modules/Grid/Pro/CellRendering/CellRenderer.d.ts +18 -20
  107. package/es-modules/Grid/Pro/CellRendering/CellRenderer.js +1 -1
  108. package/es-modules/Grid/Pro/CellRendering/CellRendererRegistry.d.ts +19 -17
  109. package/es-modules/Grid/Pro/CellRendering/CellRendererRegistry.js +28 -34
  110. package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.d.ts +12 -1
  111. package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.js +41 -46
  112. package/es-modules/Grid/Pro/CellRendering/ContentTypes/CheckboxContent.js +2 -2
  113. package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContent.d.ts +2 -2
  114. package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContentBase.d.ts +2 -2
  115. package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContentBase.js +4 -2
  116. package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateTimeInputContent.d.ts +2 -2
  117. package/es-modules/Grid/Pro/CellRendering/ContentTypes/NumberInputContent.js +3 -1
  118. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SelectContent.js +3 -1
  119. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.d.ts +19 -8
  120. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.js +17 -13
  121. package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.js +3 -1
  122. package/es-modules/Grid/Pro/CellRendering/ContentTypes/TimeInputContent.d.ts +2 -2
  123. package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.d.ts +18 -20
  124. package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.js +3 -3
  125. package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.d.ts +10 -12
  126. package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.js +3 -3
  127. package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRendererBase.d.ts +17 -20
  128. package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.d.ts +10 -12
  129. package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.js +3 -3
  130. package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.d.ts +20 -22
  131. package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.js +3 -3
  132. package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.d.ts +40 -42
  133. package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.js +3 -3
  134. package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.d.ts +16 -18
  135. package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.js +14 -22
  136. package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.d.ts +22 -24
  137. package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.js +3 -3
  138. package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.d.ts +10 -12
  139. package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.js +3 -3
  140. package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.d.ts +10 -12
  141. package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.js +3 -3
  142. package/es-modules/Grid/Pro/ColumnTypes/Validator.d.ts +46 -51
  143. package/es-modules/Grid/Pro/ColumnTypes/Validator.js +62 -77
  144. package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.d.ts +16 -3
  145. package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.js +26 -31
  146. package/es-modules/Grid/Pro/Credits/CreditsPro.d.ts +0 -2
  147. package/es-modules/Grid/Pro/Credits/CreditsProComposition.d.ts +12 -11
  148. package/es-modules/Grid/Pro/Credits/CreditsProComposition.js +29 -31
  149. package/es-modules/Grid/Pro/Export/Exporting.d.ts +3 -3
  150. package/es-modules/Grid/Pro/Export/Exporting.js +35 -29
  151. package/es-modules/Grid/Pro/Export/ExportingComposition.d.ts +12 -11
  152. package/es-modules/Grid/Pro/Export/ExportingComposition.js +24 -26
  153. package/es-modules/Grid/Pro/GridEvents.d.ts +19 -1
  154. package/es-modules/Grid/Pro/GridEvents.js +6 -2
  155. package/es-modules/Grid/Pro/Pagination/PaginationComposition.d.ts +4 -11
  156. package/es-modules/Grid/Pro/Pagination/PaginationComposition.js +44 -45
  157. package/es-modules/Grid/index.d.ts +1 -0
  158. package/es-modules/masters/grid-pro.src.d.ts +62 -37
  159. package/es-modules/masters/grid-pro.src.js +37 -39
  160. package/grid-pro.d.ts +122 -48
  161. package/grid-pro.js +3 -6
  162. package/grid-pro.js.map +1 -1
  163. package/grid-pro.src.d.ts +122 -48
  164. package/grid-pro.src.js +6650 -6277
  165. package/package.json +13 -4
  166. package/es-modules/Grid/Pro/ColumnTypes/ColumnDataType.d.ts +0 -29
@@ -181,87 +181,72 @@ class Validator {
181
181
  this.notifContainer.remove();
182
182
  }
183
183
  }
184
- /* *
185
- *
186
- * Namespace
187
- *
188
- * */
189
184
  /**
190
- * Namespace for Validation functionality.
185
+ * The class names used by the validator functionality.
191
186
  */
192
- (function (Validator) {
193
- /**
194
- * The class names used by the validator functionality.
195
- */
196
- Validator.classNames = {
197
- notifContainer: Globals.classNamePrefix + 'notification',
198
- notifError: Globals.classNamePrefix + 'notification-error',
199
- notifAnimation: Globals.classNamePrefix + 'notification-animation',
200
- editedCellError: Globals.classNamePrefix + 'edited-cell-error'
201
- };
202
- /* *
203
- *
204
- * Variables
205
- *
206
- * */
207
- /**
208
- * Definition of default validation rules.
209
- */
210
- Validator.rulesRegistry = {
211
- notEmpty: {
212
- validate: ({ value, rawValue }) => (defined(value) && rawValue.length > 0),
213
- notification: 'Value cannot be empty.'
214
- },
215
- number: {
216
- validate: ({ rawValue }) => !isNaN(+rawValue),
217
- notification: 'Value has to be a number.'
218
- },
219
- datetime: {
220
- validate: ({ value }) => !defined(value) || !isNaN(+value),
221
- notification: 'Value has to be parsed to a valid timestamp.'
222
- },
223
- 'boolean': {
224
- validate: ({ rawValue }) => (rawValue === 'true' || rawValue === 'false' ||
225
- Number(rawValue) === 1 || Number(rawValue) === 0),
226
- notification: 'Value has to be a boolean.'
187
+ Validator.classNames = {
188
+ notifContainer: Globals.classNamePrefix + 'notification',
189
+ notifError: Globals.classNamePrefix + 'notification-error',
190
+ notifAnimation: Globals.classNamePrefix + 'notification-animation',
191
+ editedCellError: Globals.classNamePrefix + 'edited-cell-error'
192
+ };
193
+ /**
194
+ * Definition of default validation rules.
195
+ */
196
+ Validator.rulesRegistry = {
197
+ notEmpty: {
198
+ validate: ({ value, rawValue }) => (defined(value) && rawValue.length > 0),
199
+ notification: 'Value cannot be empty.'
200
+ },
201
+ number: {
202
+ validate: ({ rawValue }) => !isNaN(+rawValue),
203
+ notification: 'Value has to be a number.'
204
+ },
205
+ datetime: {
206
+ validate: ({ value }) => !defined(value) || !isNaN(+value),
207
+ notification: 'Value has to be parsed to a valid timestamp.'
208
+ },
209
+ 'boolean': {
210
+ validate: ({ rawValue }) => (rawValue === 'true' || rawValue === 'false' ||
211
+ Number(rawValue) === 1 || Number(rawValue) === 0),
212
+ notification: 'Value has to be a boolean.'
213
+ },
214
+ ignoreCaseUnique: {
215
+ validate: function ({ rawValue }) {
216
+ const oldValue = String(this.value).toLowerCase();
217
+ const rowValueString = rawValue.toLowerCase();
218
+ if (oldValue === rowValueString) {
219
+ return true;
220
+ }
221
+ const columnData = this.column.data;
222
+ const isDuplicate = columnData?.some((value) => String(value).toLowerCase() ===
223
+ rowValueString);
224
+ return !isDuplicate;
227
225
  },
228
- ignoreCaseUnique: {
229
- validate: function ({ rawValue }) {
230
- const oldValue = String(this.value).toLowerCase();
231
- const rowValueString = rawValue.toLowerCase();
232
- if (oldValue === rowValueString) {
233
- return true;
234
- }
235
- const columnData = this.column.data;
236
- const isDuplicate = columnData?.some((value) => String(value).toLowerCase() ===
237
- rowValueString);
238
- return !isDuplicate;
239
- },
240
- notification: 'Value must be unique within this column (case-insensitive).'
226
+ notification: 'Value must be unique within this column (case-insensitive).'
227
+ },
228
+ unique: {
229
+ validate: function ({ rawValue }) {
230
+ const oldValue = this.value;
231
+ if (oldValue === rawValue) {
232
+ return true;
233
+ }
234
+ const columnData = this.column.data;
235
+ const isDuplicate = columnData?.some((value) => value === rawValue);
236
+ return !isDuplicate;
241
237
  },
242
- unique: {
243
- validate: function ({ rawValue }) {
244
- const oldValue = this.value;
245
- if (oldValue === rawValue) {
246
- return true;
247
- }
248
- const columnData = this.column.data;
249
- const isDuplicate = columnData?.some((value) => value === rawValue);
250
- return !isDuplicate;
251
- },
252
- notification: 'Value must be unique within this column (case-sensitive).'
253
- }
254
- };
255
- /**
256
- * Default validation rules for each dataType.
257
- */
258
- Validator.predefinedRules = {
259
- 'boolean': ['boolean'],
260
- datetime: ['datetime'],
261
- number: ['number'],
262
- string: []
263
- };
264
- })(Validator || (Validator = {}));
238
+ notification: 'Value must be unique within this column (case-sensitive).'
239
+ }
240
+ };
241
+ /**
242
+ * Default validation rules for each dataType.
243
+ */
244
+ Validator.predefinedRules = {
245
+ 'boolean': ['boolean'],
246
+ datetime: ['datetime'],
247
+ number: ['number'],
248
+ string: []
249
+ };
265
250
  /* *
266
251
  *
267
252
  * Default Export
@@ -1,4 +1,14 @@
1
+ import type Table from '../../Core/Table/Table';
2
+ import type { RuleKey, RuleDefinition, RulesRegistryType } from './Validator';
1
3
  import Validator from './Validator.js';
4
+ /**
5
+ * Extends the grid classes with cell editing functionality.
6
+ *
7
+ * @param TableClass
8
+ * The class to extend.
9
+ *
10
+ */
11
+ export declare function compose(TableClass: typeof Table): void;
2
12
  declare module '../../Core/Table/Table' {
3
13
  export default interface Table {
4
14
  /**
@@ -15,7 +25,7 @@ declare module '../../Pro/CellEditing/CellEditingComposition' {
15
25
  * If not set, the validation rules are applied according to the data
16
26
  * type.
17
27
  */
18
- validationRules?: (Validator.RuleKey | Validator.RuleDefinition)[];
28
+ validationRules?: (RuleKey | RuleDefinition)[];
19
29
  }
20
30
  }
21
31
  declare module '../../Core/Options' {
@@ -26,7 +36,10 @@ declare module '../../Core/Options' {
26
36
  * If not set, the validation rules are applied according to the data
27
37
  * type.
28
38
  */
29
- validationErrors?: Validator.RulesRegistryType;
39
+ validationErrors?: RulesRegistryType;
30
40
  }
31
41
  }
32
- export default ValidatorComposition;
42
+ declare const _default: {
43
+ readonly compose: typeof compose;
44
+ };
45
+ export default _default;
@@ -23,41 +23,36 @@ const { addEvent, pushUnique } = U;
23
23
  *
24
24
  * */
25
25
  /**
26
- * @internal
26
+ * Extends the grid classes with cell editing functionality.
27
+ *
28
+ * @param TableClass
29
+ * The class to extend.
30
+ *
27
31
  */
28
- var ValidatorComposition;
29
- (function (ValidatorComposition) {
30
- /**
31
- * Extends the grid classes with cell editing functionality.
32
- *
33
- * @param TableClass
34
- * The class to extend.
35
- *
36
- */
37
- function compose(TableClass) {
38
- if (!pushUnique(Globals.composed, 'Validator')) {
39
- return;
40
- }
41
- addEvent(TableClass, 'afterInit', initValidatorComposition);
42
- addEvent(TableClass, 'afterDestroy', destroy);
43
- }
44
- ValidatorComposition.compose = compose;
45
- /**
46
- * Callback function called after table initialization.
47
- */
48
- function initValidatorComposition() {
49
- this.validator = new Validator(this);
50
- }
51
- /**
52
- * Callback function called after table destroy.
53
- */
54
- function destroy() {
55
- this.validator.destroy();
32
+ export function compose(TableClass) {
33
+ if (!pushUnique(Globals.composed, 'Validator')) {
34
+ return;
56
35
  }
57
- })(ValidatorComposition || (ValidatorComposition = {}));
36
+ addEvent(TableClass, 'afterInit', initValidatorComposition);
37
+ addEvent(TableClass, 'afterDestroy', destroy);
38
+ }
39
+ /**
40
+ * Callback function called after table initialization.
41
+ */
42
+ function initValidatorComposition() {
43
+ this.validator = new Validator(this);
44
+ }
45
+ /**
46
+ * Callback function called after table destroy.
47
+ */
48
+ function destroy() {
49
+ this.validator.destroy();
50
+ }
58
51
  /* *
59
52
  *
60
53
  * Default Export
61
54
  *
62
55
  * */
63
- export default ValidatorComposition;
56
+ export default {
57
+ compose
58
+ };
@@ -30,6 +30,4 @@ declare class CreditsPro extends Credits {
30
30
  render(): void;
31
31
  destroy(): void;
32
32
  }
33
- declare namespace CreditsPro {
34
- }
35
33
  export default CreditsPro;
@@ -1,15 +1,13 @@
1
1
  import type Grid from '../../Core/Grid';
2
2
  import CreditsPro from './CreditsPro.js';
3
- declare namespace CreditsProComposition {
4
- /**
5
- * Extends the grid classes with customizable credits.
6
- *
7
- * @param GridClass
8
- * The class to extend.
9
- *
10
- */
11
- function compose(GridClass: typeof Grid): void;
12
- }
3
+ /**
4
+ * Extends the grid classes with customizable credits.
5
+ *
6
+ * @param GridClass
7
+ * The class to extend.
8
+ *
9
+ */
10
+ export declare function compose(GridClass: typeof Grid): void;
13
11
  declare module '../../Core/Options' {
14
12
  interface Options {
15
13
  /**
@@ -25,4 +23,7 @@ declare module '../../Core/Grid' {
25
23
  credits?: CreditsPro;
26
24
  }
27
25
  }
28
- export default CreditsProComposition;
26
+ declare const _default: {
27
+ readonly compose: typeof compose;
28
+ };
29
+ export default _default;
@@ -17,45 +17,43 @@
17
17
  import CreditsPro from './CreditsPro.js';
18
18
  import Globals from '../../Core/Globals.js';
19
19
  import U from '../../../Core/Utilities.js';
20
- import Defaults from '../../Core/Defaults.js';
20
+ import { defaultOptions } from '../../Core/Defaults.js';
21
21
  const { addEvent, merge, pushUnique } = U;
22
22
  /* *
23
23
  *
24
- * Class Namespace
24
+ * Composition
25
25
  *
26
26
  * */
27
- var CreditsProComposition;
28
- (function (CreditsProComposition) {
29
- /**
30
- * Extends the grid classes with customizable credits.
31
- *
32
- * @param GridClass
33
- * The class to extend.
34
- *
35
- */
36
- function compose(GridClass) {
37
- if (!pushUnique(Globals.composed, 'CreditsPro')) {
38
- return;
39
- }
40
- merge(true, Defaults.defaultOptions, {
41
- credits: CreditsPro.defaultOptions
42
- });
43
- // TODO: Change to `beforeLoad` after upgrading grid update.
44
- addEvent(GridClass, 'afterRenderViewport', initCredits);
45
- }
46
- CreditsProComposition.compose = compose;
47
- /**
48
- * Init configurable credits.
49
- * @param this
50
- * Reference to Grid.
51
- */
52
- function initCredits() {
53
- this.credits = new CreditsPro(this, this.options?.credits);
27
+ /**
28
+ * Extends the grid classes with customizable credits.
29
+ *
30
+ * @param GridClass
31
+ * The class to extend.
32
+ *
33
+ */
34
+ export function compose(GridClass) {
35
+ if (!pushUnique(Globals.composed, 'CreditsPro')) {
36
+ return;
54
37
  }
55
- })(CreditsProComposition || (CreditsProComposition = {}));
38
+ merge(true, defaultOptions, {
39
+ credits: CreditsPro.defaultOptions
40
+ });
41
+ // TODO: Change to `beforeLoad` after upgrading grid update.
42
+ addEvent(GridClass, 'afterRenderViewport', initCredits);
43
+ }
44
+ /**
45
+ * Init configurable credits.
46
+ * @param this
47
+ * Reference to Grid.
48
+ */
49
+ function initCredits() {
50
+ this.credits = new CreditsPro(this, this.options?.credits);
51
+ }
56
52
  /* *
57
53
  *
58
54
  * Default Export
59
55
  *
60
56
  * */
61
- export default CreditsProComposition;
57
+ export default {
58
+ compose
59
+ };
@@ -36,11 +36,11 @@ declare class Exporting {
36
36
  */
37
37
  downloadJSON(modified?: boolean): void;
38
38
  /**
39
- * Creates a CSV string from the data table.
39
+ * Creates a CSV string from the data grid.
40
40
  *
41
41
  * @param modified
42
- * Whether to return the modified data table (after filtering/sorting/etc.)
43
- * or the unmodified, original one. Default value is set to `true`.
42
+ * Whether to return the data including the modifiers (filtering, sorting,
43
+ * etc.) or the original data. Default value is set to `true`.
44
44
  *
45
45
  * @return
46
46
  * CSV string representing the data table.
@@ -14,7 +14,9 @@
14
14
  * */
15
15
  'use strict';
16
16
  import DownloadURL from '../../../Shared/DownloadURL.js';
17
+ import U from '../../../Core/Utilities.js';
17
18
  const { downloadURL, getBlobFromContent } = DownloadURL;
19
+ const { defined } = U;
18
20
  /* *
19
21
  *
20
22
  * Class
@@ -68,19 +70,18 @@ class Exporting {
68
70
  'data:application/json,\uFEFF' + encodeURIComponent(json), this.getFilename() + '.json');
69
71
  }
70
72
  /**
71
- * Creates a CSV string from the data table.
73
+ * Creates a CSV string from the data grid.
72
74
  *
73
75
  * @param modified
74
- * Whether to return the modified data table (after filtering/sorting/etc.)
75
- * or the unmodified, original one. Default value is set to `true`.
76
+ * Whether to return the data including the modifiers (filtering, sorting,
77
+ * etc.) or the original data. Default value is set to `true`.
76
78
  *
77
79
  * @return
78
80
  * CSV string representing the data table.
79
81
  */
80
82
  getCSV(modified = true) {
81
- const dataTable = modified ?
82
- this.grid.viewport?.dataTable :
83
- this.grid.dataTable;
83
+ const { grid } = this;
84
+ const dataTable = modified ? grid.presentationTable : grid.dataTable;
84
85
  if (!dataTable) {
85
86
  return '';
86
87
  }
@@ -96,49 +97,54 @@ class Exporting {
96
97
  if (!itemDelimiter) {
97
98
  itemDelimiter = (decimalPoint === ',' ? ';' : ',');
98
99
  }
99
- const columns = dataTable.getColumns();
100
- const columnIds = Object.keys(columns);
100
+ const columnIds = grid.enabledColumns ?? [];
101
+ const columnsCount = columnIds?.length;
101
102
  const csvRows = [];
102
- const columnsCount = columnIds.length;
103
103
  const rowArray = [];
104
104
  // Add the names as the first row if they should be exported
105
105
  if (exportNames) {
106
106
  csvRows.push(columnIds.map((columnId) => `"${columnId}"`).join(itemDelimiter));
107
107
  }
108
+ const typeParser = (type) => {
109
+ switch (type) {
110
+ case 'number':
111
+ case 'datetime':
112
+ return (val) => (defined(val) ?
113
+ String(val).replace('.', decimalPoint) :
114
+ '');
115
+ case 'string':
116
+ return (val) => (defined(val) ?
117
+ `"${val}"` :
118
+ '');
119
+ case 'boolean':
120
+ return (val) => (defined(val) ?
121
+ (val ? 'TRUE' : 'FALSE') :
122
+ '');
123
+ }
124
+ };
108
125
  for (let columnIndex = 0; columnIndex < columnsCount; columnIndex++) {
109
- const columnId = columnIds[columnIndex], column = columns[columnId], columnLength = column.length;
110
- let columnDataType;
126
+ const columnId = columnIds[columnIndex], column = grid.viewport?.getColumn(columnId), colType = column?.dataType, columnArray = dataTable.getColumn(columnId) ?? [], columnLength = columnArray?.length, parser = typeParser(colType ?? 'string');
111
127
  for (let rowIndex = 0; rowIndex < columnLength; rowIndex++) {
112
- let cellValue = column[rowIndex];
113
- if (!rowArray[rowIndex]) {
114
- rowArray[rowIndex] = [];
115
- }
116
- // Prefer datatype from metadata
117
- if (columnDataType === 'string') {
118
- cellValue = '"' + cellValue + '"';
119
- }
120
- else if (typeof cellValue === 'number') {
121
- cellValue = String(cellValue).replace('.', decimalPoint);
122
- }
123
- else if (typeof cellValue === 'string') {
124
- cellValue = `"${cellValue}"`;
128
+ let row = rowArray[rowIndex];
129
+ if (!row) {
130
+ row = rowArray[rowIndex] = [];
125
131
  }
126
- rowArray[rowIndex][columnIndex] = cellValue;
132
+ row[columnIndex] = parser(columnArray[rowIndex]);
127
133
  // On the final column, push the row to the CSV
128
134
  if (columnIndex === columnsCount - 1) {
129
135
  // Trim repeated undefined values starting at the end
130
136
  // Currently, we export the first "comma" even if the
131
137
  // second value is undefined
132
138
  let i = columnIndex;
133
- while (rowArray[rowIndex].length > 2) {
134
- const cellVal = rowArray[rowIndex][i];
139
+ while (row.length > 2) {
140
+ const cellVal = row[i];
135
141
  if (cellVal !== void 0) {
136
142
  break;
137
143
  }
138
- rowArray[rowIndex].pop();
144
+ row.pop();
139
145
  i--;
140
146
  }
141
- csvRows.push(rowArray[rowIndex].join(itemDelimiter));
147
+ csvRows.push(row.join(itemDelimiter));
142
148
  }
143
149
  }
144
150
  }
@@ -1,15 +1,13 @@
1
1
  import type Grid from '../../Core/Grid';
2
2
  import Exporting from './Exporting.js';
3
- declare namespace ExportingComposition {
4
- /**
5
- * Extends the grid classes with exporting.
6
- *
7
- * @param GridClass
8
- * The class to extend.
9
- *
10
- */
11
- function compose(GridClass: typeof Grid): void;
12
- }
3
+ /**
4
+ * Extends the grid classes with exporting.
5
+ *
6
+ * @param GridClass
7
+ * The class to extend.
8
+ *
9
+ */
10
+ export declare function compose(GridClass: typeof Grid): void;
13
11
  declare module '../../Core/Options' {
14
12
  interface Options {
15
13
  /**
@@ -65,4 +63,7 @@ declare module '../../Core/Grid' {
65
63
  exporting?: Exporting;
66
64
  }
67
65
  }
68
- export default ExportingComposition;
66
+ declare const _default: {
67
+ readonly compose: typeof compose;
68
+ };
69
+ export default _default;
@@ -13,43 +13,41 @@
13
13
  *
14
14
  * */
15
15
  'use strict';
16
- import Defaults from '../../Core/Defaults.js';
16
+ import { defaultOptions } from '../../Core/Defaults.js';
17
17
  import Exporting from './Exporting.js';
18
18
  import Globals from '../../Core/Globals.js';
19
19
  import U from '../../../Core/Utilities.js';
20
20
  const { addEvent, pushUnique } = U;
21
21
  /* *
22
22
  *
23
- * Class Namespace
23
+ * Composition
24
24
  *
25
25
  * */
26
- var ExportingComposition;
27
- (function (ExportingComposition) {
28
- /**
29
- * Extends the grid classes with exporting.
30
- *
31
- * @param GridClass
32
- * The class to extend.
33
- *
34
- */
35
- function compose(GridClass) {
36
- if (!pushUnique(Globals.composed, 'Exporting')) {
37
- return;
38
- }
39
- Defaults.defaultOptions.exporting = Exporting.defaultOptions;
40
- addEvent(GridClass, 'beforeLoad', initExporting);
41
- }
42
- ExportingComposition.compose = compose;
43
- /**
44
- * Init exporting
45
- */
46
- function initExporting() {
47
- this.exporting = new Exporting(this);
26
+ /**
27
+ * Extends the grid classes with exporting.
28
+ *
29
+ * @param GridClass
30
+ * The class to extend.
31
+ *
32
+ */
33
+ export function compose(GridClass) {
34
+ if (!pushUnique(Globals.composed, 'Exporting')) {
35
+ return;
48
36
  }
49
- })(ExportingComposition || (ExportingComposition = {}));
37
+ defaultOptions.exporting = Exporting.defaultOptions;
38
+ addEvent(GridClass, 'beforeLoad', initExporting);
39
+ }
40
+ /**
41
+ * Init exporting
42
+ */
43
+ function initExporting() {
44
+ this.exporting = new Exporting(this);
45
+ }
50
46
  /* *
51
47
  *
52
48
  * Default Export
53
49
  *
54
50
  * */
55
- export default ExportingComposition;
51
+ export default {
52
+ compose
53
+ };
@@ -12,7 +12,7 @@ export type ColumnEventCallback = (this: Column) => void;
12
12
  /**
13
13
  * Callback function to be called when a grid event is triggered.
14
14
  */
15
- export type GridEventCallback = (this: Grid) => void;
15
+ export type GridEventCallback = (this: Grid, e: AnyRecord) => void;
16
16
  /**
17
17
  * Events related to the cells.
18
18
  */
@@ -90,6 +90,24 @@ export interface GridEvents {
90
90
  * Callback function to be called after the grid is loaded.
91
91
  */
92
92
  afterLoad?: GridEventCallback;
93
+ /**
94
+ * Callback function to be called before the grid options are updated.
95
+ */
96
+ beforeUpdate?: GridEventCallback;
97
+ /**
98
+ * Callback function to be called after the grid options are updated.
99
+ */
100
+ afterUpdate?: GridEventCallback;
101
+ /**
102
+ * Callback function to be called before the grid is redrawn after an
103
+ * update.
104
+ */
105
+ beforeRedraw?: GridEventCallback;
106
+ /**
107
+ * Callback function to be called after the grid is redrawn after an
108
+ * update.
109
+ */
110
+ afterRedraw?: GridEventCallback;
93
111
  }
94
112
  declare module '../Core/Options' {
95
113
  interface Options {
@@ -54,11 +54,15 @@ function compose(GridClass, ColumnClass, HeaderCellClass, TableCellClass) {
54
54
  }
55
55
  [
56
56
  'beforeLoad',
57
- 'afterLoad'
57
+ 'afterLoad',
58
+ 'beforeUpdate',
59
+ 'afterUpdate',
60
+ 'beforeRedraw',
61
+ 'afterRedraw'
58
62
  ].forEach((name) => {
59
63
  addEvent(GridClass, name, (e) => {
60
64
  const grid = e.target;
61
- grid.options?.events?.[name]?.call(grid);
65
+ grid.options?.events?.[name]?.call(grid, e);
62
66
  });
63
67
  });
64
68
  [