@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,500 @@
|
|
|
1
|
+
/* *
|
|
2
|
+
*
|
|
3
|
+
* Remote Data Provider class
|
|
4
|
+
*
|
|
5
|
+
* (c) 2020-2025 Highsoft AS
|
|
6
|
+
*
|
|
7
|
+
* License: www.highcharts.com/license
|
|
8
|
+
*
|
|
9
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
10
|
+
*
|
|
11
|
+
* Authors:
|
|
12
|
+
* - Dawid Dragula
|
|
13
|
+
*
|
|
14
|
+
* */
|
|
15
|
+
'use strict';
|
|
16
|
+
import { DataProvider } from '../../Core/Data/DataProvider.js';
|
|
17
|
+
import DataProviderRegistry from '../../Core/Data/DataProviderRegistry.js';
|
|
18
|
+
import { createQueryFingerprint } from './QuerySerializer.js';
|
|
19
|
+
import { dataSourceFetch } from './DataSourceHelper.js';
|
|
20
|
+
/* *
|
|
21
|
+
*
|
|
22
|
+
* Class
|
|
23
|
+
*
|
|
24
|
+
* */
|
|
25
|
+
/**
|
|
26
|
+
* Remote data provider for the Grid.
|
|
27
|
+
*
|
|
28
|
+
* Fetches tabular data from a remote API in chunks and exposes it through the
|
|
29
|
+
* standard `DataProvider` interface used by the Grid viewport.
|
|
30
|
+
*
|
|
31
|
+
* - Caches fetched chunks (optionally with an LRU eviction policy).
|
|
32
|
+
* - Deduplicates concurrent requests for the same chunk.
|
|
33
|
+
* - Uses a query fingerprint to invalidate caches when the query changes.
|
|
34
|
+
*/
|
|
35
|
+
export class RemoteDataProvider extends DataProvider {
|
|
36
|
+
constructor() {
|
|
37
|
+
/* *
|
|
38
|
+
*
|
|
39
|
+
* Static Properties
|
|
40
|
+
*
|
|
41
|
+
* */
|
|
42
|
+
super(...arguments);
|
|
43
|
+
/**
|
|
44
|
+
* Total row count before pagination (from API metadata `totalRowCount`).
|
|
45
|
+
*/
|
|
46
|
+
this.prePaginationRowCount = null;
|
|
47
|
+
/**
|
|
48
|
+
* Current row count after pagination (actual rows returned in the chunk).
|
|
49
|
+
* When pagination is disabled, this equals prePaginationRowCount.
|
|
50
|
+
*/
|
|
51
|
+
this.rowCount = null;
|
|
52
|
+
/**
|
|
53
|
+
* Array of column IDs that have been fetched from the remote server.
|
|
54
|
+
*/
|
|
55
|
+
this.columnIds = null;
|
|
56
|
+
/**
|
|
57
|
+
* Cached chunks are used to store the data for the chunks that have been
|
|
58
|
+
* fetched from the remote server.
|
|
59
|
+
*/
|
|
60
|
+
this.dataChunks = null;
|
|
61
|
+
/**
|
|
62
|
+
* Pending chunks are used to deduplicate concurrent requests for the same
|
|
63
|
+
* chunk.
|
|
64
|
+
*/
|
|
65
|
+
this.pendingChunks = null;
|
|
66
|
+
/**
|
|
67
|
+
* Reverse lookup map from rowId to { chunkIndex, localIndex } for O(1)
|
|
68
|
+
* lookup in getRowIndex.
|
|
69
|
+
*/
|
|
70
|
+
this.rowIdToChunkInfo = null;
|
|
71
|
+
/**
|
|
72
|
+
* Fingerprint of the last applied query; used to avoid clearing caches
|
|
73
|
+
* when the query did not actually change.
|
|
74
|
+
*/
|
|
75
|
+
this.lastQueryFingerprint = null;
|
|
76
|
+
/**
|
|
77
|
+
* Epoch used to invalidate stale in-flight requests when the query changes.
|
|
78
|
+
*/
|
|
79
|
+
this.requestEpoch = 0;
|
|
80
|
+
/**
|
|
81
|
+
* Abort controllers for in-flight requests (latest-only policy).
|
|
82
|
+
*/
|
|
83
|
+
this.pendingControllers = new Set();
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Returns the effective chunk size.
|
|
87
|
+
* When pagination is enabled, uses the page size as chunk size,
|
|
88
|
+
* so that one chunk = one page.
|
|
89
|
+
*/
|
|
90
|
+
get maxChunkSize() {
|
|
91
|
+
const pagination = this.querying.pagination;
|
|
92
|
+
// When pagination is enabled, chunk size = page size
|
|
93
|
+
if (pagination.enabled) {
|
|
94
|
+
return pagination.currentPageSize;
|
|
95
|
+
}
|
|
96
|
+
return this.options.chunkSize ?? RemoteDataProvider.DEFAULT_CHUNK_SIZE;
|
|
97
|
+
}
|
|
98
|
+
/* *
|
|
99
|
+
*
|
|
100
|
+
* Methods
|
|
101
|
+
*
|
|
102
|
+
* */
|
|
103
|
+
get requestPolicy() {
|
|
104
|
+
return this.options.requestPolicy ?? 'latest';
|
|
105
|
+
}
|
|
106
|
+
abortPendingRequests() {
|
|
107
|
+
for (const controller of this.pendingControllers) {
|
|
108
|
+
controller.abort();
|
|
109
|
+
}
|
|
110
|
+
this.pendingControllers.clear();
|
|
111
|
+
}
|
|
112
|
+
async getChunkForRowIndex(rowIndex) {
|
|
113
|
+
// When pagination enabled, all rows for current page are in chunk 0
|
|
114
|
+
// When disabled, calculate chunk from global index
|
|
115
|
+
if (this.querying.pagination.enabled) {
|
|
116
|
+
return await this.fetchChunk(0);
|
|
117
|
+
}
|
|
118
|
+
const chunkIndex = Math.floor(rowIndex / this.maxChunkSize);
|
|
119
|
+
return await this.fetchChunk(chunkIndex);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Gets the chunk index for a given row index.
|
|
123
|
+
* When pagination is enabled, all rows are in chunk 0.
|
|
124
|
+
*
|
|
125
|
+
* @param rowIndex
|
|
126
|
+
* The row index passed from the grid.
|
|
127
|
+
*
|
|
128
|
+
* @returns
|
|
129
|
+
* The chunk index.
|
|
130
|
+
*/
|
|
131
|
+
getChunkIndexForRow(rowIndex) {
|
|
132
|
+
if (this.querying.pagination.enabled) {
|
|
133
|
+
return 0;
|
|
134
|
+
}
|
|
135
|
+
return Math.floor(rowIndex / this.maxChunkSize);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Gets the local index within the cached chunk data.
|
|
139
|
+
* When pagination is enabled, rowIndex is already 0-based within the page.
|
|
140
|
+
* When disabled, need to calculate offset within the chunk.
|
|
141
|
+
*
|
|
142
|
+
* @param rowIndex
|
|
143
|
+
* The row index passed from the grid.
|
|
144
|
+
*
|
|
145
|
+
* @returns
|
|
146
|
+
* The local index within the chunk.
|
|
147
|
+
*/
|
|
148
|
+
getLocalIndexInChunk(rowIndex) {
|
|
149
|
+
// When pagination enabled, rowIndex is already page-relative
|
|
150
|
+
if (this.querying.pagination.enabled) {
|
|
151
|
+
return rowIndex;
|
|
152
|
+
}
|
|
153
|
+
// Standard chunking: calculate local offset within chunk
|
|
154
|
+
const chunkIndex = Math.floor(rowIndex / this.maxChunkSize);
|
|
155
|
+
return rowIndex - (chunkIndex * this.maxChunkSize);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Evicts the least recently used chunk if the cache limit is reached.
|
|
159
|
+
* Also cleans up the reverse lookup map for evicted rowIds.
|
|
160
|
+
*/
|
|
161
|
+
evictLRUChunkIfNeeded() {
|
|
162
|
+
const { chunksLimit } = this.options;
|
|
163
|
+
if (!chunksLimit ||
|
|
164
|
+
!this.dataChunks ||
|
|
165
|
+
this.dataChunks.size < chunksLimit) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
// Get the first (oldest/LRU) chunk
|
|
169
|
+
const oldestKey = this.dataChunks.keys().next().value;
|
|
170
|
+
if (oldestKey === void 0) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const oldestChunk = this.dataChunks.get(oldestKey);
|
|
174
|
+
// Clean up reverse lookup map for evicted chunk's rowIds
|
|
175
|
+
if (oldestChunk && this.rowIdToChunkInfo) {
|
|
176
|
+
for (const rowId of oldestChunk.rowIds) {
|
|
177
|
+
this.rowIdToChunkInfo.delete(rowId);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
this.dataChunks.delete(oldestKey);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Fetches a chunk from the remote server and caches it.
|
|
184
|
+
* Deduplicates concurrent requests for the same chunk.
|
|
185
|
+
*
|
|
186
|
+
* @param chunkIndex
|
|
187
|
+
* The index of the chunk to fetch.
|
|
188
|
+
*
|
|
189
|
+
* @returns
|
|
190
|
+
* The cached chunk.
|
|
191
|
+
*/
|
|
192
|
+
async fetchChunk(chunkIndex) {
|
|
193
|
+
if (!this.dataChunks) {
|
|
194
|
+
this.dataChunks = new Map();
|
|
195
|
+
}
|
|
196
|
+
// Check if chunk is already cached (with LRU update)
|
|
197
|
+
const existingChunk = this.dataChunks.get(chunkIndex);
|
|
198
|
+
if (existingChunk) {
|
|
199
|
+
// Move to end (most recently used) by re-inserting
|
|
200
|
+
this.dataChunks.delete(chunkIndex);
|
|
201
|
+
this.dataChunks.set(chunkIndex, existingChunk);
|
|
202
|
+
return existingChunk;
|
|
203
|
+
}
|
|
204
|
+
// Check if there's already a pending request for this chunk
|
|
205
|
+
if (!this.pendingChunks) {
|
|
206
|
+
this.pendingChunks = new Map();
|
|
207
|
+
}
|
|
208
|
+
if (this.pendingChunks.has(chunkIndex)) {
|
|
209
|
+
// Return the existing pending request to avoid duplicate fetches
|
|
210
|
+
const pendingRequest = this.pendingChunks.get(chunkIndex);
|
|
211
|
+
return pendingRequest;
|
|
212
|
+
}
|
|
213
|
+
// Start a new fetch
|
|
214
|
+
const requestEpoch = this.requestEpoch;
|
|
215
|
+
const controller = this.requestPolicy === 'latest' ?
|
|
216
|
+
new AbortController() :
|
|
217
|
+
null;
|
|
218
|
+
if (controller) {
|
|
219
|
+
this.pendingControllers.add(controller);
|
|
220
|
+
}
|
|
221
|
+
const fetchPromise = (async () => {
|
|
222
|
+
try {
|
|
223
|
+
const pagination = this.querying.pagination;
|
|
224
|
+
let offset;
|
|
225
|
+
let limit;
|
|
226
|
+
if (pagination.enabled) {
|
|
227
|
+
// When pagination is enabled, fetch the current page
|
|
228
|
+
offset = (pagination.currentPage - 1) *
|
|
229
|
+
pagination.currentPageSize;
|
|
230
|
+
limit = pagination.currentPageSize;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
// Standard chunking
|
|
234
|
+
offset = chunkIndex * this.maxChunkSize;
|
|
235
|
+
limit = this.maxChunkSize;
|
|
236
|
+
}
|
|
237
|
+
let result;
|
|
238
|
+
const { fetchCallback, dataSource } = this.options;
|
|
239
|
+
if (fetchCallback) {
|
|
240
|
+
result = await fetchCallback.call(this, this.querying, offset, limit, controller?.signal);
|
|
241
|
+
}
|
|
242
|
+
else if (dataSource) {
|
|
243
|
+
result = await dataSourceFetch(dataSource, {
|
|
244
|
+
query: this.querying,
|
|
245
|
+
offset,
|
|
246
|
+
limit,
|
|
247
|
+
signal: controller?.signal
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
throw new Error('RemoteDataProvider: Either `dataSource` or ' +
|
|
252
|
+
'`fetchCallback` must be provided in options.');
|
|
253
|
+
}
|
|
254
|
+
if (requestEpoch !== this.requestEpoch ||
|
|
255
|
+
controller?.signal.aborted) {
|
|
256
|
+
return {
|
|
257
|
+
index: chunkIndex,
|
|
258
|
+
data: {},
|
|
259
|
+
rowIds: []
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
this.columnIds = Object.keys(result.columns);
|
|
263
|
+
this.prePaginationRowCount = result.totalRowCount;
|
|
264
|
+
// Calculate actual row count from returned data
|
|
265
|
+
const firstColumn = result.columns[this.columnIds[0]];
|
|
266
|
+
const chunkRowCount = firstColumn ? firstColumn.length : 0;
|
|
267
|
+
// When pagination enabled: rowCount = actual rows on page
|
|
268
|
+
// When disabled: rowCount = prePaginationRowCount (same value)
|
|
269
|
+
if (pagination.enabled) {
|
|
270
|
+
this.rowCount = chunkRowCount;
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
this.rowCount = result.totalRowCount;
|
|
274
|
+
}
|
|
275
|
+
const idColId = this.options.idColumn;
|
|
276
|
+
let idColumn;
|
|
277
|
+
if (idColId) {
|
|
278
|
+
idColumn = result.columns[idColId];
|
|
279
|
+
}
|
|
280
|
+
if (!idColumn) {
|
|
281
|
+
idColumn = result.rowIds ?? Array.from({ length: chunkRowCount }, (_, i) => i + offset);
|
|
282
|
+
}
|
|
283
|
+
const chunk = {
|
|
284
|
+
index: chunkIndex,
|
|
285
|
+
data: result.columns,
|
|
286
|
+
rowIds: idColumn
|
|
287
|
+
};
|
|
288
|
+
// Evict LRU chunk if limit is reached
|
|
289
|
+
this.evictLRUChunkIfNeeded();
|
|
290
|
+
// DataChunks guaranteed to exist (checked at start)
|
|
291
|
+
this.dataChunks?.set(chunkIndex, chunk);
|
|
292
|
+
// Populate reverse lookup map for getRowIndex
|
|
293
|
+
if (!this.rowIdToChunkInfo) {
|
|
294
|
+
this.rowIdToChunkInfo = new Map();
|
|
295
|
+
}
|
|
296
|
+
for (let i = 0; i < chunk.rowIds.length; i++) {
|
|
297
|
+
this.rowIdToChunkInfo.set(chunk.rowIds[i], {
|
|
298
|
+
chunkIndex,
|
|
299
|
+
localIndex: i
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
return chunk;
|
|
303
|
+
}
|
|
304
|
+
catch (err) {
|
|
305
|
+
if (controller?.signal.aborted ||
|
|
306
|
+
(err instanceof DOMException && err.name === 'AbortError')) {
|
|
307
|
+
return {
|
|
308
|
+
index: chunkIndex,
|
|
309
|
+
data: {},
|
|
310
|
+
rowIds: []
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
// eslint-disable-next-line no-console
|
|
314
|
+
console.error('Error fetching data from remote server.\n', err);
|
|
315
|
+
return {
|
|
316
|
+
index: chunkIndex,
|
|
317
|
+
data: {},
|
|
318
|
+
rowIds: []
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
finally {
|
|
322
|
+
// Remove from pending requests when done (success or error)
|
|
323
|
+
this.pendingChunks?.delete(chunkIndex);
|
|
324
|
+
if (controller) {
|
|
325
|
+
this.pendingControllers.delete(controller);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
})();
|
|
329
|
+
// Store the pending request
|
|
330
|
+
this.pendingChunks.set(chunkIndex, fetchPromise);
|
|
331
|
+
return fetchPromise;
|
|
332
|
+
}
|
|
333
|
+
async getColumnIds() {
|
|
334
|
+
if (this.columnIds) {
|
|
335
|
+
return Promise.resolve(this.columnIds);
|
|
336
|
+
}
|
|
337
|
+
// Fetch first chunk to get columnIds
|
|
338
|
+
await this.fetchChunk(0);
|
|
339
|
+
return this.columnIds ?? [];
|
|
340
|
+
}
|
|
341
|
+
async getRowId(rowIndex) {
|
|
342
|
+
const chunk = await this.getChunkForRowIndex(rowIndex);
|
|
343
|
+
const localIndex = this.getLocalIndexInChunk(rowIndex);
|
|
344
|
+
if (localIndex < chunk.rowIds.length) {
|
|
345
|
+
return chunk.rowIds[localIndex];
|
|
346
|
+
}
|
|
347
|
+
return void 0;
|
|
348
|
+
}
|
|
349
|
+
getRowIndex(rowId) {
|
|
350
|
+
// Check reverse lookup map (O(1))
|
|
351
|
+
const info = this.rowIdToChunkInfo?.get(rowId);
|
|
352
|
+
if (info) {
|
|
353
|
+
if (this.querying.pagination.enabled) {
|
|
354
|
+
// When pagination is enabled, return page-relative index
|
|
355
|
+
return Promise.resolve(info.localIndex);
|
|
356
|
+
}
|
|
357
|
+
// Global index: chunk offset + local index
|
|
358
|
+
return Promise.resolve(info.chunkIndex * this.maxChunkSize + info.localIndex);
|
|
359
|
+
}
|
|
360
|
+
// Not found in cached chunks - return undefined
|
|
361
|
+
// (the chunk containing this rowId hasn't been fetched yet)
|
|
362
|
+
return Promise.resolve(void 0);
|
|
363
|
+
}
|
|
364
|
+
async getRowObject(rowIndex) {
|
|
365
|
+
// Ensure the chunk is fetched and cached
|
|
366
|
+
await this.getChunkForRowIndex(rowIndex);
|
|
367
|
+
// Return from cache
|
|
368
|
+
return this.getRowObjectFromCache(rowIndex);
|
|
369
|
+
}
|
|
370
|
+
async getPrePaginationRowCount() {
|
|
371
|
+
if (this.prePaginationRowCount !== null) {
|
|
372
|
+
return this.prePaginationRowCount;
|
|
373
|
+
}
|
|
374
|
+
// Fetch first chunk to get row count from API metadata
|
|
375
|
+
await this.fetchChunk(0);
|
|
376
|
+
return this.prePaginationRowCount ?? 0;
|
|
377
|
+
}
|
|
378
|
+
async getRowCount() {
|
|
379
|
+
if (this.rowCount !== null) {
|
|
380
|
+
return this.rowCount;
|
|
381
|
+
}
|
|
382
|
+
// Fetch first chunk to get row count
|
|
383
|
+
await this.fetchChunk(0);
|
|
384
|
+
return this.rowCount ?? 0;
|
|
385
|
+
}
|
|
386
|
+
async getValue(columnId, rowIndex) {
|
|
387
|
+
// Get the chunk containing this row
|
|
388
|
+
const chunk = await this.getChunkForRowIndex(rowIndex);
|
|
389
|
+
// Calculate local index within the chunk.
|
|
390
|
+
// When pagination is enabled, rowIndex is already page-relative.
|
|
391
|
+
// When disabled, need to calculate from global index.
|
|
392
|
+
const localIndex = this.getLocalIndexInChunk(rowIndex);
|
|
393
|
+
// Get the column from chunk data
|
|
394
|
+
const column = chunk.data[columnId];
|
|
395
|
+
if (!column || localIndex >= column.length) {
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
return column[localIndex];
|
|
399
|
+
}
|
|
400
|
+
async setValue(value, columnId, rowId) {
|
|
401
|
+
const { setValueCallback } = this.options;
|
|
402
|
+
if (!setValueCallback) {
|
|
403
|
+
throw new Error('The `setValueCallback` option is not defined.');
|
|
404
|
+
}
|
|
405
|
+
try {
|
|
406
|
+
await setValueCallback.call(this, columnId, rowId, value);
|
|
407
|
+
this.lastQueryFingerprint = null;
|
|
408
|
+
// TODO(optim): Can be optimized by checking if the value was
|
|
409
|
+
// changed in the specific, queried column.
|
|
410
|
+
await this.applyQuery();
|
|
411
|
+
}
|
|
412
|
+
catch (err) {
|
|
413
|
+
const prefix = 'Error persisting value to remote server.';
|
|
414
|
+
if (err instanceof Error) {
|
|
415
|
+
err.message = err.message ?
|
|
416
|
+
`${prefix} ${err.message}` :
|
|
417
|
+
prefix;
|
|
418
|
+
throw err;
|
|
419
|
+
}
|
|
420
|
+
throw new Error(`${prefix} ${String(err)}`);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Gets a row object from the local cache without fetching.
|
|
425
|
+
* Returns undefined if the row is not cached.
|
|
426
|
+
*
|
|
427
|
+
* @param rowIndex
|
|
428
|
+
* The row index as passed from the grid.
|
|
429
|
+
*
|
|
430
|
+
* @returns
|
|
431
|
+
* The row object or undefined if not in cache.
|
|
432
|
+
*/
|
|
433
|
+
getRowObjectFromCache(rowIndex) {
|
|
434
|
+
if (!this.dataChunks || !this.columnIds) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
const chunkIndex = this.getChunkIndexForRow(rowIndex);
|
|
438
|
+
const chunk = this.dataChunks.get(chunkIndex);
|
|
439
|
+
if (!chunk) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
const localIndex = this.getLocalIndexInChunk(rowIndex);
|
|
443
|
+
const rowObject = {};
|
|
444
|
+
for (const columnId of this.columnIds) {
|
|
445
|
+
const column = chunk.data[columnId];
|
|
446
|
+
rowObject[columnId] = (column && localIndex < column.length) ?
|
|
447
|
+
column[localIndex] : null;
|
|
448
|
+
}
|
|
449
|
+
return rowObject;
|
|
450
|
+
}
|
|
451
|
+
async getColumnDataType(columnId) {
|
|
452
|
+
const chunk = await this.getChunkForRowIndex(0);
|
|
453
|
+
const column = chunk.data[columnId];
|
|
454
|
+
if (!column) {
|
|
455
|
+
return 'string';
|
|
456
|
+
}
|
|
457
|
+
if (!Array.isArray(column)) {
|
|
458
|
+
// Typed array
|
|
459
|
+
return 'number';
|
|
460
|
+
}
|
|
461
|
+
return DataProvider.assumeColumnDataType(column.slice(0, 30), columnId);
|
|
462
|
+
}
|
|
463
|
+
async applyQuery() {
|
|
464
|
+
const fingerprint = createQueryFingerprint(this.querying);
|
|
465
|
+
if (this.lastQueryFingerprint === fingerprint) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
this.lastQueryFingerprint = fingerprint;
|
|
469
|
+
this.requestEpoch++;
|
|
470
|
+
if (this.requestPolicy === 'latest') {
|
|
471
|
+
this.abortPendingRequests();
|
|
472
|
+
}
|
|
473
|
+
// Clear cached chunks when query changes.
|
|
474
|
+
this.dataChunks = null;
|
|
475
|
+
this.pendingChunks = null;
|
|
476
|
+
this.rowIdToChunkInfo = null;
|
|
477
|
+
this.columnIds = null;
|
|
478
|
+
this.prePaginationRowCount = null;
|
|
479
|
+
this.rowCount = null;
|
|
480
|
+
// When pagination is enabled, update the total items count
|
|
481
|
+
// for the pagination controller (used to calculate total pages).
|
|
482
|
+
if (this.querying.pagination.enabled) {
|
|
483
|
+
const totalCount = await this.getPrePaginationRowCount();
|
|
484
|
+
this.querying.pagination.totalItemsCount = totalCount;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
destroy() {
|
|
488
|
+
this.abortPendingRequests();
|
|
489
|
+
this.dataChunks = null;
|
|
490
|
+
this.pendingChunks = null;
|
|
491
|
+
this.rowIdToChunkInfo = null;
|
|
492
|
+
this.columnIds = null;
|
|
493
|
+
this.prePaginationRowCount = null;
|
|
494
|
+
this.rowCount = null;
|
|
495
|
+
this.lastQueryFingerprint = null;
|
|
496
|
+
this.requestEpoch++;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
RemoteDataProvider.DEFAULT_CHUNK_SIZE = 50;
|
|
500
|
+
DataProviderRegistry.registerDataProvider('remote', RemoteDataProvider);
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
* */
|
|
15
15
|
'use strict';
|
|
16
16
|
import { downloadURL, getBlobFromContent } from '../../../Shared/DownloadURL.js';
|
|
17
|
-
import
|
|
18
|
-
const { defined } = U;
|
|
17
|
+
import { defined } from '../../../Shared/Utilities.js';
|
|
19
18
|
/* *
|
|
20
19
|
*
|
|
21
20
|
* Class
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
import { defaultOptions } from '../../Core/Defaults.js';
|
|
17
17
|
import Exporting from './Exporting.js';
|
|
18
18
|
import Globals from '../../Core/Globals.js';
|
|
19
|
-
import
|
|
20
|
-
const { addEvent, pushUnique } = U;
|
|
19
|
+
import { addEvent, pushUnique } from '../../../Shared/Utilities.js';
|
|
21
20
|
/* *
|
|
22
21
|
*
|
|
23
22
|
* Composition
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
*
|
|
12
12
|
* */
|
|
13
13
|
'use strict';
|
|
14
|
-
import U from '../../Core/Utilities.js';
|
|
15
14
|
import Globals from '../../Core/Globals.js';
|
|
16
|
-
|
|
15
|
+
import { addEvent, fireEvent, pushUnique } from '../../Shared/Utilities.js';
|
|
17
16
|
const propagate = {
|
|
18
17
|
'cell_mouseOver': function () {
|
|
19
18
|
fireEvent(this.row.viewport.grid, 'cellMouseOver', {
|
|
@@ -13,9 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* */
|
|
15
15
|
'use strict';
|
|
16
|
-
import Utilities from '../../../Core/Utilities.js';
|
|
17
16
|
import Globals from '../../../Core/Globals.js';
|
|
18
|
-
|
|
17
|
+
import { addEvent, pushUnique } from '../../../Shared/Utilities.js';
|
|
19
18
|
/* *
|
|
20
19
|
*
|
|
21
20
|
* Composition
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
'use strict';
|
|
12
12
|
import H from '../Core/Globals.js';
|
|
13
13
|
const { pageLang, win } = H;
|
|
14
|
-
import
|
|
15
|
-
|
|
14
|
+
import { defined, extend, isObject, isNumber, isString, merge, objectEach, pad, splat, ucfirst } from './Utilities.js';
|
|
15
|
+
import { error, timeUnits } from '../Core/Utilities.js';
|
|
16
16
|
/* *
|
|
17
17
|
*
|
|
18
18
|
* Constants
|
|
@@ -578,7 +578,7 @@ class TimeBase {
|
|
|
578
578
|
// Regex would do it in one line, but this is faster
|
|
579
579
|
while (format.indexOf('%' + key) !== -1) {
|
|
580
580
|
format = format.replace('%' + key, typeof val === 'function' ?
|
|
581
|
-
val.call(time, timestamp) :
|
|
581
|
+
val.call(time, timestamp, time) :
|
|
582
582
|
val);
|
|
583
583
|
}
|
|
584
584
|
}
|
|
@@ -47,3 +47,10 @@ export type TypedArrayConstructor = (
|
|
|
47
47
|
Int16ArrayConstructor|Uint16ArrayConstructor|Int32ArrayConstructor|
|
|
48
48
|
Uint32ArrayConstructor|Float32ArrayConstructor|Float64ArrayConstructor
|
|
49
49
|
);
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Make specified properties optional in a union of object types, without
|
|
53
|
+
* losing the union.
|
|
54
|
+
*/
|
|
55
|
+
export type MakeOptional<T extends object, K extends keyof T> =
|
|
56
|
+
T extends unknown ? Omit<T, K> & Partial<Pick<T, K>> : never;
|