@highcharts/grid-pro 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +6 -0
- package/README.md +15 -9
- package/css/grid-pro.css +1262 -1122
- package/css/modules/grid-base-variables.css +131 -0
- package/css/modules/grid-button-variables.css +140 -0
- package/css/modules/grid-caption-variables.css +11 -0
- package/css/modules/grid-description-variables.css +11 -0
- package/css/modules/grid-input-variables.css +114 -0
- package/css/modules/grid-link-variables.css +18 -0
- package/css/modules/grid-menu-variables.css +50 -0
- package/css/modules/grid-pagination-variables.css +12 -0
- package/css/modules/grid-popup-variables.css +24 -0
- package/css/modules/grid-pro.css +234 -0
- package/css/modules/grid-table-variables.css +385 -0
- package/css/modules/grid-theme-default.css +55 -0
- package/es-modules/Accessibility/A11yI18n.js +1 -2
- package/es-modules/Accessibility/Accessibility.js +1 -2
- package/es-modules/Accessibility/AccessibilityComponent.d.ts +2 -2
- package/es-modules/Accessibility/Components/InfoRegionsComponent.js +5 -6
- package/es-modules/Accessibility/Components/LegendComponent.js +1 -2
- package/es-modules/Accessibility/Components/MenuComponent.js +1 -2
- package/es-modules/Accessibility/Components/NavigatorComponent.js +3 -4
- package/es-modules/Accessibility/Components/RangeSelectorComponent.js +1 -2
- package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js +1 -2
- package/es-modules/Accessibility/Components/SeriesComponent/NewDataAnnouncer.js +3 -4
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.js +3 -4
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.js +1 -2
- package/es-modules/Accessibility/Components/ZoomComponent.js +1 -2
- package/es-modules/Accessibility/FocusBorder.js +1 -2
- package/es-modules/Accessibility/KeyboardNavigation.js +1 -2
- package/es-modules/Accessibility/KeyboardNavigationHandler.js +1 -2
- package/es-modules/Accessibility/Options/A11yDefaults.d.ts +11 -0
- package/es-modules/Accessibility/Options/A11yDefaults.js +11 -0
- package/es-modules/Accessibility/Options/DeprecatedOptions.d.ts +58 -0
- package/es-modules/Accessibility/Options/DeprecatedOptions.js +7 -2
- package/es-modules/Accessibility/Options/LangDefaults.js +9 -0
- package/es-modules/Accessibility/ProxyElement.js +2 -5
- package/es-modules/Accessibility/ProxyProvider.js +1 -2
- package/es-modules/Accessibility/Utils/Announcer.js +2 -3
- package/es-modules/Accessibility/Utils/ChartUtilities.js +1 -2
- package/es-modules/Accessibility/Utils/EventProvider.d.ts +2 -2
- package/es-modules/Accessibility/Utils/EventProvider.js +6 -2
- package/es-modules/Accessibility/Utils/HTMLUtilities.js +1 -2
- package/es-modules/Core/Animation/AnimationUtilities.js +1 -2
- package/es-modules/Core/Animation/Fx.js +1 -2
- package/es-modules/Core/Callback.d.ts +9 -2
- package/es-modules/Core/Chart/Chart.js +48 -41
- package/es-modules/Core/Chart/Chart3D.js +1 -2
- package/es-modules/Core/Chart/ChartDefaults.js +11 -0
- package/es-modules/Core/Chart/ChartOptions.d.ts +8 -0
- package/es-modules/Core/Chart/GanttChart.js +1 -2
- package/es-modules/Core/Chart/MapChart.js +1 -2
- package/es-modules/Core/Chart/StockChart.js +2 -3
- package/es-modules/Core/Color/Color.js +1 -2
- package/es-modules/Core/Defaults.js +36 -9
- package/es-modules/Core/Delaunay.d.ts +52 -0
- package/es-modules/Core/Delaunay.js +310 -0
- package/es-modules/Core/Foundation.js +1 -2
- package/es-modules/Core/Geometry/CircleUtilities.js +1 -2
- package/es-modules/Core/Globals.js +1 -1
- package/es-modules/Core/HttpUtilities.js +1 -2
- package/es-modules/Core/MSPointer.js +1 -2
- package/es-modules/Core/Math3D.js +1 -2
- package/es-modules/Core/Options.d.ts +6 -2
- package/es-modules/Core/Pointer.js +23 -4
- package/es-modules/Core/PointerEvent.d.ts +2 -0
- package/es-modules/Core/Renderer/HTML/AST.js +2 -2
- package/es-modules/Core/Renderer/HTML/HTMLElement.js +1 -2
- package/es-modules/Core/Renderer/RendererUtilities.js +34 -19
- package/es-modules/Core/Responsive.d.ts +4 -2
- package/es-modules/Core/Responsive.js +10 -4
- package/es-modules/Core/Templating.d.ts +1 -1
- package/es-modules/Core/Templating.js +3 -4
- package/es-modules/Core/Time.d.ts +8 -0
- package/es-modules/Core/Time.js +2 -2
- package/es-modules/Core/Tooltip.d.ts +4 -8
- package/es-modules/Core/Tooltip.js +100 -81
- package/es-modules/Core/TooltipOptions.d.ts +44 -1
- package/es-modules/Core/Utilities.d.ts +25 -665
- package/es-modules/Core/Utilities.js +17 -1398
- package/es-modules/Data/ColumnUtils.d.ts +83 -80
- package/es-modules/Data/ColumnUtils.js +103 -113
- package/es-modules/Data/Connectors/CSVConnector.d.ts +9 -14
- package/es-modules/Data/Connectors/CSVConnector.js +3 -4
- package/es-modules/Data/Connectors/DataConnector.d.ts +52 -54
- package/es-modules/Data/Connectors/DataConnector.js +33 -52
- package/es-modules/Data/Connectors/GoogleSheetsConnector.d.ts +40 -42
- package/es-modules/Data/Connectors/GoogleSheetsConnector.js +73 -88
- package/es-modules/Data/Connectors/GoogleSheetsConnectorOptions.d.ts +4 -2
- package/es-modules/Data/Connectors/HTMLTableConnector.d.ts +23 -28
- package/es-modules/Data/Connectors/HTMLTableConnector.js +3 -4
- package/es-modules/Data/Connectors/JSONConnector.d.ts +9 -14
- package/es-modules/Data/Connectors/JSONConnector.js +3 -4
- package/es-modules/Data/Converters/CSVConverter.d.ts +5 -5
- package/es-modules/Data/Converters/CSVConverter.js +3 -4
- package/es-modules/Data/Converters/CSVConverterOptions.d.ts +2 -2
- package/es-modules/Data/Converters/DataConverter.d.ts +76 -78
- package/es-modules/Data/Converters/DataConverter.js +26 -53
- package/es-modules/Data/Converters/DataConverterUtils.d.ts +88 -81
- package/es-modules/Data/Converters/DataConverterUtils.js +169 -181
- package/es-modules/Data/Converters/GoogleSheetsConverter.d.ts +4 -4
- package/es-modules/Data/Converters/GoogleSheetsConverter.js +3 -3
- package/es-modules/Data/Converters/GoogleSheetsConverterOptions.d.ts +2 -2
- package/es-modules/Data/Converters/HTMLTableConverter.d.ts +4 -4
- package/es-modules/Data/Converters/HTMLTableConverter.js +2 -3
- package/es-modules/Data/Converters/HTMLTableConverterOptions.d.ts +2 -2
- package/es-modules/Data/Converters/JSONConverter.d.ts +7 -7
- package/es-modules/Data/Converters/JSONConverter.js +6 -6
- package/es-modules/Data/Converters/JSONConverterOptions.d.ts +2 -2
- package/es-modules/Data/DataCursor.d.ts +65 -70
- package/es-modules/Data/DataCursor.js +119 -139
- package/es-modules/Data/DataEvent.d.ts +55 -57
- package/es-modules/Data/DataPool.d.ts +10 -17
- package/es-modules/Data/DataPool.js +20 -9
- package/es-modules/Data/DataTable.d.ts +111 -113
- package/es-modules/Data/DataTable.js +3 -3
- package/es-modules/Data/DataTableCore.d.ts +9 -9
- package/es-modules/Data/DataTableCore.js +2 -2
- package/es-modules/Data/Formula/FormulaParser.js +1 -2
- package/es-modules/Data/Formula/FormulaProcessor.js +1 -2
- package/es-modules/Data/Modifiers/ChainModifier.d.ts +29 -34
- package/es-modules/Data/Modifiers/ChainModifier.js +7 -8
- package/es-modules/Data/Modifiers/DataModifier.d.ts +36 -41
- package/es-modules/Data/Modifiers/DataModifier.js +31 -53
- package/es-modules/Data/Modifiers/FilterModifier.d.ts +4 -4
- package/es-modules/Data/Modifiers/FilterModifier.js +3 -4
- package/es-modules/Data/Modifiers/FilterModifierOptions.d.ts +3 -2
- package/es-modules/Data/Modifiers/InvertModifier.d.ts +4 -4
- package/es-modules/Data/Modifiers/InvertModifier.js +3 -4
- package/es-modules/Data/Modifiers/MathModifier.d.ts +5 -4
- package/es-modules/Data/Modifiers/RangeModifier.d.ts +4 -4
- package/es-modules/Data/Modifiers/RangeModifier.js +3 -4
- package/es-modules/Data/Modifiers/SortModifier.d.ts +6 -11
- package/es-modules/Data/Modifiers/SortModifier.js +3 -4
- package/es-modules/Data/Modifiers/SortModifierOptions.d.ts +3 -3
- package/es-modules/Grid/Core/Accessibility/Accessibility.d.ts +1 -1
- package/es-modules/Grid/Core/Accessibility/Accessibility.js +5 -6
- package/es-modules/Grid/Core/Data/DataProvider.d.ts +97 -0
- package/es-modules/Grid/Core/Data/DataProvider.js +89 -0
- package/es-modules/Grid/Core/Data/DataProviderRegistry.d.ts +20 -0
- package/es-modules/Grid/Core/Data/DataProviderRegistry.js +52 -0
- package/es-modules/Grid/Core/Data/DataProviderType.d.ts +19 -0
- package/es-modules/Grid/Core/Data/DataProviderType.js +15 -0
- package/es-modules/Grid/Core/Data/LocalDataProvider.d.ts +165 -0
- package/es-modules/Grid/Core/Data/LocalDataProvider.js +341 -0
- package/es-modules/Grid/Core/Defaults.js +4 -2
- package/es-modules/Grid/Core/Globals.d.ts +20 -16
- package/es-modules/Grid/Core/Globals.js +10 -8
- package/es-modules/Grid/Core/Grid.d.ts +31 -22
- package/es-modules/Grid/Core/Grid.js +214 -136
- package/es-modules/Grid/Core/GridUtils.d.ts +33 -0
- package/es-modules/Grid/Core/GridUtils.js +50 -3
- package/es-modules/Grid/Core/Options.d.ts +145 -4
- package/es-modules/Grid/Core/Pagination/Pagination.d.ts +3 -0
- package/es-modules/Grid/Core/Pagination/Pagination.js +63 -23
- package/es-modules/Grid/Core/Pagination/PaginationOptions.d.ts +4 -0
- package/es-modules/Grid/Core/Querying/FilteringController.js +1 -2
- package/es-modules/Grid/Core/Querying/PaginationController.d.ts +2 -2
- package/es-modules/Grid/Core/Querying/PaginationController.js +3 -3
- package/es-modules/Grid/Core/Querying/QueryingController.d.ts +1 -1
- package/es-modules/Grid/Core/Querying/QueryingController.js +2 -26
- package/es-modules/Grid/Core/Responsive/ResponsiveComposition.d.ts +53 -0
- package/es-modules/Grid/Core/Responsive/ResponsiveComposition.js +229 -0
- package/es-modules/Grid/Core/Responsive/ResponsiveOptions.d.ts +58 -0
- package/es-modules/Grid/Core/Responsive/ResponsiveOptions.js +15 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.js +2 -3
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterCell.d.ts +1 -1
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterCell.js +3 -4
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterRow.d.ts +1 -1
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterRow.js +2 -2
- package/es-modules/Grid/Core/Table/Actions/ColumnSorting.d.ts +17 -1
- package/es-modules/Grid/Core/Table/Actions/ColumnSorting.js +58 -15
- package/es-modules/Grid/Core/Table/Actions/ColumnsResizer.js +1 -3
- package/es-modules/Grid/Core/Table/Actions/RowsVirtualizer.d.ts +57 -3
- package/es-modules/Grid/Core/Table/Actions/RowsVirtualizer.js +397 -118
- package/es-modules/Grid/Core/Table/Body/CellContextMenu.d.ts +11 -0
- package/es-modules/Grid/Core/Table/Body/CellContextMenu.js +84 -0
- package/es-modules/Grid/Core/Table/Body/TableCell.d.ts +27 -13
- package/es-modules/Grid/Core/Table/Body/TableCell.js +74 -25
- package/es-modules/Grid/Core/Table/Body/TableRow.d.ts +7 -15
- package/es-modules/Grid/Core/Table/Body/TableRow.js +24 -19
- package/es-modules/Grid/Core/Table/Cell.d.ts +16 -3
- package/es-modules/Grid/Core/Table/Cell.js +36 -3
- package/es-modules/Grid/Core/Table/CellContent/TextContent.js +3 -8
- package/es-modules/Grid/Core/Table/Column.d.ts +10 -4
- package/es-modules/Grid/Core/Table/Column.js +23 -34
- package/es-modules/Grid/Core/Table/ColumnResizing/IndependentResizingMode.js +9 -8
- package/es-modules/Grid/Core/Table/ColumnResizing/ResizingMode.js +4 -3
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.d.ts +5 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.js +7 -2
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/FilterPopup.js +1 -2
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/FilterMenuButton.js +1 -2
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/SortMenuButton.js +2 -3
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/FilterToolbarButton.js +1 -2
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/MenuToolbarButton.js +1 -2
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.d.ts +0 -1
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.js +4 -14
- package/es-modules/Grid/Core/Table/Header/HeaderCell.d.ts +6 -1
- package/es-modules/Grid/Core/Table/Header/HeaderCell.js +33 -13
- package/es-modules/Grid/Core/Table/Header/HeaderRow.js +4 -5
- package/es-modules/Grid/Core/Table/Header/TableHeader.d.ts +1 -1
- package/es-modules/Grid/Core/Table/Header/TableHeader.js +3 -3
- package/es-modules/Grid/Core/Table/Row.d.ts +1 -1
- package/es-modules/Grid/Core/Table/Row.js +2 -2
- package/es-modules/Grid/Core/Table/Table.d.ts +38 -12
- package/es-modules/Grid/Core/Table/Table.js +184 -91
- package/es-modules/Grid/Core/UI/ContextMenuButton.d.ts +6 -7
- package/es-modules/Grid/Core/UI/ContextMenuButton.js +5 -3
- package/es-modules/Grid/Core/UI/Popup.js +7 -9
- package/es-modules/Grid/Core/UI/SvgIcons.d.ts +42 -7
- package/es-modules/Grid/Core/UI/SvgIcons.js +206 -33
- package/es-modules/Grid/Core/UI/Toolbar.d.ts +5 -0
- package/es-modules/Grid/Core/UI/ToolbarButton.d.ts +4 -12
- package/es-modules/Grid/Core/UI/ToolbarButton.js +8 -26
- package/es-modules/Grid/Pro/CellEditing/CellEditMode.d.ts +2 -2
- package/es-modules/Grid/Pro/CellEditing/CellEditing.js +10 -10
- package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.d.ts +1 -1
- package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.js +4 -2
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/CheckboxContent.d.ts +2 -2
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/NumberInputContent.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SelectContent.d.ts +2 -2
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.d.ts +2 -2
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.d.ts +2 -2
- package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.js +1 -2
- package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.js +1 -2
- package/es-modules/Grid/Pro/ColumnTypes/Validator.js +34 -32
- package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.d.ts +1 -1
- package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.js +3 -4
- package/es-modules/Grid/Pro/Credits/CreditsProComposition.js +1 -3
- package/es-modules/Grid/Pro/Data/DataSourceHelper.d.ts +74 -0
- package/es-modules/Grid/Pro/Data/DataSourceHelper.js +246 -0
- package/es-modules/Grid/Pro/Data/QuerySerializer.d.ts +46 -0
- package/es-modules/Grid/Pro/Data/QuerySerializer.js +169 -0
- package/es-modules/Grid/Pro/Data/RemoteDataProvider.d.ts +187 -0
- package/es-modules/Grid/Pro/Data/RemoteDataProvider.js +500 -0
- package/es-modules/Grid/Pro/Export/Exporting.js +1 -2
- package/es-modules/Grid/Pro/Export/ExportingComposition.js +1 -2
- package/es-modules/Grid/Pro/GridEvents.js +1 -2
- package/es-modules/Grid/Pro/Pagination/PaginationComposition.d.ts +0 -1
- package/es-modules/Grid/Pro/Pagination/PaginationComposition.js +1 -2
- package/es-modules/Shared/BaseForm.js +1 -2
- package/es-modules/Shared/DownloadURL.js +1 -2
- package/es-modules/Shared/TimeBase.js +3 -3
- package/es-modules/Shared/Types.d.ts +7 -0
- package/es-modules/Shared/Utilities.d.ts +576 -0
- package/es-modules/Shared/Utilities.js +1368 -0
- package/es-modules/masters/grid-pro.src.d.ts +15 -11
- package/es-modules/masters/grid-pro.src.js +12 -5
- package/grid-pro.d.ts +15 -11
- package/grid-pro.js +3 -3
- package/grid-pro.js.map +1 -1
- package/grid-pro.src.d.ts +15 -11
- package/grid-pro.src.js +10408 -8009
- package/package.json +1 -1
- package/es-modules/Grid/Core/Pagination/Icons.d.ts +0 -7
- package/es-modules/Grid/Core/Pagination/Icons.js +0 -7
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
'use strict';
|
|
17
17
|
import Accessibility from './Accessibility/Accessibility.js';
|
|
18
18
|
import AST from '../../Core/Renderer/HTML/AST.js';
|
|
19
|
-
import
|
|
20
|
-
import GridUtils from './GridUtils.js';
|
|
19
|
+
import DataProviderRegistry from './Data/DataProviderRegistry.js';
|
|
21
20
|
import DataTable from '../../Data/DataTable.js';
|
|
21
|
+
import { defaultOptions } from './Defaults.js';
|
|
22
|
+
import { makeHTMLElement, setHTMLContent, createOptionsProxy } from './GridUtils.js';
|
|
22
23
|
import Table from './Table/Table.js';
|
|
23
|
-
import U from '../../Core/Utilities.js';
|
|
24
24
|
import QueryingController from './Querying/QueryingController.js';
|
|
25
25
|
import Globals from './Globals.js';
|
|
26
26
|
import TimeBase from '../../Shared/TimeBase.js';
|
|
27
27
|
import Pagination from './Pagination/Pagination.js';
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
import { defined, diffObjects, extend, fireEvent, merge, pick } from '../../Shared/Utilities.js';
|
|
29
|
+
import { uniqueKey } from '../../Core/Utilities.js';
|
|
30
30
|
/* *
|
|
31
31
|
*
|
|
32
32
|
* Class
|
|
@@ -85,11 +85,6 @@ export class Grid {
|
|
|
85
85
|
* The list of currently shown popups.
|
|
86
86
|
*/
|
|
87
87
|
this.popups = new Set();
|
|
88
|
-
/**
|
|
89
|
-
* Functions that unregister events attached to the grid's data table,
|
|
90
|
-
* that need to be removed when the grid is destroyed.
|
|
91
|
-
*/
|
|
92
|
-
this.dataTableEventDestructors = [];
|
|
93
88
|
/**
|
|
94
89
|
* Whether the Grid is rendered.
|
|
95
90
|
*/
|
|
@@ -100,9 +95,16 @@ export class Grid {
|
|
|
100
95
|
* @internal
|
|
101
96
|
*/
|
|
102
97
|
this.dirtyFlags = new Set();
|
|
98
|
+
/**
|
|
99
|
+
* Internal redraw queue used to prevent concurrent `redraw()` calls from
|
|
100
|
+
* interleaving async DOM work and corrupting the state (for example
|
|
101
|
+
* rendering duplicate pagination controls when `update()` is called
|
|
102
|
+
* multiple times without awaiting).
|
|
103
|
+
*/
|
|
104
|
+
this.redrawQueue = Promise.resolve();
|
|
103
105
|
this.renderTo = renderTo;
|
|
104
106
|
this.loadUserOptions(options);
|
|
105
|
-
this.id = this.options?.id ||
|
|
107
|
+
this.id = this.options?.id || uniqueKey();
|
|
106
108
|
this.querying = new QueryingController(this);
|
|
107
109
|
this.locale = this.options?.lang?.locale || (this.container?.closest('[lang]')?.lang);
|
|
108
110
|
this.time = new TimeBase(extend(this.options?.time, { locale: this.locale }), this.options?.lang);
|
|
@@ -118,6 +120,31 @@ export class Grid {
|
|
|
118
120
|
* Methods
|
|
119
121
|
*
|
|
120
122
|
* */
|
|
123
|
+
/**
|
|
124
|
+
* The data source of the Grid. It contains the original data table
|
|
125
|
+
* that was passed to the Grid.
|
|
126
|
+
*
|
|
127
|
+
* @deprecated Use `dataProvider` instead.
|
|
128
|
+
*/
|
|
129
|
+
get dataTable() {
|
|
130
|
+
const dp = this.dataProvider;
|
|
131
|
+
if (dp && 'getDataTable' in dp) {
|
|
132
|
+
return dp.getDataTable();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The presentation table of the Grid. It contains a modified version
|
|
137
|
+
* of the data table that is used for rendering the Grid content. If
|
|
138
|
+
* not modified, just a reference to the original data table.
|
|
139
|
+
*
|
|
140
|
+
* @deprecated Use `dataProvider` instead.
|
|
141
|
+
*/
|
|
142
|
+
get presentationTable() {
|
|
143
|
+
const dp = this.dataProvider;
|
|
144
|
+
if (dp && 'getDataTable' in dp) {
|
|
145
|
+
return dp.getDataTable(true);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
121
148
|
/*
|
|
122
149
|
* Initializes the accessibility controller.
|
|
123
150
|
*/
|
|
@@ -333,7 +360,7 @@ export class Grid {
|
|
|
333
360
|
* the ones that are currently defined in the user options. When `true`,
|
|
334
361
|
* the columns not defined in the new options will be removed.
|
|
335
362
|
*/
|
|
336
|
-
|
|
363
|
+
update(options = {}, redraw = true, oneToOne = false) {
|
|
337
364
|
fireEvent(this, 'beforeUpdate', {
|
|
338
365
|
scope: 'grid',
|
|
339
366
|
options,
|
|
@@ -344,20 +371,28 @@ export class Grid {
|
|
|
344
371
|
const diff = this.loadUserOptions(options, oneToOne);
|
|
345
372
|
const flags = this.dirtyFlags;
|
|
346
373
|
if (viewport) {
|
|
347
|
-
if (!this.
|
|
348
|
-
|
|
349
|
-
(
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
374
|
+
if (!this.dataProvider ||
|
|
375
|
+
('data' in diff) ||
|
|
376
|
+
('dataTable' in diff)) {
|
|
377
|
+
if ( // Handle backward compatibility
|
|
378
|
+
diff.dataTable &&
|
|
379
|
+
this.options?.dataTable &&
|
|
380
|
+
this.options?.data?.providerType === 'local') {
|
|
381
|
+
const userDT = this.options.dataTable;
|
|
382
|
+
this.options.data.dataTable = 'clone' in userDT ?
|
|
383
|
+
userDT : new DataTable(userDT);
|
|
384
|
+
}
|
|
385
|
+
this.loadDataProvider(); // Rebuild the data provider
|
|
386
|
+
// TODO(update): Sometimes it can be too much, so we need to
|
|
387
|
+
// check if the columns have changed or just their data. If
|
|
388
|
+
// just their data, we can just mark the grid.table as dirty
|
|
389
|
+
// instead of the whole grid.
|
|
355
390
|
flags.add('grid');
|
|
356
391
|
}
|
|
357
392
|
if ('columns' in diff) {
|
|
358
393
|
const ids = Object.keys(diff.columns ?? {});
|
|
359
394
|
for (const id of ids) {
|
|
360
|
-
// TODO: Move this to the column update method.
|
|
395
|
+
// TODO(update): Move this to the column update method.
|
|
361
396
|
this.loadColumnOptionDiffs(viewport, id, diff.columns?.[id]);
|
|
362
397
|
delete diff.columns?.[id];
|
|
363
398
|
}
|
|
@@ -374,7 +409,7 @@ export class Grid {
|
|
|
374
409
|
this.time.update({ locale: this.locale });
|
|
375
410
|
}
|
|
376
411
|
delete langDiff.locale;
|
|
377
|
-
// TODO: Add more lang diff checks here.
|
|
412
|
+
// TODO(update): Add more lang diff checks here.
|
|
378
413
|
if (Object.keys(langDiff).length > 0) {
|
|
379
414
|
flags.add('grid');
|
|
380
415
|
}
|
|
@@ -394,7 +429,7 @@ export class Grid {
|
|
|
394
429
|
this.pagination?.update(paginationDiff);
|
|
395
430
|
}
|
|
396
431
|
delete diff.pagination;
|
|
397
|
-
// TODO: Add more options that can be optimized here.
|
|
432
|
+
// TODO(update): Add more options that can be optimized here.
|
|
398
433
|
if (Object.keys(diff).length > 0) {
|
|
399
434
|
flags.add('grid');
|
|
400
435
|
}
|
|
@@ -402,15 +437,18 @@ export class Grid {
|
|
|
402
437
|
else {
|
|
403
438
|
flags.add('grid');
|
|
404
439
|
}
|
|
440
|
+
const finish = () => {
|
|
441
|
+
fireEvent(this, 'afterUpdate', {
|
|
442
|
+
scope: 'grid',
|
|
443
|
+
options,
|
|
444
|
+
redraw,
|
|
445
|
+
oneToOne
|
|
446
|
+
});
|
|
447
|
+
};
|
|
405
448
|
if (redraw) {
|
|
406
|
-
|
|
449
|
+
return this.redraw().then(finish);
|
|
407
450
|
}
|
|
408
|
-
|
|
409
|
-
scope: 'grid',
|
|
410
|
-
options,
|
|
411
|
-
redraw,
|
|
412
|
-
oneToOne
|
|
413
|
-
});
|
|
451
|
+
finish();
|
|
414
452
|
}
|
|
415
453
|
/**
|
|
416
454
|
* Loads the column option diffs by updating the dirty flags.
|
|
@@ -442,8 +480,7 @@ export class Grid {
|
|
|
442
480
|
const cellsDiff = columnDiff.cells ?? {};
|
|
443
481
|
if ('format' in cellsDiff ||
|
|
444
482
|
'formatter' in cellsDiff ||
|
|
445
|
-
'className' in cellsDiff
|
|
446
|
-
) {
|
|
483
|
+
'className' in cellsDiff) {
|
|
447
484
|
// Optimization idea: list of columns to update
|
|
448
485
|
flags.add('rows');
|
|
449
486
|
}
|
|
@@ -467,6 +504,7 @@ export class Grid {
|
|
|
467
504
|
}
|
|
468
505
|
delete sortingDiff.compare;
|
|
469
506
|
delete sortingDiff.order;
|
|
507
|
+
delete sortingDiff.orderSequence;
|
|
470
508
|
// Idea: sortable - redraw only header cell
|
|
471
509
|
if (Object.keys(sortingDiff).length > 0) {
|
|
472
510
|
flags.add('grid');
|
|
@@ -496,52 +534,64 @@ export class Grid {
|
|
|
496
534
|
* them minimizing the number of DOM operations.
|
|
497
535
|
*/
|
|
498
536
|
async redraw() {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
colResizing.loadColumns();
|
|
515
|
-
}
|
|
516
|
-
if (flags.has('rows') ||
|
|
517
|
-
flags.has('sorting') ||
|
|
518
|
-
flags.has('filtering') ||
|
|
519
|
-
pagination?.isDirtyQuerying) {
|
|
520
|
-
await vp?.updateRows();
|
|
521
|
-
}
|
|
522
|
-
else if (flags.has('reflow') ||
|
|
523
|
-
colResizing?.isDirty) {
|
|
524
|
-
vp?.reflow();
|
|
525
|
-
}
|
|
526
|
-
const columns = vp?.columns ?? [];
|
|
527
|
-
if (flags.has('sorting') ||
|
|
528
|
-
flags.has('filtering')) {
|
|
529
|
-
for (const column of columns) {
|
|
530
|
-
column.header?.toolbar?.refreshState();
|
|
537
|
+
const run = async () => {
|
|
538
|
+
fireEvent(this, 'beforeRedraw');
|
|
539
|
+
const flags = this.dirtyFlags;
|
|
540
|
+
const flagsToProcess = new Set(flags);
|
|
541
|
+
const { viewport: vp, pagination } = this;
|
|
542
|
+
const colResizing = vp?.columnResizing;
|
|
543
|
+
const paginationWasDirty = !!pagination?.isDirtyQuerying;
|
|
544
|
+
const colResizingWasDirty = !!colResizing?.isDirty;
|
|
545
|
+
if (flagsToProcess.has('grid')) {
|
|
546
|
+
await this.render(false);
|
|
547
|
+
for (const flag of flagsToProcess) {
|
|
548
|
+
flags.delete(flag);
|
|
549
|
+
}
|
|
550
|
+
fireEvent(this, 'afterRedraw');
|
|
551
|
+
return;
|
|
531
552
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
553
|
+
await this.dataProvider?.init();
|
|
554
|
+
if (flagsToProcess.has('sorting') ||
|
|
555
|
+
flagsToProcess.has('filtering') ||
|
|
556
|
+
paginationWasDirty) {
|
|
557
|
+
this.querying.loadOptions();
|
|
536
558
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
559
|
+
if (colResizingWasDirty) {
|
|
560
|
+
colResizing?.loadColumns();
|
|
561
|
+
}
|
|
562
|
+
if (flagsToProcess.has('rows') ||
|
|
563
|
+
flagsToProcess.has('sorting') ||
|
|
564
|
+
flagsToProcess.has('filtering') ||
|
|
565
|
+
paginationWasDirty) {
|
|
566
|
+
await vp?.updateRows();
|
|
567
|
+
}
|
|
568
|
+
else if (flagsToProcess.has('reflow') ||
|
|
569
|
+
colResizingWasDirty) {
|
|
570
|
+
vp?.reflow();
|
|
571
|
+
}
|
|
572
|
+
const columns = vp?.columns ?? [];
|
|
573
|
+
if (flagsToProcess.has('sorting') ||
|
|
574
|
+
flagsToProcess.has('filtering')) {
|
|
575
|
+
for (const column of columns) {
|
|
576
|
+
column.header?.toolbar?.refreshState();
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
if (flagsToProcess.has('filtering')) {
|
|
580
|
+
for (const column of columns) {
|
|
581
|
+
column.filtering?.refreshState();
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
pagination?.redraw();
|
|
585
|
+
delete colResizing?.isDirty;
|
|
586
|
+
for (const flag of ['sorting', 'filtering']) {
|
|
587
|
+
flags.delete(flag);
|
|
588
|
+
}
|
|
589
|
+
fireEvent(this, 'afterRedraw');
|
|
590
|
+
};
|
|
591
|
+
const queued = this.redrawQueue.then(run, run);
|
|
592
|
+
// Keep the queue progressing even if one redraw fails.
|
|
593
|
+
this.redrawQueue = queued['catch'](() => void 0);
|
|
594
|
+
return queued;
|
|
545
595
|
}
|
|
546
596
|
/**
|
|
547
597
|
* Updates the column of the Grid with new options.
|
|
@@ -672,19 +722,21 @@ export class Grid {
|
|
|
672
722
|
});
|
|
673
723
|
}
|
|
674
724
|
}
|
|
675
|
-
async render() {
|
|
725
|
+
async render(clearDirtyFlags = true) {
|
|
676
726
|
if (this.isRendered) {
|
|
677
727
|
this.destroy(true);
|
|
678
728
|
}
|
|
679
|
-
this.
|
|
729
|
+
await this.loadDataProvider().init();
|
|
680
730
|
this.initContainer(this.renderTo);
|
|
681
731
|
this.initAccessibility();
|
|
682
732
|
this.initPagination();
|
|
683
733
|
this.querying.loadOptions();
|
|
684
734
|
await this.querying.proceed();
|
|
685
|
-
this.renderViewport();
|
|
735
|
+
await this.renderViewport();
|
|
686
736
|
this.isRendered = true;
|
|
687
|
-
|
|
737
|
+
if (clearDirtyFlags) {
|
|
738
|
+
this.dirtyFlags.clear();
|
|
739
|
+
}
|
|
688
740
|
}
|
|
689
741
|
/**
|
|
690
742
|
* Hovers the row with the provided index. It removes the hover effect from
|
|
@@ -774,20 +826,19 @@ export class Grid {
|
|
|
774
826
|
*/
|
|
775
827
|
renderCaption() {
|
|
776
828
|
const captionOptions = this.options?.caption;
|
|
777
|
-
|
|
778
|
-
if (!captionText) {
|
|
829
|
+
if (!captionOptions?.text || !this.contentWrapper) {
|
|
779
830
|
return;
|
|
780
831
|
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
832
|
+
const tag = captionOptions.htmlTag?.toLowerCase();
|
|
833
|
+
const tagName = tag && AST.allowedTags.includes(tag) ? tag : 'div';
|
|
834
|
+
const defaultClass = Globals.getClassName('captionElement');
|
|
835
|
+
const className = captionOptions.className ?
|
|
836
|
+
`${defaultClass} ${captionOptions.className}` : defaultClass;
|
|
837
|
+
this.captionElement = new AST([{
|
|
838
|
+
tagName,
|
|
839
|
+
attributes: { 'class': className, id: this.id + '-caption' },
|
|
840
|
+
textContent: captionOptions.text
|
|
841
|
+
}]).addToDOM(this.contentWrapper);
|
|
791
842
|
}
|
|
792
843
|
/**
|
|
793
844
|
* Render description under the grid.
|
|
@@ -830,11 +881,11 @@ export class Grid {
|
|
|
830
881
|
* rendered, it will be destroyed and re-rendered with the new data.
|
|
831
882
|
* @internal
|
|
832
883
|
*/
|
|
833
|
-
renderViewport() {
|
|
884
|
+
async renderViewport() {
|
|
834
885
|
const viewportMeta = this.viewport?.getStateMeta();
|
|
835
886
|
const pagination = this.pagination;
|
|
836
887
|
const paginationPosition = pagination?.options?.position;
|
|
837
|
-
this.enabledColumns = this.getEnabledColumnIDs();
|
|
888
|
+
this.enabledColumns = await this.getEnabledColumnIDs();
|
|
838
889
|
this.credits?.destroy();
|
|
839
890
|
this.viewport?.destroy();
|
|
840
891
|
delete this.viewport;
|
|
@@ -846,7 +897,8 @@ export class Grid {
|
|
|
846
897
|
pagination?.render();
|
|
847
898
|
}
|
|
848
899
|
if (this.enabledColumns.length > 0) {
|
|
849
|
-
this.viewport = this.renderTable();
|
|
900
|
+
this.viewport = await this.renderTable();
|
|
901
|
+
this.viewport.tableElement.setAttribute('id', this.id);
|
|
850
902
|
if (viewportMeta && this.viewport) {
|
|
851
903
|
this.viewport.applyStateMeta(viewportMeta);
|
|
852
904
|
}
|
|
@@ -854,7 +906,7 @@ export class Grid {
|
|
|
854
906
|
else {
|
|
855
907
|
this.renderNoData();
|
|
856
908
|
}
|
|
857
|
-
this.renderAccessibility();
|
|
909
|
+
await this.renderAccessibility();
|
|
858
910
|
// Render bottom pagination, footer pagination,
|
|
859
911
|
// or custom container pagination (after table).
|
|
860
912
|
if (paginationPosition !== 'top') {
|
|
@@ -868,12 +920,12 @@ export class Grid {
|
|
|
868
920
|
* Renders the Grid accessibility.
|
|
869
921
|
* @internal
|
|
870
922
|
*/
|
|
871
|
-
renderAccessibility() {
|
|
923
|
+
async renderAccessibility() {
|
|
872
924
|
const accessibility = this.accessibility;
|
|
873
925
|
if (!accessibility) {
|
|
874
926
|
return;
|
|
875
927
|
}
|
|
876
|
-
accessibility.setA11yOptions();
|
|
928
|
+
await accessibility.setA11yOptions();
|
|
877
929
|
accessibility.addScreenReaderSection('before');
|
|
878
930
|
accessibility.addScreenReaderSection('after');
|
|
879
931
|
}
|
|
@@ -883,12 +935,14 @@ export class Grid {
|
|
|
883
935
|
* @returns
|
|
884
936
|
* The newly rendered table (viewport) of the Grid.
|
|
885
937
|
*/
|
|
886
|
-
renderTable() {
|
|
938
|
+
async renderTable() {
|
|
887
939
|
this.tableElement = makeHTMLElement('table', {
|
|
888
940
|
className: Globals.getClassName('tableElement')
|
|
889
941
|
}, this.contentWrapper);
|
|
890
942
|
this.tableElement.setAttribute('role', 'grid');
|
|
891
|
-
|
|
943
|
+
const table = new Table(this, this.tableElement);
|
|
944
|
+
await table.init();
|
|
945
|
+
return table;
|
|
892
946
|
}
|
|
893
947
|
/**
|
|
894
948
|
* Renders a message that there is no data to display.
|
|
@@ -903,12 +957,12 @@ export class Grid {
|
|
|
903
957
|
* Returns the array of IDs of columns that should be displayed in the data
|
|
904
958
|
* grid, in the correct order.
|
|
905
959
|
*/
|
|
906
|
-
getEnabledColumnIDs() {
|
|
960
|
+
async getEnabledColumnIDs() {
|
|
907
961
|
const { columnOptionsMap } = this;
|
|
908
962
|
const header = this.options?.header;
|
|
909
963
|
const headerColumns = this.getColumnIds(header || [], false);
|
|
910
964
|
const columnsIncluded = this.options?.rendering?.columns?.included || (headerColumns && headerColumns.length > 0 ?
|
|
911
|
-
headerColumns : this.
|
|
965
|
+
headerColumns : await this.dataProvider?.getColumnIds());
|
|
912
966
|
if (!columnsIncluded?.length) {
|
|
913
967
|
return [];
|
|
914
968
|
}
|
|
@@ -925,37 +979,25 @@ export class Grid {
|
|
|
925
979
|
}
|
|
926
980
|
return result;
|
|
927
981
|
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
* reference, it should be used instead of creating a new one.
|
|
931
|
-
*/
|
|
932
|
-
loadDataTable() {
|
|
982
|
+
loadDataProvider() {
|
|
983
|
+
this.dataProvider?.destroy();
|
|
933
984
|
this.querying.shouldBeUpdated = true;
|
|
934
|
-
|
|
935
|
-
this.
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
'afterDeleteRows',
|
|
951
|
-
'afterSetCell',
|
|
952
|
-
'afterSetColumns',
|
|
953
|
-
'afterSetRows'
|
|
954
|
-
].forEach((eventName) => {
|
|
955
|
-
this.dataTableEventDestructors.push(dt.on(eventName, () => {
|
|
956
|
-
this.querying.shouldBeUpdated = true;
|
|
957
|
-
}));
|
|
958
|
-
});
|
|
985
|
+
const userDT = this.options?.dataTable;
|
|
986
|
+
const dataOptions = this.options?.data ?? {
|
|
987
|
+
providerType: 'local',
|
|
988
|
+
dataTable: userDT ?? {}
|
|
989
|
+
};
|
|
990
|
+
// Just for the backward compatibility, remove in the future
|
|
991
|
+
if (dataOptions.providerType === 'local' &&
|
|
992
|
+
!dataOptions.dataTable && userDT) {
|
|
993
|
+
dataOptions.dataTable = 'clone' in userDT ?
|
|
994
|
+
userDT : new DataTable(userDT);
|
|
995
|
+
}
|
|
996
|
+
// End of backward compatibility snippet
|
|
997
|
+
const DataProviderConstructor = DataProviderRegistry.types[dataOptions.providerType ?? 'local'] ??
|
|
998
|
+
DataProviderRegistry.types.local;
|
|
999
|
+
this.dataProvider = new DataProviderConstructor(this.querying, dataOptions);
|
|
1000
|
+
return this.dataProvider;
|
|
959
1001
|
}
|
|
960
1002
|
/**
|
|
961
1003
|
* Extracts all references to columnIds on all levels below defined level
|
|
@@ -992,9 +1034,10 @@ export class Grid {
|
|
|
992
1034
|
* after destruction by calling the `render` method.
|
|
993
1035
|
*/
|
|
994
1036
|
destroy(onlyDOM = false) {
|
|
1037
|
+
fireEvent(this, 'beforeDestroy');
|
|
995
1038
|
this.isRendered = false;
|
|
996
1039
|
const dgIndex = Grid.grids.findIndex((dg) => dg === this);
|
|
997
|
-
this.
|
|
1040
|
+
this.dataProvider?.destroy();
|
|
998
1041
|
this.accessibility?.destroy();
|
|
999
1042
|
this.pagination?.destroy();
|
|
1000
1043
|
this.viewport?.destroy();
|
|
@@ -1045,6 +1088,11 @@ export class Grid {
|
|
|
1045
1088
|
/**
|
|
1046
1089
|
* Returns the grid data as a JSON string.
|
|
1047
1090
|
*
|
|
1091
|
+
* **Note:** This method only works with `LocalDataProvider`.
|
|
1092
|
+
* For other data providers, use your data source directly.
|
|
1093
|
+
*
|
|
1094
|
+
* @deprecated
|
|
1095
|
+
*
|
|
1048
1096
|
* @param modified
|
|
1049
1097
|
* Whether to return the modified data table (after filtering/sorting/etc.)
|
|
1050
1098
|
* or the unmodified, original one. Default value is set to `true`.
|
|
@@ -1053,7 +1101,14 @@ export class Grid {
|
|
|
1053
1101
|
* JSON representation of the data
|
|
1054
1102
|
*/
|
|
1055
1103
|
getData(modified = true) {
|
|
1056
|
-
|
|
1104
|
+
if (!this.dataProvider || !('getDataTable' in this.dataProvider)) {
|
|
1105
|
+
// eslint-disable-next-line no-console
|
|
1106
|
+
console.warn('getData() works only with LocalDataProvider.');
|
|
1107
|
+
return JSON.stringify({
|
|
1108
|
+
error: 'getData() works only with LocalDataProvider.'
|
|
1109
|
+
}, null, 2);
|
|
1110
|
+
}
|
|
1111
|
+
const dataTable = this.dataProvider.getDataTable(modified);
|
|
1057
1112
|
const tableColumns = dataTable?.columns;
|
|
1058
1113
|
const outputColumns = {};
|
|
1059
1114
|
if (!this.enabledColumns || !tableColumns) {
|
|
@@ -1095,12 +1150,35 @@ export class Grid {
|
|
|
1095
1150
|
* Grid options.
|
|
1096
1151
|
*/
|
|
1097
1152
|
getOptions(onlyUserOptions = true) {
|
|
1098
|
-
const options = onlyUserOptions ?
|
|
1099
|
-
|
|
1153
|
+
const options = onlyUserOptions ?
|
|
1154
|
+
merge(this.userOptions) :
|
|
1155
|
+
merge(this.options);
|
|
1156
|
+
// Keep `getOptions()` serializable:
|
|
1157
|
+
if (options.dataTable && 'clone' in options.dataTable) {
|
|
1100
1158
|
options.dataTable = {
|
|
1101
1159
|
columns: options.dataTable.columns
|
|
1102
1160
|
};
|
|
1103
1161
|
}
|
|
1162
|
+
if (options.data?.providerType === 'local') {
|
|
1163
|
+
if (options.data?.dataTable && 'clone' in options.data.dataTable) {
|
|
1164
|
+
options.data.columns = options.data.dataTable.columns;
|
|
1165
|
+
}
|
|
1166
|
+
if (options.data?.connector &&
|
|
1167
|
+
'initConverters' in options.data.connector) {
|
|
1168
|
+
options.data.connector = options.data.connector.options;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
// Clean up the column options by removing the ones that have no other
|
|
1172
|
+
// options than `id`:
|
|
1173
|
+
const oldColumnOptions = options.columns;
|
|
1174
|
+
if (oldColumnOptions) {
|
|
1175
|
+
options.columns = [];
|
|
1176
|
+
for (const columnOption of oldColumnOptions) {
|
|
1177
|
+
if (Object.keys(columnOption).length > 1) {
|
|
1178
|
+
options.columns.push(columnOption);
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1104
1182
|
return options;
|
|
1105
1183
|
}
|
|
1106
1184
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type CSSObject from '../../Core/Renderer/CSSObject';
|
|
1
2
|
/**
|
|
2
3
|
* The event object for the grid.
|
|
3
4
|
*/
|
|
@@ -28,6 +29,10 @@ export interface MakeHTMLElementParameters {
|
|
|
28
29
|
innerHTML?: string;
|
|
29
30
|
style?: Partial<CSSStyleDeclaration>;
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* A style object or callback returning one.
|
|
34
|
+
*/
|
|
35
|
+
export type StyleValue<T> = CSSObject | ((this: T, target: T) => CSSObject);
|
|
31
36
|
/**
|
|
32
37
|
* Creates a HTML element with the provided options.
|
|
33
38
|
*
|
|
@@ -105,6 +110,32 @@ export declare function createOptionsProxy<T extends object>(options: T, default
|
|
|
105
110
|
* @returns Formatted text
|
|
106
111
|
*/
|
|
107
112
|
export declare function formatText(template: string, values: Record<string, string | number>): string;
|
|
113
|
+
/**
|
|
114
|
+
* Resolves a style value that can be static or callback based.
|
|
115
|
+
*
|
|
116
|
+
* @param style
|
|
117
|
+
* Style object or callback returning one.
|
|
118
|
+
*
|
|
119
|
+
* @param target
|
|
120
|
+
* Runtime target used as callback context and first argument.
|
|
121
|
+
*
|
|
122
|
+
* @returns
|
|
123
|
+
* A resolved style object or `undefined`.
|
|
124
|
+
*/
|
|
125
|
+
export declare function resolveStyleValue<T>(style?: StyleValue<T>, target?: T): (CSSObject | undefined);
|
|
126
|
+
/**
|
|
127
|
+
* Resolves and merges style values in order.
|
|
128
|
+
*
|
|
129
|
+
* @param target
|
|
130
|
+
* Runtime target used as callback context and first argument.
|
|
131
|
+
*
|
|
132
|
+
* @param styleValues
|
|
133
|
+
* Style values to merge in order, where latter entries override former.
|
|
134
|
+
*
|
|
135
|
+
* @returns
|
|
136
|
+
* Merged style object.
|
|
137
|
+
*/
|
|
138
|
+
export declare function mergeStyleValues<T>(target: T, ...styleValues: Array<(StyleValue<T> | undefined)>): CSSObject;
|
|
108
139
|
declare const _default: {
|
|
109
140
|
readonly makeHTMLElement: typeof makeHTMLElement;
|
|
110
141
|
readonly makeDiv: typeof makeDiv;
|
|
@@ -113,5 +144,7 @@ declare const _default: {
|
|
|
113
144
|
readonly setHTMLContent: typeof setHTMLContent;
|
|
114
145
|
readonly createOptionsProxy: typeof createOptionsProxy;
|
|
115
146
|
readonly formatText: typeof formatText;
|
|
147
|
+
readonly resolveStyleValue: typeof resolveStyleValue;
|
|
148
|
+
readonly mergeStyleValues: typeof mergeStyleValues;
|
|
116
149
|
};
|
|
117
150
|
export default _default;
|