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
5.0 KiB

{"version":3,"file":"dropdown.mjs","sources":["../../../../../../packages/components/dropdown/src/dropdown.ts"],"sourcesContent":["import { EVENT_CODE } from '@element-plus/utils/aria'\nimport { buildProps, definePropType } from '@element-plus/utils/props'\nimport { createCollectionWithScope } from '@element-plus/components/collection'\nimport {\n useTooltipTriggerProps,\n useTooltipContentProps,\n} from '@element-plus/components/tooltip'\n\nimport type { ButtonType } from '@element-plus/components/button'\nimport type { Placement } from '@element-plus/components/popper'\nimport type {\n ComponentInternalInstance,\n Component,\n ComputedRef,\n Ref,\n} from 'vue'\nimport type { Nullable } from '@element-plus/utils/types'\n\nexport interface IElDropdownInstance {\n instance?: ComponentInternalInstance\n dropdownSize?: ComputedRef<string>\n visible?: Ref<boolean>\n handleClick?: () => void\n commandHandler?: (...arg) => void\n show?: () => void\n hide?: () => void\n trigger?: ComputedRef<string>\n hideOnClick?: ComputedRef<boolean>\n triggerElm?: ComputedRef<Nullable<HTMLButtonElement>>\n}\n\nexport const dropdownProps = {\n trigger: useTooltipTriggerProps.trigger,\n\n effect: {\n ...useTooltipContentProps.effect,\n default: 'light',\n },\n ...buildProps({\n type: {\n type: definePropType<ButtonType>(String),\n },\n placement: {\n type: definePropType<Placement>(String),\n default: 'bottom',\n },\n size: {\n type: String,\n default: '',\n },\n splitButton: Boolean,\n hideOnClick: {\n type: Boolean,\n default: true,\n },\n loop: {\n type: Boolean,\n },\n\n showTimeout: {\n type: Number,\n default: 150,\n },\n hideTimeout: {\n type: Number,\n default: 150,\n },\n tabindex: {\n type: definePropType<number | string>([Number, String]),\n default: 0,\n },\n\n maxHeight: {\n type: definePropType<number | string>([Number, String]),\n default: '',\n },\n popperClass: {\n type: String,\n default: '',\n },\n } as const),\n} as const\n\nexport const dropdownItemProps = buildProps({\n command: {\n type: [Object, String, Number],\n default: () => ({}),\n },\n disabled: Boolean,\n divided: Boolean,\n textValue: String,\n icon: {\n type: definePropType<string | Component>([String, Object]),\n },\n} as const)\n\nexport const dropdownMenuProps = buildProps({\n onKeydown: { type: definePropType<(e: KeyboardEvent) => void>(Function) },\n})\n\nexport const FIRST_KEYS = [\n EVENT_CODE.down,\n EVENT_CODE.pageDown,\n EVENT_CODE.home,\n]\n\nexport const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end]\n\nexport const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS]\n\nconst {\n ElCollection,\n ElCollectionItem,\n COLLECTION_INJECTION_KEY,\n COLLECTION_ITEM_INJECTION_KEY,\n} = createCollectionWithScope('Dropdown')\n\nexport {\n ElCollection,\n ElCollectionItem,\n COLLECTION_INJECTION_KEY as DROPDOWN_COLLECTION_INJECTION_KEY,\n COLLECTION_ITEM_INJECTION_KEY as DROPDOWN_COLLECTION_ITEM_INJECTION_KEY,\n}\n"],"names":[],"mappings":";;;;;;;AAOY,MAAC,aAAa,GAAG;AAC7B,EAAE,OAAO,EAAE,sBAAsB,CAAC,OAAO;AACzC,EAAE,MAAM,EAAE;AACV,IAAI,GAAG,sBAAsB,CAAC,MAAM;AACpC,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,GAAG,UAAU,CAAC;AAChB,IAAI,IAAI,EAAE;AACV,MAAM,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAClC,KAAK;AACL,IAAI,SAAS,EAAE;AACf,MAAM,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAClC,MAAM,OAAO,EAAE,QAAQ;AACvB,KAAK;AACL,IAAI,IAAI,EAAE;AACV,MAAM,IAAI,EAAE,MAAM;AAClB,MAAM,OAAO,EAAE,EAAE;AACjB,KAAK;AACL,IAAI,WAAW,EAAE,OAAO;AACxB,IAAI,WAAW,EAAE;AACjB,MAAM,IAAI,EAAE,OAAO;AACnB,MAAM,OAAO,EAAE,IAAI;AACnB,KAAK;AACL,IAAI,IAAI,EAAE;AACV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