@highcharts/grid-pro 2.0.1 → 2.1.1

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 +5 -4
  164. package/es-modules/Grid/Pro/ColumnTypes/ColumnDataType.d.ts +0 -29
@@ -1,8 +1,8 @@
1
1
  import type Toolbar from './Toolbar';
2
2
  import type Button from './Button';
3
3
  import type Popup from './Popup';
4
- import SvgIcons from './SvgIcons.js';
5
- import Globals from '../Globals.js';
4
+ import { GridIconName } from './SvgIcons.js';
5
+ import { ClassNameKey } from '../Globals.js';
6
6
  declare class ToolbarButton implements Button {
7
7
  /**
8
8
  * The wrapper element for the button.
@@ -37,7 +37,7 @@ declare class ToolbarButton implements Button {
37
37
  * The active indicator for the button.
38
38
  */
39
39
  private activeIndicator?;
40
- constructor(options: ToolbarButton.Options);
40
+ constructor(options: ToolbarButtonOptions);
41
41
  /**
42
42
  * Adds the button to the toolbar.
43
43
  *
@@ -53,17 +53,13 @@ declare class ToolbarButton implements Button {
53
53
  * @param icon
54
54
  * The icon to set.
55
55
  */
56
- setIcon(icon: SvgIcons.GridIconName): void;
56
+ setIcon(icon: GridIconName): void;
57
57
  setActive(active: boolean): void;
58
58
  setHighlighted(highlighted: boolean): void;
59
59
  /**
60
60
  * Destroys the button.
61
61
  */
62
62
  destroy(): void;
63
- /**
64
- * Initializes the state of the button.
65
- */
66
- protected refreshState(): void;
67
63
  /**
68
64
  * Handles the click event for the button.
69
65
  *
@@ -87,49 +83,47 @@ declare class ToolbarButton implements Button {
87
83
  */
88
84
  private removeEventListeners;
89
85
  }
90
- declare namespace ToolbarButton {
91
- /**
92
- * Options for the toolbar button.
93
- */
94
- interface Options {
95
- /**
96
- * The icon for the button.
97
- */
98
- icon: SvgIcons.GridIconName;
99
- /**
100
- * The class name key for the button.
101
- */
102
- classNameKey?: Globals.ClassNameKey;
103
- /**
104
- * The tooltip string for the button.
105
- */
106
- tooltip?: string;
107
- /**
108
- * Whether the button should be always visible.
109
- */
110
- alwaysVisible?: boolean;
111
- /**
112
- * The accessibility options for the button.
113
- */
114
- accessibility?: ToolbarButtonA11yOptions;
115
- /**
116
- * The click handler for the button.
117
- */
118
- onClick?: (event: MouseEvent, button: ToolbarButton) => void;
119
- }
120
- interface ToolbarButtonA11yOptions {
121
- /**
122
- * The aria label attribute for the button.
123
- */
124
- ariaLabel?: string;
125
- /**
126
- * The aria expanded attribute for the button.
127
- */
128
- ariaExpanded?: boolean;
129
- /**
130
- * The aria controls attribute for the button.
131
- */
132
- ariaControls?: string;
133
- }
86
+ /**
87
+ * Options for the toolbar button.
88
+ */
89
+ export interface ToolbarButtonOptions {
90
+ /**
91
+ * The icon for the button.
92
+ */
93
+ icon: GridIconName;
94
+ /**
95
+ * The class name key for the button.
96
+ */
97
+ classNameKey?: ClassNameKey;
98
+ /**
99
+ * The tooltip string for the button.
100
+ */
101
+ tooltip?: string;
102
+ /**
103
+ * Whether the button should be always visible.
104
+ */
105
+ alwaysVisible?: boolean;
106
+ /**
107
+ * The accessibility options for the button.
108
+ */
109
+ accessibility?: ToolbarButtonA11yOptions;
110
+ /**
111
+ * The click handler for the button.
112
+ */
113
+ onClick?: (event: MouseEvent, button: ToolbarButton) => void;
114
+ }
115
+ export interface ToolbarButtonA11yOptions {
116
+ /**
117
+ * The aria label attribute for the button.
118
+ */
119
+ ariaLabel?: string;
120
+ /**
121
+ * The aria expanded attribute for the button.
122
+ */
123
+ ariaExpanded?: boolean;
124
+ /**
125
+ * The aria controls attribute for the button.
126
+ */
127
+ ariaControls?: string;
134
128
  }
135
129
  export default ToolbarButton;
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * */
15
15
  'use strict';
16
- import SvgIcons from './SvgIcons.js';
16
+ import { createGridIcon } from './SvgIcons.js';
17
17
  import Globals from '../Globals.js';
18
18
  import GridUtils from '../GridUtils.js';
19
19
  const { makeHTMLElement } = GridUtils;
@@ -101,7 +101,7 @@ class ToolbarButton {
101
101
  */
102
102
  setIcon(icon) {
103
103
  this.icon?.remove();
104
- this.icon = SvgIcons.createGridIcon(icon);
104
+ this.icon = createGridIcon(icon);
105
105
  this.buttonEl?.appendChild(this.icon);
106
106
  }
107
107
  setActive(active) {
@@ -127,7 +127,8 @@ class ToolbarButton {
127
127
  delete this.toolbar;
128
128
  }
129
129
  /**
130
- * Initializes the state of the button.
130
+ * Refreshes the state of the button.
131
+ * @internal
131
132
  */
132
133
  refreshState() {
133
134
  // Do nothing, to be overridden by subclasses
@@ -69,12 +69,10 @@ declare class CellEditing {
69
69
  */
70
70
  private destroy;
71
71
  }
72
- declare namespace CellEditing {
73
- /**
74
- * The class names used by the CellEditing functionality.
75
- */
76
- const classNames: {
77
- readonly cellEditingContainer: string;
78
- };
79
- }
72
+ /**
73
+ * The class names used by the CellEditing functionality.
74
+ */
75
+ export declare const classNames: {
76
+ readonly cellEditingContainer: string;
77
+ };
80
78
  export default CellEditing;
@@ -163,8 +163,7 @@ class CellEditing {
163
163
  }
164
164
  this.containerElement = this.containerElement ||
165
165
  document.createElement('div');
166
- this.containerElement.className =
167
- CellEditing.classNames.cellEditingContainer;
166
+ this.containerElement.className = classNames.cellEditingContainer;
168
167
  this.editedCell?.htmlElement.appendChild(this.containerElement);
169
168
  this.editModeContent = cell.column.editModeRenderer?.render(cell, this.containerElement);
170
169
  this.editModeContent.getMainElement().focus();
@@ -192,17 +191,15 @@ class CellEditing {
192
191
  }
193
192
  /* *
194
193
  *
195
- * Namespace
194
+ * Declarations
196
195
  *
197
196
  * */
198
- (function (CellEditing) {
199
- /**
200
- * The class names used by the CellEditing functionality.
201
- */
202
- CellEditing.classNames = {
203
- cellEditingContainer: Globals.classNamePrefix + 'cell-editing-container'
204
- };
205
- })(CellEditing || (CellEditing = {}));
197
+ /**
198
+ * The class names used by the CellEditing functionality.
199
+ */
200
+ export const classNames = {
201
+ cellEditingContainer: Globals.classNamePrefix + 'cell-editing-container'
202
+ };
206
203
  /* *
207
204
  *
208
205
  * Default Export
@@ -1,6 +1,28 @@
1
1
  import type CellRendererType from '../CellRendering/CellRendererType';
2
+ import type Column from '../../Core/Table/Column';
3
+ import type { DeepPartial } from '../../../Shared/Types';
2
4
  import type { EditModeRenderer } from './CellEditMode';
5
+ import type Options from '../../Core/Options';
6
+ import type Table from '../../Core/Table/Table';
7
+ import type TableCell from '../../Core/Table/Body/TableCell';
3
8
  import CellEditing from './CellEditing.js';
9
+ /**
10
+ * Default options for the cell editing.
11
+ */
12
+ export declare const defaultOptions: DeepPartial<Options>;
13
+ /**
14
+ * Extends the grid classes with cell editing functionality.
15
+ *
16
+ * @param TableClass
17
+ * The class to extend.
18
+ *
19
+ * @param TableCellClass
20
+ * The class to extend.
21
+ *
22
+ * @param ColumnClass
23
+ * The class to extend.
24
+ */
25
+ export declare function compose(TableClass: typeof Table, TableCellClass: typeof TableCell, ColumnClass: typeof Column): void;
4
26
  export type EditModeRendererType = Extract<CellRendererType, EditModeRenderer>;
5
27
  export type EditModeRendererTypeName = EditModeRendererType['options']['type'];
6
28
  /**
@@ -120,4 +142,8 @@ declare module '../../Core/Options' {
120
142
  * The possible types of the edit message.
121
143
  */
122
144
  export type EditMsgType = 'started' | 'edited' | 'cancelled';
123
- export default CellEditingComposition;
145
+ declare const _default: {
146
+ compose: typeof compose;
147
+ defaultOptions: DeepPartial<Options>;
148
+ };
149
+ export default _default;
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * */
16
16
  'use strict';
17
- import Defaults from '../../Core/Defaults.js';
17
+ import { defaultOptions as gridDefaultOptions } from '../../Core/Defaults.js';
18
18
  import Globals from '../../Core/Globals.js';
19
19
  import CellEditing from './CellEditing.js';
20
20
  import CellRendererRegistry from '../CellRendering/CellRendererRegistry.js';
@@ -28,171 +28,171 @@ const { addEvent, merge, pushUnique } = U;
28
28
  *
29
29
  * */
30
30
  /**
31
- * @internal
31
+ * Default options for the cell editing.
32
32
  */
33
- var CellEditingComposition;
34
- (function (CellEditingComposition) {
35
- /**
36
- * Default options for the cell editing.
37
- */
38
- const defaultOptions = {
33
+ export const defaultOptions = {
34
+ accessibility: {
35
+ announcements: {
36
+ cellEditing: true
37
+ }
38
+ },
39
+ lang: {
39
40
  accessibility: {
40
- announcements: {
41
- cellEditing: true
42
- }
43
- },
44
- lang: {
45
- accessibility: {
46
- cellEditing: {
47
- editable: 'Editable.',
48
- announcements: {
49
- started: 'Entered cell editing mode.',
50
- edited: 'Edited cell value.',
51
- cancelled: 'Editing canceled.',
52
- notValid: 'Provided value is not valid.'
53
- }
41
+ cellEditing: {
42
+ editable: 'Editable.',
43
+ announcements: {
44
+ started: 'Entered cell editing mode.',
45
+ edited: 'Edited cell value.',
46
+ cancelled: 'Editing canceled.',
47
+ notValid: 'Provided value is not valid.'
54
48
  }
55
49
  }
56
50
  }
57
- };
58
- /**
59
- * Extends the grid classes with cell editing functionality.
60
- *
61
- * @param TableClass
62
- * The class to extend.
63
- *
64
- * @param TableCellClass
65
- * The class to extend.
66
- *
67
- * @param ColumnClass
68
- * The class to extend.
69
- */
70
- function compose(TableClass, TableCellClass, ColumnClass) {
71
- if (!pushUnique(Globals.composed, 'CellEditing')) {
72
- return;
73
- }
74
- merge(true, Defaults.defaultOptions, defaultOptions);
75
- addEvent(ColumnClass, 'afterInit', afterColumnInit);
76
- addEvent(TableClass, 'beforeInit', initTable);
77
- addEvent(TableCellClass, 'keyDown', onCellKeyDown);
78
- addEvent(TableCellClass, 'dblClick', onCellDblClick);
79
- addEvent(TableCellClass, 'afterRender', addEditableCellA11yHint);
80
- addEvent(TableCellClass, 'startedEditing', function () {
81
- announceA11yUserEditedCell(this, 'started');
82
- });
83
- addEvent(TableCellClass, 'stoppedEditing', function (e) {
84
- if (e.submit) {
85
- this.column.options.cells?.events?.afterEdit?.call(this);
86
- }
87
- announceA11yUserEditedCell(this, e.submit ? 'edited' : 'cancelled');
88
- });
89
51
  }
90
- CellEditingComposition.compose = compose;
91
- /**
92
- * Callback function called before table initialization.
93
- */
94
- function initTable() {
95
- this.cellEditing = new CellEditing(this);
52
+ };
53
+ /**
54
+ * Extends the grid classes with cell editing functionality.
55
+ *
56
+ * @param TableClass
57
+ * The class to extend.
58
+ *
59
+ * @param TableCellClass
60
+ * The class to extend.
61
+ *
62
+ * @param ColumnClass
63
+ * The class to extend.
64
+ */
65
+ export function compose(TableClass, TableCellClass, ColumnClass) {
66
+ if (!pushUnique(Globals.composed, 'CellEditing')) {
67
+ return;
96
68
  }
97
- /**
98
- * Creates the edit mode renderer for the column.
99
- *
100
- * @param column
101
- * The column to create the edit mode renderer for.
102
- */
103
- function createEditModeRenderer(column) {
104
- const editModeOptions = column.options.cells?.editMode;
105
- const selectedEditModeRendererTypeName = editModeOptions?.renderer?.type;
106
- const viewRendererTypeName = column.options?.cells?.renderer?.type || 'text';
107
- if (selectedEditModeRendererTypeName) {
108
- return new CellRendererRegistry.types[selectedEditModeRendererTypeName](column, editModeOptions?.renderer || {});
109
- }
110
- const ViewRendererType = CellRendererRegistry.types[viewRendererTypeName] ||
111
- CellRendererRegistry.types.text;
112
- let editModeRendererTypeName = ViewRendererType.defaultEditingRenderer;
113
- if (typeof editModeRendererTypeName !== 'string') {
114
- editModeRendererTypeName =
115
- editModeRendererTypeName[column.dataType] || 'textInput';
69
+ merge(true, gridDefaultOptions, defaultOptions);
70
+ addEvent(ColumnClass, 'afterInit', afterColumnInit);
71
+ addEvent(TableClass, 'beforeInit', initTable);
72
+ addEvent(TableCellClass, 'keyDown', onCellKeyDown);
73
+ addEvent(TableCellClass, 'dblClick', onCellDblClick);
74
+ addEvent(TableCellClass, 'afterRender', addEditableCellA11yHint);
75
+ addEvent(TableCellClass, 'startedEditing', function () {
76
+ announceA11yUserEditedCell(this, 'started');
77
+ });
78
+ addEvent(TableCellClass, 'stoppedEditing', function (e) {
79
+ if (e.submit) {
80
+ this.column.options.cells?.events?.afterEdit?.call(this);
116
81
  }
117
- return new CellRendererRegistry.types[editModeRendererTypeName](column, editModeRendererTypeName === viewRendererTypeName ? merge(column.options.cells?.renderer, { disabled: false }) || {} : {});
82
+ announceA11yUserEditedCell(this, e.submit ? 'edited' : 'cancelled');
83
+ });
84
+ addEvent(TableCellClass, 'afterEditValue', function () {
85
+ this.column.options.cells?.events?.afterEdit?.call(this);
86
+ announceA11yUserEditedCell(this, 'edited');
87
+ });
88
+ }
89
+ /**
90
+ * Callback function called before table initialization.
91
+ */
92
+ function initTable() {
93
+ this.cellEditing = new CellEditing(this);
94
+ }
95
+ /**
96
+ * Creates the edit mode renderer for the column.
97
+ *
98
+ * @param column
99
+ * The column to create the edit mode renderer for.
100
+ */
101
+ function createEditModeRenderer(column) {
102
+ const editModeOptions = column.options.cells?.editMode;
103
+ const selectedEditModeRendererTypeName = editModeOptions?.renderer?.type;
104
+ const viewRendererTypeName = column.options?.cells?.renderer?.type || 'text';
105
+ if (selectedEditModeRendererTypeName) {
106
+ return new CellRendererRegistry.types[selectedEditModeRendererTypeName](column, editModeOptions?.renderer || {});
118
107
  }
119
- /**
120
- * Callback function called after column initialization.
121
- */
122
- function afterColumnInit() {
123
- const { options } = this;
124
- if (options?.cells?.editMode?.enabled) {
125
- this.editModeRenderer = createEditModeRenderer(this);
126
- }
108
+ const ViewRendererType = CellRendererRegistry.types[viewRendererTypeName] ||
109
+ CellRendererRegistry.types.text;
110
+ let editModeRendererTypeName = ViewRendererType.defaultEditingRenderer;
111
+ if (typeof editModeRendererTypeName !== 'string') {
112
+ editModeRendererTypeName =
113
+ editModeRendererTypeName[column.dataType] || 'textInput';
127
114
  }
128
- /**
129
- * Callback function called when a key is pressed on a cell.
130
- *
131
- * @param e
132
- * The event object.
133
- */
134
- function onCellKeyDown(e) {
135
- if (e.originalEvent?.key !== 'Enter' ||
136
- !this.column.editModeRenderer) {
137
- return;
138
- }
115
+ return new CellRendererRegistry.types[editModeRendererTypeName](column, editModeRendererTypeName === viewRendererTypeName ? merge(column.options.cells?.renderer, { disabled: false }) || {} : {});
116
+ }
117
+ /**
118
+ * Callback function called after column initialization.
119
+ */
120
+ function afterColumnInit() {
121
+ const { options } = this;
122
+ if (options?.cells?.editMode?.enabled) {
123
+ this.editModeRenderer = createEditModeRenderer(this);
124
+ }
125
+ }
126
+ /**
127
+ * Callback function called when a key is pressed on a cell.
128
+ *
129
+ * @param e
130
+ * The event object.
131
+ */
132
+ function onCellKeyDown(e) {
133
+ if (e.originalEvent?.key !== 'Enter' ||
134
+ !this.column.editModeRenderer) {
135
+ return;
136
+ }
137
+ this.row.viewport.cellEditing?.startEditing(this);
138
+ }
139
+ /**
140
+ * Callback function called when a cell is double clicked.
141
+ */
142
+ function onCellDblClick() {
143
+ if (this.column.editModeRenderer) {
139
144
  this.row.viewport.cellEditing?.startEditing(this);
140
145
  }
141
- /**
142
- * Callback function called when a cell is double clicked.
143
- */
144
- function onCellDblClick() {
145
- if (this.column.editModeRenderer) {
146
- this.row.viewport.cellEditing?.startEditing(this);
147
- }
146
+ }
147
+ /**
148
+ * Add the 'editable' hint span element for the editable cell.
149
+ */
150
+ function addEditableCellA11yHint() {
151
+ const a11y = this.row.viewport.grid.accessibility;
152
+ if (!a11y || this.a11yEditableHint?.isConnected) {
153
+ return;
148
154
  }
149
- /**
150
- * Add the 'editable' hint span element for the editable cell.
151
- */
152
- function addEditableCellA11yHint() {
153
- const a11y = this.row.viewport.grid.accessibility;
154
- if (!a11y || this.a11yEditableHint?.isConnected) {
155
- return;
156
- }
157
- const editableLang = this.row.viewport.grid.options
158
- ?.lang?.accessibility?.cellEditing?.editable;
159
- if (!this.column.options.cells?.editMode?.enabled || !editableLang) {
160
- return;
161
- }
162
- this.a11yEditableHint = makeHTMLElement('span', {
163
- className: Globals.getClassName('visuallyHidden'),
164
- innerText: ', ' + editableLang
165
- }, this.htmlElement);
155
+ const editableLang = this.row.viewport.grid.options
156
+ ?.lang?.accessibility?.cellEditing?.editable;
157
+ if (!this.column.options.cells?.editMode?.enabled || !editableLang) {
158
+ return;
166
159
  }
167
- /**
168
- * Announce that the cell editing started.
169
- *
170
- * @param cell
171
- * The cell that is being edited.
172
- *
173
- * @param msgType
174
- * The type of the message.
175
- */
176
- function announceA11yUserEditedCell(cell, msgType) {
177
- const a11y = cell.row.viewport.grid.accessibility;
178
- if (!a11y) {
179
- return;
180
- }
181
- const { options } = a11y.grid;
182
- if (!options?.accessibility?.announcements?.cellEditing) {
183
- return;
184
- }
185
- const lang = options?.lang?.accessibility?.cellEditing?.announcements;
186
- const msg = lang?.[msgType];
187
- if (!msg) {
188
- return;
189
- }
190
- a11y.announce(msg);
160
+ this.a11yEditableHint = makeHTMLElement('span', {
161
+ className: Globals.getClassName('visuallyHidden'),
162
+ innerText: ', ' + editableLang
163
+ }, this.htmlElement);
164
+ }
165
+ /**
166
+ * Announce that the cell editing started.
167
+ *
168
+ * @param cell
169
+ * The cell that is being edited.
170
+ *
171
+ * @param msgType
172
+ * The type of the message.
173
+ */
174
+ function announceA11yUserEditedCell(cell, msgType) {
175
+ const a11y = cell.row.viewport.grid.accessibility;
176
+ if (!a11y) {
177
+ return;
178
+ }
179
+ const { options } = a11y.grid;
180
+ if (!options?.accessibility?.announcements?.cellEditing) {
181
+ return;
182
+ }
183
+ const lang = options?.lang?.accessibility?.cellEditing?.announcements;
184
+ const msg = lang?.[msgType];
185
+ if (!msg) {
186
+ return;
191
187
  }
192
- })(CellEditingComposition || (CellEditingComposition = {}));
188
+ a11y.announce(msg);
189
+ }
193
190
  /* *
194
191
  *
195
192
  * Default Export
196
193
  *
197
194
  * */
198
- export default CellEditingComposition;
195
+ export default {
196
+ compose,
197
+ defaultOptions
198
+ };
@@ -4,11 +4,11 @@ import type CellContent from '../../Core/Table/CellContent/CellContent';
4
4
  /**
5
5
  * Renderer class that initialize all options per column.
6
6
  */
7
- declare abstract class CellRenderer {
7
+ export declare abstract class CellRenderer {
8
8
  /**
9
9
  * Options to control the renderer content.
10
10
  */
11
- abstract options: CellRenderer.Options;
11
+ abstract options: CellRendererOptions;
12
12
  /**
13
13
  * The column to which the specific renderer belongs.
14
14
  */
@@ -26,25 +26,23 @@ declare abstract class CellRenderer {
26
26
  */
27
27
  abstract render(cell: TableCell): CellContent;
28
28
  }
29
- declare namespace CellRenderer {
29
+ /**
30
+ * Options to control the renderer content.
31
+ */
32
+ export interface CellRendererOptions {
30
33
  /**
31
- * Options to control the renderer content.
34
+ * The cell content type.
35
+ *
36
+ * Can be one of the following: `'text'`, `'checkbox'`, `'select'`,
37
+ * `'textInput'`, `'dateInput'`, `'dateTimeInput'`, `'timeInput'`,
38
+ * `'numberInput'`, `'sparkline'`.
39
+ *
40
+ * You can also create your own custom renderer by extending the
41
+ * `CellRenderer` class and registering it in the
42
+ * `CellRendererTypeRegistry`.
43
+ *
44
+ * @default 'text'
32
45
  */
33
- interface Options {
34
- /**
35
- * The cell content type.
36
- *
37
- * Can be one of the following: `'text'`, `'checkbox'`, `'select'`,
38
- * `'textInput'`, `'dateInput'`, `'dateTimeInput'`, `'timeInput'`,
39
- * `'numberInput'`, `'sparkline'`.
40
- *
41
- * You can also create your own custom renderer by extending the
42
- * `CellRenderer` class and registering it in the
43
- * `CellRendererTypeRegistry`.
44
- *
45
- * @default 'text'
46
- */
47
- type: string;
48
- }
46
+ type: string;
49
47
  }
50
48
  export default CellRenderer;
@@ -21,7 +21,7 @@
21
21
  /**
22
22
  * Renderer class that initialize all options per column.
23
23
  */
24
- class CellRenderer {
24
+ export class CellRenderer {
25
25
  /**
26
26
  * Constructs the CellRenderer instance.
27
27
  *