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

Export and Rename Types #5420

Merged
merged 3 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions packages/ra-core/src/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import useVersion from './useVersion';
import useExpanded from './useExpanded';
import useFilterState from './useFilterState';
import useSortState, { SortProps } from './useSortState';
import usePaginationState, { PaginationProps } from './usePaginationState';
import usePaginationState, { PaginationHookResult } from './usePaginationState';
import useListController, {
getListControllerProps,
sanitizeListRestProps,
Expand All @@ -39,7 +39,7 @@ export type {
CreateControllerProps,
ShowControllerProps,
UseReferenceProps,
PaginationProps,
PaginationHookResult,
SortProps,
};

Expand Down
6 changes: 3 additions & 3 deletions packages/ra-core/src/controller/usePaginationState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { PaginationPayload } from '../types';
* @property {Function} setPerPage: Set the per page number
* @property {Function} setPagination: Set page and perPage pagination numbers
*/
export interface PaginationProps {
export interface PaginationHookResult {
page: number;
perPage: number;
pagination: PaginationPayload;
Expand Down Expand Up @@ -42,11 +42,11 @@ const defaultPagination = {
* const { page, setpage, perPage, setPerPage } = usePagination(initialPerPage);
*
* @param {number} initialPagination the initial value per page
* @returns {PaginationProps} The pagination props
* @returns {PaginationHookResult} The pagination props
*/
export default (
initialPagination: { perPage?: number; page?: number } = {}
): PaginationProps => {
): PaginationHookResult => {
const [pagination, setPagination] = useReducer(paginationReducer, {
...defaultPagination,
...initialPagination,
Expand Down
8 changes: 6 additions & 2 deletions packages/ra-core/src/form/FormDataConsumer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ import get from 'lodash/get';

import warning from '../util/warning';

interface ChildrenFunctionParams {
export interface FormDataConsumerRenderParams {
formData: any;
scopedFormData?: any;
getSource?: (source: string) => string;
}

export type FormDataConsumerRender = (
params: FormDataConsumerRenderParams
) => ReactNode;

interface ConnectedProps {
children: (params: ChildrenFunctionParams) => ReactNode;
children: FormDataConsumerRender;
form?: string;
record?: any;
source?: string;
Expand Down
7 changes: 6 additions & 1 deletion packages/ra-core/src/form/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import addField from './addField';
import FormDataConsumer from './FormDataConsumer';
import FormDataConsumer, {
FormDataConsumerRender,
FormDataConsumerRenderParams,
} from './FormDataConsumer';
import FormContext from './FormContext';
import FormField from './FormField';
import FormWithRedirect, {
Expand All @@ -23,6 +26,8 @@ import useWarnWhenUnsavedChanges from './useWarnWhenUnsavedChanges';
export type {
ChoicesProps,
ChoicesInputProps,
FormDataConsumerRender,
FormDataConsumerRenderParams,
FormWithRedirectProps,
HandleSubmitWithRedirect,
InputProps,
Expand Down
4 changes: 3 additions & 1 deletion packages/ra-ui-materialui/src/list/pagination/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Pagination from './Pagination';
import Pagination, { PaginationProps } from './Pagination';
import PaginationActions from './PaginationActions';
import PaginationLimit from './PaginationLimit';

export type { PaginationProps };

export { Pagination, PaginationActions, PaginationLimit };