@mui/x-data-grid 6.7.0 → 6.9.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 +145 -5541
- package/components/GridColumnHeaders.d.ts +2 -2
- package/components/GridColumnHeaders.js +3 -1
- package/components/GridPagination.d.ts +2 -2
- package/components/GridRow.d.ts +2 -2
- package/components/GridRow.js +33 -79
- package/components/cell/GridCell.d.ts +24 -15
- package/components/cell/GridCell.js +422 -45
- package/components/cell/GridEditInputCell.js +9 -9
- package/components/cell/index.d.ts +2 -1
- package/components/cell/index.js +1 -1
- package/components/containers/GridRootStyles.js +30 -16
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/toolbar/GridToolbar.js +2 -2
- package/components/virtualization/GridVirtualScroller.js +4 -9
- package/components/virtualization/GridVirtualScrollerContent.js +11 -20
- package/constants/defaultGridSlotsComponents.js +6 -2
- package/hooks/core/useGridApiInitialization.js +4 -1
- package/hooks/core/useGridStateInitialization.js +2 -9
- package/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +4 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
- package/hooks/features/columns/gridColumnsSelector.js +7 -7
- package/hooks/features/dimensions/useGridDimensions.js +6 -12
- package/hooks/features/editing/useGridCellEditing.js +5 -3
- package/hooks/features/editing/useGridRowEditing.js +14 -6
- package/hooks/features/filter/gridFilterSelector.js +8 -8
- package/hooks/features/filter/gridFilterUtils.d.ts +4 -1
- package/hooks/features/filter/gridFilterUtils.js +19 -13
- package/hooks/features/filter/useGridFilter.js +2 -1
- package/hooks/features/focus/useGridFocus.js +9 -4
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/hooks/features/pagination/gridPaginationSelector.js +4 -4
- package/hooks/features/rowSelection/gridRowSelectionSelector.js +3 -3
- package/hooks/features/rows/gridRowsSelector.js +3 -3
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -0
- package/hooks/features/rows/useGridParamsApi.js +7 -15
- package/hooks/features/sorting/gridSortingSelector.js +3 -3
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +8 -816
- package/hooks/features/virtualization/useGridVirtualScroller.js +40 -38
- package/hooks/utils/index.d.ts +1 -1
- package/hooks/utils/index.js +1 -1
- package/hooks/utils/useGridSelector.d.ts +3 -1
- package/hooks/utils/useGridSelector.js +37 -6
- package/hooks/utils/useLazyRef.d.ts +2 -0
- package/hooks/utils/useLazyRef.js +9 -0
- package/hooks/utils/useOnMount.d.ts +2 -0
- package/hooks/utils/useOnMount.js +7 -0
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/legacy/components/GridColumnHeaders.js +3 -1
- package/legacy/components/GridRow.js +35 -79
- package/legacy/components/cell/GridCell.js +425 -46
- package/legacy/components/cell/GridEditInputCell.js +9 -9
- package/legacy/components/cell/index.js +1 -1
- package/legacy/components/containers/GridRootStyles.js +20 -17
- package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/legacy/components/toolbar/GridToolbar.js +2 -2
- package/legacy/components/virtualization/GridVirtualScroller.js +4 -7
- package/legacy/components/virtualization/GridVirtualScrollerContent.js +10 -17
- package/legacy/constants/defaultGridSlotsComponents.js +6 -2
- package/legacy/hooks/core/useGridApiInitialization.js +4 -1
- package/legacy/hooks/core/useGridStateInitialization.js +2 -7
- package/legacy/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsSelector.js +4 -4
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
- package/legacy/hooks/features/columns/gridColumnsSelector.js +7 -7
- package/legacy/hooks/features/dimensions/useGridDimensions.js +6 -12
- package/legacy/hooks/features/editing/useGridCellEditing.js +5 -3
- package/legacy/hooks/features/editing/useGridRowEditing.js +15 -7
- package/legacy/hooks/features/filter/gridFilterSelector.js +8 -8
- package/legacy/hooks/features/filter/gridFilterUtils.js +23 -19
- package/legacy/hooks/features/filter/useGridFilter.js +2 -1
- package/legacy/hooks/features/focus/useGridFocus.js +9 -4
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/legacy/hooks/features/pagination/gridPaginationSelector.js +4 -4
- package/legacy/hooks/features/rowSelection/gridRowSelectionSelector.js +3 -3
- package/legacy/hooks/features/rows/gridRowsSelector.js +3 -3
- package/legacy/hooks/features/rows/useGridParamsApi.js +23 -15
- package/legacy/hooks/features/sorting/gridSortingSelector.js +3 -3
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +38 -34
- package/legacy/hooks/utils/index.js +1 -1
- package/legacy/hooks/utils/useGridSelector.js +43 -5
- package/legacy/hooks/utils/useLazyRef.js +9 -0
- package/legacy/hooks/utils/useOnMount.js +7 -0
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -1
- package/legacy/locales/elGR.js +70 -79
- package/legacy/locales/ptBR.js +12 -13
- package/legacy/utils/Store.js +34 -0
- package/legacy/utils/createSelector.js +74 -6
- package/legacy/utils/doesSupportPreventScroll.js +13 -0
- package/legacy/utils/fastMemo.js +5 -0
- package/legacy/utils/fastObjectShallowCompare.js +32 -0
- package/legacy/utils/keyboardUtils.js +4 -2
- package/locales/elGR.js +66 -79
- package/locales/ptBR.js +12 -13
- package/models/api/gridCoreApi.d.ts +6 -0
- package/models/colDef/gridColDef.d.ts +4 -3
- package/models/colDef/gridColType.d.ts +3 -1
- package/models/events/gridEventLookup.d.ts +3 -3
- package/modern/components/GridColumnHeaders.js +3 -1
- package/modern/components/GridRow.js +32 -79
- package/modern/components/cell/GridCell.js +421 -45
- package/modern/components/cell/GridEditInputCell.js +9 -9
- package/modern/components/cell/index.js +1 -1
- package/modern/components/containers/GridRootStyles.js +30 -16
- package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/modern/components/toolbar/GridToolbar.js +2 -2
- package/modern/components/virtualization/GridVirtualScroller.js +4 -9
- package/modern/components/virtualization/GridVirtualScrollerContent.js +10 -20
- package/modern/constants/defaultGridSlotsComponents.js +6 -2
- package/modern/hooks/core/useGridApiInitialization.js +4 -1
- package/modern/hooks/core/useGridStateInitialization.js +2 -9
- package/modern/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/modern/hooks/features/columnGrouping/gridColumnGroupsSelector.js +4 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
- package/modern/hooks/features/columns/gridColumnsSelector.js +7 -7
- package/modern/hooks/features/dimensions/useGridDimensions.js +6 -12
- package/modern/hooks/features/editing/useGridCellEditing.js +5 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +14 -6
- package/modern/hooks/features/filter/gridFilterSelector.js +8 -8
- package/modern/hooks/features/filter/gridFilterUtils.js +17 -12
- package/modern/hooks/features/filter/useGridFilter.js +2 -1
- package/modern/hooks/features/focus/useGridFocus.js +8 -4
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/modern/hooks/features/pagination/gridPaginationSelector.js +4 -4
- package/modern/hooks/features/rowSelection/gridRowSelectionSelector.js +3 -3
- package/modern/hooks/features/rows/gridRowsSelector.js +3 -3
- package/modern/hooks/features/rows/useGridParamsApi.js +7 -15
- package/modern/hooks/features/sorting/gridSortingSelector.js +3 -3
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +40 -38
- package/modern/hooks/utils/index.js +1 -1
- package/modern/hooks/utils/useGridSelector.js +37 -6
- package/modern/hooks/utils/useLazyRef.js +9 -0
- package/modern/hooks/utils/useOnMount.js +7 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/locales/elGR.js +66 -79
- package/modern/locales/ptBR.js +12 -13
- package/modern/utils/Store.js +24 -0
- package/modern/utils/createSelector.js +74 -6
- package/modern/utils/doesSupportPreventScroll.js +13 -0
- package/modern/utils/fastMemo.js +5 -0
- package/modern/utils/fastObjectShallowCompare.js +32 -0
- package/modern/utils/keyboardUtils.js +4 -2
- package/node/components/GridColumnHeaders.js +4 -2
- package/node/components/GridRow.js +32 -79
- package/node/components/cell/GridCell.js +424 -47
- package/node/components/cell/GridEditInputCell.js +9 -9
- package/node/components/cell/index.js +17 -10
- package/node/components/containers/GridRootStyles.js +30 -16
- package/node/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/node/components/toolbar/GridToolbar.js +2 -2
- package/node/components/virtualization/GridVirtualScroller.js +4 -9
- package/node/components/virtualization/GridVirtualScrollerContent.js +10 -20
- package/node/constants/defaultGridSlotsComponents.js +4 -1
- package/node/hooks/core/useGridApiInitialization.js +4 -1
- package/node/hooks/core/useGridStateInitialization.js +2 -9
- package/node/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/node/hooks/features/columnGrouping/gridColumnGroupsSelector.js +3 -3
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -2
- package/node/hooks/features/columns/gridColumnsSelector.js +6 -6
- package/node/hooks/features/dimensions/useGridDimensions.js +6 -12
- package/node/hooks/features/editing/useGridCellEditing.js +5 -3
- package/node/hooks/features/editing/useGridRowEditing.js +14 -6
- package/node/hooks/features/filter/gridFilterSelector.js +7 -7
- package/node/hooks/features/filter/gridFilterUtils.js +17 -12
- package/node/hooks/features/filter/useGridFilter.js +2 -1
- package/node/hooks/features/focus/useGridFocus.js +8 -4
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/node/hooks/features/pagination/gridPaginationSelector.js +3 -3
- package/node/hooks/features/rowSelection/gridRowSelectionSelector.js +2 -2
- package/node/hooks/features/rows/gridRowsSelector.js +2 -2
- package/node/hooks/features/rows/useGridParamsApi.js +9 -15
- package/node/hooks/features/sorting/gridSortingSelector.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +40 -36
- package/node/hooks/utils/index.js +14 -10
- package/node/hooks/utils/useGridSelector.js +41 -7
- package/node/hooks/utils/useLazyRef.js +17 -0
- package/node/hooks/utils/useOnMount.js +15 -0
- package/node/index.js +1 -1
- package/node/internals/index.js +7 -0
- package/node/locales/elGR.js +66 -79
- package/node/locales/ptBR.js +12 -13
- package/node/utils/Store.js +31 -0
- package/node/utils/createSelector.js +77 -8
- package/node/utils/doesSupportPreventScroll.js +19 -0
- package/node/utils/fastMemo.js +13 -0
- package/node/utils/fastObjectShallowCompare.js +38 -0
- package/node/utils/keyboardUtils.js +4 -2
- package/package.json +2 -2
- package/utils/Store.d.ts +11 -0
- package/utils/Store.js +24 -0
- package/utils/createSelector.d.ts +1 -0
- package/utils/createSelector.js +74 -6
- package/utils/doesSupportPreventScroll.d.ts +1 -0
- package/utils/doesSupportPreventScroll.js +13 -0
- package/utils/fastMemo.d.ts +1 -0
- package/utils/fastMemo.js +5 -0
- package/utils/fastObjectShallowCompare.d.ts +1 -0
- package/utils/fastObjectShallowCompare.js +32 -0
- package/utils/keyboardUtils.js +4 -2
|
@@ -10,6 +10,22 @@ function getBorderColor(theme) {
|
|
|
10
10
|
}
|
|
11
11
|
return darken(alpha(theme.palette.divider, 1), 0.68);
|
|
12
12
|
}
|
|
13
|
+
const columnHeadersStyles = {
|
|
14
|
+
[`.${gridClasses.columnSeparator}, .${gridClasses['columnSeparator--resizing']}`]: {
|
|
15
|
+
visibility: 'visible',
|
|
16
|
+
width: 'auto'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const columnHeaderStyles = {
|
|
20
|
+
[`& .${gridClasses.iconButtonContainer}`]: {
|
|
21
|
+
visibility: 'visible',
|
|
22
|
+
width: 'auto'
|
|
23
|
+
},
|
|
24
|
+
[`& .${gridClasses.menuIcon}`]: {
|
|
25
|
+
width: 'auto',
|
|
26
|
+
visibility: 'visible'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
13
29
|
export const GridRootStyles = styled('div', {
|
|
14
30
|
name: 'MuiDataGrid',
|
|
15
31
|
slot: 'Root',
|
|
@@ -51,6 +67,8 @@ export const GridRootStyles = styled('div', {
|
|
|
51
67
|
[`& .${gridClasses['cell--rangeLeft']}`]: styles['cell--rangeLeft']
|
|
52
68
|
}, {
|
|
53
69
|
[`& .${gridClasses['cell--rangeRight']}`]: styles['cell--rangeRight']
|
|
70
|
+
}, {
|
|
71
|
+
[`& .${gridClasses['cell--withRightBorder']}`]: styles['cell--withRightBorder']
|
|
54
72
|
}, {
|
|
55
73
|
[`& .${gridClasses.cellContent}`]: styles.cellContent
|
|
56
74
|
}, {
|
|
@@ -75,6 +93,8 @@ export const GridRootStyles = styled('div', {
|
|
|
75
93
|
[`& .${gridClasses['columnHeader--sortable']}`]: styles['columnHeader--sortable']
|
|
76
94
|
}, {
|
|
77
95
|
[`& .${gridClasses['columnHeader--sorted']}`]: styles['columnHeader--sorted']
|
|
96
|
+
}, {
|
|
97
|
+
[`& .${gridClasses['columnHeader--withRightBorder']}`]: styles['columnHeader--withRightBorder']
|
|
78
98
|
}, {
|
|
79
99
|
[`& .${gridClasses.columnHeader}`]: styles.columnHeader
|
|
80
100
|
}, {
|
|
@@ -200,9 +220,6 @@ export const GridRootStyles = styled('div', {
|
|
|
200
220
|
duration: theme.transitions.duration.shorter
|
|
201
221
|
})
|
|
202
222
|
},
|
|
203
|
-
[`& .${gridClasses.columnHeader}:not(.${gridClasses['columnHeader--sorted']}):hover .${gridClasses.sortIcon}`]: {
|
|
204
|
-
opacity: 0.5
|
|
205
|
-
},
|
|
206
223
|
[`& .${gridClasses.columnHeaderTitleContainer}`]: {
|
|
207
224
|
display: 'flex',
|
|
208
225
|
alignItems: 'center',
|
|
@@ -266,9 +283,16 @@ export const GridRootStyles = styled('div', {
|
|
|
266
283
|
justifyContent: 'center',
|
|
267
284
|
color: borderColor
|
|
268
285
|
},
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
286
|
+
'@media (hover: hover)': {
|
|
287
|
+
[`& .${gridClasses.columnHeaders}:hover`]: columnHeadersStyles,
|
|
288
|
+
[`& .${gridClasses.columnHeader}:hover`]: columnHeaderStyles,
|
|
289
|
+
[`& .${gridClasses.columnHeader}:not(.${gridClasses['columnHeader--sorted']}):hover .${gridClasses.sortIcon}`]: {
|
|
290
|
+
opacity: 0.5
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
'@media (hover: none)': {
|
|
294
|
+
[`& .${gridClasses.columnHeaders}`]: columnHeadersStyles,
|
|
295
|
+
[`& .${gridClasses.columnHeader}`]: columnHeaderStyles
|
|
272
296
|
},
|
|
273
297
|
[`& .${gridClasses['columnSeparator--sideLeft']}`]: {
|
|
274
298
|
left: -12
|
|
@@ -304,16 +328,6 @@ export const GridRootStyles = styled('div', {
|
|
|
304
328
|
display: 'flex',
|
|
305
329
|
alignItems: 'center'
|
|
306
330
|
},
|
|
307
|
-
[`& .${gridClasses.columnHeader}:hover`]: {
|
|
308
|
-
[`& .${gridClasses.iconButtonContainer}`]: {
|
|
309
|
-
visibility: 'visible',
|
|
310
|
-
width: 'auto'
|
|
311
|
-
},
|
|
312
|
-
[`& .${gridClasses.menuIcon}`]: {
|
|
313
|
-
width: 'auto',
|
|
314
|
-
visibility: 'visible'
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
331
|
[`.${gridClasses.menuOpen}`]: {
|
|
318
332
|
visibility: 'visible',
|
|
319
333
|
width: 'auto'
|
|
@@ -25,7 +25,7 @@ declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<Omit
|
|
|
25
25
|
root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").PopperRootSlotPropsOverrides, import("@mui/base").PopperOwnProps> | undefined;
|
|
26
26
|
} | undefined;
|
|
27
27
|
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
28
|
-
} & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "content" | "style" | "open" | "translate" | "container" | "transition" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "sx" | "components" | "placement" | "disablePortal" | "modifiers" | "anchorEl" | "keepMounted" | "popperOptions" | "popperRef" | "slotProps" | "slots" | "componentsProps" | keyof React.RefAttributes<HTMLDivElement>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
28
|
+
} & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "content" | "style" | "open" | "translate" | "container" | "transition" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "sx" | "components" | "placement" | "disablePortal" | "modifiers" | "anchorEl" | "keepMounted" | "popperOptions" | "popperRef" | "slotProps" | "slots" | "componentsProps" | keyof React.RefAttributes<HTMLDivElement>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
29
29
|
ownerState: OwnerState;
|
|
30
30
|
}, {}, {}>;
|
|
31
31
|
declare const GridPanel: React.ForwardRefExoticComponent<Omit<GridPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -14,8 +14,8 @@ import { GridToolbarQuickFilter } from './GridToolbarQuickFilter';
|
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const GridToolbar = /*#__PURE__*/React.forwardRef(function GridToolbar(props, ref) {
|
|
17
|
-
// TODO
|
|
18
|
-
// from
|
|
17
|
+
// TODO v7: think about where export option should be passed.
|
|
18
|
+
// from slotProps={{ toolbarExport: { ...exportOption } }} seems to be more appropriate
|
|
19
19
|
const {
|
|
20
20
|
csvOptions,
|
|
21
21
|
printOptions,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["className"];
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import clsx from 'clsx';
|
|
6
4
|
import { styled } from '@mui/system';
|
|
@@ -31,16 +29,13 @@ const VirtualScrollerRoot = styled('div', {
|
|
|
31
29
|
}
|
|
32
30
|
});
|
|
33
31
|
const GridVirtualScroller = /*#__PURE__*/React.forwardRef(function GridVirtualScroller(props, ref) {
|
|
34
|
-
const {
|
|
35
|
-
className
|
|
36
|
-
} = props,
|
|
37
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
38
32
|
const rootProps = useGridRootProps();
|
|
39
33
|
const classes = useUtilityClasses(rootProps);
|
|
40
34
|
return /*#__PURE__*/_jsx(VirtualScrollerRoot, _extends({
|
|
41
|
-
ref: ref
|
|
42
|
-
|
|
35
|
+
ref: ref
|
|
36
|
+
}, props, {
|
|
37
|
+
className: clsx(classes.root, props.className),
|
|
43
38
|
ownerState: rootProps
|
|
44
|
-
}
|
|
39
|
+
}));
|
|
45
40
|
});
|
|
46
41
|
export { GridVirtualScroller };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["className", "style"];
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import clsx from 'clsx';
|
|
6
4
|
import { styled } from '@mui/system';
|
|
@@ -8,11 +6,10 @@ import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
|
8
6
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
7
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
10
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const useUtilityClasses =
|
|
9
|
+
const useUtilityClasses = (props, overflowedContent) => {
|
|
12
10
|
const {
|
|
13
|
-
classes
|
|
14
|
-
|
|
15
|
-
} = ownerState;
|
|
11
|
+
classes
|
|
12
|
+
} = props;
|
|
16
13
|
const slots = {
|
|
17
14
|
root: ['virtualScrollerContent', overflowedContent && 'virtualScrollerContent--overflowed']
|
|
18
15
|
};
|
|
@@ -24,21 +21,15 @@ const VirtualScrollerContentRoot = styled('div', {
|
|
|
24
21
|
overridesResolver: (props, styles) => styles.virtualScrollerContent
|
|
25
22
|
})({});
|
|
26
23
|
const GridVirtualScrollerContent = /*#__PURE__*/React.forwardRef(function GridVirtualScrollerContent(props, ref) {
|
|
27
|
-
|
|
28
|
-
className,
|
|
29
|
-
style
|
|
30
|
-
} = props,
|
|
31
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
24
|
+
var _props$style;
|
|
32
25
|
const rootProps = useGridRootProps();
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
const classes = useUtilityClasses(ownerState);
|
|
26
|
+
const overflowedContent = !rootProps.autoHeight && ((_props$style = props.style) == null ? void 0 : _props$style.minHeight) === 'auto';
|
|
27
|
+
const classes = useUtilityClasses(rootProps, overflowedContent);
|
|
37
28
|
return /*#__PURE__*/_jsx(VirtualScrollerContentRoot, _extends({
|
|
38
|
-
ref: ref
|
|
39
|
-
|
|
40
|
-
ownerState:
|
|
41
|
-
|
|
42
|
-
}
|
|
29
|
+
ref: ref
|
|
30
|
+
}, props, {
|
|
31
|
+
ownerState: rootProps,
|
|
32
|
+
className: clsx(classes.root, props.className)
|
|
33
|
+
}));
|
|
43
34
|
});
|
|
44
35
|
export { GridVirtualScrollerContent };
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import {
|
|
2
|
+
import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridPreferencesPanel, GridRow, GridColumnHeaderFilterIconButton } from '../components';
|
|
3
|
+
import { GridCellV7 } from '../components/cell/GridCell';
|
|
3
4
|
import { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
4
5
|
import { GridColumnMenu } from '../components/menu/columnMenu/GridColumnMenu';
|
|
5
6
|
import { GridNoResultsOverlay } from '../components/GridNoResultsOverlay';
|
|
6
7
|
import materialSlots from '../material';
|
|
8
|
+
|
|
9
|
+
// TODO: camelCase these key. It's a private helper now.
|
|
10
|
+
// Remove then need to call `uncapitalizeObjectKeys`.
|
|
7
11
|
export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, materialSlots, {
|
|
8
|
-
Cell:
|
|
12
|
+
Cell: GridCellV7,
|
|
9
13
|
SkeletonCell: GridSkeletonCell,
|
|
10
14
|
ColumnHeaderFilterIconButton: GridColumnHeaderFilterIconButton,
|
|
11
15
|
ColumnMenu: GridColumnMenu,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Store } from '../../utils/Store';
|
|
2
3
|
import { useGridApiMethod } from '../utils/useGridApiMethod';
|
|
3
4
|
import { GridSignature } from '../utils/useGridApiEventHandler';
|
|
4
5
|
import { EventManager } from '../../utils/EventManager';
|
|
@@ -35,8 +36,10 @@ const wrapPublicApi = publicApi => {
|
|
|
35
36
|
export function useGridApiInitialization(inputApiRef, props) {
|
|
36
37
|
const publicApiRef = React.useRef();
|
|
37
38
|
if (!publicApiRef.current) {
|
|
39
|
+
const state = {};
|
|
38
40
|
publicApiRef.current = {
|
|
39
|
-
state
|
|
41
|
+
state,
|
|
42
|
+
store: Store.create(state),
|
|
40
43
|
instanceId: {
|
|
41
44
|
id: globalId
|
|
42
45
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["stateId"];
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import { GridSignature } from '../utils/useGridApiEventHandler';
|
|
6
4
|
import { useGridApiMethod } from '../utils';
|
|
@@ -9,13 +7,7 @@ export const useGridStateInitialization = (apiRef, props) => {
|
|
|
9
7
|
const controlStateMapRef = React.useRef({});
|
|
10
8
|
const [, rawForceUpdate] = React.useState();
|
|
11
9
|
const registerControlState = React.useCallback(controlStateItem => {
|
|
12
|
-
|
|
13
|
-
stateId
|
|
14
|
-
} = controlStateItem,
|
|
15
|
-
others = _objectWithoutPropertiesLoose(controlStateItem, _excluded);
|
|
16
|
-
controlStateMapRef.current[stateId] = _extends({}, others, {
|
|
17
|
-
stateId
|
|
18
|
-
});
|
|
10
|
+
controlStateMapRef.current[controlStateItem.stateId] = controlStateItem;
|
|
19
11
|
}, []);
|
|
20
12
|
const setState = React.useCallback((state, reason) => {
|
|
21
13
|
let newState;
|
|
@@ -60,6 +52,7 @@ export const useGridStateInitialization = (apiRef, props) => {
|
|
|
60
52
|
if (apiRef.current.publishEvent) {
|
|
61
53
|
apiRef.current.publishEvent('stateChange', newState);
|
|
62
54
|
}
|
|
55
|
+
apiRef.current.store.update(newState);
|
|
63
56
|
}
|
|
64
57
|
if (updatedControlStateIds.length === 1) {
|
|
65
58
|
const {
|
|
@@ -54,10 +54,7 @@ export const useGridClipboard = (apiRef, props) => {
|
|
|
54
54
|
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp == null ? void 0 : ignoreValueFormatterProp.clipboardExport : ignoreValueFormatterProp) || false;
|
|
55
55
|
const clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
|
|
56
56
|
const handleCopy = React.useCallback(event => {
|
|
57
|
-
|
|
58
|
-
// event.code === 'KeyC' is not enough as event.code assume a QWERTY keyboard layout which would
|
|
59
|
-
// be wrong with a Dvorak keyboard (as if pressing J).
|
|
60
|
-
if (String.fromCharCode(event.keyCode) !== 'C' || !isModifierKeyPressed) {
|
|
57
|
+
if (!((event.ctrlKey || event.metaKey) && event.key === 'c')) {
|
|
61
58
|
return;
|
|
62
59
|
}
|
|
63
60
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { createSelector } from '../../../utils/createSelector';
|
|
1
|
+
import { createSelector, createSelectorMemoized } from '../../../utils/createSelector';
|
|
2
2
|
/**
|
|
3
3
|
* @category ColumnGrouping
|
|
4
4
|
* @ignore - do not document.
|
|
5
5
|
*/
|
|
6
6
|
export const gridColumnGroupingSelector = state => state.columnGrouping;
|
|
7
|
-
export const gridColumnGroupsUnwrappedModelSelector =
|
|
7
|
+
export const gridColumnGroupsUnwrappedModelSelector = createSelectorMemoized(gridColumnGroupingSelector, columnGrouping => {
|
|
8
8
|
var _columnGrouping$unwra;
|
|
9
9
|
return (_columnGrouping$unwra = columnGrouping == null ? void 0 : columnGrouping.unwrappedGroupingModel) != null ? _columnGrouping$unwra : {};
|
|
10
10
|
});
|
|
11
|
-
export const gridColumnGroupsLookupSelector =
|
|
11
|
+
export const gridColumnGroupsLookupSelector = createSelectorMemoized(gridColumnGroupingSelector, columnGrouping => {
|
|
12
12
|
var _columnGrouping$looku;
|
|
13
13
|
return (_columnGrouping$looku = columnGrouping == null ? void 0 : columnGrouping.lookup) != null ? _columnGrouping$looku : {};
|
|
14
14
|
});
|
|
15
|
-
export const gridColumnGroupsHeaderStructureSelector =
|
|
15
|
+
export const gridColumnGroupsHeaderStructureSelector = createSelectorMemoized(gridColumnGroupingSelector, columnGrouping => {
|
|
16
16
|
var _columnGrouping$heade;
|
|
17
17
|
return (_columnGrouping$heade = columnGrouping == null ? void 0 : columnGrouping.headerStructure) != null ? _columnGrouping$heade : [];
|
|
18
18
|
});
|
|
@@ -10,7 +10,7 @@ import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
|
10
10
|
import { GridColumnHeaderItem } from '../../../components/columnHeaders/GridColumnHeaderItem';
|
|
11
11
|
import { getFirstColumnIndexToRender, getTotalHeaderHeight } from '../columns/gridColumnsUtils';
|
|
12
12
|
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
13
|
-
import { getRenderableIndexes } from '../virtualization/useGridVirtualScroller';
|
|
13
|
+
import { areRenderContextsEqual, getRenderableIndexes } from '../virtualization/useGridVirtualScroller';
|
|
14
14
|
import { GridColumnGroupHeader } from '../../../components/columnHeaders/GridColumnGroupHeader';
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
const GridColumnHeaderRow = styled('div', {
|
|
@@ -49,12 +49,18 @@ export const useGridColumnHeaders = props => {
|
|
|
49
49
|
const rootProps = useGridRootProps();
|
|
50
50
|
const innerRef = React.useRef(null);
|
|
51
51
|
const handleInnerRef = useForkRef(innerRefProp, innerRef);
|
|
52
|
-
const [renderContext,
|
|
52
|
+
const [renderContext, setRenderContextRaw] = React.useState(null);
|
|
53
53
|
const prevRenderContext = React.useRef(renderContext);
|
|
54
54
|
const prevScrollLeft = React.useRef(0);
|
|
55
55
|
const currentPage = useGridVisibleRows(apiRef, rootProps);
|
|
56
56
|
const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps.columnHeaderHeight);
|
|
57
57
|
const headerHeight = Math.floor(rootProps.columnHeaderHeight * densityFactor);
|
|
58
|
+
const setRenderContext = React.useCallback(nextRenderContext => {
|
|
59
|
+
if (renderContext && nextRenderContext && areRenderContextsEqual(renderContext, nextRenderContext)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
setRenderContextRaw(nextRenderContext);
|
|
63
|
+
}, [renderContext]);
|
|
58
64
|
React.useEffect(() => {
|
|
59
65
|
apiRef.current.columnHeadersContainerElementRef.current.scrollLeft = 0;
|
|
60
66
|
}, [apiRef]);
|
|
@@ -130,7 +136,7 @@ export const useGridColumnHeaders = props => {
|
|
|
130
136
|
if (nextRenderContext && canUpdateInnerPosition) {
|
|
131
137
|
updateInnerPosition(nextRenderContext);
|
|
132
138
|
}
|
|
133
|
-
}, [updateInnerPosition]);
|
|
139
|
+
}, [updateInnerPosition, setRenderContext]);
|
|
134
140
|
const handleColumnResizeStart = React.useCallback(params => setResizeCol(params.field), []);
|
|
135
141
|
const handleColumnResizeStop = React.useCallback(() => setResizeCol(''), []);
|
|
136
142
|
const handleColumnReorderStart = React.useCallback(params => setDragCol(params.field), []);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSelector } from '../../../utils/createSelector';
|
|
1
|
+
import { createSelector, createSelectorMemoized } from '../../../utils/createSelector';
|
|
2
2
|
/**
|
|
3
3
|
* Get the columns state
|
|
4
4
|
* @category Columns
|
|
@@ -21,7 +21,7 @@ export const gridColumnLookupSelector = createSelector(gridColumnsStateSelector,
|
|
|
21
21
|
* Get an array of column definitions in the order rendered on screen..
|
|
22
22
|
* @category Columns
|
|
23
23
|
*/
|
|
24
|
-
export const gridColumnDefinitionsSelector =
|
|
24
|
+
export const gridColumnDefinitionsSelector = createSelectorMemoized(gridColumnFieldsSelector, gridColumnLookupSelector, (allFields, lookup) => allFields.map(field => lookup[field]));
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Get the column visibility model, containing the visibility status of each column.
|
|
@@ -34,19 +34,19 @@ export const gridColumnVisibilityModelSelector = createSelector(gridColumnsState
|
|
|
34
34
|
* Get the visible columns as a lookup (an object containing the field for keys and the definition for values).
|
|
35
35
|
* @category Visible Columns
|
|
36
36
|
*/
|
|
37
|
-
export const gridVisibleColumnDefinitionsSelector =
|
|
37
|
+
export const gridVisibleColumnDefinitionsSelector = createSelectorMemoized(gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector, (columns, columnVisibilityModel) => columns.filter(column => columnVisibilityModel[column.field] !== false));
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Get the field of each visible column.
|
|
41
41
|
* @category Visible Columns
|
|
42
42
|
*/
|
|
43
|
-
export const gridVisibleColumnFieldsSelector =
|
|
43
|
+
export const gridVisibleColumnFieldsSelector = createSelectorMemoized(gridVisibleColumnDefinitionsSelector, visibleColumns => visibleColumns.map(column => column.field));
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Get the left position in pixel of each visible columns relative to the left of the first column.
|
|
47
47
|
* @category Visible Columns
|
|
48
48
|
*/
|
|
49
|
-
export const gridColumnPositionsSelector =
|
|
49
|
+
export const gridColumnPositionsSelector = createSelectorMemoized(gridVisibleColumnDefinitionsSelector, visibleColumns => {
|
|
50
50
|
const positions = [];
|
|
51
51
|
let currentPosition = 0;
|
|
52
52
|
for (let i = 0; i < visibleColumns.length; i += 1) {
|
|
@@ -72,13 +72,13 @@ export const gridColumnsTotalWidthSelector = createSelector(gridVisibleColumnDef
|
|
|
72
72
|
* Get the filterable columns as an array.
|
|
73
73
|
* @category Columns
|
|
74
74
|
*/
|
|
75
|
-
export const gridFilterableColumnDefinitionsSelector =
|
|
75
|
+
export const gridFilterableColumnDefinitionsSelector = createSelectorMemoized(gridColumnDefinitionsSelector, columns => columns.filter(col => col.filterable));
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* Get the filterable columns as a lookup (an object containing the field for keys and the definition for values).
|
|
79
79
|
* @category Columns
|
|
80
80
|
*/
|
|
81
|
-
export const gridFilterableColumnLookupSelector =
|
|
81
|
+
export const gridFilterableColumnLookupSelector = createSelectorMemoized(gridColumnDefinitionsSelector, columns => columns.reduce((acc, col) => {
|
|
82
82
|
if (col.filterable) {
|
|
83
83
|
acc[col.field] = col;
|
|
84
84
|
}
|
|
@@ -155,22 +155,16 @@ export function useGridDimensions(apiRef, props) {
|
|
|
155
155
|
if (!mainEl) {
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
const height = mainEl.clientHeight || 0;
|
|
159
|
-
const width = mainEl.clientWidth || 0;
|
|
160
158
|
const win = ownerWindow(mainEl);
|
|
161
159
|
const computedStyle = win.getComputedStyle(mainEl);
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
const newHeight = height - paddingTop - paddingBottom;
|
|
167
|
-
const newWidth = width - paddingLeft - paddingRight;
|
|
168
|
-
const hasHeightChanged = newHeight !== ((_previousSize$current = previousSize.current) == null ? void 0 : _previousSize$current.height);
|
|
169
|
-
const hasWidthChanged = newWidth !== ((_previousSize$current2 = previousSize.current) == null ? void 0 : _previousSize$current2.width);
|
|
160
|
+
const height = parseFloat(computedStyle.height) || 0;
|
|
161
|
+
const width = parseFloat(computedStyle.width) || 0;
|
|
162
|
+
const hasHeightChanged = height !== ((_previousSize$current = previousSize.current) == null ? void 0 : _previousSize$current.height);
|
|
163
|
+
const hasWidthChanged = width !== ((_previousSize$current2 = previousSize.current) == null ? void 0 : _previousSize$current2.width);
|
|
170
164
|
if (!previousSize.current || hasHeightChanged || hasWidthChanged) {
|
|
171
165
|
const size = {
|
|
172
|
-
width
|
|
173
|
-
height
|
|
166
|
+
width,
|
|
167
|
+
height
|
|
174
168
|
};
|
|
175
169
|
apiRef.current.publishEvent('resize', size);
|
|
176
170
|
previousSize.current = size;
|
|
@@ -14,7 +14,7 @@ import { buildWarning } from '../../../utils/warning';
|
|
|
14
14
|
import { gridRowsDataRowIdToIdLookupSelector } from '../rows/gridRowsSelector';
|
|
15
15
|
import { deepClone } from '../../../utils/utils';
|
|
16
16
|
import { GridCellEditStartReasons, GridCellEditStopReasons } from '../../../models/params/gridEditCellParams';
|
|
17
|
-
const missingOnProcessRowUpdateErrorWarning = buildWarning(['MUI: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, e.g. `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see http://mui.com/components/data-grid/editing/#persistence.'], 'error');
|
|
17
|
+
const missingOnProcessRowUpdateErrorWarning = buildWarning(['MUI: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, e.g. `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see http://mui.com/components/data-grid/editing/#server-side-persistence.'], 'error');
|
|
18
18
|
export const useGridCellEditing = (apiRef, props) => {
|
|
19
19
|
const [cellModesModel, setCellModesModel] = React.useState({});
|
|
20
20
|
const cellModesModelRef = React.useRef(cellModesModel);
|
|
@@ -122,7 +122,8 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
122
122
|
id,
|
|
123
123
|
field,
|
|
124
124
|
reason,
|
|
125
|
-
key
|
|
125
|
+
key,
|
|
126
|
+
colDef
|
|
126
127
|
} = params;
|
|
127
128
|
const startCellEditModeParams = {
|
|
128
129
|
id,
|
|
@@ -134,7 +135,8 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
134
135
|
// The sequence of events makes the key pressed by the end-users update the textbox directly.
|
|
135
136
|
startCellEditModeParams.deleteValue = true;
|
|
136
137
|
} else {
|
|
137
|
-
|
|
138
|
+
const initialValue = colDef.valueParser ? colDef.valueParser(key) : key;
|
|
139
|
+
startCellEditModeParams.initialValue = initialValue;
|
|
138
140
|
}
|
|
139
141
|
} else if (reason === GridCellEditStartReasons.deleteKeyDown) {
|
|
140
142
|
startCellEditModeParams.deleteValue = true;
|
|
@@ -15,7 +15,8 @@ import { buildWarning } from '../../../utils/warning';
|
|
|
15
15
|
import { gridRowsDataRowIdToIdLookupSelector } from '../rows/gridRowsSelector';
|
|
16
16
|
import { deepClone } from '../../../utils/utils';
|
|
17
17
|
import { GridRowEditStopReasons, GridRowEditStartReasons } from '../../../models/params/gridRowParams';
|
|
18
|
-
|
|
18
|
+
import { GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';
|
|
19
|
+
const missingOnProcessRowUpdateErrorWarning = buildWarning(['MUI: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, e.g. `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see http://mui.com/components/data-grid/editing/#server-side-persistence.'], 'error');
|
|
19
20
|
export const useGridRowEditing = (apiRef, props) => {
|
|
20
21
|
const [rowModesModel, setRowModesModel] = React.useState({});
|
|
21
22
|
const rowModesModelRef = React.useRef(rowModesModel);
|
|
@@ -114,7 +115,13 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
114
115
|
} else if (event.key === 'Enter') {
|
|
115
116
|
reason = GridRowEditStopReasons.enterKeyDown;
|
|
116
117
|
} else if (event.key === 'Tab') {
|
|
117
|
-
const columnFields = gridColumnFieldsSelector(apiRef).filter(field =>
|
|
118
|
+
const columnFields = gridColumnFieldsSelector(apiRef).filter(field => {
|
|
119
|
+
const column = apiRef.current.getColumn(field);
|
|
120
|
+
if (column.type === GRID_ACTIONS_COLUMN_TYPE) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
return apiRef.current.isCellEditable(apiRef.current.getCellParams(params.id, field));
|
|
124
|
+
});
|
|
118
125
|
if (event.shiftKey) {
|
|
119
126
|
if (params.field === columnFields[0]) {
|
|
120
127
|
// Exit if user pressed Shift+Tab on the first field
|
|
@@ -135,8 +142,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
135
142
|
}
|
|
136
143
|
}
|
|
137
144
|
if (reason) {
|
|
138
|
-
const
|
|
139
|
-
const newParams = _extends({}, rowParams, {
|
|
145
|
+
const newParams = _extends({}, apiRef.current.getRowParams(params.id), {
|
|
140
146
|
reason,
|
|
141
147
|
field: params.field
|
|
142
148
|
});
|
|
@@ -178,7 +184,8 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
178
184
|
id,
|
|
179
185
|
field,
|
|
180
186
|
reason,
|
|
181
|
-
key
|
|
187
|
+
key,
|
|
188
|
+
columns
|
|
182
189
|
} = params;
|
|
183
190
|
const startRowEditModeParams = {
|
|
184
191
|
id,
|
|
@@ -190,7 +197,8 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
190
197
|
// The sequence of events makes the key pressed by the end-users update the textbox directly.
|
|
191
198
|
startRowEditModeParams.deleteValue = !!field;
|
|
192
199
|
} else {
|
|
193
|
-
|
|
200
|
+
const colDef = columns.find(col => col.field === field);
|
|
201
|
+
startRowEditModeParams.initialValue = colDef.valueParser ? colDef.valueParser(key) : key;
|
|
194
202
|
}
|
|
195
203
|
} else if (reason === GridRowEditStartReasons.deleteKeyDown) {
|
|
196
204
|
startRowEditModeParams.deleteValue = !!field;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSelector } from '../../../utils/createSelector';
|
|
1
|
+
import { createSelector, createSelectorMemoized } from '../../../utils/createSelector';
|
|
2
2
|
import { gridSortedRowEntriesSelector } from '../sorting/gridSortingSelector';
|
|
3
3
|
import { gridColumnLookupSelector } from '../columns/gridColumnsSelector';
|
|
4
4
|
import { gridRowMaximumTreeDepthSelector, gridRowTreeSelector } from '../rows/gridRowsSelector';
|
|
@@ -43,34 +43,34 @@ export const gridFilteredDescendantCountLookupSelector = createSelector(gridFilt
|
|
|
43
43
|
* Does not contain the collapsed children.
|
|
44
44
|
* @category Filtering
|
|
45
45
|
*/
|
|
46
|
-
export const gridExpandedSortedRowEntriesSelector =
|
|
46
|
+
export const gridExpandedSortedRowEntriesSelector = createSelectorMemoized(gridVisibleRowsLookupSelector, gridSortedRowEntriesSelector, (visibleRowsLookup, sortedRows) => sortedRows.filter(row => visibleRowsLookup[row.id] !== false));
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Get the id of the rows accessible after the filtering process.
|
|
50
50
|
* Does not contain the collapsed children.
|
|
51
51
|
* @category Filtering
|
|
52
52
|
*/
|
|
53
|
-
export const gridExpandedSortedRowIdsSelector =
|
|
53
|
+
export const gridExpandedSortedRowIdsSelector = createSelectorMemoized(gridExpandedSortedRowEntriesSelector, visibleSortedRowEntries => visibleSortedRowEntries.map(row => row.id));
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Get the id and the model of the rows accessible after the filtering process.
|
|
57
57
|
* Contains the collapsed children.
|
|
58
58
|
* @category Filtering
|
|
59
59
|
*/
|
|
60
|
-
export const gridFilteredSortedRowEntriesSelector =
|
|
60
|
+
export const gridFilteredSortedRowEntriesSelector = createSelectorMemoized(gridFilteredRowsLookupSelector, gridSortedRowEntriesSelector, (filteredRowsLookup, sortedRows) => sortedRows.filter(row => filteredRowsLookup[row.id] !== false));
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Get the id of the rows accessible after the filtering process.
|
|
64
64
|
* Contains the collapsed children.
|
|
65
65
|
* @category Filtering
|
|
66
66
|
*/
|
|
67
|
-
export const gridFilteredSortedRowIdsSelector =
|
|
67
|
+
export const gridFilteredSortedRowIdsSelector = createSelectorMemoized(gridFilteredSortedRowEntriesSelector, filteredSortedRowEntries => filteredSortedRowEntries.map(row => row.id));
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* Get the id and the model of the top level rows accessible after the filtering process.
|
|
71
71
|
* @category Filtering
|
|
72
72
|
*/
|
|
73
|
-
export const gridFilteredSortedTopLevelRowEntriesSelector =
|
|
73
|
+
export const gridFilteredSortedTopLevelRowEntriesSelector = createSelectorMemoized(gridExpandedSortedRowEntriesSelector, gridRowTreeSelector, gridRowMaximumTreeDepthSelector, (visibleSortedRows, rowTree, rowTreeDepth) => {
|
|
74
74
|
if (rowTreeDepth < 2) {
|
|
75
75
|
return visibleSortedRows;
|
|
76
76
|
}
|
|
@@ -96,7 +96,7 @@ export const gridFilteredTopLevelRowCountSelector = createSelector(gridFilteredS
|
|
|
96
96
|
* @category Filtering
|
|
97
97
|
* @ignore - do not document.
|
|
98
98
|
*/
|
|
99
|
-
export const gridFilterActiveItemsSelector =
|
|
99
|
+
export const gridFilterActiveItemsSelector = createSelectorMemoized(gridFilterModelSelector, gridColumnLookupSelector, (filterModel, columnLookup) => {
|
|
100
100
|
var _filterModel$items;
|
|
101
101
|
return (_filterModel$items = filterModel.items) == null ? void 0 : _filterModel$items.filter(item => {
|
|
102
102
|
var _column$filterOperato, _item$value;
|
|
@@ -118,7 +118,7 @@ export const gridFilterActiveItemsSelector = createSelector(gridFilterModelSelec
|
|
|
118
118
|
* @category Filtering
|
|
119
119
|
* @ignore - do not document.
|
|
120
120
|
*/
|
|
121
|
-
export const gridFilterActiveItemsLookupSelector =
|
|
121
|
+
export const gridFilterActiveItemsLookupSelector = createSelectorMemoized(gridFilterActiveItemsSelector, activeFilters => {
|
|
122
122
|
const result = activeFilters.reduce((res, filterItem) => {
|
|
123
123
|
if (!res[filterItem.field]) {
|
|
124
124
|
res[filterItem.field] = [filterItem];
|
|
@@ -29,5 +29,8 @@ export declare const buildAggregatedFilterItemsApplier: (filterModel: GridFilter
|
|
|
29
29
|
*/
|
|
30
30
|
export declare const buildAggregatedQuickFilterApplier: (filterModel: GridFilterModel, apiRef: React.MutableRefObject<GridApiCommunity>) => GridFilterItemApplierNotAggregated | null;
|
|
31
31
|
export declare const buildAggregatedFilterApplier: (filterModel: GridFilterModel, apiRef: React.MutableRefObject<GridApiCommunity>) => GridAggregatedFilterItemApplier;
|
|
32
|
-
|
|
32
|
+
type FilterCache = {
|
|
33
|
+
cleanedFilterItems?: GridFilterItem[];
|
|
34
|
+
};
|
|
35
|
+
export declare const passFilterLogic: (allFilterItemResults: (null | GridFilterItemResult)[], allQuickFilterResults: (null | GridQuickFilterValueResult)[], filterModel: GridFilterModel, apiRef: React.MutableRefObject<GridApiCommunity>, cache: FilterCache) => boolean;
|
|
33
36
|
export {};
|