paradiego
This commit is contained in:
188
node_modules/@mui/material/TablePagination/TablePagination.d.ts
generated
vendored
Normal file
188
node_modules/@mui/material/TablePagination/TablePagination.d.ts
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
import * as React from 'react';
|
||||
import { SxProps } from '@mui/system';
|
||||
import { Theme } from '../styles';
|
||||
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
|
||||
import { TablePaginationActionsProps } from './TablePaginationActions';
|
||||
import { TableCellProps } from '../TableCell';
|
||||
import { IconButtonProps } from '../IconButton';
|
||||
import { SelectProps } from '../Select';
|
||||
import { TablePaginationClasses } from './tablePaginationClasses';
|
||||
|
||||
export interface LabelDisplayedRowsArgs {
|
||||
from: number;
|
||||
to: number;
|
||||
count: number;
|
||||
page: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is kept for compatibility. Use `TablePaginationOwnProps` instead.
|
||||
*/
|
||||
export type TablePaginationBaseProps = Omit<TableCellProps, 'classes' | 'component' | 'children'>;
|
||||
|
||||
export interface TablePaginationOwnProps extends TablePaginationBaseProps {
|
||||
/**
|
||||
* The component used for displaying the actions.
|
||||
* Either a string to use a HTML element or a component.
|
||||
* @default TablePaginationActions
|
||||
*/
|
||||
ActionsComponent?: React.ElementType<TablePaginationActionsProps>;
|
||||
/**
|
||||
* Props applied to the back arrow [`IconButton`](https://mui.com/material-ui/api/icon-button/) component.
|
||||
*
|
||||
* This prop is an alias for `slotProps.actions.previousButton` and will be overriden by it if both are used.
|
||||
* @deprecated Use `slotProps.actions.previousButton` instead.
|
||||
*/
|
||||
backIconButtonProps?: Partial<IconButtonProps>;
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes?: Partial<TablePaginationClasses>;
|
||||
/**
|
||||
* The total number of rows.
|
||||
*
|
||||
* To enable server side pagination for an unknown number of items, provide -1.
|
||||
*/
|
||||
count: number;
|
||||
/**
|
||||
* If `true`, the component is disabled.
|
||||
* @default false
|
||||
*/
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* Accepts a function which returns a string value that provides a user-friendly name for the current page.
|
||||
* This is important for screen reader users.
|
||||
*
|
||||
* For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/).
|
||||
* @param {string} type The link or button type to format ('first' | 'last' | 'next' | 'previous').
|
||||
* @returns {string}
|
||||
* @default function defaultGetAriaLabel(type) {
|
||||
* return `Go to ${type} page`;
|
||||
* }
|
||||
*/
|
||||
getItemAriaLabel?: (type: 'first' | 'last' | 'next' | 'previous') => string;
|
||||
/**
|
||||
* Customize the displayed rows label. Invoked with a `{ from, to, count, page }`
|
||||
* object.
|
||||
*
|
||||
* For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/).
|
||||
* @default function defaultLabelDisplayedRows({ from, to, count }) {
|
||||
* return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;
|
||||
* }
|
||||
*/
|
||||
labelDisplayedRows?: (paginationInfo: LabelDisplayedRowsArgs) => React.ReactNode;
|
||||
/**
|
||||
* Customize the rows per page label.
|
||||
*
|
||||
* For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/).
|
||||
* @default 'Rows per page:'
|
||||
*/
|
||||
labelRowsPerPage?: React.ReactNode;
|
||||
/**
|
||||
* Props applied to the next arrow [`IconButton`](https://mui.com/material-ui/api/icon-button/) element.
|
||||
*
|
||||
* This prop is an alias for `slotProps.actions.nextButton` and will be overriden by it if both are used.
|
||||
* @deprecated Use `slotProps.actions.nextButton` instead.
|
||||
*/
|
||||
nextIconButtonProps?: Partial<IconButtonProps>;
|
||||
/**
|
||||
* Callback fired when the page is changed.
|
||||
*
|
||||
* @param {React.MouseEvent<HTMLButtonElement> | null} event The event source of the callback.
|
||||
* @param {number} page The page selected.
|
||||
*/
|
||||
onPageChange: (event: React.MouseEvent<HTMLButtonElement> | null, page: number) => void;
|
||||
/**
|
||||
* Callback fired when the number of rows per page is changed.
|
||||
*
|
||||
* @param {React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>} event The event source of the callback.
|
||||
*/
|
||||
onRowsPerPageChange?: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
|
||||
/**
|
||||
* The zero-based index of the current page.
|
||||
*/
|
||||
page: number;
|
||||
/**
|
||||
* The number of rows per page.
|
||||
*
|
||||
* Set -1 to display all the rows.
|
||||
*/
|
||||
rowsPerPage: number;
|
||||
/**
|
||||
* Customizes the options of the rows per page select field. If less than two options are
|
||||
* available, no select field will be displayed.
|
||||
* Use -1 for the value with a custom label to show all the rows.
|
||||
* @default [10, 25, 50, 100]
|
||||
*/
|
||||
rowsPerPageOptions?: ReadonlyArray<number | { value: number; label: string }>;
|
||||
/**
|
||||
* Props applied to the rows per page [`Select`](https://mui.com/material-ui/api/select/) element.
|
||||
*
|
||||
* This prop is an alias for `slotProps.select` and will be overriden by it if both are used.
|
||||
* @deprecated Use `slotProps.select` instead.
|
||||
*
|
||||
* @default {}
|
||||
*/
|
||||
SelectProps?: Partial<SelectProps>;
|
||||
/**
|
||||
* If `true`, show the first-page button.
|
||||
* @default false
|
||||
*/
|
||||
showFirstButton?: boolean;
|
||||
/**
|
||||
* If `true`, show the last-page button.
|
||||
* @default false
|
||||
*/
|
||||
showLastButton?: boolean;
|
||||
/**
|
||||
* The props used for each slot inside the TablePagination.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps?: {
|
||||
actions?: TablePaginationActionsProps['slotProps'];
|
||||
select?: Partial<SelectProps>;
|
||||
};
|
||||
/**
|
||||
* The components used for each slot inside the TablePagination.
|
||||
* Either a string to use a HTML element or a component.
|
||||
* @default {}
|
||||
*/
|
||||
slots?: {
|
||||
actions?: TablePaginationActionsProps['slots'];
|
||||
};
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx?: SxProps<Theme>;
|
||||
}
|
||||
|
||||
export interface TablePaginationTypeMap<AdditionalProps, RootComponent extends React.ElementType> {
|
||||
props: AdditionalProps & TablePaginationOwnProps;
|
||||
defaultComponent: RootComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* A `TableCell` based component for placing inside `TableFooter` for pagination.
|
||||
*
|
||||
* Demos:
|
||||
*
|
||||
* - [Pagination](https://mui.com/material-ui/react-pagination/)
|
||||
* - [Table](https://mui.com/material-ui/react-table/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [TablePagination API](https://mui.com/material-ui/api/table-pagination/)
|
||||
* - inherits [TableCell API](https://mui.com/material-ui/api/table-cell/)
|
||||
*/
|
||||
declare const TablePagination: OverridableComponent<
|
||||
TablePaginationTypeMap<{}, React.JSXElementConstructor<TablePaginationBaseProps>>
|
||||
>;
|
||||
|
||||
export type TablePaginationProps<
|
||||
RootComponent extends React.ElementType = React.JSXElementConstructor<TablePaginationBaseProps>,
|
||||
AdditionalProps = {},
|
||||
> = OverrideProps<TablePaginationTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|
||||
component?: React.ElementType;
|
||||
};
|
||||
|
||||
export default TablePagination;
|
||||
449
node_modules/@mui/material/TablePagination/TablePagination.js
generated
vendored
Normal file
449
node_modules/@mui/material/TablePagination/TablePagination.js
generated
vendored
Normal file
@@ -0,0 +1,449 @@
|
||||
'use client';
|
||||
|
||||
var _InputBase;
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import clsx from 'clsx';
|
||||
import integerPropType from '@mui/utils/integerPropType';
|
||||
import chainPropTypes from '@mui/utils/chainPropTypes';
|
||||
import composeClasses from '@mui/utils/composeClasses';
|
||||
import isHostComponent from "../utils/isHostComponent.js";
|
||||
import { styled } from "../zero-styled/index.js";
|
||||
import memoTheme from "../utils/memoTheme.js";
|
||||
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
||||
import InputBase from "../InputBase/index.js";
|
||||
import MenuItem from "../MenuItem/index.js";
|
||||
import Select from "../Select/index.js";
|
||||
import TableCell from "../TableCell/index.js";
|
||||
import Toolbar from "../Toolbar/index.js";
|
||||
import TablePaginationActions from "./TablePaginationActions.js";
|
||||
import useId from "../utils/useId.js";
|
||||
import tablePaginationClasses, { getTablePaginationUtilityClass } from "./tablePaginationClasses.js";
|
||||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
||||
import { createElement as _createElement } from "react";
|
||||
const TablePaginationRoot = styled(TableCell, {
|
||||
name: 'MuiTablePagination',
|
||||
slot: 'Root',
|
||||
overridesResolver: (props, styles) => styles.root
|
||||
})(memoTheme(({
|
||||
theme
|
||||
}) => ({
|
||||
overflow: 'auto',
|
||||
color: (theme.vars || theme).palette.text.primary,
|
||||
fontSize: theme.typography.pxToRem(14),
|
||||
// Increase the specificity to override TableCell.
|
||||
'&:last-child': {
|
||||
padding: 0
|
||||
}
|
||||
})));
|
||||
const TablePaginationToolbar = styled(Toolbar, {
|
||||
name: 'MuiTablePagination',
|
||||
slot: 'Toolbar',
|
||||
overridesResolver: (props, styles) => ({
|
||||
[`& .${tablePaginationClasses.actions}`]: styles.actions,
|
||||
...styles.toolbar
|
||||
})
|
||||
})(memoTheme(({
|
||||
theme
|
||||
}) => ({
|
||||
minHeight: 52,
|
||||
paddingRight: 2,
|
||||
[`${theme.breakpoints.up('xs')} and (orientation: landscape)`]: {
|
||||
minHeight: 52
|
||||
},
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
minHeight: 52,
|
||||
paddingRight: 2
|
||||
},
|
||||
[`& .${tablePaginationClasses.actions}`]: {
|
||||
flexShrink: 0,
|
||||
marginLeft: 20
|
||||
}
|
||||
})));
|
||||
const TablePaginationSpacer = styled('div', {
|
||||
name: 'MuiTablePagination',
|
||||
slot: 'Spacer',
|
||||
overridesResolver: (props, styles) => styles.spacer
|
||||
})({
|
||||
flex: '1 1 100%'
|
||||
});
|
||||
const TablePaginationSelectLabel = styled('p', {
|
||||
name: 'MuiTablePagination',
|
||||
slot: 'SelectLabel',
|
||||
overridesResolver: (props, styles) => styles.selectLabel
|
||||
})(memoTheme(({
|
||||
theme
|
||||
}) => ({
|
||||
...theme.typography.body2,
|
||||
flexShrink: 0
|
||||
})));
|
||||
const TablePaginationSelect = styled(Select, {
|
||||
name: 'MuiTablePagination',
|
||||
slot: 'Select',
|
||||
overridesResolver: (props, styles) => ({
|
||||
[`& .${tablePaginationClasses.selectIcon}`]: styles.selectIcon,
|
||||
[`& .${tablePaginationClasses.select}`]: styles.select,
|
||||
...styles.input,
|
||||
...styles.selectRoot
|
||||
})
|
||||
})({
|
||||
color: 'inherit',
|
||||
fontSize: 'inherit',
|
||||
flexShrink: 0,
|
||||
marginRight: 32,
|
||||
marginLeft: 8,
|
||||
[`& .${tablePaginationClasses.select}`]: {
|
||||
paddingLeft: 8,
|
||||
paddingRight: 24,
|
||||
textAlign: 'right',
|
||||
textAlignLast: 'right' // Align <select> on Chrome.
|
||||
}
|
||||
});
|
||||
const TablePaginationMenuItem = styled(MenuItem, {
|
||||
name: 'MuiTablePagination',
|
||||
slot: 'MenuItem',
|
||||
overridesResolver: (props, styles) => styles.menuItem
|
||||
})({});
|
||||
const TablePaginationDisplayedRows = styled('p', {
|
||||
name: 'MuiTablePagination',
|
||||
slot: 'DisplayedRows',
|
||||
overridesResolver: (props, styles) => styles.displayedRows
|
||||
})(memoTheme(({
|
||||
theme
|
||||
}) => ({
|
||||
...theme.typography.body2,
|
||||
flexShrink: 0
|
||||
})));
|
||||
function defaultLabelDisplayedRows({
|
||||
from,
|
||||
to,
|
||||
count
|
||||
}) {
|
||||
return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;
|
||||
}
|
||||
function defaultGetAriaLabel(type) {
|
||||
return `Go to ${type} page`;
|
||||
}
|
||||
const useUtilityClasses = ownerState => {
|
||||
const {
|
||||
classes
|
||||
} = ownerState;
|
||||
const slots = {
|
||||
root: ['root'],
|
||||
toolbar: ['toolbar'],
|
||||
spacer: ['spacer'],
|
||||
selectLabel: ['selectLabel'],
|
||||
select: ['select'],
|
||||
input: ['input'],
|
||||
selectIcon: ['selectIcon'],
|
||||
menuItem: ['menuItem'],
|
||||
displayedRows: ['displayedRows'],
|
||||
actions: ['actions']
|
||||
};
|
||||
return composeClasses(slots, getTablePaginationUtilityClass, classes);
|
||||
};
|
||||
|
||||
/**
|
||||
* A `TableCell` based component for placing inside `TableFooter` for pagination.
|
||||
*/
|
||||
const TablePagination = /*#__PURE__*/React.forwardRef(function TablePagination(inProps, ref) {
|
||||
const props = useDefaultProps({
|
||||
props: inProps,
|
||||
name: 'MuiTablePagination'
|
||||
});
|
||||
const {
|
||||
ActionsComponent = TablePaginationActions,
|
||||
backIconButtonProps,
|
||||
className,
|
||||
colSpan: colSpanProp,
|
||||
component = TableCell,
|
||||
count,
|
||||
disabled = false,
|
||||
getItemAriaLabel = defaultGetAriaLabel,
|
||||
labelDisplayedRows = defaultLabelDisplayedRows,
|
||||
labelRowsPerPage = 'Rows per page:',
|
||||
nextIconButtonProps,
|
||||
onPageChange,
|
||||
onRowsPerPageChange,
|
||||
page,
|
||||
rowsPerPage,
|
||||
rowsPerPageOptions = [10, 25, 50, 100],
|
||||
SelectProps = {},
|
||||
showFirstButton = false,
|
||||
showLastButton = false,
|
||||
slotProps = {},
|
||||
slots = {},
|
||||
...other
|
||||
} = props;
|
||||
const ownerState = props;
|
||||
const classes = useUtilityClasses(ownerState);
|
||||
const selectProps = slotProps?.select ?? SelectProps;
|
||||
const MenuItemComponent = selectProps.native ? 'option' : TablePaginationMenuItem;
|
||||
let colSpan;
|
||||
if (component === TableCell || component === 'td') {
|
||||
colSpan = colSpanProp || 1000; // col-span over everything
|
||||
}
|
||||
const selectId = useId(selectProps.id);
|
||||
const labelId = useId(selectProps.labelId);
|
||||
const getLabelDisplayedRowsTo = () => {
|
||||
if (count === -1) {
|
||||
return (page + 1) * rowsPerPage;
|
||||
}
|
||||
return rowsPerPage === -1 ? count : Math.min(count, (page + 1) * rowsPerPage);
|
||||
};
|
||||
return /*#__PURE__*/_jsx(TablePaginationRoot, {
|
||||
colSpan: colSpan,
|
||||
ref: ref,
|
||||
as: component,
|
||||
ownerState: ownerState,
|
||||
className: clsx(classes.root, className),
|
||||
...other,
|
||||
children: /*#__PURE__*/_jsxs(TablePaginationToolbar, {
|
||||
className: classes.toolbar,
|
||||
children: [/*#__PURE__*/_jsx(TablePaginationSpacer, {
|
||||
className: classes.spacer
|
||||
}), rowsPerPageOptions.length > 1 && /*#__PURE__*/_jsx(TablePaginationSelectLabel, {
|
||||
className: classes.selectLabel,
|
||||
id: labelId,
|
||||
children: labelRowsPerPage
|
||||
}), rowsPerPageOptions.length > 1 && /*#__PURE__*/_jsx(TablePaginationSelect, {
|
||||
variant: "standard",
|
||||
...(!selectProps.variant && {
|
||||
input: _InputBase || (_InputBase = /*#__PURE__*/_jsx(InputBase, {}))
|
||||
}),
|
||||
value: rowsPerPage,
|
||||
onChange: onRowsPerPageChange,
|
||||
id: selectId,
|
||||
labelId: labelId,
|
||||
...selectProps,
|
||||
classes: {
|
||||
...selectProps.classes,
|
||||
// TODO v5 remove `classes.input`
|
||||
root: clsx(classes.input, classes.selectRoot, (selectProps.classes || {}).root),
|
||||
select: clsx(classes.select, (selectProps.classes || {}).select),
|
||||
// TODO v5 remove `selectIcon`
|
||||
icon: clsx(classes.selectIcon, (selectProps.classes || {}).icon)
|
||||
},
|
||||
disabled: disabled,
|
||||
children: rowsPerPageOptions.map(rowsPerPageOption => /*#__PURE__*/_createElement(MenuItemComponent, {
|
||||
...(!isHostComponent(MenuItemComponent) && {
|
||||
ownerState
|
||||
}),
|
||||
className: classes.menuItem,
|
||||
key: rowsPerPageOption.label ? rowsPerPageOption.label : rowsPerPageOption,
|
||||
value: rowsPerPageOption.value ? rowsPerPageOption.value : rowsPerPageOption
|
||||
}, rowsPerPageOption.label ? rowsPerPageOption.label : rowsPerPageOption))
|
||||
}), /*#__PURE__*/_jsx(TablePaginationDisplayedRows, {
|
||||
className: classes.displayedRows,
|
||||
children: labelDisplayedRows({
|
||||
from: count === 0 ? 0 : page * rowsPerPage + 1,
|
||||
to: getLabelDisplayedRowsTo(),
|
||||
count: count === -1 ? -1 : count,
|
||||
page
|
||||
})
|
||||
}), /*#__PURE__*/_jsx(ActionsComponent, {
|
||||
className: classes.actions,
|
||||
backIconButtonProps: backIconButtonProps,
|
||||
count: count,
|
||||
nextIconButtonProps: nextIconButtonProps,
|
||||
onPageChange: onPageChange,
|
||||
page: page,
|
||||
rowsPerPage: rowsPerPage,
|
||||
showFirstButton: showFirstButton,
|
||||
showLastButton: showLastButton,
|
||||
slotProps: slotProps.actions,
|
||||
slots: slots.actions,
|
||||
getItemAriaLabel: getItemAriaLabel,
|
||||
disabled: disabled
|
||||
})]
|
||||
})
|
||||
});
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* The component used for displaying the actions.
|
||||
* Either a string to use a HTML element or a component.
|
||||
* @default TablePaginationActions
|
||||
*/
|
||||
ActionsComponent: PropTypes.elementType,
|
||||
/**
|
||||
* Props applied to the back arrow [`IconButton`](https://mui.com/material-ui/api/icon-button/) component.
|
||||
*
|
||||
* This prop is an alias for `slotProps.actions.previousButton` and will be overriden by it if both are used.
|
||||
* @deprecated Use `slotProps.actions.previousButton` instead.
|
||||
*/
|
||||
backIconButtonProps: PropTypes.object,
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
colSpan: PropTypes.number,
|
||||
/**
|
||||
* The component used for the root node.
|
||||
* Either a string to use a HTML element or a component.
|
||||
*/
|
||||
component: PropTypes.elementType,
|
||||
/**
|
||||
* The total number of rows.
|
||||
*
|
||||
* To enable server side pagination for an unknown number of items, provide -1.
|
||||
*/
|
||||
count: integerPropType.isRequired,
|
||||
/**
|
||||
* If `true`, the component is disabled.
|
||||
* @default false
|
||||
*/
|
||||
disabled: PropTypes.bool,
|
||||
/**
|
||||
* Accepts a function which returns a string value that provides a user-friendly name for the current page.
|
||||
* This is important for screen reader users.
|
||||
*
|
||||
* For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/).
|
||||
* @param {string} type The link or button type to format ('first' | 'last' | 'next' | 'previous').
|
||||
* @returns {string}
|
||||
* @default function defaultGetAriaLabel(type) {
|
||||
* return `Go to ${type} page`;
|
||||
* }
|
||||
*/
|
||||
getItemAriaLabel: PropTypes.func,
|
||||
/**
|
||||
* Customize the displayed rows label. Invoked with a `{ from, to, count, page }`
|
||||
* object.
|
||||
*
|
||||
* For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/).
|
||||
* @default function defaultLabelDisplayedRows({ from, to, count }) {
|
||||
* return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;
|
||||
* }
|
||||
*/
|
||||
labelDisplayedRows: PropTypes.func,
|
||||
/**
|
||||
* Customize the rows per page label.
|
||||
*
|
||||
* For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/).
|
||||
* @default 'Rows per page:'
|
||||
*/
|
||||
labelRowsPerPage: PropTypes.node,
|
||||
/**
|
||||
* Props applied to the next arrow [`IconButton`](https://mui.com/material-ui/api/icon-button/) element.
|
||||
*
|
||||
* This prop is an alias for `slotProps.actions.nextButton` and will be overriden by it if both are used.
|
||||
* @deprecated Use `slotProps.actions.nextButton` instead.
|
||||
*/
|
||||
nextIconButtonProps: PropTypes.object,
|
||||
/**
|
||||
* Callback fired when the page is changed.
|
||||
*
|
||||
* @param {React.MouseEvent<HTMLButtonElement> | null} event The event source of the callback.
|
||||
* @param {number} page The page selected.
|
||||
*/
|
||||
onPageChange: PropTypes.func.isRequired,
|
||||
/**
|
||||
* Callback fired when the number of rows per page is changed.
|
||||
*
|
||||
* @param {React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>} event The event source of the callback.
|
||||
*/
|
||||
onRowsPerPageChange: PropTypes.func,
|
||||
/**
|
||||
* The zero-based index of the current page.
|
||||
*/
|
||||
page: chainPropTypes(integerPropType.isRequired, props => {
|
||||
const {
|
||||
count,
|
||||
page,
|
||||
rowsPerPage
|
||||
} = props;
|
||||
if (count === -1) {
|
||||
return null;
|
||||
}
|
||||
const newLastPage = Math.max(0, Math.ceil(count / rowsPerPage) - 1);
|
||||
if (page < 0 || page > newLastPage) {
|
||||
return new Error('MUI: The page prop of a TablePagination is out of range ' + `(0 to ${newLastPage}, but page is ${page}).`);
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
/**
|
||||
* The number of rows per page.
|
||||
*
|
||||
* Set -1 to display all the rows.
|
||||
*/
|
||||
rowsPerPage: integerPropType.isRequired,
|
||||
/**
|
||||
* Customizes the options of the rows per page select field. If less than two options are
|
||||
* available, no select field will be displayed.
|
||||
* Use -1 for the value with a custom label to show all the rows.
|
||||
* @default [10, 25, 50, 100]
|
||||
*/
|
||||
rowsPerPageOptions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
||||
label: PropTypes.string.isRequired,
|
||||
value: PropTypes.number.isRequired
|
||||
})]).isRequired),
|
||||
/**
|
||||
* Props applied to the rows per page [`Select`](https://mui.com/material-ui/api/select/) element.
|
||||
*
|
||||
* This prop is an alias for `slotProps.select` and will be overriden by it if both are used.
|
||||
* @deprecated Use `slotProps.select` instead.
|
||||
*
|
||||
* @default {}
|
||||
*/
|
||||
SelectProps: PropTypes.object,
|
||||
/**
|
||||
* If `true`, show the first-page button.
|
||||
* @default false
|
||||
*/
|
||||
showFirstButton: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, show the last-page button.
|
||||
* @default false
|
||||
*/
|
||||
showLastButton: PropTypes.bool,
|
||||
/**
|
||||
* The props used for each slot inside the TablePagination.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: PropTypes.shape({
|
||||
actions: PropTypes.shape({
|
||||
firstButton: PropTypes.object,
|
||||
firstButtonIcon: PropTypes.object,
|
||||
lastButton: PropTypes.object,
|
||||
lastButtonIcon: PropTypes.object,
|
||||
nextButton: PropTypes.object,
|
||||
nextButtonIcon: PropTypes.object,
|
||||
previousButton: PropTypes.object,
|
||||
previousButtonIcon: PropTypes.object
|
||||
}),
|
||||
select: PropTypes.object
|
||||
}),
|
||||
/**
|
||||
* The components used for each slot inside the TablePagination.
|
||||
* Either a string to use a HTML element or a component.
|
||||
* @default {}
|
||||
*/
|
||||
slots: PropTypes.shape({
|
||||
actions: PropTypes.shape({
|
||||
firstButton: PropTypes.elementType,
|
||||
firstButtonIcon: PropTypes.elementType,
|
||||
lastButton: PropTypes.elementType,
|
||||
lastButtonIcon: PropTypes.elementType,
|
||||
nextButton: PropTypes.elementType,
|
||||
nextButtonIcon: PropTypes.elementType,
|
||||
previousButton: PropTypes.elementType,
|
||||
previousButtonIcon: PropTypes.elementType
|
||||
})
|
||||
}),
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
||||
} : void 0;
|
||||
export default TablePagination;
|
||||
98
node_modules/@mui/material/TablePagination/TablePaginationActions.d.ts
generated
vendored
Normal file
98
node_modules/@mui/material/TablePagination/TablePaginationActions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
import * as React from 'react';
|
||||
import { IconButtonProps } from '../IconButton/IconButton';
|
||||
import { SvgIconProps } from '../SvgIcon';
|
||||
|
||||
export interface TablePaginationActionsProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
/**
|
||||
* This prop is an alias for `slotProps.previousButton` and will be overriden by it if both are used.
|
||||
* @deprecated Use `slotProps.previousButton` instead.
|
||||
*/
|
||||
backIconButtonProps?: Partial<IconButtonProps>;
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes?: {};
|
||||
count: number;
|
||||
/**
|
||||
* If `true`, the component is disabled.
|
||||
* @default false
|
||||
*/
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* Accepts a function which returns a string value that provides a user-friendly name for the current page.
|
||||
* This is important for screen reader users.
|
||||
*
|
||||
* For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/).
|
||||
* @param {string} type The link or button type to format ('first' | 'last' | 'next' | 'previous').
|
||||
* @returns {string}
|
||||
*/
|
||||
getItemAriaLabel: (type: 'first' | 'last' | 'next' | 'previous') => string;
|
||||
/**
|
||||
* This prop is an alias for `slotProps.nextButton` and will be overriden by it if both are used.
|
||||
* @deprecated Use `slotProps.nextButton` instead.
|
||||
*/
|
||||
nextIconButtonProps?: Partial<IconButtonProps>;
|
||||
onPageChange: (event: React.MouseEvent<HTMLButtonElement> | null, page: number) => void;
|
||||
page: number;
|
||||
rowsPerPage: number;
|
||||
showFirstButton: boolean;
|
||||
showLastButton: boolean;
|
||||
slotProps?: {
|
||||
firstButton?: Partial<IconButtonProps>;
|
||||
lastButton?: Partial<IconButtonProps>;
|
||||
nextButton?: Partial<IconButtonProps>;
|
||||
previousButton?: Partial<IconButtonProps>;
|
||||
firstButtonIcon?: Partial<SvgIconProps>;
|
||||
lastButtonIcon?: Partial<SvgIconProps>;
|
||||
nextButtonIcon?: Partial<SvgIconProps>;
|
||||
previousButtonIcon?: Partial<SvgIconProps>;
|
||||
};
|
||||
slots?: TablePaginationActionsSlots;
|
||||
}
|
||||
|
||||
export interface TablePaginationActionsSlots {
|
||||
/**
|
||||
* The component that renders the first button.
|
||||
* @default IconButton
|
||||
*/
|
||||
firstButton?: React.ElementType;
|
||||
/**
|
||||
* The component that renders the last button.
|
||||
* @default IconButton
|
||||
*/
|
||||
lastButton?: React.ElementType;
|
||||
/**
|
||||
* The component that renders the next button.
|
||||
* @default IconButton
|
||||
*/
|
||||
nextButton?: React.ElementType;
|
||||
/**
|
||||
* The component that renders the previous button.
|
||||
* @default IconButton
|
||||
*/
|
||||
previousButton?: React.ElementType;
|
||||
/**
|
||||
* The component that renders the first button icon.
|
||||
* @default FirstPageIcon
|
||||
*/
|
||||
firstButtonIcon?: React.ElementType;
|
||||
/**
|
||||
* The component that renders the last button icon.
|
||||
* @default LastPageIcon
|
||||
*/
|
||||
lastButtonIcon?: React.ElementType;
|
||||
/**
|
||||
* The component that renders the next button icon.
|
||||
* @default KeyboardArrowRight
|
||||
*/
|
||||
nextButtonIcon?: React.ElementType;
|
||||
/**
|
||||
* The component that renders the previous button icon.
|
||||
* @default KeyboardArrowLeft
|
||||
*/
|
||||
previousButtonIcon?: React.ElementType;
|
||||
}
|
||||
|
||||
declare const TablePaginationActions: React.JSXElementConstructor<TablePaginationActionsProps>;
|
||||
|
||||
export default TablePaginationActions;
|
||||
194
node_modules/@mui/material/TablePagination/TablePaginationActions.js
generated
vendored
Normal file
194
node_modules/@mui/material/TablePagination/TablePaginationActions.js
generated
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useRtl } from '@mui/system/RtlProvider';
|
||||
import KeyboardArrowLeft from "../internal/svg-icons/KeyboardArrowLeft.js";
|
||||
import KeyboardArrowRight from "../internal/svg-icons/KeyboardArrowRight.js";
|
||||
import IconButton from "../IconButton/index.js";
|
||||
import LastPageIconDefault from "../internal/svg-icons/LastPage.js";
|
||||
import FirstPageIconDefault from "../internal/svg-icons/FirstPage.js";
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
||||
const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginationActions(props, ref) {
|
||||
const {
|
||||
backIconButtonProps,
|
||||
count,
|
||||
disabled = false,
|
||||
getItemAriaLabel,
|
||||
nextIconButtonProps,
|
||||
onPageChange,
|
||||
page,
|
||||
rowsPerPage,
|
||||
showFirstButton,
|
||||
showLastButton,
|
||||
slots = {},
|
||||
slotProps = {},
|
||||
...other
|
||||
} = props;
|
||||
const isRtl = useRtl();
|
||||
const handleFirstPageButtonClick = event => {
|
||||
onPageChange(event, 0);
|
||||
};
|
||||
const handleBackButtonClick = event => {
|
||||
onPageChange(event, page - 1);
|
||||
};
|
||||
const handleNextButtonClick = event => {
|
||||
onPageChange(event, page + 1);
|
||||
};
|
||||
const handleLastPageButtonClick = event => {
|
||||
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
|
||||
};
|
||||
const FirstButton = slots.firstButton ?? IconButton;
|
||||
const LastButton = slots.lastButton ?? IconButton;
|
||||
const NextButton = slots.nextButton ?? IconButton;
|
||||
const PreviousButton = slots.previousButton ?? IconButton;
|
||||
const FirstButtonIcon = slots.firstButtonIcon ?? FirstPageIconDefault;
|
||||
const LastButtonIcon = slots.lastButtonIcon ?? LastPageIconDefault;
|
||||
const NextButtonIcon = slots.nextButtonIcon ?? KeyboardArrowRight;
|
||||
const PreviousButtonIcon = slots.previousButtonIcon ?? KeyboardArrowLeft;
|
||||
const FirstButtonSlot = isRtl ? LastButton : FirstButton;
|
||||
const PreviousButtonSlot = isRtl ? NextButton : PreviousButton;
|
||||
const NextButtonSlot = isRtl ? PreviousButton : NextButton;
|
||||
const LastButtonSlot = isRtl ? FirstButton : LastButton;
|
||||
const firstButtonSlotProps = isRtl ? slotProps.lastButton : slotProps.firstButton;
|
||||
const previousButtonSlotProps = isRtl ? slotProps.nextButton : slotProps.previousButton;
|
||||
const nextButtonSlotProps = isRtl ? slotProps.previousButton : slotProps.nextButton;
|
||||
const lastButtonSlotProps = isRtl ? slotProps.firstButton : slotProps.lastButton;
|
||||
return /*#__PURE__*/_jsxs("div", {
|
||||
ref: ref,
|
||||
...other,
|
||||
children: [showFirstButton && /*#__PURE__*/_jsx(FirstButtonSlot, {
|
||||
onClick: handleFirstPageButtonClick,
|
||||
disabled: disabled || page === 0,
|
||||
"aria-label": getItemAriaLabel('first', page),
|
||||
title: getItemAriaLabel('first', page),
|
||||
...firstButtonSlotProps,
|
||||
children: isRtl ? /*#__PURE__*/_jsx(LastButtonIcon, {
|
||||
...slotProps.lastButtonIcon
|
||||
}) : /*#__PURE__*/_jsx(FirstButtonIcon, {
|
||||
...slotProps.firstButtonIcon
|
||||
})
|
||||
}), /*#__PURE__*/_jsx(PreviousButtonSlot, {
|
||||
onClick: handleBackButtonClick,
|
||||
disabled: disabled || page === 0,
|
||||
color: "inherit",
|
||||
"aria-label": getItemAriaLabel('previous', page),
|
||||
title: getItemAriaLabel('previous', page),
|
||||
...(previousButtonSlotProps ?? backIconButtonProps),
|
||||
children: isRtl ? /*#__PURE__*/_jsx(NextButtonIcon, {
|
||||
...slotProps.nextButtonIcon
|
||||
}) : /*#__PURE__*/_jsx(PreviousButtonIcon, {
|
||||
...slotProps.previousButtonIcon
|
||||
})
|
||||
}), /*#__PURE__*/_jsx(NextButtonSlot, {
|
||||
onClick: handleNextButtonClick,
|
||||
disabled: disabled || (count !== -1 ? page >= Math.ceil(count / rowsPerPage) - 1 : false),
|
||||
color: "inherit",
|
||||
"aria-label": getItemAriaLabel('next', page),
|
||||
title: getItemAriaLabel('next', page),
|
||||
...(nextButtonSlotProps ?? nextIconButtonProps),
|
||||
children: isRtl ? /*#__PURE__*/_jsx(PreviousButtonIcon, {
|
||||
...slotProps.previousButtonIcon
|
||||
}) : /*#__PURE__*/_jsx(NextButtonIcon, {
|
||||
...slotProps.nextButtonIcon
|
||||
})
|
||||
}), showLastButton && /*#__PURE__*/_jsx(LastButtonSlot, {
|
||||
onClick: handleLastPageButtonClick,
|
||||
disabled: disabled || page >= Math.ceil(count / rowsPerPage) - 1,
|
||||
"aria-label": getItemAriaLabel('last', page),
|
||||
title: getItemAriaLabel('last', page),
|
||||
...lastButtonSlotProps,
|
||||
children: isRtl ? /*#__PURE__*/_jsx(FirstButtonIcon, {
|
||||
...slotProps.firstButtonIcon
|
||||
}) : /*#__PURE__*/_jsx(LastButtonIcon, {
|
||||
...slotProps.lastButtonIcon
|
||||
})
|
||||
})]
|
||||
});
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? TablePaginationActions.propTypes = {
|
||||
/**
|
||||
* Props applied to the back arrow [`IconButton`](/material-ui/api/icon-button/) element.
|
||||
*/
|
||||
backIconButtonProps: PropTypes.object,
|
||||
/**
|
||||
* The total number of rows.
|
||||
*/
|
||||
count: PropTypes.number.isRequired,
|
||||
/**
|
||||
* If `true`, the component is disabled.
|
||||
* @default false
|
||||
*/
|
||||
disabled: PropTypes.bool,
|
||||
/**
|
||||
* Accepts a function which returns a string value that provides a user-friendly name for the current page.
|
||||
*
|
||||
* For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).
|
||||
*
|
||||
* @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous'). Defaults to 'page'.
|
||||
* @param {number} page The page number to format.
|
||||
* @returns {string}
|
||||
*/
|
||||
getItemAriaLabel: PropTypes.func.isRequired,
|
||||
/**
|
||||
* Props applied to the next arrow [`IconButton`](/material-ui/api/icon-button/) element.
|
||||
*/
|
||||
nextIconButtonProps: PropTypes.object,
|
||||
/**
|
||||
* Callback fired when the page is changed.
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
* @param {number} page The page selected.
|
||||
*/
|
||||
onPageChange: PropTypes.func.isRequired,
|
||||
/**
|
||||
* The zero-based index of the current page.
|
||||
*/
|
||||
page: PropTypes.number.isRequired,
|
||||
/**
|
||||
* The number of rows per page.
|
||||
*/
|
||||
rowsPerPage: PropTypes.number.isRequired,
|
||||
/**
|
||||
* If `true`, show the first-page button.
|
||||
*/
|
||||
showFirstButton: PropTypes.bool.isRequired,
|
||||
/**
|
||||
* If `true`, show the last-page button.
|
||||
*/
|
||||
showLastButton: PropTypes.bool.isRequired,
|
||||
/**
|
||||
* The props used for each slot inside the TablePaginationActions.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: PropTypes.shape({
|
||||
firstButton: PropTypes.object,
|
||||
firstButtonIcon: PropTypes.object,
|
||||
lastButton: PropTypes.object,
|
||||
lastButtonIcon: PropTypes.object,
|
||||
nextButton: PropTypes.object,
|
||||
nextButtonIcon: PropTypes.object,
|
||||
previousButton: PropTypes.object,
|
||||
previousButtonIcon: PropTypes.object
|
||||
}),
|
||||
/**
|
||||
* The components used for each slot inside the TablePaginationActions.
|
||||
* Either a string to use a HTML element or a component.
|
||||
* @default {}
|
||||
*/
|
||||
slots: PropTypes.shape({
|
||||
firstButton: PropTypes.elementType,
|
||||
firstButtonIcon: PropTypes.elementType,
|
||||
lastButton: PropTypes.elementType,
|
||||
lastButtonIcon: PropTypes.elementType,
|
||||
nextButton: PropTypes.elementType,
|
||||
nextButtonIcon: PropTypes.elementType,
|
||||
previousButton: PropTypes.elementType,
|
||||
previousButtonIcon: PropTypes.elementType
|
||||
})
|
||||
} : void 0;
|
||||
export default TablePaginationActions;
|
||||
5
node_modules/@mui/material/TablePagination/index.d.ts
generated
vendored
Normal file
5
node_modules/@mui/material/TablePagination/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export { default } from './TablePagination';
|
||||
export * from './TablePagination';
|
||||
|
||||
export { default as tablePaginationClasses } from './tablePaginationClasses';
|
||||
export * from './tablePaginationClasses';
|
||||
3
node_modules/@mui/material/TablePagination/index.js
generated
vendored
Normal file
3
node_modules/@mui/material/TablePagination/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default } from "./TablePagination.js";
|
||||
export { default as tablePaginationClasses } from "./tablePaginationClasses.js";
|
||||
export * from "./tablePaginationClasses.js";
|
||||
6
node_modules/@mui/material/TablePagination/package.json
generated
vendored
Normal file
6
node_modules/@mui/material/TablePagination/package.json
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"sideEffects": false,
|
||||
"module": "./index.js",
|
||||
"main": "../node/TablePagination/index.js",
|
||||
"types": "./index.d.ts"
|
||||
}
|
||||
28
node_modules/@mui/material/TablePagination/tablePaginationClasses.d.ts
generated
vendored
Normal file
28
node_modules/@mui/material/TablePagination/tablePaginationClasses.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
export interface TablePaginationClasses {
|
||||
/** Styles applied to the root element. */
|
||||
root: string;
|
||||
/** Styles applied to the Toolbar component. */
|
||||
toolbar: string;
|
||||
/** Styles applied to the spacer element. */
|
||||
spacer: string;
|
||||
/** Styles applied to the select label Typography element. */
|
||||
selectLabel: string;
|
||||
/** Styles applied to the Select component `root` element. */
|
||||
selectRoot: string;
|
||||
/** Styles applied to the Select component `select` class. */
|
||||
select: string;
|
||||
/** Styles applied to the Select component `icon` class. */
|
||||
selectIcon: string;
|
||||
/** Styles applied to the Select component `root` element. */
|
||||
input: string;
|
||||
/** Styles applied to the MenuItem component. */
|
||||
menuItem: string;
|
||||
/** Styles applied to the displayed rows Typography element. */
|
||||
displayedRows: string;
|
||||
/** Styles applied to the internal `TablePaginationActions` component. */
|
||||
actions: string;
|
||||
}
|
||||
export type TablePaginationClassKey = keyof TablePaginationClasses;
|
||||
export declare function getTablePaginationUtilityClass(slot: string): string;
|
||||
declare const tablePaginationClasses: TablePaginationClasses;
|
||||
export default tablePaginationClasses;
|
||||
7
node_modules/@mui/material/TablePagination/tablePaginationClasses.js
generated
vendored
Normal file
7
node_modules/@mui/material/TablePagination/tablePaginationClasses.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
export function getTablePaginationUtilityClass(slot) {
|
||||
return generateUtilityClass('MuiTablePagination', slot);
|
||||
}
|
||||
const tablePaginationClasses = generateUtilityClasses('MuiTablePagination', ['root', 'toolbar', 'spacer', 'selectLabel', 'selectRoot', 'select', 'selectIcon', 'input', 'menuItem', 'displayedRows', 'actions']);
|
||||
export default tablePaginationClasses;
|
||||
Reference in New Issue
Block a user