From 754c5d2593e9f9938923869148d54c376ad0e11c Mon Sep 17 00:00:00 2001 From: Amour1688 Date: Thu, 5 Mar 2020 10:38:44 +0800 Subject: [PATCH 1/2] feat: add mentions type --- types/mentions/mentions.d.ts | 72 ++++++++++++++++++++++++++++++++++++ types/mentions/option.d.ts | 13 +++++++ 2 files changed, 85 insertions(+) create mode 100644 types/mentions/mentions.d.ts create mode 100644 types/mentions/option.d.ts diff --git a/types/mentions/mentions.d.ts b/types/mentions/mentions.d.ts new file mode 100644 index 0000000000..3331544f62 --- /dev/null +++ b/types/mentions/mentions.d.ts @@ -0,0 +1,72 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from '../component'; +import { Option } from './option'; + +export declare class Mentions extends AntdComponent { + static Option: typeof Option; + /** + * Auto get focus when component mounted + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * Default value + * @type string + */ + defaultValue: string; + + /** + * Customize filter option logic + * @type false | (input: string, option: OptionProps) => boolean + */ + filterOption: false | ((input: string, option: Option) => boolean); + + /** + * Set mentions content when not match + * @type any (string | slot) + */ + notFoundContent: any; + + /** + * Set popup placement + * @default 'top' + * @type string + */ + placement: 'top' | 'bottom'; + + /** + * Set trigger prefix keyword + * @default '@' + * @type string | string[] + */ + prefix: string | string[]; + + /** + * Set split string before and after selected mention + * @default ' ' + * @type string + */ + split: string; + + /** + * Customize trigger search logic + * @type (text: string, props: MentionsProps) => void + */ + validateSearch: (text: string, props: Mentions) => void; + + /** + * Set value of mentions + * @type string + */ + value: string; + + /** + * Set the mount HTML node for suggestions + * @default () => HTMLElement + */ + getPopupContainer: (triggerNode: HTMLElement) => HTMLElement; +} diff --git a/types/mentions/option.d.ts b/types/mentions/option.d.ts new file mode 100644 index 0000000000..9cffee404c --- /dev/null +++ b/types/mentions/option.d.ts @@ -0,0 +1,13 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from '../component'; + +export declare class Option extends AntdComponent { + /** + * value of suggestion, the value will insert into input filed while selected + * @default '' + * @type string + */ + value: string; +} From a869f16b07229dd2aa14039f27ac3f6650a73bfb Mon Sep 17 00:00:00 2001 From: Amour1688 Date: Thu, 5 Mar 2020 21:15:19 +0800 Subject: [PATCH 2/2] feat: add mentions in ant-design-vue.d.ts --- types/ant-design-vue.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ant-design-vue.d.ts b/types/ant-design-vue.d.ts index 6dde6e9d3b..805c2f865a 100644 --- a/types/ant-design-vue.d.ts +++ b/types/ant-design-vue.d.ts @@ -35,6 +35,7 @@ import { Layout } from './layout/layout'; import { List } from './list/list'; import { LocaleProvider } from './locale-provider'; import { Message } from './message'; +import { Mentions } from './mentions/mentions'; import { Menu } from './menu/menu'; import { Modal } from './modal'; import { Notification } from './notification';