@mui/x-data-grid 7.1.1 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +211 -0
- package/DataGrid/DataGrid.js +19 -0
- package/components/GridPagination.d.ts +4 -1
- package/components/GridPagination.js +60 -9
- package/components/GridRow.js +4 -1
- package/components/GridScrollArea.js +1 -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 +2 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +9 -4
- package/components/containers/GridRootStyles.js +8 -4
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/components/panel/GridPanel.js +3 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +5 -1
- package/constants/gridClasses.d.ts +11 -2
- 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 +9 -5
- package/hooks/features/columnResize/useGridColumnResize.js +75 -61
- package/hooks/features/columns/gridColumnsUtils.d.ts +2 -1
- package/hooks/features/columns/gridColumnsUtils.js +4 -3
- package/hooks/features/density/useGridDensity.d.ts +1 -1
- package/hooks/features/density/useGridDensity.js +30 -4
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -1
- package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +5 -2
- package/hooks/features/editing/useGridCellEditing.js +17 -2
- package/hooks/features/editing/useGridRowEditing.js +3 -1
- package/hooks/features/export/serializers/csvSerializer.js +6 -5
- package/hooks/features/export/useGridPrintExport.d.ts +1 -1
- package/hooks/features/export/useGridPrintExport.js +2 -2
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +14 -2
- package/hooks/features/pagination/gridPaginationSelector.d.ts +5 -0
- package/hooks/features/pagination/gridPaginationSelector.js +7 -1
- package/hooks/features/pagination/gridPaginationUtils.d.ts +1 -2
- package/hooks/features/pagination/gridPaginationUtils.js +5 -3
- package/hooks/features/pagination/useGridPagination.d.ts +1 -1
- package/hooks/features/pagination/useGridPagination.js +5 -1
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +4 -0
- package/hooks/features/pagination/useGridPaginationMeta.js +77 -0
- package/hooks/features/pagination/useGridPaginationModel.js +2 -1
- package/hooks/features/pagination/useGridRowCount.d.ts +0 -4
- package/hooks/features/pagination/useGridRowCount.js +32 -18
- package/hooks/utils/useGridSelector.d.ts +1 -1
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/utils/propValidation.js +1 -1
- package/locales/daDK.js +3 -4
- package/locales/deDE.js +3 -4
- package/locales/frFR.js +5 -6
- package/locales/svSE.js +3 -4
- package/models/api/gridApiCommon.d.ts +1 -1
- package/models/api/gridCallbackDetails.d.ts +5 -0
- package/models/api/gridLocaleTextApi.d.ts +7 -3
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +7 -1
- package/models/gridPaginationProps.d.ts +3 -0
- package/models/props/DataGridProps.d.ts +26 -8
- package/modern/DataGrid/DataGrid.js +19 -0
- package/modern/components/GridPagination.js +60 -9
- package/modern/components/GridRow.js +4 -1
- package/modern/components/GridScrollArea.js +1 -1
- package/modern/components/cell/GridCell.js +4 -2
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +3 -2
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +9 -4
- package/modern/components/containers/GridRootStyles.js +8 -4
- package/modern/components/index.js +1 -1
- package/modern/components/panel/GridPanel.js +3 -1
- 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 +9 -5
- package/modern/hooks/features/columnResize/useGridColumnResize.js +75 -61
- package/modern/hooks/features/columns/gridColumnsUtils.js +4 -3
- package/modern/hooks/features/density/useGridDensity.js +30 -4
- package/modern/hooks/features/dimensions/useGridDimensions.js +5 -2
- package/modern/hooks/features/editing/useGridCellEditing.js +17 -2
- package/modern/hooks/features/editing/useGridRowEditing.js +3 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +6 -5
- package/modern/hooks/features/export/useGridPrintExport.js +2 -2
- package/modern/hooks/features/pagination/gridPaginationSelector.js +7 -1
- package/modern/hooks/features/pagination/gridPaginationUtils.js +5 -3
- package/modern/hooks/features/pagination/useGridPagination.js +5 -1
- package/modern/hooks/features/pagination/useGridPaginationMeta.js +77 -0
- package/modern/hooks/features/pagination/useGridPaginationModel.js +2 -1
- package/modern/hooks/features/pagination/useGridRowCount.js +32 -18
- package/modern/index.js +1 -1
- package/modern/internals/utils/propValidation.js +1 -1
- package/modern/locales/daDK.js +3 -4
- package/modern/locales/deDE.js +3 -4
- package/modern/locales/frFR.js +5 -6
- package/modern/locales/svSE.js +3 -4
- package/modern/models/api/index.js +0 -1
- package/modern/utils/cellBorderUtils.js +15 -2
- package/node/DataGrid/DataGrid.js +19 -0
- package/node/components/GridPagination.js +59 -8
- package/node/components/GridRow.js +4 -1
- package/node/components/GridScrollArea.js +1 -1
- package/node/components/cell/GridCell.js +4 -2
- package/node/components/columnHeaders/GridColumnGroupHeader.js +3 -2
- package/node/components/columnHeaders/GridColumnHeaderItem.js +8 -3
- package/node/components/containers/GridRootStyles.js +8 -4
- package/node/components/index.js +27 -10
- package/node/components/panel/GridPanel.js +3 -1
- 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 +9 -5
- package/node/hooks/features/columnResize/useGridColumnResize.js +76 -62
- package/node/hooks/features/columns/gridColumnsUtils.js +4 -3
- package/node/hooks/features/density/useGridDensity.js +30 -4
- package/node/hooks/features/dimensions/useGridDimensions.js +5 -2
- package/node/hooks/features/editing/useGridCellEditing.js +17 -2
- package/node/hooks/features/editing/useGridRowEditing.js +3 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +6 -5
- package/node/hooks/features/export/useGridPrintExport.js +2 -2
- package/node/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/node/hooks/features/pagination/gridPaginationUtils.js +6 -4
- package/node/hooks/features/pagination/useGridPagination.js +5 -1
- package/node/hooks/features/pagination/useGridPaginationMeta.js +87 -0
- package/node/hooks/features/pagination/useGridPaginationModel.js +2 -1
- package/node/hooks/features/pagination/useGridRowCount.js +30 -15
- package/node/index.js +1 -1
- package/node/internals/utils/propValidation.js +1 -1
- package/node/locales/daDK.js +3 -4
- package/node/locales/deDE.js +3 -4
- package/node/locales/frFR.js +5 -6
- package/node/locales/svSE.js +3 -4
- package/node/models/api/index.js +0 -11
- 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
- package/utils/getGridLocalization.d.ts +1 -1
|
@@ -11,6 +11,7 @@ var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallb
|
|
|
11
11
|
var _useGridLogger = require("../../utils/useGridLogger");
|
|
12
12
|
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
13
13
|
var _densitySelector = require("./densitySelector");
|
|
14
|
+
var _pipeProcessing = require("../../core/pipeProcessing");
|
|
14
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
17
|
const densityStateInitializer = (state, props) => (0, _extends2.default)({}, state, {
|
|
@@ -36,14 +37,39 @@ const useGridDensity = (apiRef, props) => {
|
|
|
36
37
|
density: newDensity
|
|
37
38
|
}));
|
|
38
39
|
});
|
|
40
|
+
const densityApi = {
|
|
41
|
+
setDensity
|
|
42
|
+
};
|
|
43
|
+
(0, _useGridApiMethod.useGridApiMethod)(apiRef, densityApi, 'public');
|
|
44
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
45
|
+
const exportedDensity = (0, _densitySelector.gridDensitySelector)(apiRef.current.state);
|
|
46
|
+
const shouldExportRowCount =
|
|
47
|
+
// Always export if the `exportOnlyDirtyModels` property is not activated
|
|
48
|
+
!context.exportOnlyDirtyModels ||
|
|
49
|
+
// Always export if the `density` is controlled
|
|
50
|
+
props.density != null ||
|
|
51
|
+
// Always export if the `density` has been initialized
|
|
52
|
+
props.initialState?.density != null;
|
|
53
|
+
if (!shouldExportRowCount) {
|
|
54
|
+
return prevState;
|
|
55
|
+
}
|
|
56
|
+
return (0, _extends2.default)({}, prevState, {
|
|
57
|
+
density: exportedDensity
|
|
58
|
+
});
|
|
59
|
+
}, [apiRef, props.density, props.initialState?.density]);
|
|
60
|
+
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
61
|
+
const restoredDensity = context.stateToRestore?.density ? context.stateToRestore.density : (0, _densitySelector.gridDensitySelector)(apiRef.current.state);
|
|
62
|
+
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
63
|
+
density: restoredDensity
|
|
64
|
+
}));
|
|
65
|
+
return params;
|
|
66
|
+
}, [apiRef]);
|
|
67
|
+
(0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'exportState', stateExportPreProcessing);
|
|
68
|
+
(0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
39
69
|
React.useEffect(() => {
|
|
40
70
|
if (props.density) {
|
|
41
71
|
apiRef.current.setDensity(props.density);
|
|
42
72
|
}
|
|
43
73
|
}, [apiRef, props.density]);
|
|
44
|
-
const densityApi = {
|
|
45
|
-
setDensity
|
|
46
|
-
};
|
|
47
|
-
(0, _useGridApiMethod.useGridApiMethod)(apiRef, densityApi, 'public');
|
|
48
74
|
};
|
|
49
75
|
exports.useGridDensity = useGridDensity;
|
|
@@ -39,6 +39,7 @@ const EMPTY_DIMENSIONS = {
|
|
|
39
39
|
hasScrollY: false,
|
|
40
40
|
scrollbarSize: 0,
|
|
41
41
|
headerHeight: 0,
|
|
42
|
+
headerFilterHeight: 0,
|
|
42
43
|
rowWidth: 0,
|
|
43
44
|
rowHeight: 0,
|
|
44
45
|
columnsTotalWidth: 0,
|
|
@@ -64,8 +65,9 @@ function useGridDimensions(apiRef, props) {
|
|
|
64
65
|
const densityFactor = (0, _utils2.useGridSelector)(apiRef, _density.gridDensityFactorSelector);
|
|
65
66
|
const rowHeight = Math.floor(props.rowHeight * densityFactor);
|
|
66
67
|
const headerHeight = Math.floor(props.columnHeaderHeight * densityFactor);
|
|
68
|
+
const headerFilterHeight = Math.floor((props.headerFilterHeight ?? props.columnHeaderHeight) * densityFactor);
|
|
67
69
|
const columnsTotalWidth = roundToDecimalPlaces((0, _columns.gridColumnsTotalWidthSelector)(apiRef), 6);
|
|
68
|
-
const headersTotalHeight = (0, _gridColumnsUtils.getTotalHeaderHeight)(apiRef, props
|
|
70
|
+
const headersTotalHeight = (0, _gridColumnsUtils.getTotalHeaderHeight)(apiRef, props);
|
|
69
71
|
const leftPinnedWidth = pinnedColumns.left.reduce((w, col) => w + col.computedWidth, 0);
|
|
70
72
|
const rightPinnedWidth = pinnedColumns.right.reduce((w, col) => w + col.computedWidth, 0);
|
|
71
73
|
const [savedSize, setSavedSize] = React.useState();
|
|
@@ -187,6 +189,7 @@ function useGridDimensions(apiRef, props) {
|
|
|
187
189
|
hasScrollY,
|
|
188
190
|
scrollbarSize,
|
|
189
191
|
headerHeight,
|
|
192
|
+
headerFilterHeight,
|
|
190
193
|
rowWidth,
|
|
191
194
|
rowHeight,
|
|
192
195
|
columnsTotalWidth,
|
|
@@ -202,7 +205,7 @@ function useGridDimensions(apiRef, props) {
|
|
|
202
205
|
apiRef.current.publishEvent('viewportInnerSizeChange', newDimensions.viewportInnerSize);
|
|
203
206
|
}
|
|
204
207
|
apiRef.current.updateRenderContext?.();
|
|
205
|
-
}, [apiRef, setDimensions, props.scrollbarSize, props.autoHeight, rowsMeta.currentPageTotalHeight, rowHeight, headerHeight, columnsTotalWidth, headersTotalHeight, leftPinnedWidth, rightPinnedWidth]);
|
|
208
|
+
}, [apiRef, setDimensions, props.scrollbarSize, props.autoHeight, rowsMeta.currentPageTotalHeight, rowHeight, headerHeight, headerFilterHeight, columnsTotalWidth, headersTotalHeight, leftPinnedWidth, rightPinnedWidth]);
|
|
206
209
|
const apiPublic = {
|
|
207
210
|
resize,
|
|
208
211
|
getRootDimensions
|
|
@@ -162,13 +162,26 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
162
162
|
cellToFocusAfter
|
|
163
163
|
});
|
|
164
164
|
}, [apiRef]);
|
|
165
|
+
const runIfNoFieldErrors = callback => async (...args) => {
|
|
166
|
+
if (callback) {
|
|
167
|
+
const {
|
|
168
|
+
id,
|
|
169
|
+
field
|
|
170
|
+
} = args[0];
|
|
171
|
+
const editRowsState = apiRef.current.state.editRows;
|
|
172
|
+
const hasFieldErrors = editRowsState[id][field]?.error;
|
|
173
|
+
if (!hasFieldErrors) {
|
|
174
|
+
callback(...args);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
165
178
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'cellDoubleClick', runIfEditModeIsCell(handleCellDoubleClick));
|
|
166
179
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'cellFocusOut', runIfEditModeIsCell(handleCellFocusOut));
|
|
167
180
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'cellKeyDown', runIfEditModeIsCell(handleCellKeyDown));
|
|
168
181
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'cellEditStart', runIfEditModeIsCell(handleCellEditStart));
|
|
169
182
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'cellEditStop', runIfEditModeIsCell(handleCellEditStop));
|
|
170
183
|
(0, _useGridApiEventHandler.useGridApiOptionHandler)(apiRef, 'cellEditStart', props.onCellEditStart);
|
|
171
|
-
(0, _useGridApiEventHandler.useGridApiOptionHandler)(apiRef, 'cellEditStop', props.onCellEditStop);
|
|
184
|
+
(0, _useGridApiEventHandler.useGridApiOptionHandler)(apiRef, 'cellEditStop', runIfNoFieldErrors(props.onCellEditStop));
|
|
172
185
|
const getCellMode = React.useCallback((id, field) => {
|
|
173
186
|
const editingState = (0, _gridEditingSelectors.gridEditRowsStateSelector)(apiRef.current.state);
|
|
174
187
|
const isEditing = editingState[id] && editingState[id][field];
|
|
@@ -177,7 +190,9 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
177
190
|
const updateCellModesModel = (0, _utils.unstable_useEventCallback)(newModel => {
|
|
178
191
|
const isNewModelDifferentFromProp = newModel !== props.cellModesModel;
|
|
179
192
|
if (onCellModesModelChange && isNewModelDifferentFromProp) {
|
|
180
|
-
onCellModesModelChange(newModel, {
|
|
193
|
+
onCellModesModelChange(newModel, {
|
|
194
|
+
api: apiRef.current
|
|
195
|
+
});
|
|
181
196
|
}
|
|
182
197
|
if (props.cellModesModel && isNewModelDifferentFromProp) {
|
|
183
198
|
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
|
}
|
|
@@ -116,7 +116,7 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// Expand container height to accommodate all rows
|
|
119
|
-
const computedTotalHeight = rowsMeta.currentPageTotalHeight + (0, _gridColumnsUtils.getTotalHeaderHeight)(apiRef, props
|
|
119
|
+
const computedTotalHeight = rowsMeta.currentPageTotalHeight + (0, _gridColumnsUtils.getTotalHeaderHeight)(apiRef, props) + gridToolbarElementHeight + gridFooterElementHeight;
|
|
120
120
|
gridClone.style.height = `${computedTotalHeight}px`;
|
|
121
121
|
// The height above does not include grid border width, so we need to exclude it
|
|
122
122
|
gridClone.style.boxSizing = 'content-box';
|
|
@@ -190,7 +190,7 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
190
190
|
printWindow.contentWindow.print();
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
-
}, [apiRef, doc, props
|
|
193
|
+
}, [apiRef, doc, props]);
|
|
194
194
|
const handlePrintWindowAfterPrint = React.useCallback(printWindow => {
|
|
195
195
|
// Remove the print iframe
|
|
196
196
|
doc.current.body.removeChild(printWindow);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.gridPaginationSelector = exports.gridPaginationRowRangeSelector = exports.gridPaginationRowCountSelector = exports.gridPaginationModelSelector = exports.gridPaginatedVisibleSortedGridRowIdsSelector = exports.gridPaginatedVisibleSortedGridRowEntriesSelector = exports.gridPageSizeSelector = exports.gridPageSelector = exports.gridPageCountSelector = void 0;
|
|
6
|
+
exports.gridPaginationSelector = exports.gridPaginationRowRangeSelector = exports.gridPaginationRowCountSelector = exports.gridPaginationModelSelector = exports.gridPaginationMetaSelector = exports.gridPaginatedVisibleSortedGridRowIdsSelector = exports.gridPaginatedVisibleSortedGridRowEntriesSelector = exports.gridPageSizeSelector = exports.gridPageSelector = exports.gridPageCountSelector = void 0;
|
|
7
7
|
var _createSelector = require("../../../utils/createSelector");
|
|
8
8
|
var _gridFilterSelector = require("../filter/gridFilterSelector");
|
|
9
9
|
var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
@@ -27,6 +27,12 @@ const gridPaginationModelSelector = exports.gridPaginationModelSelector = (0, _c
|
|
|
27
27
|
*/
|
|
28
28
|
const gridPaginationRowCountSelector = exports.gridPaginationRowCountSelector = (0, _createSelector.createSelector)(gridPaginationSelector, pagination => pagination.rowCount);
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Get the pagination meta
|
|
32
|
+
* @category Pagination
|
|
33
|
+
*/
|
|
34
|
+
const gridPaginationMetaSelector = exports.gridPaginationMetaSelector = (0, _createSelector.createSelector)(gridPaginationSelector, pagination => pagination.meta);
|
|
35
|
+
|
|
30
36
|
/**
|
|
31
37
|
* Get the index of the page to render if the pagination is enabled
|
|
32
38
|
* @category Pagination
|
|
@@ -43,7 +49,7 @@ const gridPageSizeSelector = exports.gridPageSizeSelector = (0, _createSelector.
|
|
|
43
49
|
* Get the amount of pages needed to display all the rows if the pagination is enabled
|
|
44
50
|
* @category Pagination
|
|
45
51
|
*/
|
|
46
|
-
const gridPageCountSelector = exports.gridPageCountSelector = (0, _createSelector.createSelector)(
|
|
52
|
+
const gridPageCountSelector = exports.gridPageCountSelector = (0, _createSelector.createSelector)(gridPaginationModelSelector, gridPaginationRowCountSelector, (paginationModel, rowCount) => (0, _gridPaginationUtils.getPageCount)(rowCount, paginationModel.pageSize, paginationModel.page));
|
|
47
53
|
|
|
48
54
|
/**
|
|
49
55
|
* Get the index of the first and the last row to include in the current page if the pagination is enabled.
|
|
@@ -3,20 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.throwIfPageSizeExceedsTheLimit = exports.
|
|
7
|
-
var _warning = require("../../../utils/warning");
|
|
6
|
+
exports.throwIfPageSizeExceedsTheLimit = exports.getValidPage = exports.getPageCount = exports.getDefaultGridPaginationModel = exports.defaultPageSize = void 0;
|
|
8
7
|
var _utils = require("../../utils");
|
|
9
8
|
const MAX_PAGE_SIZE = 100;
|
|
10
9
|
const defaultPageSize = autoPageSize => autoPageSize ? 0 : 100;
|
|
11
10
|
exports.defaultPageSize = defaultPageSize;
|
|
12
|
-
const getPageCount = (rowCount, pageSize) => {
|
|
11
|
+
const getPageCount = (rowCount, pageSize, page) => {
|
|
13
12
|
if (pageSize > 0 && rowCount > 0) {
|
|
14
13
|
return Math.ceil(rowCount / pageSize);
|
|
15
14
|
}
|
|
15
|
+
if (rowCount === -1) {
|
|
16
|
+
// With unknown row-count, we can assume a page after the current one
|
|
17
|
+
return page + 2;
|
|
18
|
+
}
|
|
16
19
|
return 0;
|
|
17
20
|
};
|
|
18
21
|
exports.getPageCount = getPageCount;
|
|
19
|
-
const noRowCountInServerMode = exports.noRowCountInServerMode = (0, _warning.buildWarning)(["MUI X: the 'rowCount' prop is undefined while using paginationMode='server'", 'For more detail, see http://mui.com/components/data-grid/pagination/#basic-implementation'], 'error');
|
|
20
22
|
const getDefaultGridPaginationModel = autoPageSize => ({
|
|
21
23
|
page: 0,
|
|
22
24
|
pageSize: autoPageSize ? 0 : 100
|
|
@@ -9,14 +9,17 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _gridPaginationUtils = require("./gridPaginationUtils");
|
|
10
10
|
var _useGridPaginationModel = require("./useGridPaginationModel");
|
|
11
11
|
var _useGridRowCount = require("./useGridRowCount");
|
|
12
|
+
var _useGridPaginationMeta = require("./useGridPaginationMeta");
|
|
12
13
|
const paginationStateInitializer = (state, props) => {
|
|
13
14
|
const paginationModel = (0, _extends2.default)({}, (0, _gridPaginationUtils.getDefaultGridPaginationModel)(props.autoPageSize), props.paginationModel ?? props.initialState?.pagination?.paginationModel);
|
|
14
15
|
(0, _gridPaginationUtils.throwIfPageSizeExceedsTheLimit)(paginationModel.pageSize, props.signature);
|
|
15
16
|
const rowCount = props.rowCount ?? props.initialState?.pagination?.rowCount;
|
|
17
|
+
const meta = props.paginationMeta ?? props.initialState?.pagination?.meta ?? {};
|
|
16
18
|
return (0, _extends2.default)({}, state, {
|
|
17
19
|
pagination: {
|
|
18
20
|
paginationModel,
|
|
19
|
-
rowCount
|
|
21
|
+
rowCount,
|
|
22
|
+
meta
|
|
20
23
|
}
|
|
21
24
|
});
|
|
22
25
|
};
|
|
@@ -27,6 +30,7 @@ const paginationStateInitializer = (state, props) => {
|
|
|
27
30
|
*/
|
|
28
31
|
exports.paginationStateInitializer = paginationStateInitializer;
|
|
29
32
|
const useGridPagination = (apiRef, props) => {
|
|
33
|
+
(0, _useGridPaginationMeta.useGridPaginationMeta)(apiRef, props);
|
|
30
34
|
(0, _useGridPaginationModel.useGridPaginationModel)(apiRef, props);
|
|
31
35
|
(0, _useGridRowCount.useGridRowCount)(apiRef, props);
|
|
32
36
|
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useGridPaginationMeta = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _utils = require("../../utils");
|
|
11
|
+
var _pipeProcessing = require("../../core/pipeProcessing");
|
|
12
|
+
var _gridPaginationSelector = require("./gridPaginationSelector");
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
const useGridPaginationMeta = (apiRef, props) => {
|
|
16
|
+
const logger = (0, _utils.useGridLogger)(apiRef, 'useGridPaginationMeta');
|
|
17
|
+
const paginationMeta = (0, _utils.useGridSelector)(apiRef, _gridPaginationSelector.gridPaginationMetaSelector);
|
|
18
|
+
apiRef.current.registerControlState({
|
|
19
|
+
stateId: 'paginationMeta',
|
|
20
|
+
propModel: props.paginationMeta,
|
|
21
|
+
propOnChange: props.onPaginationMetaChange,
|
|
22
|
+
stateSelector: _gridPaginationSelector.gridPaginationMetaSelector,
|
|
23
|
+
changeEvent: 'paginationMetaChange'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* API METHODS
|
|
28
|
+
*/
|
|
29
|
+
const setPaginationMeta = React.useCallback(newPaginationMeta => {
|
|
30
|
+
if (paginationMeta === newPaginationMeta) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
logger.debug("Setting 'paginationMeta' to", newPaginationMeta);
|
|
34
|
+
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
35
|
+
pagination: (0, _extends2.default)({}, state.pagination, {
|
|
36
|
+
meta: newPaginationMeta
|
|
37
|
+
})
|
|
38
|
+
}));
|
|
39
|
+
}, [apiRef, logger, paginationMeta]);
|
|
40
|
+
const paginationMetaApi = {
|
|
41
|
+
setPaginationMeta
|
|
42
|
+
};
|
|
43
|
+
(0, _utils.useGridApiMethod)(apiRef, paginationMetaApi, 'public');
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* PRE-PROCESSING
|
|
47
|
+
*/
|
|
48
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
49
|
+
const exportedPaginationMeta = (0, _gridPaginationSelector.gridPaginationMetaSelector)(apiRef);
|
|
50
|
+
const shouldExportRowCount =
|
|
51
|
+
// Always export if the `exportOnlyDirtyModels` property is not activated
|
|
52
|
+
!context.exportOnlyDirtyModels ||
|
|
53
|
+
// Always export if the `paginationMeta` is controlled
|
|
54
|
+
props.paginationMeta != null ||
|
|
55
|
+
// Always export if the `paginationMeta` has been initialized
|
|
56
|
+
props.initialState?.pagination?.meta != null;
|
|
57
|
+
if (!shouldExportRowCount) {
|
|
58
|
+
return prevState;
|
|
59
|
+
}
|
|
60
|
+
return (0, _extends2.default)({}, prevState, {
|
|
61
|
+
pagination: (0, _extends2.default)({}, prevState.pagination, {
|
|
62
|
+
meta: exportedPaginationMeta
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}, [apiRef, props.paginationMeta, props.initialState?.pagination?.meta]);
|
|
66
|
+
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
67
|
+
const restoredPaginationMeta = context.stateToRestore.pagination?.meta ? context.stateToRestore.pagination.meta : (0, _gridPaginationSelector.gridPaginationMetaSelector)(apiRef);
|
|
68
|
+
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
69
|
+
pagination: (0, _extends2.default)({}, state.pagination, {
|
|
70
|
+
meta: restoredPaginationMeta
|
|
71
|
+
})
|
|
72
|
+
}));
|
|
73
|
+
return params;
|
|
74
|
+
}, [apiRef]);
|
|
75
|
+
(0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'exportState', stateExportPreProcessing);
|
|
76
|
+
(0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* EFFECTS
|
|
80
|
+
*/
|
|
81
|
+
React.useEffect(() => {
|
|
82
|
+
if (props.paginationMeta) {
|
|
83
|
+
apiRef.current.setPaginationMeta(props.paginationMeta);
|
|
84
|
+
}
|
|
85
|
+
}, [apiRef, props.paginationMeta]);
|
|
86
|
+
};
|
|
87
|
+
exports.useGridPaginationMeta = useGridPaginationMeta;
|
|
@@ -18,7 +18,8 @@ const getDerivedPaginationModel = (paginationState, signature, paginationModelPr
|
|
|
18
18
|
let paginationModel = paginationState.paginationModel;
|
|
19
19
|
const rowCount = paginationState.rowCount;
|
|
20
20
|
const pageSize = paginationModelProp?.pageSize ?? paginationModel.pageSize;
|
|
21
|
-
const
|
|
21
|
+
const page = paginationModelProp?.page ?? paginationModel.page;
|
|
22
|
+
const pageCount = (0, _gridPaginationUtils.getPageCount)(rowCount, pageSize, page);
|
|
22
23
|
if (paginationModelProp && (paginationModelProp?.page !== paginationModel.page || paginationModelProp?.pageSize !== paginationModel.pageSize)) {
|
|
23
24
|
paginationModel = paginationModelProp;
|
|
24
25
|
}
|
|
@@ -7,21 +7,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useGridRowCount = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _useLazyRef = _interopRequireDefault(require("@mui/utils/useLazyRef"));
|
|
10
11
|
var _filter = require("../filter");
|
|
11
12
|
var _utils = require("../../utils");
|
|
12
13
|
var _pipeProcessing = require("../../core/pipeProcessing");
|
|
13
14
|
var _gridPaginationSelector = require("./gridPaginationSelector");
|
|
14
|
-
var _gridPaginationUtils = require("./gridPaginationUtils");
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
-
/**
|
|
18
|
-
* @requires useGridFilter (state)
|
|
19
|
-
* @requires useGridDimensions (event) - can be after
|
|
20
|
-
*/
|
|
21
17
|
const useGridRowCount = (apiRef, props) => {
|
|
22
18
|
const logger = (0, _utils.useGridLogger)(apiRef, 'useGridRowCount');
|
|
23
19
|
const visibleTopLevelRowCount = (0, _utils.useGridSelector)(apiRef, _filter.gridFilteredTopLevelRowCountSelector);
|
|
24
|
-
const
|
|
20
|
+
const rowCountState = (0, _utils.useGridSelector)(apiRef, _gridPaginationSelector.gridPaginationRowCountSelector);
|
|
21
|
+
const paginationMeta = (0, _utils.useGridSelector)(apiRef, _gridPaginationSelector.gridPaginationMetaSelector);
|
|
22
|
+
const paginationModel = (0, _utils.useGridSelector)(apiRef, _gridPaginationSelector.gridPaginationModelSelector);
|
|
23
|
+
const previousPageSize = (0, _useLazyRef.default)(() => (0, _gridPaginationSelector.gridPaginationModelSelector)(apiRef).pageSize);
|
|
25
24
|
apiRef.current.registerControlState({
|
|
26
25
|
stateId: 'paginationRowCount',
|
|
27
26
|
propModel: props.rowCount,
|
|
@@ -34,7 +33,7 @@ const useGridRowCount = (apiRef, props) => {
|
|
|
34
33
|
* API METHODS
|
|
35
34
|
*/
|
|
36
35
|
const setRowCount = React.useCallback(newRowCount => {
|
|
37
|
-
if (
|
|
36
|
+
if (rowCountState === newRowCount) {
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
40
39
|
logger.debug("Setting 'rowCount' to", newRowCount);
|
|
@@ -43,7 +42,7 @@ const useGridRowCount = (apiRef, props) => {
|
|
|
43
42
|
rowCount: newRowCount
|
|
44
43
|
})
|
|
45
44
|
}));
|
|
46
|
-
}, [apiRef, logger,
|
|
45
|
+
}, [apiRef, logger, rowCountState]);
|
|
47
46
|
const paginationRowCountApi = {
|
|
48
47
|
setRowCount
|
|
49
48
|
};
|
|
@@ -83,21 +82,37 @@ const useGridRowCount = (apiRef, props) => {
|
|
|
83
82
|
(0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
84
83
|
|
|
85
84
|
/**
|
|
86
|
-
*
|
|
85
|
+
* EVENTS
|
|
87
86
|
*/
|
|
88
|
-
React.
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
const handlePaginationModelChange = React.useCallback(model => {
|
|
88
|
+
if (props.paginationMode === 'client' || !previousPageSize.current) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (model.pageSize !== previousPageSize.current) {
|
|
92
|
+
previousPageSize.current = model.pageSize;
|
|
93
|
+
if (rowCountState === -1) {
|
|
94
|
+
// Row count unknown and page size changed, reset the page
|
|
95
|
+
apiRef.current.setPage(0);
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
|
-
}, [props.
|
|
98
|
+
}, [props.paginationMode, previousPageSize, rowCountState, apiRef]);
|
|
99
|
+
(0, _utils.useGridApiEventHandler)(apiRef, 'paginationModelChange', handlePaginationModelChange);
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* EFFECTS
|
|
103
|
+
*/
|
|
95
104
|
React.useEffect(() => {
|
|
96
105
|
if (props.paginationMode === 'client') {
|
|
97
106
|
apiRef.current.setRowCount(visibleTopLevelRowCount);
|
|
98
107
|
} else if (props.rowCount != null) {
|
|
99
108
|
apiRef.current.setRowCount(props.rowCount);
|
|
100
109
|
}
|
|
101
|
-
}, [apiRef,
|
|
110
|
+
}, [apiRef, props.paginationMode, visibleTopLevelRowCount, props.rowCount]);
|
|
111
|
+
const isLastPage = paginationMeta.hasNextPage === false;
|
|
112
|
+
React.useEffect(() => {
|
|
113
|
+
if (isLastPage && rowCountState === -1) {
|
|
114
|
+
apiRef.current.setRowCount(paginationModel.pageSize * paginationModel.page + visibleTopLevelRowCount);
|
|
115
|
+
}
|
|
116
|
+
}, [apiRef, visibleTopLevelRowCount, isLastPage, rowCountState, paginationModel]);
|
|
102
117
|
};
|
|
103
118
|
exports.useGridRowCount = useGridRowCount;
|
package/node/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.validateProps = exports.propValidatorsDataGrid = exports.clearWarningsCache = void 0;
|
|
7
7
|
var _utils = require("../../utils/utils");
|
|
8
8
|
var _useGridApiEventHandler = require("../../hooks/utils/useGridApiEventHandler");
|
|
9
|
-
const propValidatorsDataGrid = exports.propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined, props => props.signature === _useGridApiEventHandler.GridSignature.DataGrid && props.paginationMode === 'client' && (0, _utils.isNumber)(props.rowCount) && 'MUI X: Usage of the `rowCount` prop with client side pagination (`paginationMode="client"`) has no effect. `rowCount` is only meant to be used with `paginationMode="server"`.' || undefined];
|
|
9
|
+
const propValidatorsDataGrid = exports.propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined, props => props.paginationMode === 'client' && props.paginationMeta != null && ['MUI X: Usage of the `paginationMeta` prop with client-side pagination (`paginationMode="client"`) has no effect.', '`paginationMeta` is only meant to be used with `paginationMode="server"`.'].join('\n') || undefined, props => props.signature === _useGridApiEventHandler.GridSignature.DataGrid && props.paginationMode === 'client' && (0, _utils.isNumber)(props.rowCount) && ['MUI X: Usage of the `rowCount` prop with client side pagination (`paginationMode="client"`) has no effect.', '`rowCount` is only meant to be used with `paginationMode="server"`.'].join('\n') || undefined, props => props.paginationMode === 'server' && props.rowCount == null && ["MUI X: The `rowCount` prop must be passed using `paginationMode='server'`", 'For more detail, see http://mui.com/components/data-grid/pagination/#index-based-pagination'].join('\n') || undefined];
|
|
10
10
|
const warnedOnceCache = new Set();
|
|
11
11
|
const warnOnce = message => {
|
|
12
12
|
if (!warnedOnceCache.has(message)) {
|
package/node/locales/daDK.js
CHANGED
|
@@ -36,10 +36,9 @@ const daDKGrid = {
|
|
|
36
36
|
toolbarExportPrint: 'Print',
|
|
37
37
|
toolbarExportExcel: 'Download som Excel',
|
|
38
38
|
// Columns management text
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
columnsManagementSearchTitle: 'Søg',
|
|
40
|
+
columnsManagementNoColumns: 'Ingen søjler',
|
|
41
|
+
columnsManagementShowHideAllText: 'Vis/Shjul Alle',
|
|
43
42
|
// Filter panel text
|
|
44
43
|
filterPanelAddFilter: 'Tilføj filter',
|
|
45
44
|
filterPanelRemoveAll: 'Fjern alle',
|
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',
|
package/node/models/api/index.js
CHANGED
|
@@ -69,17 +69,6 @@ Object.keys(_gridSortApi).forEach(function (key) {
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
|
-
var _gridLocaleTextApi = require("./gridLocaleTextApi");
|
|
73
|
-
Object.keys(_gridLocaleTextApi).forEach(function (key) {
|
|
74
|
-
if (key === "default" || key === "__esModule") return;
|
|
75
|
-
if (key in exports && exports[key] === _gridLocaleTextApi[key]) return;
|
|
76
|
-
Object.defineProperty(exports, key, {
|
|
77
|
-
enumerable: true,
|
|
78
|
-
get: function () {
|
|
79
|
-
return _gridLocaleTextApi[key];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
72
|
var _gridCsvExportApi = require("./gridCsvExportApi");
|
|
84
73
|
Object.keys(_gridCsvExportApi).forEach(function (key) {
|
|
85
74
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -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;
|