@mui/x-data-grid 7.1.1 → 7.2.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 +86 -0
- package/components/GridRow.js +3 -1
- package/components/cell/GridCell.d.ts +1 -0
- package/components/cell/GridCell.js +4 -2
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +1 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +3 -2
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +1 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +4 -2
- package/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
- package/components/containers/GridRootStyles.js +5 -3
- package/components/panel/filterPanel/GridFilterInputDate.js +5 -1
- package/constants/gridClasses.d.ts +5 -0
- package/constants/gridClasses.js +1 -1
- package/hooks/core/useGridInitialization.js +1 -1
- package/hooks/core/useGridStateInitialization.d.ts +1 -2
- package/hooks/core/useGridStateInitialization.js +6 -10
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +7 -3
- package/hooks/features/editing/useGridCellEditing.js +3 -1
- package/hooks/features/editing/useGridRowEditing.js +3 -1
- package/hooks/features/export/serializers/csvSerializer.js +6 -5
- package/index.js +1 -1
- package/locales/deDE.js +3 -4
- package/locales/frFR.js +5 -6
- package/locales/svSE.js +3 -4
- package/models/api/gridCallbackDetails.d.ts +5 -0
- package/modern/components/GridRow.js +3 -1
- package/modern/components/cell/GridCell.js +4 -2
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +3 -2
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +4 -2
- package/modern/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
- package/modern/components/containers/GridRootStyles.js +5 -3
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +5 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/core/useGridInitialization.js +1 -1
- package/modern/hooks/core/useGridStateInitialization.js +6 -10
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +7 -3
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +3 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +6 -5
- package/modern/index.js +1 -1
- package/modern/locales/deDE.js +3 -4
- package/modern/locales/frFR.js +5 -6
- package/modern/locales/svSE.js +3 -4
- package/modern/utils/cellBorderUtils.js +15 -2
- package/node/components/GridRow.js +3 -1
- package/node/components/cell/GridCell.js +4 -2
- package/node/components/columnHeaders/GridColumnGroupHeader.js +3 -2
- package/node/components/columnHeaders/GridColumnHeaderItem.js +4 -2
- package/node/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
- package/node/components/containers/GridRootStyles.js +5 -3
- package/node/components/panel/filterPanel/GridFilterInputDate.js +5 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/core/useGridInitialization.js +1 -1
- package/node/hooks/core/useGridStateInitialization.js +6 -10
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +7 -3
- package/node/hooks/features/editing/useGridCellEditing.js +3 -1
- package/node/hooks/features/editing/useGridRowEditing.js +3 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +6 -5
- package/node/index.js +1 -1
- package/node/locales/deDE.js +3 -4
- package/node/locales/frFR.js +5 -6
- package/node/locales/svSE.js +3 -4
- package/node/utils/cellBorderUtils.js +15 -2
- package/package.json +1 -1
- package/themeAugmentation/overrides.d.ts +6 -0
- package/utils/cellBorderUtils.d.ts +1 -1
- package/utils/cellBorderUtils.js +15 -2
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useGridColumnHeaders = exports.GridColumnHeaderRow = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
11
|
var _styles = require("@mui/material/styles");
|
|
11
12
|
var _utils = require("../../utils");
|
|
12
13
|
var _useGridRootProps = require("../../utils/useGridRootProps");
|
|
@@ -59,6 +60,7 @@ const useGridColumnHeaders = props => {
|
|
|
59
60
|
const renderContext = (0, _utils.useGridSelector)(apiRef, _virtualization.gridRenderContextColumnsSelector);
|
|
60
61
|
const pinnedColumns = (0, _utils.useGridSelector)(apiRef, _columns.gridVisiblePinnedColumnDefinitionsSelector);
|
|
61
62
|
const offsetLeft = (0, _useGridVirtualScroller.computeOffsetLeft)(columnPositions, renderContext, theme.direction, pinnedColumns.left.length);
|
|
63
|
+
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
62
64
|
React.useEffect(() => {
|
|
63
65
|
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
64
66
|
}, [apiRef]);
|
|
@@ -112,7 +114,7 @@ const useGridColumnHeaders = props => {
|
|
|
112
114
|
}
|
|
113
115
|
}), children, isNotPinned && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
114
116
|
role: "presentation",
|
|
115
|
-
className: _gridClasses.gridClasses.filler
|
|
117
|
+
className: (0, _clsx.default)(_gridClasses.gridClasses.filler, borderTop && _gridClasses.gridClasses['filler--borderTop'])
|
|
116
118
|
}), hasScrollbarFiller && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridScrollbarFillerCell.GridScrollbarFillerCell, {
|
|
117
119
|
header: true,
|
|
118
120
|
borderTop: borderTop,
|
|
@@ -173,7 +175,8 @@ const useGridColumnHeaders = props => {
|
|
|
173
175
|
pinnedPosition: pinnedPosition,
|
|
174
176
|
style: style,
|
|
175
177
|
indexInSection: i,
|
|
176
|
-
sectionLength: renderedColumns.length
|
|
178
|
+
sectionLength: renderedColumns.length,
|
|
179
|
+
gridHasFiller: gridHasFiller
|
|
177
180
|
}, other), colDef.field));
|
|
178
181
|
}
|
|
179
182
|
return getFillers(params, columns, 0);
|
|
@@ -283,7 +286,8 @@ const useGridColumnHeaders = props => {
|
|
|
283
286
|
pinnedPosition: pinnedPosition,
|
|
284
287
|
style: style,
|
|
285
288
|
indexInSection: indexInSection,
|
|
286
|
-
sectionLength: renderedColumns.length
|
|
289
|
+
sectionLength: renderedColumns.length,
|
|
290
|
+
gridHasFiller: gridHasFiller
|
|
287
291
|
}, index);
|
|
288
292
|
});
|
|
289
293
|
return getFillers(params, children, leftOverflow);
|
|
@@ -177,7 +177,9 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
177
177
|
const updateCellModesModel = (0, _utils.unstable_useEventCallback)(newModel => {
|
|
178
178
|
const isNewModelDifferentFromProp = newModel !== props.cellModesModel;
|
|
179
179
|
if (onCellModesModelChange && isNewModelDifferentFromProp) {
|
|
180
|
-
onCellModesModelChange(newModel, {
|
|
180
|
+
onCellModesModelChange(newModel, {
|
|
181
|
+
api: apiRef.current
|
|
182
|
+
});
|
|
181
183
|
}
|
|
182
184
|
if (props.cellModesModel && isNewModelDifferentFromProp) {
|
|
183
185
|
return; // The prop always win
|
|
@@ -251,7 +251,9 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
251
251
|
const updateRowModesModel = (0, _utils.unstable_useEventCallback)(newModel => {
|
|
252
252
|
const isNewModelDifferentFromProp = newModel !== props.rowModesModel;
|
|
253
253
|
if (onRowModesModelChange && isNewModelDifferentFromProp) {
|
|
254
|
-
onRowModesModelChange(newModel, {
|
|
254
|
+
onRowModesModelChange(newModel, {
|
|
255
|
+
api: apiRef.current
|
|
256
|
+
});
|
|
255
257
|
}
|
|
256
258
|
if (props.rowModesModel && isNewModelDifferentFromProp) {
|
|
257
259
|
return; // The prop always win
|
|
@@ -9,12 +9,13 @@ var _colDef = require("../../../../colDef");
|
|
|
9
9
|
var _warning = require("../../../../utils/warning");
|
|
10
10
|
function sanitizeCellValue(value, delimiterCharacter, shouldAppendQuotes) {
|
|
11
11
|
if (typeof value === 'string') {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
if (shouldAppendQuotes) {
|
|
13
|
+
const escapedValue = value.replace(/"/g, '""');
|
|
14
|
+
// Make sure value containing delimiter or line break won't be split into multiple rows
|
|
15
|
+
if ([delimiterCharacter, '\n', '\r', '"'].some(delimiter => value.includes(delimiter))) {
|
|
16
|
+
return `"${escapedValue}"`;
|
|
16
17
|
}
|
|
17
|
-
return
|
|
18
|
+
return escapedValue;
|
|
18
19
|
}
|
|
19
20
|
return value;
|
|
20
21
|
}
|
package/node/index.js
CHANGED
package/node/locales/deDE.js
CHANGED
|
@@ -36,10 +36,9 @@ const deDEGrid = {
|
|
|
36
36
|
toolbarExportPrint: 'Drucken',
|
|
37
37
|
toolbarExportExcel: 'Download als Excel',
|
|
38
38
|
// Columns management text
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
columnsManagementSearchTitle: 'Suche',
|
|
40
|
+
columnsManagementNoColumns: 'Keine Spalten',
|
|
41
|
+
columnsManagementShowHideAllText: 'Alle anzeigen/verbergen',
|
|
43
42
|
// Filter panel text
|
|
44
43
|
filterPanelAddFilter: 'Filter hinzufügen',
|
|
45
44
|
filterPanelRemoveAll: 'Alle entfernen',
|
package/node/locales/frFR.js
CHANGED
|
@@ -22,7 +22,7 @@ const frFRGrid = {
|
|
|
22
22
|
// Filters toolbar button text
|
|
23
23
|
toolbarFilters: 'Filtres',
|
|
24
24
|
toolbarFiltersLabel: 'Afficher les filtres',
|
|
25
|
-
toolbarFiltersTooltipHide: '
|
|
25
|
+
toolbarFiltersTooltipHide: 'Masquer les filtres',
|
|
26
26
|
toolbarFiltersTooltipShow: 'Afficher les filtres',
|
|
27
27
|
toolbarFiltersTooltipActive: count => count > 1 ? `${count} filtres actifs` : `${count} filtre actif`,
|
|
28
28
|
// Quick filter toolbar field
|
|
@@ -36,10 +36,9 @@ const frFRGrid = {
|
|
|
36
36
|
toolbarExportPrint: 'Imprimer',
|
|
37
37
|
toolbarExportExcel: 'Télécharger pour Excel',
|
|
38
38
|
// Columns management text
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
columnsManagementSearchTitle: 'Rechercher',
|
|
40
|
+
columnsManagementNoColumns: 'Pas de colonnes',
|
|
41
|
+
columnsManagementShowHideAllText: 'Afficher/masquer toutes',
|
|
43
42
|
// Filter panel text
|
|
44
43
|
filterPanelAddFilter: 'Ajouter un filtre',
|
|
45
44
|
filterPanelRemoveAll: 'Tout supprimer',
|
|
@@ -100,7 +99,7 @@ const frFRGrid = {
|
|
|
100
99
|
columnMenuShowColumns: 'Afficher les colonnes',
|
|
101
100
|
columnMenuManageColumns: 'Gérer les colonnes',
|
|
102
101
|
columnMenuFilter: 'Filtrer',
|
|
103
|
-
columnMenuHideColumn: '
|
|
102
|
+
columnMenuHideColumn: 'Masquer',
|
|
104
103
|
columnMenuUnsort: 'Annuler le tri',
|
|
105
104
|
columnMenuSortAsc: 'Tri ascendant',
|
|
106
105
|
columnMenuSortDesc: 'Tri descendant',
|
package/node/locales/svSE.js
CHANGED
|
@@ -36,10 +36,9 @@ const svSEGrid = {
|
|
|
36
36
|
toolbarExportPrint: 'Skriv ut',
|
|
37
37
|
toolbarExportExcel: 'Ladda ner som Excel',
|
|
38
38
|
// Columns management text
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
columnsManagementSearchTitle: 'Sök',
|
|
40
|
+
columnsManagementNoColumns: 'Inga kolumner',
|
|
41
|
+
columnsManagementShowHideAllText: 'Visa/Dölj alla',
|
|
43
42
|
// Filter panel text
|
|
44
43
|
filterPanelAddFilter: 'Lägg till filter',
|
|
45
44
|
filterPanelRemoveAll: 'Ta bort alla',
|
|
@@ -5,9 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.shouldCellShowRightBorder = exports.shouldCellShowLeftBorder = void 0;
|
|
7
7
|
var _gridColumnsInterfaces = require("../hooks/features/columns/gridColumnsInterfaces");
|
|
8
|
-
const shouldCellShowRightBorder = (pinnedPosition, indexInSection, sectionLength, showCellVerticalBorderRootProp) => {
|
|
8
|
+
const shouldCellShowRightBorder = (pinnedPosition, indexInSection, sectionLength, showCellVerticalBorderRootProp, gridHasFiller) => {
|
|
9
9
|
const isSectionLastCell = indexInSection === sectionLength - 1;
|
|
10
|
-
|
|
10
|
+
if (pinnedPosition === _gridColumnsInterfaces.GridPinnedColumnPosition.LEFT && isSectionLastCell) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
if (showCellVerticalBorderRootProp) {
|
|
14
|
+
if (pinnedPosition === _gridColumnsInterfaces.GridPinnedColumnPosition.LEFT) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (pinnedPosition === _gridColumnsInterfaces.GridPinnedColumnPosition.RIGHT) {
|
|
18
|
+
return !isSectionLastCell;
|
|
19
|
+
}
|
|
20
|
+
// pinnedPosition === undefined, middle section
|
|
21
|
+
return !isSectionLastCell || gridHasFiller;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
11
24
|
};
|
|
12
25
|
exports.shouldCellShowRightBorder = shouldCellShowRightBorder;
|
|
13
26
|
const shouldCellShowLeftBorder = (pinnedPosition, indexInSection) => {
|
package/package.json
CHANGED
|
@@ -5,4 +5,10 @@ export interface DataGridComponentNameToClassKey {
|
|
|
5
5
|
declare module '@mui/material/styles' {
|
|
6
6
|
interface ComponentNameToClassKey extends DataGridComponentNameToClassKey {
|
|
7
7
|
}
|
|
8
|
+
interface Mixins {
|
|
9
|
+
MuiDataGrid?: {
|
|
10
|
+
containerBackground?: string;
|
|
11
|
+
pinnedBackground?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
8
14
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GridPinnedColumnPosition } from '../hooks/features/columns/gridColumnsInterfaces';
|
|
2
|
-
export declare const shouldCellShowRightBorder: (pinnedPosition: GridPinnedColumnPosition | undefined, indexInSection: number, sectionLength: number, showCellVerticalBorderRootProp: boolean) => boolean;
|
|
2
|
+
export declare const shouldCellShowRightBorder: (pinnedPosition: GridPinnedColumnPosition | undefined, indexInSection: number, sectionLength: number, showCellVerticalBorderRootProp: boolean, gridHasFiller: boolean) => boolean;
|
|
3
3
|
export declare const shouldCellShowLeftBorder: (pinnedPosition: GridPinnedColumnPosition | undefined, indexInSection: number) => boolean;
|
package/utils/cellBorderUtils.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { GridPinnedColumnPosition } from '../hooks/features/columns/gridColumnsInterfaces';
|
|
2
|
-
export const shouldCellShowRightBorder = (pinnedPosition, indexInSection, sectionLength, showCellVerticalBorderRootProp) => {
|
|
2
|
+
export const shouldCellShowRightBorder = (pinnedPosition, indexInSection, sectionLength, showCellVerticalBorderRootProp, gridHasFiller) => {
|
|
3
3
|
const isSectionLastCell = indexInSection === sectionLength - 1;
|
|
4
|
-
|
|
4
|
+
if (pinnedPosition === GridPinnedColumnPosition.LEFT && isSectionLastCell) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
if (showCellVerticalBorderRootProp) {
|
|
8
|
+
if (pinnedPosition === GridPinnedColumnPosition.LEFT) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (pinnedPosition === GridPinnedColumnPosition.RIGHT) {
|
|
12
|
+
return !isSectionLastCell;
|
|
13
|
+
}
|
|
14
|
+
// pinnedPosition === undefined, middle section
|
|
15
|
+
return !isSectionLastCell || gridHasFiller;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
5
18
|
};
|
|
6
19
|
export const shouldCellShowLeftBorder = (pinnedPosition, indexInSection) => {
|
|
7
20
|
return pinnedPosition === GridPinnedColumnPosition.RIGHT && indexInSection === 0;
|