@mui/x-data-grid-pro 7.0.0-beta.6 → 7.0.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/CHANGELOG.md +311 -12
- package/DataGridPro/DataGridPro.js +18 -18
- package/DataGridPro/useDataGridProComponent.js +2 -3
- package/README.md +1 -1
- package/components/GridColumnHeaders.d.ts +1 -2
- package/components/GridColumnHeaders.js +7 -164
- package/components/headerFiltering/GridHeaderFilterCell.d.ts +8 -1
- package/components/headerFiltering/GridHeaderFilterCell.js +26 -9
- package/esm/DataGridPro/DataGridPro.js +18 -18
- package/esm/DataGridPro/useDataGridProComponent.js +1 -2
- package/esm/components/GridColumnHeaders.js +9 -166
- package/esm/components/GridDetailPanelToggleCell.js +1 -2
- package/esm/components/GridTreeDataGroupingCell.js +2 -3
- package/esm/components/headerFiltering/GridHeaderFilterCell.js +39 -26
- package/esm/components/headerFiltering/GridHeaderFilterClearButton.js +1 -2
- package/esm/components/headerFiltering/GridHeaderFilterMenu.js +1 -2
- package/esm/components/headerFiltering/GridHeaderFilterMenuContainer.js +1 -2
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +49 -16
- package/esm/hooks/features/columnPinning/useGridColumnPinning.js +7 -10
- package/esm/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -0
- package/esm/hooks/features/columnReorder/useGridColumnReorder.js +2 -4
- package/esm/hooks/features/detailPanel/useGridDetailPanel.js +5 -10
- package/esm/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -2
- package/esm/hooks/features/index.js +0 -1
- package/esm/hooks/features/infiniteLoader/useGridInfiniteLoader.js +6 -10
- package/esm/hooks/features/lazyLoader/useGridLazyLoader.js +3 -23
- package/esm/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -6
- package/esm/hooks/features/rowPinning/useGridRowPinning.js +3 -5
- package/esm/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +5 -7
- package/esm/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/esm/hooks/features/treeData/gridTreeDataUtils.js +1 -2
- package/esm/hooks/features/treeData/useGridTreeDataPreProcessors.js +1 -2
- package/esm/internals/index.js +0 -1
- package/esm/utils/releaseInfo.js +1 -1
- package/esm/utils/tree/insertDataRowInTree.js +8 -9
- package/esm/utils/tree/removeDataRowFromTree.js +3 -3
- package/esm/utils/tree/sortRowTree.js +1 -1
- package/esm/utils/tree/updateRowTree.js +1 -1
- package/esm/utils/tree/utils.js +6 -9
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +3 -5
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +44 -11
- package/hooks/features/columnPinning/useGridColumnPinning.js +3 -3
- package/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -0
- package/hooks/features/detailPanel/useGridDetailPanel.js +1 -1
- package/hooks/features/index.d.ts +0 -1
- package/hooks/features/index.js +0 -11
- package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/hooks/features/lazyLoader/useGridLazyLoader.d.ts +1 -1
- package/hooks/features/lazyLoader/useGridLazyLoader.js +1 -19
- package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -5
- package/index.js +1 -1
- package/internals/index.d.ts +0 -1
- package/internals/index.js +0 -15
- package/models/dataGridProProps.d.ts +3 -36
- package/models/dataSource.d.ts +1 -1
- package/models/gridApiPro.d.ts +4 -4
- package/models/gridStatePro.d.ts +1 -2
- package/modern/DataGridPro/DataGridPro.js +18 -18
- package/modern/DataGridPro/useDataGridProComponent.js +1 -2
- package/modern/components/GridColumnHeaders.js +9 -166
- package/modern/components/headerFiltering/GridHeaderFilterCell.js +27 -10
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +46 -12
- package/modern/hooks/features/columnPinning/useGridColumnPinning.js +3 -3
- package/modern/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -0
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +1 -1
- package/modern/hooks/features/index.js +0 -1
- package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/modern/hooks/features/lazyLoader/useGridLazyLoader.js +1 -19
- package/modern/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -5
- package/modern/index.js +1 -1
- package/modern/internals/index.js +0 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +6 -6
- package/typeOverloads/modules.d.ts +3 -3
- package/utils/releaseInfo.js +1 -1
- package/components/GridScrollArea.d.ts +0 -10
- package/components/GridScrollArea.js +0 -145
- package/esm/components/GridScrollArea.js +0 -137
- package/esm/hooks/features/columnResize/columnResizeSelector.js +0 -3
- package/esm/hooks/features/columnResize/columnResizeState.js +0 -1
- package/esm/hooks/features/columnResize/gridColumnResizeApi.js +0 -10
- package/esm/hooks/features/columnResize/index.js +0 -3
- package/esm/hooks/features/columnResize/useGridColumnResize.js +0 -547
- package/esm/utils/domUtils.js +0 -109
- package/hooks/features/columnResize/columnResizeSelector.d.ts +0 -3
- package/hooks/features/columnResize/columnResizeSelector.js +0 -10
- package/hooks/features/columnResize/columnResizeState.d.ts +0 -3
- package/hooks/features/columnResize/columnResizeState.js +0 -5
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +0 -44
- package/hooks/features/columnResize/gridColumnResizeApi.js +0 -16
- package/hooks/features/columnResize/index.d.ts +0 -3
- package/hooks/features/columnResize/index.js +0 -38
- package/hooks/features/columnResize/useGridColumnResize.d.ts +0 -10
- package/hooks/features/columnResize/useGridColumnResize.js +0 -548
- package/modern/components/GridScrollArea.js +0 -137
- package/modern/hooks/features/columnResize/columnResizeSelector.js +0 -3
- package/modern/hooks/features/columnResize/columnResizeState.js +0 -1
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +0 -10
- package/modern/hooks/features/columnResize/index.js +0 -3
- package/modern/hooks/features/columnResize/useGridColumnResize.js +0 -537
- package/modern/utils/domUtils.js +0 -107
- package/utils/domUtils.d.ts +0 -11
- package/utils/domUtils.js +0 -121
|
@@ -1,547 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { unstable_ownerDocument as ownerDocument, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
4
|
-
import { gridClasses, GridPinnedColumnPosition, useGridApiEventHandler, useGridApiOptionHandler, useGridApiMethod, useGridNativeEventListener, useGridLogger, useGridSelector, gridVirtualizationColumnEnabledSelector } from '@mui/x-data-grid';
|
|
5
|
-
import { clamp, findParentElementFromClassName, gridColumnsStateSelector, useOnMount, useTimeout, createControllablePromise } from '@mui/x-data-grid/internals';
|
|
6
|
-
import { useTheme } from '@mui/material/styles';
|
|
7
|
-
import { findGridCellElementsFromCol, findGridElement, findLeftPinnedCellsAfterCol, findRightPinnedCellsBeforeCol, getFieldFromHeaderElem, findHeaderElementFromField, findGroupHeaderElementsFromField, findGridHeader, findGridCells } from '../../../utils/domUtils';
|
|
8
|
-
import { DEFAULT_GRID_AUTOSIZE_OPTIONS } from './gridColumnResizeApi';
|
|
9
|
-
// TODO: remove support for Safari < 13.
|
|
10
|
-
// https://caniuse.com/#search=touch-action
|
|
11
|
-
//
|
|
12
|
-
// Safari, on iOS, supports touch action since v13.
|
|
13
|
-
// Over 80% of the iOS phones are compatible
|
|
14
|
-
// in August 2020.
|
|
15
|
-
// Utilizing the CSS.supports method to check if touch-action is supported.
|
|
16
|
-
// Since CSS.supports is supported on all but Edge@12 and IE and touch-action
|
|
17
|
-
// is supported on both Edge@12 and IE if CSS.supports is not available that means that
|
|
18
|
-
// touch-action will be supported
|
|
19
|
-
let cachedSupportsTouchActionNone = false;
|
|
20
|
-
function doesSupportTouchActionNone() {
|
|
21
|
-
if (cachedSupportsTouchActionNone === undefined) {
|
|
22
|
-
if (typeof CSS !== 'undefined' && typeof CSS.supports === 'function') {
|
|
23
|
-
cachedSupportsTouchActionNone = CSS.supports('touch-action', 'none');
|
|
24
|
-
} else {
|
|
25
|
-
cachedSupportsTouchActionNone = true;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return cachedSupportsTouchActionNone;
|
|
29
|
-
}
|
|
30
|
-
function trackFinger(event, currentTouchId) {
|
|
31
|
-
if (currentTouchId !== undefined && event.changedTouches) {
|
|
32
|
-
for (let i = 0; i < event.changedTouches.length; i += 1) {
|
|
33
|
-
const touch = event.changedTouches[i];
|
|
34
|
-
if (touch.identifier === currentTouchId) {
|
|
35
|
-
return {
|
|
36
|
-
x: touch.clientX,
|
|
37
|
-
y: touch.clientY
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
x: event.clientX,
|
|
45
|
-
y: event.clientY
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, resizeDirection) {
|
|
49
|
-
let newWidth = initialOffsetToSeparator;
|
|
50
|
-
if (resizeDirection === 'Right') {
|
|
51
|
-
newWidth += clickX - columnBounds.left;
|
|
52
|
-
} else {
|
|
53
|
-
newWidth += columnBounds.right - clickX;
|
|
54
|
-
}
|
|
55
|
-
return newWidth;
|
|
56
|
-
}
|
|
57
|
-
function computeOffsetToSeparator(clickX, columnBounds, resizeDirection) {
|
|
58
|
-
if (resizeDirection === 'Left') {
|
|
59
|
-
return clickX - columnBounds.left;
|
|
60
|
-
}
|
|
61
|
-
return columnBounds.right - clickX;
|
|
62
|
-
}
|
|
63
|
-
function flipResizeDirection(side) {
|
|
64
|
-
if (side === 'Right') {
|
|
65
|
-
return 'Left';
|
|
66
|
-
}
|
|
67
|
-
return 'Right';
|
|
68
|
-
}
|
|
69
|
-
function getResizeDirection(separator, direction) {
|
|
70
|
-
const side = separator.classList.contains(gridClasses['columnSeparator--sideRight']) ? 'Right' : 'Left';
|
|
71
|
-
if (direction === 'rtl') {
|
|
72
|
-
// Resizing logic should be mirrored in the RTL case
|
|
73
|
-
return flipResizeDirection(side);
|
|
74
|
-
}
|
|
75
|
-
return side;
|
|
76
|
-
}
|
|
77
|
-
function preventClick(event) {
|
|
78
|
-
event.preventDefault();
|
|
79
|
-
event.stopImmediatePropagation();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Checker that returns a promise that resolves when the column virtualization
|
|
84
|
-
* is disabled.
|
|
85
|
-
*/
|
|
86
|
-
function useColumnVirtualizationDisabled(apiRef) {
|
|
87
|
-
const promise = React.useRef();
|
|
88
|
-
const selector = () => gridVirtualizationColumnEnabledSelector(apiRef);
|
|
89
|
-
const value = useGridSelector(apiRef, selector);
|
|
90
|
-
React.useEffect(() => {
|
|
91
|
-
if (promise.current && value === false) {
|
|
92
|
-
promise.current.resolve();
|
|
93
|
-
promise.current = undefined;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
const asyncCheck = () => {
|
|
97
|
-
if (!promise.current) {
|
|
98
|
-
if (selector() === false) {
|
|
99
|
-
return Promise.resolve();
|
|
100
|
-
}
|
|
101
|
-
promise.current = createControllablePromise();
|
|
102
|
-
}
|
|
103
|
-
return promise.current;
|
|
104
|
-
};
|
|
105
|
-
return asyncCheck;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Basic statistical outlier detection, checks if the value is `F * IQR` away from
|
|
110
|
-
* the Q1 and Q3 boundaries. IQR: interquartile range.
|
|
111
|
-
*/
|
|
112
|
-
function excludeOutliers(inputValues, factor) {
|
|
113
|
-
if (inputValues.length < 4) {
|
|
114
|
-
return inputValues;
|
|
115
|
-
}
|
|
116
|
-
const values = inputValues.slice();
|
|
117
|
-
values.sort((a, b) => a - b);
|
|
118
|
-
const q1 = values[Math.floor(values.length * 0.25)];
|
|
119
|
-
const q3 = values[Math.floor(values.length * 0.75) - 1];
|
|
120
|
-
const iqr = q3 - q1;
|
|
121
|
-
|
|
122
|
-
// We make a small adjustment if `iqr < 5` for the cases where the IQR is
|
|
123
|
-
// very small (e.g. zero) due to very close by values in the input data.
|
|
124
|
-
// Otherwise, with an IQR of `0`, anything outside that would be considered
|
|
125
|
-
// an outlier, but it makes more sense visually to allow for this 5px variance
|
|
126
|
-
// rather than showing a cropped cell.
|
|
127
|
-
const deviation = iqr < 5 ? 5 : iqr * factor;
|
|
128
|
-
return values.filter(v => v > q1 - deviation && v < q3 + deviation);
|
|
129
|
-
}
|
|
130
|
-
function extractColumnWidths(apiRef, options, columns) {
|
|
131
|
-
const widthByField = {};
|
|
132
|
-
const root = apiRef.current.rootElementRef.current;
|
|
133
|
-
root.classList.add(gridClasses.autosizing);
|
|
134
|
-
columns.forEach(column => {
|
|
135
|
-
const cells = findGridCells(apiRef.current, column.field);
|
|
136
|
-
const widths = cells.map(cell => {
|
|
137
|
-
var _cell$getBoundingClie;
|
|
138
|
-
return (_cell$getBoundingClie = cell.getBoundingClientRect().width) != null ? _cell$getBoundingClie : 0;
|
|
139
|
-
});
|
|
140
|
-
const filteredWidths = options.includeOutliers ? widths : excludeOutliers(widths, options.outliersFactor);
|
|
141
|
-
if (options.includeHeaders) {
|
|
142
|
-
const header = findGridHeader(apiRef.current, column.field);
|
|
143
|
-
if (header) {
|
|
144
|
-
var _iconContainer$client, _menuContainer$client;
|
|
145
|
-
const title = header.querySelector(`.${gridClasses.columnHeaderTitle}`);
|
|
146
|
-
const content = header.querySelector(`.${gridClasses.columnHeaderTitleContainerContent}`);
|
|
147
|
-
const iconContainer = header.querySelector(`.${gridClasses.iconButtonContainer}`);
|
|
148
|
-
const menuContainer = header.querySelector(`.${gridClasses.menuIcon}`);
|
|
149
|
-
const element = title != null ? title : content;
|
|
150
|
-
const style = window.getComputedStyle(header, null);
|
|
151
|
-
const paddingWidth = parseInt(style.paddingLeft, 10) + parseInt(style.paddingRight, 10);
|
|
152
|
-
const contentWidth = element.scrollWidth + 1;
|
|
153
|
-
const width = contentWidth + paddingWidth + ((_iconContainer$client = iconContainer == null ? void 0 : iconContainer.clientWidth) != null ? _iconContainer$client : 0) + ((_menuContainer$client = menuContainer == null ? void 0 : menuContainer.clientWidth) != null ? _menuContainer$client : 0);
|
|
154
|
-
filteredWidths.push(width);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
const hasColumnMin = column.minWidth !== -Infinity && column.minWidth !== undefined;
|
|
158
|
-
const hasColumnMax = column.maxWidth !== Infinity && column.maxWidth !== undefined;
|
|
159
|
-
const min = hasColumnMin ? column.minWidth : 0;
|
|
160
|
-
const max = hasColumnMax ? column.maxWidth : Infinity;
|
|
161
|
-
const maxContent = filteredWidths.length === 0 ? 0 : Math.max(...filteredWidths);
|
|
162
|
-
widthByField[column.field] = clamp(maxContent, min, max);
|
|
163
|
-
});
|
|
164
|
-
root.classList.remove(gridClasses.autosizing);
|
|
165
|
-
return widthByField;
|
|
166
|
-
}
|
|
167
|
-
export const columnResizeStateInitializer = state => _extends({}, state, {
|
|
168
|
-
columnResize: {
|
|
169
|
-
resizingColumnField: ''
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
/**
|
|
173
|
-
* @requires useGridColumns (method, event)
|
|
174
|
-
* TODO: improve experience for last column
|
|
175
|
-
*/
|
|
176
|
-
export const useGridColumnResize = (apiRef, props) => {
|
|
177
|
-
const theme = useTheme();
|
|
178
|
-
const logger = useGridLogger(apiRef, 'useGridColumnResize');
|
|
179
|
-
const colDefRef = React.useRef();
|
|
180
|
-
const previousMouseClickEvent = React.useRef();
|
|
181
|
-
const columnHeaderElementRef = React.useRef();
|
|
182
|
-
const headerFilterElementRef = React.useRef();
|
|
183
|
-
const groupHeaderElementsRef = React.useRef([]);
|
|
184
|
-
const cellElementsRef = React.useRef([]);
|
|
185
|
-
const leftPinnedCellsAfterRef = React.useRef([]);
|
|
186
|
-
const rightPinnedCellsBeforeRef = React.useRef([]);
|
|
187
|
-
const fillerLeftRef = React.useRef();
|
|
188
|
-
const fillerRightRef = React.useRef();
|
|
189
|
-
|
|
190
|
-
// To improve accessibility, the separator has padding on both sides.
|
|
191
|
-
// Clicking inside the padding area should be treated as a click in the separator.
|
|
192
|
-
// This ref stores the offset between the click and the separator.
|
|
193
|
-
const initialOffsetToSeparator = React.useRef();
|
|
194
|
-
const resizeDirection = React.useRef();
|
|
195
|
-
const stopResizeEventTimeout = useTimeout();
|
|
196
|
-
const touchId = React.useRef();
|
|
197
|
-
const updateWidth = newWidth => {
|
|
198
|
-
logger.debug(`Updating width to ${newWidth} for col ${colDefRef.current.field}`);
|
|
199
|
-
const prevWidth = columnHeaderElementRef.current.offsetWidth;
|
|
200
|
-
const widthDiff = newWidth - prevWidth;
|
|
201
|
-
colDefRef.current.computedWidth = newWidth;
|
|
202
|
-
colDefRef.current.width = newWidth;
|
|
203
|
-
colDefRef.current.flex = 0;
|
|
204
|
-
columnHeaderElementRef.current.style.width = `${newWidth}px`;
|
|
205
|
-
columnHeaderElementRef.current.style.minWidth = `${newWidth}px`;
|
|
206
|
-
columnHeaderElementRef.current.style.maxWidth = `${newWidth}px`;
|
|
207
|
-
const headerFilterElement = headerFilterElementRef.current;
|
|
208
|
-
if (headerFilterElement) {
|
|
209
|
-
headerFilterElement.style.width = `${newWidth}px`;
|
|
210
|
-
headerFilterElement.style.minWidth = `${newWidth}px`;
|
|
211
|
-
headerFilterElement.style.maxWidth = `${newWidth}px`;
|
|
212
|
-
}
|
|
213
|
-
groupHeaderElementsRef.current.forEach(element => {
|
|
214
|
-
const div = element;
|
|
215
|
-
let finalWidth;
|
|
216
|
-
if (div.getAttribute('aria-colspan') === '1') {
|
|
217
|
-
finalWidth = `${newWidth}px`;
|
|
218
|
-
} else {
|
|
219
|
-
// Cell with colspan > 1 cannot be just updated width new width.
|
|
220
|
-
// Instead, we add width diff to the current width.
|
|
221
|
-
finalWidth = `${div.offsetWidth + widthDiff}px`;
|
|
222
|
-
}
|
|
223
|
-
div.style.width = finalWidth;
|
|
224
|
-
div.style.minWidth = finalWidth;
|
|
225
|
-
div.style.maxWidth = finalWidth;
|
|
226
|
-
});
|
|
227
|
-
cellElementsRef.current.forEach(element => {
|
|
228
|
-
const div = element;
|
|
229
|
-
let finalWidth;
|
|
230
|
-
if (div.getAttribute('aria-colspan') === '1') {
|
|
231
|
-
finalWidth = `${newWidth}px`;
|
|
232
|
-
} else {
|
|
233
|
-
// Cell with colspan > 1 cannot be just updated width new width.
|
|
234
|
-
// Instead, we add width diff to the current width.
|
|
235
|
-
finalWidth = `${div.offsetWidth + widthDiff}px`;
|
|
236
|
-
}
|
|
237
|
-
div.style.setProperty('--width', finalWidth);
|
|
238
|
-
});
|
|
239
|
-
const pinnedPosition = apiRef.current.isColumnPinned(colDefRef.current.field);
|
|
240
|
-
if (pinnedPosition === GridPinnedColumnPosition.LEFT) {
|
|
241
|
-
updateProperty(fillerLeftRef.current, 'width', widthDiff);
|
|
242
|
-
leftPinnedCellsAfterRef.current.forEach(cell => {
|
|
243
|
-
updateProperty(cell, 'left', widthDiff);
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
if (pinnedPosition === GridPinnedColumnPosition.RIGHT) {
|
|
247
|
-
updateProperty(fillerRightRef.current, 'width', widthDiff);
|
|
248
|
-
rightPinnedCellsBeforeRef.current.forEach(cell => {
|
|
249
|
-
updateProperty(cell, 'right', widthDiff);
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
const finishResize = nativeEvent => {
|
|
254
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
255
|
-
stopListening();
|
|
256
|
-
|
|
257
|
-
// Prevent double-clicks from being interpreted as two separate clicks
|
|
258
|
-
if (previousMouseClickEvent.current) {
|
|
259
|
-
const prevEvent = previousMouseClickEvent.current;
|
|
260
|
-
const prevTimeStamp = prevEvent.timeStamp;
|
|
261
|
-
const prevClientX = prevEvent.clientX;
|
|
262
|
-
const prevClientY = prevEvent.clientY;
|
|
263
|
-
|
|
264
|
-
// Check if the current event is part of a double-click
|
|
265
|
-
if (nativeEvent.timeStamp - prevTimeStamp < 300 && nativeEvent.clientX === prevClientX && nativeEvent.clientY === prevClientY) {
|
|
266
|
-
previousMouseClickEvent.current = undefined;
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
if (colDefRef.current) {
|
|
271
|
-
apiRef.current.setColumnWidth(colDefRef.current.field, colDefRef.current.width);
|
|
272
|
-
logger.debug(`Updating col ${colDefRef.current.field} with new width: ${colDefRef.current.width}`);
|
|
273
|
-
}
|
|
274
|
-
stopResizeEventTimeout.start(0, () => {
|
|
275
|
-
apiRef.current.publishEvent('columnResizeStop', null, nativeEvent);
|
|
276
|
-
});
|
|
277
|
-
};
|
|
278
|
-
const storeReferences = (colDef, separator, xStart) => {
|
|
279
|
-
var _apiRef$current$colum;
|
|
280
|
-
const root = apiRef.current.rootElementRef.current;
|
|
281
|
-
colDefRef.current = colDef;
|
|
282
|
-
columnHeaderElementRef.current = findHeaderElementFromField(apiRef.current.columnHeadersContainerElementRef.current, colDef.field);
|
|
283
|
-
const headerFilterElement = root.querySelector(`.${gridClasses.headerFilterRow} [data-field="${colDef.field}"]`);
|
|
284
|
-
if (headerFilterElement) {
|
|
285
|
-
headerFilterElementRef.current = headerFilterElement;
|
|
286
|
-
}
|
|
287
|
-
groupHeaderElementsRef.current = findGroupHeaderElementsFromField((_apiRef$current$colum = apiRef.current.columnHeadersContainerElementRef) == null ? void 0 : _apiRef$current$colum.current, colDef.field);
|
|
288
|
-
cellElementsRef.current = findGridCellElementsFromCol(columnHeaderElementRef.current, apiRef.current);
|
|
289
|
-
fillerLeftRef.current = findGridElement(apiRef.current, 'filler--pinnedLeft');
|
|
290
|
-
fillerRightRef.current = findGridElement(apiRef.current, 'filler--pinnedRight');
|
|
291
|
-
const pinnedPosition = apiRef.current.isColumnPinned(colDef.field);
|
|
292
|
-
leftPinnedCellsAfterRef.current = pinnedPosition !== GridPinnedColumnPosition.LEFT ? [] : findLeftPinnedCellsAfterCol(apiRef.current, columnHeaderElementRef.current);
|
|
293
|
-
rightPinnedCellsBeforeRef.current = pinnedPosition !== GridPinnedColumnPosition.RIGHT ? [] : findRightPinnedCellsBeforeCol(apiRef.current, columnHeaderElementRef.current);
|
|
294
|
-
resizeDirection.current = getResizeDirection(separator, theme.direction);
|
|
295
|
-
initialOffsetToSeparator.current = computeOffsetToSeparator(xStart, columnHeaderElementRef.current.getBoundingClientRect(), resizeDirection.current);
|
|
296
|
-
};
|
|
297
|
-
const handleResizeMouseUp = useEventCallback(finishResize);
|
|
298
|
-
const handleResizeMouseMove = useEventCallback(nativeEvent => {
|
|
299
|
-
// Cancel move in case some other element consumed a mouseup event and it was not fired.
|
|
300
|
-
if (nativeEvent.buttons === 0) {
|
|
301
|
-
handleResizeMouseUp(nativeEvent);
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
let newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, columnHeaderElementRef.current.getBoundingClientRect(), resizeDirection.current);
|
|
305
|
-
newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
|
|
306
|
-
updateWidth(newWidth);
|
|
307
|
-
const params = {
|
|
308
|
-
element: columnHeaderElementRef.current,
|
|
309
|
-
colDef: colDefRef.current,
|
|
310
|
-
width: newWidth
|
|
311
|
-
};
|
|
312
|
-
apiRef.current.publishEvent('columnResize', params, nativeEvent);
|
|
313
|
-
});
|
|
314
|
-
const handleTouchEnd = useEventCallback(nativeEvent => {
|
|
315
|
-
const finger = trackFinger(nativeEvent, touchId.current);
|
|
316
|
-
if (!finger) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
finishResize(nativeEvent);
|
|
320
|
-
});
|
|
321
|
-
const handleTouchMove = useEventCallback(nativeEvent => {
|
|
322
|
-
const finger = trackFinger(nativeEvent, touchId.current);
|
|
323
|
-
if (!finger) {
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
// Cancel move in case some other element consumed a touchmove event and it was not fired.
|
|
328
|
-
if (nativeEvent.type === 'mousemove' && nativeEvent.buttons === 0) {
|
|
329
|
-
handleTouchEnd(nativeEvent);
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
let newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, columnHeaderElementRef.current.getBoundingClientRect(), resizeDirection.current);
|
|
333
|
-
newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
|
|
334
|
-
updateWidth(newWidth);
|
|
335
|
-
const params = {
|
|
336
|
-
element: columnHeaderElementRef.current,
|
|
337
|
-
colDef: colDefRef.current,
|
|
338
|
-
width: newWidth
|
|
339
|
-
};
|
|
340
|
-
apiRef.current.publishEvent('columnResize', params, nativeEvent);
|
|
341
|
-
});
|
|
342
|
-
const handleTouchStart = useEventCallback(event => {
|
|
343
|
-
const cellSeparator = findParentElementFromClassName(event.target, gridClasses['columnSeparator--resizable']);
|
|
344
|
-
// Let the event bubble if the target is not a col separator
|
|
345
|
-
if (!cellSeparator) {
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
// If touch-action: none; is not supported we need to prevent the scroll manually.
|
|
349
|
-
if (!doesSupportTouchActionNone()) {
|
|
350
|
-
event.preventDefault();
|
|
351
|
-
}
|
|
352
|
-
const touch = event.changedTouches[0];
|
|
353
|
-
if (touch != null) {
|
|
354
|
-
// A number that uniquely identifies the current finger in the touch session.
|
|
355
|
-
touchId.current = touch.identifier;
|
|
356
|
-
}
|
|
357
|
-
const columnHeaderElement = findParentElementFromClassName(event.target, gridClasses.columnHeader);
|
|
358
|
-
const field = getFieldFromHeaderElem(columnHeaderElement);
|
|
359
|
-
const colDef = apiRef.current.getColumn(field);
|
|
360
|
-
logger.debug(`Start Resize on col ${colDef.field}`);
|
|
361
|
-
apiRef.current.publishEvent('columnResizeStart', {
|
|
362
|
-
field
|
|
363
|
-
}, event);
|
|
364
|
-
storeReferences(colDef, cellSeparator, touch.clientX);
|
|
365
|
-
const doc = ownerDocument(event.currentTarget);
|
|
366
|
-
doc.addEventListener('touchmove', handleTouchMove);
|
|
367
|
-
doc.addEventListener('touchend', handleTouchEnd);
|
|
368
|
-
});
|
|
369
|
-
const stopListening = React.useCallback(() => {
|
|
370
|
-
const doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
371
|
-
doc.body.style.removeProperty('cursor');
|
|
372
|
-
doc.removeEventListener('mousemove', handleResizeMouseMove);
|
|
373
|
-
doc.removeEventListener('mouseup', handleResizeMouseUp);
|
|
374
|
-
doc.removeEventListener('touchmove', handleTouchMove);
|
|
375
|
-
doc.removeEventListener('touchend', handleTouchEnd);
|
|
376
|
-
// The click event runs right after the mouseup event, we want to wait until it
|
|
377
|
-
// has been canceled before removing our handler.
|
|
378
|
-
setTimeout(() => {
|
|
379
|
-
doc.removeEventListener('click', preventClick, true);
|
|
380
|
-
}, 100);
|
|
381
|
-
if (columnHeaderElementRef.current) {
|
|
382
|
-
columnHeaderElementRef.current.style.pointerEvents = 'unset';
|
|
383
|
-
}
|
|
384
|
-
}, [apiRef, columnHeaderElementRef, handleResizeMouseMove, handleResizeMouseUp, handleTouchMove, handleTouchEnd]);
|
|
385
|
-
const handleResizeStart = React.useCallback(({
|
|
386
|
-
field
|
|
387
|
-
}) => {
|
|
388
|
-
apiRef.current.setState(state => _extends({}, state, {
|
|
389
|
-
columnResize: _extends({}, state.columnResize, {
|
|
390
|
-
resizingColumnField: field
|
|
391
|
-
})
|
|
392
|
-
}));
|
|
393
|
-
apiRef.current.forceUpdate();
|
|
394
|
-
}, [apiRef]);
|
|
395
|
-
const handleResizeStop = React.useCallback(() => {
|
|
396
|
-
apiRef.current.setState(state => _extends({}, state, {
|
|
397
|
-
columnResize: _extends({}, state.columnResize, {
|
|
398
|
-
resizingColumnField: ''
|
|
399
|
-
})
|
|
400
|
-
}));
|
|
401
|
-
apiRef.current.forceUpdate();
|
|
402
|
-
}, [apiRef]);
|
|
403
|
-
const handleColumnResizeMouseDown = useEventCallback(({
|
|
404
|
-
colDef
|
|
405
|
-
}, event) => {
|
|
406
|
-
// Only handle left clicks
|
|
407
|
-
if (event.button !== 0) {
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// Skip if the column isn't resizable
|
|
412
|
-
if (!event.currentTarget.classList.contains(gridClasses['columnSeparator--resizable'])) {
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
// Avoid text selection
|
|
417
|
-
event.preventDefault();
|
|
418
|
-
logger.debug(`Start Resize on col ${colDef.field}`);
|
|
419
|
-
apiRef.current.publishEvent('columnResizeStart', {
|
|
420
|
-
field: colDef.field
|
|
421
|
-
}, event);
|
|
422
|
-
storeReferences(colDef, event.currentTarget, event.clientX);
|
|
423
|
-
const doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
424
|
-
doc.body.style.cursor = 'col-resize';
|
|
425
|
-
previousMouseClickEvent.current = event.nativeEvent;
|
|
426
|
-
doc.addEventListener('mousemove', handleResizeMouseMove);
|
|
427
|
-
doc.addEventListener('mouseup', handleResizeMouseUp);
|
|
428
|
-
|
|
429
|
-
// Prevent the click event if we have resized the column.
|
|
430
|
-
// Fixes https://github.com/mui/mui-x/issues/4777
|
|
431
|
-
doc.addEventListener('click', preventClick, true);
|
|
432
|
-
});
|
|
433
|
-
const handleColumnSeparatorDoubleClick = useEventCallback((params, event) => {
|
|
434
|
-
if (props.disableAutosize) {
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
// Only handle left clicks
|
|
439
|
-
if (event.button !== 0) {
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
const column = apiRef.current.state.columns.lookup[params.field];
|
|
443
|
-
if (column.resizable === false) {
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
apiRef.current.autosizeColumns(_extends({}, props.autosizeOptions, {
|
|
447
|
-
columns: [column.field]
|
|
448
|
-
}));
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* API METHODS
|
|
453
|
-
*/
|
|
454
|
-
|
|
455
|
-
const columnVirtualizationDisabled = useColumnVirtualizationDisabled(apiRef);
|
|
456
|
-
const isAutosizingRef = React.useRef(false);
|
|
457
|
-
const autosizeColumns = React.useCallback(async userOptions => {
|
|
458
|
-
var _apiRef$current$rootE, _userOptions$columns;
|
|
459
|
-
const root = (_apiRef$current$rootE = apiRef.current.rootElementRef) == null ? void 0 : _apiRef$current$rootE.current;
|
|
460
|
-
if (!root) {
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
if (isAutosizingRef.current) {
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
isAutosizingRef.current = true;
|
|
467
|
-
const state = gridColumnsStateSelector(apiRef.current.state);
|
|
468
|
-
const options = _extends({}, DEFAULT_GRID_AUTOSIZE_OPTIONS, userOptions, {
|
|
469
|
-
columns: (_userOptions$columns = userOptions == null ? void 0 : userOptions.columns) != null ? _userOptions$columns : state.orderedFields
|
|
470
|
-
});
|
|
471
|
-
options.columns = options.columns.filter(c => state.columnVisibilityModel[c] !== false);
|
|
472
|
-
const columns = options.columns.map(c => apiRef.current.state.columns.lookup[c]);
|
|
473
|
-
try {
|
|
474
|
-
apiRef.current.unstable_setColumnVirtualization(false);
|
|
475
|
-
await columnVirtualizationDisabled();
|
|
476
|
-
const widthByField = extractColumnWidths(apiRef, options, columns);
|
|
477
|
-
const newColumns = columns.map(column => _extends({}, column, {
|
|
478
|
-
width: widthByField[column.field],
|
|
479
|
-
computedWidth: widthByField[column.field]
|
|
480
|
-
}));
|
|
481
|
-
if (options.expand) {
|
|
482
|
-
const visibleColumns = state.orderedFields.map(field => state.lookup[field]).filter(c => state.columnVisibilityModel[c.field] !== false);
|
|
483
|
-
const totalWidth = visibleColumns.reduce((total, column) => {
|
|
484
|
-
var _ref, _widthByField$column$;
|
|
485
|
-
return total + ((_ref = (_widthByField$column$ = widthByField[column.field]) != null ? _widthByField$column$ : column.computedWidth) != null ? _ref : column.width);
|
|
486
|
-
}, 0);
|
|
487
|
-
const availableWidth = apiRef.current.getRootDimensions().viewportInnerSize.width;
|
|
488
|
-
const remainingWidth = availableWidth - totalWidth;
|
|
489
|
-
if (remainingWidth > 0) {
|
|
490
|
-
const widthPerColumn = remainingWidth / (newColumns.length || 1);
|
|
491
|
-
newColumns.forEach(column => {
|
|
492
|
-
column.width += widthPerColumn;
|
|
493
|
-
column.computedWidth += widthPerColumn;
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
apiRef.current.updateColumns(newColumns);
|
|
498
|
-
newColumns.forEach((newColumn, index) => {
|
|
499
|
-
if (newColumn.width !== columns[index].width) {
|
|
500
|
-
const width = newColumn.width;
|
|
501
|
-
apiRef.current.publishEvent('columnWidthChange', {
|
|
502
|
-
element: apiRef.current.getColumnHeaderElement(newColumn.field),
|
|
503
|
-
colDef: newColumn,
|
|
504
|
-
width
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
});
|
|
508
|
-
} finally {
|
|
509
|
-
apiRef.current.unstable_setColumnVirtualization(true);
|
|
510
|
-
isAutosizingRef.current = false;
|
|
511
|
-
}
|
|
512
|
-
}, [apiRef, columnVirtualizationDisabled]);
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* EFFECTS
|
|
516
|
-
*/
|
|
517
|
-
|
|
518
|
-
React.useEffect(() => stopListening, [stopListening]);
|
|
519
|
-
useOnMount(() => {
|
|
520
|
-
if (props.autosizeOnMount) {
|
|
521
|
-
Promise.resolve().then(() => {
|
|
522
|
-
apiRef.current.autosizeColumns(props.autosizeOptions);
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
useGridNativeEventListener(apiRef, () => {
|
|
527
|
-
var _apiRef$current$colum2;
|
|
528
|
-
return (_apiRef$current$colum2 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum2.current;
|
|
529
|
-
}, 'touchstart', handleTouchStart, {
|
|
530
|
-
passive: doesSupportTouchActionNone()
|
|
531
|
-
});
|
|
532
|
-
useGridApiMethod(apiRef, {
|
|
533
|
-
autosizeColumns
|
|
534
|
-
}, 'public');
|
|
535
|
-
useGridApiEventHandler(apiRef, 'columnResizeStop', handleResizeStop);
|
|
536
|
-
useGridApiEventHandler(apiRef, 'columnResizeStart', handleResizeStart);
|
|
537
|
-
useGridApiEventHandler(apiRef, 'columnSeparatorMouseDown', handleColumnResizeMouseDown);
|
|
538
|
-
useGridApiEventHandler(apiRef, 'columnSeparatorDoubleClick', handleColumnSeparatorDoubleClick);
|
|
539
|
-
useGridApiOptionHandler(apiRef, 'columnResize', props.onColumnResize);
|
|
540
|
-
useGridApiOptionHandler(apiRef, 'columnWidthChange', props.onColumnWidthChange);
|
|
541
|
-
};
|
|
542
|
-
function updateProperty(element, property, delta) {
|
|
543
|
-
if (!element) {
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
546
|
-
element.style[property] = `${parseInt(element.style[property], 10) + delta}px`;
|
|
547
|
-
}
|
package/esm/utils/domUtils.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { gridClasses } from '@mui/x-data-grid';
|
|
2
|
-
import { findParentElementFromClassName } from '@mui/x-data-grid/internals';
|
|
3
|
-
export function getFieldFromHeaderElem(colCellEl) {
|
|
4
|
-
return colCellEl.getAttribute('data-field');
|
|
5
|
-
}
|
|
6
|
-
export function findHeaderElementFromField(elem, field) {
|
|
7
|
-
return elem.querySelector(`[data-field="${field}"]`);
|
|
8
|
-
}
|
|
9
|
-
export function findGroupHeaderElementsFromField(elem, field) {
|
|
10
|
-
var _elem$querySelectorAl;
|
|
11
|
-
return Array.from((_elem$querySelectorAl = elem.querySelectorAll(`[data-fields*="|-${field}-|"]`)) != null ? _elem$querySelectorAl : []);
|
|
12
|
-
}
|
|
13
|
-
export function findGridCellElementsFromCol(col, api) {
|
|
14
|
-
var _api$virtualScrollerR;
|
|
15
|
-
const root = findParentElementFromClassName(col, gridClasses.root);
|
|
16
|
-
if (!root) {
|
|
17
|
-
throw new Error('MUI X: The root element is not found.');
|
|
18
|
-
}
|
|
19
|
-
const ariaColIndex = col.getAttribute('aria-colindex');
|
|
20
|
-
if (!ariaColIndex) {
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
23
|
-
const colIndex = Number(ariaColIndex) - 1;
|
|
24
|
-
const cells = [];
|
|
25
|
-
if (!((_api$virtualScrollerR = api.virtualScrollerRef) != null && _api$virtualScrollerR.current)) {
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
|
-
queryRows(api).forEach(rowElement => {
|
|
29
|
-
const rowId = rowElement.getAttribute('data-id');
|
|
30
|
-
if (!rowId) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
let columnIndex = colIndex;
|
|
34
|
-
const cellColSpanInfo = api.unstable_getCellColSpanInfo(rowId, colIndex);
|
|
35
|
-
if (cellColSpanInfo && cellColSpanInfo.spannedByColSpan) {
|
|
36
|
-
columnIndex = cellColSpanInfo.leftVisibleCellIndex;
|
|
37
|
-
}
|
|
38
|
-
const cell = rowElement.querySelector(`[data-colindex="${columnIndex}"]`);
|
|
39
|
-
if (cell) {
|
|
40
|
-
cells.push(cell);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return cells;
|
|
44
|
-
}
|
|
45
|
-
export function findGridElement(api, klass) {
|
|
46
|
-
return api.rootElementRef.current.querySelector(`.${gridClasses[klass]}`);
|
|
47
|
-
}
|
|
48
|
-
export function findLeftPinnedCellsAfterCol(api, col) {
|
|
49
|
-
const colIndex = parseCellColIndex(col);
|
|
50
|
-
if (colIndex === null) {
|
|
51
|
-
return [];
|
|
52
|
-
}
|
|
53
|
-
const cells = [];
|
|
54
|
-
queryRows(api).forEach(rowElement => {
|
|
55
|
-
const rowId = rowElement.getAttribute('data-id');
|
|
56
|
-
if (!rowId) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const rightPinnedCells = rowElement.querySelectorAll(`.${gridClasses['cell--pinnedLeft']}`);
|
|
60
|
-
rightPinnedCells.forEach(cell => {
|
|
61
|
-
const currentColIndex = parseCellColIndex(cell);
|
|
62
|
-
if (currentColIndex !== null && currentColIndex > colIndex) {
|
|
63
|
-
cells.push(cell);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
return cells;
|
|
68
|
-
}
|
|
69
|
-
export function findRightPinnedCellsBeforeCol(api, col) {
|
|
70
|
-
const colIndex = parseCellColIndex(col);
|
|
71
|
-
if (colIndex === null) {
|
|
72
|
-
return [];
|
|
73
|
-
}
|
|
74
|
-
const cells = [];
|
|
75
|
-
queryRows(api).forEach(rowElement => {
|
|
76
|
-
const rowId = rowElement.getAttribute('data-id');
|
|
77
|
-
if (!rowId) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const rightPinnedCells = rowElement.querySelectorAll(`.${gridClasses['cell--pinnedRight']}`);
|
|
81
|
-
rightPinnedCells.forEach(cell => {
|
|
82
|
-
const currentColIndex = parseCellColIndex(cell);
|
|
83
|
-
if (currentColIndex !== null && currentColIndex < colIndex) {
|
|
84
|
-
cells.push(cell);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
return cells;
|
|
89
|
-
}
|
|
90
|
-
export function findGridHeader(api, field) {
|
|
91
|
-
const headers = api.columnHeadersContainerElementRef.current;
|
|
92
|
-
return headers.querySelector(`:scope > div > div > [data-field="${field}"][role="columnheader"]`);
|
|
93
|
-
}
|
|
94
|
-
export function findGridCells(api, field) {
|
|
95
|
-
const container = api.virtualScrollerRef.current;
|
|
96
|
-
return Array.from(container.querySelectorAll(`:scope > div > div > div > [data-field="${field}"][role="gridcell"]`));
|
|
97
|
-
}
|
|
98
|
-
function queryRows(api) {
|
|
99
|
-
return api.virtualScrollerRef.current.querySelectorAll(
|
|
100
|
-
// Use > to ignore rows from nested data grids (e.g. in detail panel)
|
|
101
|
-
`:scope > div > div > .${gridClasses.row}`);
|
|
102
|
-
}
|
|
103
|
-
function parseCellColIndex(col) {
|
|
104
|
-
const ariaColIndex = col.getAttribute('aria-colindex');
|
|
105
|
-
if (!ariaColIndex) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
return Number(ariaColIndex) - 1;
|
|
109
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { GridStatePro } from '../../../models/gridStatePro';
|
|
2
|
-
export declare const gridColumnResizeSelector: (state: GridStatePro) => import("./columnResizeState").GridColumnResizeState;
|
|
3
|
-
export declare const gridResizingColumnFieldSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, string>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.gridResizingColumnFieldSelector = exports.gridColumnResizeSelector = void 0;
|
|
7
|
-
var _internals = require("@mui/x-data-grid/internals");
|
|
8
|
-
const gridColumnResizeSelector = state => state.columnResize;
|
|
9
|
-
exports.gridColumnResizeSelector = gridColumnResizeSelector;
|
|
10
|
-
const gridResizingColumnFieldSelector = exports.gridResizingColumnFieldSelector = (0, _internals.createSelector)(gridColumnResizeSelector, columnResize => columnResize.resizingColumnField);
|