Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript] Fix <SingleFieldList> rejects the sx prop #7735

Merged
merged 1 commit into from
May 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/ra-ui-materialui/src/list/SingleFieldList.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import * as React from 'react';
import { styled } from '@mui/material/styles';
import { LinearProgress, styled, SxProps } from '@mui/material';
import {
cloneElement,
Children,
HtmlHTMLAttributes,
ComponentType,
} from 'react';
import PropTypes from 'prop-types';
import LinearProgress from '@mui/material/LinearProgress';
import {
sanitizeListRestProps,
useListContext,
Expand Down Expand Up @@ -124,6 +123,17 @@ SingleFieldList.propTypes = {
// @ts-ignore
linkType: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
resource: PropTypes.string,
sx: PropTypes.oneOfType([
PropTypes.arrayOf(
PropTypes.oneOfType([
PropTypes.func,
PropTypes.object,
PropTypes.bool,
])
),
PropTypes.func,
PropTypes.object,
]),
};

export interface SingleFieldListProps<RecordType extends RaRecord = any>
Expand All @@ -137,6 +147,7 @@ export interface SingleFieldListProps<RecordType extends RaRecord = any>
data?: RecordType[];
total?: number;
loaded?: boolean;
sx?: SxProps;
}

const PREFIX = 'RaSingleFieldList';
Expand Down