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,5 @@
import type { GridStateCommunity } from "../../../models/gridStateCommunity.mjs";
export declare const gridPreferencePanelStateSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, unknown, import("@mui/x-data-grid").GridPreferencePanelState>;
export declare const gridPreferencePanelSelectorWithLabel: (args_0: import("react").RefObject<{
state: GridStateCommunity;
} | null>, labelId: string | undefined) => boolean;
@@ -0,0 +1,5 @@
import type { GridStateCommunity } from "../../../models/gridStateCommunity.js";
export declare const gridPreferencePanelStateSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, unknown, import("@mui/x-data-grid").GridPreferencePanelState>;
export declare const gridPreferencePanelSelectorWithLabel: (args_0: import("react").RefObject<{
state: GridStateCommunity;
} | null>, labelId: string | undefined) => boolean;
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.gridPreferencePanelStateSelector = exports.gridPreferencePanelSelectorWithLabel = void 0;
var _createSelector = require("../../../utils/createSelector");
const gridPreferencePanelStateSelector = exports.gridPreferencePanelStateSelector = (0, _createSelector.createRootSelector)(state => state.preferencePanel);
const gridPreferencePanelSelectorWithLabel = exports.gridPreferencePanelSelectorWithLabel = (0, _createSelector.createSelector)(gridPreferencePanelStateSelector, (panel, labelId) => {
if (panel.open && panel.labelId === labelId) {
return true;
}
return false;
});
@@ -0,0 +1,8 @@
import { createSelector, createRootSelector } from "../../../utils/createSelector.mjs";
export const gridPreferencePanelStateSelector = createRootSelector(state => state.preferencePanel);
export const gridPreferencePanelSelectorWithLabel = createSelector(gridPreferencePanelStateSelector, (panel, labelId) => {
if (panel.open && panel.labelId === labelId) {
return true;
}
return false;
});
@@ -0,0 +1,13 @@
import type { GridPreferencePanelsValue } from "./gridPreferencePanelsValue.mjs";
export interface GridPreferencePanelState {
open: boolean;
panelId?: string;
labelId?: string;
/**
* Tab currently opened.
* @default GridPreferencePanelsValue.filter
* TODO v6: Remove the default behavior
*/
openedPanelValue?: GridPreferencePanelsValue;
}
export type GridPreferencePanelInitialState = GridPreferencePanelState;
@@ -0,0 +1,13 @@
import type { GridPreferencePanelsValue } from "./gridPreferencePanelsValue.js";
export interface GridPreferencePanelState {
open: boolean;
panelId?: string;
labelId?: string;
/**
* Tab currently opened.
* @default GridPreferencePanelsValue.filter
* TODO v6: Remove the default behavior
*/
openedPanelValue?: GridPreferencePanelsValue;
}
export type GridPreferencePanelInitialState = GridPreferencePanelState;
@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,6 @@
declare enum GridPreferencePanelsValue {
filters = "filters",
columns = "columns",
aiAssistant = "aiAssistant",
}
export { GridPreferencePanelsValue };
@@ -0,0 +1,6 @@
declare enum GridPreferencePanelsValue {
filters = "filters",
columns = "columns",
aiAssistant = "aiAssistant",
}
export { GridPreferencePanelsValue };
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.GridPreferencePanelsValue = void 0;
var GridPreferencePanelsValue = exports.GridPreferencePanelsValue = /*#__PURE__*/function (GridPreferencePanelsValue) {
GridPreferencePanelsValue["filters"] = "filters";
GridPreferencePanelsValue["columns"] = "columns";
GridPreferencePanelsValue["aiAssistant"] = "aiAssistant";
return GridPreferencePanelsValue;
}(GridPreferencePanelsValue || {});
@@ -0,0 +1,7 @@
var GridPreferencePanelsValue = /*#__PURE__*/function (GridPreferencePanelsValue) {
GridPreferencePanelsValue["filters"] = "filters";
GridPreferencePanelsValue["columns"] = "columns";
GridPreferencePanelsValue["aiAssistant"] = "aiAssistant";
return GridPreferencePanelsValue;
}(GridPreferencePanelsValue || {});
export { GridPreferencePanelsValue };
@@ -0,0 +1,3 @@
export { gridPreferencePanelStateSelector } from "./gridPreferencePanelSelector.mjs";
export * from "./gridPreferencePanelState.mjs";
export * from "./gridPreferencePanelsValue.mjs";
@@ -0,0 +1,3 @@
export { gridPreferencePanelStateSelector } from "./gridPreferencePanelSelector.js";
export * from "./gridPreferencePanelState.js";
export * from "./gridPreferencePanelsValue.js";
@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
gridPreferencePanelStateSelector: true
};
Object.defineProperty(exports, "gridPreferencePanelStateSelector", {
enumerable: true,
get: function () {
return _gridPreferencePanelSelector.gridPreferencePanelStateSelector;
}
});
var _gridPreferencePanelSelector = require("./gridPreferencePanelSelector");
var _gridPreferencePanelState = require("./gridPreferencePanelState");
Object.keys(_gridPreferencePanelState).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _gridPreferencePanelState[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _gridPreferencePanelState[key];
}
});
});
var _gridPreferencePanelsValue = require("./gridPreferencePanelsValue");
Object.keys(_gridPreferencePanelsValue).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _gridPreferencePanelsValue[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _gridPreferencePanelsValue[key];
}
});
});
@@ -0,0 +1,3 @@
export { gridPreferencePanelStateSelector } from "./gridPreferencePanelSelector.mjs";
export * from "./gridPreferencePanelState.mjs";
export * from "./gridPreferencePanelsValue.mjs";
@@ -0,0 +1,9 @@
import type { RefObject } from '@mui/x-internals/types';
import type { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.mjs";
import type { DataGridProcessedProps } from "../../../models/props/DataGridProps.mjs";
import type { GridStateInitializer } from "../../utils/useGridInitializeState.mjs";
export declare const preferencePanelStateInitializer: GridStateInitializer<Pick<DataGridProcessedProps, 'initialState'>>;
/**
* TODO: Add a single `setPreferencePanel` method to avoid multiple `setState`
*/
export declare const useGridPreferencesPanel: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'initialState'>) => void;
@@ -0,0 +1,9 @@
import type { RefObject } from '@mui/x-internals/types';
import type { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
import type { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
import type { GridStateInitializer } from "../../utils/useGridInitializeState.js";
export declare const preferencePanelStateInitializer: GridStateInitializer<Pick<DataGridProcessedProps, 'initialState'>>;
/**
* TODO: Add a single `setPreferencePanel` method to avoid multiple `setState`
*/
export declare const useGridPreferencesPanel: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'initialState'>) => void;
@@ -0,0 +1,98 @@
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useGridPreferencesPanel = exports.preferencePanelStateInitializer = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var React = _interopRequireWildcard(require("react"));
var _useGridApiMethod = require("../../utils/useGridApiMethod");
var _useGridLogger = require("../../utils/useGridLogger");
var _pipeProcessing = require("../../core/pipeProcessing");
var _gridPreferencePanelSelector = require("./gridPreferencePanelSelector");
const preferencePanelStateInitializer = (state, props) => (0, _extends2.default)({}, state, {
preferencePanel: props.initialState?.preferencePanel ?? {
open: false
}
});
/**
* TODO: Add a single `setPreferencePanel` method to avoid multiple `setState`
*/
exports.preferencePanelStateInitializer = preferencePanelStateInitializer;
const useGridPreferencesPanel = (apiRef, props) => {
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridPreferencesPanel');
/**
* API METHODS
*/
const hidePreferences = React.useCallback(() => {
apiRef.current.setState(state => {
if (!state.preferencePanel.open) {
return state;
}
logger.debug('Hiding Preferences Panel');
const preferencePanelState = (0, _gridPreferencePanelSelector.gridPreferencePanelStateSelector)(apiRef);
apiRef.current.publishEvent('preferencePanelClose', {
openedPanelValue: preferencePanelState.openedPanelValue
});
return (0, _extends2.default)({}, state, {
preferencePanel: {
open: false
}
});
});
}, [apiRef, logger]);
const showPreferences = React.useCallback((newValue, panelId, labelId) => {
logger.debug('Opening Preferences Panel');
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
preferencePanel: (0, _extends2.default)({}, state.preferencePanel, {
open: true,
openedPanelValue: newValue,
panelId,
labelId
})
}));
apiRef.current.publishEvent('preferencePanelOpen', {
openedPanelValue: newValue
});
}, [logger, apiRef]);
(0, _useGridApiMethod.useGridApiMethod)(apiRef, {
showPreferences,
hidePreferences
}, 'public');
/**
* PRE-PROCESSING
*/
const stateExportPreProcessing = React.useCallback((prevState, context) => {
const preferencePanelToExport = (0, _gridPreferencePanelSelector.gridPreferencePanelStateSelector)(apiRef);
const shouldExportPreferencePanel =
// Always export if the `exportOnlyDirtyModels` property is not activated
!context.exportOnlyDirtyModels ||
// Always export if the panel was initialized
props.initialState?.preferencePanel != null ||
// Always export if the panel is opened
preferencePanelToExport.open;
if (!shouldExportPreferencePanel) {
return prevState;
}
return (0, _extends2.default)({}, prevState, {
preferencePanel: preferencePanelToExport
});
}, [apiRef, props.initialState?.preferencePanel]);
const stateRestorePreProcessing = React.useCallback((params, context) => {
const preferencePanel = context.stateToRestore.preferencePanel;
if (preferencePanel != null) {
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
preferencePanel
}));
}
return params;
}, [apiRef]);
(0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'exportState', stateExportPreProcessing);
(0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'restoreState', stateRestorePreProcessing);
};
exports.useGridPreferencesPanel = useGridPreferencesPanel;
@@ -0,0 +1,88 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import * as React from 'react';
import { useGridApiMethod } from "../../utils/useGridApiMethod.mjs";
import { useGridLogger } from "../../utils/useGridLogger.mjs";
import { useGridRegisterPipeProcessor } from "../../core/pipeProcessing/index.mjs";
import { gridPreferencePanelStateSelector } from "./gridPreferencePanelSelector.mjs";
export const preferencePanelStateInitializer = (state, props) => _extends({}, state, {
preferencePanel: props.initialState?.preferencePanel ?? {
open: false
}
});
/**
* TODO: Add a single `setPreferencePanel` method to avoid multiple `setState`
*/
export const useGridPreferencesPanel = (apiRef, props) => {
const logger = useGridLogger(apiRef, 'useGridPreferencesPanel');
/**
* API METHODS
*/
const hidePreferences = React.useCallback(() => {
apiRef.current.setState(state => {
if (!state.preferencePanel.open) {
return state;
}
logger.debug('Hiding Preferences Panel');
const preferencePanelState = gridPreferencePanelStateSelector(apiRef);
apiRef.current.publishEvent('preferencePanelClose', {
openedPanelValue: preferencePanelState.openedPanelValue
});
return _extends({}, state, {
preferencePanel: {
open: false
}
});
});
}, [apiRef, logger]);
const showPreferences = React.useCallback((newValue, panelId, labelId) => {
logger.debug('Opening Preferences Panel');
apiRef.current.setState(state => _extends({}, state, {
preferencePanel: _extends({}, state.preferencePanel, {
open: true,
openedPanelValue: newValue,
panelId,
labelId
})
}));
apiRef.current.publishEvent('preferencePanelOpen', {
openedPanelValue: newValue
});
}, [logger, apiRef]);
useGridApiMethod(apiRef, {
showPreferences,
hidePreferences
}, 'public');
/**
* PRE-PROCESSING
*/
const stateExportPreProcessing = React.useCallback((prevState, context) => {
const preferencePanelToExport = gridPreferencePanelStateSelector(apiRef);
const shouldExportPreferencePanel =
// Always export if the `exportOnlyDirtyModels` property is not activated
!context.exportOnlyDirtyModels ||
// Always export if the panel was initialized
props.initialState?.preferencePanel != null ||
// Always export if the panel is opened
preferencePanelToExport.open;
if (!shouldExportPreferencePanel) {
return prevState;
}
return _extends({}, prevState, {
preferencePanel: preferencePanelToExport
});
}, [apiRef, props.initialState?.preferencePanel]);
const stateRestorePreProcessing = React.useCallback((params, context) => {
const preferencePanel = context.stateToRestore.preferencePanel;
if (preferencePanel != null) {
apiRef.current.setState(state => _extends({}, state, {
preferencePanel
}));
}
return params;
}, [apiRef]);
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
};