@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,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { ColumnDataType } from '../../Core/Table/Column';
|
|
2
2
|
import type { EditModeContent } from '../CellEditing/CellEditMode';
|
|
3
3
|
import type Table from '../../Core/Table/Table';
|
|
4
4
|
import type TableCell from '../../Core/Table/Body/TableCell';
|
|
@@ -7,6 +7,23 @@ import Cell from '../../Core/Table/Cell.js';
|
|
|
7
7
|
* Class for validating cell content.
|
|
8
8
|
*/
|
|
9
9
|
declare class Validator {
|
|
10
|
+
/**
|
|
11
|
+
* The class names used by the validator functionality.
|
|
12
|
+
*/
|
|
13
|
+
static readonly classNames: {
|
|
14
|
+
readonly notifContainer: string;
|
|
15
|
+
readonly notifError: string;
|
|
16
|
+
readonly notifAnimation: string;
|
|
17
|
+
readonly editedCellError: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Definition of default validation rules.
|
|
21
|
+
*/
|
|
22
|
+
static readonly rulesRegistry: RulesRegistryType;
|
|
23
|
+
/**
|
|
24
|
+
* Default validation rules for each dataType.
|
|
25
|
+
*/
|
|
26
|
+
static readonly predefinedRules: Record<ColumnDataType, RuleKey[]>;
|
|
10
27
|
viewport: Table;
|
|
11
28
|
/**
|
|
12
29
|
* The cell that has an error.
|
|
@@ -63,56 +80,34 @@ declare class Validator {
|
|
|
63
80
|
destroy(): void;
|
|
64
81
|
}
|
|
65
82
|
/**
|
|
66
|
-
*
|
|
83
|
+
* Callback function that checks if field is valid.
|
|
67
84
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
*/
|
|
81
|
-
type ValidateFunction = (this: TableCell, content: EditModeContent) => boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Callback function that returns a error message.
|
|
84
|
-
*/
|
|
85
|
-
type ValidationErrorFunction = (this: TableCell, content?: EditModeContent) => string;
|
|
86
|
-
/**
|
|
87
|
-
* Definition of the validation rule that should container validate method
|
|
88
|
-
* and error message displayed in notification.
|
|
89
|
-
*/
|
|
90
|
-
interface RuleDefinition {
|
|
91
|
-
validate: RulesRegistryType | ValidateFunction;
|
|
92
|
-
notification: string | ValidationErrorFunction;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Definition of default validation rules.
|
|
96
|
-
*/
|
|
97
|
-
interface RulesRegistryType {
|
|
98
|
-
boolean: RuleDefinition;
|
|
99
|
-
datetime: RuleDefinition;
|
|
100
|
-
notEmpty: RuleDefinition;
|
|
101
|
-
number: RuleDefinition;
|
|
102
|
-
ignoreCaseUnique: RuleDefinition;
|
|
103
|
-
unique: RuleDefinition;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Type of rule: `notEmpty`, `number` or `boolean`.
|
|
107
|
-
*/
|
|
108
|
-
type RuleKey = keyof RulesRegistryType;
|
|
109
|
-
/**
|
|
110
|
-
* Definition of default validation rules.
|
|
111
|
-
*/
|
|
112
|
-
const rulesRegistry: RulesRegistryType;
|
|
113
|
-
/**
|
|
114
|
-
* Default validation rules for each dataType.
|
|
115
|
-
*/
|
|
116
|
-
const predefinedRules: Record<Column.DataType, RuleKey[]>;
|
|
85
|
+
export type ValidateFunction = (this: TableCell, content: EditModeContent) => boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Callback function that returns a error message.
|
|
88
|
+
*/
|
|
89
|
+
export type ValidationErrorFunction = (this: TableCell, content?: EditModeContent) => string;
|
|
90
|
+
/**
|
|
91
|
+
* Definition of the validation rule that should container validate method
|
|
92
|
+
* and error message displayed in notification.
|
|
93
|
+
*/
|
|
94
|
+
export interface RuleDefinition {
|
|
95
|
+
validate: RulesRegistryType | ValidateFunction;
|
|
96
|
+
notification: string | ValidationErrorFunction;
|
|
117
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Definition of default validation rules.
|
|
100
|
+
*/
|
|
101
|
+
export interface RulesRegistryType {
|
|
102
|
+
boolean: RuleDefinition;
|
|
103
|
+
datetime: RuleDefinition;
|
|
104
|
+
notEmpty: RuleDefinition;
|
|
105
|
+
number: RuleDefinition;
|
|
106
|
+
ignoreCaseUnique: RuleDefinition;
|
|
107
|
+
unique: RuleDefinition;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Type of rule: `notEmpty`, `number` or `boolean`.
|
|
111
|
+
*/
|
|
112
|
+
export type RuleKey = keyof RulesRegistryType;
|
|
118
113
|
export default Validator;
|
|
@@ -181,87 +181,72 @@ class Validator {
|
|
|
181
181
|
this.notifContainer.remove();
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
/* *
|
|
185
|
-
*
|
|
186
|
-
* Namespace
|
|
187
|
-
*
|
|
188
|
-
* */
|
|
189
184
|
/**
|
|
190
|
-
*
|
|
185
|
+
* The class names used by the validator functionality.
|
|
191
186
|
*/
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
187
|
+
Validator.classNames = {
|
|
188
|
+
notifContainer: Globals.classNamePrefix + 'notification',
|
|
189
|
+
notifError: Globals.classNamePrefix + 'notification-error',
|
|
190
|
+
notifAnimation: Globals.classNamePrefix + 'notification-animation',
|
|
191
|
+
editedCellError: Globals.classNamePrefix + 'edited-cell-error'
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Definition of default validation rules.
|
|
195
|
+
*/
|
|
196
|
+
Validator.rulesRegistry = {
|
|
197
|
+
notEmpty: {
|
|
198
|
+
validate: ({ value, rawValue }) => (defined(value) && rawValue.length > 0),
|
|
199
|
+
notification: 'Value cannot be empty.'
|
|
200
|
+
},
|
|
201
|
+
number: {
|
|
202
|
+
validate: ({ rawValue }) => !isNaN(+rawValue),
|
|
203
|
+
notification: 'Value has to be a number.'
|
|
204
|
+
},
|
|
205
|
+
datetime: {
|
|
206
|
+
validate: ({ value }) => !defined(value) || !isNaN(+value),
|
|
207
|
+
notification: 'Value has to be parsed to a valid timestamp.'
|
|
208
|
+
},
|
|
209
|
+
'boolean': {
|
|
210
|
+
validate: ({ rawValue }) => (rawValue === 'true' || rawValue === 'false' ||
|
|
211
|
+
Number(rawValue) === 1 || Number(rawValue) === 0),
|
|
212
|
+
notification: 'Value has to be a boolean.'
|
|
213
|
+
},
|
|
214
|
+
ignoreCaseUnique: {
|
|
215
|
+
validate: function ({ rawValue }) {
|
|
216
|
+
const oldValue = String(this.value).toLowerCase();
|
|
217
|
+
const rowValueString = rawValue.toLowerCase();
|
|
218
|
+
if (oldValue === rowValueString) {
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
const columnData = this.column.data;
|
|
222
|
+
const isDuplicate = columnData?.some((value) => String(value).toLowerCase() ===
|
|
223
|
+
rowValueString);
|
|
224
|
+
return !isDuplicate;
|
|
227
225
|
},
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
},
|
|
240
|
-
notification: 'Value must be unique within this column (case-insensitive).'
|
|
226
|
+
notification: 'Value must be unique within this column (case-insensitive).'
|
|
227
|
+
},
|
|
228
|
+
unique: {
|
|
229
|
+
validate: function ({ rawValue }) {
|
|
230
|
+
const oldValue = this.value;
|
|
231
|
+
if (oldValue === rawValue) {
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
const columnData = this.column.data;
|
|
235
|
+
const isDuplicate = columnData?.some((value) => value === rawValue);
|
|
236
|
+
return !isDuplicate;
|
|
241
237
|
},
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
};
|
|
255
|
-
/**
|
|
256
|
-
* Default validation rules for each dataType.
|
|
257
|
-
*/
|
|
258
|
-
Validator.predefinedRules = {
|
|
259
|
-
'boolean': ['boolean'],
|
|
260
|
-
datetime: ['datetime'],
|
|
261
|
-
number: ['number'],
|
|
262
|
-
string: []
|
|
263
|
-
};
|
|
264
|
-
})(Validator || (Validator = {}));
|
|
238
|
+
notification: 'Value must be unique within this column (case-sensitive).'
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Default validation rules for each dataType.
|
|
243
|
+
*/
|
|
244
|
+
Validator.predefinedRules = {
|
|
245
|
+
'boolean': ['boolean'],
|
|
246
|
+
datetime: ['datetime'],
|
|
247
|
+
number: ['number'],
|
|
248
|
+
string: []
|
|
249
|
+
};
|
|
265
250
|
/* *
|
|
266
251
|
*
|
|
267
252
|
* Default Export
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import type Table from '../../Core/Table/Table';
|
|
2
|
+
import type { RuleKey, RuleDefinition, RulesRegistryType } from './Validator';
|
|
1
3
|
import Validator from './Validator.js';
|
|
4
|
+
/**
|
|
5
|
+
* Extends the grid classes with cell editing functionality.
|
|
6
|
+
*
|
|
7
|
+
* @param TableClass
|
|
8
|
+
* The class to extend.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare function compose(TableClass: typeof Table): void;
|
|
2
12
|
declare module '../../Core/Table/Table' {
|
|
3
13
|
export default interface Table {
|
|
4
14
|
/**
|
|
@@ -15,7 +25,7 @@ declare module '../../Pro/CellEditing/CellEditingComposition' {
|
|
|
15
25
|
* If not set, the validation rules are applied according to the data
|
|
16
26
|
* type.
|
|
17
27
|
*/
|
|
18
|
-
validationRules?: (
|
|
28
|
+
validationRules?: (RuleKey | RuleDefinition)[];
|
|
19
29
|
}
|
|
20
30
|
}
|
|
21
31
|
declare module '../../Core/Options' {
|
|
@@ -26,7 +36,10 @@ declare module '../../Core/Options' {
|
|
|
26
36
|
* If not set, the validation rules are applied according to the data
|
|
27
37
|
* type.
|
|
28
38
|
*/
|
|
29
|
-
validationErrors?:
|
|
39
|
+
validationErrors?: RulesRegistryType;
|
|
30
40
|
}
|
|
31
41
|
}
|
|
32
|
-
|
|
42
|
+
declare const _default: {
|
|
43
|
+
readonly compose: typeof compose;
|
|
44
|
+
};
|
|
45
|
+
export default _default;
|
|
@@ -23,41 +23,36 @@ const { addEvent, pushUnique } = U;
|
|
|
23
23
|
*
|
|
24
24
|
* */
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Extends the grid classes with cell editing functionality.
|
|
27
|
+
*
|
|
28
|
+
* @param TableClass
|
|
29
|
+
* The class to extend.
|
|
30
|
+
*
|
|
27
31
|
*/
|
|
28
|
-
|
|
29
|
-
(
|
|
30
|
-
|
|
31
|
-
* Extends the grid classes with cell editing functionality.
|
|
32
|
-
*
|
|
33
|
-
* @param TableClass
|
|
34
|
-
* The class to extend.
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
function compose(TableClass) {
|
|
38
|
-
if (!pushUnique(Globals.composed, 'Validator')) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
addEvent(TableClass, 'afterInit', initValidatorComposition);
|
|
42
|
-
addEvent(TableClass, 'afterDestroy', destroy);
|
|
43
|
-
}
|
|
44
|
-
ValidatorComposition.compose = compose;
|
|
45
|
-
/**
|
|
46
|
-
* Callback function called after table initialization.
|
|
47
|
-
*/
|
|
48
|
-
function initValidatorComposition() {
|
|
49
|
-
this.validator = new Validator(this);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Callback function called after table destroy.
|
|
53
|
-
*/
|
|
54
|
-
function destroy() {
|
|
55
|
-
this.validator.destroy();
|
|
32
|
+
export function compose(TableClass) {
|
|
33
|
+
if (!pushUnique(Globals.composed, 'Validator')) {
|
|
34
|
+
return;
|
|
56
35
|
}
|
|
57
|
-
|
|
36
|
+
addEvent(TableClass, 'afterInit', initValidatorComposition);
|
|
37
|
+
addEvent(TableClass, 'afterDestroy', destroy);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Callback function called after table initialization.
|
|
41
|
+
*/
|
|
42
|
+
function initValidatorComposition() {
|
|
43
|
+
this.validator = new Validator(this);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Callback function called after table destroy.
|
|
47
|
+
*/
|
|
48
|
+
function destroy() {
|
|
49
|
+
this.validator.destroy();
|
|
50
|
+
}
|
|
58
51
|
/* *
|
|
59
52
|
*
|
|
60
53
|
* Default Export
|
|
61
54
|
*
|
|
62
55
|
* */
|
|
63
|
-
export default
|
|
56
|
+
export default {
|
|
57
|
+
compose
|
|
58
|
+
};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type Grid from '../../Core/Grid';
|
|
2
2
|
import CreditsPro from './CreditsPro.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function compose(GridClass: typeof Grid): void;
|
|
12
|
-
}
|
|
3
|
+
/**
|
|
4
|
+
* Extends the grid classes with customizable credits.
|
|
5
|
+
*
|
|
6
|
+
* @param GridClass
|
|
7
|
+
* The class to extend.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare function compose(GridClass: typeof Grid): void;
|
|
13
11
|
declare module '../../Core/Options' {
|
|
14
12
|
interface Options {
|
|
15
13
|
/**
|
|
@@ -25,4 +23,7 @@ declare module '../../Core/Grid' {
|
|
|
25
23
|
credits?: CreditsPro;
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
|
-
|
|
26
|
+
declare const _default: {
|
|
27
|
+
readonly compose: typeof compose;
|
|
28
|
+
};
|
|
29
|
+
export default _default;
|
|
@@ -17,45 +17,43 @@
|
|
|
17
17
|
import CreditsPro from './CreditsPro.js';
|
|
18
18
|
import Globals from '../../Core/Globals.js';
|
|
19
19
|
import U from '../../../Core/Utilities.js';
|
|
20
|
-
import
|
|
20
|
+
import { defaultOptions } from '../../Core/Defaults.js';
|
|
21
21
|
const { addEvent, merge, pushUnique } = U;
|
|
22
22
|
/* *
|
|
23
23
|
*
|
|
24
|
-
*
|
|
24
|
+
* Composition
|
|
25
25
|
*
|
|
26
26
|
* */
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!pushUnique(Globals.composed, 'CreditsPro')) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
merge(true, Defaults.defaultOptions, {
|
|
41
|
-
credits: CreditsPro.defaultOptions
|
|
42
|
-
});
|
|
43
|
-
// TODO: Change to `beforeLoad` after upgrading grid update.
|
|
44
|
-
addEvent(GridClass, 'afterRenderViewport', initCredits);
|
|
45
|
-
}
|
|
46
|
-
CreditsProComposition.compose = compose;
|
|
47
|
-
/**
|
|
48
|
-
* Init configurable credits.
|
|
49
|
-
* @param this
|
|
50
|
-
* Reference to Grid.
|
|
51
|
-
*/
|
|
52
|
-
function initCredits() {
|
|
53
|
-
this.credits = new CreditsPro(this, this.options?.credits);
|
|
27
|
+
/**
|
|
28
|
+
* Extends the grid classes with customizable credits.
|
|
29
|
+
*
|
|
30
|
+
* @param GridClass
|
|
31
|
+
* The class to extend.
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export function compose(GridClass) {
|
|
35
|
+
if (!pushUnique(Globals.composed, 'CreditsPro')) {
|
|
36
|
+
return;
|
|
54
37
|
}
|
|
55
|
-
|
|
38
|
+
merge(true, defaultOptions, {
|
|
39
|
+
credits: CreditsPro.defaultOptions
|
|
40
|
+
});
|
|
41
|
+
// TODO: Change to `beforeLoad` after upgrading grid update.
|
|
42
|
+
addEvent(GridClass, 'afterRenderViewport', initCredits);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Init configurable credits.
|
|
46
|
+
* @param this
|
|
47
|
+
* Reference to Grid.
|
|
48
|
+
*/
|
|
49
|
+
function initCredits() {
|
|
50
|
+
this.credits = new CreditsPro(this, this.options?.credits);
|
|
51
|
+
}
|
|
56
52
|
/* *
|
|
57
53
|
*
|
|
58
54
|
* Default Export
|
|
59
55
|
*
|
|
60
56
|
* */
|
|
61
|
-
export default
|
|
57
|
+
export default {
|
|
58
|
+
compose
|
|
59
|
+
};
|
|
@@ -36,11 +36,11 @@ declare class Exporting {
|
|
|
36
36
|
*/
|
|
37
37
|
downloadJSON(modified?: boolean): void;
|
|
38
38
|
/**
|
|
39
|
-
* Creates a CSV string from the data
|
|
39
|
+
* Creates a CSV string from the data grid.
|
|
40
40
|
*
|
|
41
41
|
* @param modified
|
|
42
|
-
* Whether to return the
|
|
43
|
-
* or the
|
|
42
|
+
* Whether to return the data including the modifiers (filtering, sorting,
|
|
43
|
+
* etc.) or the original data. Default value is set to `true`.
|
|
44
44
|
*
|
|
45
45
|
* @return
|
|
46
46
|
* CSV string representing the data table.
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* */
|
|
15
15
|
'use strict';
|
|
16
16
|
import DownloadURL from '../../../Shared/DownloadURL.js';
|
|
17
|
+
import U from '../../../Core/Utilities.js';
|
|
17
18
|
const { downloadURL, getBlobFromContent } = DownloadURL;
|
|
19
|
+
const { defined } = U;
|
|
18
20
|
/* *
|
|
19
21
|
*
|
|
20
22
|
* Class
|
|
@@ -68,19 +70,18 @@ class Exporting {
|
|
|
68
70
|
'data:application/json,\uFEFF' + encodeURIComponent(json), this.getFilename() + '.json');
|
|
69
71
|
}
|
|
70
72
|
/**
|
|
71
|
-
* Creates a CSV string from the data
|
|
73
|
+
* Creates a CSV string from the data grid.
|
|
72
74
|
*
|
|
73
75
|
* @param modified
|
|
74
|
-
* Whether to return the
|
|
75
|
-
* or the
|
|
76
|
+
* Whether to return the data including the modifiers (filtering, sorting,
|
|
77
|
+
* etc.) or the original data. Default value is set to `true`.
|
|
76
78
|
*
|
|
77
79
|
* @return
|
|
78
80
|
* CSV string representing the data table.
|
|
79
81
|
*/
|
|
80
82
|
getCSV(modified = true) {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
this.grid.dataTable;
|
|
83
|
+
const { grid } = this;
|
|
84
|
+
const dataTable = modified ? grid.presentationTable : grid.dataTable;
|
|
84
85
|
if (!dataTable) {
|
|
85
86
|
return '';
|
|
86
87
|
}
|
|
@@ -96,49 +97,54 @@ class Exporting {
|
|
|
96
97
|
if (!itemDelimiter) {
|
|
97
98
|
itemDelimiter = (decimalPoint === ',' ? ';' : ',');
|
|
98
99
|
}
|
|
99
|
-
const
|
|
100
|
-
const
|
|
100
|
+
const columnIds = grid.enabledColumns ?? [];
|
|
101
|
+
const columnsCount = columnIds?.length;
|
|
101
102
|
const csvRows = [];
|
|
102
|
-
const columnsCount = columnIds.length;
|
|
103
103
|
const rowArray = [];
|
|
104
104
|
// Add the names as the first row if they should be exported
|
|
105
105
|
if (exportNames) {
|
|
106
106
|
csvRows.push(columnIds.map((columnId) => `"${columnId}"`).join(itemDelimiter));
|
|
107
107
|
}
|
|
108
|
+
const typeParser = (type) => {
|
|
109
|
+
switch (type) {
|
|
110
|
+
case 'number':
|
|
111
|
+
case 'datetime':
|
|
112
|
+
return (val) => (defined(val) ?
|
|
113
|
+
String(val).replace('.', decimalPoint) :
|
|
114
|
+
'');
|
|
115
|
+
case 'string':
|
|
116
|
+
return (val) => (defined(val) ?
|
|
117
|
+
`"${val}"` :
|
|
118
|
+
'');
|
|
119
|
+
case 'boolean':
|
|
120
|
+
return (val) => (defined(val) ?
|
|
121
|
+
(val ? 'TRUE' : 'FALSE') :
|
|
122
|
+
'');
|
|
123
|
+
}
|
|
124
|
+
};
|
|
108
125
|
for (let columnIndex = 0; columnIndex < columnsCount; columnIndex++) {
|
|
109
|
-
const columnId = columnIds[columnIndex], column =
|
|
110
|
-
let columnDataType;
|
|
126
|
+
const columnId = columnIds[columnIndex], column = grid.viewport?.getColumn(columnId), colType = column?.dataType, columnArray = dataTable.getColumn(columnId) ?? [], columnLength = columnArray?.length, parser = typeParser(colType ?? 'string');
|
|
111
127
|
for (let rowIndex = 0; rowIndex < columnLength; rowIndex++) {
|
|
112
|
-
let
|
|
113
|
-
if (!
|
|
114
|
-
rowArray[rowIndex] = [];
|
|
115
|
-
}
|
|
116
|
-
// Prefer datatype from metadata
|
|
117
|
-
if (columnDataType === 'string') {
|
|
118
|
-
cellValue = '"' + cellValue + '"';
|
|
119
|
-
}
|
|
120
|
-
else if (typeof cellValue === 'number') {
|
|
121
|
-
cellValue = String(cellValue).replace('.', decimalPoint);
|
|
122
|
-
}
|
|
123
|
-
else if (typeof cellValue === 'string') {
|
|
124
|
-
cellValue = `"${cellValue}"`;
|
|
128
|
+
let row = rowArray[rowIndex];
|
|
129
|
+
if (!row) {
|
|
130
|
+
row = rowArray[rowIndex] = [];
|
|
125
131
|
}
|
|
126
|
-
|
|
132
|
+
row[columnIndex] = parser(columnArray[rowIndex]);
|
|
127
133
|
// On the final column, push the row to the CSV
|
|
128
134
|
if (columnIndex === columnsCount - 1) {
|
|
129
135
|
// Trim repeated undefined values starting at the end
|
|
130
136
|
// Currently, we export the first "comma" even if the
|
|
131
137
|
// second value is undefined
|
|
132
138
|
let i = columnIndex;
|
|
133
|
-
while (
|
|
134
|
-
const cellVal =
|
|
139
|
+
while (row.length > 2) {
|
|
140
|
+
const cellVal = row[i];
|
|
135
141
|
if (cellVal !== void 0) {
|
|
136
142
|
break;
|
|
137
143
|
}
|
|
138
|
-
|
|
144
|
+
row.pop();
|
|
139
145
|
i--;
|
|
140
146
|
}
|
|
141
|
-
csvRows.push(
|
|
147
|
+
csvRows.push(row.join(itemDelimiter));
|
|
142
148
|
}
|
|
143
149
|
}
|
|
144
150
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type Grid from '../../Core/Grid';
|
|
2
2
|
import Exporting from './Exporting.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function compose(GridClass: typeof Grid): void;
|
|
12
|
-
}
|
|
3
|
+
/**
|
|
4
|
+
* Extends the grid classes with exporting.
|
|
5
|
+
*
|
|
6
|
+
* @param GridClass
|
|
7
|
+
* The class to extend.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare function compose(GridClass: typeof Grid): void;
|
|
13
11
|
declare module '../../Core/Options' {
|
|
14
12
|
interface Options {
|
|
15
13
|
/**
|
|
@@ -65,4 +63,7 @@ declare module '../../Core/Grid' {
|
|
|
65
63
|
exporting?: Exporting;
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
|
-
|
|
66
|
+
declare const _default: {
|
|
67
|
+
readonly compose: typeof compose;
|
|
68
|
+
};
|
|
69
|
+
export default _default;
|