@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
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/* *
|
|
2
|
+
*
|
|
3
|
+
* Grid Query Serializer
|
|
4
|
+
*
|
|
5
|
+
* (c) 2020-2026 Highsoft AS
|
|
6
|
+
*
|
|
7
|
+
* A commercial license may be required depending on use.
|
|
8
|
+
* See www.highcharts.com/license
|
|
9
|
+
*
|
|
10
|
+
* Authors:
|
|
11
|
+
* - Dawid Dragula
|
|
12
|
+
*
|
|
13
|
+
* */
|
|
14
|
+
'use strict';
|
|
15
|
+
/* *
|
|
16
|
+
*
|
|
17
|
+
* Functions
|
|
18
|
+
*
|
|
19
|
+
* */
|
|
20
|
+
/**
|
|
21
|
+
* Creates a deterministic fingerprint of the current query state.
|
|
22
|
+
*
|
|
23
|
+
* @param input
|
|
24
|
+
* Minimal query-like object (duck-typed) containing sorting, filtering and
|
|
25
|
+
* pagination state.
|
|
26
|
+
*/
|
|
27
|
+
export function createQueryFingerprint(input) {
|
|
28
|
+
const sortingOptions = input.sorting.modifier?.options || null;
|
|
29
|
+
const filteringOptions = input.filtering.modifier?.options || null;
|
|
30
|
+
const paginationOptions = {
|
|
31
|
+
enabled: input.pagination.enabled,
|
|
32
|
+
currentPage: input.pagination.currentPage,
|
|
33
|
+
currentPageSize: input.pagination.currentPageSize
|
|
34
|
+
};
|
|
35
|
+
const sortingPart = serializeValue(sortingOptions);
|
|
36
|
+
const paginationPart = serializeValue(paginationOptions);
|
|
37
|
+
const filteringPart = serializeValue(filteringOptions);
|
|
38
|
+
const raw = `s=${sortingPart}|p=${paginationPart}|f=${filteringPart}`;
|
|
39
|
+
return hashString(raw);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Serializes function identity deterministically (name + hash of source).
|
|
43
|
+
*
|
|
44
|
+
* @param fn
|
|
45
|
+
* Function to serialize.
|
|
46
|
+
*/
|
|
47
|
+
function serializeFunction(fn) {
|
|
48
|
+
if (typeof fn !== 'function') {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
let src = '';
|
|
52
|
+
try {
|
|
53
|
+
src = Function.prototype.toString.call(fn);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
src = '';
|
|
57
|
+
}
|
|
58
|
+
return `fn:${fn.name || ''}:${hashString(src)}`;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Serializes a filter condition into a deterministic string.
|
|
62
|
+
*
|
|
63
|
+
* @param condition
|
|
64
|
+
* Filter condition (serializable object, callback, or primitive).
|
|
65
|
+
*/
|
|
66
|
+
export function serializeFilterCondition(condition) {
|
|
67
|
+
if (!condition) {
|
|
68
|
+
return '';
|
|
69
|
+
}
|
|
70
|
+
if (typeof condition === 'function') {
|
|
71
|
+
return serializeFunction(condition);
|
|
72
|
+
}
|
|
73
|
+
if (typeof condition !== 'object') {
|
|
74
|
+
return serializeValue(condition);
|
|
75
|
+
}
|
|
76
|
+
const c = condition;
|
|
77
|
+
const op = String(c.operator || '');
|
|
78
|
+
if (op === 'and' || op === 'or') {
|
|
79
|
+
const subs = Array.isArray(c.conditions) ? c.conditions : [];
|
|
80
|
+
const parts = subs
|
|
81
|
+
.map((sub) => serializeFilterCondition(sub))
|
|
82
|
+
.sort(); // Commutative -> stable
|
|
83
|
+
return `${op}(${parts.join(',')})`;
|
|
84
|
+
}
|
|
85
|
+
if (op === 'not') {
|
|
86
|
+
return `not(${serializeFilterCondition(c.condition)})`;
|
|
87
|
+
}
|
|
88
|
+
const col = serializeValue(c.columnId);
|
|
89
|
+
const val = serializeValue(c.value);
|
|
90
|
+
const ignoreCase = serializeValue(c.ignoreCase);
|
|
91
|
+
// Comparison / string condition
|
|
92
|
+
return `${op}:${col}:${val}:${ignoreCase}`;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Serializes an arbitrary value into a deterministic string.
|
|
96
|
+
*
|
|
97
|
+
* @param value
|
|
98
|
+
* Value to serialize.
|
|
99
|
+
*/
|
|
100
|
+
export function serializeValue(value) {
|
|
101
|
+
if (value === null) {
|
|
102
|
+
return 'null';
|
|
103
|
+
}
|
|
104
|
+
if (typeof value === 'undefined') {
|
|
105
|
+
return 'undef';
|
|
106
|
+
}
|
|
107
|
+
if (typeof value === 'string') {
|
|
108
|
+
// Escape to keep delimiters stable
|
|
109
|
+
return `str:${encodeURIComponent(value)}`;
|
|
110
|
+
}
|
|
111
|
+
if (typeof value === 'number') {
|
|
112
|
+
if (Number.isNaN(value)) {
|
|
113
|
+
return 'num:NaN';
|
|
114
|
+
}
|
|
115
|
+
if (value === Number.POSITIVE_INFINITY) {
|
|
116
|
+
return 'num:Infinity';
|
|
117
|
+
}
|
|
118
|
+
if (value === Number.NEGATIVE_INFINITY) {
|
|
119
|
+
return 'num:-Infinity';
|
|
120
|
+
}
|
|
121
|
+
return `num:${value}`;
|
|
122
|
+
}
|
|
123
|
+
if (typeof value === 'boolean') {
|
|
124
|
+
return value ? 'bool:1' : 'bool:0';
|
|
125
|
+
}
|
|
126
|
+
if (typeof value === 'bigint') {
|
|
127
|
+
return `big:${String(value)}`;
|
|
128
|
+
}
|
|
129
|
+
if (value instanceof Date) {
|
|
130
|
+
return `date:${value.toISOString()}`;
|
|
131
|
+
}
|
|
132
|
+
if (Array.isArray(value)) {
|
|
133
|
+
return `arr:[${value.map(serializeValue).join(',')}]`;
|
|
134
|
+
}
|
|
135
|
+
if (typeof value === 'function') {
|
|
136
|
+
const fn = value;
|
|
137
|
+
let src = '';
|
|
138
|
+
try {
|
|
139
|
+
src = Function.prototype.toString.call(fn);
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
src = '';
|
|
143
|
+
}
|
|
144
|
+
return `fn:${fn.name || ''}:${hashString(src)}`;
|
|
145
|
+
}
|
|
146
|
+
// Fallback: deterministic key order
|
|
147
|
+
const obj = value;
|
|
148
|
+
const keys = Object.keys(obj).sort();
|
|
149
|
+
const parts = [];
|
|
150
|
+
for (let i = 0, iEnd = keys.length; i < iEnd; ++i) {
|
|
151
|
+
const k = keys[i];
|
|
152
|
+
parts.push(`${encodeURIComponent(k)}=${serializeValue(obj[k])}`);
|
|
153
|
+
}
|
|
154
|
+
return `obj:{${parts.join(',')}}`;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Small deterministic hash for strings (djb2-ish), returned as base36.
|
|
158
|
+
*
|
|
159
|
+
* @param str
|
|
160
|
+
* String to hash.
|
|
161
|
+
*/
|
|
162
|
+
export function hashString(str) {
|
|
163
|
+
let hash = 5381;
|
|
164
|
+
for (let i = 0, iEnd = str.length; i < iEnd; ++i) {
|
|
165
|
+
hash = ((hash << 5) + hash) ^ str.charCodeAt(i);
|
|
166
|
+
}
|
|
167
|
+
// Convert to unsigned 32-bit and base36 for compactness
|
|
168
|
+
return (hash >>> 0).toString(36);
|
|
169
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { RowObject as RowObjectType, Column as DataTableColumnType, CellType as DataTableCellType } from '../../../Data/DataTable';
|
|
2
|
+
import type { DataProviderOptions, RowId } from '../../Core/Data/DataProvider';
|
|
3
|
+
import type { ColumnDataType } from '../../Core/Table/Column';
|
|
4
|
+
import type QueryingController from '../../Core/Querying/QueryingController';
|
|
5
|
+
import type { DataSourceOptions } from './DataSourceHelper';
|
|
6
|
+
import { DataProvider } from '../../Core/Data/DataProvider.js';
|
|
7
|
+
/**
|
|
8
|
+
* Remote data provider for the Grid.
|
|
9
|
+
*
|
|
10
|
+
* Fetches tabular data from a remote API in chunks and exposes it through the
|
|
11
|
+
* standard `DataProvider` interface used by the Grid viewport.
|
|
12
|
+
*
|
|
13
|
+
* - Caches fetched chunks (optionally with an LRU eviction policy).
|
|
14
|
+
* - Deduplicates concurrent requests for the same chunk.
|
|
15
|
+
* - Uses a query fingerprint to invalidate caches when the query changes.
|
|
16
|
+
*/
|
|
17
|
+
export declare class RemoteDataProvider extends DataProvider {
|
|
18
|
+
private static readonly DEFAULT_CHUNK_SIZE;
|
|
19
|
+
readonly options: RemoteDataProviderOptions;
|
|
20
|
+
/**
|
|
21
|
+
* Total row count before pagination (from API metadata `totalRowCount`).
|
|
22
|
+
*/
|
|
23
|
+
private prePaginationRowCount;
|
|
24
|
+
/**
|
|
25
|
+
* Current row count after pagination (actual rows returned in the chunk).
|
|
26
|
+
* When pagination is disabled, this equals prePaginationRowCount.
|
|
27
|
+
*/
|
|
28
|
+
private rowCount;
|
|
29
|
+
/**
|
|
30
|
+
* Array of column IDs that have been fetched from the remote server.
|
|
31
|
+
*/
|
|
32
|
+
private columnIds;
|
|
33
|
+
/**
|
|
34
|
+
* Cached chunks are used to store the data for the chunks that have been
|
|
35
|
+
* fetched from the remote server.
|
|
36
|
+
*/
|
|
37
|
+
private dataChunks;
|
|
38
|
+
/**
|
|
39
|
+
* Pending chunks are used to deduplicate concurrent requests for the same
|
|
40
|
+
* chunk.
|
|
41
|
+
*/
|
|
42
|
+
private pendingChunks;
|
|
43
|
+
/**
|
|
44
|
+
* Reverse lookup map from rowId to { chunkIndex, localIndex } for O(1)
|
|
45
|
+
* lookup in getRowIndex.
|
|
46
|
+
*/
|
|
47
|
+
private rowIdToChunkInfo;
|
|
48
|
+
/**
|
|
49
|
+
* Fingerprint of the last applied query; used to avoid clearing caches
|
|
50
|
+
* when the query did not actually change.
|
|
51
|
+
*/
|
|
52
|
+
private lastQueryFingerprint;
|
|
53
|
+
/**
|
|
54
|
+
* Epoch used to invalidate stale in-flight requests when the query changes.
|
|
55
|
+
*/
|
|
56
|
+
private requestEpoch;
|
|
57
|
+
/**
|
|
58
|
+
* Abort controllers for in-flight requests (latest-only policy).
|
|
59
|
+
*/
|
|
60
|
+
private pendingControllers;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the effective chunk size.
|
|
63
|
+
* When pagination is enabled, uses the page size as chunk size,
|
|
64
|
+
* so that one chunk = one page.
|
|
65
|
+
*/
|
|
66
|
+
private get maxChunkSize();
|
|
67
|
+
private get requestPolicy();
|
|
68
|
+
private abortPendingRequests;
|
|
69
|
+
private getChunkForRowIndex;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the chunk index for a given row index.
|
|
72
|
+
* When pagination is enabled, all rows are in chunk 0.
|
|
73
|
+
*
|
|
74
|
+
* @param rowIndex
|
|
75
|
+
* The row index passed from the grid.
|
|
76
|
+
*
|
|
77
|
+
* @returns
|
|
78
|
+
* The chunk index.
|
|
79
|
+
*/
|
|
80
|
+
private getChunkIndexForRow;
|
|
81
|
+
/**
|
|
82
|
+
* Gets the local index within the cached chunk data.
|
|
83
|
+
* When pagination is enabled, rowIndex is already 0-based within the page.
|
|
84
|
+
* When disabled, need to calculate offset within the chunk.
|
|
85
|
+
*
|
|
86
|
+
* @param rowIndex
|
|
87
|
+
* The row index passed from the grid.
|
|
88
|
+
*
|
|
89
|
+
* @returns
|
|
90
|
+
* The local index within the chunk.
|
|
91
|
+
*/
|
|
92
|
+
private getLocalIndexInChunk;
|
|
93
|
+
/**
|
|
94
|
+
* Evicts the least recently used chunk if the cache limit is reached.
|
|
95
|
+
* Also cleans up the reverse lookup map for evicted rowIds.
|
|
96
|
+
*/
|
|
97
|
+
private evictLRUChunkIfNeeded;
|
|
98
|
+
/**
|
|
99
|
+
* Fetches a chunk from the remote server and caches it.
|
|
100
|
+
* Deduplicates concurrent requests for the same chunk.
|
|
101
|
+
*
|
|
102
|
+
* @param chunkIndex
|
|
103
|
+
* The index of the chunk to fetch.
|
|
104
|
+
*
|
|
105
|
+
* @returns
|
|
106
|
+
* The cached chunk.
|
|
107
|
+
*/
|
|
108
|
+
private fetchChunk;
|
|
109
|
+
getColumnIds(): Promise<string[]>;
|
|
110
|
+
getRowId(rowIndex: number): Promise<RowId | undefined>;
|
|
111
|
+
getRowIndex(rowId: RowId): Promise<number | undefined>;
|
|
112
|
+
getRowObject(rowIndex: number): Promise<RowObjectType | undefined>;
|
|
113
|
+
getPrePaginationRowCount(): Promise<number>;
|
|
114
|
+
getRowCount(): Promise<number>;
|
|
115
|
+
getValue(columnId: string, rowIndex: number): Promise<DataTableCellType>;
|
|
116
|
+
setValue(value: DataTableCellType, columnId: string, rowId: RowId): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Gets a row object from the local cache without fetching.
|
|
119
|
+
* Returns undefined if the row is not cached.
|
|
120
|
+
*
|
|
121
|
+
* @param rowIndex
|
|
122
|
+
* The row index as passed from the grid.
|
|
123
|
+
*
|
|
124
|
+
* @returns
|
|
125
|
+
* The row object or undefined if not in cache.
|
|
126
|
+
*/
|
|
127
|
+
private getRowObjectFromCache;
|
|
128
|
+
getColumnDataType(columnId: string): Promise<ColumnDataType>;
|
|
129
|
+
applyQuery(): Promise<void>;
|
|
130
|
+
destroy(): void;
|
|
131
|
+
}
|
|
132
|
+
export interface RemoteFetchCallbackResult {
|
|
133
|
+
columns: Record<string, DataTableColumnType>;
|
|
134
|
+
totalRowCount: number;
|
|
135
|
+
rowIds?: RowId[];
|
|
136
|
+
}
|
|
137
|
+
export interface DataChunk {
|
|
138
|
+
index: number;
|
|
139
|
+
data: Record<string, DataTableColumnType>;
|
|
140
|
+
rowIds: RowId[];
|
|
141
|
+
}
|
|
142
|
+
export interface RemoteDataProviderOptions extends DataProviderOptions {
|
|
143
|
+
providerType: 'remote';
|
|
144
|
+
/**
|
|
145
|
+
* Serialized data source configuration, alternatively to `fetchCallback`.
|
|
146
|
+
*/
|
|
147
|
+
dataSource?: DataSourceOptions;
|
|
148
|
+
/**
|
|
149
|
+
* Custom callback to fetch data from the remote server. Has higher priority
|
|
150
|
+
* than `dataSource`.
|
|
151
|
+
*/
|
|
152
|
+
fetchCallback?: (this: RemoteDataProvider, query: QueryingController, offset: number, limit: number, signal?: AbortSignal) => Promise<RemoteFetchCallbackResult>;
|
|
153
|
+
/**
|
|
154
|
+
* Callback to persist value changes to the remote server. If not provided,
|
|
155
|
+
* cell value editing will not be possible.
|
|
156
|
+
*
|
|
157
|
+
* The callback receives the column ID, row ID and value to set.
|
|
158
|
+
*/
|
|
159
|
+
setValueCallback?: (this: RemoteDataProvider, columnId: string, rowId: RowId, value: DataTableCellType) => Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* The number of rows to fetch per chunk.
|
|
162
|
+
*/
|
|
163
|
+
chunkSize?: number;
|
|
164
|
+
/**
|
|
165
|
+
* Maximum number of chunks to keep in memory. When exceeded, the least
|
|
166
|
+
* recently used (LRU) chunk is evicted. If not set, all chunks are kept.
|
|
167
|
+
*/
|
|
168
|
+
chunksLimit?: number;
|
|
169
|
+
/**
|
|
170
|
+
* Request policy for rapid query changes. `latest` aborts or ignores
|
|
171
|
+
* in-flight requests so only the final query updates the cache.
|
|
172
|
+
* @default 'latest'
|
|
173
|
+
*/
|
|
174
|
+
requestPolicy?: 'latest' | 'all';
|
|
175
|
+
/**
|
|
176
|
+
* The column ID that contains the stable, unique row IDs. If not
|
|
177
|
+
* provided, the row IDs will be extracted from the `result.rowIds` property
|
|
178
|
+
* if available. If `result.rowIds` is also not defined, the row IDs will
|
|
179
|
+
* default to the indices of the rows in their display order.
|
|
180
|
+
*/
|
|
181
|
+
idColumn?: string;
|
|
182
|
+
}
|
|
183
|
+
declare module '../../Core/Data/DataProviderType' {
|
|
184
|
+
interface DataProviderTypeRegistry {
|
|
185
|
+
remote: typeof RemoteDataProvider;
|
|
186
|
+
}
|
|
187
|
+
}
|