@mui/x-data-grid 5.16.0 → 5.17.2
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 +138 -1
- package/components/GridRow.d.ts +2 -1
- package/components/GridRow.js +132 -83
- package/components/cell/GridBooleanCell.js +2 -1
- package/components/cell/GridCell.js +9 -1
- package/components/cell/GridEditBooleanCell.js +2 -1
- package/components/cell/GridEditDateCell.js +2 -1
- package/components/cell/GridEditInputCell.js +2 -1
- package/components/cell/GridEditSingleSelectCell.js +2 -1
- package/components/cell/GridSkeletonCell.d.ts +12 -0
- package/components/cell/GridSkeletonCell.js +60 -0
- package/components/cell/index.d.ts +1 -0
- package/components/cell/index.js +2 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/components/containers/GridRootStyles.js +2 -0
- package/components/panel/GridColumnsPanel.d.ts +6 -1
- package/components/panel/GridColumnsPanel.js +38 -6
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +8 -0
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -1
- package/hooks/features/editRows/useGridCellEditing.new.js +8 -2
- package/hooks/features/editRows/useGridRowEditing.new.js +8 -2
- package/hooks/features/filter/gridFilterUtils.d.ts +1 -1
- package/hooks/features/filter/gridFilterUtils.js +55 -54
- package/hooks/features/filter/useGridFilter.js +1 -1
- package/hooks/features/focus/useGridFocus.js +13 -3
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/hooks/features/rows/useGridParamsApi.js +1 -1
- package/hooks/features/rows/useGridRows.js +65 -8
- package/hooks/features/rows/useGridRowsMeta.js +36 -16
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/legacy/components/GridRow.js +135 -83
- package/legacy/components/cell/GridBooleanCell.js +2 -1
- package/legacy/components/cell/GridCell.js +11 -1
- package/legacy/components/cell/GridEditBooleanCell.js +2 -1
- package/legacy/components/cell/GridEditDateCell.js +2 -1
- package/legacy/components/cell/GridEditInputCell.js +2 -1
- package/legacy/components/cell/GridEditSingleSelectCell.js +2 -1
- package/legacy/components/cell/GridSkeletonCell.js +57 -0
- package/legacy/components/cell/index.js +2 -1
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/legacy/components/containers/GridRootStyles.js +3 -3
- package/legacy/components/panel/GridColumnsPanel.js +41 -6
- package/legacy/constants/defaultGridSlotsComponents.js +2 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +11 -5
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +8 -2
- package/legacy/hooks/features/filter/gridFilterUtils.js +61 -56
- package/legacy/hooks/features/filter/useGridFilter.js +1 -1
- package/legacy/hooks/features/focus/useGridFocus.js +13 -3
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/legacy/hooks/features/rows/useGridParamsApi.js +1 -1
- package/legacy/hooks/features/rows/useGridRows.js +73 -8
- package/legacy/hooks/features/rows/useGridRowsMeta.js +45 -18
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +31 -13
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -1
- package/legacy/models/events/gridEvents.js +2 -0
- package/legacy/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/legacy/models/params/index.js +2 -1
- package/legacy/utils/utils.js +25 -0
- package/models/api/gridParamsApi.d.ts +1 -1
- package/models/api/gridRowApi.d.ts +6 -0
- package/models/api/gridRowsMetaApi.d.ts +6 -1
- package/models/events/gridEventLookup.d.ts +7 -1
- package/models/events/gridEvents.d.ts +3 -1
- package/models/events/gridEvents.js +2 -0
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/params/gridCellParams.d.ts +7 -2
- package/models/params/gridRenderedRowsIntervalChangeParams.d.ts +10 -0
- package/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/modern/components/GridRow.js +129 -82
- package/modern/components/cell/GridBooleanCell.js +2 -1
- package/modern/components/cell/GridCell.js +9 -1
- package/modern/components/cell/GridEditBooleanCell.js +2 -1
- package/modern/components/cell/GridEditDateCell.js +2 -1
- package/modern/components/cell/GridEditInputCell.js +2 -1
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -1
- package/modern/components/cell/GridSkeletonCell.js +60 -0
- package/modern/components/cell/index.js +2 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/modern/components/containers/GridRootStyles.js +2 -0
- package/modern/components/panel/GridColumnsPanel.js +38 -6
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +8 -2
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +8 -2
- package/modern/hooks/features/filter/gridFilterUtils.js +54 -53
- package/modern/hooks/features/filter/useGridFilter.js +1 -1
- package/modern/hooks/features/focus/useGridFocus.js +13 -3
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/modern/hooks/features/rows/useGridParamsApi.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +65 -8
- package/modern/hooks/features/rows/useGridRowsMeta.js +36 -16
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/models/events/gridEvents.js +2 -0
- package/modern/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/modern/utils/utils.js +23 -0
- package/node/components/GridRow.js +131 -75
- package/node/components/cell/GridBooleanCell.js +2 -1
- package/node/components/cell/GridCell.js +9 -1
- package/node/components/cell/GridEditBooleanCell.js +2 -1
- package/node/components/cell/GridEditDateCell.js +2 -1
- package/node/components/cell/GridEditInputCell.js +2 -1
- package/node/components/cell/GridEditSingleSelectCell.js +2 -1
- package/node/components/cell/GridSkeletonCell.js +81 -0
- package/node/components/cell/index.js +13 -0
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/node/components/containers/GridRootStyles.js +2 -0
- package/node/components/panel/GridColumnsPanel.js +36 -5
- package/node/constants/defaultGridSlotsComponents.js +1 -0
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/editRows/useGridCellEditing.new.js +9 -2
- package/node/hooks/features/editRows/useGridRowEditing.new.js +9 -2
- package/node/hooks/features/filter/gridFilterUtils.js +55 -55
- package/node/hooks/features/filter/useGridFilter.js +1 -1
- package/node/hooks/features/focus/useGridFocus.js +13 -3
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/node/hooks/features/rows/useGridParamsApi.js +1 -1
- package/node/hooks/features/rows/useGridRows.js +60 -7
- package/node/hooks/features/rows/useGridRowsMeta.js +35 -15
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/node/index.js +1 -1
- package/node/internals/index.js +6 -0
- package/node/models/events/gridEvents.js +2 -0
- package/node/models/params/gridRenderedRowsIntervalChangeParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/node/utils/utils.js +27 -0
- package/package.json +1 -1
- package/utils/utils.d.ts +2 -0
- package/utils/utils.js +23 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { debounce } from '@mui/material/utils';
|
|
3
|
+
import { debounce, capitalize } from '@mui/material/utils';
|
|
4
4
|
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
5
5
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
6
6
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
@@ -47,7 +47,7 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
47
47
|
if (!rowsHeightLookup.current[row.id]) {
|
|
48
48
|
rowsHeightLookup.current[row.id] = {
|
|
49
49
|
sizes: {
|
|
50
|
-
|
|
50
|
+
baseCenter: rowHeightFromDensity
|
|
51
51
|
},
|
|
52
52
|
isResized: false,
|
|
53
53
|
autoHeight: false,
|
|
@@ -62,7 +62,7 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
62
62
|
sizes
|
|
63
63
|
} = rowsHeightLookup.current[row.id];
|
|
64
64
|
let baseRowHeight = rowHeightFromDensity;
|
|
65
|
-
const existingBaseRowHeight = sizes.
|
|
65
|
+
const existingBaseRowHeight = sizes.baseCenter;
|
|
66
66
|
|
|
67
67
|
if (isResized) {
|
|
68
68
|
// Do not recalculate resized row height and use the value from the lookup
|
|
@@ -93,12 +93,19 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
93
93
|
}
|
|
94
94
|
} else {
|
|
95
95
|
rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
|
|
96
|
-
}
|
|
96
|
+
}
|
|
97
97
|
|
|
98
|
+
const existingBaseSizes = Object.entries(sizes).reduce((acc, [key, size]) => {
|
|
99
|
+
if (/^base[A-Z]/.test(key)) {
|
|
100
|
+
acc[key] = size;
|
|
101
|
+
}
|
|
98
102
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
return acc;
|
|
104
|
+
}, {}); // We use an object to make simple to check if a height is already added or not
|
|
105
|
+
|
|
106
|
+
const initialHeights = _extends({}, existingBaseSizes, {
|
|
107
|
+
baseCenter: baseRowHeight
|
|
108
|
+
});
|
|
102
109
|
|
|
103
110
|
if (getRowSpacing) {
|
|
104
111
|
var _spacing$top, _spacing$bottom;
|
|
@@ -121,9 +128,17 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
121
128
|
const positions = [];
|
|
122
129
|
const currentPageTotalHeight = currentPage.rows.reduce((acc, row) => {
|
|
123
130
|
positions.push(acc);
|
|
131
|
+
let maximumBaseSize = 0;
|
|
132
|
+
let otherSizes = 0;
|
|
124
133
|
const processedSizes = calculateRowProcessedSizes(row);
|
|
125
|
-
|
|
126
|
-
|
|
134
|
+
Object.entries(processedSizes).forEach(([size, value]) => {
|
|
135
|
+
if (/^base[A-Z]/.test(size)) {
|
|
136
|
+
maximumBaseSize = value > maximumBaseSize ? value : maximumBaseSize;
|
|
137
|
+
} else {
|
|
138
|
+
otherSizes += value;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
return acc + maximumBaseSize + otherSizes;
|
|
127
142
|
}, 0);
|
|
128
143
|
pinnedRows == null ? void 0 : (_pinnedRows$top = pinnedRows.top) == null ? void 0 : _pinnedRows$top.forEach(row => {
|
|
129
144
|
calculateRowProcessedSizes(row);
|
|
@@ -149,7 +164,7 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
149
164
|
}, [apiRef, currentPage.rows, rowHeightFromDensity, getRowHeightProp, getRowSpacing, getEstimatedRowHeight, pinnedRows]);
|
|
150
165
|
const getRowHeight = React.useCallback(rowId => {
|
|
151
166
|
const height = rowsHeightLookup.current[rowId];
|
|
152
|
-
return height ? height.sizes.
|
|
167
|
+
return height ? height.sizes.baseCenter : rowHeightFromDensity;
|
|
153
168
|
}, [rowHeightFromDensity]);
|
|
154
169
|
|
|
155
170
|
const getRowInternalSizes = rowId => {
|
|
@@ -159,21 +174,21 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
159
174
|
};
|
|
160
175
|
|
|
161
176
|
const setRowHeight = React.useCallback((id, height) => {
|
|
162
|
-
rowsHeightLookup.current[id].sizes.
|
|
177
|
+
rowsHeightLookup.current[id].sizes.baseCenter = height;
|
|
163
178
|
rowsHeightLookup.current[id].isResized = true;
|
|
164
179
|
rowsHeightLookup.current[id].needsFirstMeasurement = false;
|
|
165
180
|
hydrateRowsMeta();
|
|
166
181
|
}, [hydrateRowsMeta]);
|
|
167
182
|
const debouncedHydrateRowsMeta = React.useMemo(() => debounce(hydrateRowsMeta), [hydrateRowsMeta]);
|
|
168
|
-
const storeMeasuredRowHeight = React.useCallback((id, height) => {
|
|
183
|
+
const storeMeasuredRowHeight = React.useCallback((id, height, position) => {
|
|
169
184
|
if (!rowsHeightLookup.current[id] || !rowsHeightLookup.current[id].autoHeight) {
|
|
170
185
|
return;
|
|
171
186
|
} // Only trigger hydration if the value is different, otherwise we trigger a loop
|
|
172
187
|
|
|
173
188
|
|
|
174
|
-
const needsHydration = rowsHeightLookup.current[id].sizes
|
|
189
|
+
const needsHydration = rowsHeightLookup.current[id].sizes[`base${capitalize(position)}`] !== height;
|
|
175
190
|
rowsHeightLookup.current[id].needsFirstMeasurement = false;
|
|
176
|
-
rowsHeightLookup.current[id].sizes
|
|
191
|
+
rowsHeightLookup.current[id].sizes[`base${capitalize(position)}`] = height;
|
|
177
192
|
|
|
178
193
|
if (needsHydration) {
|
|
179
194
|
debouncedHydrateRowsMeta();
|
|
@@ -191,7 +206,11 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
191
206
|
if (hasRowWithAutoHeight.current && index > lastMeasuredRowIndex.current) {
|
|
192
207
|
lastMeasuredRowIndex.current = index;
|
|
193
208
|
}
|
|
194
|
-
}, []);
|
|
209
|
+
}, []);
|
|
210
|
+
const resetRowHeights = React.useCallback(() => {
|
|
211
|
+
rowsHeightLookup.current = {};
|
|
212
|
+
hydrateRowsMeta();
|
|
213
|
+
}, [hydrateRowsMeta]); // The effect is used to build the rows meta data - currentPageTotalHeight and positions.
|
|
195
214
|
// Because of variable row height this is needed for the virtualization
|
|
196
215
|
|
|
197
216
|
React.useEffect(() => {
|
|
@@ -205,7 +224,8 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
205
224
|
unstable_getRowHeight: getRowHeight,
|
|
206
225
|
unstable_getRowInternalSizes: getRowInternalSizes,
|
|
207
226
|
unstable_setRowHeight: setRowHeight,
|
|
208
|
-
unstable_storeRowHeightMeasurement: storeMeasuredRowHeight
|
|
227
|
+
unstable_storeRowHeightMeasurement: storeMeasuredRowHeight,
|
|
228
|
+
resetRowHeights
|
|
209
229
|
};
|
|
210
230
|
useGridApiMethod(apiRef, rowsMetaApi, 'GridRowsMetaApi');
|
|
211
231
|
};
|
|
@@ -25,10 +25,10 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
25
25
|
updateRenderZonePosition: (nextRenderContext: GridRenderContext) => void;
|
|
26
26
|
getRows: (params?: {
|
|
27
27
|
renderContext: GridRenderContext | null;
|
|
28
|
+
position?: string | undefined;
|
|
28
29
|
minFirstColumn?: number | undefined;
|
|
29
30
|
maxLastColumn?: number | undefined;
|
|
30
31
|
availableSpace?: number | null | undefined;
|
|
31
|
-
ignoreAutoHeight?: boolean | undefined;
|
|
32
32
|
rows?: GridRowEntry<import("../../../models").GridValidRowModel>[] | undefined;
|
|
33
33
|
rowIndexOffset?: number | undefined;
|
|
34
34
|
}) => JSX.Element[] | null;
|
|
@@ -215,8 +215,19 @@ export const useGridVirtualScroller = props => {
|
|
|
215
215
|
}, [renderContext, updateRenderZonePosition]);
|
|
216
216
|
const updateRenderContext = React.useCallback(nextRenderContext => {
|
|
217
217
|
setRenderContext(nextRenderContext);
|
|
218
|
+
const [firstRowToRender, lastRowToRender] = getRenderableIndexes({
|
|
219
|
+
firstIndex: nextRenderContext.firstRowIndex,
|
|
220
|
+
lastIndex: nextRenderContext.lastRowIndex,
|
|
221
|
+
minFirstIndex: 0,
|
|
222
|
+
maxLastIndex: currentPage.rows.length,
|
|
223
|
+
buffer: rootProps.rowBuffer
|
|
224
|
+
});
|
|
225
|
+
apiRef.current.publishEvent('renderedRowsIntervalChange', {
|
|
226
|
+
firstRowToRender,
|
|
227
|
+
lastRowToRender
|
|
228
|
+
});
|
|
218
229
|
prevRenderContext.current = nextRenderContext;
|
|
219
|
-
}, [setRenderContext, prevRenderContext]);
|
|
230
|
+
}, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
|
|
220
231
|
React.useEffect(() => {
|
|
221
232
|
if (containerWidth == null) {
|
|
222
233
|
return;
|
|
@@ -287,8 +298,8 @@ export const useGridVirtualScroller = props => {
|
|
|
287
298
|
minFirstColumn = renderZoneMinColumnIndex,
|
|
288
299
|
maxLastColumn = renderZoneMaxColumnIndex,
|
|
289
300
|
availableSpace = containerWidth,
|
|
290
|
-
|
|
291
|
-
|
|
301
|
+
rowIndexOffset = 0,
|
|
302
|
+
position = 'center'
|
|
292
303
|
} = params;
|
|
293
304
|
|
|
294
305
|
if (!nextRenderContext || availableSpace == null) {
|
|
@@ -358,7 +369,7 @@ export const useGridVirtualScroller = props => {
|
|
|
358
369
|
model
|
|
359
370
|
} = renderedRows[i];
|
|
360
371
|
const lastVisibleRowIndex = firstRowToRender + i === currentPage.rows.length - 1;
|
|
361
|
-
const baseRowHeight = !apiRef.current.unstable_rowHasAutoHeight(id)
|
|
372
|
+
const baseRowHeight = !apiRef.current.unstable_rowHasAutoHeight(id) ? apiRef.current.unstable_getRowHeight(id) : 'auto';
|
|
362
373
|
let isSelected;
|
|
363
374
|
|
|
364
375
|
if (selectedRowsLookup[id] == null) {
|
|
@@ -384,7 +395,8 @@ export const useGridVirtualScroller = props => {
|
|
|
384
395
|
selected: isSelected,
|
|
385
396
|
index: rowIndexOffset + ((currentPage == null ? void 0 : (_currentPage$range5 = currentPage.range) == null ? void 0 : _currentPage$range5.firstRowIndex) || 0) + firstRowToRender + i,
|
|
386
397
|
containerWidth: availableSpace,
|
|
387
|
-
isLastVisible: lastVisibleRowIndex
|
|
398
|
+
isLastVisible: lastVisibleRowIndex,
|
|
399
|
+
position: position
|
|
388
400
|
}, typeof getRowProps === 'function' ? getRowProps(id, model) : {}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.row), id));
|
|
389
401
|
}
|
|
390
402
|
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export { useGridEvents } from '../hooks/features/events/useGridEvents';
|
|
|
45
45
|
export { useGridDimensions } from '../hooks/features/dimensions/useGridDimensions';
|
|
46
46
|
export { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
47
47
|
export type { GridRestoreStatePreProcessingContext } from '../hooks/features/statePersistence/gridStatePersistenceInterface';
|
|
48
|
-
export { useGridVirtualScroller } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
48
|
+
export { useGridVirtualScroller, getRenderableIndexes, } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
49
49
|
export { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
50
50
|
export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
51
51
|
export type { GridStateInitializer } from '../hooks/utils/useGridInitializeState';
|
package/internals/index.js
CHANGED
|
@@ -38,7 +38,7 @@ export { useGridScroll } from '../hooks/features/scroll/useGridScroll';
|
|
|
38
38
|
export { useGridEvents } from '../hooks/features/events/useGridEvents';
|
|
39
39
|
export { useGridDimensions } from '../hooks/features/dimensions/useGridDimensions';
|
|
40
40
|
export { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
41
|
-
export { useGridVirtualScroller } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
41
|
+
export { useGridVirtualScroller, getRenderableIndexes } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
42
42
|
export { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
43
43
|
export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
44
44
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
5
|
-
|
|
6
|
-
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
7
|
-
|
|
8
|
-
/* eslint-disable jsx-a11y/interactive-supports-focus */
|
|
5
|
+
var _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
9
6
|
import * as React from 'react';
|
|
10
7
|
import PropTypes from 'prop-types';
|
|
11
8
|
import clsx from 'clsx';
|
|
@@ -24,6 +21,7 @@ import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelTogg
|
|
|
24
21
|
import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSelector';
|
|
25
22
|
import { gridRowTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
26
23
|
import { gridDensityHeaderGroupingMaxDepthSelector } from '../hooks/features/density/densitySelector';
|
|
24
|
+
import { randomNumberBetween } from '../utils/utils';
|
|
27
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
27
|
|
|
@@ -64,6 +62,7 @@ function GridRow(props) {
|
|
|
64
62
|
row = props.row,
|
|
65
63
|
index = props.index,
|
|
66
64
|
styleProp = props.style,
|
|
65
|
+
position = props.position,
|
|
67
66
|
rowHeight = props.rowHeight,
|
|
68
67
|
className = props.className,
|
|
69
68
|
visibleColumns = props.visibleColumns,
|
|
@@ -111,9 +110,9 @@ function GridRow(props) {
|
|
|
111
110
|
React.useLayoutEffect(function () {
|
|
112
111
|
if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
113
112
|
// Fallback for IE
|
|
114
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
113
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight, position);
|
|
115
114
|
}
|
|
116
|
-
}, [apiRef, rowHeight, rowId]);
|
|
115
|
+
}, [apiRef, rowHeight, rowId, position]);
|
|
117
116
|
React.useLayoutEffect(function () {
|
|
118
117
|
if (currentPage.range) {
|
|
119
118
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -140,13 +139,13 @@ function GridRow(props) {
|
|
|
140
139
|
entry = _entries[0];
|
|
141
140
|
|
|
142
141
|
var height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
|
|
143
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
|
|
142
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height, position);
|
|
144
143
|
});
|
|
145
144
|
resizeObserver.observe(rootElement);
|
|
146
145
|
return function () {
|
|
147
146
|
return resizeObserver.disconnect();
|
|
148
147
|
};
|
|
149
|
-
}, [apiRef, currentPage.range, index, rowHeight, rowId]);
|
|
148
|
+
}, [apiRef, currentPage.range, index, rowHeight, rowId, position]);
|
|
150
149
|
var publish = React.useCallback(function (eventName, propHandler) {
|
|
151
150
|
return function (event) {
|
|
152
151
|
// Ignore portal
|
|
@@ -204,48 +203,9 @@ function GridRow(props) {
|
|
|
204
203
|
|
|
205
204
|
publish('rowClick', onClick)(event);
|
|
206
205
|
}, [apiRef, onClick, publish, rowId]);
|
|
206
|
+
var getCell = React.useCallback(function (column, cellProps) {
|
|
207
|
+
var _rootProps$components;
|
|
207
208
|
|
|
208
|
-
var style = _extends({}, styleProp, {
|
|
209
|
-
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
210
|
-
// max-height doesn't support "auto"
|
|
211
|
-
minHeight: rowHeight
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
var sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
215
|
-
|
|
216
|
-
if (sizes != null && sizes.spacingTop) {
|
|
217
|
-
var property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
218
|
-
style[property] = sizes.spacingTop;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if (sizes != null && sizes.spacingBottom) {
|
|
222
|
-
var _property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
223
|
-
|
|
224
|
-
style[_property] = sizes.spacingBottom;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
var rowClassName = null;
|
|
228
|
-
|
|
229
|
-
if (typeof rootProps.getRowClassName === 'function') {
|
|
230
|
-
var indexRelativeToCurrentPage = index - currentPage.range.firstRowIndex;
|
|
231
|
-
|
|
232
|
-
var rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
233
|
-
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
234
|
-
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
235
|
-
indexRelativeToCurrentPage: indexRelativeToCurrentPage
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
rowClassName = rootProps.getRowClassName(rowParams);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
var cells = [];
|
|
242
|
-
|
|
243
|
-
for (var i = 0; i < renderedColumns.length; i += 1) {
|
|
244
|
-
var column = renderedColumns[i];
|
|
245
|
-
var indexRelativeToAllColumns = firstColumnToRender + i;
|
|
246
|
-
var isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
247
|
-
var removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
248
|
-
var showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
|
|
249
209
|
var cellParams = apiRef.current.getCellParams(rowId, column.field);
|
|
250
210
|
var classNames = [];
|
|
251
211
|
var disableDragEvents = rootProps.disableColumnReorder && column.disableReorder || !rootProps.rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
|
|
@@ -295,52 +255,143 @@ function GridRow(props) {
|
|
|
295
255
|
|
|
296
256
|
var hasFocus = cellFocus !== null && cellFocus.id === rowId && cellFocus.field === column.field;
|
|
297
257
|
var tabIndex = cellTabIndex !== null && cellTabIndex.id === rowId && cellTabIndex.field === column.field && cellParams.cellMode === 'view' ? 0 : -1;
|
|
258
|
+
return /*#__PURE__*/_jsx(rootProps.components.Cell, _extends({
|
|
259
|
+
value: cellParams.value,
|
|
260
|
+
field: column.field,
|
|
261
|
+
width: cellProps.width,
|
|
262
|
+
rowId: rowId,
|
|
263
|
+
height: rowHeight,
|
|
264
|
+
showRightBorder: cellProps.showRightBorder,
|
|
265
|
+
formattedValue: cellParams.formattedValue,
|
|
266
|
+
align: column.align || 'left',
|
|
267
|
+
cellMode: cellParams.cellMode,
|
|
268
|
+
colIndex: cellProps.indexRelativeToAllColumns,
|
|
269
|
+
isEditable: cellParams.isEditable,
|
|
270
|
+
hasFocus: hasFocus,
|
|
271
|
+
tabIndex: tabIndex,
|
|
272
|
+
className: clsx(classNames),
|
|
273
|
+
colSpan: cellProps.colSpan,
|
|
274
|
+
disableDragEvents: disableDragEvents
|
|
275
|
+
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
|
|
276
|
+
children: content
|
|
277
|
+
}), column.field);
|
|
278
|
+
}, [apiRef, cellTabIndex, editRowsState, cellFocus, rootProps, row, rowHeight, rowId, treeDepth, sortModel.length]);
|
|
279
|
+
var sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
280
|
+
var minHeight = rowHeight;
|
|
281
|
+
|
|
282
|
+
if (minHeight === 'auto' && sizes) {
|
|
283
|
+
var numberOfBaseSizes = 0;
|
|
284
|
+
var maximumSize = Object.entries(sizes).reduce(function (acc, _ref3) {
|
|
285
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
286
|
+
key = _ref4[0],
|
|
287
|
+
size = _ref4[1];
|
|
288
|
+
|
|
289
|
+
var isBaseHeight = /^base[A-Z]/.test(key);
|
|
290
|
+
|
|
291
|
+
if (!isBaseHeight) {
|
|
292
|
+
return acc;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
numberOfBaseSizes += 1;
|
|
296
|
+
|
|
297
|
+
if (size > acc) {
|
|
298
|
+
return size;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return acc;
|
|
302
|
+
}, 0);
|
|
303
|
+
|
|
304
|
+
if (maximumSize > 0 && numberOfBaseSizes > 1) {
|
|
305
|
+
minHeight = maximumSize;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
var style = _extends({}, styleProp, {
|
|
310
|
+
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
311
|
+
// max-height doesn't support "auto"
|
|
312
|
+
minHeight: minHeight
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
if (sizes != null && sizes.spacingTop) {
|
|
316
|
+
var property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
317
|
+
style[property] = sizes.spacingTop;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (sizes != null && sizes.spacingBottom) {
|
|
321
|
+
var _property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
322
|
+
|
|
323
|
+
style[_property] = sizes.spacingBottom;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
var rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
327
|
+
|
|
328
|
+
if (typeof rootProps.getRowClassName === 'function') {
|
|
329
|
+
var _currentPage$range;
|
|
330
|
+
|
|
331
|
+
var indexRelativeToCurrentPage = index - (((_currentPage$range = currentPage.range) == null ? void 0 : _currentPage$range.firstRowIndex) || 0);
|
|
332
|
+
|
|
333
|
+
var rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
334
|
+
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
335
|
+
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
336
|
+
indexRelativeToCurrentPage: indexRelativeToCurrentPage
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
var randomNumber = randomNumberBetween(10000, 20, 80);
|
|
343
|
+
var cells = [];
|
|
344
|
+
|
|
345
|
+
for (var i = 0; i < renderedColumns.length; i += 1) {
|
|
346
|
+
var column = renderedColumns[i];
|
|
347
|
+
var indexRelativeToAllColumns = firstColumnToRender + i;
|
|
348
|
+
var isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
349
|
+
var removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
350
|
+
var showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
|
|
298
351
|
var cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
299
352
|
|
|
300
353
|
if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
disableDragEvents: disableDragEvents
|
|
323
|
-
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
|
|
324
|
-
children: content
|
|
325
|
-
}), column.field));
|
|
354
|
+
if (row) {
|
|
355
|
+
var _cellColSpanInfo$cell = cellColSpanInfo.cellProps,
|
|
356
|
+
colSpan = _cellColSpanInfo$cell.colSpan,
|
|
357
|
+
width = _cellColSpanInfo$cell.width;
|
|
358
|
+
var cellProps = {
|
|
359
|
+
width: width,
|
|
360
|
+
colSpan: colSpan,
|
|
361
|
+
showRightBorder: showRightBorder,
|
|
362
|
+
indexRelativeToAllColumns: indexRelativeToAllColumns
|
|
363
|
+
};
|
|
364
|
+
cells.push(getCell(column, cellProps));
|
|
365
|
+
} else {
|
|
366
|
+
var _width = cellColSpanInfo.cellProps.width;
|
|
367
|
+
var contentWidth = Math.round(randomNumber());
|
|
368
|
+
cells.push( /*#__PURE__*/_jsx(rootProps.components.SkeletonCell, {
|
|
369
|
+
width: _width,
|
|
370
|
+
contentWidth: contentWidth,
|
|
371
|
+
field: column.field,
|
|
372
|
+
align: column.align
|
|
373
|
+
}, column.field));
|
|
374
|
+
}
|
|
326
375
|
}
|
|
327
376
|
}
|
|
328
377
|
|
|
329
378
|
var emptyCellWidth = containerWidth - columnsTotalWidth;
|
|
379
|
+
var eventHandlers = row ? {
|
|
380
|
+
onClick: publishClick,
|
|
381
|
+
onDoubleClick: publish('rowDoubleClick', onDoubleClick),
|
|
382
|
+
onMouseEnter: publish('rowMouseEnter', onMouseEnter),
|
|
383
|
+
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
384
|
+
} : null;
|
|
330
385
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
331
386
|
ref: ref,
|
|
332
387
|
"data-id": rowId,
|
|
333
388
|
"data-rowindex": index,
|
|
334
389
|
role: "row",
|
|
335
|
-
className: clsx(
|
|
390
|
+
className: clsx.apply(void 0, _toConsumableArray(rowClassNames).concat([classes.root, className])),
|
|
336
391
|
"aria-rowindex": ariaRowIndex,
|
|
337
392
|
"aria-selected": selected,
|
|
338
|
-
style: style
|
|
339
|
-
|
|
340
|
-
onDoubleClick: publish('rowDoubleClick', onDoubleClick),
|
|
341
|
-
onMouseEnter: publish('rowMouseEnter', onMouseEnter),
|
|
342
|
-
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
343
|
-
}, other, {
|
|
393
|
+
style: style
|
|
394
|
+
}, eventHandlers, other, {
|
|
344
395
|
children: [cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
|
|
345
396
|
width: emptyCellWidth
|
|
346
397
|
})]
|
|
@@ -365,8 +416,9 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
365
416
|
index: PropTypes.number.isRequired,
|
|
366
417
|
isLastVisible: PropTypes.bool,
|
|
367
418
|
lastColumnToRender: PropTypes.number.isRequired,
|
|
419
|
+
position: PropTypes.oneOf(['center', 'left', 'right']).isRequired,
|
|
368
420
|
renderedColumns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
369
|
-
row: PropTypes.object
|
|
421
|
+
row: PropTypes.object,
|
|
370
422
|
rowHeight: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
|
|
371
423
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
372
424
|
selected: PropTypes.bool.isRequired,
|
|
@@ -133,7 +133,8 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
133
133
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
|
-
* The cell value
|
|
136
|
+
* The cell value.
|
|
137
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
137
138
|
*/
|
|
138
139
|
value: PropTypes.any
|
|
139
140
|
} : void 0;
|
|
@@ -99,6 +99,16 @@ function GridCell(props) {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
}, [apiRef, field, onMouseUp, rowId]);
|
|
102
|
+
var publishMouseDown = React.useCallback(function (eventName) {
|
|
103
|
+
return function (event) {
|
|
104
|
+
var params = apiRef.current.getCellParams(rowId, field || '');
|
|
105
|
+
apiRef.current.publishEvent(eventName, params, event);
|
|
106
|
+
|
|
107
|
+
if (onMouseDown) {
|
|
108
|
+
onMouseDown(event);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}, [apiRef, field, onMouseDown, rowId]);
|
|
102
112
|
var publish = React.useCallback(function (eventName, propHandler) {
|
|
103
113
|
return function (event) {
|
|
104
114
|
// Ignore portal
|
|
@@ -205,7 +215,7 @@ function GridCell(props) {
|
|
|
205
215
|
tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
|
|
206
216
|
onClick: publish('cellClick', onClick),
|
|
207
217
|
onDoubleClick: publish('cellDoubleClick', onDoubleClick),
|
|
208
|
-
onMouseDown:
|
|
218
|
+
onMouseDown: publishMouseDown('cellMouseDown'),
|
|
209
219
|
onMouseUp: publishMouseUp('cellMouseUp'),
|
|
210
220
|
onKeyDown: publish('cellKeyDown', onKeyDown)
|
|
211
221
|
}, draggableEventHandlers, other, {
|
|
@@ -201,7 +201,8 @@ process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes = {
|
|
|
201
201
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
202
202
|
|
|
203
203
|
/**
|
|
204
|
-
* The cell value
|
|
204
|
+
* The cell value.
|
|
205
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
205
206
|
*/
|
|
206
207
|
value: PropTypes.any
|
|
207
208
|
} : void 0;
|
|
@@ -252,7 +252,8 @@ process.env.NODE_ENV !== "production" ? GridEditDateCell.propTypes = {
|
|
|
252
252
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
253
253
|
|
|
254
254
|
/**
|
|
255
|
-
* The cell value
|
|
255
|
+
* The cell value.
|
|
256
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
256
257
|
*/
|
|
257
258
|
value: PropTypes.any
|
|
258
259
|
} : void 0;
|
|
@@ -218,7 +218,8 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
218
218
|
tabIndex: PropTypes.oneOf([-1, 0]),
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
|
-
* The cell value
|
|
221
|
+
* The cell value.
|
|
222
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
222
223
|
*/
|
|
223
224
|
value: PropTypes.any
|
|
224
225
|
} : void 0;
|
|
@@ -321,7 +321,8 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
321
321
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
322
322
|
|
|
323
323
|
/**
|
|
324
|
-
* The cell value
|
|
324
|
+
* The cell value.
|
|
325
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
325
326
|
*/
|
|
326
327
|
value: PropTypes.any
|
|
327
328
|
} : void 0;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["field", "align", "width", "contentWidth"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import Skeleton from '@mui/material/Skeleton';
|
|
7
|
+
import { capitalize } from '@mui/material/utils';
|
|
8
|
+
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
9
|
+
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
|
+
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
|
|
13
|
+
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
14
|
+
var align = ownerState.align,
|
|
15
|
+
classes = ownerState.classes;
|
|
16
|
+
var slots = {
|
|
17
|
+
root: ['cell', 'cellSkeleton', "cell--text".concat(capitalize(align))]
|
|
18
|
+
};
|
|
19
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function GridSkeletonCell(props) {
|
|
23
|
+
var field = props.field,
|
|
24
|
+
align = props.align,
|
|
25
|
+
width = props.width,
|
|
26
|
+
contentWidth = props.contentWidth,
|
|
27
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
28
|
+
|
|
29
|
+
var rootProps = useGridRootProps();
|
|
30
|
+
var ownerState = {
|
|
31
|
+
classes: rootProps.classes,
|
|
32
|
+
align: align
|
|
33
|
+
};
|
|
34
|
+
var classes = useUtilityClasses(ownerState);
|
|
35
|
+
return /*#__PURE__*/_jsx("div", _extends({
|
|
36
|
+
className: classes.root,
|
|
37
|
+
style: {
|
|
38
|
+
width: width
|
|
39
|
+
}
|
|
40
|
+
}, other, {
|
|
41
|
+
children: /*#__PURE__*/_jsx(Skeleton, {
|
|
42
|
+
width: "".concat(contentWidth, "%")
|
|
43
|
+
})
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
process.env.NODE_ENV !== "production" ? GridSkeletonCell.propTypes = {
|
|
48
|
+
// ----------------------------- Warning --------------------------------
|
|
49
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
50
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
51
|
+
// ----------------------------------------------------------------------
|
|
52
|
+
align: PropTypes.string.isRequired,
|
|
53
|
+
contentWidth: PropTypes.number.isRequired,
|
|
54
|
+
field: PropTypes.string.isRequired,
|
|
55
|
+
width: PropTypes.number.isRequired
|
|
56
|
+
} : void 0;
|
|
57
|
+
export { GridSkeletonCell };
|
|
@@ -5,4 +5,5 @@ export * from './GridEditDateCell';
|
|
|
5
5
|
export * from './GridEditInputCell';
|
|
6
6
|
export * from './GridEditSingleSelectCell';
|
|
7
7
|
export * from './GridActionsCell';
|
|
8
|
-
export * from './GridActionsCellItem';
|
|
8
|
+
export * from './GridActionsCellItem';
|
|
9
|
+
export * from './GridSkeletonCell';
|