Skip to content

Commit

Permalink
Merge pull request #4312 from WiXSL/patch-jdocs
Browse files Browse the repository at this point in the history
Corrected JDocs.
  • Loading branch information
fzaninotto authored Jan 21, 2020
2 parents a1b0359 + ea97251 commit fdf4c4c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 52 deletions.
11 changes: 1 addition & 10 deletions packages/ra-core/src/controller/field/getResourceLinkPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ interface Option {
linkType?: LinkToType; // deprecated, use link instead
}

/**
* @typedef ReferenceProps
* @type {Object}
* @property {boolean} loading: boolean indicating if the reference is loading
* @property {boolean} loaded: boolean indicating if the reference has loaded
* @property {Object} referenceRecord: the referenced record.
* @property {string | false} resourceLinkPath link to the page of the related record (depends on link) (false is no link)
*/

/**
* Get the link toward the referenced resource
*
Expand All @@ -51,7 +42,7 @@ interface Option {
* @param {string} option.resource The current resource name
* @param {string} option.source The key of the linked resource identifier
*
* @returns {ReferenceProps} The reference props
* @returns {string | false} The reference props
*/
const getResourceLinkPath = ({
basePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ interface Option {
* });
*
* @param {Object} option
* @param {boolean} option.allowEmpty do we allow for no referenced record (default to false)
* @param {string} option.basePath basepath to current resource
* @param {string | false} option.linkType The type of the link toward the referenced record. edit, show of false for no link (default to edit)
* @param {Object} option.record The The current resource record
* @param {string} option.reference The linked resource name
* @param {string} option.resource The current resource name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ import { Record, Sort, RecordMap, Identifier } from '../../types';
import { useGetManyReference } from '../../dataProvider';
import { useNotify } from '../../sideEffect';

/**
* @typedef ReferenceManyProps
* @type {Object}
* @property {Array} data: the referenced records dictionary by their ids.
* @property {Array} ids: the list of referenced records ids.
* @property {boolean} loaded: boolean indicating if the references has already be loaded loaded
* @property {string | false} referenceBasePath base path of the related record
* @property {number} total records
*/
interface ReferenceManyProps {
data: RecordMap;
ids: Identifier[];
Expand Down Expand Up @@ -32,15 +41,6 @@ interface Options {

const defaultFilter = {};

/**
* @typedef ReferenceManyProps
* @type {Object}
* @property {Object} data: the referenced records dictionary by their ids.
* @property {Object} ids: the list of referenced records ids.
* @property {boolean} loaded: boolean indicating if the references has already be loaded loaded
* @property {string | false} referenceBasePath base path of the related record
*/

/**
* Fetch reference records, and return them when avaliable
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ import { getStatusForArrayInput as getDataStatus } from './referenceDataStatus';
* });
*
* @param {Object} option
* @param {boolean} option.allowEmpty do we allow for no referenced record (default to false)
* @param {string} option.basePath basepath to current resource
* @param {string | false} option.linkType The type of the link toward the referenced record. edit, show of false for no link (default to edit)
* @param {Object} option.record The The current resource record
* @param {string} option.reference The linked resource name
* @param {string} option.resource The current resource name
Expand Down
20 changes: 6 additions & 14 deletions packages/ra-core/src/controller/useFilterState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ interface UseFilterStateOptions {
debounceTime?: number;
}

/**
* @typedef UseFilterStateProps
* @property {Object} filter: The filter object.
* @property {setFilter} setFilter: Update the filter with the given string
*/
interface UseFilterStateProps {
filter: Filter;
setFilter: (v: string) => void;
Expand All @@ -19,19 +24,6 @@ interface UseFilterStateProps {
const defaultFilterToQuery = (v: string) => ({ q: v });
const emptyFilter = {};

/**
* @name setFilter
* @function
* @param {string} the value
*/

/**
* @typedef FilterProps
* @type {Object}
* @property {Object} filter: The filter object.
* @property {setFilter} setFilter: Update the filter with the given string
*/

/**
* Hooks to provide filter state and setFilter which update the query part of the filter
*
Expand Down Expand Up @@ -59,7 +51,7 @@ const emptyFilter = {};
* @param {Object} option.permanentFilter Permanent filter to be merged with the filter string. Defaults to {}.
* @param {number} option.debounceTime Time in ms between filter updates - used to debounce the search. Defaults to 500ms.
*
* @returns {FilterProps} The filter props
* @returns {UseFilterStateOptions} The filter props
*/
export default ({
filterToQuery = defaultFilterToQuery,
Expand Down
24 changes: 9 additions & 15 deletions packages/ra-core/src/controller/usePaginationState.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { useEffect, useReducer, useCallback, useRef } from 'react';
import { Pagination } from '../types';

/**
* @typedef PaginationProps
* @type {Object}
* @property {number} page: The page number.
* @property {number} perPage: The number of item per page.
* @property {function} setPage: Set the page number
* @property {function} setPerPage: Set the per page number
* @property {function} setPagination: Set page and perPage pagination numbers
*/
interface PaginationProps {
page: number;
perPage: number;
Expand All @@ -25,21 +34,6 @@ const defaultPagination = {
perPage: 25,
};

/**
* @name setNumber
* @function
* @param {number} state the state value
*/

/**
* @typedef PaginationProps
* @type {Object}
* @property {number} page: The page number.
* @property {number} perPage: The number of item per page.
* @property {setNumber} setPage: Set the page number
* @property {setNumber} setPerPage: Set the per page number
*/

/**
* Hooks to provide pagination state (apge and perPage)
*
Expand Down

0 comments on commit fdf4c4c

Please sign in to comment.