@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
|
@@ -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
|
|
5
|
-
import
|
|
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:
|
|
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:
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
|
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 =
|
|
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
|
-
*
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
*
|
|
194
|
+
* Declarations
|
|
196
195
|
*
|
|
197
196
|
* */
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
*
|
|
31
|
+
* Default options for the cell editing.
|
|
32
32
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
export const defaultOptions = {
|
|
34
|
+
accessibility: {
|
|
35
|
+
announcements: {
|
|
36
|
+
cellEditing: true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
lang: {
|
|
39
40
|
accessibility: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
|
|
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
|
-
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
|
|
188
|
+
a11y.announce(msg);
|
|
189
|
+
}
|
|
193
190
|
/* *
|
|
194
191
|
*
|
|
195
192
|
* Default Export
|
|
196
193
|
*
|
|
197
194
|
* */
|
|
198
|
-
export default
|
|
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:
|
|
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
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Options to control the renderer content.
|
|
31
|
+
*/
|
|
32
|
+
export interface CellRendererOptions {
|
|
30
33
|
/**
|
|
31
|
-
*
|
|
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
|
-
|
|
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;
|