@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
@@ -30,7 +30,7 @@ export interface PageSizeSelectorOptions {
30
30
  *
31
31
  * @default [10, 20, 50, 100]
32
32
  */
33
- options: Array<number>;
33
+ options?: Array<number>;
34
34
  }
35
35
 
36
36
  /**
@@ -44,7 +44,7 @@ export interface PaginationControlsOptions {
44
44
  *
45
45
  * @default { enabled: true, options: [10, 20, 50, 100] }
46
46
  */
47
- pageSizeSelector: boolean | PageSizeSelectorOptions;
47
+ pageSizeSelector?: boolean | PageSizeSelectorOptions;
48
48
 
49
49
  /**
50
50
  * Whether to show the page information text
@@ -73,7 +73,7 @@ export interface PaginationControlsOptions {
73
73
  *
74
74
  * @default { enabled: true, count: 5 }
75
75
  */
76
- pageButtons: boolean | PageButtonsOptions;
76
+ pageButtons?: boolean | PageButtonsOptions;
77
77
  }
78
78
 
79
79
  /**
@@ -86,42 +86,42 @@ export interface PaginationLangOptions {
86
86
  *
87
87
  * @default "Showing {start} - {end} of {total} (Page {currentPage} of {totalPages})" // eslint-disable-line
88
88
  */
89
- pageInfo: string;
89
+ pageInfo?: string;
90
90
 
91
91
  /**
92
92
  * Text for the page size label.
93
93
  *
94
94
  * @default "rows per page"
95
95
  */
96
- pageSizeLabel: string;
96
+ pageSizeLabel?: string;
97
97
 
98
98
  /**
99
99
  * Text for the first page button (accessibility).
100
100
  *
101
101
  * @default "First page"
102
102
  */
103
- firstPage: string;
103
+ firstPage?: string;
104
104
 
105
105
  /**
106
106
  * Text for the previous page button (accessibility).
107
107
  *
108
108
  * @default "Previous page"
109
109
  */
110
- previousPage: string;
110
+ previousPage?: string;
111
111
 
112
112
  /**
113
113
  * Text for the next page button (accessibility).
114
114
  *
115
115
  * @default "Next page"
116
116
  */
117
- nextPage: string;
117
+ nextPage?: string;
118
118
 
119
119
  /**
120
120
  * Text for the last page button (accessibility).
121
121
  *
122
122
  * @default "Last page"
123
123
  */
124
- lastPage: string;
124
+ lastPage?: string;
125
125
 
126
126
  /**
127
127
  * Text for page number button (accessibility).
@@ -129,14 +129,14 @@ export interface PaginationLangOptions {
129
129
  *
130
130
  * @default "Page {page}"
131
131
  */
132
- pageNumber: string;
132
+ pageNumber?: string;
133
133
 
134
134
  /**
135
135
  * Text for ellipsis (accessibility).
136
136
  *
137
137
  * @default "More pages"
138
138
  */
139
- ellipsis: string;
139
+ ellipsis?: string;
140
140
  }
141
141
 
142
142
  /**
@@ -148,7 +148,14 @@ export interface PaginationOptions {
148
148
  *
149
149
  * @default false
150
150
  */
151
- enabled: boolean;
151
+ enabled?: boolean;
152
+
153
+ /**
154
+ * The current page number.
155
+ *
156
+ * @default 1
157
+ */
158
+ page?: number;
152
159
 
153
160
  /**
154
161
  * Initial number of items per page when the Grid is initialized.
@@ -157,7 +164,7 @@ export interface PaginationOptions {
157
164
  *
158
165
  * @default 10
159
166
  */
160
- pageSize: number;
167
+ pageSize?: number;
161
168
 
162
169
  /**
163
170
  * Position of the pagination container relative to the table.
@@ -169,7 +176,7 @@ export interface PaginationOptions {
169
176
  /**
170
177
  * Controls options for pagination UI elements.
171
178
  */
172
- controls: PaginationControlsOptions;
179
+ controls?: PaginationControlsOptions;
173
180
  }
174
181
 
175
182
  /**
@@ -188,7 +195,7 @@ export interface PageButtonsOptions {
188
195
  *
189
196
  * @default 5
190
197
  */
191
- count: number;
198
+ count?: number;
192
199
  }
193
200
 
194
201
  /**
@@ -9,13 +9,21 @@ declare class PaginationController {
9
9
  */
10
10
  private querying;
11
11
  /**
12
- * The current page.
12
+ * Whether the pagination is enabled.
13
+ */
14
+ enabled: boolean;
15
+ /**
16
+ * The current page (1-based index).
17
+ */
18
+ currentPage: number;
19
+ /**
20
+ * The current page size.
13
21
  */
14
- currentPage?: number;
22
+ currentPageSize: number;
15
23
  /**
16
24
  * The number of rows before pagination.
17
25
  */
18
- totalItems?: number;
26
+ private _totalItems?;
19
27
  /**
20
28
  * Constructs the PaginationController instance.
21
29
  *
@@ -24,12 +32,31 @@ declare class PaginationController {
24
32
  */
25
33
  constructor(querying: QueryingController);
26
34
  /**
27
- * Sets the range options.
35
+ * Total number of items (rows)
36
+ */
37
+ get totalItems(): number;
38
+ /**
39
+ * Gets the total number of pages.
40
+ */
41
+ get totalPages(): number;
42
+ /**
43
+ * Clamps the current page to the total number of pages.
44
+ */
45
+ clampPage(): void;
46
+ /**
47
+ * Sets the page.
28
48
  *
29
49
  * @param currentPage
30
50
  * The current page.
31
51
  */
32
- setRange(currentPage: number): void;
52
+ setPage(currentPage: number): void;
53
+ /**
54
+ * Sets the page size.
55
+ *
56
+ * @param pageSize
57
+ * The page size.
58
+ */
59
+ setPageSize(pageSize: number): void;
33
60
  /**
34
61
  * Loads range options from the grid options.
35
62
  */
@@ -42,9 +69,5 @@ declare class PaginationController {
42
69
  * the original data table.
43
70
  */
44
71
  createModifier(rowsCountBeforePagination?: number): RangeModifier | undefined;
45
- /**
46
- * Reset the pagination controller.
47
- */
48
- reset(): void;
49
72
  }
50
73
  export default PaginationController;
@@ -35,7 +35,16 @@ class PaginationController {
35
35
  * The querying controller instance.
36
36
  */
37
37
  constructor(querying) {
38
+ /**
39
+ * The current page (1-based index).
40
+ */
41
+ this.currentPage = 1;
42
+ /**
43
+ * The current page size.
44
+ */
45
+ this.currentPageSize = 10;
38
46
  this.querying = querying;
47
+ this.enabled = !!querying.grid.options?.pagination?.enabled;
39
48
  }
40
49
  /* *
41
50
  *
@@ -43,24 +52,62 @@ class PaginationController {
43
52
  *
44
53
  * */
45
54
  /**
46
- * Sets the range options.
55
+ * Total number of items (rows)
56
+ */
57
+ get totalItems() {
58
+ return this._totalItems ?? this.querying.grid.dataTable?.rowCount ?? 0;
59
+ }
60
+ /**
61
+ * Gets the total number of pages.
62
+ */
63
+ get totalPages() {
64
+ return this.currentPageSize > 0 ? Math.ceil(this.totalItems / this.currentPageSize) : 1;
65
+ }
66
+ /**
67
+ * Clamps the current page to the total number of pages.
68
+ */
69
+ clampPage() {
70
+ if (this.currentPage <= this.totalPages) {
71
+ return;
72
+ }
73
+ this.currentPage = this.totalPages;
74
+ this.querying.shouldBeUpdated = true;
75
+ }
76
+ /**
77
+ * Sets the page.
47
78
  *
48
79
  * @param currentPage
49
80
  * The current page.
50
81
  */
51
- setRange(currentPage) {
82
+ setPage(currentPage) {
52
83
  this.currentPage = currentPage;
84
+ this.clampPage();
85
+ this.querying.shouldBeUpdated = true;
86
+ }
87
+ /**
88
+ * Sets the page size.
89
+ *
90
+ * @param pageSize
91
+ * The page size.
92
+ */
93
+ setPageSize(pageSize) {
94
+ this.currentPageSize = pageSize;
53
95
  this.querying.shouldBeUpdated = true;
54
96
  }
55
97
  /**
56
98
  * Loads range options from the grid options.
57
99
  */
58
100
  loadOptions() {
59
- const pagination = this.querying.grid.pagination;
60
- if (pagination?.options.enabled &&
61
- this.currentPage !== pagination.currentPage) {
62
- this.currentPage = pagination.currentPage;
63
- this.setRange(this.currentPage);
101
+ const options = this.querying.grid.options?.pagination || {};
102
+ if (this.enabled === !options.enabled) {
103
+ this.enabled = !!options.enabled;
104
+ this.querying.shouldBeUpdated = true;
105
+ }
106
+ if (this.currentPageSize !== options.pageSize) {
107
+ this.setPageSize(options.pageSize ?? this.currentPageSize);
108
+ }
109
+ if (this.currentPage !== options.page) {
110
+ this.setPage(options.page ?? this.currentPage);
64
111
  }
65
112
  }
66
113
  /**
@@ -71,27 +118,20 @@ class PaginationController {
71
118
  * the original data table.
72
119
  */
73
120
  createModifier(rowsCountBeforePagination = (this.querying.grid.dataTable?.rowCount || 0)) {
74
- const currentPage = this.currentPage || 1; // Start from page 1, not 0
75
- const pageSize = this.querying.grid.pagination?.currentPageSize;
76
- if (!pageSize) {
121
+ if (!this.enabled) {
77
122
  return;
78
123
  }
124
+ const currentPage = this.currentPage;
125
+ const pageSize = this.currentPageSize;
79
126
  // Calculate the start index (0-based)
80
127
  const start = (currentPage - 1) * pageSize;
81
128
  const end = Math.min(start + pageSize, rowsCountBeforePagination);
82
- this.totalItems = rowsCountBeforePagination;
129
+ this._totalItems = rowsCountBeforePagination;
83
130
  return new RangeModifier({
84
131
  start,
85
132
  end
86
133
  });
87
134
  }
88
- /**
89
- * Reset the pagination controller.
90
- */
91
- reset() {
92
- delete this.currentPage;
93
- this.querying.shouldBeUpdated = true;
94
- }
95
135
  }
96
136
  /* *
97
137
  *
@@ -12,13 +12,7 @@ declare class SortingController {
12
12
  /**
13
13
  * The current sorting options: column ID and sorting order.
14
14
  */
15
- currentSorting?: SortingController.SortingState;
16
- /**
17
- * The initial sorting options: column ID and sorting order.
18
- * This is the sorting that is applied when the data grid is created or
19
- * after the whole viewport is reloaded with changed sorting options.
20
- */
21
- private initialSorting?;
15
+ currentSorting?: SortingState;
22
16
  /**
23
17
  * The modifier that is applied to the data table.
24
18
  */
@@ -55,13 +49,11 @@ declare class SortingController {
55
49
  */
56
50
  private createModifier;
57
51
  }
58
- declare namespace SortingController {
59
- /**
60
- * The sorting state interface.
61
- */
62
- interface SortingState {
63
- columnId?: string;
64
- order: ColumnSortingOrder;
65
- }
52
+ /**
53
+ * The sorting state interface.
54
+ */
55
+ export interface SortingState {
56
+ columnId?: string;
57
+ order: ColumnSortingOrder;
66
58
  }
67
59
  export default SortingController;
@@ -101,9 +101,8 @@ class SortingController {
101
101
  */
102
102
  loadOptions() {
103
103
  const stateFromOptions = this.getSortingOptions();
104
- if (stateFromOptions.columnId !== this.initialSorting?.columnId ||
105
- stateFromOptions.order !== this.initialSorting?.order) {
106
- this.initialSorting = stateFromOptions;
104
+ if (stateFromOptions.columnId !== this.currentSorting?.columnId ||
105
+ stateFromOptions.order !== this.currentSorting?.order) {
107
106
  this.setSorting(stateFromOptions.order, stateFromOptions.columnId);
108
107
  }
109
108
  }
@@ -1,4 +1,4 @@
1
- import type Column from '../../Column';
1
+ import type { Column } from '../../Column';
2
2
  import type { Condition } from './FilteringTypes';
3
3
  import type FilterCell from './FilterCell.js';
4
4
  /**
@@ -129,6 +129,26 @@ class ColumnFiltering {
129
129
  }
130
130
  await this.applyFilter({ value, condition });
131
131
  }
132
+ /**
133
+ * Refreshes the state of the filtering content by updating the select,
134
+ * input and clear button according to the column filtering options.
135
+ * @internal
136
+ */
137
+ refreshState() {
138
+ const colFilteringOptions = this.column.options.filtering;
139
+ if (this.filterSelect) {
140
+ this.filterSelect.value =
141
+ colFilteringOptions?.condition ??
142
+ conditionsMap[this.column.dataType][0];
143
+ }
144
+ if (this.filterInput) {
145
+ this.filterInput.value = '' + (colFilteringOptions?.value ?? '');
146
+ }
147
+ if (this.clearButton) {
148
+ this.clearButton.disabled = !this.isFilteringApplied();
149
+ }
150
+ this.disableInputIfNeeded();
151
+ }
132
152
  /**
133
153
  * Render the filtering content in the container.
134
154
  *
@@ -198,8 +218,12 @@ class ColumnFiltering {
198
218
  break;
199
219
  }
200
220
  }
201
- // Update the userOptions.
202
- void this.column.update({ filtering: condition }, false);
221
+ this.column.setOptions({
222
+ filtering: {
223
+ condition: condition.condition,
224
+ value: condition.value
225
+ }
226
+ });
203
227
  filteringController.addColumnFilterCondition(columnId, condition);
204
228
  this.disableInputIfNeeded();
205
229
  await querying.proceed();
@@ -224,7 +248,9 @@ class ColumnFiltering {
224
248
  */
225
249
  renderFilteringInput(inputWrapper, columnType) {
226
250
  // Render the input element.
227
- this.filterInput = makeHTMLElement('input', {}, inputWrapper);
251
+ this.filterInput = makeHTMLElement('input', {
252
+ className: Globals.getClassName('input')
253
+ }, inputWrapper);
228
254
  this.filterInput.setAttribute('tabindex', '-1');
229
255
  const column = this.column;
230
256
  this.filterInput.setAttribute('id', 'filter-input-' + column.viewport.grid.id + '-' + column.id);
@@ -268,7 +294,9 @@ class ColumnFiltering {
268
294
  */
269
295
  renderConditionSelect(inputWrapper) {
270
296
  // Render the select element.
271
- this.filterSelect = makeHTMLElement('select', {}, inputWrapper);
297
+ this.filterSelect = makeHTMLElement('select', {
298
+ className: Globals.getClassName('input')
299
+ }, inputWrapper);
272
300
  this.filterSelect.setAttribute('tabindex', '-1');
273
301
  const column = this.column;
274
302
  this.filterSelect.setAttribute('id', 'filter-select-' + column.viewport.grid.id + '-' + column.id);
@@ -1,4 +1,4 @@
1
- import type Column from '../../Column';
1
+ import type { ColumnDataType } from '../../Column';
2
2
  /**
3
3
  * String filtering conditions.
4
4
  */
@@ -19,7 +19,7 @@ export type BooleanCondition = typeof booleanConditions[number];
19
19
  * The event object for the 'afterRender' event.
20
20
  */
21
21
  export type AfterRenderEvent = Event & {
22
- column: Column;
22
+ column: ColumnDataType;
23
23
  filtering: boolean;
24
24
  };
25
25
  /**
@@ -49,4 +49,4 @@ export declare const booleanValueMap: Record<BooleanCondition, 'all' | boolean |
49
49
  /**
50
50
  * Conditions map for the condition select options.
51
51
  */
52
- export declare const conditionsMap: Record<Column.DataType, readonly Condition[]>;
52
+ export declare const conditionsMap: Record<ColumnDataType, readonly Condition[]>;
@@ -47,10 +47,8 @@ declare class ColumnSorting {
47
47
  */
48
48
  toggle: () => void;
49
49
  }
50
- declare namespace ColumnSorting {
51
- interface Event {
52
- target: Column;
53
- order: ColumnSortingOrder;
54
- }
50
+ export interface ColumnSortingEvent {
51
+ target: Column;
52
+ order: ColumnSortingOrder;
55
53
  }
56
54
  export default ColumnSorting;
@@ -110,11 +110,7 @@ class ColumnSorting {
110
110
  updateColumnOptions(col) {
111
111
  const order = col.viewport.grid.querying.sorting.currentSorting?.order;
112
112
  if (col.id === this.column.id && order) {
113
- col.update({
114
- sorting: {
115
- order
116
- }
117
- }, false);
113
+ col.setOptions({ sorting: { order } });
118
114
  }
119
115
  else {
120
116
  delete col.options.sorting?.order;
@@ -33,6 +33,14 @@ declare class TableCell extends Cell {
33
33
  * Renders the cell by appending it to the row and setting its value.
34
34
  */
35
35
  render(): void;
36
+ /**
37
+ * Edits the cell value and updates the data table. Call this instead of
38
+ * `setValue` when you want it to trigger the cell value user change event.
39
+ *
40
+ * @param value
41
+ * The new value to set.
42
+ */
43
+ editValue(value: DataTable.CellType): Promise<void>;
36
44
  /**
37
45
  * Sets the cell value and updates its content with it.
38
46
  *
@@ -60,9 +68,7 @@ declare class TableCell extends Cell {
60
68
  * Handles the focus event on the cell.
61
69
  */
62
70
  protected onFocus(): void;
63
- /**
64
- * Handles the mouse out event on the cell.
65
- */
71
+ protected onMouseOver(): void;
66
72
  protected onMouseOut(): void;
67
73
  /**
68
74
  * Handles the double click event on the cell.
@@ -77,12 +83,10 @@ declare class TableCell extends Cell {
77
83
  */
78
84
  destroy(): void;
79
85
  }
80
- declare namespace TableCell {
81
- /**
82
- * Event interface for table cell events.
83
- */
84
- interface TableCellEvent {
85
- target: TableCell;
86
- }
86
+ /**
87
+ * Event interface for table cell events.
88
+ */
89
+ export interface TableCellEvent {
90
+ target: TableCell;
87
91
  }
88
92
  export default TableCell;
@@ -59,6 +59,21 @@ class TableCell extends Cell {
59
59
  super.render();
60
60
  void this.setValue();
61
61
  }
62
+ /**
63
+ * Edits the cell value and updates the data table. Call this instead of
64
+ * `setValue` when you want it to trigger the cell value user change event.
65
+ *
66
+ * @param value
67
+ * The new value to set.
68
+ */
69
+ async editValue(value) {
70
+ if (this.value === value) {
71
+ return;
72
+ }
73
+ fireEvent(this, 'beforeEditValue');
74
+ await this.setValue(value, true);
75
+ fireEvent(this, 'afterEditValue');
76
+ }
62
77
  /**
63
78
  * Sets the cell value and updates its content with it.
64
79
  *
@@ -82,11 +97,10 @@ class TableCell extends Cell {
82
97
  this.content = this.column.createCellContent(this);
83
98
  }
84
99
  this.htmlElement.setAttribute('data-value', this.value + '');
100
+ // Set alignment in column cells based on column data type
101
+ this.htmlElement.classList[this.column.dataType === 'number' ? 'add' : 'remove'](Globals.getClassName('rightAlign'));
102
+ // Add custom class name from column options
85
103
  this.setCustomClassName(this.column.options.cells?.className);
86
- // Add alignment to number column
87
- if (this.column.dataType === 'number') {
88
- this.setCustomClassName(Globals.getClassName('rightAlign'));
89
- }
90
104
  fireEvent(this, 'afterRender', { target: this });
91
105
  }
92
106
  /**
@@ -121,8 +135,6 @@ class TableCell extends Cell {
121
135
  }
122
136
  initEvents() {
123
137
  this.cellEvents.push(['dblclick', (e) => (this.onDblClick(e))]);
124
- this.cellEvents.push(['mouseout', () => this.onMouseOut()]);
125
- this.cellEvents.push(['mouseover', () => this.onMouseOver()]);
126
138
  this.cellEvents.push(['mousedown', (e) => {
127
139
  this.onMouseDown(e);
128
140
  }]);
@@ -156,28 +168,13 @@ class TableCell extends Cell {
156
168
  originalEvent: e
157
169
  });
158
170
  }
159
- /**
160
- * Handles the mouse over event on the cell.
161
- * @internal
162
- */
163
171
  onMouseOver() {
164
- const { grid } = this.row.viewport;
165
- grid.hoverRow(this.row.index);
166
- grid.hoverColumn(this.column.id);
167
- fireEvent(this, 'mouseOver', {
168
- target: this
169
- });
172
+ this.row.viewport.grid.hoverRow(this.row.index);
173
+ super.onMouseOver();
170
174
  }
171
- /**
172
- * Handles the mouse out event on the cell.
173
- */
174
175
  onMouseOut() {
175
- const { grid } = this.row.viewport;
176
- grid.hoverRow();
177
- grid.hoverColumn();
178
- fireEvent(this, 'mouseOut', {
179
- target: this
180
- });
176
+ this.row.viewport.grid.hoverRow();
177
+ super.onMouseOut();
181
178
  }
182
179
  /**
183
180
  * Handles the double click event on the cell.
@@ -74,6 +74,4 @@ declare class TableRow extends Row {
74
74
  */
75
75
  setTranslateY(value: number): void;
76
76
  }
77
- declare namespace TableRow {
78
- }
79
77
  export default TableRow;
@@ -15,6 +15,8 @@
15
15
  * */
16
16
  'use strict';
17
17
  import Templating from '../../../Core/Templating.js';
18
+ import U from '../../../Core/Utilities.js';
19
+ const { fireEvent } = U;
18
20
  /* *
19
21
  *
20
22
  * Abstract Class of Cell
@@ -77,6 +79,12 @@ class Cell {
77
79
  this.cellEvents.push(['keydown', (e) => {
78
80
  this.onKeyDown(e);
79
81
  }]);
82
+ this.cellEvents.push(['mouseout', () => {
83
+ this.onMouseOut();
84
+ }]);
85
+ this.cellEvents.push(['mouseover', () => {
86
+ this.onMouseOver();
87
+ }]);
80
88
  this.cellEvents.forEach((pair) => {
81
89
  this.htmlElement.addEventListener(pair[0], pair[1]);
82
90
  });
@@ -150,6 +158,28 @@ class Cell {
150
158
  }
151
159
  }
152
160
  }
161
+ /**
162
+ * Handles the mouse over event on the cell.
163
+ * @internal
164
+ */
165
+ onMouseOver() {
166
+ const { grid } = this.row.viewport;
167
+ grid.hoverColumn(this.column?.id);
168
+ fireEvent(this, 'mouseOver', {
169
+ target: this
170
+ });
171
+ }
172
+ /**
173
+ * Handles the mouse out event on the cell.
174
+ * @internal
175
+ */
176
+ onMouseOut() {
177
+ const { grid } = this.row.viewport;
178
+ grid.hoverColumn();
179
+ fireEvent(this, 'mouseOut', {
180
+ target: this
181
+ });
182
+ }
153
183
  /**
154
184
  * Renders the cell by appending the HTML element to the row.
155
185
  */