@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
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
* */
|
|
16
16
|
'use strict';
|
|
17
17
|
import GridUtils from '../GridUtils.js';
|
|
18
|
-
import Utils from '../../../Core/Utilities.js';
|
|
19
18
|
import ColumnResizing from './ColumnResizing/ColumnResizing.js';
|
|
20
19
|
import Column from './Column.js';
|
|
21
20
|
import TableHeader from './Header/TableHeader.js';
|
|
22
21
|
import RowsVirtualizer from './Actions/RowsVirtualizer.js';
|
|
23
22
|
import ColumnsResizer from './Actions/ColumnsResizer.js';
|
|
24
23
|
import Globals from '../Globals.js';
|
|
24
|
+
import { defined, fireEvent, getStyle } from '../../../Shared/Utilities.js';
|
|
25
|
+
import CellContextMenu from './Body/CellContextMenu.js';
|
|
25
26
|
const { makeHTMLElement } = GridUtils;
|
|
26
|
-
const { fireEvent, getStyle, defined } = Utils;
|
|
27
27
|
/* *
|
|
28
28
|
*
|
|
29
29
|
* Class
|
|
@@ -56,6 +56,10 @@ class Table {
|
|
|
56
56
|
* The visible rows of the table.
|
|
57
57
|
*/
|
|
58
58
|
this.rows = [];
|
|
59
|
+
/**
|
|
60
|
+
* The flag that indicates if the table rows are virtualized.
|
|
61
|
+
*/
|
|
62
|
+
this.virtualRows = true;
|
|
59
63
|
/**
|
|
60
64
|
* Handles the focus event on the table body.
|
|
61
65
|
*
|
|
@@ -78,7 +82,7 @@ class Table {
|
|
|
78
82
|
*/
|
|
79
83
|
this.onScroll = () => {
|
|
80
84
|
if (this.virtualRows) {
|
|
81
|
-
this.rowsVirtualizer.scroll();
|
|
85
|
+
void this.rowsVirtualizer.scroll();
|
|
82
86
|
}
|
|
83
87
|
this.header?.scrollHorizontally(this.tbodyElement.scrollLeft);
|
|
84
88
|
};
|
|
@@ -103,6 +107,20 @@ class Table {
|
|
|
103
107
|
cell.onDblClick(e);
|
|
104
108
|
}
|
|
105
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* Delegated context menu handler for cells.
|
|
112
|
+
* @param e Mouse event
|
|
113
|
+
*/
|
|
114
|
+
this.onCellContextMenu = (e) => {
|
|
115
|
+
const cell = this.getCellFromElement(e.target);
|
|
116
|
+
if (!cell || !('column' in cell) || !('row' in cell)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const tableCell = cell;
|
|
120
|
+
if (this.openCellContextMenu(tableCell, e.clientX, e.clientY)) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
106
124
|
/**
|
|
107
125
|
* Delegated mousedown handler for cells.
|
|
108
126
|
* @param e Mouse event
|
|
@@ -139,37 +157,38 @@ class Table {
|
|
|
139
157
|
*/
|
|
140
158
|
this.onCellKeyDown = (e) => {
|
|
141
159
|
const cell = this.getCellFromElement(e.target);
|
|
142
|
-
if (cell) {
|
|
143
|
-
|
|
160
|
+
if (!cell) {
|
|
161
|
+
return;
|
|
144
162
|
}
|
|
163
|
+
// Disabled until meaningful functionality is ready.
|
|
164
|
+
// const isContextMenuKey = (
|
|
165
|
+
// e.key === 'ContextMenu' || (e.key === 'F10' && e.shiftKey)
|
|
166
|
+
// );
|
|
167
|
+
// if (isContextMenuKey && 'column' in cell && 'row' in cell) {
|
|
168
|
+
// const tableCell = cell as TableCell;
|
|
169
|
+
// const rect = tableCell.htmlElement.getBoundingClientRect();
|
|
170
|
+
// const opened = this.openCellContextMenu(
|
|
171
|
+
// tableCell,
|
|
172
|
+
// rect.left + 4,
|
|
173
|
+
// rect.bottom - 2
|
|
174
|
+
// );
|
|
175
|
+
// if (opened) {
|
|
176
|
+
// e.preventDefault();
|
|
177
|
+
// e.stopPropagation();
|
|
178
|
+
// return;
|
|
179
|
+
// }
|
|
180
|
+
// }
|
|
181
|
+
cell.onKeyDown(e);
|
|
145
182
|
};
|
|
146
183
|
this.grid = grid;
|
|
147
184
|
this.tableElement = tableElement;
|
|
148
|
-
this.dataTable = this.grid.presentationTable;
|
|
149
|
-
const dgOptions = grid.options;
|
|
150
|
-
const customClassName = dgOptions?.rendering?.table?.className;
|
|
151
185
|
this.columnResizing = ColumnResizing.initMode(this);
|
|
152
|
-
if (
|
|
186
|
+
if (grid.options?.rendering?.header?.enabled) {
|
|
153
187
|
this.theadElement = makeHTMLElement('thead', {}, tableElement);
|
|
154
188
|
}
|
|
155
189
|
this.tbodyElement = makeHTMLElement('tbody', {}, tableElement);
|
|
156
|
-
if (dgOptions?.rendering?.columns?.resizing?.enabled) {
|
|
157
|
-
this.columnsResizer = new ColumnsResizer(this);
|
|
158
|
-
}
|
|
159
|
-
if (customClassName) {
|
|
160
|
-
tableElement.classList.add(...customClassName.split(/\s+/g));
|
|
161
|
-
}
|
|
162
|
-
tableElement.classList.add(Globals.getClassName('scrollableContent'));
|
|
163
|
-
// Load columns
|
|
164
|
-
this.loadColumns();
|
|
165
|
-
// Virtualization
|
|
166
|
-
this.virtualRows = this.shouldVirtualizeRows();
|
|
167
|
-
if (this.virtualRows) {
|
|
168
|
-
tableElement.classList.add(Globals.getClassName('virtualization'));
|
|
169
|
-
}
|
|
170
190
|
this.rowsVirtualizer = new RowsVirtualizer(this);
|
|
171
|
-
|
|
172
|
-
this.init();
|
|
191
|
+
fireEvent(this, 'beforeInit');
|
|
173
192
|
// Add event listeners
|
|
174
193
|
this.resizeObserver = new ResizeObserver(this.onResize);
|
|
175
194
|
this.resizeObserver.observe(tableElement);
|
|
@@ -178,6 +197,7 @@ class Table {
|
|
|
178
197
|
// Delegated cell events
|
|
179
198
|
this.tbodyElement.addEventListener('click', this.onCellClick);
|
|
180
199
|
this.tbodyElement.addEventListener('dblclick', this.onCellDblClick);
|
|
200
|
+
this.tbodyElement.addEventListener('contextmenu', this.onCellContextMenu);
|
|
181
201
|
this.tbodyElement.addEventListener('mousedown', this.onCellMouseDown);
|
|
182
202
|
this.tbodyElement.addEventListener('mouseover', this.onCellMouseOver);
|
|
183
203
|
this.tbodyElement.addEventListener('mouseout', this.onCellMouseOut);
|
|
@@ -189,21 +209,55 @@ class Table {
|
|
|
189
209
|
*
|
|
190
210
|
* */
|
|
191
211
|
/**
|
|
192
|
-
*
|
|
212
|
+
* The presentation version of the data table. It has applied modifiers
|
|
213
|
+
* and is ready to be rendered.
|
|
214
|
+
*
|
|
215
|
+
* @deprecated Use `grid.dataProvider` instead.
|
|
193
216
|
*/
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
217
|
+
get dataTable() {
|
|
218
|
+
const dp = this.grid.dataProvider;
|
|
219
|
+
if (dp && 'getDataTable' in dp) {
|
|
220
|
+
return dp.getDataTable(true);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Initializes the table. Should be called after creation so that the table
|
|
225
|
+
* can be asynchronously initialized.
|
|
226
|
+
*/
|
|
227
|
+
async init() {
|
|
228
|
+
try {
|
|
229
|
+
this.grid.showLoading();
|
|
230
|
+
const { tableElement } = this;
|
|
231
|
+
const renderingOptions = this.grid.options?.rendering;
|
|
232
|
+
const customClassName = renderingOptions?.table?.className;
|
|
233
|
+
this.virtualRows = await this.shouldVirtualizeRows();
|
|
234
|
+
if (this.virtualRows) {
|
|
235
|
+
tableElement.classList.add(Globals.getClassName('virtualization'));
|
|
236
|
+
}
|
|
237
|
+
if (renderingOptions?.columns?.resizing?.enabled) {
|
|
238
|
+
this.columnsResizer = new ColumnsResizer(this);
|
|
239
|
+
}
|
|
240
|
+
if (customClassName) {
|
|
241
|
+
tableElement.classList.add(...customClassName.split(/\s+/g));
|
|
242
|
+
}
|
|
243
|
+
tableElement.classList.add(Globals.getClassName('scrollableContent'));
|
|
244
|
+
await this.loadColumns();
|
|
245
|
+
this.setTbodyMinHeight();
|
|
246
|
+
// Load & render head
|
|
247
|
+
if (this.grid.options?.rendering?.header?.enabled) {
|
|
248
|
+
this.header = new TableHeader(this);
|
|
249
|
+
await this.header.render();
|
|
250
|
+
}
|
|
251
|
+
// TODO(footer): Load & render footer
|
|
252
|
+
// this.footer = new TableFooter(this);
|
|
253
|
+
// this.footer.render();
|
|
254
|
+
await this.rowsVirtualizer.initialRender();
|
|
255
|
+
}
|
|
256
|
+
finally {
|
|
257
|
+
fireEvent(this, 'afterInit');
|
|
258
|
+
this.reflow();
|
|
259
|
+
this.grid.hideLoading();
|
|
201
260
|
}
|
|
202
|
-
// TODO: Load & render footer
|
|
203
|
-
// this.footer = new TableFooter(this);
|
|
204
|
-
// this.footer.render();
|
|
205
|
-
this.rowsVirtualizer.initialRender();
|
|
206
|
-
fireEvent(this, 'afterInit');
|
|
207
261
|
}
|
|
208
262
|
/**
|
|
209
263
|
* Sets the minimum height of the table body.
|
|
@@ -223,7 +277,7 @@ class Table {
|
|
|
223
277
|
* @returns
|
|
224
278
|
* Whether rows virtualization should be enabled.
|
|
225
279
|
*/
|
|
226
|
-
shouldVirtualizeRows() {
|
|
280
|
+
async shouldVirtualizeRows() {
|
|
227
281
|
const { grid } = this;
|
|
228
282
|
const rows = grid.userOptions.rendering?.rows;
|
|
229
283
|
if (defined(rows?.virtualization)) {
|
|
@@ -231,7 +285,7 @@ class Table {
|
|
|
231
285
|
}
|
|
232
286
|
// Consider changing this to use the presentation table row count
|
|
233
287
|
// instead of the original data table row count.
|
|
234
|
-
const rowCount =
|
|
288
|
+
const rowCount = (await this.grid.dataProvider?.getRowCount()) ?? 0;
|
|
235
289
|
const threshold = rows?.virtualizationThreshold ?? 50;
|
|
236
290
|
if (grid.pagination) {
|
|
237
291
|
return grid.querying.pagination.currentPageSize >= threshold;
|
|
@@ -241,7 +295,7 @@ class Table {
|
|
|
241
295
|
/**
|
|
242
296
|
* Loads the columns of the table.
|
|
243
297
|
*/
|
|
244
|
-
loadColumns() {
|
|
298
|
+
async loadColumns() {
|
|
245
299
|
const { enabledColumns } = this.grid;
|
|
246
300
|
if (!enabledColumns) {
|
|
247
301
|
return;
|
|
@@ -249,7 +303,9 @@ class Table {
|
|
|
249
303
|
let columnId;
|
|
250
304
|
for (let i = 0, iEnd = enabledColumns.length; i < iEnd; ++i) {
|
|
251
305
|
columnId = enabledColumns[i];
|
|
252
|
-
|
|
306
|
+
const column = new Column(this, columnId, i);
|
|
307
|
+
await column.init();
|
|
308
|
+
this.columns.push(column);
|
|
253
309
|
}
|
|
254
310
|
this.columnResizing.loadColumns();
|
|
255
311
|
}
|
|
@@ -258,53 +314,52 @@ class Table {
|
|
|
258
314
|
*/
|
|
259
315
|
async updateRows() {
|
|
260
316
|
const vp = this;
|
|
261
|
-
|
|
262
|
-
if (
|
|
263
|
-
|
|
317
|
+
const { dataProvider: dp } = vp.grid;
|
|
318
|
+
if (!dp) {
|
|
319
|
+
return;
|
|
264
320
|
}
|
|
265
321
|
vp.grid.querying.pagination.clampPage();
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
let shouldRerender = false;
|
|
276
|
-
if (this.virtualRows !== shouldVirtualize) {
|
|
277
|
-
this.virtualRows = shouldVirtualize;
|
|
278
|
-
vp.tableElement.classList.toggle(Globals.getClassName('virtualization'), shouldVirtualize);
|
|
279
|
-
shouldRerender = true;
|
|
280
|
-
}
|
|
281
|
-
if (shouldRerender || oldRowsCount !== vp.dataTable.rowCount) {
|
|
282
|
-
// Rerender all rows
|
|
283
|
-
vp.rowsVirtualizer.rerender();
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
// Update existing rows
|
|
287
|
-
for (let i = 0, iEnd = vp.rows.length; i < iEnd; ++i) {
|
|
288
|
-
vp.rows[i].update();
|
|
322
|
+
try {
|
|
323
|
+
this.grid.showLoading();
|
|
324
|
+
// Update data
|
|
325
|
+
const oldRowsCount = vp.rows.length > 0 ?
|
|
326
|
+
(vp.rows[vp.rows.length - 1]?.index ?? -1) + 1 :
|
|
327
|
+
0;
|
|
328
|
+
await vp.grid.querying.proceed();
|
|
329
|
+
for (const column of vp.columns) {
|
|
330
|
+
column.loadData();
|
|
289
331
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
if (newRowIndex !== void 0) {
|
|
298
|
-
// Scroll to the focused row.
|
|
299
|
-
vp.scrollToRow(newRowIndex);
|
|
300
|
-
// Focus the cell that was focused before the update.
|
|
301
|
-
setTimeout(() => {
|
|
302
|
-
if (!defined(vp.focusCursor?.[1])) {
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
vp.rows[newRowIndex - vp.rows[0].index]?.cells[vp.focusCursor[1]].htmlElement.focus();
|
|
306
|
-
});
|
|
332
|
+
// Update virtualization if needed
|
|
333
|
+
const shouldVirtualize = await this.shouldVirtualizeRows();
|
|
334
|
+
let shouldRerender = false;
|
|
335
|
+
if (this.virtualRows !== shouldVirtualize) {
|
|
336
|
+
this.virtualRows = shouldVirtualize;
|
|
337
|
+
vp.tableElement.classList.toggle(Globals.getClassName('virtualization'), shouldVirtualize);
|
|
338
|
+
shouldRerender = true;
|
|
307
339
|
}
|
|
340
|
+
const newRowCount = await dp.getRowCount();
|
|
341
|
+
if (shouldRerender) {
|
|
342
|
+
// Rerender all rows
|
|
343
|
+
await vp.rowsVirtualizer.rerender();
|
|
344
|
+
}
|
|
345
|
+
else if (oldRowsCount !== newRowCount) {
|
|
346
|
+
// Refresh rows without full teardown
|
|
347
|
+
await vp.rowsVirtualizer.refreshRows();
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
// Update existing rows - create a snapshot to avoid issues
|
|
351
|
+
// if array changes during iteration
|
|
352
|
+
const rowsToUpdate = [...vp.rows];
|
|
353
|
+
for (let i = 0, iEnd = rowsToUpdate.length; i < iEnd; ++i) {
|
|
354
|
+
await rowsToUpdate[i].update();
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
// Update the pagination controls
|
|
358
|
+
vp.grid.pagination?.updateControls();
|
|
359
|
+
vp.reflow();
|
|
360
|
+
}
|
|
361
|
+
finally {
|
|
362
|
+
this.grid.hideLoading();
|
|
308
363
|
}
|
|
309
364
|
vp.grid.dirtyFlags.delete('rows');
|
|
310
365
|
}
|
|
@@ -312,8 +367,6 @@ class Table {
|
|
|
312
367
|
* Reflows the table's content dimensions.
|
|
313
368
|
*/
|
|
314
369
|
reflow() {
|
|
315
|
-
// TODO: More `needsReflow` logic can be added in the future to avoid
|
|
316
|
-
// unnecessary reflows of the table parts.
|
|
317
370
|
this.columnResizing.reflow();
|
|
318
371
|
// Reflow the head
|
|
319
372
|
this.header?.reflow();
|
|
@@ -327,6 +380,46 @@ class Table {
|
|
|
327
380
|
});
|
|
328
381
|
this.grid.dirtyFlags.delete('reflow');
|
|
329
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* Opens a cell context menu if configured and enabled.
|
|
385
|
+
*
|
|
386
|
+
* @param tableCell
|
|
387
|
+
* The target cell.
|
|
388
|
+
*
|
|
389
|
+
* @param clientX
|
|
390
|
+
* The viewport X coordinate for anchoring.
|
|
391
|
+
*
|
|
392
|
+
* @param clientY
|
|
393
|
+
* The viewport Y coordinate for anchoring.
|
|
394
|
+
*
|
|
395
|
+
* @returns
|
|
396
|
+
* True if the menu was opened.
|
|
397
|
+
*/
|
|
398
|
+
openCellContextMenu(tableCell, clientX, clientY) {
|
|
399
|
+
const options = tableCell.column?.options.cells?.contextMenu;
|
|
400
|
+
if (options?.enabled === false) {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
const items = options?.items || [];
|
|
404
|
+
if (!items.length) {
|
|
405
|
+
return false; // Keep native browser menu
|
|
406
|
+
}
|
|
407
|
+
if (!this.cellContextMenu) {
|
|
408
|
+
this.cellContextMenu = new CellContextMenu(this.grid);
|
|
409
|
+
}
|
|
410
|
+
// Close any existing popups before opening a new menu.
|
|
411
|
+
// Copy to array to avoid mutation during iteration.
|
|
412
|
+
for (const popup of Array.from(this.grid.popups)) {
|
|
413
|
+
if (popup !== this.cellContextMenu) {
|
|
414
|
+
popup.hide();
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (this.cellContextMenu.isVisible) {
|
|
418
|
+
this.cellContextMenu.hide();
|
|
419
|
+
}
|
|
420
|
+
this.cellContextMenu.showAt(tableCell, clientX, clientY);
|
|
421
|
+
return true;
|
|
422
|
+
}
|
|
330
423
|
/**
|
|
331
424
|
* Scrolls the table to the specified row.
|
|
332
425
|
*
|
|
@@ -422,6 +515,7 @@ class Table {
|
|
|
422
515
|
this.tbodyElement.removeEventListener('scroll', this.onScroll);
|
|
423
516
|
this.tbodyElement.removeEventListener('click', this.onCellClick);
|
|
424
517
|
this.tbodyElement.removeEventListener('dblclick', this.onCellDblClick);
|
|
518
|
+
this.tbodyElement.removeEventListener('contextmenu', this.onCellContextMenu);
|
|
425
519
|
this.tbodyElement.removeEventListener('mousedown', this.onCellMouseDown);
|
|
426
520
|
this.tbodyElement.removeEventListener('mouseover', this.onCellMouseOver);
|
|
427
521
|
this.tbodyElement.removeEventListener('mouseout', this.onCellMouseOut);
|
|
@@ -429,8 +523,10 @@ class Table {
|
|
|
429
523
|
this.resizeObserver.disconnect();
|
|
430
524
|
this.columnsResizer?.removeEventListeners();
|
|
431
525
|
this.header?.destroy();
|
|
526
|
+
this.cellContextMenu?.hide();
|
|
527
|
+
delete this.cellContextMenu;
|
|
432
528
|
for (let i = 0, iEnd = this.rows.length; i < iEnd; ++i) {
|
|
433
|
-
this.rows[i]
|
|
529
|
+
this.rows[i]?.destroy();
|
|
434
530
|
}
|
|
435
531
|
fireEvent(this, 'afterDestroy');
|
|
436
532
|
}
|
|
@@ -500,9 +596,6 @@ class Table {
|
|
|
500
596
|
* The ID of the row.
|
|
501
597
|
*/
|
|
502
598
|
getRow(id) {
|
|
503
|
-
// TODO: Change `find` to a method using `vp.dataTable.getLocalRowIndex`
|
|
504
|
-
// and rows[presentationRowIndex - firstRowIndex]. Needs more testing,
|
|
505
|
-
// but it should be faster.
|
|
506
599
|
return this.rows.find((row) => row.id === id);
|
|
507
600
|
}
|
|
508
601
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type ContextMenu from './ContextMenu';
|
|
2
2
|
import type Button from './Button';
|
|
3
3
|
import type Popup from './Popup';
|
|
4
|
-
import { GridIconName } from './SvgIcons.js';
|
|
5
4
|
import { ClassNameKey } from '../Globals.js';
|
|
6
5
|
export declare class ContextMenuButton implements Button {
|
|
7
6
|
/**
|
|
@@ -55,9 +54,9 @@ export declare class ContextMenuButton implements Button {
|
|
|
55
54
|
* Sets the icon for the button.
|
|
56
55
|
*
|
|
57
56
|
* @param icon
|
|
58
|
-
* The icon to set.
|
|
57
|
+
* The icon to set (built-in name or custom name from rendering.icons).
|
|
59
58
|
*/
|
|
60
|
-
setIcon(icon?:
|
|
59
|
+
setIcon(icon?: string): void;
|
|
61
60
|
setActive(active: boolean): void;
|
|
62
61
|
setHighlighted(highlighted: boolean): void;
|
|
63
62
|
/**
|
|
@@ -90,9 +89,9 @@ export interface ContextMenuButtonOptions {
|
|
|
90
89
|
*/
|
|
91
90
|
label?: string;
|
|
92
91
|
/**
|
|
93
|
-
* The icon for the button.
|
|
92
|
+
* The icon for the button (built-in name or custom from rendering.icons).
|
|
94
93
|
*/
|
|
95
|
-
icon?:
|
|
94
|
+
icon?: string;
|
|
96
95
|
/**
|
|
97
96
|
* A class name key applied to the `<li>` wrapper of the button.
|
|
98
97
|
*/
|
|
@@ -100,11 +99,11 @@ export interface ContextMenuButtonOptions {
|
|
|
100
99
|
/**
|
|
101
100
|
* The icon for the active state of the button.
|
|
102
101
|
*/
|
|
103
|
-
activeIcon?:
|
|
102
|
+
activeIcon?: string;
|
|
104
103
|
/**
|
|
105
104
|
* The icon for the highlighted state of the button.
|
|
106
105
|
*/
|
|
107
|
-
highlightedIcon?:
|
|
106
|
+
highlightedIcon?: string;
|
|
108
107
|
/**
|
|
109
108
|
* The tooltip string for the button.
|
|
110
109
|
*/
|
|
@@ -80,7 +80,8 @@ export class ContextMenuButton {
|
|
|
80
80
|
buttonEl.setAttribute('tabindex', '-1');
|
|
81
81
|
this.refreshState();
|
|
82
82
|
if (cfg.chevron) {
|
|
83
|
-
|
|
83
|
+
const grid = this.contextMenu?.grid;
|
|
84
|
+
chevronEl.appendChild(createGridIcon('chevronRight', grid?.options?.rendering?.icons));
|
|
84
85
|
}
|
|
85
86
|
if (cfg.icon) {
|
|
86
87
|
this.setIcon(cfg.icon);
|
|
@@ -104,14 +105,15 @@ export class ContextMenuButton {
|
|
|
104
105
|
* Sets the icon for the button.
|
|
105
106
|
*
|
|
106
107
|
* @param icon
|
|
107
|
-
* The icon to set.
|
|
108
|
+
* The icon to set (built-in name or custom name from rendering.icons).
|
|
108
109
|
*/
|
|
109
110
|
setIcon(icon) {
|
|
110
111
|
this.icon?.remove();
|
|
111
112
|
if (!icon) {
|
|
112
113
|
return;
|
|
113
114
|
}
|
|
114
|
-
|
|
115
|
+
const grid = this.contextMenu?.grid;
|
|
116
|
+
this.icon = createGridIcon(icon, grid?.options?.rendering?.icons);
|
|
115
117
|
this.iconWrapper?.appendChild(this.icon);
|
|
116
118
|
}
|
|
117
119
|
setActive(active) {
|
|
@@ -15,9 +15,8 @@
|
|
|
15
15
|
'use strict';
|
|
16
16
|
import GridUtils from '../GridUtils.js';
|
|
17
17
|
import Globals from '../Globals.js';
|
|
18
|
-
import
|
|
18
|
+
import { fireEvent } from '../../../Shared/Utilities.js';
|
|
19
19
|
const { makeHTMLElement } = GridUtils;
|
|
20
|
-
const { fireEvent } = U;
|
|
21
20
|
/* *
|
|
22
21
|
*
|
|
23
22
|
* Class
|
|
@@ -146,6 +145,7 @@ export class Popup {
|
|
|
146
145
|
return;
|
|
147
146
|
}
|
|
148
147
|
const next = this.options.nextToAnchor || false;
|
|
148
|
+
const edgePadding = 8;
|
|
149
149
|
const popupRect = this.container.getBoundingClientRect();
|
|
150
150
|
const parentRect = wrapper.getBoundingClientRect();
|
|
151
151
|
const anchorRect = anchorElement?.getBoundingClientRect() ?? parentRect;
|
|
@@ -153,24 +153,22 @@ export class Popup {
|
|
|
153
153
|
let left = next ? anchorRect.right + 3 : anchorRect.left;
|
|
154
154
|
// If popup's right side is after the parent's right side, shift popup
|
|
155
155
|
// to the left of the anchor element.
|
|
156
|
-
if (left + popupRect.width > parentRect.
|
|
156
|
+
if (left + popupRect.width > parentRect.right - edgePadding) {
|
|
157
157
|
left = -popupRect.width + (next ? anchorRect.left + 4 : anchorRect.right);
|
|
158
158
|
}
|
|
159
159
|
// If popup's left side is before the parent's left side,
|
|
160
160
|
// shift popup so it's aligned to parent's left.
|
|
161
|
-
if (left < parentRect.left) {
|
|
162
|
-
left = parentRect.left;
|
|
161
|
+
if (left < parentRect.left + edgePadding) {
|
|
162
|
+
left = parentRect.left + edgePadding;
|
|
163
163
|
}
|
|
164
164
|
// Apply positioning
|
|
165
165
|
this.container.style.top = `${top - parentRect.top}px`;
|
|
166
166
|
this.container.style.left = `${left - parentRect.left}px`;
|
|
167
167
|
// If the content is too tall, constrain the container to the bottom
|
|
168
168
|
// of the parent to enable content Y-scrolling.
|
|
169
|
-
|
|
170
|
-
if (contentRect.height + contentRect.top - parentRect.top >
|
|
171
|
-
parentRect.height) {
|
|
169
|
+
if (top + popupRect.height > parentRect.bottom - edgePadding) {
|
|
172
170
|
this.container.style.top = 'auto';
|
|
173
|
-
this.container.style.bottom =
|
|
171
|
+
this.container.style.bottom = `${edgePadding}px`;
|
|
174
172
|
}
|
|
175
173
|
else {
|
|
176
174
|
this.container.style.top = `${top - parentRect.top}px`;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The name of the icon from SvgIcons registry
|
|
2
|
+
* The name of the icon from SvgIcons registry.
|
|
3
|
+
* Use these names wherever an icon is accepted (toolbar, menu, pagination).
|
|
4
|
+
* Can be overridden or extended via `rendering.icons`.
|
|
5
|
+
*
|
|
6
|
+
* Default icons available in the registry:
|
|
7
|
+
* - `filter`, `menu`, `checkmark`
|
|
8
|
+
* - `arrowUpDown`, `arrowUp`, `arrowDown`
|
|
9
|
+
* - `chevronLeft`, `chevronRight`, `doubleChevronLeft`, `doubleChevronRight`
|
|
10
|
+
* - `copy`, `clipboard`, `plus`, `trash`
|
|
11
|
+
* - `addRowAbove`, `addRowBelow`, `addColumnLeft`, `addColumnRight`
|
|
3
12
|
*/
|
|
4
|
-
export type GridIconName = ('filter' | 'menu' | 'chevronRight' | '
|
|
13
|
+
export type GridIconName = ('filter' | 'menu' | 'checkmark' | 'arrowUpDown' | 'arrowUp' | 'arrowDown' | 'chevronLeft' | 'chevronRight' | 'doubleChevronLeft' | 'doubleChevronRight' | 'copy' | 'clipboard' | 'plus' | 'trash' | 'addRowAbove' | 'addRowBelow' | 'addColumnLeft' | 'addColumnRight');
|
|
5
14
|
/**
|
|
6
15
|
* The registry of all Grid Svg icons with their SVG path data.
|
|
7
16
|
*/
|
|
@@ -32,20 +41,46 @@ export interface SVGDefinition {
|
|
|
32
41
|
children?: PathDefinition[];
|
|
33
42
|
}
|
|
34
43
|
/**
|
|
35
|
-
*
|
|
44
|
+
* Value for an entry in the icon registry: either an SVG definition object
|
|
45
|
+
* or a raw SVG markup string (e.g. `'<svg>...</svg>'`).
|
|
46
|
+
*/
|
|
47
|
+
export type IconRegistryValue = SVGDefinition | string;
|
|
48
|
+
/**
|
|
49
|
+
* Looks up an icon by name, checking custom icons first and then falling
|
|
50
|
+
* back to the built-in registry.
|
|
51
|
+
*
|
|
52
|
+
* @param name
|
|
53
|
+
* Icon name to look up.
|
|
54
|
+
*
|
|
55
|
+
* @param customIcons
|
|
56
|
+
* Optional map of icon names provided via `rendering.icons`.
|
|
57
|
+
*
|
|
58
|
+
* @returns
|
|
59
|
+
* Icon registry value (definition or raw SVG string), or `undefined` if
|
|
60
|
+
* neither a custom nor a built-in icon exists for the given name.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getIconFromRegistry(name: string, customIcons?: Record<string, IconRegistryValue>): IconRegistryValue | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Creates an SVG icon element from the SvgIcons registry or a custom
|
|
65
|
+
* registry. When `customIcons` is provided, `name` can be any registered
|
|
66
|
+
* name (built-in or custom). When omitted, only built-in `GridIconName`
|
|
67
|
+
* values are allowed. The SVG element always receives the default icon
|
|
68
|
+
* class name from `Globals`.
|
|
36
69
|
*
|
|
37
70
|
* @param name
|
|
38
|
-
* The name of the icon from
|
|
71
|
+
* The name of the icon (built-in or from registry)
|
|
39
72
|
*
|
|
40
|
-
* @param
|
|
41
|
-
*
|
|
73
|
+
* @param customIcons
|
|
74
|
+
* Optional custom icons map from `rendering.icons`. When provided, custom
|
|
75
|
+
* and override icons are used and arbitrary names are allowed.
|
|
42
76
|
*
|
|
43
77
|
* @returns
|
|
44
78
|
* SVG element with the specified icon
|
|
45
79
|
*/
|
|
46
|
-
export declare function createGridIcon(name:
|
|
80
|
+
export declare function createGridIcon(name: string, customIcons?: Record<string, IconRegistryValue>): SVGElement;
|
|
47
81
|
declare const _default: {
|
|
48
82
|
readonly createGridIcon: typeof createGridIcon;
|
|
83
|
+
readonly getIconFromRegistry: typeof getIconFromRegistry;
|
|
49
84
|
readonly icons: Record<GridIconName, SVGDefinition>;
|
|
50
85
|
readonly pathDefaults: Partial<PathDefinition>;
|
|
51
86
|
};
|