import React from "react"; import { TagValue } from "./Tag"; import { AttributeValue } from "./AttributeSelect"; import { WithTranslationProps } from "../i18n"; import { StyledProps } from "../_type"; import { WithConfigProps } from "../util"; export interface TagSearchBoxProps extends WithTranslationProps, WithConfigProps, StyledProps { /** * 要选择过滤的资源属性的集合 */ attributes?: AttributeValue[]; /** * 搜索框中默认包含的标签值的集合 */ defaultValue?: TagValue[]; /** * 配合 onChange 作为受控组件使用 */ value?: TagValue[]; /** * 当新增/修改/减少标签时调用此函数 * * **💡 用于触发搜索** */ onChange?: (tags: TagValue[]) => void; /** * 搜索框收起后宽度 * @default 210 */ minWidth?: string | number; /** * 是否禁用 * @default false * @since 2.4.1 */ disabled?: boolean; /** * 搜索框中提示语 * * @default "多个关键字用竖线 “|” 分隔,多个过滤标签用回车键分隔" (已处理国际化) */ tips?: string; /** * 资源属性选择下拉框提示 * * @default "选择资源属性进行过滤" (已处理国际化) */ attributesSelectTips?: string; /** * 隐藏帮助按钮 * * @default false */ hideHelp?: boolean; /** * 清空按钮点击回调 * * @since 2.2.2 */ onClearButtonClick?: (e: React.MouseEvent) => void; /** * 帮助按钮点击回调 * * 返回 `false` 阻止默认提示行为 * * @since 2.2.2 */ onHelpButtonClick?: (e: React.MouseEvent) => void | false; /** * 搜索按钮点击回调 * * @since 2.2.2 */ onSearchButtonClick?: (e: React.MouseEvent, value: TagValue[]) => void; /** * 使用禁用根据输入值过滤资源属性选择 * * **新增或修改标签时将展示全部资源属性** * * @since 2.4.0 * @default false */ disableAttributesFilter?: boolean; /** * 删除单个标签的回调 * * 返回 `false` 阻止删除 * * @since 2.7.4 */ onDeleteTag?: (tag: TagValue) => Promise | boolean; } export interface TagSearchBoxState { /** * 搜索框是否为展开状态 */ active: boolean; /** * 是否展示提示框 */ dialogActive: boolean; /** * 当前光标位置 */ curPos: number; /** * 当前光标(焦点)所在位置的元素类型 */ curPosType: FocusPosType; /** * 是否展示值选择组件 */ showSelect: boolean; /** * 已选标签 */ tags: TagValue[]; /** * 更新前 tags */ lastValue: TagValue[]; } /** * 焦点所在位置类型 */ export declare enum FocusPosType { INPUT = 0, INPUT_EDIT = 1, TAG = 2 } export declare const TagSearchBox: React.ForwardRefExoticComponent>;