@mui/x-data-grid 8.7.0 → 8.9.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 +229 -24
- package/DataGrid/index.d.ts +0 -1
- package/DataGrid/useDataGridComponent.js +8 -0
- package/components/GridScrollArea.d.ts +1 -1
- package/components/GridScrollArea.js +134 -28
- package/components/containers/GridRootStyles.js +41 -0
- package/components/virtualization/GridVirtualScroller.js +4 -0
- package/constants/gridClasses.d.ts +20 -0
- package/constants/gridClasses.js +3 -1
- package/esm/DataGrid/index.d.ts +0 -1
- package/esm/DataGrid/useDataGridComponent.js +8 -0
- package/esm/components/GridScrollArea.d.ts +1 -1
- package/esm/components/GridScrollArea.js +134 -28
- package/esm/components/containers/GridRootStyles.js +41 -0
- package/esm/components/virtualization/GridVirtualScroller.js +4 -0
- package/esm/constants/gridClasses.d.ts +20 -0
- package/esm/constants/gridClasses.js +3 -1
- package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -0
- package/esm/hooks/core/pipeProcessing/useGridPipeProcessing.js +20 -5
- package/esm/hooks/core/useGridProps.d.ts +2 -2
- package/esm/hooks/core/useGridProps.js +3 -1
- package/esm/hooks/features/columnGrouping/gridColumnGroupsInterfaces.d.ts +4 -1
- package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.js +35 -32
- package/esm/hooks/features/columnGrouping/useGridColumnGrouping.js +18 -13
- package/esm/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -3
- package/esm/hooks/features/columns/gridColumnsSelector.js +6 -2
- package/esm/hooks/features/columns/gridColumnsUtils.js +6 -4
- package/esm/hooks/features/columns/useGridColumns.js +8 -10
- package/esm/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/esm/hooks/features/dataSource/useGridDataSourceBase.js +3 -0
- package/esm/hooks/features/dataSource/utils.js +3 -0
- package/esm/hooks/features/export/utils.js +1 -1
- package/esm/hooks/features/filter/useGridFilter.js +3 -3
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +5 -9
- package/esm/hooks/features/listView/gridListViewSelectors.d.ts +8 -1
- package/esm/hooks/features/listView/gridListViewSelectors.js +7 -0
- package/esm/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/esm/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/esm/hooks/features/rows/gridRowsUtils.js +5 -2
- package/esm/hooks/features/rows/useGridRows.js +4 -3
- package/esm/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/esm/hooks/features/scroll/useGridScroll.js +2 -3
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +3 -6
- package/esm/hooks/utils/index.d.ts +1 -0
- package/esm/hooks/utils/index.js +2 -1
- package/esm/hooks/utils/useGridInitializeState.d.ts +1 -1
- package/esm/hooks/utils/useGridInitializeState.js +6 -1
- package/esm/hooks/utils/useGridSelector.js +4 -0
- package/esm/hooks/utils/useRunOncePerLoop.d.ts +1 -0
- package/esm/hooks/utils/useRunOncePerLoop.js +26 -0
- package/esm/index.js +1 -1
- package/esm/internals/utils/cache.d.ts +9 -0
- package/esm/internals/utils/cache.js +19 -0
- package/esm/internals/utils/index.d.ts +2 -1
- package/esm/internals/utils/index.js +2 -1
- package/esm/locales/idID.d.ts +4 -0
- package/esm/locales/idID.js +261 -0
- package/esm/locales/index.d.ts +2 -1
- package/esm/locales/index.js +2 -1
- package/esm/models/api/gridRowApi.d.ts +5 -0
- package/esm/models/events/gridEventLookup.d.ts +2 -1
- package/esm/models/gridApiCaches.d.ts +8 -2
- package/esm/models/gridStateCommunity.d.ts +2 -2
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +20 -5
- package/hooks/core/useGridProps.d.ts +2 -2
- package/hooks/core/useGridProps.js +3 -1
- package/hooks/features/columnGrouping/gridColumnGroupsInterfaces.d.ts +4 -1
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +35 -32
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +18 -13
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -3
- package/hooks/features/columns/gridColumnsSelector.js +6 -2
- package/hooks/features/columns/gridColumnsUtils.js +6 -4
- package/hooks/features/columns/useGridColumns.js +8 -10
- package/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/hooks/features/dataSource/useGridDataSourceBase.js +3 -0
- package/hooks/features/dataSource/utils.js +3 -0
- package/hooks/features/export/utils.js +1 -1
- package/hooks/features/filter/useGridFilter.js +3 -3
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +5 -9
- package/hooks/features/listView/gridListViewSelectors.d.ts +8 -1
- package/hooks/features/listView/gridListViewSelectors.js +8 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.js +5 -2
- package/hooks/features/rows/useGridRows.js +4 -3
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.js +2 -3
- package/hooks/features/virtualization/useGridVirtualScroller.js +3 -6
- package/hooks/utils/index.d.ts +1 -0
- package/hooks/utils/index.js +12 -0
- package/hooks/utils/useGridInitializeState.d.ts +1 -1
- package/hooks/utils/useGridInitializeState.js +6 -1
- package/hooks/utils/useGridSelector.js +4 -0
- package/hooks/utils/useRunOncePerLoop.d.ts +1 -0
- package/hooks/utils/useRunOncePerLoop.js +33 -0
- package/index.js +1 -1
- package/internals/utils/cache.d.ts +9 -0
- package/internals/utils/cache.js +26 -0
- package/internals/utils/index.d.ts +2 -1
- package/internals/utils/index.js +11 -0
- package/locales/idID.d.ts +4 -0
- package/locales/idID.js +267 -0
- package/locales/index.d.ts +2 -1
- package/locales/index.js +11 -0
- package/models/api/gridRowApi.d.ts +5 -0
- package/models/events/gridEventLookup.d.ts +2 -1
- package/models/gridApiCaches.d.ts +8 -2
- package/models/gridStateCommunity.d.ts +2 -2
- package/package.json +3 -3
|
@@ -7,6 +7,7 @@ exports.gridVisiblePinnedColumnDefinitionsSelector = exports.gridVisibleColumnFi
|
|
|
7
7
|
var _createSelector = require("../../../utils/createSelector");
|
|
8
8
|
var _gridColumnsInterfaces = require("./gridColumnsInterfaces");
|
|
9
9
|
var _gridCoreSelector = require("../../core/gridCoreSelector");
|
|
10
|
+
var _listView = require("../listView");
|
|
10
11
|
/**
|
|
11
12
|
* Get the columns state
|
|
12
13
|
* @category Columns
|
|
@@ -50,7 +51,7 @@ const gridInitialColumnVisibilityModelSelector = exports.gridInitialColumnVisibi
|
|
|
50
51
|
* Get the visible columns as a lookup (an object containing the field for keys and the definition for values).
|
|
51
52
|
* @category Visible Columns
|
|
52
53
|
*/
|
|
53
|
-
const gridVisibleColumnDefinitionsSelector = exports.gridVisibleColumnDefinitionsSelector = (0, _createSelector.createSelectorMemoized)(gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector, (columns, columnVisibilityModel) => columns.filter(column => columnVisibilityModel[column.field] !== false));
|
|
54
|
+
const gridVisibleColumnDefinitionsSelector = exports.gridVisibleColumnDefinitionsSelector = (0, _createSelector.createSelectorMemoized)(gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector, _listView.gridListViewSelector, _listView.gridListColumnSelector, (columns, columnVisibilityModel, listView, listColumn) => listView && listColumn ? [listColumn] : columns.filter(column => columnVisibilityModel[column.field] !== false));
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
* Get the field of each visible column.
|
|
@@ -75,7 +76,10 @@ const gridExistingPinnedColumnSelector = exports.gridExistingPinnedColumnSelecto
|
|
|
75
76
|
* Get the visible pinned columns.
|
|
76
77
|
* @category Visible Columns
|
|
77
78
|
*/
|
|
78
|
-
const gridVisiblePinnedColumnDefinitionsSelector = exports.gridVisiblePinnedColumnDefinitionsSelector = (0, _createSelector.createSelectorMemoized)(gridColumnsStateSelector, gridPinnedColumnsSelector, gridVisibleColumnFieldsSelector, _gridCoreSelector.gridIsRtlSelector, (columnsState, model, visibleColumnFields, isRtl) => {
|
|
79
|
+
const gridVisiblePinnedColumnDefinitionsSelector = exports.gridVisiblePinnedColumnDefinitionsSelector = (0, _createSelector.createSelectorMemoized)(gridColumnsStateSelector, gridPinnedColumnsSelector, gridVisibleColumnFieldsSelector, _gridCoreSelector.gridIsRtlSelector, _listView.gridListViewSelector, (columnsState, model, visibleColumnFields, isRtl, listView) => {
|
|
80
|
+
if (listView) {
|
|
81
|
+
return _gridColumnsInterfaces.EMPTY_PINNED_COLUMN_FIELDS;
|
|
82
|
+
}
|
|
79
83
|
const visiblePinnedFields = filterMissingColumns(model, visibleColumnFields, isRtl);
|
|
80
84
|
const visiblePinnedColumns = {
|
|
81
85
|
left: visiblePinnedFields.left.map(field => columnsState.lookup[field]),
|
|
@@ -257,11 +257,13 @@ const createColumnsState = ({
|
|
|
257
257
|
initialColumnVisibilityModel: updateInitialVisibilityModel ? columnVisibilityModel : currentState.initialColumnVisibilityModel
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
|
-
|
|
260
|
+
const columnsToKeep = {};
|
|
261
261
|
if (keepOnlyColumnsToUpsert && !isInsideStateInitializer) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
for (const key in columnsState.lookup) {
|
|
263
|
+
if (Object.prototype.hasOwnProperty.call(columnsState.lookup, key)) {
|
|
264
|
+
columnsToKeep[key] = false;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
265
267
|
}
|
|
266
268
|
const columnsToUpsertLookup = {};
|
|
267
269
|
columnsToUpsert.forEach(newColumn => {
|
|
@@ -22,6 +22,9 @@ var _preferencesPanel = require("../preferencesPanel");
|
|
|
22
22
|
var _pivoting = require("../pivoting");
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
24
|
const columnsStateInitializer = (state, props, apiRef) => {
|
|
25
|
+
apiRef.current.caches.columns = {
|
|
26
|
+
lastColumnsProp: props.columns
|
|
27
|
+
};
|
|
25
28
|
const columnsState = (0, _gridColumnsUtils.createColumnsState)({
|
|
26
29
|
apiRef,
|
|
27
30
|
columnsToUpsert: props.columns,
|
|
@@ -45,7 +48,6 @@ const columnsStateInitializer = (state, props, apiRef) => {
|
|
|
45
48
|
exports.columnsStateInitializer = columnsStateInitializer;
|
|
46
49
|
function useGridColumns(apiRef, props) {
|
|
47
50
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridColumns');
|
|
48
|
-
const previousColumnsProp = React.useRef(props.columns);
|
|
49
51
|
apiRef.current.registerControlState({
|
|
50
52
|
stateId: 'visibleColumns',
|
|
51
53
|
propModel: props.columnVisibilityModel,
|
|
@@ -308,27 +310,23 @@ function useGridColumns(apiRef, props) {
|
|
|
308
310
|
*/
|
|
309
311
|
// The effect do not track any value defined synchronously during the 1st render by hooks called after `useGridColumns`
|
|
310
312
|
// As a consequence, the state generated by the 1st run of this useEffect will always be equal to the initialization one
|
|
311
|
-
const isFirstRender = React.useRef(true);
|
|
312
313
|
React.useEffect(() => {
|
|
313
|
-
if (
|
|
314
|
-
isFirstRender.current = false;
|
|
314
|
+
if (apiRef.current.caches.columns.lastColumnsProp === props.columns) {
|
|
315
315
|
return;
|
|
316
316
|
}
|
|
317
|
+
apiRef.current.caches.columns.lastColumnsProp = props.columns;
|
|
317
318
|
logger.info(`GridColumns have changed, new length ${props.columns.length}`);
|
|
318
|
-
if (previousColumnsProp.current === props.columns) {
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
319
|
const columnsState = (0, _gridColumnsUtils.createColumnsState)({
|
|
322
320
|
apiRef,
|
|
323
321
|
initialState: undefined,
|
|
324
322
|
// If the user provides a model, we don't want to set it in the state here because it has it's dedicated `useEffect` which calls `setColumnVisibilityModel`
|
|
325
323
|
columnsToUpsert: props.columns,
|
|
326
324
|
keepOnlyColumnsToUpsert: true,
|
|
327
|
-
updateInitialVisibilityModel: true
|
|
325
|
+
updateInitialVisibilityModel: true,
|
|
326
|
+
columnVisibilityModel: props.columnVisibilityModel
|
|
328
327
|
});
|
|
329
|
-
previousColumnsProp.current = props.columns;
|
|
330
328
|
setGridColumnsState(columnsState);
|
|
331
|
-
}, [logger, apiRef, setGridColumnsState, props.columns]);
|
|
329
|
+
}, [logger, apiRef, setGridColumnsState, props.columns, props.columnVisibilityModel]);
|
|
332
330
|
React.useEffect(() => {
|
|
333
331
|
if (props.columnVisibilityModel !== undefined) {
|
|
334
332
|
apiRef.current.setColumnVisibilityModel(props.columnVisibilityModel);
|
|
@@ -6,7 +6,7 @@ import type { GridPrivateApiCommunity } from "../../../models/api/gridApiCommuni
|
|
|
6
6
|
import type { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
7
7
|
import type { GridStrategyProcessor } from "../../core/strategyProcessing/index.js";
|
|
8
8
|
import type { GridEventListener } from "../../../models/events/index.js";
|
|
9
|
-
export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity>(apiRef: RefObject<Api>, props: Pick<DataGridProcessedProps, "dataSource" | "dataSourceCache" | "onDataSourceError" | "pageSizeOptions" | "signature">, options?: GridDataSourceBaseOptions) => {
|
|
9
|
+
export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity>(apiRef: RefObject<Api>, props: Pick<DataGridProcessedProps, "dataSource" | "dataSourceCache" | "onDataSourceError" | "pageSizeOptions" | "pagination" | "signature">, options?: GridDataSourceBaseOptions) => {
|
|
10
10
|
api: {
|
|
11
11
|
public: GridDataSourceApi;
|
|
12
12
|
};
|
|
@@ -42,6 +42,9 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
42
42
|
const lastRequestId = React.useRef(0);
|
|
43
43
|
const onDataSourceErrorProp = props.onDataSourceError;
|
|
44
44
|
const cacheChunkManager = (0, _useLazyRef.default)(() => {
|
|
45
|
+
if (!props.pagination) {
|
|
46
|
+
return new _utils2.CacheChunkManager(paginationModel.pageSize);
|
|
47
|
+
}
|
|
45
48
|
const sortedPageSizeOptions = props.pageSizeOptions.map(option => typeof option === 'number' ? option : option.value).sort((a, b) => a - b);
|
|
46
49
|
const cacheChunkSize = Math.min(paginationModel.pageSize, sortedPageSizeOptions[0]);
|
|
47
50
|
return new _utils2.CacheChunkManager(cacheChunkSize);
|
|
@@ -43,6 +43,9 @@ class CacheChunkManager {
|
|
|
43
43
|
};
|
|
44
44
|
this.splitResponse = (key, response) => {
|
|
45
45
|
const cacheKeys = this.getCacheKeys(key);
|
|
46
|
+
if (cacheKeys.length === 1) {
|
|
47
|
+
return new Map([[key, response]]);
|
|
48
|
+
}
|
|
46
49
|
const responses = new Map();
|
|
47
50
|
cacheKeys.forEach(chunkKey => {
|
|
48
51
|
const isLastChunk = chunkKey.end === key.end;
|
|
@@ -23,7 +23,7 @@ const getColumnsToExport = ({
|
|
|
23
23
|
}, []);
|
|
24
24
|
}
|
|
25
25
|
const validColumns = options.allColumns ? columns : (0, _columns.gridVisibleColumnDefinitionsSelector)(apiRef);
|
|
26
|
-
return validColumns.filter(column =>
|
|
26
|
+
return validColumns.filter(column => column.disableExport !== true);
|
|
27
27
|
};
|
|
28
28
|
exports.getColumnsToExport = getColumnsToExport;
|
|
29
29
|
const defaultGetRowsToExport = ({
|
|
@@ -351,9 +351,9 @@ const useGridFilter = (apiRef, props) => {
|
|
|
351
351
|
(0, _useGridEvent.useGridEvent)(apiRef, 'rowExpansionChange', updateVisibleRowsLookupState);
|
|
352
352
|
(0, _useGridEvent.useGridEvent)(apiRef, 'columnVisibilityModelChange', () => {
|
|
353
353
|
const filterModel = (0, _gridFilterSelector.gridFilterModelSelector)(apiRef);
|
|
354
|
-
if (filterModel.quickFilterValues && (0, _gridFilterUtils.shouldQuickFilterExcludeHiddenColumns)(filterModel)) {
|
|
354
|
+
if (filterModel.quickFilterValues?.length && (0, _gridFilterUtils.shouldQuickFilterExcludeHiddenColumns)(filterModel)) {
|
|
355
355
|
// re-apply filters because the quick filter results may have changed
|
|
356
|
-
|
|
356
|
+
updateFilteredRows();
|
|
357
357
|
}
|
|
358
358
|
});
|
|
359
359
|
|
|
@@ -361,7 +361,7 @@ const useGridFilter = (apiRef, props) => {
|
|
|
361
361
|
* 1ST RENDER
|
|
362
362
|
*/
|
|
363
363
|
(0, _useFirstRender.useFirstRender)(() => {
|
|
364
|
-
|
|
364
|
+
updateFilteredRows();
|
|
365
365
|
});
|
|
366
366
|
|
|
367
367
|
/**
|
|
@@ -10,4 +10,4 @@ import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
|
10
10
|
* @requires useGridScroll (method) - can be after
|
|
11
11
|
* @requires useGridColumnSpanning (method) - can be after
|
|
12
12
|
*/
|
|
13
|
-
export declare const useGridKeyboardNavigation: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode" | "getRowId" | "signature" | "headerFilters"
|
|
13
|
+
export declare const useGridKeyboardNavigation: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode" | "getRowId" | "signature" | "headerFilters">) => void;
|
|
@@ -23,7 +23,6 @@ var _gridHeaderFilteringSelectors = require("../headerFiltering/gridHeaderFilter
|
|
|
23
23
|
var _pipeProcessing = require("../../core/pipeProcessing");
|
|
24
24
|
var _domUtils = require("../../../utils/domUtils");
|
|
25
25
|
var _utils = require("./utils");
|
|
26
|
-
var _gridListViewSelectors = require("../listView/gridListViewSelectors");
|
|
27
26
|
var _createSelector = require("../../../utils/createSelector");
|
|
28
27
|
var _pagination = require("../pagination");
|
|
29
28
|
var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
@@ -43,7 +42,6 @@ const gridVisibleRowsWithPinnedRowsSelector = (0, _createSelector.createSelector
|
|
|
43
42
|
const useGridKeyboardNavigation = (apiRef, props) => {
|
|
44
43
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridKeyboardNavigation');
|
|
45
44
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
46
|
-
const listView = props.listView;
|
|
47
45
|
const getCurrentPageRows = React.useCallback(() => {
|
|
48
46
|
return gridVisibleRowsWithPinnedRowsSelector(apiRef);
|
|
49
47
|
}, [apiRef]);
|
|
@@ -66,7 +64,7 @@ const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
66
64
|
colIndex = nextCellColSpanInfo.rightVisibleCellIndex;
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
|
-
const field =
|
|
67
|
+
const field = (0, _gridColumnsSelector.gridVisibleColumnFieldsSelector)(apiRef)[colIndex];
|
|
70
68
|
const nonRowSpannedRowId = (0, _utils.findNonRowSpannedCell)(apiRef, rowId, field, rowSpanScanDirection);
|
|
71
69
|
// `scrollToIndexes` requires a rowIndex relative to all visible rows.
|
|
72
70
|
// Those rows do not include pinned rows, but pinned rows do not need scroll anyway.
|
|
@@ -77,7 +75,7 @@ const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
77
75
|
rowIndex: rowIndexRelativeToAllRows
|
|
78
76
|
});
|
|
79
77
|
apiRef.current.setCellFocus(nonRowSpannedRowId, field);
|
|
80
|
-
}, [apiRef, logger
|
|
78
|
+
}, [apiRef, logger]);
|
|
81
79
|
const goToHeader = React.useCallback((colIndex, event) => {
|
|
82
80
|
logger.debug(`Navigating to header col ${colIndex}`);
|
|
83
81
|
apiRef.current.scrollToIndexes({
|
|
@@ -402,14 +400,12 @@ const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
402
400
|
return;
|
|
403
401
|
}
|
|
404
402
|
const viewportPageSize = apiRef.current.getViewportPageSize();
|
|
405
|
-
const
|
|
406
|
-
const colIndexBefore = params.field ? getColumnIndexFn(params.field) : 0;
|
|
403
|
+
const colIndexBefore = params.field ? apiRef.current.getColumnIndex(params.field) : 0;
|
|
407
404
|
const rowIndexBefore = currentPageRows.findIndex(row => row.id === params.id);
|
|
408
405
|
const firstRowIndexInPage = 0;
|
|
409
406
|
const lastRowIndexInPage = currentPageRows.length - 1;
|
|
410
407
|
const firstColIndex = 0;
|
|
411
|
-
const
|
|
412
|
-
const lastColIndex = visibleColumns.length - 1;
|
|
408
|
+
const lastColIndex = (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef).length - 1;
|
|
413
409
|
let shouldPreventDefault = true;
|
|
414
410
|
switch (event.key) {
|
|
415
411
|
case 'ArrowDown':
|
|
@@ -526,7 +522,7 @@ const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
526
522
|
if (shouldPreventDefault) {
|
|
527
523
|
event.preventDefault();
|
|
528
524
|
}
|
|
529
|
-
}, [apiRef, getCurrentPageRows, isRtl, goToCell, getRowIdFromIndex, headerFilteringEnabled, goToHeaderFilter, goToHeader
|
|
525
|
+
}, [apiRef, getCurrentPageRows, isRtl, goToCell, getRowIdFromIndex, headerFilteringEnabled, goToHeaderFilter, goToHeader]);
|
|
530
526
|
const checkIfCanStartEditing = React.useCallback((initialValue, {
|
|
531
527
|
event
|
|
532
528
|
}) => {
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { GridStateCommunity } from "../../../models/gridStateCommunity.js";
|
|
2
|
+
import type { GridStateColDef } from "../../../models/colDef/gridColDef.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get the list view state
|
|
5
|
+
* @category List View
|
|
6
|
+
* @ignore - Do not document
|
|
7
|
+
*/
|
|
8
|
+
export declare const gridListViewSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, unknown, boolean>;
|
|
2
9
|
/**
|
|
3
10
|
* Get the list column definition
|
|
4
11
|
* @category List View
|
|
5
12
|
* @ignore - Do not document
|
|
6
13
|
*/
|
|
7
|
-
export declare const gridListColumnSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, unknown,
|
|
14
|
+
export declare const gridListColumnSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, unknown, GridStateColDef>;
|
|
@@ -3,8 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.gridListColumnSelector = void 0;
|
|
6
|
+
exports.gridListViewSelector = exports.gridListColumnSelector = void 0;
|
|
7
7
|
var _createSelector = require("../../../utils/createSelector");
|
|
8
|
+
/**
|
|
9
|
+
* Get the list view state
|
|
10
|
+
* @category List View
|
|
11
|
+
* @ignore - Do not document
|
|
12
|
+
*/
|
|
13
|
+
const gridListViewSelector = exports.gridListViewSelector = (0, _createSelector.createRootSelector)(state => state.props.listView ?? false);
|
|
14
|
+
|
|
8
15
|
/**
|
|
9
16
|
* Get the list column definition
|
|
10
17
|
* @category List View
|
|
@@ -307,12 +307,13 @@ const useGridRowSelection = (apiRef, props) => {
|
|
|
307
307
|
}
|
|
308
308
|
const currentSelection = (0, _gridRowSelectionSelector.gridRowSelectionStateSelector)(apiRef);
|
|
309
309
|
const rowsLookup = (0, _gridRowsSelector.gridRowsLookupSelector)(apiRef);
|
|
310
|
+
const rowTree = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef);
|
|
310
311
|
const filteredRowsLookup = (0, _gridFilterSelector.gridFilteredRowsLookupSelector)(apiRef);
|
|
311
312
|
const isNonExistent = id => {
|
|
312
313
|
if (props.filterMode === 'server') {
|
|
313
314
|
return !rowsLookup[id];
|
|
314
315
|
}
|
|
315
|
-
return !
|
|
316
|
+
return !rowTree[id] || filteredRowsLookup[id] === false;
|
|
316
317
|
};
|
|
317
318
|
const newSelectionModel = {
|
|
318
319
|
type: currentSelection.type,
|
|
@@ -438,15 +439,15 @@ const useGridRowSelection = (apiRef, props) => {
|
|
|
438
439
|
const filterModel = (0, _gridFilterSelector.gridFilterModelSelector)(apiRef);
|
|
439
440
|
const quickFilterModel = (0, _gridFilterSelector.gridQuickFilterValuesSelector)(apiRef);
|
|
440
441
|
const hasFilters = filterModel.items.length > 0 || quickFilterModel?.some(val => val.length);
|
|
441
|
-
if (!props.isRowSelectable && !props.checkboxSelectionVisibleOnly &&
|
|
442
|
+
if (!props.isRowSelectable && !props.checkboxSelectionVisibleOnly && (!isNestedData || props.rowSelectionPropagation?.descendants) && !hasFilters) {
|
|
442
443
|
apiRef.current.setRowSelectionModel({
|
|
443
444
|
type: value ? 'exclude' : 'include',
|
|
444
445
|
ids: new Set()
|
|
445
|
-
});
|
|
446
|
+
}, 'multipleRowsSelection');
|
|
446
447
|
} else {
|
|
447
448
|
apiRef.current.selectRows(getRowsToBeSelected(), value);
|
|
448
449
|
}
|
|
449
|
-
}, [apiRef,
|
|
450
|
+
}, [apiRef, getRowsToBeSelected, props.checkboxSelectionVisibleOnly, props.isRowSelectable, props.rowSelectionPropagation?.descendants, isNestedData]);
|
|
450
451
|
const handleHeaderSelectionCheckboxChange = React.useCallback(params => {
|
|
451
452
|
toggleAllRows(params.value);
|
|
452
453
|
}, [toggleAllRows]);
|
|
@@ -42,7 +42,7 @@ export declare const getRowsStateFromCache: ({
|
|
|
42
42
|
}) => GridRowsState;
|
|
43
43
|
export declare const isAutogeneratedRow: (row: GridRowModel) => boolean;
|
|
44
44
|
export declare const isAutogeneratedRowNode: (rowNode: GridTreeNode) => rowNode is GridFooterNode | GridSkeletonRowNode | GridAutoGeneratedGroupNode | GridAutoGeneratedPinnedRowNode;
|
|
45
|
-
export declare const getTreeNodeDescendants: (tree: GridRowTreeConfig, parentId: GridRowId, skipAutoGeneratedRows: boolean) => GridRowId[];
|
|
45
|
+
export declare const getTreeNodeDescendants: (tree: GridRowTreeConfig, parentId: GridRowId, skipAutoGeneratedRows: boolean, directChildrenOnly?: boolean) => GridRowId[];
|
|
46
46
|
export declare const updateCacheWithNewRows: ({
|
|
47
47
|
previousCache,
|
|
48
48
|
getRowId,
|
|
@@ -145,7 +145,7 @@ const isAutogeneratedRow = row => GRID_ID_AUTOGENERATED in row;
|
|
|
145
145
|
exports.isAutogeneratedRow = isAutogeneratedRow;
|
|
146
146
|
const isAutogeneratedRowNode = rowNode => rowNode.type === 'skeletonRow' || rowNode.type === 'footer' || rowNode.type === 'group' && rowNode.isAutoGenerated || rowNode.type === 'pinnedRow' && rowNode.isAutoGenerated;
|
|
147
147
|
exports.isAutogeneratedRowNode = isAutogeneratedRowNode;
|
|
148
|
-
const getTreeNodeDescendants = (tree, parentId, skipAutoGeneratedRows) => {
|
|
148
|
+
const getTreeNodeDescendants = (tree, parentId, skipAutoGeneratedRows, directChildrenOnly) => {
|
|
149
149
|
const node = tree[parentId];
|
|
150
150
|
if (node.type !== 'group') {
|
|
151
151
|
return [];
|
|
@@ -156,7 +156,10 @@ const getTreeNodeDescendants = (tree, parentId, skipAutoGeneratedRows) => {
|
|
|
156
156
|
if (!skipAutoGeneratedRows || !isAutogeneratedRowNode(tree[child])) {
|
|
157
157
|
validDescendants.push(child);
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
if (directChildrenOnly) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const childDescendants = getTreeNodeDescendants(tree, child, skipAutoGeneratedRows, directChildrenOnly);
|
|
160
163
|
for (let j = 0; j < childDescendants.length; j += 1) {
|
|
161
164
|
validDescendants.push(childDescendants[j]);
|
|
162
165
|
}
|
|
@@ -206,7 +206,8 @@ const useGridRows = (apiRef, props) => {
|
|
|
206
206
|
skipAutoGeneratedRows = true,
|
|
207
207
|
groupId,
|
|
208
208
|
applySorting,
|
|
209
|
-
applyFiltering
|
|
209
|
+
applyFiltering,
|
|
210
|
+
directChildrenOnly = false
|
|
210
211
|
}) => {
|
|
211
212
|
const tree = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef);
|
|
212
213
|
let children;
|
|
@@ -218,14 +219,14 @@ const useGridRows = (apiRef, props) => {
|
|
|
218
219
|
const sortedRowIds = (0, _gridSortingSelector.gridSortedRowIdsSelector)(apiRef);
|
|
219
220
|
children = [];
|
|
220
221
|
const startIndex = sortedRowIds.findIndex(id => id === groupId) + 1;
|
|
221
|
-
for (let index = startIndex; index < sortedRowIds.length && tree[sortedRowIds[index]].depth > groupNode.depth; index += 1) {
|
|
222
|
+
for (let index = startIndex; index < sortedRowIds.length && (directChildrenOnly ? tree[sortedRowIds[index]].depth === groupNode.depth + 1 : tree[sortedRowIds[index]].depth > groupNode.depth); index += 1) {
|
|
222
223
|
const id = sortedRowIds[index];
|
|
223
224
|
if (!skipAutoGeneratedRows || !(0, _gridRowsUtils.isAutogeneratedRowNode)(tree[id])) {
|
|
224
225
|
children.push(id);
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
228
|
} else {
|
|
228
|
-
children = (0, _gridRowsUtils.getTreeNodeDescendants)(tree, groupId, skipAutoGeneratedRows);
|
|
229
|
+
children = (0, _gridRowsUtils.getTreeNodeDescendants)(tree, groupId, skipAutoGeneratedRows, directChildrenOnly);
|
|
229
230
|
}
|
|
230
231
|
if (applyFiltering) {
|
|
231
232
|
const filteredRowsLookup = (0, _gridFilterSelector.gridFilteredRowsLookupSelector)(apiRef);
|
|
@@ -9,4 +9,4 @@ import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
|
9
9
|
* @requires useGridFilter (state)
|
|
10
10
|
* @requires useGridColumnSpanning (method)
|
|
11
11
|
*/
|
|
12
|
-
export declare const useGridScroll: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination"
|
|
12
|
+
export declare const useGridScroll: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination">) => void;
|
|
@@ -16,7 +16,6 @@ var _gridRowsMetaSelector = require("../rows/gridRowsMetaSelector");
|
|
|
16
16
|
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
17
17
|
var _gridFilterSelector = require("../filter/gridFilterSelector");
|
|
18
18
|
var _dimensions = require("../dimensions");
|
|
19
|
-
var _gridListViewSelectors = require("../listView/gridListViewSelectors");
|
|
20
19
|
// Logic copied from https://www.w3.org/TR/wai-aria-practices/examples/listbox/js/listbox.js
|
|
21
20
|
// Similar to https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
|
|
22
21
|
function scrollIntoView(dimensions) {
|
|
@@ -58,7 +57,7 @@ const useGridScroll = (apiRef, props) => {
|
|
|
58
57
|
const scrollToIndexes = React.useCallback(params => {
|
|
59
58
|
const dimensions = (0, _dimensions.gridDimensionsSelector)(apiRef);
|
|
60
59
|
const totalRowCount = (0, _gridRowsSelector.gridRowCountSelector)(apiRef);
|
|
61
|
-
const visibleColumns =
|
|
60
|
+
const visibleColumns = (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef);
|
|
62
61
|
const scrollToHeader = params.rowIndex == null;
|
|
63
62
|
if (!scrollToHeader && totalRowCount === 0 || visibleColumns.length === 0) {
|
|
64
63
|
return false;
|
|
@@ -105,7 +104,7 @@ const useGridScroll = (apiRef, props) => {
|
|
|
105
104
|
return true;
|
|
106
105
|
}
|
|
107
106
|
return false;
|
|
108
|
-
}, [logger, apiRef, virtualScrollerRef, props.pagination, visibleSortedRows
|
|
107
|
+
}, [logger, apiRef, virtualScrollerRef, props.pagination, visibleSortedRows]);
|
|
109
108
|
const scroll = React.useCallback(params => {
|
|
110
109
|
if (virtualScrollerRef.current && params.left !== undefined && colRef.current) {
|
|
111
110
|
const direction = isRtl ? -1 : 1;
|
|
@@ -35,9 +35,7 @@ var _gridColumnsUtils = require("../columns/gridColumnsUtils");
|
|
|
35
35
|
var _gridVirtualizationSelectors = require("./gridVirtualizationSelectors");
|
|
36
36
|
var _useGridVirtualization = require("./useGridVirtualization");
|
|
37
37
|
var _gridRowSpanningSelectors = require("../rows/gridRowSpanningSelectors");
|
|
38
|
-
var _gridListViewSelectors = require("../listView/gridListViewSelectors");
|
|
39
38
|
var _gridRowsUtils = require("../rows/gridRowsUtils");
|
|
40
|
-
var _columns = require("../columns");
|
|
41
39
|
var _gridFocusedVirtualCellSelector = require("./gridFocusedVirtualCellSelector");
|
|
42
40
|
var _roundToDecimalPlaces = require("../../../utils/roundToDecimalPlaces");
|
|
43
41
|
var _isJSDOM = require("../../../utils/isJSDOM");
|
|
@@ -67,12 +65,11 @@ const useGridVirtualScroller = () => {
|
|
|
67
65
|
const {
|
|
68
66
|
listView
|
|
69
67
|
} = rootProps;
|
|
70
|
-
const visibleColumns = (0, _useGridSelector.useGridSelector)(apiRef,
|
|
68
|
+
const visibleColumns = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector);
|
|
71
69
|
const enabledForRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationRowEnabledSelector) && !_isJSDOM.isJSDOM;
|
|
72
70
|
const enabledForColumns = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationColumnEnabledSelector) && !_isJSDOM.isJSDOM;
|
|
73
71
|
const pinnedRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridPinnedRowsSelector);
|
|
74
|
-
const
|
|
75
|
-
const pinnedColumns = listView ? _columns.EMPTY_PINNED_COLUMN_FIELDS : pinnedColumnDefinitions;
|
|
72
|
+
const pinnedColumns = (0, _gridColumnsSelector.gridVisiblePinnedColumnDefinitionsSelector)(apiRef);
|
|
76
73
|
const hasBottomPinnedRows = pinnedRows.bottom.length > 0;
|
|
77
74
|
const [panels, setPanels] = React.useState(EMPTY_DETAIL_PANELS);
|
|
78
75
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
@@ -563,7 +560,7 @@ function needsHorizontalScrollbarSelector(apiRef) {
|
|
|
563
560
|
function inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns) {
|
|
564
561
|
const dimensions = (0, _gridDimensionsSelectors.gridDimensionsSelector)(apiRef);
|
|
565
562
|
const currentPage = (0, _useGridVisibleRows.getVisibleRows)(apiRef, rootProps);
|
|
566
|
-
const visibleColumns =
|
|
563
|
+
const visibleColumns = (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef);
|
|
567
564
|
const hiddenCellsOriginMap = (0, _gridRowSpanningSelectors.gridRowSpanningHiddenCellsOriginMapSelector)(apiRef);
|
|
568
565
|
const lastRowId = apiRef.current.state.rows.dataRowIds.at(-1);
|
|
569
566
|
const lastColumn = visibleColumns.at(-1);
|
package/hooks/utils/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export * from "./useGridNativeEventListener.js";
|
|
|
6
6
|
export * from "./useFirstRender.js";
|
|
7
7
|
export * from "./useOnMount.js";
|
|
8
8
|
export * from "./useRunOnce.js";
|
|
9
|
+
export * from "./useRunOncePerLoop.js";
|
|
9
10
|
export type { RenderProp } from '@mui/x-internals/useComponentRenderer';
|
package/hooks/utils/index.js
CHANGED
|
@@ -106,4 +106,16 @@ Object.keys(_useRunOnce).forEach(function (key) {
|
|
|
106
106
|
return _useRunOnce[key];
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
+
});
|
|
110
|
+
var _useRunOncePerLoop = require("./useRunOncePerLoop");
|
|
111
|
+
Object.keys(_useRunOncePerLoop).forEach(function (key) {
|
|
112
|
+
if (key === "default" || key === "__esModule") return;
|
|
113
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
114
|
+
if (key in exports && exports[key] === _useRunOncePerLoop[key]) return;
|
|
115
|
+
Object.defineProperty(exports, key, {
|
|
116
|
+
enumerable: true,
|
|
117
|
+
get: function () {
|
|
118
|
+
return _useRunOncePerLoop[key];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
109
121
|
});
|
|
@@ -4,5 +4,5 @@ import { GridPrivateApiCommunity } from "../../models/api/gridApiCommunity.js";
|
|
|
4
4
|
import { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
|
|
5
5
|
type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> };
|
|
6
6
|
export type GridStateInitializer<P extends Partial<DataGridProcessedProps> = DataGridProcessedProps, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity> = (state: DeepPartial<PrivateApi['state']>, props: P, privateApiRef: RefObject<PrivateApi>) => DeepPartial<PrivateApi['state']>;
|
|
7
|
-
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps>, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(initializer: GridStateInitializer<P, PrivateApi>, privateApiRef: RefObject<PrivateApi>, props: P) => void;
|
|
7
|
+
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps>, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(initializer: GridStateInitializer<P, PrivateApi>, privateApiRef: RefObject<PrivateApi>, props: P, key?: string) => void;
|
|
8
8
|
export {};
|
|
@@ -6,8 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useGridInitializeState = void 0;
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
const useGridInitializeState = (initializer, privateApiRef, props) => {
|
|
9
|
+
const useGridInitializeState = (initializer, privateApiRef, props, key) => {
|
|
10
|
+
const previousKey = React.useRef(key);
|
|
10
11
|
const isInitialized = React.useRef(false);
|
|
12
|
+
if (key !== previousKey.current) {
|
|
13
|
+
isInitialized.current = false;
|
|
14
|
+
previousKey.current = key;
|
|
15
|
+
}
|
|
11
16
|
if (!isInitialized.current) {
|
|
12
17
|
privateApiRef.current.state = initializer(privateApiRef.current.state, props, privateApiRef);
|
|
13
18
|
isInitialized.current = true;
|
|
@@ -77,6 +77,10 @@ function useGridSelector(apiRef, selector, args = undefined, equals = defaultCom
|
|
|
77
77
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78
78
|
EMPTY);
|
|
79
79
|
const unsubscribe = React.useCallback(() => {
|
|
80
|
+
// Fixes issue in React Strict Mode, where getSnapshot is not called
|
|
81
|
+
if (!refs.current.subscription) {
|
|
82
|
+
subscribe();
|
|
83
|
+
}
|
|
80
84
|
return () => {
|
|
81
85
|
if (refs.current.subscription) {
|
|
82
86
|
refs.current.subscription();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useRunOncePerLoop<T extends (...args: any[]) => void>(callback: T, nextFrame?: boolean): (...args: Parameters<T>) => void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useRunOncePerLoop = useRunOncePerLoop;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
function useRunOncePerLoop(callback, nextFrame = false) {
|
|
10
|
+
const scheduledRef = React.useRef(false);
|
|
11
|
+
const schedule = React.useCallback((...args) => {
|
|
12
|
+
if (scheduledRef.current) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
scheduledRef.current = true;
|
|
16
|
+
const runner = () => {
|
|
17
|
+
scheduledRef.current = false;
|
|
18
|
+
callback(...args);
|
|
19
|
+
};
|
|
20
|
+
if (nextFrame) {
|
|
21
|
+
if (typeof requestAnimationFrame === 'function') {
|
|
22
|
+
requestAnimationFrame(runner);
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (typeof queueMicrotask === 'function') {
|
|
27
|
+
queueMicrotask(runner);
|
|
28
|
+
} else {
|
|
29
|
+
Promise.resolve().then(runner);
|
|
30
|
+
}
|
|
31
|
+
}, [callback, nextFrame]);
|
|
32
|
+
return schedule;
|
|
33
|
+
}
|
package/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GridGetRowsParams, GridGetRowsResponse } from "../../models/gridDataSource.js";
|
|
2
|
+
export declare class TestCache {
|
|
3
|
+
private cache;
|
|
4
|
+
constructor();
|
|
5
|
+
set(key: GridGetRowsParams, value: GridGetRowsResponse): void;
|
|
6
|
+
get(key: GridGetRowsParams): GridGetRowsResponse | undefined;
|
|
7
|
+
size(): number;
|
|
8
|
+
clear(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TestCache = void 0;
|
|
7
|
+
var _cache = require("../../hooks/features/dataSource/cache");
|
|
8
|
+
class TestCache {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.cache = void 0;
|
|
11
|
+
this.cache = new Map();
|
|
12
|
+
}
|
|
13
|
+
set(key, value) {
|
|
14
|
+
this.cache.set((0, _cache.getKeyDefault)(key), value);
|
|
15
|
+
}
|
|
16
|
+
get(key) {
|
|
17
|
+
return this.cache.get((0, _cache.getKeyDefault)(key));
|
|
18
|
+
}
|
|
19
|
+
size() {
|
|
20
|
+
return this.cache.size;
|
|
21
|
+
}
|
|
22
|
+
clear() {
|
|
23
|
+
this.cache.clear();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.TestCache = TestCache;
|
package/internals/utils/index.js
CHANGED
|
@@ -46,4 +46,15 @@ Object.keys(_attachPinnedStyle).forEach(function (key) {
|
|
|
46
46
|
return _attachPinnedStyle[key];
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
+
});
|
|
50
|
+
var _cache = require("./cache");
|
|
51
|
+
Object.keys(_cache).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _cache[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _cache[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
49
60
|
});
|