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.

0 lines
7.4 KiB

1 month ago
  1. {"ast":null,"code":"import { filterOption } from './helper.mjs';\nimport { inputProps } from '../../input/src/input.mjs';\nimport { buildProps, definePropType } from '../../../utils/vue/props/runtime.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 * @descript