/** * @license * Copyright Stbui All Rights Reserved. * https://github.com/stbui/prophet */ import { Sort } from '../types'; interface ListParamsOptions { resource: string; filterDefaultValues?: object; sort?: Sort; perPage?: number; debounceTime?: number; } export interface ListParams { sort: string; order: string; page: number; perPage: number; filter: any; filterValues: object; displayedFilters: { [key: string]: boolean; }; requestSignature: any[]; } interface Modifiers { changeParams: (action: any) => void; setPage: (page: number) => void; setPerPage: (pageSize: number) => void; setSort: (sort: string, order?: string) => void; setFilters: (filters: any, displayedFilters: any) => void; hideFilter: (filterName: string) => void; showFilter: (filterName: string, defaultValue: any) => void; } /** * ListParams * * @param {Object} options * @param {string} options.resource * @param {Object} options.filterDefaultValues * @param {Object} options.sort * @param {order} options.sort.field * @param {order} options.sort.order * @param {number} options.perPage * @param {number} options.debounceTime * @returns * * @example * * const [query, queryMethod] = useListParams({ * resource: 'users', * filterDefaultValues: { username: 'stbui' }, * sort: { field: 'id', order: 'ASC' }, * perPage: 20 * }) * */ export declare const useListParams: ({ resource, filterDefaultValues, sort, perPage, debounceTime, }: ListParamsOptions) => [ListParams, Modifiers]; /** * 将url参数转换成对象 * ?page=1&perPage=10&sort=stb&order=ASC&filter={} * @param {string} options.search */ export declare const parseQueryFromLocation: ({ search }: { search: any; }) => any; /** * * { filter: {}, order: null, page: 1, perPage: null, sort: null } * @param {object} params */ export declare const hasCustomParams: (params: any) => boolean; /** * * @param {Object} options * @param {Object} options.location * @param {Object} options.params * @param {string} options.filterDefaultValues * @param {Object} options.sort * @param {number} options.perPage */ export declare const getQuery: ({ location, params, filterDefaultValues, sort, perPage, }: { location: any; params: any; filterDefaultValues: any; sort: any; perPage: any; }) => any; export {};