jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
53 lines (52 loc) • 1.99 kB
TypeScript
import React from 'react';
import type { ActionObject, Option } from 'jamis-core';
import type { InputTagProps } from './types';
interface TagState {
inputValue: string;
isFocused?: boolean;
isOpened?: boolean;
}
export default class TagControl extends React.PureComponent<InputTagProps, TagState> {
input: React.RefObject<any>;
static defaultProps: {
resetValue: string;
labelField: string;
valueField: string;
multiple: boolean;
placeholder: string;
optionsTip: string;
separator: string;
};
state: {
isOpened: boolean;
inputValue: string;
isFocused: boolean;
};
componentDidUpdate(prevProps: InputTagProps): void;
doAction(action: ActionObject, data: object, throwErrors: boolean): void;
dispatchEvent: (eventName: string, eventData?: any) => Promise<boolean>;
/** 处理输入的内容 */
normalizeInputValue: (inputValue: string) => Option[];
normalizeOptions: (options: Option[]) => string | any[];
/** 输入的内容和存量的内容合并,过滤掉value值相同的 */
normalizeMergedValue: (inputValue: string, normalized?: boolean) => string | any[];
validateInputValue: (inputValue: string) => boolean;
getValue: (type?: "push" | "pop" | "normal", option?: any) => string | any[];
addItem: (option: Option) => Promise<void>;
handleFocus: (e: any) => Promise<void>;
handleBlur: (e: any) => Promise<void>;
close: () => void;
handleInputChange: (text: string) => void;
handleChange: (value: Array<Option>) => Promise<void>;
renderItem: (item: Option) => any;
handleKeyDown: (evt: React.KeyboardEvent<HTMLInputElement>) => Promise<void>;
handleOptionChange: (option: Option) => void;
getTarget: () => any;
getParent: () => any;
reload(): void;
isReachMax: () => boolean;
render(): JSX.Element;
}
export declare class TagControlRenderer extends TagControl {
}
export {};