import { RenderFunction, SetupContext, Ref } from 'vue' import { DefineVxeComponentApp, DefineVxeComponentOptions, DefineVxeComponentInstance, VxeComponentBaseOptions, VxeComponentIsVScrollbar, VxeComponentEventParams, ValueOf, VxeComponentStyleType, VxeComponentSizeType } from '@vxe-ui/core' import { VxeIconPropTypes } from './icon' import { VxeScrollbarProps } from './scrollbar' /* eslint-disable no-use-before-define,@typescript-eslint/ban-types */ export declare const VxeIconPicker: DefineVxeComponentApp export type VxeIconPickerComponent = DefineVxeComponentOptions export type VxeIconPickerInstance = DefineVxeComponentInstance export interface VxeIconPickerConstructor extends VxeComponentBaseOptions, VxeIconPickerMethods { props: VxeIconPickerProps context: SetupContext reactData: IconPickerReactData getRefMaps(): IconPickerPrivateRef getComputeMaps(): IconPickerPrivateComputed renderVN: RenderFunction } export interface IconPickerPrivateRef { refElem: Ref } export interface VxeIconPickerPrivateRef extends IconPickerPrivateRef {} export namespace VxeIconPickerPropTypes { export type ModelValue = string | null export type Placeholder = string export type Size = VxeComponentSizeType export type Width = string | number export type ClassName = string | ((params: { $iconPicker: VxeIconPickerConstructor }) => string) /** * 已废弃,请使用 PopupConfig.className * @deprecated */ export type PopupClassName = string | ((params: { $iconPicker: VxeIconPickerConstructor }) => string) export type Readonly = boolean export type Disabled = boolean export type Option = { title?: string | number icon: string iconRender?: VxeIconPickerDefines.OptionIconRender } export type Icons = VxeIconPropTypes.Name[] | Option[] export type Clearable = boolean export type ShowIconTitle = boolean export type Filterable = boolean export interface FilterConfig { filterMethod?: (params: { $iconPicker: VxeIconPickerConstructor; option: VxeIconPickerDefines.IconItemObj; searchValue: string; value: ModelValue | undefined }) => boolean } export type Placement = 'top' | 'bottom' | '' | null export interface PopupConfig { /** * 设置弹出面板方向 */ placement?: 'top' | 'bottom' | '' | null /** * 默认弹出面板方向 */ defaultPlacement?: 'top' | 'bottom' | '' | null /** * 触发方式 */ trigger?: 'default' | 'icon' | 'manual' | '' | null /** * 是否启用元素挂载 */ transfer?: boolean /** * 挂载到指定元素下 */ appendTo?: string | HTMLElement | ((params: {}) => string | HTMLElement) /** * 每行显示出多少个图标,如果设置了 chunkWidth 则该参数无效 */ chunkSize?: number /** * 每个图标的宽度 */ chunkWidth?: number | string /** * 宽度 */ width?: number | string height?: number | string maxHeight?: number | string zIndex?: number | string className?: string | ((params: { $iconPicker: VxeIconPickerConstructor }) => string) } export type Transfer = boolean export type UseScrollbar = VxeComponentIsVScrollbar export interface ScrollbarConfig extends Pick { /** * 滚动条宽度 */ width?: number | string /** * 滚动条高度 */ height?: number | string } } export type VxeIconPickerProps = { /** * 绑定值 */ modelValue?: VxeIconPickerPropTypes.ModelValue placeholder?: VxeIconPickerPropTypes.Placeholder size?: VxeIconPickerPropTypes.Size className?: VxeIconPickerPropTypes.ClassName /** * 已废弃,请使用 popup-config.className * @deprecated */ popupClassName?: VxeIconPickerPropTypes.PopupClassName width?: VxeIconPickerPropTypes.Width readonly?: VxeIconPickerPropTypes.Readonly disabled?: VxeIconPickerPropTypes.Disabled icons?: VxeIconPickerPropTypes.Icons clearable?: VxeIconPickerPropTypes.Clearable showIconTitle?: VxeIconPickerPropTypes.ShowIconTitle filterable?: VxeIconPickerPropTypes.Filterable filterConfig?: VxeIconPickerPropTypes.FilterConfig placement?: VxeIconPickerPropTypes.Placement popupConfig?: VxeIconPickerPropTypes.PopupConfig transfer?: VxeIconPickerPropTypes.Transfer /** * 使用虚拟滚动条 */ useScrollbar?: VxeIconPickerPropTypes.UseScrollbar /** * 滚动条配置项 */ scrollbarConfig?: VxeIconPickerPropTypes.ScrollbarConfig } export interface IconPickerPrivateComputed {} export interface VxeIconPickerPrivateComputed extends IconPickerPrivateComputed {} export interface IconPickerReactData { initialized: boolean selectIcon: VxeIconPickerPropTypes.ModelValue panelIndex: number panelStyle: VxeComponentStyleType panelPlacement: any visiblePanel: boolean isAniVisible: boolean isActivated: boolean searchValue: string iconList: VxeIconPickerDefines.IconItemObj[] } export interface IconPickerInternalData { hpTimeout?: undefined | number fullList: VxeIconPickerDefines.IconItemObj[] } export interface IconPickerMethods { dispatchEvent(type: ValueOf, params: Record, evnt: Event | null): void /** * 判断下拉面板是否可视 */ isPanelVisible(): boolean /** * 切换下拉面板 */ togglePanel(): Promise /** * 显示下拉面板 */ showPanel(): Promise /** * 隐藏下拉面板 */ hidePanel(): Promise /** * 获取焦点 */ focus(): Promise /** * 失去焦点 */ blur(): Promise } export interface VxeIconPickerMethods extends IconPickerMethods {} export interface IconPickerPrivateMethods {} export interface VxeIconPickerPrivateMethods extends IconPickerPrivateMethods {} export type VxeIconPickerEmits = ['update:modelValue', 'change', 'clear', 'click'] export namespace VxeIconPickerDefines { export interface IconPickerEventParams extends VxeComponentEventParams { $iconPicker: VxeIconPickerConstructor } export interface OptionIconRender { /** * 渲染器名称 */ name: string /** * 目标组件渲染的参数 */ props?: { [key: string]: any } /** * 目标组件渲染的事件 */ events?: { [key: string]: (...args: any[]) => any } } export interface IconItemObj { title: string icon: string iconRender?: OptionIconRender } } export type VxeIconPickerEventProps = { 'onUpdate:modelValue'?: VxeIconPickerEvents.UpdateModelValue } export interface VxeIconPickerListeners { 'update:modelValue'?: VxeIconPickerEvents.UpdateModelValue } export namespace VxeIconPickerEvents { export type UpdateModelValue = (modelValue: VxeIconPickerPropTypes.ModelValue) => void } export namespace VxeIconPickerSlotTypes { export interface DefaultSlotParams {} } export interface VxeIconPickerSlots { default: (params: VxeIconPickerSlotTypes.DefaultSlotParams) => any } export const IconPicker: typeof VxeIconPicker export default VxeIconPicker