import React, { FormEvent } from 'react'; import { ApiMetaData, FetchParams, MultiComboBoxOption } from '.'; export declare const useApiMultiComboBoxInternal: ({ createNewItem, currentPage, fetchItems, onBlur, onChange, onFocus, onKeyDown, options, totalPages, values, maxSelectionCount, }: { createNewItem?: ((fieldValue: string) => void) | undefined; currentPage: number; fetchItems: (params: FetchParams) => Promise; onBlur?: ((e: FormEvent, fetchParams: FetchParams, values?: MultiComboBoxOption[] | undefined) => void) | undefined; onChange?: ((options: MultiComboBoxOption[]) => void) | undefined; onFocus?: (() => void) | undefined; onKeyDown?: React.KeyboardEventHandler | undefined; options: MultiComboBoxOption[]; totalPages: number; values: MultiComboBoxOption[]; maxSelectionCount?: number | undefined; }) => { filteredOptions: MultiComboBoxOption[]; isLoadingMore: boolean; loadMore: () => void; fieldValue: string; isOpen: boolean; setOpen: React.Dispatch>; selectedIndex: number; listOptionsRef: React.RefObject; selectedOptionRef: React.RefObject; borderRef: React.RefObject; onFieldBlur: (e: any) => void; onFieldChange: (e: React.ChangeEvent) => Promise; onFieldFocus: () => void; onFieldKeyDown: (e: React.KeyboardEvent) => void; onSelectOption: (option: MultiComboBoxOption) => void; onRemoveOption: (option: MultiComboBoxOption) => void; onClickNewItem: (fieldValue: string) => Promise; }; /** * ApiMultiComboBoxのためにAPIをラップし、以下の機能を付与します。 * * - 複数のApiMultiComboBoxで利用するためのリソース管理 * - ローディング状態の管理 * - 初期化時のAPI呼び出し * - フォーカス時の挙動制御 * * このhooksの利用は必須ではありません。 * */ export declare const useApiMultiComboBox: ({ createOptions, fetchItems, fetchOnInit, responseAdapter, }: { createOptions: (items: T[]) => MultiComboBoxOption[]; fetchItems: (params: FetchParams) => Promise; /** * 初期化時にfetchを一回呼ぶ */ fetchOnInit?: boolean | undefined; /** * APIレスポンスの形が合わない場合に整形する */ responseAdapter?: ((response: any) => { items: T[]; meta: ApiMetaData; }) | undefined; }) => { fetchItems: ({ name, page, }?: FetchParams) => Promise; isLoading: boolean; meta: ApiMetaData; onFocus: () => void; options: import(".").ComboBoxOption[]; /** * ApiMultiComboBox の props としては使用しないが、useApiMultiComboBox で取得したリソースを * 他のコンポーネントから参照・編集したいケースのために返している */ items: T[]; createOptions: (items: T[]) => MultiComboBoxOption[]; setItems: (newItems: T[]) => void; setMeta: (newMeta: ApiMetaData) => void; };