1 line
14 KiB
Plaintext
1 line
14 KiB
Plaintext
|
|
{"version":3,"file":"select-dropdown.mjs","names":["computed","defineComponent","inject","ref","toRaw","unref","watch","createVNode","_createVNode","mergeProps","_mergeProps","get","getEventCode","isIOS","isObject","isUndefined","DynamicSizeList","FixedSizeList","useNamespace","EVENT_CODE","GroupItem","OptionItem","useProps","selectV2InjectionKey","scrollbarEmits","props","loading","Boolean","data","type","Array","required","hoveringIndex","Number","width","id","String","ariaLabel","name","emits","setup","slots","expose","emit","select","ns","getLabel","getValue","getDisabled","cachedHeights","listRef","size","length","value","tooltipRef","updatePopper","isSized","estimatedOptionHeight","listProps","itemSize","itemHeight","estimatedSize","idx","contains","arr","target","valueKey","includes","some","item","isEqual","selected","isItemSelected","modelValue","multiple","isItemDisabled","disabled","multipleLimit","isItemHovering","scrollToItem","index","list","resetScrollTop","exposed","Item","itemProps","style","sized","onSelect","onHover","isSelected","isDisabled","isHovering","created","default","onKeyboardNavigate","onKeyboardSelect","onForward","onBackward","onEscOrTab","onKeydown","e","code","tab","esc","down","up","enter","numpadEnter","preventDefault","stopPropagation","onEndReached","direction","height","scrollbarAlwaysOn","isScrollbarAlwaysOn","List","b","is","header","empty","be","role","footer"],"sources":["../../../../../../packages/components/select-v2/src/select-dropdown.tsx"],"sourcesContent":["import {\n computed,\n defineComponent,\n inject,\n ref,\n toRaw,\n unref,\n watch,\n} from 'vue'\nimport { get } from 'lodash-unified'\nimport { getEventCode, isIOS, isObject, isUndefined } from '@element-plus/utils'\nimport {\n DynamicSizeList,\n FixedSizeList,\n} from '@element-plus/components/virtual-list'\nimport { useNamespace } from '@element-plus/hooks'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport GroupItem from './group-item.vue'\nimport OptionItem from './option-item.vue'\nimport { useProps } from './useProps'\nimport { selectV2InjectionKey } from './token'\nimport { scrollbarEmits } from '@element-plus/components/scrollbar'\n\nimport type { ScrollbarDirection } from '@element-plus/components/scrollbar'\nimport type {\n DynamicSizeListInstance,\n FixedSizeListInstance,\n ItemProps,\n} from '@element-plus/components/virtual-list'\nimport type { Option, OptionItemProps } from './select.types'\nimport type {\n ComponentPublicInstance,\n ComputedRef,\n ExtractPropTypes,\n Ref,\n} from 'vue'\n\nconst props = {\n loading: Boolean,\n data: {\n type: Array,\n required: true as const,\n },\n hoveringIndex: Number,\n width: Number,\n id: String,\n ariaLabel: String,\n}\ninterface SelectDropdownExposed {\n listRef: Ref<FixedSizeListInstance | DynamicSizeListInstance | undefined>\n isSized: ComputedRef<boolean>\n isItemDisabled: (modelValue: any[] | any, selected: boolean) => boolean\n isItemHovering: (target: number) => boolean\n isItemSelected: (modelValue: any[] | any, target: Option) => boolean\n scrollToItem: (index: number) => void\n resetScrollTop: () => void\n}\nexport type SelectDropdownInstance = ComponentPublicInstance<\n ExtractPropTypes<typeof props>,\n SelectDropdownExposed\n>\nexport default defineComponent({\n name: 'ElSelectDropdown',\n props,\n emits: {\n 'end-reached': scrollbarEmits['end-reached'],\n },\n setup(props, { slots, expose, emit }) {\n const select = inject(selectV2InjectionKey)!\n const ns = useNamespace('select')\n const { getLabel, getValue, getDisabled } = useProps(select.props)\n\n const cachedHeights = ref<Array<number>>([])\n\n const listRef = ref<FixedSizeListInstance | DynamicSizeListInstance>()\n\n const size = computed(() => props.data.length)\n watch(\n () => size.value,\n () => {\n select.tooltipRef.value?.updatePopper?.()\n }\n )\n\n const isSized = computed(() =>\n isUndefined(select.props.estimatedOptionHeight)\n )\n const listProps = computed(() => {\n
|