@mui/x-data-grid 7.12.1 → 7.13.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 +81 -0
- package/DataGrid/DataGrid.js +10 -1
- package/components/GridColumnHeaders.js +1 -1
- package/components/GridConfigurationContext.d.ts +2 -0
- package/components/GridConfigurationContext.js +5 -0
- package/components/GridHeaders.js +1 -1
- package/components/GridRow.js +6 -8
- package/components/GridScrollArea.js +1 -1
- package/components/GridSkeletonLoadingOverlay.js +1 -1
- package/components/cell/GridCell.js +1 -1
- package/components/cell/GridSkeletonCell.js +2 -2
- package/components/columnHeaders/GridColumnHeaderItem.js +1 -1
- package/components/containers/GridRootStyles.js +9 -2
- package/components/virtualization/GridMainContainer.js +3 -2
- package/components/virtualization/GridVirtualScrollerFiller.js +1 -1
- package/context/GridContextProvider.d.ts +3 -1
- package/context/GridContextProvider.js +12 -7
- package/hooks/core/useGridStateInitialization.js +1 -3
- package/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/hooks/features/export/serializers/csvSerializer.js +4 -3
- package/hooks/features/filter/gridFilterSelector.d.ts +20 -7
- package/hooks/features/filter/gridFilterSelector.js +34 -0
- package/hooks/features/filter/gridFilterState.d.ts +6 -0
- package/hooks/features/filter/index.d.ts +2 -1
- package/hooks/features/filter/index.js +1 -1
- package/hooks/features/filter/useGridFilter.js +3 -0
- package/hooks/features/rowSelection/useGridRowSelection.js +4 -1
- package/hooks/features/rows/useGridRowAriaAttributes.d.ts +2 -0
- package/hooks/features/rows/useGridRowAriaAttributes.js +19 -0
- package/hooks/utils/useGridAriaAttributes.d.ts +2 -6
- package/hooks/utils/useGridAriaAttributes.js +5 -8
- package/hooks/utils/useGridConfiguration.d.ts +2 -0
- package/hooks/utils/useGridConfiguration.js +9 -0
- package/hooks/utils/useGridSelector.d.ts +1 -1
- package/hooks/utils/useGridSelector.js +1 -1
- package/index.js +1 -1
- package/internals/index.d.ts +3 -1
- package/internals/index.js +3 -1
- package/locales/viVN.js +4 -5
- package/models/configuration/gridConfiguration.d.ts +10 -0
- package/models/configuration/gridConfiguration.js +1 -0
- package/models/configuration/gridRowConfiguration.d.ts +12 -0
- package/models/configuration/gridRowConfiguration.js +1 -0
- package/models/gridDataSource.d.ts +2 -1
- package/models/gridRows.d.ts +2 -2
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/DataGrid/DataGrid.js +10 -1
- package/modern/components/GridColumnHeaders.js +1 -1
- package/modern/components/GridConfigurationContext.js +5 -0
- package/modern/components/GridHeaders.js +1 -1
- package/modern/components/GridRow.js +6 -8
- package/modern/components/GridScrollArea.js +1 -1
- package/modern/components/GridSkeletonLoadingOverlay.js +1 -1
- package/modern/components/cell/GridCell.js +1 -1
- package/modern/components/cell/GridSkeletonCell.js +2 -2
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +1 -1
- package/modern/components/containers/GridRootStyles.js +9 -2
- package/modern/components/virtualization/GridMainContainer.js +3 -2
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +1 -1
- package/modern/context/GridContextProvider.js +12 -7
- package/modern/hooks/core/useGridStateInitialization.js +1 -3
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +4 -3
- package/modern/hooks/features/filter/gridFilterSelector.js +34 -0
- package/modern/hooks/features/filter/index.js +1 -1
- package/modern/hooks/features/filter/useGridFilter.js +3 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +4 -1
- package/modern/hooks/features/rows/useGridRowAriaAttributes.js +19 -0
- package/modern/hooks/utils/useGridAriaAttributes.js +5 -8
- package/modern/hooks/utils/useGridConfiguration.js +9 -0
- package/modern/hooks/utils/useGridSelector.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +3 -1
- package/modern/locales/viVN.js +4 -5
- package/modern/models/configuration/gridConfiguration.js +1 -0
- package/modern/models/configuration/gridRowConfiguration.js +1 -0
- package/node/DataGrid/DataGrid.js +10 -1
- package/node/components/GridColumnHeaders.js +1 -1
- package/node/{utils/fastMemo.js → components/GridConfigurationContext.js} +4 -4
- package/node/components/GridHeaders.js +1 -1
- package/node/components/GridRow.js +6 -8
- package/node/components/GridScrollArea.js +1 -1
- package/node/components/GridSkeletonLoadingOverlay.js +1 -1
- package/node/components/cell/GridCell.js +1 -1
- package/node/components/cell/GridSkeletonCell.js +2 -2
- package/node/components/columnHeaders/GridColumnHeaderItem.js +1 -1
- package/node/components/containers/GridRootStyles.js +9 -2
- package/node/components/virtualization/GridMainContainer.js +3 -2
- package/node/components/virtualization/GridVirtualScrollerFiller.js +1 -1
- package/node/context/GridContextProvider.js +12 -7
- package/node/hooks/core/useGridStateInitialization.js +1 -3
- package/node/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +4 -3
- package/node/hooks/features/filter/gridFilterSelector.js +35 -1
- package/node/hooks/features/filter/index.js +97 -15
- package/node/hooks/features/filter/useGridFilter.js +3 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +4 -1
- package/node/hooks/features/rows/useGridRowAriaAttributes.js +28 -0
- package/node/hooks/utils/useGridAriaAttributes.js +4 -7
- package/node/hooks/utils/useGridConfiguration.js +18 -0
- package/node/hooks/utils/useGridSelector.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +31 -12
- package/node/locales/viVN.js +4 -5
- package/node/models/configuration/gridConfiguration.js +5 -0
- package/node/models/configuration/gridRowConfiguration.js +5 -0
- package/package.json +2 -2
- package/modern/utils/fastMemo.js +0 -5
- package/modern/utils/fastObjectShallowCompare.js +0 -28
- package/modern/utils/throttle.js +0 -19
- package/node/utils/fastObjectShallowCompare.js +0 -34
- package/node/utils/throttle.js +0 -25
- package/utils/fastMemo.d.ts +0 -1
- package/utils/fastMemo.js +0 -5
- package/utils/fastObjectShallowCompare.d.ts +0 -1
- package/utils/fastObjectShallowCompare.js +0 -28
- package/utils/throttle.d.ts +0 -4
- package/utils/throttle.js +0 -19
|
@@ -23,6 +23,7 @@ export const filterStateInitializer = (state, props, apiRef) => {
|
|
|
23
23
|
filter: {
|
|
24
24
|
filterModel: sanitizeFilterModel(filterModel, props.disableMultipleColumnsFiltering, apiRef),
|
|
25
25
|
filteredRowsLookup: {},
|
|
26
|
+
filteredChildrenCountLookup: {},
|
|
26
27
|
filteredDescendantCountLookup: {}
|
|
27
28
|
},
|
|
28
29
|
visibleRowsLookup: {}
|
|
@@ -273,6 +274,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
273
274
|
if (props.filterMode !== 'client' || !params.isRowMatchingFilters) {
|
|
274
275
|
return {
|
|
275
276
|
filteredRowsLookup: {},
|
|
277
|
+
filteredChildrenCountLookup: {},
|
|
276
278
|
filteredDescendantCountLookup: {}
|
|
277
279
|
};
|
|
278
280
|
}
|
|
@@ -301,6 +303,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
301
303
|
}
|
|
302
304
|
return {
|
|
303
305
|
filteredRowsLookup,
|
|
306
|
+
filteredChildrenCountLookup: {},
|
|
304
307
|
filteredDescendantCountLookup: {}
|
|
305
308
|
};
|
|
306
309
|
}, [apiRef, props.filterMode, getRowId, getRowsRef]);
|
|
@@ -105,6 +105,9 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
105
105
|
}, [apiRef, logger, props.rowSelection, props.signature, canHaveMultipleSelection]);
|
|
106
106
|
const isRowSelected = React.useCallback(id => gridRowSelectionStateSelector(apiRef.current.state).includes(id), [apiRef]);
|
|
107
107
|
const isRowSelectable = React.useCallback(id => {
|
|
108
|
+
if (props.rowSelection === false) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
108
111
|
if (propIsRowSelectable && !propIsRowSelectable(apiRef.current.getRowParams(id))) {
|
|
109
112
|
return false;
|
|
110
113
|
}
|
|
@@ -113,7 +116,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
113
116
|
return false;
|
|
114
117
|
}
|
|
115
118
|
return true;
|
|
116
|
-
}, [apiRef, propIsRowSelectable]);
|
|
119
|
+
}, [apiRef, props.rowSelection, propIsRowSelectable]);
|
|
117
120
|
const getSelectedRows = React.useCallback(() => selectedGridRowsSelector(apiRef), [apiRef]);
|
|
118
121
|
const selectRow = React.useCallback((id, isSelected = true, resetSelection = false) => {
|
|
119
122
|
if (!apiRef.current.isRowSelectable(id)) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { selectedIdsLookupSelector } from '../rowSelection';
|
|
3
|
+
import { useGridSelector } from '../../utils/useGridSelector';
|
|
4
|
+
import { gridColumnGroupsHeaderMaxDepthSelector } from '../columnGrouping/gridColumnGroupsSelector';
|
|
5
|
+
import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
|
|
6
|
+
export const useGridRowAriaAttributes = () => {
|
|
7
|
+
const apiRef = useGridPrivateApiContext();
|
|
8
|
+
const selectedIdsLookup = useGridSelector(apiRef, selectedIdsLookupSelector);
|
|
9
|
+
const headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
|
|
10
|
+
return React.useCallback((rowNode, index) => {
|
|
11
|
+
const ariaAttributes = {};
|
|
12
|
+
const ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
|
|
13
|
+
ariaAttributes['aria-rowindex'] = ariaRowIndex;
|
|
14
|
+
if (apiRef.current.isRowSelectable(rowNode.id)) {
|
|
15
|
+
ariaAttributes['aria-selected'] = selectedIdsLookup[rowNode.id] !== undefined;
|
|
16
|
+
}
|
|
17
|
+
return ariaAttributes;
|
|
18
|
+
}, [apiRef, selectedIdsLookup, headerGroupingMaxDepth]);
|
|
19
|
+
};
|
|
@@ -2,24 +2,21 @@ import { gridVisibleColumnDefinitionsSelector } from '../features/columns/gridCo
|
|
|
2
2
|
import { useGridSelector } from './useGridSelector';
|
|
3
3
|
import { useGridRootProps } from './useGridRootProps';
|
|
4
4
|
import { gridColumnGroupsHeaderMaxDepthSelector } from '../features/columnGrouping/gridColumnGroupsSelector';
|
|
5
|
-
import { gridPinnedRowsCountSelector
|
|
5
|
+
import { gridPinnedRowsCountSelector } from '../features/rows/gridRowsSelector';
|
|
6
6
|
import { useGridPrivateApiContext } from './useGridPrivateApiContext';
|
|
7
7
|
import { isMultipleRowSelectionEnabled } from '../features/rowSelection/utils';
|
|
8
|
+
import { gridExpandedRowCountSelector } from '../features/filter/gridFilterSelector';
|
|
8
9
|
export const useGridAriaAttributes = () => {
|
|
9
10
|
const apiRef = useGridPrivateApiContext();
|
|
10
11
|
const rootProps = useGridRootProps();
|
|
11
12
|
const visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
12
|
-
const
|
|
13
|
+
const accessibleRowCount = useGridSelector(apiRef, gridExpandedRowCountSelector);
|
|
13
14
|
const headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
|
|
14
15
|
const pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector);
|
|
15
|
-
let role = 'grid';
|
|
16
|
-
if (rootProps.treeData) {
|
|
17
|
-
role = 'treegrid';
|
|
18
|
-
}
|
|
19
16
|
return {
|
|
20
|
-
role,
|
|
17
|
+
role: 'grid',
|
|
21
18
|
'aria-colcount': visibleColumns.length,
|
|
22
|
-
'aria-rowcount': headerGroupingMaxDepth + 1 + pinnedRowsCount +
|
|
19
|
+
'aria-rowcount': headerGroupingMaxDepth + 1 + pinnedRowsCount + accessibleRowCount,
|
|
23
20
|
'aria-multiselectable': isMultipleRowSelectionEnabled(rootProps)
|
|
24
21
|
};
|
|
25
22
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridConfigurationContext } from '../../components/GridConfigurationContext';
|
|
3
|
+
export const useGridConfiguration = () => {
|
|
4
|
+
const configuration = React.useContext(GridConfigurationContext);
|
|
5
|
+
if (configuration === undefined) {
|
|
6
|
+
throw new Error(['MUI X: Could not find the data grid configuration context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the data grid.'].join('\n'));
|
|
7
|
+
}
|
|
8
|
+
return configuration;
|
|
9
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { fastObjectShallowCompare } from '@mui/x-internals/fastObjectShallowCompare';
|
|
2
3
|
import { useLazyRef } from './useLazyRef';
|
|
3
4
|
import { useOnMount } from './useOnMount';
|
|
4
5
|
import { warnOnce } from '../../internals/utils/warning';
|
|
5
|
-
import { fastObjectShallowCompare } from '../../utils/fastObjectShallowCompare';
|
|
6
6
|
function isOutputSelector(selector) {
|
|
7
7
|
return selector.acceptsApiRef;
|
|
8
8
|
}
|
package/modern/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export { useGridCsvExport } from '../hooks/features/export/useGridCsvExport';
|
|
|
23
23
|
export { useGridPrintExport } from '../hooks/features/export/useGridPrintExport';
|
|
24
24
|
export { useGridFilter, filterStateInitializer } from '../hooks/features/filter/useGridFilter';
|
|
25
25
|
export { passFilterLogic } from '../hooks/features/filter/gridFilterUtils';
|
|
26
|
+
export { gridFilteredChildrenCountLookupSelector, gridExpandedSortedRowTreeLevelPositionLookupSelector } from '../hooks/features/filter/gridFilterSelector';
|
|
26
27
|
export { isSingleSelectColDef } from '../components/panel/filterPanel/filterPanelUtils';
|
|
27
28
|
export { useGridFocus, focusStateInitializer } from '../hooks/features/focus/useGridFocus';
|
|
28
29
|
export { useGridKeyboardNavigation } from '../hooks/features/keyboardNavigation/useGridKeyboardNavigation';
|
|
@@ -31,6 +32,8 @@ export { useGridPreferencesPanel, preferencePanelStateInitializer } from '../hoo
|
|
|
31
32
|
export { useGridEditing, editingStateInitializer } from '../hooks/features/editing/useGridEditing';
|
|
32
33
|
export { gridEditRowsStateSelector } from '../hooks/features/editing/gridEditingSelectors';
|
|
33
34
|
export { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
|
|
35
|
+
export { useGridAriaAttributes } from '../hooks/utils/useGridAriaAttributes';
|
|
36
|
+
export { useGridRowAriaAttributes } from '../hooks/features/rows/useGridRowAriaAttributes';
|
|
34
37
|
export { useGridRowsPreProcessors } from '../hooks/features/rows/useGridRowsPreProcessors';
|
|
35
38
|
export { getTreeNodeDescendants, buildRootGroup } from '../hooks/features/rows/gridRowsUtils';
|
|
36
39
|
export { useGridRowsMeta, rowsMetaStateInitializer } from '../hooks/features/rows/useGridRowsMeta';
|
|
@@ -59,7 +62,6 @@ export { gridRowGroupsToFetchSelector } from '../hooks/features/rows/gridRowsSel
|
|
|
59
62
|
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal } from '../utils/domUtils';
|
|
60
63
|
export { isNavigationKey, isPasteShortcut } from '../utils/keyboardUtils';
|
|
61
64
|
export * from '../utils/utils';
|
|
62
|
-
export * from '../utils/fastMemo';
|
|
63
65
|
export { exportAs } from '../utils/exportAs';
|
|
64
66
|
export * from '../utils/getPublicApiRef';
|
|
65
67
|
export * from '../utils/cellBorderUtils';
|
package/modern/locales/viVN.js
CHANGED
|
@@ -30,11 +30,10 @@ const viVNGrid = {
|
|
|
30
30
|
toolbarExportPrint: 'In',
|
|
31
31
|
toolbarExportExcel: 'Xuất Excel',
|
|
32
32
|
// Columns management text
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
columnsManagementSearchTitle: 'Tìm kiếm',
|
|
34
|
+
columnsManagementNoColumns: 'Không có cột',
|
|
35
|
+
columnsManagementShowHideAllText: 'Hiện/Ẩn Tất cả',
|
|
36
|
+
columnsManagementReset: 'Đặt lại',
|
|
38
37
|
// Filter panel text
|
|
39
38
|
filterPanelAddFilter: 'Thêm bộ lọc',
|
|
40
39
|
filterPanelRemoveAll: 'Xóa tất cả',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,6 +10,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _components = require("../components");
|
|
13
|
+
var _useGridAriaAttributes = require("../hooks/utils/useGridAriaAttributes");
|
|
14
|
+
var _useGridRowAriaAttributes = require("../hooks/features/rows/useGridRowAriaAttributes");
|
|
13
15
|
var _GridContextProvider = require("../context/GridContextProvider");
|
|
14
16
|
var _useDataGridComponent = require("./useDataGridComponent");
|
|
15
17
|
var _useDataGridProps = require("./useDataGridProps");
|
|
@@ -17,6 +19,12 @@ var _propValidation = require("../internals/utils/propValidation");
|
|
|
17
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
20
|
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); }
|
|
19
21
|
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 && {}.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; }
|
|
22
|
+
const configuration = {
|
|
23
|
+
hooks: {
|
|
24
|
+
useGridAriaAttributes: _useGridAriaAttributes.useGridAriaAttributes,
|
|
25
|
+
useGridRowAriaAttributes: _useGridRowAriaAttributes.useGridRowAriaAttributes
|
|
26
|
+
}
|
|
27
|
+
};
|
|
20
28
|
let propValidators;
|
|
21
29
|
if (process.env.NODE_ENV !== 'production') {
|
|
22
30
|
propValidators = [..._propValidation.propValidatorsDataGrid,
|
|
@@ -31,6 +39,7 @@ const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref
|
|
|
31
39
|
}
|
|
32
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridContextProvider.GridContextProvider, {
|
|
33
41
|
privateApiRef: privateApiRef,
|
|
42
|
+
configuration: configuration,
|
|
34
43
|
props: props,
|
|
35
44
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.GridRoot, (0, _extends2.default)({
|
|
36
45
|
className: props.className,
|
|
@@ -329,7 +338,7 @@ DataGridRaw.propTypes = {
|
|
|
329
338
|
/**
|
|
330
339
|
* Determines if a row can be selected.
|
|
331
340
|
* @param {GridRowParams} params With all properties from [[GridRowParams]].
|
|
332
|
-
* @returns {boolean} A boolean indicating if the
|
|
341
|
+
* @returns {boolean} A boolean indicating if the row is selectable.
|
|
333
342
|
*/
|
|
334
343
|
isRowSelectable: _propTypes.default.func,
|
|
335
344
|
/**
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var _fastMemo = require("
|
|
12
|
+
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
13
13
|
var _useGridColumnHeaders = require("../hooks/features/columnHeaders/useGridColumnHeaders");
|
|
14
14
|
var _GridBaseColumnHeaders = require("./columnHeaders/GridBaseColumnHeaders");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.GridConfigurationContext = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _fastObjectShallowCompare = require("./fastObjectShallowCompare");
|
|
9
8
|
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); }
|
|
10
9
|
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 && {}.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; }
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const GridConfigurationContext = exports.GridConfigurationContext = /*#__PURE__*/React.createContext(undefined);
|
|
11
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
12
|
+
GridConfigurationContext.displayName = 'GridConfigurationContext';
|
|
13
13
|
}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.GridHeaders = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _fastMemo = require("
|
|
10
|
+
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
11
11
|
var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
|
|
12
12
|
var _useGridSelector = require("../hooks/utils/useGridSelector");
|
|
13
13
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
|
-
var _fastMemo = require("
|
|
14
|
+
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
15
15
|
var _gridEditRowModel = require("../models/gridEditRowModel");
|
|
16
16
|
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
17
17
|
var _gridClasses = require("../constants/gridClasses");
|
|
@@ -26,11 +26,11 @@ var _gridActionsColDef = require("../colDef/gridActionsColDef");
|
|
|
26
26
|
var _gridDetailPanelToggleField = require("../constants/gridDetailPanelToggleField");
|
|
27
27
|
var _gridSortingSelector = require("../hooks/features/sorting/gridSortingSelector");
|
|
28
28
|
var _gridRowsSelector = require("../hooks/features/rows/gridRowsSelector");
|
|
29
|
-
var _gridColumnGroupsSelector = require("../hooks/features/columnGrouping/gridColumnGroupsSelector");
|
|
30
29
|
var _gridEditingSelectors = require("../hooks/features/editing/gridEditingSelectors");
|
|
31
30
|
var _GridCell = require("./cell/GridCell");
|
|
32
31
|
var _GridScrollbarFillerCell = require("./GridScrollbarFillerCell");
|
|
33
32
|
var _getPinnedCellOffset = require("../internals/utils/getPinnedCellOffset");
|
|
33
|
+
var _useGridConfiguration = require("../hooks/utils/useGridConfiguration");
|
|
34
34
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
35
|
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
36
36
|
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); }
|
|
@@ -77,12 +77,12 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
77
77
|
} = props,
|
|
78
78
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
79
79
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
80
|
+
const configuration = (0, _useGridConfiguration.useGridConfiguration)();
|
|
80
81
|
const ref = React.useRef(null);
|
|
81
82
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
82
83
|
const currentPage = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, rootProps);
|
|
83
84
|
const sortModel = (0, _useGridSelector.useGridSelector)(apiRef, _gridSortingSelector.gridSortModelSelector);
|
|
84
85
|
const treeDepth = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowMaximumTreeDepthSelector);
|
|
85
|
-
const headerGroupingMaxDepth = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnGroupsSelector.gridColumnGroupsHeaderMaxDepthSelector);
|
|
86
86
|
const columnPositions = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridColumnPositionsSelector);
|
|
87
87
|
const editRowsState = (0, _useGridSelector.useGridSelector)(apiRef, _gridEditingSelectors.gridEditRowsStateSelector);
|
|
88
88
|
const handleRef = (0, _utils.unstable_useForkRef)(ref, refProp);
|
|
@@ -94,11 +94,10 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
94
94
|
const hasFocusCell = focusedColumnIndex !== undefined;
|
|
95
95
|
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < renderContext.firstColumnIndex;
|
|
96
96
|
const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= renderContext.lastColumnIndex;
|
|
97
|
-
const ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
|
|
98
|
-
|
|
99
97
|
const classes = (0, _composeGridClasses.composeGridClasses)(rootProps.classes, {
|
|
100
98
|
root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isFirstVisible && 'row--firstVisible', isLastVisible && 'row--lastVisible', showBottomBorder && 'row--borderBottom', rowHeight === 'auto' && 'row--dynamicHeight']
|
|
101
99
|
});
|
|
100
|
+
const getRowAriaAttributes = configuration.hooks.useGridRowAriaAttributes();
|
|
102
101
|
React.useLayoutEffect(() => {
|
|
103
102
|
if (currentPage.range) {
|
|
104
103
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -221,6 +220,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
221
220
|
return rowStyle;
|
|
222
221
|
}, [isNotVisible, rowHeight, styleProp, minHeight, sizes, rootProps.rowSpacingType]);
|
|
223
222
|
const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
223
|
+
const ariaAttributes = rowNode ? getRowAriaAttributes(rowNode, index) : undefined;
|
|
224
224
|
if (typeof rootProps.getRowClassName === 'function') {
|
|
225
225
|
const indexRelativeToCurrentPage = index - (currentPage.range?.firstRowIndex || 0);
|
|
226
226
|
const rowParams = (0, _extends2.default)({}, apiRef.current.getRowParams(rowId), {
|
|
@@ -317,10 +317,8 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
317
317
|
"data-rowindex": index,
|
|
318
318
|
role: "row",
|
|
319
319
|
className: (0, _clsx.default)(...rowClassNames, classes.root, className),
|
|
320
|
-
"aria-rowindex": ariaRowIndex,
|
|
321
|
-
"aria-selected": selected,
|
|
322
320
|
style: style
|
|
323
|
-
}, eventHandlers, other, {
|
|
321
|
+
}, ariaAttributes, eventHandlers, other, {
|
|
324
322
|
children: [leftCells, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
325
323
|
role: "presentation",
|
|
326
324
|
className: _gridClasses.gridClasses.cellOffsetLeft,
|
|
@@ -10,6 +10,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
11
|
var _utils = require("@mui/utils");
|
|
12
12
|
var _system = require("@mui/system");
|
|
13
|
+
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
13
14
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
14
15
|
var _constants = require("../constants");
|
|
15
16
|
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
@@ -20,7 +21,6 @@ var _densitySelector = require("../hooks/features/density/densitySelector");
|
|
|
20
21
|
var _gridColumnsSelector = require("../hooks/features/columns/gridColumnsSelector");
|
|
21
22
|
var _useTimeout = require("../hooks/utils/useTimeout");
|
|
22
23
|
var _gridColumnsUtils = require("../hooks/features/columns/gridColumnsUtils");
|
|
23
|
-
var _fastMemo = require("../utils/fastMemo");
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
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); }
|
|
26
26
|
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 && {}.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; }
|
|
@@ -128,7 +128,7 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = /*#__PUR
|
|
|
128
128
|
if (hasScrollbarFiller) {
|
|
129
129
|
rowCells.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridScrollbarFillerCell.GridScrollbarFillerCell, {
|
|
130
130
|
pinnedRight: pinnedColumns.right.length > 0
|
|
131
|
-
}));
|
|
131
|
+
}, `skeleton-scrollbar-filler-${i}`));
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
array.push( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
|
-
var _fastMemo = require("
|
|
14
|
+
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
15
15
|
var _doesSupportPreventScroll = require("../../utils/doesSupportPreventScroll");
|
|
16
16
|
var _gridClasses = require("../../constants/gridClasses");
|
|
17
17
|
var _models = require("../../models");
|
|
@@ -9,10 +9,10 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
13
|
var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));
|
|
13
14
|
var _utils = require("@mui/utils");
|
|
14
|
-
var
|
|
15
|
-
var _fastMemo = require("../../utils/fastMemo");
|
|
15
|
+
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
16
16
|
var _utils2 = require("../../utils/utils");
|
|
17
17
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
18
18
|
var _gridClasses = require("../../constants/gridClasses");
|
|
@@ -10,7 +10,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
12
|
var _utils = require("@mui/utils");
|
|
13
|
-
var _fastMemo = require("
|
|
13
|
+
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
14
14
|
var _useGridPrivateApiContext = require("../../hooks/utils/useGridPrivateApiContext");
|
|
15
15
|
var _ColumnHeaderMenuIcon = require("./ColumnHeaderMenuIcon");
|
|
16
16
|
var _GridColumnHeaderMenu = require("../menu/columnMenu/GridColumnHeaderMenu");
|
|
@@ -675,9 +675,16 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
675
675
|
[`& .${_gridClasses.gridClasses['filler--borderTop']}`]: {
|
|
676
676
|
borderTop: '1px solid var(--DataGrid-rowBorderColor)'
|
|
677
677
|
},
|
|
678
|
-
/* Hide grid rows and vertical scrollbar when skeleton overlay is visible */
|
|
678
|
+
/* Hide grid rows, row filler, and vertical scrollbar when skeleton overlay is visible */
|
|
679
679
|
[`& .${_gridClasses.gridClasses['main--hasSkeletonLoadingOverlay']}`]: {
|
|
680
|
-
[`& .${_gridClasses.gridClasses.virtualScrollerContent}
|
|
680
|
+
[`& .${_gridClasses.gridClasses.virtualScrollerContent}`]: {
|
|
681
|
+
// We use visibility hidden so that the virtual scroller content retains its height.
|
|
682
|
+
// Position fixed is used to remove the virtual scroller content from the flow.
|
|
683
|
+
// https://github.com/mui/mui-x/issues/14061
|
|
684
|
+
position: 'fixed',
|
|
685
|
+
visibility: 'hidden'
|
|
686
|
+
},
|
|
687
|
+
[`& .${_gridClasses.gridClasses['scrollbar--vertical']}, & .${_gridClasses.gridClasses.pinnedRows}, & .${_gridClasses.gridClasses.virtualScroller} > .${_gridClasses.gridClasses.filler}`]: {
|
|
681
688
|
display: 'none'
|
|
682
689
|
}
|
|
683
690
|
}
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _system = require("@mui/system");
|
|
11
11
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
12
|
-
var
|
|
12
|
+
var _useGridConfiguration = require("../../hooks/utils/useGridConfiguration");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
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
15
|
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 && {}.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; }
|
|
@@ -28,8 +28,9 @@ const Element = (0, _system.styled)('div', {
|
|
|
28
28
|
overflow: 'hidden'
|
|
29
29
|
});
|
|
30
30
|
const GridMainContainer = exports.GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
31
|
-
const ariaAttributes = (0, _useGridAriaAttributes.useGridAriaAttributes)();
|
|
32
31
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
32
|
+
const configuration = (0, _useGridConfiguration.useGridConfiguration)();
|
|
33
|
+
const ariaAttributes = configuration.hooks.useGridAriaAttributes();
|
|
33
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Element, (0, _extends2.default)({
|
|
34
35
|
ref: ref,
|
|
35
36
|
ownerState: rootProps,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.GridVirtualScrollerFiller = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _system = require("@mui/system");
|
|
9
|
-
var _fastMemo = require("
|
|
9
|
+
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
10
10
|
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
11
11
|
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
12
12
|
var _dimensions = require("../../hooks/features/dimensions");
|
|
@@ -8,22 +8,27 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _GridApiContext = require("../components/GridApiContext");
|
|
9
9
|
var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
|
|
10
10
|
var _GridRootPropsContext = require("./GridRootPropsContext");
|
|
11
|
+
var _GridConfigurationContext = require("../components/GridConfigurationContext");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
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); }
|
|
13
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 && {}.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; }
|
|
14
15
|
function GridContextProvider({
|
|
15
16
|
privateApiRef,
|
|
17
|
+
configuration,
|
|
16
18
|
props,
|
|
17
19
|
children
|
|
18
20
|
}) {
|
|
19
21
|
const apiRef = React.useRef(privateApiRef.current.getPublicApi());
|
|
20
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
21
|
-
value:
|
|
22
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
23
|
-
value:
|
|
24
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
25
|
-
value:
|
|
26
|
-
children:
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridConfigurationContext.GridConfigurationContext.Provider, {
|
|
23
|
+
value: configuration,
|
|
24
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridRootPropsContext.GridRootPropsContext.Provider, {
|
|
25
|
+
value: props,
|
|
26
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_useGridPrivateApiContext.GridPrivateApiContext.Provider, {
|
|
27
|
+
value: privateApiRef,
|
|
28
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridApiContext.GridApiContext.Provider, {
|
|
29
|
+
value: apiRef,
|
|
30
|
+
children: children
|
|
31
|
+
})
|
|
27
32
|
})
|
|
28
33
|
})
|
|
29
34
|
});
|
|
@@ -57,9 +57,7 @@ const useGridStateInitialization = apiRef => {
|
|
|
57
57
|
if (!ignoreSetState) {
|
|
58
58
|
// We always assign it as we mutate rows for perf reason.
|
|
59
59
|
apiRef.current.state = newState;
|
|
60
|
-
|
|
61
|
-
apiRef.current.publishEvent('stateChange', newState);
|
|
62
|
-
}
|
|
60
|
+
apiRef.current.publishEvent('stateChange', newState);
|
|
63
61
|
apiRef.current.store.update(newState);
|
|
64
62
|
}
|
|
65
63
|
if (updatedControlStateIds.length === 1) {
|
|
@@ -9,9 +9,9 @@ exports.useGridDimensions = useGridDimensions;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _utils = require("@mui/utils");
|
|
12
|
+
var _throttle = require("@mui/x-internals/throttle");
|
|
12
13
|
var _useGridApiEventHandler = require("../../utils/useGridApiEventHandler");
|
|
13
14
|
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
14
|
-
var _throttle = require("../../../utils/throttle");
|
|
15
15
|
var _useGridLogger = require("../../utils/useGridLogger");
|
|
16
16
|
var _columns = require("../columns");
|
|
17
17
|
var _gridDimensionsSelectors = require("./gridDimensionsSelectors");
|
|
@@ -8,6 +8,9 @@ exports.serializeCellValue = void 0;
|
|
|
8
8
|
var _colDef = require("../../../../colDef");
|
|
9
9
|
var _warning = require("../../../../internals/utils/warning");
|
|
10
10
|
function sanitizeCellValue(value, csvOptions) {
|
|
11
|
+
if (value === null || value === undefined) {
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
11
14
|
const valueStr = typeof value === 'string' ? value : `${value}`;
|
|
12
15
|
if (csvOptions.shouldAppendQuotes || csvOptions.escapeFormulas) {
|
|
13
16
|
const escapedValue = valueStr.replace(/"/g, '""');
|
|
@@ -59,9 +62,7 @@ class CSVRow {
|
|
|
59
62
|
if (!this.isEmpty) {
|
|
60
63
|
this.rowString += this.options.csvOptions.delimiter;
|
|
61
64
|
}
|
|
62
|
-
if (
|
|
63
|
-
this.rowString += '';
|
|
64
|
-
} else if (typeof this.options.sanitizeCellValue === 'function') {
|
|
65
|
+
if (typeof this.options.sanitizeCellValue === 'function') {
|
|
65
66
|
this.rowString += this.options.sanitizeCellValue(value, this.options.csvOptions);
|
|
66
67
|
} else {
|
|
67
68
|
this.rowString += value;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.gridVisibleRowsLookupSelector = exports.gridQuickFilterValuesSelector = exports.gridFilteredTopLevelRowCountSelector = exports.gridFilteredSortedTopLevelRowEntriesSelector = exports.gridFilteredSortedRowIdsSelector = exports.gridFilteredSortedRowEntriesSelector = exports.gridFilteredRowsLookupSelector = exports.gridFilteredRowCountSelector = exports.gridFilteredDescendantRowCountSelector = exports.gridFilteredDescendantCountLookupSelector = exports.gridFilterModelSelector = exports.gridFilterActiveItemsSelector = exports.gridFilterActiveItemsLookupSelector = exports.gridExpandedSortedRowIdsSelector = exports.gridExpandedSortedRowEntriesSelector = exports.gridExpandedRowCountSelector = void 0;
|
|
6
|
+
exports.gridVisibleRowsLookupSelector = exports.gridQuickFilterValuesSelector = exports.gridFilteredTopLevelRowCountSelector = exports.gridFilteredSortedTopLevelRowEntriesSelector = exports.gridFilteredSortedRowIdsSelector = exports.gridFilteredSortedRowEntriesSelector = exports.gridFilteredRowsLookupSelector = exports.gridFilteredRowCountSelector = exports.gridFilteredDescendantRowCountSelector = exports.gridFilteredDescendantCountLookupSelector = exports.gridFilteredChildrenCountLookupSelector = exports.gridFilterModelSelector = exports.gridFilterActiveItemsSelector = exports.gridFilterActiveItemsLookupSelector = exports.gridExpandedSortedRowTreeLevelPositionLookupSelector = exports.gridExpandedSortedRowIdsSelector = exports.gridExpandedSortedRowEntriesSelector = exports.gridExpandedRowCountSelector = void 0;
|
|
7
7
|
var _createSelector = require("../../../utils/createSelector");
|
|
8
8
|
var _gridSortingSelector = require("../sorting/gridSortingSelector");
|
|
9
9
|
var _gridColumnsSelector = require("../columns/gridColumnsSelector");
|
|
@@ -38,6 +38,12 @@ const gridVisibleRowsLookupSelector = state => state.visibleRowsLookup;
|
|
|
38
38
|
exports.gridVisibleRowsLookupSelector = gridVisibleRowsLookupSelector;
|
|
39
39
|
const gridFilteredRowsLookupSelector = exports.gridFilteredRowsLookupSelector = (0, _createSelector.createSelector)(gridFilterStateSelector, filterState => filterState.filteredRowsLookup);
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* @category Filtering
|
|
43
|
+
* @ignore - do not document.
|
|
44
|
+
*/
|
|
45
|
+
const gridFilteredChildrenCountLookupSelector = exports.gridFilteredChildrenCountLookupSelector = (0, _createSelector.createSelector)(gridFilterStateSelector, filterState => filterState.filteredChildrenCountLookup);
|
|
46
|
+
|
|
41
47
|
/**
|
|
42
48
|
* @category Filtering
|
|
43
49
|
* @ignore - do not document.
|
|
@@ -72,6 +78,34 @@ const gridFilteredSortedRowEntriesSelector = exports.gridFilteredSortedRowEntrie
|
|
|
72
78
|
*/
|
|
73
79
|
const gridFilteredSortedRowIdsSelector = exports.gridFilteredSortedRowIdsSelector = (0, _createSelector.createSelectorMemoized)(gridFilteredSortedRowEntriesSelector, filteredSortedRowEntries => filteredSortedRowEntries.map(row => row.id));
|
|
74
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Get the ids to position in the current tree level lookup of the rows accessible after the filtering process.
|
|
83
|
+
* Does not contain the collapsed children.
|
|
84
|
+
* @category Filtering
|
|
85
|
+
* @ignore - do not document.
|
|
86
|
+
*/
|
|
87
|
+
const gridExpandedSortedRowTreeLevelPositionLookupSelector = exports.gridExpandedSortedRowTreeLevelPositionLookupSelector = (0, _createSelector.createSelectorMemoized)(gridExpandedSortedRowIdsSelector, _gridRowsSelector.gridRowTreeSelector, (visibleSortedRowIds, rowTree) => {
|
|
88
|
+
const depthPositionCounter = {};
|
|
89
|
+
let lastDepth = 0;
|
|
90
|
+
return visibleSortedRowIds.reduce((acc, rowId) => {
|
|
91
|
+
const rowNode = rowTree[rowId];
|
|
92
|
+
if (!depthPositionCounter[rowNode.depth]) {
|
|
93
|
+
depthPositionCounter[rowNode.depth] = 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// going deeper in the tree should reset the counter
|
|
97
|
+
// since it might have been used in some other branch at the same level, up in the tree
|
|
98
|
+
// going back up should keep the counter and continue where it left off
|
|
99
|
+
if (rowNode.depth > lastDepth) {
|
|
100
|
+
depthPositionCounter[rowNode.depth] = 0;
|
|
101
|
+
}
|
|
102
|
+
lastDepth = rowNode.depth;
|
|
103
|
+
depthPositionCounter[rowNode.depth] += 1;
|
|
104
|
+
acc[rowId] = depthPositionCounter[rowNode.depth];
|
|
105
|
+
return acc;
|
|
106
|
+
}, {});
|
|
107
|
+
});
|
|
108
|
+
|
|
75
109
|
/**
|
|
76
110
|
* Get the id and the model of the top level rows accessible after the filtering process.
|
|
77
111
|
* @category Filtering
|