wip:milestone 0 fixes
Some checks failed
CI/CD Pipeline / unit-tests (push) Failing after 1m16s
CI/CD Pipeline / integration-tests (push) Failing after 2m32s
CI/CD Pipeline / lint (push) Successful in 5m22s
CI/CD Pipeline / e2e-tests (push) Has been skipped
CI/CD Pipeline / build (push) Has been skipped

This commit is contained in:
2026-03-15 12:35:42 +02:00
parent 6708cf28a7
commit cffdf8af86
61266 changed files with 4511646 additions and 1938 deletions

View File

@@ -0,0 +1,433 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["sx", "fontSize"],
_excluded2 = ["sortingOrder"];
/**
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT).
* All other copyright (c) for Lucide are held by Lucide Contributors 2022.
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted,
* provided that the above copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
* FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
import * as React from 'react';
import SvgIcon from '@mui/joy/SvgIcon';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
function createSvgIcon(path, displayName) {
const fontSizeMap = {
small: 'lg',
medium: 'xl',
large: 'xl2',
inherit: undefined
};
// @ts-ignore internal component
function Component(_ref, ref) {
let {
sx,
fontSize
} = _ref,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
return /*#__PURE__*/_jsx(SvgIcon, _extends({
"data-testid": `${displayName}Icon`,
ref: ref,
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round",
sx: [{
fill: 'none'
}, ...(Array.isArray(sx) ? sx : [sx])],
fontSize: fontSize ? fontSizeMap[fontSize] : undefined
}, props, {
children: path
}));
}
if (process.env.NODE_ENV !== 'production') {
// Need to set `displayName` on the inner component for React.memo.
// React prior to 16.14 ignores `displayName` on the wrapper.
Component.displayName = `${displayName}Icon`;
}
// @ts-ignore internal component
Component.muiName = SvgIcon.muiName;
// @ts-ignore internal component
return /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(Component));
}
export const GridArrowUpwardIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("line", {
x1: "12",
x2: "12",
y1: "19",
y2: "5"
}), /*#__PURE__*/_jsx("polyline", {
points: "5 12 12 5 19 12"
})]
}), 'ArrowUpward');
export const GridArrowDownwardIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("line", {
x1: "12",
x2: "12",
y1: "5",
y2: "19"
}), /*#__PURE__*/_jsx("polyline", {
points: "19 12 12 19 5 12"
})]
}), 'ArrowDownward');
export const GridKeyboardArrowLeft = createSvgIcon( /*#__PURE__*/_jsx("polyline", {
points: "15 18 9 12 15 6"
}), 'KeyboardArrowLeft');
export const GridKeyboardArrowRight = createSvgIcon( /*#__PURE__*/_jsx("polyline", {
points: "9 18 15 12 9 6"
}), 'KeyboardArrowRight');
export const GridExpandMoreIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("path", {
d: "m7 15 5 5 5-5"
}), /*#__PURE__*/_jsx("path", {
d: "m7 9 5-5 5 5"
})]
}), 'ExpandMore');
export const GridFilterListIcon = createSvgIcon( /*#__PURE__*/_jsx("polygon", {
points: "22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"
}), 'FilterList');
export const GridFilterAltIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("path", {
d: "M3 6h18"
}), /*#__PURE__*/_jsx("path", {
d: "M7 12h10"
}), /*#__PURE__*/_jsx("path", {
d: "M10 18h4"
})]
}), 'FilterAlt');
export const GridSearchIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("circle", {
cx: "11",
cy: "11",
r: "8"
}), /*#__PURE__*/_jsx("line", {
x1: "21",
x2: "16.65",
y1: "21",
y2: "16.65"
})]
}), 'Search');
export const GridMenuIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("rect", {
width: "18",
height: "18",
x: "3",
y: "3",
rx: "2"
}), /*#__PURE__*/_jsx("path", {
d: "M7 8h10"
}), /*#__PURE__*/_jsx("path", {
d: "M7 12h10"
}), /*#__PURE__*/_jsx("path", {
d: "M7 16h10"
})]
}), 'Menu');
export const GridCheckCircleIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("path", {
d: "M22 11.08V12a10 10 0 1 1-5.93-9.14"
}), /*#__PURE__*/_jsx("polyline", {
points: "22 4 12 14.01 9 11.01"
})]
}), 'CheckCircle');
export const GridColumnIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("rect", {
width: "18",
height: "18",
x: "3",
y: "3",
rx: "2",
ry: "2"
}), /*#__PURE__*/_jsx("line", {
x1: "12",
x2: "12",
y1: "3",
y2: "21"
})]
}), 'ColumnIcon');
export const GridSeparatorIcon = createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M11 19V5h2v14z"
}), 'Separator');
export const GridViewHeadlineIcon = createSvgIcon( /*#__PURE__*/_jsx("path", {
fill: "none",
stroke: "currentColor",
strokeWidth: "1.5",
d: "M3 12h18M3 12v4.5M3 12V7.5M21 12v4.5m0-4.5V7.5m-18 9v3.9a.6.6 0 0 0 .6.6h16.8a.6.6 0 0 0 .6-.6v-3.9m-18 0h18m0-9V3.6a.6.6 0 0 0-.6-.6H3.6a.6.6 0 0 0-.6.6v3.9m18 0H3"
}), 'ViewHeadline');
export const GridTableRowsIcon = createSvgIcon( /*#__PURE__*/_jsx("path", {
fill: "currentColor",
strokeWidth: "0",
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 2v3H5V5h14zm0 5v4H5v-4h14zM5 19v-3h14v3H5z"
}), 'TableRows');
export const GridViewStreamIcon = createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm0 6h16"
}), 'ViewStream');
export const GridTripleDotsVerticalIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("circle", {
cx: "12",
cy: "12",
r: "1"
}), /*#__PURE__*/_jsx("circle", {
cx: "12",
cy: "5",
r: "1"
}), /*#__PURE__*/_jsx("circle", {
cx: "12",
cy: "19",
r: "1"
})]
}), 'TripleDotsVertical');
export const GridCloseIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("circle", {
cx: "12",
cy: "12",
r: "10"
}), /*#__PURE__*/_jsx("line", {
x1: "15",
x2: "9",
y1: "9",
y2: "15"
}), /*#__PURE__*/_jsx("line", {
x1: "9",
x2: "15",
y1: "9",
y2: "15"
})]
}), 'Close');
export const GridAddIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("circle", {
cx: "12",
cy: "12",
r: "10"
}), /*#__PURE__*/_jsx("line", {
x1: "12",
x2: "12",
y1: "8",
y2: "16"
}), /*#__PURE__*/_jsx("line", {
x1: "8",
x2: "16",
y1: "12",
y2: "12"
})]
}), 'Add');
export const GridRemoveIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("circle", {
cx: "12",
cy: "12",
r: "10"
}), /*#__PURE__*/_jsx("line", {
x1: "15",
x2: "9",
y1: "9",
y2: "15"
}), /*#__PURE__*/_jsx("line", {
x1: "9",
x2: "15",
y1: "9",
y2: "15"
})]
}), 'Remove');
export const GridLoadIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("path", {
d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
}), /*#__PURE__*/_jsx("polyline", {
points: "7 10 12 15 17 10"
}), /*#__PURE__*/_jsx("line", {
x1: "12",
x2: "12",
y1: "15",
y2: "3"
})]
}), 'Load');
export const GridDragIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("circle", {
cx: "9",
cy: "12",
r: "1"
}), /*#__PURE__*/_jsx("circle", {
cx: "9",
cy: "5",
r: "1"
}), /*#__PURE__*/_jsx("circle", {
cx: "9",
cy: "19",
r: "1"
}), /*#__PURE__*/_jsx("circle", {
cx: "15",
cy: "12",
r: "1"
}), /*#__PURE__*/_jsx("circle", {
cx: "15",
cy: "5",
r: "1"
}), /*#__PURE__*/_jsx("circle", {
cx: "15",
cy: "19",
r: "1"
})]
}), 'Drag');
export const GridSaveAltIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("path", {
d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"
}), /*#__PURE__*/_jsx("polyline", {
points: "14 2 14 8 20 8"
}), /*#__PURE__*/_jsx("path", {
d: "M12 12v6"
}), /*#__PURE__*/_jsx("path", {
d: "m15 15-3-3-3 3"
})]
}), 'SaveAlt');
export const GridCheckIcon = createSvgIcon( /*#__PURE__*/_jsx("polyline", {
points: "20 6 9 17 4 12"
}), 'Check');
export const GridMoreVertIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("circle", {
cx: "12",
cy: "12",
r: "1"
}), /*#__PURE__*/_jsx("circle", {
cx: "12",
cy: "5",
r: "1"
}), /*#__PURE__*/_jsx("circle", {
cx: "12",
cy: "19",
r: "1"
})]
}), 'MoreVert');
export const GridVisibilityOffIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("path", {
d: "M9.88 9.88a3 3 0 1 0 4.24 4.24"
}), /*#__PURE__*/_jsx("path", {
d: "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"
}), /*#__PURE__*/_jsx("path", {
d: "M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"
}), /*#__PURE__*/_jsx("line", {
x1: "2",
x2: "22",
y1: "2",
y2: "22"
})]
}), 'VisibilityOff');
export const GridViewColumnIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("rect", {
width: "6",
height: "20",
x: "4",
y: "2",
rx: "2"
}), /*#__PURE__*/_jsx("rect", {
width: "6",
height: "20",
x: "14",
y: "2",
rx: "2"
})]
}), 'ViewColumn');
export const GridClearIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("path", {
d: "m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21"
}), /*#__PURE__*/_jsx("path", {
d: "M22 21H7"
}), /*#__PURE__*/_jsx("path", {
d: "m5 11 9 9"
})]
}), 'Clear');
export const GridDeleteIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("path", {
d: "M3 6h18"
}), /*#__PURE__*/_jsx("path", {
d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"
}), /*#__PURE__*/_jsx("path", {
d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
}), /*#__PURE__*/_jsx("line", {
x1: "10",
x2: "10",
y1: "11",
y2: "17"
}), /*#__PURE__*/_jsx("line", {
x1: "14",
x2: "14",
y1: "11",
y2: "17"
})]
}), 'Delete');
export const GridDeleteForeverIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsx("path", {
d: "M3 6h18"
}), /*#__PURE__*/_jsx("path", {
d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"
}), /*#__PURE__*/_jsx("path", {
d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
}), /*#__PURE__*/_jsx("line", {
x1: "10",
x2: "10",
y1: "11",
y2: "17"
}), /*#__PURE__*/_jsx("line", {
x1: "14",
x2: "14",
y1: "11",
y2: "17"
})]
}), 'Delete');
const GridColumnUnsortedIcon = /*#__PURE__*/React.memo(function GridColumnHeaderSortIcon(props) {
const {
sortingOrder
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded2);
const rootProps = useGridRootProps();
const [nextSortDirection] = sortingOrder;
const Icon = nextSortDirection === 'asc' ? rootProps.slots.columnSortedAscendingIcon : rootProps.slots.columnSortedDescendingIcon;
return Icon ? /*#__PURE__*/_jsx(Icon, _extends({}, other)) : null;
});
const joyIconSlots = {
booleanCellTrueIcon: GridCheckIcon,
booleanCellFalseIcon: GridCloseIcon,
columnMenuIcon: GridTripleDotsVerticalIcon,
openFilterButtonIcon: GridFilterListIcon,
filterPanelDeleteIcon: GridCloseIcon,
columnFilteredIcon: GridFilterAltIcon,
columnSelectorIcon: GridColumnIcon,
columnUnsortedIcon: GridColumnUnsortedIcon,
columnSortedAscendingIcon: GridArrowUpwardIcon,
columnSortedDescendingIcon: GridArrowDownwardIcon,
columnResizeIcon: GridSeparatorIcon,
densityCompactIcon: GridViewHeadlineIcon,
densityStandardIcon: GridTableRowsIcon,
densityComfortableIcon: GridViewStreamIcon,
exportIcon: GridSaveAltIcon,
moreActionsIcon: GridMoreVertIcon,
treeDataCollapseIcon: GridExpandMoreIcon,
treeDataExpandIcon: GridKeyboardArrowRight,
groupingCriteriaCollapseIcon: GridExpandMoreIcon,
groupingCriteriaExpandIcon: GridKeyboardArrowRight,
detailPanelExpandIcon: GridAddIcon,
detailPanelCollapseIcon: GridRemoveIcon,
rowReorderIcon: GridDragIcon,
quickFilterIcon: GridSearchIcon,
quickFilterClearIcon: GridCloseIcon,
columnMenuHideIcon: GridVisibilityOffIcon,
columnMenuSortAscendingIcon: GridArrowUpwardIcon,
columnMenuSortDescendingIcon: GridArrowDownwardIcon,
columnMenuFilterIcon: GridFilterAltIcon,
columnMenuManageColumnsIcon: GridViewColumnIcon,
columnMenuClearIcon: GridClearIcon,
loadIcon: GridLoadIcon,
filterPanelAddIcon: GridAddIcon,
filterPanelRemoveAllIcon: GridDeleteForeverIcon,
columnReorderIcon: GridDragIcon
};
export default joyIconSlots;

View File

@@ -0,0 +1,2 @@
import joySlots from './joySlots';
export { joySlots as unstable_joySlots };

View File

@@ -0,0 +1,406 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["touchRippleRef", "inputProps", "onChange", "color", "size", "checked", "sx", "value", "inputRef"],
_excluded2 = ["onChange", "label", "placeholder", "value", "inputRef", "type", "size", "variant"],
_excluded3 = ["startIcon", "color", "endIcon", "size", "sx", "variant"],
_excluded4 = ["color", "size", "sx", "touchRippleRef"],
_excluded5 = ["name", "checkedIcon", "color", "disableRipple", "disableFocusRipple", "disableTouchRipple", "edge", "icon", "inputProps", "inputRef", "size", "sx", "onChange", "onClick"],
_excluded6 = ["open", "onOpen", "value", "onChange", "size", "color", "variant", "inputProps", "MenuProps", "inputRef", "error", "native", "fullWidth", "labelId"],
_excluded7 = ["native"],
_excluded8 = ["shrink", "variant", "sx"];
import * as React from 'react';
import JoyCheckbox from '@mui/joy/Checkbox';
import JoyInput from '@mui/joy/Input';
import JoyFormControl from '@mui/joy/FormControl';
import JoyFormLabel from '@mui/joy/FormLabel';
import JoyButton from '@mui/joy/Button';
import JoyIconButton from '@mui/joy/IconButton';
import JoySwitch from '@mui/joy/Switch';
import JoySelect from '@mui/joy/Select';
import JoyOption from '@mui/joy/Option';
import JoyBox from '@mui/joy/Box';
import JoyTypography from '@mui/joy/Typography';
import JoyCircularProgress from '@mui/joy/CircularProgress';
import JoyTooltip from '@mui/joy/Tooltip';
import { unstable_useForkRef as useForkRef } from '@mui/utils';
import joyIconSlots, { GridKeyboardArrowRight, GridKeyboardArrowLeft } from './icons';
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
import { gridFilteredTopLevelRowCountSelector, gridPaginationModelSelector } from '../hooks';
import { GridOverlay } from '../components/containers/GridOverlay';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
function convertColor(color) {
if (color === 'secondary') {
return 'primary';
}
if (color === 'error') {
return 'danger';
}
if (color === 'default' || color === 'inherit') {
return 'neutral';
}
return color;
}
function convertSize(size) {
return size ? {
small: 'sm',
medium: 'md',
large: 'lg'
}[size] : size;
}
function convertVariant(variant, defaultVariant = 'plain') {
if (!variant) {
return defaultVariant;
}
return {
standard: 'outlined',
outlined: 'outlined',
contained: 'solid',
text: 'plain',
filled: 'soft'
}[variant] || defaultVariant;
}
const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
let {
inputProps,
onChange,
checked,
inputRef
} = _ref,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
return /*#__PURE__*/_jsx(JoyCheckbox, _extends({}, props, {
slotProps: {
input: _extends({}, inputProps, {
ref: inputRef
})
},
ref: ref,
checked: checked,
onChange: onChange
}));
});
const TextField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
let {
onChange,
label,
placeholder,
value,
inputRef,
type,
size,
variant
} = _ref2,
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
const rootRef = useForkRef(ref, props.InputProps?.ref);
const inputForkRef = useForkRef(inputRef, props?.inputProps?.ref);
const {
startAdornment,
endAdornment
} = props.InputProps || {};
return /*#__PURE__*/_jsxs(JoyFormControl, {
ref: rootRef,
children: [/*#__PURE__*/_jsx(JoyFormLabel, {
children: label
}), /*#__PURE__*/_jsx(JoyInput, {
type: type,
value: value,
onChange: onChange,
placeholder: placeholder,
variant: convertVariant(variant, 'outlined'),
size: convertSize(size),
slotProps: {
input: _extends({}, props?.inputProps, {
ref: inputForkRef
})
},
startDecorator: startAdornment,
endDecorator: endAdornment
})]
});
});
const Button = /*#__PURE__*/React.forwardRef(function Button(_ref3, ref) {
let {
startIcon,
color,
endIcon,
size,
sx,
variant
} = _ref3,
props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
return /*#__PURE__*/_jsx(JoyButton, _extends({}, props, {
size: convertSize(size),
color: convertColor(color),
variant: convertVariant(variant),
ref: ref,
startDecorator: startIcon,
endDecorator: endIcon,
sx: sx
}));
});
const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref4, ref) {
let {
color,
size,
sx
} = _ref4,
props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
return /*#__PURE__*/_jsx(JoyIconButton, _extends({}, props, {
size: convertSize(size),
color: convertColor(color) ?? 'neutral',
variant: "plain",
ref: ref,
sx: sx
}));
});
const Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref5, ref) {
let {
name,
color: colorProp,
edge,
icon,
inputProps,
inputRef,
size,
sx,
onChange,
onClick
} = _ref5,
props = _objectWithoutPropertiesLoose(_ref5, _excluded5);
return /*#__PURE__*/_jsx(JoySwitch, _extends({}, props, {
onChange: onChange,
size: convertSize(size),
color: convertColor(colorProp),
ref: ref,
slotProps: {
input: _extends({}, inputProps, {
name,
onClick: onClick,
ref: inputRef
}),
thumb: {
children: icon
}
},
sx: [_extends({}, edge === 'start' && {
ml: '-8px'
}, edge === 'end' && {
mr: '-8px'
}), ...(Array.isArray(sx) ? sx : [sx])]
}));
});
const Select = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
let {
open,
onOpen,
value,
onChange,
size,
color,
variant,
MenuProps,
inputRef,
labelId
} = _ref6,
props = _objectWithoutPropertiesLoose(_ref6, _excluded6);
const handleChange = (event, newValue) => {
if (event && onChange) {
// Same as in https://github.com/mui/material-ui/blob/e5558282a8f36856aef1299f3a36f3235e92e770/packages/mui-material/src/Select/SelectInput.js#L288-L300
// Redefine target to allow name and value to be read.
// This allows seamless integration with the most popular form libraries.
// https://github.com/mui/material-ui/issues/13485#issuecomment-676048492
// Clone the event to not override `target` of the original event.
const nativeEvent = event.nativeEvent || event;
// @ts-ignore The nativeEvent is function, not object
const clonedEvent = new nativeEvent.constructor(nativeEvent.type, nativeEvent);
Object.defineProperty(clonedEvent, 'target', {
writable: true,
value: {
value: newValue,
name: props.name
}
});
onChange(clonedEvent, null);
}
};
return /*#__PURE__*/_jsx(JoySelect, _extends({}, props, {
listboxOpen: open,
onListboxOpenChange: isOpen => {
if (isOpen) {
onOpen?.({});
} else {
MenuProps?.onClose?.({}, undefined);
}
},
size: convertSize(size),
color: convertColor(color),
variant: convertVariant(variant, 'outlined'),
ref: ref,
value: value,
onChange: handleChange,
slotProps: {
button: {
'aria-labelledby': labelId,
ref: inputRef
},
listbox: {
disablePortal: false,
sx: {
zIndex: 1350
}
}
}
}));
});
const Option = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
let props = _objectWithoutPropertiesLoose(_ref7, _excluded7);
return /*#__PURE__*/_jsx(JoyOption, _extends({}, props, {
ref: ref
}));
});
const InputLabel = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
let {
sx
} = _ref8,
props = _objectWithoutPropertiesLoose(_ref8, _excluded8);
return /*#__PURE__*/_jsx(JoyFormLabel, _extends({}, props, {
ref: ref,
sx: sx
}));
});
function labelDisplayedRows({
from,
to,
count
}) {
return `${from}${to} of ${count !== -1 ? count : `more than ${to}`}`;
}
const getLabelDisplayedRowsTo = ({
page,
pageSize,
rowCount
}) => {
if (rowCount === -1) {
return (page + 1) * pageSize;
}
return pageSize === -1 ? rowCount : Math.min(rowCount, (page + 1) * pageSize);
};
const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
const apiRef = useGridApiContext();
const rootProps = useGridRootProps();
const paginationModel = gridPaginationModelSelector(apiRef);
const visibleTopLevelRowCount = gridFilteredTopLevelRowCountSelector(apiRef);
const rowCount = React.useMemo(() => rootProps.rowCount ?? visibleTopLevelRowCount ?? 0, [rootProps.rowCount, visibleTopLevelRowCount]);
const lastPage = React.useMemo(() => Math.floor(rowCount / (paginationModel.pageSize || 1)), [rowCount, paginationModel.pageSize]);
const handlePageChange = React.useCallback(page => {
apiRef.current.setPage(page);
}, [apiRef]);
const page = paginationModel.page <= lastPage ? paginationModel.page : lastPage;
const pageSize = paginationModel.pageSize;
const isPageSizeIncludedInPageSizeOptions = () => {
for (let i = 0; i < rootProps.pageSizeOptions.length; i += 1) {
const option = rootProps.pageSizeOptions[i];
if (typeof option === 'number') {
if (option === pageSize) {
return true;
}
} else if (option.value === pageSize) {
return true;
}
}
return false;
};
const pageSizeOptions = isPageSizeIncludedInPageSizeOptions() ? rootProps.pageSizeOptions : [];
const handleChangeRowsPerPage = (event, newValue) => {
const newPageSize = Number(newValue);
apiRef.current.setPageSize(newPageSize);
};
return /*#__PURE__*/_jsxs(JoyBox, {
sx: {
display: 'flex',
alignItems: 'center',
gap: 2,
justifyContent: 'flex-end',
px: 2
},
ref: ref,
children: [/*#__PURE__*/_jsxs(JoyFormControl, {
orientation: "horizontal",
size: "sm",
children: [/*#__PURE__*/_jsx(JoyFormLabel, {
children: "Rows per page:"
}), /*#__PURE__*/_jsx(JoySelect, {
onChange: handleChangeRowsPerPage,
value: pageSize,
children: pageSizeOptions.map(option => {
return /*#__PURE__*/_jsx(Option, {
value: typeof option !== 'number' && option.value ? option.value : option,
children: typeof option !== 'number' && option.label ? option.label : `${option}`
}, typeof option !== 'number' && option.label ? option.label : `${option}`);
})
})]
}), /*#__PURE__*/_jsx(JoyTypography, {
textAlign: "center",
fontSize: "xs",
fontWeight: "md",
children: labelDisplayedRows({
from: rowCount === 0 ? 0 : page * pageSize + 1,
to: getLabelDisplayedRowsTo({
page,
pageSize,
rowCount
}),
count: rowCount === -1 ? -1 : rowCount
})
}), /*#__PURE__*/_jsxs(JoyBox, {
sx: {
display: 'flex',
gap: 0.5
},
children: [/*#__PURE__*/_jsx(JoyIconButton, {
size: "sm",
color: "neutral",
variant: "outlined",
disabled: page === 0,
onClick: () => handlePageChange(page - 1),
sx: {
bgcolor: 'background.surface'
},
children: /*#__PURE__*/_jsx(GridKeyboardArrowLeft, {})
}), /*#__PURE__*/_jsx(JoyIconButton, {
size: "sm",
color: "neutral",
variant: "outlined",
disabled: rowCount !== -1 ? page >= Math.ceil(rowCount / pageSize) - 1 : false,
onClick: () => handlePageChange(page + 1),
sx: {
bgcolor: 'background.surface'
},
children: /*#__PURE__*/_jsx(GridKeyboardArrowRight, {})
})]
})]
});
});
const LoadingOverlay = /*#__PURE__*/React.forwardRef((props, ref) => {
return /*#__PURE__*/_jsx(GridOverlay, _extends({}, props, {
ref: ref,
children: /*#__PURE__*/_jsx(JoyCircularProgress, {})
}));
});
const joySlots = _extends({}, joyIconSlots, {
baseCheckbox: Checkbox,
baseTextField: TextField,
baseButton: Button,
baseIconButton: IconButton,
baseSwitch: Switch,
baseSelect: Select,
baseSelectOption: Option,
baseInputLabel: InputLabel,
baseFormControl: JoyFormControl,
baseTooltip: JoyTooltip,
pagination: Pagination,
loadingOverlay: LoadingOverlay
});
export default joySlots;