You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
7.5 KiB

{"ast":null,"code":"import '../../../utils/index.mjs';\nimport '../../../constants/index.mjs';\nimport '../../input/index.mjs';\nimport { filterOption } from './helper.mjs';\nimport { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';\nimport { inputProps } from '../../input/src/input.mjs';\nimport { isString, isFunction } from '@vue/shared';\nimport { UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';\nconst mentionProps = buildProps({\n ...inputProps,\n options: {\n type: definePropType(Array),\n default: () => []\n },\n prefix: {\n type: definePropType([String, Array]),\n default: \"@\",\n validator: val => {\n if (isString(val)) return val.length === 1;\n return val.every(v => isString(v) && v.length === 1);\n }\n },\n split: {\n type: String,\n default: \" \",\n validator: val => val.length === 1\n },\n filterOption: {\n type: definePropType([Boolean, Function]),\n default: () => filterOption,\n validator: val => {\n if (val === false) return true;\n return isFunction(val);\n }\n },\n placement: {\n type: definePropType(String),\n default: \"bottom\"\n },\n showArrow: Boolean,\n offset: {\n type: Number,\n default: 0\n },\n whole: Boolean,\n checkIsWhole: {\n type: definePropType(Function)\n },\n modelValue: String,\n loading: Boolean,\n popperClass: {\n type: String,\n default: \"\"\n },\n popperOptions: {\n type: definePropType(Object),\n default: () => ({})\n }\n});\nconst mentionEmits = {\n [UPDATE_MODEL_EVENT]: value => isString(value),\n search: (pattern, prefix) => isString(pattern) && isString(prefix),\n select: (option, prefix) => isString(option.value) && isString(prefix),\n focus: evt => evt instanceof FocusEvent,\n blur: evt => evt instanceof FocusEvent\n};\nexport { mentionEmits, mentionProps };","map":{"version":3,"names":["mentionProps","buildProps","inputProps","options","type","definePropType","Array","default","prefix","String","validator","val","isString","length","every","v","split","filterOption","Boolean","Function","isFunction","placement","showArrow","offset","Number","whole","checkIsWhole","modelValue","loading","popperClass","popperOptions","Object","mentionEmits","UPDATE_MODEL_EVENT","value","search","pattern","select","option","focus","evt","FocusEvent","blur"],"sources":["../../../../../../packages/components/mention/src/mention.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isFunction,\n isString,\n} from '@element-plus/utils'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { inputProps } from '@element-plus/components/input'\nimport { filterOption } from './helper'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type Mention from './mention.vue'\nimport type { MentionOption } from './types'\nimport type { Options } from '@element-plus/components/popper'\n\nexport const mentionProps = buildProps({\n ...inputProps,\n /**\n * @description mention options list\n */\n options: {\n type: definePropType<MentionOption[]>(Array),\n default: () => [],\n },\n /**\n * @description prefix character to trigger mentions. The string length must be exactly 1.\n */\n prefix: {\n type: definePropType<string | string[]>([String, Array]),\n default: '@',\n validator: (val: string | string[]) => {\n if (isString(val)) return val.length === 1\n return val.every((v) => isString(v) && v.length === 1)\n },\n },\n /**\n * @description character to split mentions. The string length must be exactly 1.\n */\n split: {\n type: String,\n default: ' ',\n validator: (val: string) => val.length === 1,\n },\n /**\n * @description customize filter option logic.\n */\n filterOption: {\n type: definePropType<false | typeof filterOption>([Boolean, Function]),\n default: () => filterOption,\n validator: (val) => {\n if (val === false) return true\n return isFunction(val)\n },\n },\n /**\n * @description set popup placement\n */\n placement: {\n type: definePropType<'bottom' | 'top'>(String),\n default: 'bottom',\n },\n /**\n * @description whether the dropdown panel has an arrow\n */\n showArrow: Boolean,\n /**\n * @description offset of the dropdown panel\n */\n offset: {\n type: Number,\n default: 0,\n },\n /**\n * @description when backspace is pressed to delete, whether the mention content is deleted as a whole\n */\n whole: Boolean,\n /**\n * @description when backspace is pressed to delete, check if the mention is a whole\n */\n checkIsWhole: {\n type: definePropType<(pattern: string, prefix: string) => boolean>(\n Function\n ),\n },\n /**\n * @description input value\n */\n modelValue: String,\n /**\n * @description whether the dropdown panel of mentions is in a loading state.\n */\n loading: Boolean,\n /**\n * @description custom class name for dropdown panel\n */\n popperClass: {\n type: String,\n default: '',\n },\n /**\n * @description [popper.js](https://popper.js.org/docs/v2/) parameters\n */\n popperOptions: {\n type: definePropType<Partial<Options>>(Object),\n default: () => ({} as Partial<Options>),\n },\n})\n\nexport const mentionEmits = {\n [UPDATE_MODEL_EVENT]: (value: string) => isString(value),\n search: (pattern: string, prefix: string) =>\n isString(pattern) && isString(prefix),\n select: (option: MentionOption, prefix: string) =>\n isString(option.value) && isString(prefix),\n focus: (evt: FocusEvent) => evt instanceof FocusEvent,\n blur: (evt: FocusEvent) => evt instanceof FocusEvent,\n}\n\nexport type MentionEmits = typeof mentionEmits\nexport type MentionProps = ExtractPropTypes<typeof mentionProps>\nexport type MentionInstance = InstanceType<typeof Mention>\n\nexport type { MentionOption } from './types'\n"],"mappings":";;;;;;;;AASY,MAACA,YAAY,GAAGC,UAAU,CAAC;EACrC,GAAGC,UAAU;EACbC,OAAO,EAAE;IACPC,IAAI,EAAEC,cAAc,CAACC,KAAK,CAAC;IAC3BC,OAAO,EAAEA,CAAA,KAAM;EACnB,CAAG;EACDC,MAAM,EAAE;IACNJ,IAAI,EAAEC,cAAc,CAAC,CAACI,MAAM,EAAEH,KAAK,CAAC,CAAC;IACrCC,OAAO,EAAE,GAAG;IACZG,SAAS,EAAGC,GAAG,IAAK;MAClB,IAAIC,QAAQ,CAACD,GAAG,CAAC,EACf,OAAOA,GAAG,CAACE,MAAM,KAAK,CAAC;MACzB,OAAOF,GAAG,CAACG,KAAK,CAAEC,CAAC,IAAKH,QAAQ,CAACG,CAAC,CAAC,IAAIA,CAAC,CAACF,MAAM,KAAK,CAAC,CAAC;IAC5D;EACA,CAAG;EACDG,KAAK,EAAE;IACLZ,IAAI,EAAEK,MAAM;IACZF,OAAO,EAAE,GAAG;IACZG,SAAS,EAAGC,GAAG,IAAKA,GAAG,CAACE,MAAM,KAAK;EACvC,CAAG;EACDI,YAAY,EAAE;IACZb,IAAI,EAAEC,cAAc,CAAC,CAACa,OAAO,EAAEC,QAAQ,CAAC,CAAC;IACzCZ,OAAO,EAAEA,CAAA,KAAMU,YAAY;IAC3BP,SAAS,EAAGC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