@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.
- package/css/grid-pro.css +69 -85
- package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js +2 -0
- package/es-modules/Accessibility/Options/LangDefaults.js +6 -1
- package/es-modules/Accessibility/Utils/ChartUtilities.js +3 -3
- package/es-modules/Core/Color/ColorString.d.ts +25 -0
- package/es-modules/Core/Color/ColorType.d.ts +43 -0
- package/es-modules/Core/Color/GradientColor.d.ts +57 -0
- package/es-modules/Core/Globals.js +1 -1
- package/es-modules/Core/Renderer/AlignObject.d.ts +37 -0
- package/es-modules/Core/Renderer/BBoxObject.d.ts +40 -0
- package/es-modules/Core/Renderer/CSSObject.d.ts +130 -0
- package/es-modules/Core/Renderer/DOMElementType.d.ts +36 -0
- package/es-modules/Core/Renderer/DashStyleValue.d.ts +28 -0
- package/es-modules/Core/Renderer/FontMetricsObject.d.ts +38 -0
- package/es-modules/Core/Renderer/HTML/HTMLAttributes.d.ts +57 -0
- package/es-modules/Core/Renderer/PolygonBoxObject.d.ts +19 -0
- package/es-modules/Core/Renderer/Position3DObject.d.ts +35 -0
- package/es-modules/Core/Renderer/PositionObject.d.ts +28 -0
- package/es-modules/Core/Renderer/RectangleObject.d.ts +35 -0
- package/es-modules/Core/Renderer/RendererType.d.ts +53 -0
- package/es-modules/Core/Renderer/SVG/ButtonThemeObject.d.ts +43 -0
- package/es-modules/Core/Renderer/SVG/SVGArc3D.d.ts +44 -0
- package/es-modules/Core/Renderer/SVG/SVGAttributes.d.ts +147 -0
- package/es-modules/Core/Renderer/SVG/SVGAttributes3D.d.ts +42 -0
- package/es-modules/Core/Renderer/SVG/SVGCuboid.d.ts +42 -0
- package/es-modules/Core/Renderer/SVG/SVGElementBase.d.ts +31 -0
- package/es-modules/Core/Renderer/SVG/SVGPath.d.ts +97 -0
- package/es-modules/Core/Renderer/SVG/SVGPath3D.d.ts +40 -0
- package/es-modules/Core/Renderer/SVG/SVGRendererBase.d.ts +31 -0
- package/es-modules/Core/Renderer/SVG/SymbolOptions.d.ts +41 -0
- package/es-modules/Core/Renderer/SVG/SymbolType.d.ts +50 -0
- package/es-modules/Core/Renderer/ShadowOptionsObject.d.ts +40 -0
- package/es-modules/Core/Renderer/SizeObject.d.ts +28 -0
- package/es-modules/Core/Templating.js +6 -7
- package/es-modules/Data/Connectors/DataConnector.js +3 -2
- package/es-modules/Data/Connectors/DataConnectorOptions.d.ts +1 -1
- package/es-modules/Data/DataTable.d.ts +1 -1
- package/es-modules/Data/DataTable.js +3 -2
- package/es-modules/Data/DataTableCore.js +15 -6
- package/es-modules/Grid/Core/Accessibility/Accessibility.d.ts +13 -15
- package/es-modules/Grid/Core/Credits.d.ts +0 -2
- package/es-modules/Grid/Core/Defaults.d.ts +20 -17
- package/es-modules/Grid/Core/Defaults.js +116 -114
- package/es-modules/Grid/Core/Globals.d.ts +108 -32
- package/es-modules/Grid/Core/Globals.js +98 -111
- package/es-modules/Grid/Core/Grid.d.ts +51 -17
- package/es-modules/Grid/Core/Grid.js +369 -79
- package/es-modules/Grid/Core/GridUtils.d.ts +96 -89
- package/es-modules/Grid/Core/GridUtils.js +143 -155
- package/es-modules/Grid/Core/Options.d.ts +3 -7
- package/es-modules/Grid/Core/Pagination/Icons.d.ts +4 -4
- package/es-modules/Grid/Core/Pagination/Pagination.d.ts +32 -57
- package/es-modules/Grid/Core/Pagination/Pagination.js +206 -214
- package/es-modules/Grid/Core/Pagination/PaginationOptions.d.ts +22 -15
- package/es-modules/Grid/Core/Querying/PaginationController.d.ts +32 -9
- package/es-modules/Grid/Core/Querying/PaginationController.js +58 -18
- package/es-modules/Grid/Core/Querying/SortingController.d.ts +7 -15
- package/es-modules/Grid/Core/Querying/SortingController.js +2 -3
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.d.ts +1 -1
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.js +32 -4
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilteringTypes.d.ts +3 -3
- package/es-modules/Grid/Core/Table/Actions/ColumnSorting.d.ts +3 -5
- package/es-modules/Grid/Core/Table/Actions/ColumnSorting.js +1 -5
- package/es-modules/Grid/Core/Table/Body/TableCell.d.ts +14 -10
- package/es-modules/Grid/Core/Table/Body/TableCell.js +19 -21
- package/es-modules/Grid/Core/Table/Body/TableRow.d.ts +0 -2
- package/es-modules/Grid/Core/Table/Cell.js +30 -0
- package/es-modules/Grid/Core/Table/CellContent/TextContent.d.ts +2 -7
- package/es-modules/Grid/Core/Table/CellContent/TextContent.js +25 -14
- package/es-modules/Grid/Core/Table/Column.d.ts +7 -9
- package/es-modules/Grid/Core/Table/Column.js +23 -1
- package/es-modules/Grid/Core/Table/ColumnResizing/AdjacentResizingMode.js +2 -2
- package/es-modules/Grid/Core/Table/ColumnResizing/ColumnResizing.d.ts +30 -23
- package/es-modules/Grid/Core/Table/ColumnResizing/ColumnResizing.js +39 -39
- package/es-modules/Grid/Core/Table/ColumnResizing/DistributedResizingMode.js +1 -1
- package/es-modules/Grid/Core/Table/ColumnResizing/IndependentResizingMode.js +2 -2
- package/es-modules/Grid/Core/Table/ColumnResizing/ResizingMode.d.ts +6 -1
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.js +10 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/FilterPopup.d.ts +2 -2
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/StateHelpers.d.ts +26 -24
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/StateHelpers.js +37 -39
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/FilterToolbarButton.d.ts +1 -1
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/MenuToolbarButton.d.ts +1 -1
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.d.ts +1 -1
- package/es-modules/Grid/Core/Table/Header/HeaderRow.d.ts +0 -2
- package/es-modules/Grid/Core/Table/Header/TableHeader.d.ts +0 -2
- package/es-modules/Grid/Core/Table/Table.d.ts +11 -13
- package/es-modules/Grid/Core/Table/Table.js +9 -5
- package/es-modules/Grid/Core/UI/Button.d.ts +1 -1
- package/es-modules/Grid/Core/UI/ContextMenu.d.ts +1 -1
- package/es-modules/Grid/Core/UI/ContextMenu.js +1 -1
- package/es-modules/Grid/Core/UI/ContextMenuButton.d.ts +39 -44
- package/es-modules/Grid/Core/UI/ContextMenuButton.js +4 -4
- package/es-modules/Grid/Core/UI/Popup.d.ts +17 -19
- package/es-modules/Grid/Core/UI/Popup.js +2 -1
- package/es-modules/Grid/Core/UI/SvgIcons.d.ts +49 -50
- package/es-modules/Grid/Core/UI/SvgIcons.js +114 -123
- package/es-modules/Grid/Core/UI/ToolbarButton.d.ts +46 -52
- package/es-modules/Grid/Core/UI/ToolbarButton.js +4 -3
- package/es-modules/Grid/Pro/CellEditing/CellEditing.d.ts +6 -8
- package/es-modules/Grid/Pro/CellEditing/CellEditing.js +8 -11
- package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.d.ts +27 -1
- package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.js +149 -149
- package/es-modules/Grid/Pro/CellRendering/CellRenderer.d.ts +18 -20
- package/es-modules/Grid/Pro/CellRendering/CellRenderer.js +1 -1
- package/es-modules/Grid/Pro/CellRendering/CellRendererRegistry.d.ts +19 -17
- package/es-modules/Grid/Pro/CellRendering/CellRendererRegistry.js +28 -34
- package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.d.ts +12 -1
- package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.js +41 -46
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/CheckboxContent.js +2 -2
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContent.d.ts +2 -2
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContentBase.d.ts +2 -2
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContentBase.js +4 -2
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateTimeInputContent.d.ts +2 -2
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/NumberInputContent.js +3 -1
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SelectContent.js +3 -1
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.d.ts +19 -8
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.js +17 -13
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.js +3 -1
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TimeInputContent.d.ts +2 -2
- package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.d.ts +18 -20
- package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.js +3 -3
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.d.ts +10 -12
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.js +3 -3
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRendererBase.d.ts +17 -20
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.d.ts +10 -12
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.js +3 -3
- package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.d.ts +20 -22
- package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.js +3 -3
- package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.d.ts +40 -42
- package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.js +3 -3
- package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.d.ts +16 -18
- package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.js +14 -22
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.d.ts +22 -24
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.js +3 -3
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.d.ts +10 -12
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.js +3 -3
- package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.d.ts +10 -12
- package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.js +3 -3
- package/es-modules/Grid/Pro/ColumnTypes/Validator.d.ts +46 -51
- package/es-modules/Grid/Pro/ColumnTypes/Validator.js +62 -77
- package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.d.ts +16 -3
- package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.js +26 -31
- package/es-modules/Grid/Pro/Credits/CreditsPro.d.ts +0 -2
- package/es-modules/Grid/Pro/Credits/CreditsProComposition.d.ts +12 -11
- package/es-modules/Grid/Pro/Credits/CreditsProComposition.js +29 -31
- package/es-modules/Grid/Pro/Export/Exporting.d.ts +3 -3
- package/es-modules/Grid/Pro/Export/Exporting.js +35 -29
- package/es-modules/Grid/Pro/Export/ExportingComposition.d.ts +12 -11
- package/es-modules/Grid/Pro/Export/ExportingComposition.js +24 -26
- package/es-modules/Grid/Pro/GridEvents.d.ts +19 -1
- package/es-modules/Grid/Pro/GridEvents.js +6 -2
- package/es-modules/Grid/Pro/Pagination/PaginationComposition.d.ts +4 -11
- package/es-modules/Grid/Pro/Pagination/PaginationComposition.js +44 -45
- package/es-modules/Grid/index.d.ts +1 -0
- package/es-modules/masters/grid-pro.src.d.ts +62 -37
- package/es-modules/masters/grid-pro.src.js +37 -39
- package/grid-pro.d.ts +122 -48
- package/grid-pro.js +3 -6
- package/grid-pro.js.map +1 -1
- package/grid-pro.src.d.ts +122 -48
- package/grid-pro.src.js +6645 -6270
- package/package.json +5 -4
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
132
|
+
pageNumber?: string;
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
135
|
* Text for ellipsis (accessibility).
|
|
136
136
|
*
|
|
137
137
|
* @default "More pages"
|
|
138
138
|
*/
|
|
139
|
-
ellipsis
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
-
|
|
22
|
+
currentPageSize: number;
|
|
15
23
|
/**
|
|
16
24
|
* The number of rows before pagination.
|
|
17
25
|
*/
|
|
18
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
|
60
|
-
if (
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
-
|
|
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
|
-
|
|
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.
|
|
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?:
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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.
|
|
105
|
-
stateFromOptions.order !== this.
|
|
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
|
}
|
|
@@ -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
|
-
|
|
202
|
-
|
|
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', {
|
|
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', {
|
|
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
|
|
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:
|
|
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<
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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.
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
*
|
|
@@ -120,8 +135,6 @@ class TableCell extends Cell {
|
|
|
120
135
|
}
|
|
121
136
|
initEvents() {
|
|
122
137
|
this.cellEvents.push(['dblclick', (e) => (this.onDblClick(e))]);
|
|
123
|
-
this.cellEvents.push(['mouseout', () => this.onMouseOut()]);
|
|
124
|
-
this.cellEvents.push(['mouseover', () => this.onMouseOver()]);
|
|
125
138
|
this.cellEvents.push(['mousedown', (e) => {
|
|
126
139
|
this.onMouseDown(e);
|
|
127
140
|
}]);
|
|
@@ -155,28 +168,13 @@ class TableCell extends Cell {
|
|
|
155
168
|
originalEvent: e
|
|
156
169
|
});
|
|
157
170
|
}
|
|
158
|
-
/**
|
|
159
|
-
* Handles the mouse over event on the cell.
|
|
160
|
-
* @internal
|
|
161
|
-
*/
|
|
162
171
|
onMouseOver() {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
grid.hoverColumn(this.column.id);
|
|
166
|
-
fireEvent(this, 'mouseOver', {
|
|
167
|
-
target: this
|
|
168
|
-
});
|
|
172
|
+
this.row.viewport.grid.hoverRow(this.row.index);
|
|
173
|
+
super.onMouseOver();
|
|
169
174
|
}
|
|
170
|
-
/**
|
|
171
|
-
* Handles the mouse out event on the cell.
|
|
172
|
-
*/
|
|
173
175
|
onMouseOut() {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
grid.hoverColumn();
|
|
177
|
-
fireEvent(this, 'mouseOut', {
|
|
178
|
-
target: this
|
|
179
|
-
});
|
|
176
|
+
this.row.viewport.grid.hoverRow();
|
|
177
|
+
super.onMouseOut();
|
|
180
178
|
}
|
|
181
179
|
/**
|
|
182
180
|
* Handles the double click event on the cell.
|
|
@@ -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
|
*/
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { ColumnDataType } from '../Column';
|
|
2
2
|
import CellContent from './CellContent.js';
|
|
3
3
|
import TableCell from '../Body/TableCell';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a text type of content.
|
|
6
6
|
*/
|
|
7
7
|
declare class TextContent extends CellContent {
|
|
8
|
+
static readonly defaultFormatsForDataTypes: Record<ColumnDataType, string>;
|
|
8
9
|
constructor(cell: TableCell);
|
|
9
10
|
protected add(): void;
|
|
10
11
|
destroy(): void;
|
|
11
12
|
update(): void;
|
|
12
13
|
}
|
|
13
|
-
declare namespace TextContent {
|
|
14
|
-
/**
|
|
15
|
-
* Default formats for data types.
|
|
16
|
-
*/
|
|
17
|
-
const defaultFormatsForDataTypes: Record<Column.DataType, string>;
|
|
18
|
-
}
|
|
19
14
|
export default TextContent;
|