@mui/x-data-grid 8.0.0-alpha.3 → 8.0.0-alpha.5
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 +377 -0
- package/DataGrid/DataGrid.js +7 -11
- package/DataGrid/useDataGridProps.js +3 -3
- package/README.md +1 -1
- package/components/GridRow.js +13 -2
- package/components/cell/GridActionsCell.js +8 -1
- package/components/cell/GridActionsCellItem.js +4 -6
- package/components/cell/GridCell.js +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +6 -11
- package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +6 -11
- package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +6 -11
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +13 -22
- package/components/panel/GridColumnsPanel.js +1 -2
- package/components/panel/GridPanelContent.js +7 -3
- package/components/panel/GridPanelFooter.d.ts +1 -1
- package/components/panel/GridPanelFooter.js +4 -3
- package/components/panel/filterPanel/GridFilterForm.js +15 -15
- package/components/toolbar/GridToolbarDensitySelector.js +3 -5
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/toolbar/GridToolbarFilterButton.js +3 -0
- package/components/toolbar/GridToolbarQuickFilter.js +27 -23
- package/components/virtualization/GridMainContainer.js +1 -1
- package/constants/dataGridPropsDefaultValues.js +1 -1
- package/hooks/core/useGridStateInitialization.js +3 -3
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +4 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/hooks/features/columnResize/columnResizeSelector.d.ts +1 -1
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +6 -0
- package/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/hooks/features/columns/gridColumnsSelector.d.ts +12 -12
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/hooks/features/density/densitySelector.d.ts +1 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +17 -17
- package/hooks/features/filter/useGridFilter.js +1 -1
- package/hooks/features/focus/gridFocusStateSelector.d.ts +8 -8
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
- package/hooks/features/overlays/useGridOverlays.js +3 -1
- package/hooks/features/pagination/gridPaginationSelector.d.ts +15 -9
- package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/hooks/features/rowSelection/utils.d.ts +1 -1
- package/hooks/features/rows/gridRowSpanningSelectors.d.ts +3 -3
- package/hooks/features/rows/gridRowsSelector.d.ts +23 -12
- package/hooks/features/rows/useGridRowSpanning.d.ts +1 -1
- package/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/hooks/features/rows/useGridRows.js +5 -5
- package/hooks/features/sorting/gridSortingSelector.d.ts +10 -5
- package/hooks/features/sorting/gridSortingSelector.js +11 -0
- package/hooks/features/sorting/index.d.ts +2 -1
- package/hooks/features/sorting/index.js +1 -1
- package/hooks/features/sorting/useGridSorting.js +1 -1
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +5 -5
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/hooks/utils/useGridSelector.d.ts +4 -6
- package/hooks/utils/useGridSelector.js +6 -44
- package/index.js +1 -1
- package/internals/index.d.ts +2 -2
- package/internals/index.js +2 -2
- package/internals/utils/index.d.ts +0 -1
- package/internals/utils/index.js +0 -1
- package/locales/koKR.js +45 -49
- package/locales/roRO.js +18 -20
- package/material/index.js +30 -4
- package/models/api/gridStateApi.d.ts +1 -1
- package/models/controlStateItem.d.ts +2 -2
- package/models/gridBaseSlots.d.ts +21 -0
- package/models/gridBaseSlots.js +1 -0
- package/models/gridSlotsComponentsProps.d.ts +25 -5
- package/models/props/DataGridProps.d.ts +1 -6
- package/modern/DataGrid/DataGrid.js +7 -11
- package/modern/DataGrid/useDataGridProps.js +3 -3
- package/modern/components/GridRow.js +13 -2
- package/modern/components/cell/GridActionsCell.js +8 -1
- package/modern/components/cell/GridActionsCellItem.js +4 -6
- package/modern/components/cell/GridCell.js +1 -1
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +6 -11
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +6 -11
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +6 -11
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +13 -22
- package/modern/components/panel/GridColumnsPanel.js +1 -2
- package/modern/components/panel/GridPanelContent.js +7 -3
- package/modern/components/panel/GridPanelFooter.js +4 -3
- package/modern/components/panel/filterPanel/GridFilterForm.js +15 -15
- package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -5
- package/modern/components/toolbar/GridToolbarFilterButton.js +3 -0
- package/modern/components/toolbar/GridToolbarQuickFilter.js +27 -23
- package/modern/components/virtualization/GridMainContainer.js +1 -1
- package/modern/constants/dataGridPropsDefaultValues.js +1 -1
- package/modern/hooks/core/useGridStateInitialization.js +3 -3
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/modern/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/modern/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/modern/hooks/features/filter/useGridFilter.js +1 -1
- package/modern/hooks/features/overlays/useGridOverlays.js +3 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/modern/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/modern/hooks/features/rows/useGridRows.js +5 -5
- package/modern/hooks/features/sorting/gridSortingSelector.js +11 -0
- package/modern/hooks/features/sorting/index.js +1 -1
- package/modern/hooks/features/sorting/useGridSorting.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/modern/hooks/utils/useGridSelector.js +6 -44
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -2
- package/modern/internals/utils/index.js +0 -1
- package/modern/locales/koKR.js +45 -49
- package/modern/locales/roRO.js +18 -20
- package/modern/material/index.js +30 -4
- package/modern/models/gridBaseSlots.js +1 -0
- package/modern/utils/createSelector.js +1 -120
- package/node/DataGrid/DataGrid.js +7 -11
- package/node/DataGrid/useDataGridProps.js +2 -2
- package/node/components/GridRow.js +13 -2
- package/node/components/cell/GridActionsCell.js +8 -1
- package/node/components/cell/GridActionsCellItem.js +3 -5
- package/node/components/cell/GridCell.js +1 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +5 -10
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +5 -10
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +5 -10
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +13 -22
- package/node/components/panel/GridColumnsPanel.js +1 -2
- package/node/components/panel/GridPanelContent.js +7 -3
- package/node/components/panel/GridPanelFooter.js +5 -4
- package/node/components/panel/filterPanel/GridFilterForm.js +15 -15
- package/node/components/toolbar/GridToolbarDensitySelector.js +3 -5
- package/node/components/toolbar/GridToolbarFilterButton.js +3 -0
- package/node/components/toolbar/GridToolbarQuickFilter.js +27 -23
- package/node/components/virtualization/GridMainContainer.js +1 -1
- package/node/constants/dataGridPropsDefaultValues.js +1 -1
- package/node/hooks/core/useGridStateInitialization.js +3 -3
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/node/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/node/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/node/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/node/hooks/features/filter/useGridFilter.js +1 -1
- package/node/hooks/features/overlays/useGridOverlays.js +3 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/node/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/node/hooks/features/rows/useGridRows.js +5 -5
- package/node/hooks/features/sorting/gridSortingSelector.js +12 -1
- package/node/hooks/features/sorting/index.js +24 -16
- package/node/hooks/features/sorting/useGridSorting.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/node/hooks/utils/useGridSelector.js +8 -47
- package/node/index.js +1 -1
- package/node/internals/index.js +8 -22
- package/node/internals/utils/index.js +0 -11
- package/node/locales/koKR.js +45 -49
- package/node/locales/roRO.js +18 -20
- package/node/material/index.js +31 -4
- package/node/models/gridBaseSlots.js +5 -0
- package/node/utils/createSelector.js +4 -125
- package/package.json +2 -2
- package/utils/createSelector.d.ts +4 -16
- package/utils/createSelector.js +1 -120
- package/internals/utils/useProps.d.ts +0 -1
- package/internals/utils/useProps.js +0 -24
- package/joy/icons.d.ts +0 -32
- package/joy/icons.js +0 -431
- package/joy/index.d.ts +0 -2
- package/joy/index.js +0 -2
- package/joy/joySlots.d.ts +0 -3
- package/joy/joySlots.js +0 -389
- package/joy/package.json +0 -6
- package/modern/internals/utils/useProps.js +0 -24
- package/modern/joy/icons.js +0 -431
- package/modern/joy/index.js +0 -2
- package/modern/joy/joySlots.js +0 -389
- package/node/internals/utils/useProps.js +0 -30
- package/node/joy/icons.js +0 -439
- package/node/joy/index.js +0 -13
- package/node/joy/joySlots.js +0 -397
|
@@ -47,7 +47,7 @@ export const useGridColumnHeaders = props => {
|
|
|
47
47
|
const isRtl = useRtl();
|
|
48
48
|
const rootProps = useGridRootProps();
|
|
49
49
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
50
|
-
const
|
|
50
|
+
const hasColumnVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
|
|
51
51
|
const columnGroupsModel = useGridSelector(apiRef, gridColumnGroupsUnwrappedModelSelector);
|
|
52
52
|
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
53
53
|
const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
|
|
@@ -87,8 +87,15 @@ export const useGridColumnHeaders = props => {
|
|
|
87
87
|
renderContext: currentContext = renderContext,
|
|
88
88
|
maxLastColumn = visibleColumns.length
|
|
89
89
|
} = params || {};
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
let firstColumnToRender;
|
|
91
|
+
let lastColumnToRender;
|
|
92
|
+
if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
|
|
93
|
+
firstColumnToRender = 0;
|
|
94
|
+
lastColumnToRender = maxLastColumn;
|
|
95
|
+
} else {
|
|
96
|
+
firstColumnToRender = currentContext.firstColumnIndex;
|
|
97
|
+
lastColumnToRender = currentContext.lastColumnIndex;
|
|
98
|
+
}
|
|
92
99
|
const renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
|
|
93
100
|
return {
|
|
94
101
|
renderedColumns,
|
|
@@ -460,6 +460,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
460
460
|
return;
|
|
461
461
|
}
|
|
462
462
|
apiRef.current.autosizeColumns(_extends({}, props.autosizeOptions, {
|
|
463
|
+
disableColumnVirtualization: false,
|
|
463
464
|
columns: [column.field]
|
|
464
465
|
}));
|
|
465
466
|
});
|
|
@@ -486,8 +487,10 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
486
487
|
options.columns = options.columns.filter(c => state.columnVisibilityModel[c] !== false);
|
|
487
488
|
const columns = options.columns.map(c => apiRef.current.state.columns.lookup[c]);
|
|
488
489
|
try {
|
|
489
|
-
|
|
490
|
-
|
|
490
|
+
if (!props.disableVirtualization && options.disableColumnVirtualization) {
|
|
491
|
+
apiRef.current.unstable_setColumnVirtualization(false);
|
|
492
|
+
await columnVirtualizationDisabled();
|
|
493
|
+
}
|
|
491
494
|
const widthByField = extractColumnWidths(apiRef, options, columns);
|
|
492
495
|
const newColumns = columns.map(column => _extends({}, column, {
|
|
493
496
|
width: widthByField[column.field],
|
|
@@ -519,10 +522,12 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
519
522
|
}
|
|
520
523
|
});
|
|
521
524
|
} finally {
|
|
522
|
-
|
|
525
|
+
if (!props.disableVirtualization) {
|
|
526
|
+
apiRef.current.unstable_setColumnVirtualization(true);
|
|
527
|
+
}
|
|
523
528
|
isAutosizingRef.current = false;
|
|
524
529
|
}
|
|
525
|
-
}, [apiRef, columnVirtualizationDisabled]);
|
|
530
|
+
}, [apiRef, columnVirtualizationDisabled, props.disableVirtualization]);
|
|
526
531
|
|
|
527
532
|
/**
|
|
528
533
|
* EFFECTS
|
|
@@ -319,6 +319,7 @@ export function getTotalHeaderHeight(apiRef, props) {
|
|
|
319
319
|
const maxDepth = gridColumnGroupsHeaderMaxDepthSelector(apiRef);
|
|
320
320
|
const isHeaderFilteringEnabled = gridHeaderFilteringEnabledSelector(apiRef);
|
|
321
321
|
const columnHeadersHeight = Math.floor(props.columnHeaderHeight * densityFactor);
|
|
322
|
+
const columnGroupHeadersHeight = Math.floor((props.columnGroupHeaderHeight ?? props.columnHeaderHeight) * densityFactor);
|
|
322
323
|
const filterHeadersHeight = isHeaderFilteringEnabled ? Math.floor((props.headerFilterHeight ?? props.columnHeaderHeight) * densityFactor) : 0;
|
|
323
|
-
return columnHeadersHeight
|
|
324
|
+
return columnHeadersHeight + columnGroupHeadersHeight * maxDepth + filterHeadersHeight;
|
|
324
325
|
}
|
|
@@ -59,7 +59,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
59
59
|
});
|
|
60
60
|
const updateFilteredRows = React.useCallback(() => {
|
|
61
61
|
apiRef.current.setState(state => {
|
|
62
|
-
const filterModel = gridFilterModelSelector(state, apiRef.current.instanceId);
|
|
62
|
+
const filterModel = gridFilterModelSelector(state, undefined, apiRef.current.instanceId);
|
|
63
63
|
const filterState = apiRef.current.getFilterState(filterModel);
|
|
64
64
|
const newState = _extends({}, state, {
|
|
65
65
|
filter: _extends({}, state.filter, filterState)
|
|
@@ -5,6 +5,7 @@ import { useGridApiContext } from "../../utils/useGridApiContext.js";
|
|
|
5
5
|
import { useGridRootProps } from "../../utils/useGridRootProps.js";
|
|
6
6
|
import { gridExpandedRowCountSelector } from "../filter/index.js";
|
|
7
7
|
import { gridRowCountSelector, gridRowsLoadingSelector } from "../rows/index.js";
|
|
8
|
+
import { gridPinnedRowsCountSelector } from "../rows/gridRowsSelector.js";
|
|
8
9
|
import { GridOverlayWrapper } from "../../../components/base/GridOverlays.js";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
/**
|
|
@@ -16,7 +17,8 @@ export const useGridOverlays = () => {
|
|
|
16
17
|
const rootProps = useGridRootProps();
|
|
17
18
|
const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
18
19
|
const visibleRowCount = useGridSelector(apiRef, gridExpandedRowCountSelector);
|
|
19
|
-
const
|
|
20
|
+
const pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector);
|
|
21
|
+
const noRows = totalRowCount === 0 && pinnedRowsCount === 0;
|
|
20
22
|
const loading = useGridSelector(apiRef, gridRowsLoadingSelector);
|
|
21
23
|
const showNoRowsOverlay = !loading && noRows;
|
|
22
24
|
const showNoResultsOverlay = !loading && totalRowCount > 0 && visibleRowCount === 0;
|
|
@@ -313,11 +313,12 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
313
313
|
|
|
314
314
|
const isMultipleSelectionDisabled = !checkboxSelection && !hasCtrlKey && !isKeyboardEvent(event);
|
|
315
315
|
const resetSelection = !canHaveMultipleSelection || isMultipleSelectionDisabled;
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
318
|
-
apiRef.current.selectRow(id,
|
|
316
|
+
const selectedRowsCount = apiRef.current.getSelectedRows().size;
|
|
317
|
+
if (canHaveMultipleSelection && selectedRowsCount > 1 && !hasCtrlKey) {
|
|
318
|
+
apiRef.current.selectRow(id, true, resetSelection);
|
|
319
319
|
} else {
|
|
320
|
-
apiRef.current.
|
|
320
|
+
const isSelected = apiRef.current.isRowSelected(id);
|
|
321
|
+
apiRef.current.selectRow(id, !isSelected, resetSelection);
|
|
321
322
|
}
|
|
322
323
|
}, [apiRef, canHaveMultipleSelection, checkboxSelection]);
|
|
323
324
|
const handleRowClick = React.useCallback((params, event) => {
|
|
@@ -6,6 +6,7 @@ import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSele
|
|
|
6
6
|
import { useGridVisibleRows } from "../../utils/useGridVisibleRows.js";
|
|
7
7
|
import { gridRenderContextSelector } from "../virtualization/gridVirtualizationSelectors.js";
|
|
8
8
|
import { useGridSelector } from "../../utils/useGridSelector.js";
|
|
9
|
+
import { gridRowTreeSelector } from "./gridRowsSelector.js";
|
|
9
10
|
import { getUnprocessedRange, isRowRangeUpdated, isRowContextInitialized, getCellValue } from "./gridRowSpanningUtils.js";
|
|
10
11
|
import { GRID_CHECKBOX_SELECTION_FIELD } from "../../../colDef/gridCheckboxSelectionColDef.js";
|
|
11
12
|
const EMPTY_STATE = {
|
|
@@ -35,7 +36,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
35
36
|
if (skippedFields.has(colDef.field)) {
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
|
-
for (let index = rangeToProcess.firstRowIndex; index
|
|
39
|
+
for (let index = rangeToProcess.firstRowIndex; index < rangeToProcess.lastRowIndex; index += 1) {
|
|
39
40
|
const row = visibleRows[index];
|
|
40
41
|
if (hiddenCells[row.id]?.[colDef.field]) {
|
|
41
42
|
continue;
|
|
@@ -129,7 +130,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
129
130
|
* @requires filterStateInitializer (method) - should be initialized before
|
|
130
131
|
*/
|
|
131
132
|
export const rowSpanningStateInitializer = (state, props, apiRef) => {
|
|
132
|
-
if (props.
|
|
133
|
+
if (props.rowSpanning) {
|
|
133
134
|
const rowIds = state.rows.dataRowIds || [];
|
|
134
135
|
const orderedFields = state.columns.orderedFields || [];
|
|
135
136
|
const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
|
|
@@ -142,7 +143,7 @@ export const rowSpanningStateInitializer = (state, props, apiRef) => {
|
|
|
142
143
|
}
|
|
143
144
|
const rangeToProcess = {
|
|
144
145
|
firstRowIndex: 0,
|
|
145
|
-
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS
|
|
146
|
+
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
|
|
146
147
|
};
|
|
147
148
|
const rows = rowIds.map(id => ({
|
|
148
149
|
id,
|
|
@@ -173,10 +174,11 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
173
174
|
} = useGridVisibleRows(apiRef, props);
|
|
174
175
|
const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
|
|
175
176
|
const colDefs = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
177
|
+
const tree = useGridSelector(apiRef, gridRowTreeSelector);
|
|
176
178
|
const processedRange = useLazyRef(() => {
|
|
177
179
|
return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
|
|
178
180
|
firstRowIndex: 0,
|
|
179
|
-
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS
|
|
181
|
+
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
|
|
180
182
|
} : EMPTY_RANGE;
|
|
181
183
|
});
|
|
182
184
|
const lastRange = React.useRef(EMPTY_RANGE);
|
|
@@ -188,7 +190,7 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
188
190
|
// - The `paginationModel` is updated
|
|
189
191
|
// - The rows are updated
|
|
190
192
|
(resetState = true) => {
|
|
191
|
-
if (!props.
|
|
193
|
+
if (!props.rowSpanning) {
|
|
192
194
|
if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
|
|
193
195
|
apiRef.current.setState(state => _extends({}, state, {
|
|
194
196
|
rowSpanning: EMPTY_STATE
|
|
@@ -204,7 +206,7 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
204
206
|
}
|
|
205
207
|
const rangeToProcess = getUnprocessedRange({
|
|
206
208
|
firstRowIndex: renderContext.firstRowIndex,
|
|
207
|
-
lastRowIndex: Math.min(renderContext.lastRowIndex
|
|
209
|
+
lastRowIndex: Math.min(renderContext.lastRowIndex, range.lastRowIndex + 1)
|
|
208
210
|
}, processedRange.current);
|
|
209
211
|
if (rangeToProcess === null) {
|
|
210
212
|
return;
|
|
@@ -233,15 +235,21 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
233
235
|
}
|
|
234
236
|
});
|
|
235
237
|
});
|
|
236
|
-
}, [apiRef, props.
|
|
238
|
+
}, [apiRef, props.rowSpanning, range, renderContext, visibleRows, colDefs, processedRange]);
|
|
237
239
|
const prevRenderContext = React.useRef(renderContext);
|
|
238
240
|
const isFirstRender = React.useRef(true);
|
|
239
241
|
const shouldResetState = React.useRef(false);
|
|
242
|
+
const previousTree = React.useRef(tree);
|
|
240
243
|
React.useEffect(() => {
|
|
241
244
|
const firstRender = isFirstRender.current;
|
|
242
245
|
if (isFirstRender.current) {
|
|
243
246
|
isFirstRender.current = false;
|
|
244
247
|
}
|
|
248
|
+
if (tree !== previousTree.current) {
|
|
249
|
+
previousTree.current = tree;
|
|
250
|
+
updateRowSpanningState(true);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
245
253
|
if (range && lastRange.current && isRowRangeUpdated(range, lastRange.current)) {
|
|
246
254
|
lastRange.current = range;
|
|
247
255
|
shouldResetState.current = true;
|
|
@@ -255,5 +263,5 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
255
263
|
return;
|
|
256
264
|
}
|
|
257
265
|
updateRowSpanningState();
|
|
258
|
-
}, [updateRowSpanningState, renderContext, range, lastRange]);
|
|
266
|
+
}, [updateRowSpanningState, renderContext, range, lastRange, tree]);
|
|
259
267
|
};
|
|
@@ -239,7 +239,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
239
239
|
throw new Error(`MUI X: The row reordering do not support reordering of footer or grouping rows.`);
|
|
240
240
|
}
|
|
241
241
|
apiRef.current.setState(state => {
|
|
242
|
-
const group = gridRowTreeSelector(state, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
|
|
242
|
+
const group = gridRowTreeSelector(state, undefined, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
|
|
243
243
|
const allRows = group.children;
|
|
244
244
|
const oldIndex = allRows.findIndex(row => row === rowId);
|
|
245
245
|
if (oldIndex === -1 || oldIndex === targetIndex) {
|
|
@@ -392,10 +392,10 @@ export const useGridRows = (apiRef, props) => {
|
|
|
392
392
|
const applyHydrateRowsProcessor = React.useCallback(() => {
|
|
393
393
|
apiRef.current.setState(state => {
|
|
394
394
|
const response = apiRef.current.unstable_applyPipeProcessors('hydrateRows', {
|
|
395
|
-
tree: gridRowTreeSelector(state, apiRef.current.instanceId),
|
|
396
|
-
treeDepths: gridRowTreeDepthsSelector(state, apiRef.current.instanceId),
|
|
397
|
-
dataRowIds: gridDataRowIdsSelector(state, apiRef.current.instanceId),
|
|
398
|
-
dataRowIdToModelLookup: gridRowsLookupSelector(state, apiRef.current.instanceId)
|
|
395
|
+
tree: gridRowTreeSelector(state, undefined, apiRef.current.instanceId),
|
|
396
|
+
treeDepths: gridRowTreeDepthsSelector(state, undefined, apiRef.current.instanceId),
|
|
397
|
+
dataRowIds: gridDataRowIdsSelector(state, undefined, apiRef.current.instanceId),
|
|
398
|
+
dataRowIdToModelLookup: gridRowsLookupSelector(state, undefined, apiRef.current.instanceId)
|
|
399
399
|
});
|
|
400
400
|
return _extends({}, state, {
|
|
401
401
|
rows: _extends({}, state.rows, response, {
|
|
@@ -55,4 +55,15 @@ export const gridSortColumnLookupSelector = createSelectorMemoized(gridSortModel
|
|
|
55
55
|
return res;
|
|
56
56
|
}, {});
|
|
57
57
|
return result;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @category Sorting
|
|
62
|
+
* @ignore - do not document.
|
|
63
|
+
*/
|
|
64
|
+
export const gridSortedRowIndexLookupSelector = createSelectorMemoized(gridSortedRowIdsSelector, sortedIds => {
|
|
65
|
+
return sortedIds.reduce((acc, id, index) => {
|
|
66
|
+
acc[id] = index;
|
|
67
|
+
return acc;
|
|
68
|
+
}, Object.create(null));
|
|
58
69
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { gridSortedRowIdsSelector, gridSortedRowEntriesSelector, gridSortModelSelector, gridSortColumnLookupSelector } from "./gridSortingSelector.js";
|
|
2
2
|
export { gridDateComparator, gridNumberComparator, gridStringOrNumberComparator } from "./gridSortingUtils.js";
|
|
@@ -88,7 +88,7 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
88
88
|
})
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
const sortModel = gridSortModelSelector(state, apiRef.current.instanceId);
|
|
91
|
+
const sortModel = gridSortModelSelector(state, undefined, apiRef.current.instanceId);
|
|
92
92
|
const sortRowList = buildAggregatedSortingApplier(sortModel, apiRef);
|
|
93
93
|
const sortedRows = apiRef.current.applyStrategyProcessor('sorting', {
|
|
94
94
|
sortRowList
|
|
@@ -92,10 +92,7 @@ export const useGridVirtualScroller = () => {
|
|
|
92
92
|
return undefined;
|
|
93
93
|
}
|
|
94
94
|
const initialRect = node.getBoundingClientRect();
|
|
95
|
-
let lastSize =
|
|
96
|
-
width: initialRect.width,
|
|
97
|
-
height: initialRect.height
|
|
98
|
-
};
|
|
95
|
+
let lastSize = roundDimensions(initialRect);
|
|
99
96
|
apiRef.current.publishEvent('resize', lastSize);
|
|
100
97
|
if (typeof ResizeObserver === 'undefined') {
|
|
101
98
|
return undefined;
|
|
@@ -105,10 +102,7 @@ export const useGridVirtualScroller = () => {
|
|
|
105
102
|
if (!entry) {
|
|
106
103
|
return;
|
|
107
104
|
}
|
|
108
|
-
const newSize =
|
|
109
|
-
width: entry.contentRect.width,
|
|
110
|
-
height: entry.contentRect.height
|
|
111
|
-
};
|
|
105
|
+
const newSize = roundDimensions(entry.contentRect);
|
|
112
106
|
if (newSize.width === lastSize.width && newSize.height === lastSize.height) {
|
|
113
107
|
return;
|
|
114
108
|
}
|
|
@@ -784,4 +778,13 @@ function bufferForDirection(isRtl, direction, rowBufferPx, columnBufferPx, verti
|
|
|
784
778
|
// eslint unable to figure out enum exhaustiveness
|
|
785
779
|
throw new Error('unreachable');
|
|
786
780
|
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
// Round to avoid issues with subpixel rendering
|
|
784
|
+
// https://github.com/mui/mui-x/issues/15721
|
|
785
|
+
function roundDimensions(dimensions) {
|
|
786
|
+
return {
|
|
787
|
+
width: Math.round(dimensions.width * 10) / 10,
|
|
788
|
+
height: Math.round(dimensions.height * 10) / 10
|
|
789
|
+
};
|
|
787
790
|
}
|
|
@@ -6,20 +6,11 @@ import { useOnMount } from "./useOnMount.js";
|
|
|
6
6
|
function isOutputSelector(selector) {
|
|
7
7
|
return selector.acceptsApiRef;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
function applySelector(apiRef, selector) {
|
|
11
|
-
if (isOutputSelector(selector)) {
|
|
12
|
-
return selector(apiRef);
|
|
13
|
-
}
|
|
14
|
-
return selector(apiRef.current.state);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// TODO v8: Rename this function to `applySelector`
|
|
18
|
-
function applySelectorV8(apiRef, selector, args, instanceId) {
|
|
9
|
+
function applySelector(apiRef, selector, args, instanceId) {
|
|
19
10
|
if (isOutputSelector(selector)) {
|
|
20
11
|
return selector(apiRef, args);
|
|
21
12
|
}
|
|
22
|
-
return selector(apiRef.current.state, instanceId);
|
|
13
|
+
return selector(apiRef.current.state, args, instanceId);
|
|
23
14
|
}
|
|
24
15
|
const defaultCompare = Object.is;
|
|
25
16
|
export const objectShallowCompare = fastObjectShallowCompare;
|
|
@@ -44,36 +35,7 @@ const createRefs = () => ({
|
|
|
44
35
|
selector: null,
|
|
45
36
|
args: null
|
|
46
37
|
});
|
|
47
|
-
|
|
48
|
-
// TODO v8: Remove this function
|
|
49
|
-
export const useGridSelector = (apiRef, selector, equals = defaultCompare) => {
|
|
50
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
51
|
-
if (!apiRef.current.state) {
|
|
52
|
-
warnOnce(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const refs = useLazyRef(createRefs);
|
|
56
|
-
const didInit = refs.current.selector !== null;
|
|
57
|
-
const [state, setState] = React.useState(
|
|
58
|
-
// We don't use an initialization function to avoid allocations
|
|
59
|
-
didInit ? null : applySelector(apiRef, selector));
|
|
60
|
-
refs.current.state = state;
|
|
61
|
-
refs.current.equals = equals;
|
|
62
|
-
refs.current.selector = selector;
|
|
63
|
-
useOnMount(() => {
|
|
64
|
-
return apiRef.current.store.subscribe(() => {
|
|
65
|
-
const newState = applySelector(apiRef, refs.current.selector);
|
|
66
|
-
if (!refs.current.equals(refs.current.state, newState)) {
|
|
67
|
-
refs.current.state = newState;
|
|
68
|
-
setState(newState);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
return state;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// TODO v8: Rename this function to `useGridSelector`
|
|
76
|
-
export const useGridSelectorV8 = (apiRef, selector, args = undefined, equals = defaultCompare) => {
|
|
38
|
+
export const useGridSelector = (apiRef, selector, args = undefined, equals = defaultCompare) => {
|
|
77
39
|
if (process.env.NODE_ENV !== 'production') {
|
|
78
40
|
if (!apiRef.current.state) {
|
|
79
41
|
warnOnce(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
|
|
@@ -83,14 +45,14 @@ export const useGridSelectorV8 = (apiRef, selector, args = undefined, equals = d
|
|
|
83
45
|
const didInit = refs.current.selector !== null;
|
|
84
46
|
const [state, setState] = React.useState(
|
|
85
47
|
// We don't use an initialization function to avoid allocations
|
|
86
|
-
didInit ? null :
|
|
48
|
+
didInit ? null : applySelector(apiRef, selector, args, apiRef.current.instanceId));
|
|
87
49
|
refs.current.state = state;
|
|
88
50
|
refs.current.equals = equals;
|
|
89
51
|
refs.current.selector = selector;
|
|
90
52
|
const prevArgs = refs.current.args;
|
|
91
53
|
refs.current.args = args;
|
|
92
54
|
if (didInit && !argsEqual(prevArgs, args)) {
|
|
93
|
-
const newState =
|
|
55
|
+
const newState = applySelector(apiRef, refs.current.selector, refs.current.args, apiRef.current.instanceId);
|
|
94
56
|
if (!refs.current.equals(refs.current.state, newState)) {
|
|
95
57
|
refs.current.state = newState;
|
|
96
58
|
setState(newState);
|
|
@@ -98,7 +60,7 @@ export const useGridSelectorV8 = (apiRef, selector, args = undefined, equals = d
|
|
|
98
60
|
}
|
|
99
61
|
useOnMount(() => {
|
|
100
62
|
return apiRef.current.store.subscribe(() => {
|
|
101
|
-
const newState =
|
|
63
|
+
const newState = applySelector(apiRef, refs.current.selector, refs.current.args, apiRef.current.instanceId);
|
|
102
64
|
if (!refs.current.equals(refs.current.state, newState)) {
|
|
103
65
|
refs.current.state = newState;
|
|
104
66
|
setState(newState);
|
package/modern/index.js
CHANGED
|
@@ -47,6 +47,7 @@ export { calculatePinnedRowsHeight } from "../hooks/features/rows/gridRowsUtils.
|
|
|
47
47
|
export { useGridRowSelection, rowSelectionStateInitializer } from "../hooks/features/rowSelection/useGridRowSelection.js";
|
|
48
48
|
export { useGridRowSelectionPreProcessors } from "../hooks/features/rowSelection/useGridRowSelectionPreProcessors.js";
|
|
49
49
|
export { useGridSorting, sortingStateInitializer } from "../hooks/features/sorting/useGridSorting.js";
|
|
50
|
+
export { gridSortedRowIndexLookupSelector } from "../hooks/features/sorting/gridSortingSelector.js";
|
|
50
51
|
export { useGridScroll } from "../hooks/features/scroll/useGridScroll.js";
|
|
51
52
|
export { useGridEvents } from "../hooks/features/events/useGridEvents.js";
|
|
52
53
|
export { dimensionsStateInitializer, useGridDimensions } from "../hooks/features/dimensions/useGridDimensions.js";
|
|
@@ -61,8 +62,7 @@ export { useGridVisibleRows, getVisibleRows } from "../hooks/utils/useGridVisibl
|
|
|
61
62
|
export { useGridInitializeState } from "../hooks/utils/useGridInitializeState.js";
|
|
62
63
|
export { getColumnsToExport, defaultGetRowsToExport } from "../hooks/features/export/utils.js";
|
|
63
64
|
export * from "../utils/createControllablePromise.js";
|
|
64
|
-
export { createSelector,
|
|
65
|
-
export { useGridSelectorV8 } from "../hooks/utils/useGridSelector.js";
|
|
65
|
+
export { createSelector, createSelectorMemoized } from "../utils/createSelector.js";
|
|
66
66
|
export { gridRowGroupsToFetchSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
67
67
|
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal } from "../utils/domUtils.js";
|
|
68
68
|
export { isNavigationKey, isPasteShortcut, isCopyShortcut } from "../utils/keyboardUtils.js";
|
package/modern/locales/koKR.js
CHANGED
|
@@ -24,16 +24,15 @@ const koKRGrid = {
|
|
|
24
24
|
toolbarQuickFilterLabel: '검색',
|
|
25
25
|
toolbarQuickFilterDeleteIconLabel: '초기화',
|
|
26
26
|
// Prompt toolbar field
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
toolbarPromptControlPlaceholder: '프롬프트 입력…',
|
|
28
|
+
toolbarPromptControlWithRecordingPlaceholder: '프롬프트 입력 또는 녹음…',
|
|
29
|
+
toolbarPromptControlRecordingPlaceholder: '녹음 중…',
|
|
30
|
+
toolbarPromptControlLabel: '프롬프트 입력',
|
|
31
|
+
toolbarPromptControlRecordButtonDefaultLabel: '녹음',
|
|
32
|
+
toolbarPromptControlRecordButtonActiveLabel: '녹음 정지',
|
|
33
|
+
toolbarPromptControlSendActionLabel: '전송',
|
|
34
|
+
toolbarPromptControlSendActionAriaLabel: '프롬프트 전송',
|
|
35
|
+
toolbarPromptControlErrorMessage: '요청을 처리하는 동안 오류가 발생했습니다. 다른 프롬프트로 다시 시도하십시오.',
|
|
37
36
|
// Export selector toolbar button text
|
|
38
37
|
toolbarExport: '내보내기',
|
|
39
38
|
toolbarExportLabel: '내보내기',
|
|
@@ -41,15 +40,14 @@ const koKRGrid = {
|
|
|
41
40
|
toolbarExportPrint: '프린트',
|
|
42
41
|
toolbarExportExcel: 'Excel로 내보내기',
|
|
43
42
|
// Columns management text
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
columnsManagementSearchTitle: '검색',
|
|
44
|
+
columnsManagementNoColumns: '열이 없습니다.',
|
|
45
|
+
columnsManagementShowHideAllText: '모두 보기/숨기기',
|
|
46
|
+
columnsManagementReset: '초기화',
|
|
47
|
+
columnsManagementDeleteIconLabel: '제거',
|
|
50
48
|
// Filter panel text
|
|
51
49
|
filterPanelAddFilter: '필터 추가',
|
|
52
|
-
|
|
50
|
+
filterPanelRemoveAll: '모두 삭제',
|
|
53
51
|
filterPanelDeleteIconLabel: '삭제',
|
|
54
52
|
filterPanelLogicOperator: '논리 연산자',
|
|
55
53
|
filterPanelOperator: '연산자',
|
|
@@ -60,9 +58,9 @@ const koKRGrid = {
|
|
|
60
58
|
filterPanelInputPlaceholder: '값 입력',
|
|
61
59
|
// Filter operators text
|
|
62
60
|
filterOperatorContains: '포함하는',
|
|
63
|
-
|
|
61
|
+
filterOperatorDoesNotContain: '포함하지 않는',
|
|
64
62
|
filterOperatorEquals: '값이 같은',
|
|
65
|
-
|
|
63
|
+
filterOperatorDoesNotEqual: '값이 다른',
|
|
66
64
|
filterOperatorStartsWith: '시작하는',
|
|
67
65
|
filterOperatorEndsWith: '끝나는',
|
|
68
66
|
filterOperatorIs: '~인',
|
|
@@ -74,36 +72,34 @@ const koKRGrid = {
|
|
|
74
72
|
filterOperatorIsEmpty: '값이 없는',
|
|
75
73
|
filterOperatorIsNotEmpty: '값이 있는',
|
|
76
74
|
filterOperatorIsAnyOf: '값 중 하나인',
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
'filterOperator=': '=',
|
|
76
|
+
'filterOperator!=': '!=',
|
|
77
|
+
'filterOperator>': '>',
|
|
78
|
+
'filterOperator>=': '>=',
|
|
79
|
+
'filterOperator<': '<',
|
|
80
|
+
'filterOperator<=': '<=',
|
|
84
81
|
// Header filter operators text
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
82
|
+
headerFilterOperatorContains: '포함하는',
|
|
83
|
+
headerFilterOperatorDoesNotContain: '포함하지 않는',
|
|
84
|
+
headerFilterOperatorEquals: '값이 같은',
|
|
85
|
+
headerFilterOperatorDoesNotEqual: '값이 다른',
|
|
86
|
+
headerFilterOperatorStartsWith: '시작하는',
|
|
87
|
+
headerFilterOperatorEndsWith: '끝나는',
|
|
88
|
+
headerFilterOperatorIs: '~인',
|
|
89
|
+
headerFilterOperatorNot: '~아닌',
|
|
90
|
+
headerFilterOperatorAfter: '더 이후',
|
|
91
|
+
headerFilterOperatorOnOrAfter: '이후',
|
|
92
|
+
headerFilterOperatorBefore: '더 이전',
|
|
93
|
+
headerFilterOperatorOnOrBefore: '이전',
|
|
94
|
+
headerFilterOperatorIsEmpty: '값이 없는',
|
|
95
|
+
headerFilterOperatorIsNotEmpty: '값이 있는',
|
|
96
|
+
headerFilterOperatorIsAnyOf: '값 중 하나인',
|
|
97
|
+
'headerFilterOperator=': '값이 같은',
|
|
98
|
+
'headerFilterOperator!=': '값이 다른',
|
|
99
|
+
'headerFilterOperator>': '더 큰',
|
|
100
|
+
'headerFilterOperator>=': '같거나 더 큰',
|
|
101
|
+
'headerFilterOperator<': '더 작은',
|
|
102
|
+
'headerFilterOperator<=': '같거나 더 작은',
|
|
107
103
|
// Filter values text
|
|
108
104
|
filterValueAny: '아무값',
|
|
109
105
|
filterValueTrue: '참',
|
|
@@ -111,7 +107,7 @@ const koKRGrid = {
|
|
|
111
107
|
// Column menu text
|
|
112
108
|
columnMenuLabel: '메뉴',
|
|
113
109
|
columnMenuShowColumns: '열 표시',
|
|
114
|
-
|
|
110
|
+
columnMenuManageColumns: '열 관리',
|
|
115
111
|
columnMenuFilter: '필터',
|
|
116
112
|
columnMenuHideColumn: '열 숨기기',
|
|
117
113
|
columnMenuUnsort: '정렬 해제',
|