@highcharts/grid-pro 2.0.1 → 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 (164) hide show
  1. package/css/grid-pro.css +69 -85
  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/Color/ColorString.d.ts +25 -0
  6. package/es-modules/Core/Color/ColorType.d.ts +43 -0
  7. package/es-modules/Core/Color/GradientColor.d.ts +57 -0
  8. package/es-modules/Core/Globals.js +1 -1
  9. package/es-modules/Core/Renderer/AlignObject.d.ts +37 -0
  10. package/es-modules/Core/Renderer/BBoxObject.d.ts +40 -0
  11. package/es-modules/Core/Renderer/CSSObject.d.ts +130 -0
  12. package/es-modules/Core/Renderer/DOMElementType.d.ts +36 -0
  13. package/es-modules/Core/Renderer/DashStyleValue.d.ts +28 -0
  14. package/es-modules/Core/Renderer/FontMetricsObject.d.ts +38 -0
  15. package/es-modules/Core/Renderer/HTML/HTMLAttributes.d.ts +57 -0
  16. package/es-modules/Core/Renderer/PolygonBoxObject.d.ts +19 -0
  17. package/es-modules/Core/Renderer/Position3DObject.d.ts +35 -0
  18. package/es-modules/Core/Renderer/PositionObject.d.ts +28 -0
  19. package/es-modules/Core/Renderer/RectangleObject.d.ts +35 -0
  20. package/es-modules/Core/Renderer/RendererType.d.ts +53 -0
  21. package/es-modules/Core/Renderer/SVG/ButtonThemeObject.d.ts +43 -0
  22. package/es-modules/Core/Renderer/SVG/SVGArc3D.d.ts +44 -0
  23. package/es-modules/Core/Renderer/SVG/SVGAttributes.d.ts +147 -0
  24. package/es-modules/Core/Renderer/SVG/SVGAttributes3D.d.ts +42 -0
  25. package/es-modules/Core/Renderer/SVG/SVGCuboid.d.ts +42 -0
  26. package/es-modules/Core/Renderer/SVG/SVGElementBase.d.ts +31 -0
  27. package/es-modules/Core/Renderer/SVG/SVGPath.d.ts +97 -0
  28. package/es-modules/Core/Renderer/SVG/SVGPath3D.d.ts +40 -0
  29. package/es-modules/Core/Renderer/SVG/SVGRendererBase.d.ts +31 -0
  30. package/es-modules/Core/Renderer/SVG/SymbolOptions.d.ts +41 -0
  31. package/es-modules/Core/Renderer/SVG/SymbolType.d.ts +50 -0
  32. package/es-modules/Core/Renderer/ShadowOptionsObject.d.ts +40 -0
  33. package/es-modules/Core/Renderer/SizeObject.d.ts +28 -0
  34. package/es-modules/Core/Templating.js +6 -7
  35. package/es-modules/Data/Connectors/DataConnector.js +3 -2
  36. package/es-modules/Data/Connectors/DataConnectorOptions.d.ts +1 -1
  37. package/es-modules/Data/DataTable.d.ts +1 -1
  38. package/es-modules/Data/DataTable.js +3 -2
  39. package/es-modules/Data/DataTableCore.js +15 -6
  40. package/es-modules/Grid/Core/Accessibility/Accessibility.d.ts +13 -15
  41. package/es-modules/Grid/Core/Credits.d.ts +0 -2
  42. package/es-modules/Grid/Core/Defaults.d.ts +20 -17
  43. package/es-modules/Grid/Core/Defaults.js +116 -114
  44. package/es-modules/Grid/Core/Globals.d.ts +108 -32
  45. package/es-modules/Grid/Core/Globals.js +98 -111
  46. package/es-modules/Grid/Core/Grid.d.ts +51 -17
  47. package/es-modules/Grid/Core/Grid.js +369 -79
  48. package/es-modules/Grid/Core/GridUtils.d.ts +96 -89
  49. package/es-modules/Grid/Core/GridUtils.js +143 -155
  50. package/es-modules/Grid/Core/Options.d.ts +3 -7
  51. package/es-modules/Grid/Core/Pagination/Icons.d.ts +4 -4
  52. package/es-modules/Grid/Core/Pagination/Pagination.d.ts +32 -57
  53. package/es-modules/Grid/Core/Pagination/Pagination.js +206 -214
  54. package/es-modules/Grid/Core/Pagination/PaginationOptions.d.ts +22 -15
  55. package/es-modules/Grid/Core/Querying/PaginationController.d.ts +32 -9
  56. package/es-modules/Grid/Core/Querying/PaginationController.js +58 -18
  57. package/es-modules/Grid/Core/Querying/SortingController.d.ts +7 -15
  58. package/es-modules/Grid/Core/Querying/SortingController.js +2 -3
  59. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.d.ts +1 -1
  60. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.js +32 -4
  61. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilteringTypes.d.ts +3 -3
  62. package/es-modules/Grid/Core/Table/Actions/ColumnSorting.d.ts +3 -5
  63. package/es-modules/Grid/Core/Table/Actions/ColumnSorting.js +1 -5
  64. package/es-modules/Grid/Core/Table/Body/TableCell.d.ts +14 -10
  65. package/es-modules/Grid/Core/Table/Body/TableCell.js +19 -21
  66. package/es-modules/Grid/Core/Table/Body/TableRow.d.ts +0 -2
  67. package/es-modules/Grid/Core/Table/Cell.js +30 -0
  68. package/es-modules/Grid/Core/Table/CellContent/TextContent.d.ts +2 -7
  69. package/es-modules/Grid/Core/Table/CellContent/TextContent.js +25 -14
  70. package/es-modules/Grid/Core/Table/Column.d.ts +7 -9
  71. package/es-modules/Grid/Core/Table/Column.js +23 -1
  72. package/es-modules/Grid/Core/Table/ColumnResizing/AdjacentResizingMode.js +2 -2
  73. package/es-modules/Grid/Core/Table/ColumnResizing/ColumnResizing.d.ts +30 -23
  74. package/es-modules/Grid/Core/Table/ColumnResizing/ColumnResizing.js +39 -39
  75. package/es-modules/Grid/Core/Table/ColumnResizing/DistributedResizingMode.js +1 -1
  76. package/es-modules/Grid/Core/Table/ColumnResizing/IndependentResizingMode.js +2 -2
  77. package/es-modules/Grid/Core/Table/ColumnResizing/ResizingMode.d.ts +6 -1
  78. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.js +10 -0
  79. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/FilterPopup.d.ts +2 -2
  80. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/StateHelpers.d.ts +26 -24
  81. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/StateHelpers.js +37 -39
  82. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/FilterToolbarButton.d.ts +1 -1
  83. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/MenuToolbarButton.d.ts +1 -1
  84. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.d.ts +1 -1
  85. package/es-modules/Grid/Core/Table/Header/HeaderRow.d.ts +0 -2
  86. package/es-modules/Grid/Core/Table/Header/TableHeader.d.ts +0 -2
  87. package/es-modules/Grid/Core/Table/Table.d.ts +11 -13
  88. package/es-modules/Grid/Core/Table/Table.js +9 -5
  89. package/es-modules/Grid/Core/UI/Button.d.ts +1 -1
  90. package/es-modules/Grid/Core/UI/ContextMenu.d.ts +1 -1
  91. package/es-modules/Grid/Core/UI/ContextMenu.js +1 -1
  92. package/es-modules/Grid/Core/UI/ContextMenuButton.d.ts +39 -44
  93. package/es-modules/Grid/Core/UI/ContextMenuButton.js +4 -4
  94. package/es-modules/Grid/Core/UI/Popup.d.ts +17 -19
  95. package/es-modules/Grid/Core/UI/Popup.js +2 -1
  96. package/es-modules/Grid/Core/UI/SvgIcons.d.ts +49 -50
  97. package/es-modules/Grid/Core/UI/SvgIcons.js +114 -123
  98. package/es-modules/Grid/Core/UI/ToolbarButton.d.ts +46 -52
  99. package/es-modules/Grid/Core/UI/ToolbarButton.js +4 -3
  100. package/es-modules/Grid/Pro/CellEditing/CellEditing.d.ts +6 -8
  101. package/es-modules/Grid/Pro/CellEditing/CellEditing.js +8 -11
  102. package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.d.ts +27 -1
  103. package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.js +149 -149
  104. package/es-modules/Grid/Pro/CellRendering/CellRenderer.d.ts +18 -20
  105. package/es-modules/Grid/Pro/CellRendering/CellRenderer.js +1 -1
  106. package/es-modules/Grid/Pro/CellRendering/CellRendererRegistry.d.ts +19 -17
  107. package/es-modules/Grid/Pro/CellRendering/CellRendererRegistry.js +28 -34
  108. package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.d.ts +12 -1
  109. package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.js +41 -46
  110. package/es-modules/Grid/Pro/CellRendering/ContentTypes/CheckboxContent.js +2 -2
  111. package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContent.d.ts +2 -2
  112. package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContentBase.d.ts +2 -2
  113. package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContentBase.js +4 -2
  114. package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateTimeInputContent.d.ts +2 -2
  115. package/es-modules/Grid/Pro/CellRendering/ContentTypes/NumberInputContent.js +3 -1
  116. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SelectContent.js +3 -1
  117. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.d.ts +19 -8
  118. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.js +17 -13
  119. package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.js +3 -1
  120. package/es-modules/Grid/Pro/CellRendering/ContentTypes/TimeInputContent.d.ts +2 -2
  121. package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.d.ts +18 -20
  122. package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.js +3 -3
  123. package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.d.ts +10 -12
  124. package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.js +3 -3
  125. package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRendererBase.d.ts +17 -20
  126. package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.d.ts +10 -12
  127. package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.js +3 -3
  128. package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.d.ts +20 -22
  129. package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.js +3 -3
  130. package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.d.ts +40 -42
  131. package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.js +3 -3
  132. package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.d.ts +16 -18
  133. package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.js +14 -22
  134. package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.d.ts +22 -24
  135. package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.js +3 -3
  136. package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.d.ts +10 -12
  137. package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.js +3 -3
  138. package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.d.ts +10 -12
  139. package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.js +3 -3
  140. package/es-modules/Grid/Pro/ColumnTypes/Validator.d.ts +46 -51
  141. package/es-modules/Grid/Pro/ColumnTypes/Validator.js +62 -77
  142. package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.d.ts +16 -3
  143. package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.js +26 -31
  144. package/es-modules/Grid/Pro/Credits/CreditsPro.d.ts +0 -2
  145. package/es-modules/Grid/Pro/Credits/CreditsProComposition.d.ts +12 -11
  146. package/es-modules/Grid/Pro/Credits/CreditsProComposition.js +29 -31
  147. package/es-modules/Grid/Pro/Export/Exporting.d.ts +3 -3
  148. package/es-modules/Grid/Pro/Export/Exporting.js +35 -29
  149. package/es-modules/Grid/Pro/Export/ExportingComposition.d.ts +12 -11
  150. package/es-modules/Grid/Pro/Export/ExportingComposition.js +24 -26
  151. package/es-modules/Grid/Pro/GridEvents.d.ts +19 -1
  152. package/es-modules/Grid/Pro/GridEvents.js +6 -2
  153. package/es-modules/Grid/Pro/Pagination/PaginationComposition.d.ts +4 -11
  154. package/es-modules/Grid/Pro/Pagination/PaginationComposition.js +44 -45
  155. package/es-modules/Grid/index.d.ts +1 -0
  156. package/es-modules/masters/grid-pro.src.d.ts +62 -37
  157. package/es-modules/masters/grid-pro.src.js +37 -39
  158. package/grid-pro.d.ts +122 -48
  159. package/grid-pro.js +3 -6
  160. package/grid-pro.js.map +1 -1
  161. package/grid-pro.src.d.ts +122 -48
  162. package/grid-pro.src.js +6645 -6270
  163. package/package.json +13 -4
  164. package/es-modules/Grid/Pro/ColumnTypes/ColumnDataType.d.ts +0 -29
@@ -1,4 +1,4 @@
1
- import type Column from '../../Core/Table/Column';
1
+ import type { ColumnDataType } from '../../Core/Table/Column';
2
2
  import type { EditModeContent } from '../CellEditing/CellEditMode';
3
3
  import type Table from '../../Core/Table/Table';
4
4
  import type TableCell from '../../Core/Table/Body/TableCell';
@@ -7,6 +7,23 @@ import Cell from '../../Core/Table/Cell.js';
7
7
  * Class for validating cell content.
8
8
  */
9
9
  declare class Validator {
10
+ /**
11
+ * The class names used by the validator functionality.
12
+ */
13
+ static readonly classNames: {
14
+ readonly notifContainer: string;
15
+ readonly notifError: string;
16
+ readonly notifAnimation: string;
17
+ readonly editedCellError: string;
18
+ };
19
+ /**
20
+ * Definition of default validation rules.
21
+ */
22
+ static readonly rulesRegistry: RulesRegistryType;
23
+ /**
24
+ * Default validation rules for each dataType.
25
+ */
26
+ static readonly predefinedRules: Record<ColumnDataType, RuleKey[]>;
10
27
  viewport: Table;
11
28
  /**
12
29
  * The cell that has an error.
@@ -63,56 +80,34 @@ declare class Validator {
63
80
  destroy(): void;
64
81
  }
65
82
  /**
66
- * Namespace for Validation functionality.
83
+ * Callback function that checks if field is valid.
67
84
  */
68
- declare namespace Validator {
69
- /**
70
- * The class names used by the validator functionality.
71
- */
72
- const classNames: {
73
- readonly notifContainer: string;
74
- readonly notifError: string;
75
- readonly notifAnimation: string;
76
- readonly editedCellError: string;
77
- };
78
- /**
79
- * Callback function that checks if field is valid.
80
- */
81
- type ValidateFunction = (this: TableCell, content: EditModeContent) => boolean;
82
- /**
83
- * Callback function that returns a error message.
84
- */
85
- type ValidationErrorFunction = (this: TableCell, content?: EditModeContent) => string;
86
- /**
87
- * Definition of the validation rule that should container validate method
88
- * and error message displayed in notification.
89
- */
90
- interface RuleDefinition {
91
- validate: RulesRegistryType | ValidateFunction;
92
- notification: string | ValidationErrorFunction;
93
- }
94
- /**
95
- * Definition of default validation rules.
96
- */
97
- interface RulesRegistryType {
98
- boolean: RuleDefinition;
99
- datetime: RuleDefinition;
100
- notEmpty: RuleDefinition;
101
- number: RuleDefinition;
102
- ignoreCaseUnique: RuleDefinition;
103
- unique: RuleDefinition;
104
- }
105
- /**
106
- * Type of rule: `notEmpty`, `number` or `boolean`.
107
- */
108
- type RuleKey = keyof RulesRegistryType;
109
- /**
110
- * Definition of default validation rules.
111
- */
112
- const rulesRegistry: RulesRegistryType;
113
- /**
114
- * Default validation rules for each dataType.
115
- */
116
- const predefinedRules: Record<Column.DataType, RuleKey[]>;
85
+ export type ValidateFunction = (this: TableCell, content: EditModeContent) => boolean;
86
+ /**
87
+ * Callback function that returns a error message.
88
+ */
89
+ export type ValidationErrorFunction = (this: TableCell, content?: EditModeContent) => string;
90
+ /**
91
+ * Definition of the validation rule that should container validate method
92
+ * and error message displayed in notification.
93
+ */
94
+ export interface RuleDefinition {
95
+ validate: RulesRegistryType | ValidateFunction;
96
+ notification: string | ValidationErrorFunction;
117
97
  }
98
+ /**
99
+ * Definition of default validation rules.
100
+ */
101
+ export interface RulesRegistryType {
102
+ boolean: RuleDefinition;
103
+ datetime: RuleDefinition;
104
+ notEmpty: RuleDefinition;
105
+ number: RuleDefinition;
106
+ ignoreCaseUnique: RuleDefinition;
107
+ unique: RuleDefinition;
108
+ }
109
+ /**
110
+ * Type of rule: `notEmpty`, `number` or `boolean`.
111
+ */
112
+ export type RuleKey = keyof RulesRegistryType;
118
113
  export default Validator;
@@ -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;