neue Homepage auf react basis

This commit is contained in:
2026-08-07 21:39:30 +02:00
parent 164bdd19ad
commit ee89442c04
52191 changed files with 1230242 additions and 58 deletions
@@ -0,0 +1,40 @@
import type { GridInitialStateCommunity } from "../../../models/gridStateCommunity.mjs";
export interface GridStatePersistenceApi<InitialState extends GridInitialStateCommunity> {
/**
* Generates a serializable object containing the exportable parts of the DataGrid state.
* These values can then be passed to the `initialState` prop or injected using the `restoreState` method.
* @param {GridExportStateParams} params With all properties from [[GridExportStateParams]]
* @returns {GridInitialState} The exported state.
*/
exportState: (params?: GridExportStateParams) => InitialState;
/**
* Inject the given values into the state of the DataGrid.
* @param {GridInitialState} stateToRestore The exported state to restore.
*/
restoreState: (stateToRestore: InitialState) => void;
}
export interface GridRestoreStatePreProcessingValue {
/**
* Functions to run after the state has been updated but before re-rendering.
* This is usually used to apply derived states like `applyFilters` or `applySorting`
*/
callbacks: (() => void)[];
}
/**
* Object passed as parameter in the `exportState()` grid API method.
* @demos
* - [Restore state with `apiRef`](/x/react-data-grid/state/#restore-the-state-with-apiref)
*/
export interface GridExportStateParams {
/**
* By default, the grid exports all the models.
* You can switch this property to `true` to only exports models that are either controlled, initialized or modified.
* For instance, with this property, if you don't control or initialize the `filterModel` and you did not apply any filter, the model won't be exported.
* Note that the column dimensions are not a model. The grid only exports the dimensions of the modified columns even when `exportOnlyDirtyModels` is false.
* @default false
*/
exportOnlyDirtyModels?: boolean;
}
export interface GridRestoreStatePreProcessingContext<I extends GridInitialStateCommunity> {
stateToRestore: I;
}
@@ -0,0 +1,40 @@
import type { GridInitialStateCommunity } from "../../../models/gridStateCommunity.js";
export interface GridStatePersistenceApi<InitialState extends GridInitialStateCommunity> {
/**
* Generates a serializable object containing the exportable parts of the DataGrid state.
* These values can then be passed to the `initialState` prop or injected using the `restoreState` method.
* @param {GridExportStateParams} params With all properties from [[GridExportStateParams]]
* @returns {GridInitialState} The exported state.
*/
exportState: (params?: GridExportStateParams) => InitialState;
/**
* Inject the given values into the state of the DataGrid.
* @param {GridInitialState} stateToRestore The exported state to restore.
*/
restoreState: (stateToRestore: InitialState) => void;
}
export interface GridRestoreStatePreProcessingValue {
/**
* Functions to run after the state has been updated but before re-rendering.
* This is usually used to apply derived states like `applyFilters` or `applySorting`
*/
callbacks: (() => void)[];
}
/**
* Object passed as parameter in the `exportState()` grid API method.
* @demos
* - [Restore state with `apiRef`](/x/react-data-grid/state/#restore-the-state-with-apiref)
*/
export interface GridExportStateParams {
/**
* By default, the grid exports all the models.
* You can switch this property to `true` to only exports models that are either controlled, initialized or modified.
* For instance, with this property, if you don't control or initialize the `filterModel` and you did not apply any filter, the model won't be exported.
* Note that the column dimensions are not a model. The grid only exports the dimensions of the modified columns even when `exportOnlyDirtyModels` is false.
* @default false
*/
exportOnlyDirtyModels?: boolean;
}
export interface GridRestoreStatePreProcessingContext<I extends GridInitialStateCommunity> {
stateToRestore: I;
}
@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
export {};
@@ -0,0 +1 @@
export type { GridStatePersistenceApi, GridExportStateParams } from "./gridStatePersistenceInterface.mjs";
@@ -0,0 +1 @@
export type { GridStatePersistenceApi, GridExportStateParams } from "./gridStatePersistenceInterface.js";
@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,3 @@
import type { RefObject } from '@mui/x-internals/types';
import type { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.mjs";
export declare const useGridStatePersistence: (apiRef: RefObject<GridPrivateApiCommunity>) => void;
@@ -0,0 +1,3 @@
import type { RefObject } from '@mui/x-internals/types';
import type { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
export declare const useGridStatePersistence: (apiRef: RefObject<GridPrivateApiCommunity>) => void;
@@ -0,0 +1,31 @@
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useGridStatePersistence = void 0;
var React = _interopRequireWildcard(require("react"));
var _utils = require("../../utils");
const useGridStatePersistence = apiRef => {
const exportState = React.useCallback((params = {}) => {
const stateToExport = apiRef.current.unstable_applyPipeProcessors('exportState', {}, params);
return stateToExport;
}, [apiRef]);
const restoreState = React.useCallback(stateToRestore => {
const response = apiRef.current.unstable_applyPipeProcessors('restoreState', {
callbacks: []
}, {
stateToRestore
});
response.callbacks.forEach(callback => {
callback();
});
}, [apiRef]);
const statePersistenceApi = {
exportState,
restoreState
};
(0, _utils.useGridApiMethod)(apiRef, statePersistenceApi, 'public');
};
exports.useGridStatePersistence = useGridStatePersistence;
@@ -0,0 +1,23 @@
import * as React from 'react';
import { useGridApiMethod } from "../../utils/index.mjs";
export const useGridStatePersistence = apiRef => {
const exportState = React.useCallback((params = {}) => {
const stateToExport = apiRef.current.unstable_applyPipeProcessors('exportState', {}, params);
return stateToExport;
}, [apiRef]);
const restoreState = React.useCallback(stateToRestore => {
const response = apiRef.current.unstable_applyPipeProcessors('restoreState', {
callbacks: []
}, {
stateToRestore
});
response.callbacks.forEach(callback => {
callback();
});
}, [apiRef]);
const statePersistenceApi = {
exportState,
restoreState
};
useGridApiMethod(apiRef, statePersistenceApi, 'public');
};