@mui/x-data-grid 7.0.0-alpha.9 → 7.0.0-beta.1
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 +386 -38
- package/DataGrid/useDataGridComponent.js +1 -1
- package/README.md +2 -2
- package/colDef/gridBooleanColDef.js +3 -6
- package/colDef/gridCheckboxSelectionColDef.js +4 -3
- package/colDef/gridDateColDef.d.ts +3 -4
- package/colDef/gridDateColDef.js +10 -16
- package/colDef/gridNumericColDef.js +1 -3
- package/colDef/gridSingleSelectColDef.js +7 -12
- package/components/GridRow.js +1 -100
- package/components/cell/GridEditInputCell.js +1 -1
- package/components/columnsManagement/GridColumnsManagement.d.ts +43 -0
- package/components/columnsManagement/GridColumnsManagement.js +265 -0
- package/components/columnsManagement/index.d.ts +1 -0
- package/components/columnsManagement/index.js +1 -0
- package/components/columnsManagement/utils.d.ts +4 -0
- package/components/columnsManagement/utils.js +16 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/panel/GridColumnsPanel.d.ts +0 -28
- package/components/panel/GridColumnsPanel.js +5 -213
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +12 -4
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +4 -6
- package/hooks/core/useGridApiInitialization.js +4 -0
- package/hooks/features/columns/useGridColumnSpanning.js +3 -1
- package/hooks/features/editing/useGridCellEditing.js +2 -5
- package/hooks/features/editing/useGridRowEditing.js +2 -5
- package/hooks/features/filter/gridFilterUtils.js +1 -1
- package/hooks/features/rows/gridRowsUtils.js +4 -1
- package/hooks/features/rows/useGridParamsApi.d.ts +1 -2
- package/hooks/features/rows/useGridParamsApi.js +14 -49
- package/index.js +1 -1
- package/legacy/DataGrid/useDataGridComponent.js +1 -1
- package/legacy/colDef/gridBooleanColDef.js +3 -5
- package/legacy/colDef/gridCheckboxSelectionColDef.js +4 -3
- package/legacy/colDef/gridDateColDef.js +10 -14
- package/legacy/colDef/gridNumericColDef.js +1 -2
- package/legacy/colDef/gridSingleSelectColDef.js +7 -10
- package/legacy/components/GridRow.js +1 -100
- package/legacy/components/cell/GridEditInputCell.js +1 -1
- package/legacy/components/columnsManagement/GridColumnsManagement.js +307 -0
- package/legacy/components/columnsManagement/index.js +1 -0
- package/legacy/components/columnsManagement/utils.js +22 -0
- package/legacy/components/index.js +1 -0
- package/legacy/components/panel/GridColumnsPanel.js +5 -233
- package/legacy/constants/defaultGridSlotsComponents.js +2 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/constants/localeTextConstants.js +4 -6
- package/legacy/hooks/core/useGridApiInitialization.js +4 -0
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +3 -1
- package/legacy/hooks/features/editing/useGridCellEditing.js +2 -5
- package/legacy/hooks/features/editing/useGridRowEditing.js +2 -5
- package/legacy/hooks/features/filter/gridFilterUtils.js +2 -2
- package/legacy/hooks/features/rows/gridRowsUtils.js +4 -1
- package/legacy/hooks/features/rows/useGridParamsApi.js +14 -47
- package/legacy/index.js +1 -1
- package/legacy/locales/arSD.js +5 -6
- package/legacy/locales/beBY.js +5 -6
- package/legacy/locales/bgBG.js +5 -6
- package/legacy/locales/csCZ.js +5 -6
- package/legacy/locales/daDK.js +5 -6
- package/legacy/locales/deDE.js +5 -6
- package/legacy/locales/elGR.js +5 -6
- package/legacy/locales/esES.js +5 -6
- package/legacy/locales/faIR.js +5 -6
- package/legacy/locales/fiFI.js +5 -6
- package/legacy/locales/frFR.js +5 -6
- package/legacy/locales/heIL.js +12 -14
- package/legacy/locales/hrHR.js +5 -6
- package/legacy/locales/huHU.js +5 -6
- package/legacy/locales/itIT.js +5 -6
- package/legacy/locales/jaJP.js +5 -6
- package/legacy/locales/koKR.js +5 -6
- package/legacy/locales/nbNO.js +5 -6
- package/legacy/locales/nlNL.js +5 -6
- package/legacy/locales/plPL.js +5 -6
- package/legacy/locales/ptBR.js +5 -6
- package/legacy/locales/ptPT.js +5 -6
- package/legacy/locales/roRO.js +5 -6
- package/legacy/locales/ruRU.js +5 -6
- package/legacy/locales/skSK.js +5 -6
- package/legacy/locales/svSE.js +5 -6
- package/legacy/locales/trTR.js +5 -6
- package/legacy/locales/ukUA.js +5 -6
- package/legacy/locales/urPK.js +5 -6
- package/legacy/locales/viVN.js +5 -6
- package/legacy/locales/zhCN.js +5 -6
- package/legacy/locales/zhHK.js +5 -6
- package/legacy/locales/zhTW.js +5 -6
- package/locales/arSD.js +5 -6
- package/locales/beBY.js +5 -6
- package/locales/bgBG.js +5 -6
- package/locales/csCZ.js +5 -6
- package/locales/daDK.js +5 -6
- package/locales/deDE.js +5 -6
- package/locales/elGR.js +5 -6
- package/locales/esES.js +5 -6
- package/locales/faIR.js +5 -6
- package/locales/fiFI.js +5 -6
- package/locales/frFR.js +5 -6
- package/locales/heIL.js +12 -14
- package/locales/hrHR.js +5 -6
- package/locales/huHU.js +5 -6
- package/locales/itIT.js +5 -6
- package/locales/jaJP.js +5 -6
- package/locales/koKR.js +5 -6
- package/locales/nbNO.js +5 -6
- package/locales/nlNL.js +5 -6
- package/locales/plPL.js +5 -6
- package/locales/ptBR.js +5 -6
- package/locales/ptPT.js +5 -6
- package/locales/roRO.js +5 -6
- package/locales/ruRU.js +5 -6
- package/locales/skSK.js +5 -6
- package/locales/svSE.js +5 -6
- package/locales/trTR.js +5 -6
- package/locales/ukUA.js +5 -6
- package/locales/urPK.js +5 -6
- package/locales/viVN.js +5 -6
- package/locales/zhCN.js +5 -6
- package/locales/zhHK.js +5 -6
- package/locales/zhTW.js +5 -6
- package/models/api/gridLocaleTextApi.d.ts +3 -5
- package/models/colDef/gridColDef.d.ts +11 -17
- package/models/colDef/gridColType.d.ts +11 -2
- package/models/colDef/index.d.ts +1 -1
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/gridSlotsComponentsProps.d.ts +4 -0
- package/models/params/gridCellParams.d.ts +0 -26
- package/modern/DataGrid/useDataGridComponent.js +1 -1
- package/modern/colDef/gridBooleanColDef.js +3 -6
- package/modern/colDef/gridCheckboxSelectionColDef.js +4 -3
- package/modern/colDef/gridDateColDef.js +10 -16
- package/modern/colDef/gridNumericColDef.js +1 -3
- package/modern/colDef/gridSingleSelectColDef.js +7 -12
- package/modern/components/GridRow.js +1 -100
- package/modern/components/cell/GridEditInputCell.js +1 -1
- package/modern/components/columnsManagement/GridColumnsManagement.js +261 -0
- package/modern/components/columnsManagement/index.js +1 -0
- package/modern/components/columnsManagement/utils.js +16 -0
- package/modern/components/index.js +1 -0
- package/modern/components/panel/GridColumnsPanel.js +4 -209
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +4 -6
- package/modern/hooks/core/useGridApiInitialization.js +3 -0
- package/modern/hooks/features/columns/useGridColumnSpanning.js +3 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +2 -5
- package/modern/hooks/features/editing/useGridRowEditing.js +2 -5
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +4 -1
- package/modern/hooks/features/rows/useGridParamsApi.js +14 -47
- package/modern/index.js +1 -1
- package/modern/locales/arSD.js +5 -6
- package/modern/locales/beBY.js +5 -6
- package/modern/locales/bgBG.js +5 -6
- package/modern/locales/csCZ.js +5 -6
- package/modern/locales/daDK.js +5 -6
- package/modern/locales/deDE.js +5 -6
- package/modern/locales/elGR.js +5 -6
- package/modern/locales/esES.js +5 -6
- package/modern/locales/faIR.js +5 -6
- package/modern/locales/fiFI.js +5 -6
- package/modern/locales/frFR.js +5 -6
- package/modern/locales/heIL.js +12 -14
- package/modern/locales/hrHR.js +5 -6
- package/modern/locales/huHU.js +5 -6
- package/modern/locales/itIT.js +5 -6
- package/modern/locales/jaJP.js +5 -6
- package/modern/locales/koKR.js +5 -6
- package/modern/locales/nbNO.js +5 -6
- package/modern/locales/nlNL.js +5 -6
- package/modern/locales/plPL.js +5 -6
- package/modern/locales/ptBR.js +5 -6
- package/modern/locales/ptPT.js +5 -6
- package/modern/locales/roRO.js +5 -6
- package/modern/locales/ruRU.js +5 -6
- package/modern/locales/skSK.js +5 -6
- package/modern/locales/svSE.js +5 -6
- package/modern/locales/trTR.js +5 -6
- package/modern/locales/ukUA.js +5 -6
- package/modern/locales/urPK.js +5 -6
- package/modern/locales/viVN.js +5 -6
- package/modern/locales/zhCN.js +5 -6
- package/modern/locales/zhHK.js +5 -6
- package/modern/locales/zhTW.js +5 -6
- package/node/DataGrid/useDataGridComponent.js +1 -1
- package/node/colDef/gridBooleanColDef.js +3 -6
- package/node/colDef/gridCheckboxSelectionColDef.js +4 -3
- package/node/colDef/gridDateColDef.js +13 -19
- package/node/colDef/gridNumericColDef.js +1 -3
- package/node/colDef/gridSingleSelectColDef.js +7 -12
- package/node/components/GridRow.js +1 -100
- package/node/components/cell/GridEditInputCell.js +1 -1
- package/node/components/columnsManagement/GridColumnsManagement.js +269 -0
- package/node/components/columnsManagement/index.js +16 -0
- package/node/components/columnsManagement/utils.js +24 -0
- package/node/components/index.js +11 -0
- package/node/components/panel/GridColumnsPanel.js +4 -208
- package/node/constants/defaultGridSlotsComponents.js +1 -0
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +4 -6
- package/node/hooks/core/useGridApiInitialization.js +3 -0
- package/node/hooks/features/columns/useGridColumnSpanning.js +3 -1
- package/node/hooks/features/editing/useGridCellEditing.js +2 -5
- package/node/hooks/features/editing/useGridRowEditing.js +2 -5
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/rows/gridRowsUtils.js +4 -1
- package/node/hooks/features/rows/useGridParamsApi.js +14 -47
- package/node/index.js +1 -1
- package/node/locales/arSD.js +5 -6
- package/node/locales/beBY.js +5 -6
- package/node/locales/bgBG.js +5 -6
- package/node/locales/csCZ.js +5 -6
- package/node/locales/daDK.js +5 -6
- package/node/locales/deDE.js +5 -6
- package/node/locales/elGR.js +5 -6
- package/node/locales/esES.js +5 -6
- package/node/locales/faIR.js +5 -6
- package/node/locales/fiFI.js +5 -6
- package/node/locales/frFR.js +5 -6
- package/node/locales/heIL.js +12 -14
- package/node/locales/hrHR.js +5 -6
- package/node/locales/huHU.js +5 -6
- package/node/locales/itIT.js +5 -6
- package/node/locales/jaJP.js +5 -6
- package/node/locales/koKR.js +5 -6
- package/node/locales/nbNO.js +5 -6
- package/node/locales/nlNL.js +5 -6
- package/node/locales/plPL.js +5 -6
- package/node/locales/ptBR.js +5 -6
- package/node/locales/ptPT.js +5 -6
- package/node/locales/roRO.js +5 -6
- package/node/locales/ruRU.js +5 -6
- package/node/locales/skSK.js +5 -6
- package/node/locales/svSE.js +5 -6
- package/node/locales/trTR.js +5 -6
- package/node/locales/ukUA.js +5 -6
- package/node/locales/urPK.js +5 -6
- package/node/locales/viVN.js +5 -6
- package/node/locales/zhCN.js +5 -6
- package/node/locales/zhHK.js +5 -6
- package/node/locales/zhTW.js +5 -6
- package/package.json +4 -4
|
@@ -1,216 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
-
var _excluded = ["sort", "searchPredicate", "autoFocusSearchField", "disableHideAllButton", "disableShowAllButton", "getTogglableColumns"];
|
|
7
2
|
import * as React from 'react';
|
|
8
3
|
import PropTypes from 'prop-types';
|
|
9
|
-
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
10
|
-
import IconButton from '@mui/material/IconButton';
|
|
11
|
-
import { switchClasses } from '@mui/material/Switch';
|
|
12
|
-
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
13
|
-
import { styled } from '@mui/material/styles';
|
|
14
|
-
import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector } from '../../hooks/features/columns/gridColumnsSelector';
|
|
15
|
-
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
16
|
-
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
17
|
-
import { GridPanelContent } from './GridPanelContent';
|
|
18
|
-
import { GridPanelFooter } from './GridPanelFooter';
|
|
19
|
-
import { GridPanelHeader } from './GridPanelHeader';
|
|
20
4
|
import { GridPanelWrapper } from './GridPanelWrapper';
|
|
21
|
-
import {
|
|
5
|
+
import { GridColumnsManagement } from '../columnsManagement';
|
|
22
6
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
23
|
-
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
24
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
-
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
27
|
-
var classes = ownerState.classes;
|
|
28
|
-
var slots = {
|
|
29
|
-
root: ['columnsPanel'],
|
|
30
|
-
columnsPanelRow: ['columnsPanelRow']
|
|
31
|
-
};
|
|
32
|
-
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
33
|
-
};
|
|
34
|
-
var GridColumnsPanelRoot = styled('div', {
|
|
35
|
-
name: 'MuiDataGrid',
|
|
36
|
-
slot: 'ColumnsPanel',
|
|
37
|
-
overridesResolver: function overridesResolver(props, styles) {
|
|
38
|
-
return styles.columnsPanel;
|
|
39
|
-
}
|
|
40
|
-
})({
|
|
41
|
-
padding: '8px 0px 8px 8px'
|
|
42
|
-
});
|
|
43
|
-
var GridColumnsPanelRowRoot = styled('div', {
|
|
44
|
-
name: 'MuiDataGrid',
|
|
45
|
-
slot: 'ColumnsPanelRow',
|
|
46
|
-
overridesResolver: function overridesResolver(props, styles) {
|
|
47
|
-
return styles.columnsPanelRow;
|
|
48
|
-
}
|
|
49
|
-
})(function (_ref) {
|
|
50
|
-
var theme = _ref.theme;
|
|
51
|
-
return _defineProperty({
|
|
52
|
-
display: 'flex',
|
|
53
|
-
justifyContent: 'space-between',
|
|
54
|
-
padding: '1px 8px 1px 7px'
|
|
55
|
-
}, "& .".concat(switchClasses.root), {
|
|
56
|
-
marginRight: theme.spacing(0.5)
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
var GridIconButtonRoot = styled(IconButton)({
|
|
60
|
-
justifyContent: 'flex-end'
|
|
61
|
-
});
|
|
62
|
-
var collator = new Intl.Collator();
|
|
63
|
-
var defaultSearchPredicate = function defaultSearchPredicate(column, searchValue) {
|
|
64
|
-
return (column.headerName || column.field).toLowerCase().indexOf(searchValue) > -1;
|
|
65
|
-
};
|
|
66
8
|
function GridColumnsPanel(props) {
|
|
67
|
-
var _rootProps$slotProps
|
|
68
|
-
var apiRef = useGridApiContext();
|
|
69
|
-
var searchInputRef = React.useRef(null);
|
|
70
|
-
var columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
|
|
71
|
-
var columnVisibilityModel = useGridSelector(apiRef, gridColumnVisibilityModelSelector);
|
|
9
|
+
var _rootProps$slotProps;
|
|
72
10
|
var rootProps = useGridRootProps();
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
searchValue = _React$useState2[0],
|
|
76
|
-
setSearchValue = _React$useState2[1];
|
|
77
|
-
var classes = useUtilityClasses(rootProps);
|
|
78
|
-
var sort = props.sort,
|
|
79
|
-
_props$searchPredicat = props.searchPredicate,
|
|
80
|
-
searchPredicate = _props$searchPredicat === void 0 ? defaultSearchPredicate : _props$searchPredicat,
|
|
81
|
-
_props$autoFocusSearc = props.autoFocusSearchField,
|
|
82
|
-
autoFocusSearchField = _props$autoFocusSearc === void 0 ? true : _props$autoFocusSearc,
|
|
83
|
-
_props$disableHideAll = props.disableHideAllButton,
|
|
84
|
-
disableHideAllButton = _props$disableHideAll === void 0 ? false : _props$disableHideAll,
|
|
85
|
-
_props$disableShowAll = props.disableShowAllButton,
|
|
86
|
-
disableShowAllButton = _props$disableShowAll === void 0 ? false : _props$disableShowAll,
|
|
87
|
-
getTogglableColumns = props.getTogglableColumns,
|
|
88
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
89
|
-
var sortedColumns = React.useMemo(function () {
|
|
90
|
-
switch (sort) {
|
|
91
|
-
case 'asc':
|
|
92
|
-
return _toConsumableArray(columns).sort(function (a, b) {
|
|
93
|
-
return collator.compare(a.headerName || a.field, b.headerName || b.field);
|
|
94
|
-
});
|
|
95
|
-
case 'desc':
|
|
96
|
-
return _toConsumableArray(columns).sort(function (a, b) {
|
|
97
|
-
return -collator.compare(a.headerName || a.field, b.headerName || b.field);
|
|
98
|
-
});
|
|
99
|
-
default:
|
|
100
|
-
return columns;
|
|
101
|
-
}
|
|
102
|
-
}, [columns, sort]);
|
|
103
|
-
var toggleColumn = function toggleColumn(event) {
|
|
104
|
-
var _ref3 = event.target,
|
|
105
|
-
field = _ref3.name;
|
|
106
|
-
apiRef.current.setColumnVisibility(field, columnVisibilityModel[field] === false);
|
|
107
|
-
};
|
|
108
|
-
var toggleAllColumns = React.useCallback(function (isVisible) {
|
|
109
|
-
var currentModel = gridColumnVisibilityModelSelector(apiRef);
|
|
110
|
-
var newModel = _extends({}, currentModel);
|
|
111
|
-
var togglableColumns = getTogglableColumns ? getTogglableColumns(columns) : null;
|
|
112
|
-
columns.forEach(function (col) {
|
|
113
|
-
if (col.hideable && (togglableColumns == null || togglableColumns.includes(col.field))) {
|
|
114
|
-
if (isVisible) {
|
|
115
|
-
// delete the key from the model instead of setting it to `true`
|
|
116
|
-
delete newModel[col.field];
|
|
117
|
-
} else {
|
|
118
|
-
newModel[col.field] = false;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
123
|
-
}, [apiRef, columns, getTogglableColumns]);
|
|
124
|
-
var handleSearchValueChange = React.useCallback(function (event) {
|
|
125
|
-
setSearchValue(event.target.value);
|
|
126
|
-
}, []);
|
|
127
|
-
var currentColumns = React.useMemo(function () {
|
|
128
|
-
var togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
|
|
129
|
-
var togglableSortedColumns = togglableColumns ? sortedColumns.filter(function (_ref4) {
|
|
130
|
-
var field = _ref4.field;
|
|
131
|
-
return togglableColumns.includes(field);
|
|
132
|
-
}) : sortedColumns;
|
|
133
|
-
if (!searchValue) {
|
|
134
|
-
return togglableSortedColumns;
|
|
135
|
-
}
|
|
136
|
-
return togglableSortedColumns.filter(function (column) {
|
|
137
|
-
return searchPredicate(column, searchValue.toLowerCase());
|
|
138
|
-
});
|
|
139
|
-
}, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
|
|
140
|
-
var firstSwitchRef = React.useRef(null);
|
|
141
|
-
React.useEffect(function () {
|
|
142
|
-
if (autoFocusSearchField) {
|
|
143
|
-
searchInputRef.current.focus();
|
|
144
|
-
} else if (firstSwitchRef.current && typeof firstSwitchRef.current.focus === 'function') {
|
|
145
|
-
firstSwitchRef.current.focus();
|
|
146
|
-
}
|
|
147
|
-
}, [autoFocusSearchField]);
|
|
148
|
-
var firstHideableColumnFound = false;
|
|
149
|
-
var isFirstHideableColumn = function isFirstHideableColumn(column) {
|
|
150
|
-
if (firstHideableColumnFound === false && column.hideable !== false) {
|
|
151
|
-
firstHideableColumnFound = true;
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
return false;
|
|
155
|
-
};
|
|
156
|
-
return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({}, other, {
|
|
157
|
-
children: [/*#__PURE__*/_jsx(GridPanelHeader, {
|
|
158
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
159
|
-
label: apiRef.current.getLocaleText('columnsPanelTextFieldLabel'),
|
|
160
|
-
placeholder: apiRef.current.getLocaleText('columnsPanelTextFieldPlaceholder'),
|
|
161
|
-
inputRef: searchInputRef,
|
|
162
|
-
value: searchValue,
|
|
163
|
-
onChange: handleSearchValueChange,
|
|
164
|
-
variant: "standard",
|
|
165
|
-
fullWidth: true
|
|
166
|
-
}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTextField))
|
|
167
|
-
}), /*#__PURE__*/_jsx(GridPanelContent, {
|
|
168
|
-
children: /*#__PURE__*/_jsx(GridColumnsPanelRoot, {
|
|
169
|
-
className: classes.root,
|
|
170
|
-
ownerState: rootProps,
|
|
171
|
-
children: currentColumns.map(function (column) {
|
|
172
|
-
var _rootProps$slotProps2;
|
|
173
|
-
return /*#__PURE__*/_jsxs(GridColumnsPanelRowRoot, {
|
|
174
|
-
className: classes.columnsPanelRow,
|
|
175
|
-
ownerState: rootProps,
|
|
176
|
-
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
|
177
|
-
control: /*#__PURE__*/_jsx(rootProps.slots.baseSwitch, _extends({
|
|
178
|
-
disabled: column.hideable === false,
|
|
179
|
-
checked: columnVisibilityModel[column.field] !== false,
|
|
180
|
-
onClick: toggleColumn,
|
|
181
|
-
name: column.field,
|
|
182
|
-
size: "small",
|
|
183
|
-
inputRef: isFirstHideableColumn(column) ? firstSwitchRef : undefined
|
|
184
|
-
}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseSwitch)),
|
|
185
|
-
label: column.headerName || column.field
|
|
186
|
-
}), !rootProps.disableColumnReorder && GRID_EXPERIMENTAL_ENABLED && /*#__PURE__*/_jsx(GridIconButtonRoot, {
|
|
187
|
-
draggable: true,
|
|
188
|
-
"aria-label": apiRef.current.getLocaleText('columnsPanelDragIconLabel'),
|
|
189
|
-
title: apiRef.current.getLocaleText('columnsPanelDragIconLabel'),
|
|
190
|
-
size: "small",
|
|
191
|
-
disabled: true,
|
|
192
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.columnReorderIcon, {})
|
|
193
|
-
})]
|
|
194
|
-
}, column.field);
|
|
195
|
-
})
|
|
196
|
-
})
|
|
197
|
-
}), disableShowAllButton && disableHideAllButton ? null : /*#__PURE__*/_jsxs(GridPanelFooter, {
|
|
198
|
-
children: [!disableHideAllButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
199
|
-
onClick: function onClick() {
|
|
200
|
-
return toggleAllColumns(false);
|
|
201
|
-
}
|
|
202
|
-
}, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseButton, {
|
|
203
|
-
disabled: disableHideAllButton,
|
|
204
|
-
children: apiRef.current.getLocaleText('columnsPanelHideAllButton')
|
|
205
|
-
})) : /*#__PURE__*/_jsx("span", {}), !disableShowAllButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
206
|
-
onClick: function onClick() {
|
|
207
|
-
return toggleAllColumns(true);
|
|
208
|
-
}
|
|
209
|
-
}, (_rootProps$slotProps4 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps4.baseButton, {
|
|
210
|
-
disabled: disableShowAllButton,
|
|
211
|
-
children: apiRef.current.getLocaleText('columnsPanelShowAllButton')
|
|
212
|
-
})) : null]
|
|
213
|
-
})]
|
|
11
|
+
return /*#__PURE__*/_jsx(GridPanelWrapper, _extends({}, props, {
|
|
12
|
+
children: /*#__PURE__*/_jsx(GridColumnsManagement, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.columnsManagement))
|
|
214
13
|
}));
|
|
215
14
|
}
|
|
216
15
|
process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
@@ -218,33 +17,6 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
|
218
17
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
219
18
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
220
19
|
// ----------------------------------------------------------------------
|
|
221
|
-
|
|
222
|
-
* If `true`, the column search field will be focused automatically.
|
|
223
|
-
* If `false`, the first column switch input will be focused automatically.
|
|
224
|
-
* This helps to avoid input keyboard panel to popup automatically on touch devices.
|
|
225
|
-
* @default true
|
|
226
|
-
*/
|
|
227
|
-
autoFocusSearchField: PropTypes.bool,
|
|
228
|
-
/**
|
|
229
|
-
* If `true`, the `Hide all` button will not be displayed.
|
|
230
|
-
* @default false
|
|
231
|
-
*/
|
|
232
|
-
disableHideAllButton: PropTypes.bool,
|
|
233
|
-
/**
|
|
234
|
-
* If `true`, the `Show all` button will be disabled
|
|
235
|
-
* @default false
|
|
236
|
-
*/
|
|
237
|
-
disableShowAllButton: PropTypes.bool,
|
|
238
|
-
/**
|
|
239
|
-
* Returns the list of togglable columns.
|
|
240
|
-
* If used, only those columns will be displayed in the panel
|
|
241
|
-
* which are passed as the return value of the function.
|
|
242
|
-
* @param {GridColDef[]} columns The `ColDef` list of all columns.
|
|
243
|
-
* @returns {GridColDef['field'][]} The list of togglable columns' field names.
|
|
244
|
-
*/
|
|
245
|
-
getTogglableColumns: PropTypes.func,
|
|
246
|
-
searchPredicate: PropTypes.func,
|
|
247
|
-
slotProps: PropTypes.object,
|
|
248
|
-
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
20
|
+
slotProps: PropTypes.object
|
|
249
21
|
} : void 0;
|
|
250
22
|
export { GridColumnsPanel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridRow, GridColumnHeaderFilterIconButton, GridRowCount } from '../components';
|
|
2
|
+
import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridRow, GridColumnHeaderFilterIconButton, GridRowCount, GridColumnsManagement } from '../components';
|
|
3
3
|
import { GridCell } from '../components/cell/GridCell';
|
|
4
4
|
import { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
5
5
|
import { GridColumnMenu } from '../components/menu/columnMenu/GridColumnMenu';
|
|
@@ -27,6 +27,7 @@ export var DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, materialSlots, {
|
|
|
27
27
|
pagination: GridPagination,
|
|
28
28
|
filterPanel: GridFilterPanel,
|
|
29
29
|
columnsPanel: GridColumnsPanel,
|
|
30
|
+
columnsManagement: GridColumnsManagement,
|
|
30
31
|
panel: GridPanel,
|
|
31
32
|
row: GridRow
|
|
32
33
|
});
|
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export var gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellContent', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', '
|
|
5
|
+
export var gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellContent', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
@@ -29,12 +29,10 @@ export var GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
29
29
|
toolbarExportCSV: 'Download as CSV',
|
|
30
30
|
toolbarExportPrint: 'Print',
|
|
31
31
|
toolbarExportExcel: 'Download as Excel',
|
|
32
|
-
// Columns
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
columnsPanelShowAllButton: 'Show all',
|
|
37
|
-
columnsPanelHideAllButton: 'Hide all',
|
|
32
|
+
// Columns management text
|
|
33
|
+
columnsManagementSearchTitle: 'Search',
|
|
34
|
+
columnsManagementNoColumns: 'No columns',
|
|
35
|
+
columnsManagementShowHideAllText: 'Show/Hide All',
|
|
38
36
|
// Filter panel text
|
|
39
37
|
filterPanelAddFilter: 'Add filter',
|
|
40
38
|
filterPanelRemoveAll: 'Remove all',
|
|
@@ -71,6 +71,7 @@ function createPublicAPI(privateApiRef) {
|
|
|
71
71
|
return publicApi;
|
|
72
72
|
}
|
|
73
73
|
export function useGridApiInitialization(inputApiRef, props) {
|
|
74
|
+
var _inputApiRef$current;
|
|
74
75
|
var publicApiRef = React.useRef();
|
|
75
76
|
var privateApiRef = React.useRef();
|
|
76
77
|
if (!privateApiRef.current) {
|
|
@@ -107,6 +108,9 @@ export function useGridApiInitialization(inputApiRef, props) {
|
|
|
107
108
|
subscribeEvent: subscribeEvent,
|
|
108
109
|
publishEvent: publishEvent
|
|
109
110
|
}, 'public');
|
|
111
|
+
if (inputApiRef && !((_inputApiRef$current = inputApiRef.current) != null && _inputApiRef$current.state)) {
|
|
112
|
+
inputApiRef.current = publicApiRef.current;
|
|
113
|
+
}
|
|
110
114
|
React.useImperativeHandle(inputApiRef, function () {
|
|
111
115
|
return publicApiRef.current;
|
|
112
116
|
}, [publicApiRef]);
|
|
@@ -57,7 +57,9 @@ function calculateCellColSpan(params) {
|
|
|
57
57
|
columns = params.columns;
|
|
58
58
|
var columnsLength = columns.length;
|
|
59
59
|
var column = columns[columnIndex];
|
|
60
|
-
var
|
|
60
|
+
var row = apiRef.current.getRow(rowId);
|
|
61
|
+
var value = apiRef.current.getRowValue(row, column);
|
|
62
|
+
var colSpan = typeof column.colSpan === 'function' ? column.colSpan(value, row, column, apiRef) : column.colSpan;
|
|
61
63
|
if (!colSpan || colSpan === 1) {
|
|
62
64
|
setCellColSpanInfo(lookup, rowId, columnIndex, {
|
|
63
65
|
spannedByColSpan: false,
|
|
@@ -340,7 +340,7 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
340
340
|
row = apiRef.current.getRow(id);
|
|
341
341
|
parsedValue = value;
|
|
342
342
|
if (column.valueParser && !skipValueParser) {
|
|
343
|
-
parsedValue = column.valueParser(value,
|
|
343
|
+
parsedValue = column.valueParser(value, row, column, apiRef);
|
|
344
344
|
}
|
|
345
345
|
editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
346
346
|
newProps = _extends({}, editingState[id][field], {
|
|
@@ -401,10 +401,7 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
401
401
|
return apiRef.current.getRow(id);
|
|
402
402
|
}
|
|
403
403
|
var value = editingState[id][field].value;
|
|
404
|
-
return column.valueSetter ? column.valueSetter({
|
|
405
|
-
value: value,
|
|
406
|
-
row: row
|
|
407
|
-
}) : _extends({}, row, _defineProperty({}, field, value));
|
|
404
|
+
return column.valueSetter ? column.valueSetter(value, row, column, apiRef) : _extends({}, row, _defineProperty({}, field, value));
|
|
408
405
|
}, [apiRef]);
|
|
409
406
|
var editingApi = {
|
|
410
407
|
getCellMode: getCellMode,
|
|
@@ -406,7 +406,7 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
406
406
|
var row = apiRef.current.getRow(id);
|
|
407
407
|
var parsedValue = value;
|
|
408
408
|
if (column.valueParser && !skipValueParser) {
|
|
409
|
-
parsedValue = column.valueParser(value,
|
|
409
|
+
parsedValue = column.valueParser(value, row, column, apiRef);
|
|
410
410
|
}
|
|
411
411
|
var editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
412
412
|
var newProps = _extends({}, editingState[id][field], {
|
|
@@ -514,10 +514,7 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
514
514
|
fieldProps = _ref4[1];
|
|
515
515
|
var column = apiRef.current.getColumn(field);
|
|
516
516
|
if (column.valueSetter) {
|
|
517
|
-
rowUpdate = column.valueSetter(
|
|
518
|
-
value: fieldProps.value,
|
|
519
|
-
row: rowUpdate
|
|
520
|
-
});
|
|
517
|
+
rowUpdate = column.valueSetter(fieldProps.value, rowUpdate, column, apiRef);
|
|
521
518
|
} else {
|
|
522
519
|
rowUpdate[field] = fieldProps.value;
|
|
523
520
|
}
|
|
@@ -100,8 +100,8 @@ var getFilterCallbackFromItem = function getFilterCallbackFromItem(filterItem, a
|
|
|
100
100
|
var _filterItem$value;
|
|
101
101
|
var parser = column.valueParser;
|
|
102
102
|
parsedValue = Array.isArray(filterItem.value) ? (_filterItem$value = filterItem.value) == null ? void 0 : _filterItem$value.map(function (x) {
|
|
103
|
-
return parser(x);
|
|
104
|
-
}) : parser(filterItem.value);
|
|
103
|
+
return parser(x, undefined, column, apiRef);
|
|
104
|
+
}) : parser(filterItem.value, undefined, column, apiRef);
|
|
105
105
|
} else {
|
|
106
106
|
parsedValue = filterItem.value;
|
|
107
107
|
}
|
|
@@ -135,7 +135,10 @@ export var getTreeNodeDescendants = function getTreeNodeDescendants(tree, parent
|
|
|
135
135
|
if (!skipAutoGeneratedRows || !isAutoGeneratedRow(tree[child])) {
|
|
136
136
|
validDescendants.push(child);
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
var childDescendants = getTreeNodeDescendants(tree, child, skipAutoGeneratedRows);
|
|
139
|
+
for (var j = 0; j < childDescendants.length; j += 1) {
|
|
140
|
+
validDescendants.push(childDescendants[j]);
|
|
141
|
+
}
|
|
139
142
|
}
|
|
140
143
|
if (!skipAutoGeneratedRows && node.footerId != null) {
|
|
141
144
|
validDescendants.push(node.footerId);
|
|
@@ -8,7 +8,6 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import { getGridCellElement, getGridColumnHeaderElement, getGridRowElement } from '../../../utils/domUtils';
|
|
11
|
-
import { GRID_ID_AUTOGENERATED } from './gridRowsUtils';
|
|
12
11
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
13
12
|
import { gridFocusCellSelector, gridTabIndexCellSelector } from '../focus/gridFocusStateSelector';
|
|
14
13
|
export var MissingRowIdError = /*#__PURE__*/function (_Error) {
|
|
@@ -28,8 +27,7 @@ export var MissingRowIdError = /*#__PURE__*/function (_Error) {
|
|
|
28
27
|
* TODO: Impossible priority - useGridEditing also needs to be after useGridParamsApi
|
|
29
28
|
* TODO: Impossible priority - useGridFocus also needs to be after useGridParamsApi
|
|
30
29
|
*/
|
|
31
|
-
export function useGridParamsApi(apiRef
|
|
32
|
-
var getRowId = props.getRowId;
|
|
30
|
+
export function useGridParamsApi(apiRef) {
|
|
33
31
|
var getColumnHeaderParams = React.useCallback(function (field) {
|
|
34
32
|
return {
|
|
35
33
|
field: field,
|
|
@@ -48,28 +46,6 @@ export function useGridParamsApi(apiRef, props) {
|
|
|
48
46
|
};
|
|
49
47
|
return params;
|
|
50
48
|
}, [apiRef]);
|
|
51
|
-
var getBaseCellParams = React.useCallback(function (id, field) {
|
|
52
|
-
var row = apiRef.current.getRow(id);
|
|
53
|
-
var rowNode = apiRef.current.getRowNode(id);
|
|
54
|
-
if (!row || !rowNode) {
|
|
55
|
-
throw new MissingRowIdError("No row with id #".concat(id, " found"));
|
|
56
|
-
}
|
|
57
|
-
var cellFocus = gridFocusCellSelector(apiRef);
|
|
58
|
-
var cellTabIndex = gridTabIndexCellSelector(apiRef);
|
|
59
|
-
var params = {
|
|
60
|
-
id: id,
|
|
61
|
-
field: field,
|
|
62
|
-
row: row,
|
|
63
|
-
rowNode: rowNode,
|
|
64
|
-
value: row[field],
|
|
65
|
-
colDef: apiRef.current.getColumn(field),
|
|
66
|
-
cellMode: apiRef.current.getCellMode(id, field),
|
|
67
|
-
api: apiRef.current,
|
|
68
|
-
hasFocus: cellFocus !== null && cellFocus.field === field && cellFocus.id === id,
|
|
69
|
-
tabIndex: cellTabIndex && cellTabIndex.field === field && cellTabIndex.id === id ? 0 : -1
|
|
70
|
-
};
|
|
71
|
-
return params;
|
|
72
|
-
}, [apiRef]);
|
|
73
49
|
var getCellParams = React.useCallback(function (id, field) {
|
|
74
50
|
var colDef = apiRef.current.getColumn(field);
|
|
75
51
|
var value = apiRef.current.getCellValue(id, field);
|
|
@@ -94,12 +70,7 @@ export function useGridParamsApi(apiRef, props) {
|
|
|
94
70
|
isEditable: false
|
|
95
71
|
};
|
|
96
72
|
if (colDef && colDef.valueFormatter) {
|
|
97
|
-
params.formattedValue = colDef.valueFormatter(
|
|
98
|
-
id: id,
|
|
99
|
-
field: params.field,
|
|
100
|
-
value: params.value,
|
|
101
|
-
api: apiRef.current
|
|
102
|
-
});
|
|
73
|
+
params.formattedValue = colDef.valueFormatter(value, row, colDef, apiRef);
|
|
103
74
|
}
|
|
104
75
|
params.isEditable = colDef && apiRef.current.isCellEditable(params);
|
|
105
76
|
return params;
|
|
@@ -113,32 +84,28 @@ export function useGridParamsApi(apiRef, props) {
|
|
|
113
84
|
}
|
|
114
85
|
return rowModel[field];
|
|
115
86
|
}
|
|
116
|
-
|
|
117
|
-
|
|
87
|
+
var row = apiRef.current.getRow(id);
|
|
88
|
+
if (!row) {
|
|
89
|
+
throw new MissingRowIdError("No row with id #".concat(id, " found"));
|
|
90
|
+
}
|
|
91
|
+
var value = row[colDef.field];
|
|
92
|
+
return colDef.valueGetter(value, row, colDef, apiRef);
|
|
93
|
+
}, [apiRef]);
|
|
118
94
|
var getRowValue = React.useCallback(function (row, colDef) {
|
|
119
|
-
var _getRowId;
|
|
120
|
-
var id = GRID_ID_AUTOGENERATED in row ? row[GRID_ID_AUTOGENERATED] : (_getRowId = getRowId == null ? void 0 : getRowId(row)) != null ? _getRowId : row.id;
|
|
121
95
|
var field = colDef.field;
|
|
122
96
|
if (!colDef || !colDef.valueGetter) {
|
|
123
97
|
return row[field];
|
|
124
98
|
}
|
|
125
|
-
|
|
126
|
-
|
|
99
|
+
var value = row[colDef.field];
|
|
100
|
+
return colDef.valueGetter(value, row, colDef, apiRef);
|
|
101
|
+
}, [apiRef]);
|
|
127
102
|
var getRowFormattedValue = React.useCallback(function (row, colDef) {
|
|
128
|
-
var _ref;
|
|
129
103
|
var value = getRowValue(row, colDef);
|
|
130
104
|
if (!colDef || !colDef.valueFormatter) {
|
|
131
105
|
return value;
|
|
132
106
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return colDef.valueFormatter({
|
|
136
|
-
id: id,
|
|
137
|
-
field: field,
|
|
138
|
-
value: value,
|
|
139
|
-
api: apiRef.current
|
|
140
|
-
});
|
|
141
|
-
}, [apiRef, getRowId, getRowValue]);
|
|
107
|
+
return colDef.valueFormatter(value, row, colDef, apiRef);
|
|
108
|
+
}, [apiRef, getRowValue]);
|
|
142
109
|
var getColumnHeaderElement = React.useCallback(function (field) {
|
|
143
110
|
if (!apiRef.current.rootElementRef.current) {
|
|
144
111
|
return null;
|
package/legacy/index.js
CHANGED
package/legacy/locales/arSD.js
CHANGED
|
@@ -31,12 +31,11 @@ var arSDGrid = {
|
|
|
31
31
|
toolbarExportCSV: 'تنزيل كملف CSV',
|
|
32
32
|
toolbarExportPrint: 'طباعة',
|
|
33
33
|
toolbarExportExcel: 'تحميل كملف الإكسل',
|
|
34
|
-
// Columns
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
columnsPanelHideAllButton: 'إخفاء الكل',
|
|
34
|
+
// Columns management text
|
|
35
|
+
// columnsManagementSearchTitle: 'Search',
|
|
36
|
+
// columnsManagementNoColumns: 'No columns',
|
|
37
|
+
// columnsManagementShowHideAllText: 'Show/Hide All',
|
|
38
|
+
|
|
40
39
|
// Filter panel text
|
|
41
40
|
filterPanelAddFilter: 'إضافة مرشِح',
|
|
42
41
|
filterPanelRemoveAll: 'حذف الكل',
|
package/legacy/locales/beBY.js
CHANGED
|
@@ -45,12 +45,11 @@ var beBYGrid = {
|
|
|
45
45
|
toolbarExportCSV: 'Спампаваць у фармаце CSV',
|
|
46
46
|
toolbarExportPrint: 'Друк',
|
|
47
47
|
toolbarExportExcel: 'Спампаваць у фармаце Excel',
|
|
48
|
-
// Columns
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
columnsPanelHideAllButton: 'Схаваць усе',
|
|
48
|
+
// Columns management text
|
|
49
|
+
// columnsManagementSearchTitle: 'Search',
|
|
50
|
+
// columnsManagementNoColumns: 'No columns',
|
|
51
|
+
// columnsManagementShowHideAllText: 'Show/Hide All',
|
|
52
|
+
|
|
54
53
|
// Filter panel text
|
|
55
54
|
filterPanelAddFilter: 'Дадаць фільтр',
|
|
56
55
|
// filterPanelRemoveAll: 'Remove all',
|
package/legacy/locales/bgBG.js
CHANGED
|
@@ -31,12 +31,11 @@ var bgBGGrid = {
|
|
|
31
31
|
toolbarExportCSV: 'Изтегли като CSV',
|
|
32
32
|
toolbarExportPrint: 'Принтиране',
|
|
33
33
|
toolbarExportExcel: 'Изтегли като Excel',
|
|
34
|
-
// Columns
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
columnsPanelHideAllButton: 'Скрий Всички',
|
|
34
|
+
// Columns management text
|
|
35
|
+
// columnsManagementSearchTitle: 'Search',
|
|
36
|
+
// columnsManagementNoColumns: 'No columns',
|
|
37
|
+
// columnsManagementShowHideAllText: 'Show/Hide All',
|
|
38
|
+
|
|
40
39
|
// Filter panel text
|
|
41
40
|
filterPanelAddFilter: 'Добави Филтър',
|
|
42
41
|
filterPanelRemoveAll: 'Премахни всички',
|
package/legacy/locales/csCZ.js
CHANGED
|
@@ -37,12 +37,11 @@ var csCZGrid = {
|
|
|
37
37
|
toolbarExportCSV: 'Stáhnout jako CSV',
|
|
38
38
|
toolbarExportPrint: 'Vytisknout',
|
|
39
39
|
toolbarExportExcel: 'Stáhnout jako Excel',
|
|
40
|
-
// Columns
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
columnsPanelHideAllButton: 'Skrýt vše',
|
|
40
|
+
// Columns management text
|
|
41
|
+
// columnsManagementSearchTitle: 'Search',
|
|
42
|
+
// columnsManagementNoColumns: 'No columns',
|
|
43
|
+
// columnsManagementShowHideAllText: 'Show/Hide All',
|
|
44
|
+
|
|
46
45
|
// Filter panel text
|
|
47
46
|
filterPanelAddFilter: 'Přidat filtr',
|
|
48
47
|
filterPanelRemoveAll: 'Odstranit vše',
|
package/legacy/locales/daDK.js
CHANGED
|
@@ -31,12 +31,11 @@ var daDKGrid = {
|
|
|
31
31
|
toolbarExportCSV: 'Download som CSV',
|
|
32
32
|
toolbarExportPrint: 'Print',
|
|
33
33
|
toolbarExportExcel: 'Download som Excel',
|
|
34
|
-
// Columns
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
columnsPanelHideAllButton: 'Skjul alle',
|
|
34
|
+
// Columns management text
|
|
35
|
+
// columnsManagementSearchTitle: 'Search',
|
|
36
|
+
// columnsManagementNoColumns: 'No columns',
|
|
37
|
+
// columnsManagementShowHideAllText: 'Show/Hide All',
|
|
38
|
+
|
|
40
39
|
// Filter panel text
|
|
41
40
|
filterPanelAddFilter: 'Tilføj filter',
|
|
42
41
|
filterPanelRemoveAll: 'Fjern alle',
|
package/legacy/locales/deDE.js
CHANGED
|
@@ -31,12 +31,11 @@ var deDEGrid = {
|
|
|
31
31
|
toolbarExportCSV: 'Download als CSV',
|
|
32
32
|
toolbarExportPrint: 'Drucken',
|
|
33
33
|
toolbarExportExcel: 'Download als Excel',
|
|
34
|
-
// Columns
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
columnsPanelHideAllButton: 'Verberge alle',
|
|
34
|
+
// Columns management text
|
|
35
|
+
// columnsManagementSearchTitle: 'Search',
|
|
36
|
+
// columnsManagementNoColumns: 'No columns',
|
|
37
|
+
// columnsManagementShowHideAllText: 'Show/Hide All',
|
|
38
|
+
|
|
40
39
|
// Filter panel text
|
|
41
40
|
filterPanelAddFilter: 'Filter hinzufügen',
|
|
42
41
|
filterPanelRemoveAll: 'Alle entfernen',
|