@wfrog/vc-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -0
- package/dist/es/chunk/-EkpfdcW.mjs +1100 -0
- package/dist/es/chunk/8rLUmOVR.mjs +29 -0
- package/dist/es/chunk/B-rxnVJv.mjs +3 -0
- package/dist/es/chunk/BAGoDD49.mjs +36 -0
- package/dist/es/chunk/BAtns-Mc.mjs +96 -0
- package/dist/es/chunk/BJS5Pdfp.mjs +55 -0
- package/dist/es/chunk/BMzd-IS6.mjs +900 -0
- package/dist/es/chunk/BWcCXRRK.mjs +229 -0
- package/dist/es/chunk/BX-Ogf7p.mjs +3743 -0
- package/dist/es/chunk/B_tU9Nax.mjs +49 -0
- package/dist/es/chunk/BdDihk0t.mjs +3420 -0
- package/dist/es/chunk/C2LgraHx.mjs +489 -0
- package/dist/es/chunk/C5hWsUfD.mjs +64 -0
- package/dist/es/chunk/C7iSSBUr.mjs +303 -0
- package/dist/es/chunk/CD98REcR.mjs +666 -0
- package/dist/es/chunk/CEClY-_T.mjs +445 -0
- package/dist/es/chunk/CEm0brzD.mjs +35 -0
- package/dist/es/chunk/CMABHk8B.mjs +1942 -0
- package/dist/es/chunk/CS4VKsqy.mjs +19 -0
- package/dist/es/chunk/CVlj9F0I.mjs +291 -0
- package/dist/es/chunk/CZ4ggqDE.mjs +140 -0
- package/dist/es/chunk/CaTfZePA.mjs +533 -0
- package/dist/es/chunk/Ce9ApjrT.mjs +201 -0
- package/dist/es/chunk/ClZGuAIb.mjs +10 -0
- package/dist/es/chunk/Coex0GxM.mjs +450 -0
- package/dist/es/chunk/Ct6q2FXg.mjs +5 -0
- package/dist/es/chunk/CyxEcbcy.mjs +29 -0
- package/dist/es/chunk/D389hx_T.mjs +35 -0
- package/dist/es/chunk/D3DXeVfC.mjs +1171 -0
- package/dist/es/chunk/D3uV7vm-.mjs +45 -0
- package/dist/es/chunk/D5259bwd.mjs +50 -0
- package/dist/es/chunk/DMHNh_tw.mjs +49 -0
- package/dist/es/chunk/DVNTpOBR.mjs +4 -0
- package/dist/es/chunk/DZACQ9LT.mjs +95 -0
- package/dist/es/chunk/De_EXLIy.mjs +22 -0
- package/dist/es/chunk/Dh4jaUSg.mjs +89 -0
- package/dist/es/chunk/DhhdKtyu.mjs +439 -0
- package/dist/es/chunk/DqUIKX7f.mjs +2039 -0
- package/dist/es/chunk/Dqz1zvKN.mjs +59 -0
- package/dist/es/chunk/Dvi7RsXg.mjs +727 -0
- package/dist/es/chunk/DyDMGLoF.mjs +123 -0
- package/dist/es/chunk/E_WRn0OP.mjs +449 -0
- package/dist/es/chunk/Fo0dZYnz.mjs +128 -0
- package/dist/es/chunk/HSv8BL8o.mjs +72 -0
- package/dist/es/chunk/JCIyOUEY.mjs +105 -0
- package/dist/es/chunk/O-uhUKF4.mjs +43 -0
- package/dist/es/chunk/Spa-JKB4.mjs +1046 -0
- package/dist/es/chunk/VAdRxe-1.mjs +16 -0
- package/dist/es/chunk/VCrtRnxt.mjs +1477 -0
- package/dist/es/chunk/ViP2SEY4.mjs +211 -0
- package/dist/es/chunk/aibQ9WSZ.mjs +249 -0
- package/dist/es/chunk/nWBcrYxV.mjs +690 -0
- package/dist/es/chunk/pcqpp-6-.mjs +9 -0
- package/dist/es/chunk/qY9OvNHY.mjs +283 -0
- package/dist/es/chunk/su2Zrql0.mjs +53 -0
- package/dist/es/chunk/zfg5SOj1.mjs +138 -0
- package/dist/es/components/awesome-icon/awesome-icon.d.ts +6 -0
- package/dist/es/components/awesome-icon/awesome-icon.mjs +41 -0
- package/dist/es/components/awesome-icon/awesome-icon.vue.d.ts +5 -0
- package/dist/es/components/awesome-icon/index.d.ts +4 -0
- package/dist/es/components/awesome-icon/index.mjs +6 -0
- package/dist/es/components/backbottom/backbottom.d.ts +7 -0
- package/dist/es/components/backbottom/backbottom.mjs +172 -0
- package/dist/es/components/backbottom/backbottom.vue.d.ts +7 -0
- package/dist/es/components/backbottom/components/child.vue.d.ts +30 -0
- package/dist/es/components/backbottom/index.d.ts +4 -0
- package/dist/es/components/backbottom/index.mjs +6 -0
- package/dist/es/components/button/button.d.ts +18 -0
- package/dist/es/components/button/button.mjs +313 -0
- package/dist/es/components/button/button.vue.d.ts +33 -0
- package/dist/es/components/button/index.css +9 -0
- package/dist/es/components/button/index.d.ts +4 -0
- package/dist/es/components/button/index.mjs +6 -0
- package/dist/es/components/cdn-tag.vue.d.ts +5 -0
- package/dist/es/components/chat-container/chat-container.d.ts +9 -0
- package/dist/es/components/chat-container/chat-container.mjs +77 -0
- package/dist/es/components/chat-container/chat-container.vue.d.ts +29 -0
- package/dist/es/components/chat-container/index.css +9 -0
- package/dist/es/components/chat-container/index.d.ts +4 -0
- package/dist/es/components/chat-container/index.mjs +6 -0
- package/dist/es/components/choice/choice.d.ts +6 -0
- package/dist/es/components/choice/choice.mjs +53 -0
- package/dist/es/components/choice/choice.vue.d.ts +5 -0
- package/dist/es/components/choice/index.css +7 -0
- package/dist/es/components/choice/index.d.ts +4 -0
- package/dist/es/components/choice/index.mjs +6 -0
- package/dist/es/components/choice-boolean/choice-boolean.d.ts +5 -0
- package/dist/es/components/choice-boolean/choice-boolean.mjs +32 -0
- package/dist/es/components/choice-boolean/choice-boolean.vue.d.ts +10 -0
- package/dist/es/components/choice-boolean/index.d.ts +4 -0
- package/dist/es/components/choice-boolean/index.mjs +6 -0
- package/dist/es/components/config-provider/config-provider.d.ts +16 -0
- package/dist/es/components/config-provider/config-provider.mjs +29 -0
- package/dist/es/components/config-provider/config-provider.vue.d.ts +18 -0
- package/dist/es/components/config-provider/config-provider2.mjs +6 -0
- package/dist/es/components/config-provider/index.d.ts +4 -0
- package/dist/es/components/config-provider/index.mjs +6 -0
- package/dist/es/components/cropper/cropper.d.ts +12 -0
- package/dist/es/components/cropper/cropper.mjs +333 -0
- package/dist/es/components/cropper/cropper.vue.d.ts +32 -0
- package/dist/es/components/cropper/index.css +4 -0
- package/dist/es/components/cropper/index.d.ts +4 -0
- package/dist/es/components/cropper/index.mjs +6 -0
- package/dist/es/components/currency/currency.d.ts +21 -0
- package/dist/es/components/currency/currency.mjs +185 -0
- package/dist/es/components/currency/currency.vue.d.ts +14 -0
- package/dist/es/components/currency/index.css +8 -0
- package/dist/es/components/currency/index.d.ts +4 -0
- package/dist/es/components/currency/index.mjs +6 -0
- package/dist/es/components/daterange-picker/daterange-picker.d.ts +6 -0
- package/dist/es/components/daterange-picker/daterange-picker.mjs +5550 -0
- package/dist/es/components/daterange-picker/daterange-picker.vue.d.ts +13 -0
- package/dist/es/components/daterange-picker/index.d.ts +4 -0
- package/dist/es/components/daterange-picker/index.mjs +6 -0
- package/dist/es/components/dialog/dialog.d.ts +13 -0
- package/dist/es/components/dialog/dialog.mjs +537 -0
- package/dist/es/components/dialog/dialog.vue.d.ts +38 -0
- package/dist/es/components/dialog/index.css +87 -0
- package/dist/es/components/dialog/index.d.ts +4 -0
- package/dist/es/components/dialog/index.mjs +6 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.d.ts +33 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +412 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.vue.d.ts +23 -0
- package/dist/es/components/dialog-camera-upload/index.css +66 -0
- package/dist/es/components/dialog-camera-upload/index.d.ts +4 -0
- package/dist/es/components/dialog-camera-upload/index.mjs +6 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.d.ts +9 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.mjs +183 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.vue.d.ts +22 -0
- package/dist/es/components/dialog-map-point/index.css +11 -0
- package/dist/es/components/dialog-map-point/index.d.ts +4 -0
- package/dist/es/components/dialog-map-point/index.mjs +6 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.d.ts +16 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +1391 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.vue.d.ts +19 -0
- package/dist/es/components/dialog-upload-images/index.css +62 -0
- package/dist/es/components/dialog-upload-images/index.d.ts +4 -0
- package/dist/es/components/dialog-upload-images/index.mjs +6 -0
- package/dist/es/components/document.vue.d.ts +14 -0
- package/dist/es/components/drawer/drawer.d.ts +7 -0
- package/dist/es/components/drawer/drawer.mjs +412 -0
- package/dist/es/components/drawer/drawer.vue.d.ts +31 -0
- package/dist/es/components/drawer/index.css +56 -0
- package/dist/es/components/drawer/index.d.ts +4 -0
- package/dist/es/components/drawer/index.mjs +6 -0
- package/dist/es/components/easy-pagination/easy-pagination.d.ts +8 -0
- package/dist/es/components/easy-pagination/easy-pagination.mjs +74 -0
- package/dist/es/components/easy-pagination/easy-pagination.vue.d.ts +19 -0
- package/dist/es/components/easy-pagination/index.css +10 -0
- package/dist/es/components/easy-pagination/index.d.ts +4 -0
- package/dist/es/components/easy-pagination/index.mjs +6 -0
- package/dist/es/components/el-icon/el-icon.d.ts +6 -0
- package/dist/es/components/el-icon/el-icon.mjs +46 -0
- package/dist/es/components/el-icon/el-icon.vue.d.ts +6 -0
- package/dist/es/components/el-icon/index.css +7 -0
- package/dist/es/components/el-icon/index.d.ts +4 -0
- package/dist/es/components/el-icon/index.mjs +6 -0
- package/dist/es/components/example-wrapper.vue.d.ts +19 -0
- package/dist/es/components/flag/flag.mjs +44 -0
- package/dist/es/components/flag/flag.vue.d.ts +5 -0
- package/dist/es/components/flag/flags.d.ts +8 -0
- package/dist/es/components/flag/index.d.ts +4 -0
- package/dist/es/components/flag/index.mjs +6 -0
- package/dist/es/components/icon/icon.d.ts +6 -0
- package/dist/es/components/icon/icon.mjs +54 -0
- package/dist/es/components/icon/icon.vue.d.ts +3 -0
- package/dist/es/components/icon/icon2.mjs +27 -0
- package/dist/es/components/icon/index.css +9 -0
- package/dist/es/components/icon/index.d.ts +4 -0
- package/dist/es/components/icon/index.mjs +6 -0
- package/dist/es/components/image/image.d.ts +16 -0
- package/dist/es/components/image/image.mjs +167 -0
- package/dist/es/components/image/image.vue.d.ts +206 -0
- package/dist/es/components/image/index.css +20 -0
- package/dist/es/components/image/index.d.ts +4 -0
- package/dist/es/components/image/index.mjs +6 -0
- package/dist/es/components/input/index.css +9 -0
- package/dist/es/components/input/index.d.ts +4 -0
- package/dist/es/components/input/index.mjs +6 -0
- package/dist/es/components/input/input.d.ts +4 -0
- package/dist/es/components/input/input.mjs +85 -0
- package/dist/es/components/input/input.vue.d.ts +1232 -0
- package/dist/es/components/input-number/index.css +24 -0
- package/dist/es/components/input-number/index.d.ts +4 -0
- package/dist/es/components/input-number/index.mjs +6 -0
- package/dist/es/components/input-number/input-number.d.ts +8 -0
- package/dist/es/components/input-number/input-number.mjs +137 -0
- package/dist/es/components/input-number/input-number.vue.d.ts +35 -0
- package/dist/es/components/pca-picker/components/c.vue.d.ts +123 -0
- package/dist/es/components/pca-picker/components/elevator-item.vue.d.ts +7 -0
- package/dist/es/components/pca-picker/components/filter.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/history.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/hot.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/p.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/pca.vue.d.ts +9 -0
- package/dist/es/components/pca-picker/index.css +107 -0
- package/dist/es/components/pca-picker/index.d.ts +4 -0
- package/dist/es/components/pca-picker/index.mjs +6 -0
- package/dist/es/components/pca-picker/pca-picker.d.ts +78 -0
- package/dist/es/components/pca-picker/pca-picker.mjs +1667 -0
- package/dist/es/components/pca-picker/pca-picker.vue.d.ts +583 -0
- package/dist/es/components/qr-code/index.d.ts +4 -0
- package/dist/es/components/qr-code/index.mjs +6 -0
- package/dist/es/components/qr-code/qr-code.d.ts +9 -0
- package/dist/es/components/qr-code/qr-code.mjs +69 -0
- package/dist/es/components/qr-code/qr-code.vue.d.ts +13 -0
- package/dist/es/components/screenfull/index.css +14 -0
- package/dist/es/components/screenfull/index.d.ts +4 -0
- package/dist/es/components/screenfull/index.mjs +6 -0
- package/dist/es/components/screenfull/screenfull.d.ts +4 -0
- package/dist/es/components/screenfull/screenfull.mjs +91 -0
- package/dist/es/components/screenfull/screenfull.vue.d.ts +20 -0
- package/dist/es/components/select/index.css +9 -0
- package/dist/es/components/select/index.d.ts +4 -0
- package/dist/es/components/select/index.mjs +6 -0
- package/dist/es/components/select/select.d.ts +6 -0
- package/dist/es/components/select/select.mjs +63 -0
- package/dist/es/components/select/select.vue.d.ts +6 -0
- package/dist/es/components/single-player/index.css +45 -0
- package/dist/es/components/single-player/index.d.ts +4 -0
- package/dist/es/components/single-player/index.mjs +6 -0
- package/dist/es/components/single-player/single-player.d.ts +4 -0
- package/dist/es/components/single-player/single-player.mjs +1172 -0
- package/dist/es/components/single-player/single-player.vue.d.ts +13 -0
- package/dist/es/components/svg-icon/index.css +9 -0
- package/dist/es/components/svg-icon/index.d.ts +4 -0
- package/dist/es/components/svg-icon/index.mjs +6 -0
- package/dist/es/components/svg-icon/svg-icon.d.ts +5 -0
- package/dist/es/components/svg-icon/svg-icon.mjs +46 -0
- package/dist/es/components/svg-icon/svg-icon.vue.d.ts +18 -0
- package/dist/es/components/switch/index.css +15 -0
- package/dist/es/components/switch/index.d.ts +4 -0
- package/dist/es/components/switch/index.mjs +6 -0
- package/dist/es/components/switch/switch.d.ts +9 -0
- package/dist/es/components/switch/switch.mjs +82 -0
- package/dist/es/components/switch/switch.vue.d.ts +14 -0
- package/dist/es/components/sync-scroll-container/index.css +82 -0
- package/dist/es/components/sync-scroll-container/index.d.ts +4 -0
- package/dist/es/components/sync-scroll-container/index.mjs +6 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.d.ts +6 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.mjs +157 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.vue.d.ts +36 -0
- package/dist/es/components/tags/index.css +17 -0
- package/dist/es/components/tags/index.d.ts +4 -0
- package/dist/es/components/tags/index.mjs +6 -0
- package/dist/es/components/tags/tags.d.ts +9 -0
- package/dist/es/components/tags/tags.mjs +296 -0
- package/dist/es/components/tags/tags.vue.d.ts +20 -0
- package/dist/es/components/text-ellipsis/index.css +15 -0
- package/dist/es/components/text-ellipsis/index.d.ts +4 -0
- package/dist/es/components/text-ellipsis/index.mjs +6 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.d.ts +12 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.mjs +137 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.vue.d.ts +41 -0
- package/dist/es/components/thousand-input/index.css +4 -0
- package/dist/es/components/thousand-input/index.d.ts +4 -0
- package/dist/es/components/thousand-input/index.mjs +6 -0
- package/dist/es/components/thousand-input/thousand-input.d.ts +11 -0
- package/dist/es/components/thousand-input/thousand-input.mjs +159 -0
- package/dist/es/components/thousand-input/thousand-input.vue.d.ts +2558 -0
- package/dist/es/components/tinymce/config.d.ts +25 -0
- package/dist/es/components/tinymce/index.css +9 -0
- package/dist/es/components/tinymce/index.d.ts +4 -0
- package/dist/es/components/tinymce/index.mjs +6 -0
- package/dist/es/components/tinymce/tinymce.d.ts +9 -0
- package/dist/es/components/tinymce/tinymce.mjs +176 -0
- package/dist/es/components/tinymce/tinymce.vue.d.ts +20 -0
- package/dist/es/components/tree-picker/components/popover-cascader.d.ts +8 -0
- package/dist/es/components/tree-picker/components/popover-cascader.vue.d.ts +1361 -0
- package/dist/es/components/tree-picker/docs/data.d.ts +2 -0
- package/dist/es/components/tree-picker/index.css +41 -0
- package/dist/es/components/tree-picker/index.d.ts +4 -0
- package/dist/es/components/tree-picker/index.mjs +6 -0
- package/dist/es/components/tree-picker/popover-cascader.css +23 -0
- package/dist/es/components/tree-picker/tree-picker.d.ts +14 -0
- package/dist/es/components/tree-picker/tree-picker.mjs +173 -0
- package/dist/es/components/tree-picker/tree-picker.vue.d.ts +575 -0
- package/dist/es/components/upload-file/index.css +30 -0
- package/dist/es/components/upload-file/index.d.ts +4 -0
- package/dist/es/components/upload-file/index.mjs +6 -0
- package/dist/es/components/upload-file/upload-file.d.ts +39 -0
- package/dist/es/components/upload-file/upload-file.mjs +202 -0
- package/dist/es/components/upload-file/upload-file.vue.d.ts +30 -0
- package/dist/es/directives/cleave/index.d.ts +3 -0
- package/dist/es/directives/focus/index.d.ts +4 -0
- package/dist/es/directives/index.d.ts +3 -0
- package/dist/es/directives/thousand/index.d.ts +3 -0
- package/dist/es/index.d.ts +42 -0
- package/dist/es/index.mjs +122 -0
- package/dist/es/use/useSmallScreen/index.d.ts +4 -0
- package/dist/es/use/useSmallScreen/index.mjs +10 -0
- package/dist/es/use/useStore/index.d.ts +3 -0
- package/dist/es/use/useStore/index.mjs +22 -0
- package/dist/es/utils/index.d.ts +6 -0
- package/dist/es/utils/resolver.d.ts +3 -0
- package/dist/es/utils/resolver.mjs +24 -0
- package/dist/es/utils/typescript.d.ts +6 -0
- package/dist/global.d.ts +42 -0
- package/dist/index.css +869 -0
- package/package.json +58 -0
|
@@ -0,0 +1,1942 @@
|
|
|
1
|
+
import { shallowRef, ref, computed, watch, inject, getCurrentInstance, toRaw, defineComponent, withDirectives, createElementBlock, openBlock, withModifiers, normalizeClass, renderSlot, createElementVNode, toDisplayString, vShow, unref, toRefs, reactive, onBeforeUnmount, nextTick, normalizeStyle, createCommentVNode, onMounted, watchEffect, provide, isVNode, resolveComponent, resolveDirective, toHandlerKey, createVNode, withCtx, createBlock, Fragment, renderList, mergeProps, normalizeProps, createTextVNode, vModelText, resolveDynamicComponent } from 'vue';
|
|
2
|
+
import { u as useTooltipContentProps, E as Ee, a as ElTooltip } from './DqUIKX7f.mjs';
|
|
3
|
+
import { s as scrollbarEmits, E as ElScrollbar } from './CaTfZePA.mjs';
|
|
4
|
+
import { t as tagProps, E as ElTag } from './CZ4ggqDE.mjs';
|
|
5
|
+
import { E as ElIcon } from './DMHNh_tw.mjs';
|
|
6
|
+
import { i as isEqual } from './-EkpfdcW.mjs';
|
|
7
|
+
import { g as get, u as useLocale } from './aibQ9WSZ.mjs';
|
|
8
|
+
import { c as buildProps, t as throwError, s as isObject, u as useNamespace, e as debugWarn, i as isArray$1, a as isEmpty, g as isUndefined, v as isIOS, o as isClient, f as isNumber, j as isFunction, l as isPlainObject, w as useDebounceFn, k as isNil, h as isString, d as definePropType } from './E_WRn0OP.mjs';
|
|
9
|
+
import { b as isArray } from './Spa-JKB4.mjs';
|
|
10
|
+
import { _ as _export_sfc, w as withInstall, a as withNoopInstall } from './D389hx_T.mjs';
|
|
11
|
+
import { u as useId } from './8rLUmOVR.mjs';
|
|
12
|
+
import { e as useResizeObserver, f as useMutationObserver } from './CEClY-_T.mjs';
|
|
13
|
+
import { u as useFormItem, a as useFormItemInputId, b as useFormDisabled, c as useFormSize } from './DZACQ9LT.mjs';
|
|
14
|
+
import { a as useEmptyValues, u as useEmptyValuesProps } from './C5hWsUfD.mjs';
|
|
15
|
+
import { a as useComposition, u as useFocusController } from './JCIyOUEY.mjs';
|
|
16
|
+
import { V as ValidateComponentsMap, i as iconPropType } from '../components/icon/icon2.mjs';
|
|
17
|
+
import { g as getEventCode, E as EVENT_CODE } from './BJS5Pdfp.mjs';
|
|
18
|
+
import { U as UPDATE_MODEL_EVENT, C as CHANGE_EVENT } from './Ct6q2FXg.mjs';
|
|
19
|
+
import { s as scrollIntoView } from './DyDMGLoF.mjs';
|
|
20
|
+
import { b as baseIteratee } from './BWcCXRRK.mjs';
|
|
21
|
+
import { c as clamp } from './Dqz1zvKN.mjs';
|
|
22
|
+
import { ArrowDown, CircleClose } from '@element-plus/icons-vue';
|
|
23
|
+
import { u as useSizeProp } from './CS4VKsqy.mjs';
|
|
24
|
+
import { u as useAriaProps } from './C2LgraHx.mjs';
|
|
25
|
+
import { C as ClickOutside } from './HSv8BL8o.mjs';
|
|
26
|
+
import { f as flattedChildren } from './B_tU9Nax.mjs';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The base implementation of `_.findIndex` and `_.findLastIndex` without
|
|
30
|
+
* support for iteratee shorthands.
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
* @param {Array} array The array to inspect.
|
|
34
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
35
|
+
* @param {number} fromIndex The index to search from.
|
|
36
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
37
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
38
|
+
*/
|
|
39
|
+
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
|
40
|
+
array.length;
|
|
41
|
+
var index = fromIndex + (1 );
|
|
42
|
+
|
|
43
|
+
while ((index-- )) {
|
|
44
|
+
if (predicate(array[index], index, array)) {
|
|
45
|
+
return index;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return -1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Casts `value` as an array if it's not one.
|
|
53
|
+
*
|
|
54
|
+
* @static
|
|
55
|
+
* @memberOf _
|
|
56
|
+
* @since 4.4.0
|
|
57
|
+
* @category Lang
|
|
58
|
+
* @param {*} value The value to inspect.
|
|
59
|
+
* @returns {Array} Returns the cast array.
|
|
60
|
+
* @example
|
|
61
|
+
*
|
|
62
|
+
* _.castArray(1);
|
|
63
|
+
* // => [1]
|
|
64
|
+
*
|
|
65
|
+
* _.castArray({ 'a': 1 });
|
|
66
|
+
* // => [{ 'a': 1 }]
|
|
67
|
+
*
|
|
68
|
+
* _.castArray('abc');
|
|
69
|
+
* // => ['abc']
|
|
70
|
+
*
|
|
71
|
+
* _.castArray(null);
|
|
72
|
+
* // => [null]
|
|
73
|
+
*
|
|
74
|
+
* _.castArray(undefined);
|
|
75
|
+
* // => [undefined]
|
|
76
|
+
*
|
|
77
|
+
* _.castArray();
|
|
78
|
+
* // => []
|
|
79
|
+
*
|
|
80
|
+
* var array = [1, 2, 3];
|
|
81
|
+
* console.log(_.castArray(array) === array);
|
|
82
|
+
* // => true
|
|
83
|
+
*/
|
|
84
|
+
function castArray() {
|
|
85
|
+
if (!arguments.length) {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
var value = arguments[0];
|
|
89
|
+
return isArray(value) ? value : [value];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* This method is like `_.findIndex` except that it iterates over elements
|
|
94
|
+
* of `collection` from right to left.
|
|
95
|
+
*
|
|
96
|
+
* @static
|
|
97
|
+
* @memberOf _
|
|
98
|
+
* @since 2.0.0
|
|
99
|
+
* @category Array
|
|
100
|
+
* @param {Array} array The array to inspect.
|
|
101
|
+
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
102
|
+
* @param {number} [fromIndex=array.length-1] The index to search from.
|
|
103
|
+
* @returns {number} Returns the index of the found element, else `-1`.
|
|
104
|
+
* @example
|
|
105
|
+
*
|
|
106
|
+
* var users = [
|
|
107
|
+
* { 'user': 'barney', 'active': true },
|
|
108
|
+
* { 'user': 'fred', 'active': false },
|
|
109
|
+
* { 'user': 'pebbles', 'active': false }
|
|
110
|
+
* ];
|
|
111
|
+
*
|
|
112
|
+
* _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
|
|
113
|
+
* // => 2
|
|
114
|
+
*
|
|
115
|
+
* // The `_.matches` iteratee shorthand.
|
|
116
|
+
* _.findLastIndex(users, { 'user': 'barney', 'active': true });
|
|
117
|
+
* // => 0
|
|
118
|
+
*
|
|
119
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
|
120
|
+
* _.findLastIndex(users, ['active', false]);
|
|
121
|
+
* // => 2
|
|
122
|
+
*
|
|
123
|
+
* // The `_.property` iteratee shorthand.
|
|
124
|
+
* _.findLastIndex(users, 'active');
|
|
125
|
+
* // => 0
|
|
126
|
+
*/
|
|
127
|
+
function findLastIndex(array, predicate, fromIndex) {
|
|
128
|
+
var length = array == null ? 0 : array.length;
|
|
129
|
+
if (!length) {
|
|
130
|
+
return -1;
|
|
131
|
+
}
|
|
132
|
+
var index = length - 1;
|
|
133
|
+
return baseFindIndex(array, baseIteratee(predicate), index);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const MINIMUM_INPUT_WIDTH = 11;
|
|
137
|
+
const BORDER_HORIZONTAL_WIDTH = 2;
|
|
138
|
+
|
|
139
|
+
function useCalcInputWidth() {
|
|
140
|
+
const calculatorRef = shallowRef();
|
|
141
|
+
const calculatorWidth = ref(0);
|
|
142
|
+
const inputStyle = computed(() => ({
|
|
143
|
+
minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px`
|
|
144
|
+
}));
|
|
145
|
+
const resetCalculatorWidth = () => {
|
|
146
|
+
var _a, _b;
|
|
147
|
+
calculatorWidth.value = (_b = (_a = calculatorRef.value) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 0;
|
|
148
|
+
};
|
|
149
|
+
useResizeObserver(calculatorRef, resetCalculatorWidth);
|
|
150
|
+
return {
|
|
151
|
+
calculatorRef,
|
|
152
|
+
calculatorWidth,
|
|
153
|
+
inputStyle
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const defaultProps = {
|
|
158
|
+
label: "label",
|
|
159
|
+
value: "value",
|
|
160
|
+
disabled: "disabled",
|
|
161
|
+
options: "options"
|
|
162
|
+
};
|
|
163
|
+
function useProps(props) {
|
|
164
|
+
const aliasProps = ref({ ...defaultProps, ...props.props });
|
|
165
|
+
let cache = { ...props.props };
|
|
166
|
+
watch(() => props.props, (val) => {
|
|
167
|
+
if (!isEqual(val, cache)) {
|
|
168
|
+
aliasProps.value = { ...defaultProps, ...val };
|
|
169
|
+
cache = { ...val };
|
|
170
|
+
}
|
|
171
|
+
}, { deep: true });
|
|
172
|
+
const getLabel = (option) => get(option, aliasProps.value.label);
|
|
173
|
+
const getValue = (option) => get(option, aliasProps.value.value);
|
|
174
|
+
const getDisabled = (option) => get(option, aliasProps.value.disabled);
|
|
175
|
+
const getOptions = (option) => get(option, aliasProps.value.options);
|
|
176
|
+
return {
|
|
177
|
+
aliasProps,
|
|
178
|
+
getLabel,
|
|
179
|
+
getValue,
|
|
180
|
+
getDisabled,
|
|
181
|
+
getOptions
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const selectGroupKey = Symbol("ElSelectGroup");
|
|
186
|
+
const selectKey = Symbol("ElSelect");
|
|
187
|
+
|
|
188
|
+
const COMPONENT_NAME$1 = "ElOption";
|
|
189
|
+
const optionProps = buildProps({
|
|
190
|
+
value: {
|
|
191
|
+
type: [String, Number, Boolean, Object],
|
|
192
|
+
required: true
|
|
193
|
+
},
|
|
194
|
+
label: {
|
|
195
|
+
type: [String, Number]
|
|
196
|
+
},
|
|
197
|
+
created: Boolean,
|
|
198
|
+
disabled: Boolean
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
202
|
+
|
|
203
|
+
function useOption(props, states) {
|
|
204
|
+
const select = inject(selectKey);
|
|
205
|
+
if (!select) {
|
|
206
|
+
throwError(COMPONENT_NAME$1, "usage: <el-select><el-option /></el-select/>");
|
|
207
|
+
}
|
|
208
|
+
const selectGroup = inject(selectGroupKey, { disabled: false });
|
|
209
|
+
const itemSelected = computed(() => {
|
|
210
|
+
return contains(castArray(select.props.modelValue), props.value);
|
|
211
|
+
});
|
|
212
|
+
const limitReached = computed(() => {
|
|
213
|
+
var _a;
|
|
214
|
+
if (select.props.multiple) {
|
|
215
|
+
const modelValue = castArray((_a = select.props.modelValue) != null ? _a : []);
|
|
216
|
+
return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
|
|
217
|
+
} else {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
const currentLabel = computed(() => {
|
|
222
|
+
var _a;
|
|
223
|
+
return (_a = props.label) != null ? _a : isObject(props.value) ? "" : props.value;
|
|
224
|
+
});
|
|
225
|
+
const currentValue = computed(() => {
|
|
226
|
+
return props.value || props.label || "";
|
|
227
|
+
});
|
|
228
|
+
const isDisabled = computed(() => {
|
|
229
|
+
return props.disabled || states.groupDisabled || limitReached.value;
|
|
230
|
+
});
|
|
231
|
+
const instance = getCurrentInstance();
|
|
232
|
+
const contains = (arr = [], target) => {
|
|
233
|
+
if (!isObject(props.value)) {
|
|
234
|
+
return arr && arr.includes(target);
|
|
235
|
+
} else {
|
|
236
|
+
const valueKey = select.props.valueKey;
|
|
237
|
+
return arr && arr.some((item) => {
|
|
238
|
+
return toRaw(get(item, valueKey)) === get(target, valueKey);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const hoverItem = () => {
|
|
243
|
+
if (!isDisabled.value) {
|
|
244
|
+
select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
const updateOption = (query) => {
|
|
248
|
+
const regexp = new RegExp(escapeStringRegexp(query), "i");
|
|
249
|
+
states.visible = regexp.test(String(currentLabel.value)) || props.created;
|
|
250
|
+
};
|
|
251
|
+
watch(() => currentLabel.value, () => {
|
|
252
|
+
if (!props.created && !select.props.remote)
|
|
253
|
+
select.setSelected();
|
|
254
|
+
});
|
|
255
|
+
watch(() => props.value, (val, oldVal) => {
|
|
256
|
+
const { remote, valueKey } = select.props;
|
|
257
|
+
const shouldUpdate = remote ? val !== oldVal : !isEqual(val, oldVal);
|
|
258
|
+
if (shouldUpdate) {
|
|
259
|
+
select.onOptionDestroy(oldVal, instance.proxy);
|
|
260
|
+
select.onOptionCreate(instance.proxy);
|
|
261
|
+
}
|
|
262
|
+
if (!props.created && !remote) {
|
|
263
|
+
if (valueKey && isObject(val) && isObject(oldVal) && val[valueKey] === oldVal[valueKey]) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
select.setSelected();
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
watch(() => selectGroup.disabled, () => {
|
|
270
|
+
states.groupDisabled = selectGroup.disabled;
|
|
271
|
+
}, { immediate: true });
|
|
272
|
+
return {
|
|
273
|
+
select,
|
|
274
|
+
currentLabel,
|
|
275
|
+
currentValue,
|
|
276
|
+
itemSelected,
|
|
277
|
+
isDisabled,
|
|
278
|
+
hoverItem,
|
|
279
|
+
updateOption
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const _sfc_main$3 = defineComponent({
|
|
284
|
+
name: COMPONENT_NAME$1,
|
|
285
|
+
componentName: COMPONENT_NAME$1,
|
|
286
|
+
props: optionProps,
|
|
287
|
+
setup(props) {
|
|
288
|
+
const ns = useNamespace("select");
|
|
289
|
+
const id = useId();
|
|
290
|
+
const containerKls = computed(() => [
|
|
291
|
+
ns.be("dropdown", "item"),
|
|
292
|
+
ns.is("disabled", unref(isDisabled)),
|
|
293
|
+
ns.is("selected", unref(itemSelected)),
|
|
294
|
+
ns.is("hovering", unref(hover))
|
|
295
|
+
]);
|
|
296
|
+
const states = reactive({
|
|
297
|
+
index: -1,
|
|
298
|
+
groupDisabled: false,
|
|
299
|
+
visible: true,
|
|
300
|
+
hover: false
|
|
301
|
+
});
|
|
302
|
+
const {
|
|
303
|
+
currentLabel,
|
|
304
|
+
itemSelected,
|
|
305
|
+
isDisabled,
|
|
306
|
+
select,
|
|
307
|
+
hoverItem,
|
|
308
|
+
updateOption
|
|
309
|
+
} = useOption(props, states);
|
|
310
|
+
const { visible, hover } = toRefs(states);
|
|
311
|
+
const vm = getCurrentInstance().proxy;
|
|
312
|
+
select.onOptionCreate(vm);
|
|
313
|
+
onBeforeUnmount(() => {
|
|
314
|
+
const key = vm.value;
|
|
315
|
+
nextTick(() => {
|
|
316
|
+
const { selected: selectedOptions } = select.states;
|
|
317
|
+
const doesSelected = selectedOptions.some((item) => {
|
|
318
|
+
return item.value === vm.value;
|
|
319
|
+
});
|
|
320
|
+
if (select.states.cachedOptions.get(key) === vm && !doesSelected) {
|
|
321
|
+
select.states.cachedOptions.delete(key);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
select.onOptionDestroy(key, vm);
|
|
325
|
+
});
|
|
326
|
+
function selectOptionClick() {
|
|
327
|
+
if (!isDisabled.value) {
|
|
328
|
+
select.handleOptionSelect(vm);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return {
|
|
332
|
+
ns,
|
|
333
|
+
id,
|
|
334
|
+
containerKls,
|
|
335
|
+
currentLabel,
|
|
336
|
+
itemSelected,
|
|
337
|
+
isDisabled,
|
|
338
|
+
select,
|
|
339
|
+
visible,
|
|
340
|
+
hover,
|
|
341
|
+
states,
|
|
342
|
+
hoverItem,
|
|
343
|
+
updateOption,
|
|
344
|
+
selectOptionClick
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
function _sfc_render$3(_ctx, _cache) {
|
|
349
|
+
return withDirectives((openBlock(), createElementBlock("li", {
|
|
350
|
+
id: _ctx.id,
|
|
351
|
+
class: normalizeClass(_ctx.containerKls),
|
|
352
|
+
role: "option",
|
|
353
|
+
"aria-disabled": _ctx.isDisabled || void 0,
|
|
354
|
+
"aria-selected": _ctx.itemSelected,
|
|
355
|
+
onMousemove: _ctx.hoverItem,
|
|
356
|
+
onClick: withModifiers(_ctx.selectOptionClick, ["stop"])
|
|
357
|
+
}, [
|
|
358
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
359
|
+
createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
|
|
360
|
+
])
|
|
361
|
+
], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"])), [
|
|
362
|
+
[vShow, _ctx.visible]
|
|
363
|
+
]);
|
|
364
|
+
}
|
|
365
|
+
var Option = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__file", "option.vue"]]);
|
|
366
|
+
|
|
367
|
+
const _sfc_main$2 = defineComponent({
|
|
368
|
+
name: "ElSelectDropdown",
|
|
369
|
+
componentName: "ElSelectDropdown",
|
|
370
|
+
setup() {
|
|
371
|
+
const select = inject(selectKey);
|
|
372
|
+
const ns = useNamespace("select");
|
|
373
|
+
const popperClass = computed(() => select.props.popperClass);
|
|
374
|
+
const isMultiple = computed(() => select.props.multiple);
|
|
375
|
+
const isFitInputWidth = computed(() => select.props.fitInputWidth);
|
|
376
|
+
const minWidth = ref("");
|
|
377
|
+
function updateMinWidth() {
|
|
378
|
+
var _a;
|
|
379
|
+
const offsetWidth = (_a = select.selectRef) == null ? void 0 : _a.offsetWidth;
|
|
380
|
+
if (offsetWidth) {
|
|
381
|
+
minWidth.value = `${offsetWidth - BORDER_HORIZONTAL_WIDTH}px`;
|
|
382
|
+
} else {
|
|
383
|
+
minWidth.value = "";
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
onMounted(() => {
|
|
387
|
+
updateMinWidth();
|
|
388
|
+
useResizeObserver(select.selectRef, updateMinWidth);
|
|
389
|
+
});
|
|
390
|
+
return {
|
|
391
|
+
ns,
|
|
392
|
+
minWidth,
|
|
393
|
+
popperClass,
|
|
394
|
+
isMultiple,
|
|
395
|
+
isFitInputWidth
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
400
|
+
return openBlock(), createElementBlock("div", {
|
|
401
|
+
class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
|
|
402
|
+
style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
|
|
403
|
+
}, [
|
|
404
|
+
_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
|
|
405
|
+
key: 0,
|
|
406
|
+
class: normalizeClass(_ctx.ns.be("dropdown", "header"))
|
|
407
|
+
}, [
|
|
408
|
+
renderSlot(_ctx.$slots, "header")
|
|
409
|
+
], 2)) : createCommentVNode("v-if", true),
|
|
410
|
+
renderSlot(_ctx.$slots, "default"),
|
|
411
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
|
|
412
|
+
key: 1,
|
|
413
|
+
class: normalizeClass(_ctx.ns.be("dropdown", "footer"))
|
|
414
|
+
}, [
|
|
415
|
+
renderSlot(_ctx.$slots, "footer")
|
|
416
|
+
], 2)) : createCommentVNode("v-if", true)
|
|
417
|
+
], 6);
|
|
418
|
+
}
|
|
419
|
+
var ElSelectMenu = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__file", "select-dropdown.vue"]]);
|
|
420
|
+
|
|
421
|
+
const useSelect = (props, emit) => {
|
|
422
|
+
const { t } = useLocale();
|
|
423
|
+
const contentId = useId();
|
|
424
|
+
const nsSelect = useNamespace("select");
|
|
425
|
+
const nsInput = useNamespace("input");
|
|
426
|
+
const states = reactive({
|
|
427
|
+
inputValue: "",
|
|
428
|
+
options: /* @__PURE__ */ new Map(),
|
|
429
|
+
cachedOptions: /* @__PURE__ */ new Map(),
|
|
430
|
+
optionValues: [],
|
|
431
|
+
selected: [],
|
|
432
|
+
selectionWidth: 0,
|
|
433
|
+
collapseItemWidth: 0,
|
|
434
|
+
selectedLabel: "",
|
|
435
|
+
hoveringIndex: -1,
|
|
436
|
+
previousQuery: null,
|
|
437
|
+
inputHovering: false,
|
|
438
|
+
menuVisibleOnFocus: false,
|
|
439
|
+
isBeforeHide: false
|
|
440
|
+
});
|
|
441
|
+
const selectRef = ref();
|
|
442
|
+
const selectionRef = ref();
|
|
443
|
+
const tooltipRef = ref();
|
|
444
|
+
const tagTooltipRef = ref();
|
|
445
|
+
const inputRef = ref();
|
|
446
|
+
const prefixRef = ref();
|
|
447
|
+
const suffixRef = ref();
|
|
448
|
+
const menuRef = ref();
|
|
449
|
+
const tagMenuRef = ref();
|
|
450
|
+
const collapseItemRef = ref();
|
|
451
|
+
const scrollbarRef = ref();
|
|
452
|
+
const expanded = ref(false);
|
|
453
|
+
const hoverOption = ref();
|
|
454
|
+
const debouncing = ref(false);
|
|
455
|
+
const { form, formItem } = useFormItem();
|
|
456
|
+
const { inputId } = useFormItemInputId(props, {
|
|
457
|
+
formItemContext: formItem
|
|
458
|
+
});
|
|
459
|
+
const { valueOnClear, isEmptyValue } = useEmptyValues(props);
|
|
460
|
+
const {
|
|
461
|
+
isComposing,
|
|
462
|
+
handleCompositionStart,
|
|
463
|
+
handleCompositionUpdate,
|
|
464
|
+
handleCompositionEnd
|
|
465
|
+
} = useComposition({
|
|
466
|
+
afterComposition: (e) => onInput(e)
|
|
467
|
+
});
|
|
468
|
+
const selectDisabled = useFormDisabled();
|
|
469
|
+
const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
|
|
470
|
+
disabled: selectDisabled,
|
|
471
|
+
afterFocus() {
|
|
472
|
+
if (props.automaticDropdown && !expanded.value) {
|
|
473
|
+
expanded.value = true;
|
|
474
|
+
states.menuVisibleOnFocus = true;
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
beforeBlur(event) {
|
|
478
|
+
var _a, _b;
|
|
479
|
+
return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
|
|
480
|
+
},
|
|
481
|
+
afterBlur() {
|
|
482
|
+
var _a;
|
|
483
|
+
expanded.value = false;
|
|
484
|
+
states.menuVisibleOnFocus = false;
|
|
485
|
+
if (props.validateEvent) {
|
|
486
|
+
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
const hasModelValue = computed(() => {
|
|
491
|
+
return isArray$1(props.modelValue) ? props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
|
|
492
|
+
});
|
|
493
|
+
const needStatusIcon = computed(() => {
|
|
494
|
+
var _a;
|
|
495
|
+
return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
|
|
496
|
+
});
|
|
497
|
+
const showClearBtn = computed(() => {
|
|
498
|
+
return props.clearable && !selectDisabled.value && hasModelValue.value && (isFocused.value || states.inputHovering);
|
|
499
|
+
});
|
|
500
|
+
const iconComponent = computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
|
|
501
|
+
const iconReverse = computed(() => nsSelect.is("reverse", !!(iconComponent.value && expanded.value)));
|
|
502
|
+
const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
|
|
503
|
+
const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
|
|
504
|
+
const debounce = computed(() => props.remote ? props.debounce : 0);
|
|
505
|
+
const isRemoteSearchEmpty = computed(() => props.remote && !states.inputValue && states.options.size === 0);
|
|
506
|
+
const emptyText = computed(() => {
|
|
507
|
+
if (props.loading) {
|
|
508
|
+
return props.loadingText || t("el.select.loading");
|
|
509
|
+
} else {
|
|
510
|
+
if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) {
|
|
511
|
+
return props.noMatchText || t("el.select.noMatch");
|
|
512
|
+
}
|
|
513
|
+
if (states.options.size === 0) {
|
|
514
|
+
return props.noDataText || t("el.select.noData");
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return null;
|
|
518
|
+
});
|
|
519
|
+
const filteredOptionsCount = computed(() => optionsArray.value.filter((option) => option.visible).length);
|
|
520
|
+
const optionsArray = computed(() => {
|
|
521
|
+
const list = Array.from(states.options.values());
|
|
522
|
+
const newList = [];
|
|
523
|
+
states.optionValues.forEach((item) => {
|
|
524
|
+
const index = list.findIndex((i) => i.value === item);
|
|
525
|
+
if (index > -1) {
|
|
526
|
+
newList.push(list[index]);
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
return newList.length >= list.length ? newList : list;
|
|
530
|
+
});
|
|
531
|
+
const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
|
|
532
|
+
const showNewOption = computed(() => {
|
|
533
|
+
const hasExistingOption = optionsArray.value.filter((option) => {
|
|
534
|
+
return !option.created;
|
|
535
|
+
}).some((option) => {
|
|
536
|
+
return option.currentLabel === states.inputValue;
|
|
537
|
+
});
|
|
538
|
+
return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
|
|
539
|
+
});
|
|
540
|
+
const updateOptions = () => {
|
|
541
|
+
if (props.filterable && isFunction(props.filterMethod))
|
|
542
|
+
return;
|
|
543
|
+
if (props.filterable && props.remote && isFunction(props.remoteMethod))
|
|
544
|
+
return;
|
|
545
|
+
optionsArray.value.forEach((option) => {
|
|
546
|
+
var _a;
|
|
547
|
+
(_a = option.updateOption) == null ? void 0 : _a.call(option, states.inputValue);
|
|
548
|
+
});
|
|
549
|
+
};
|
|
550
|
+
const selectSize = useFormSize();
|
|
551
|
+
const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
|
|
552
|
+
const dropdownMenuVisible = computed({
|
|
553
|
+
get() {
|
|
554
|
+
return expanded.value && (props.loading || !isRemoteSearchEmpty.value) && (!debouncing.value || !isEmpty(states.previousQuery));
|
|
555
|
+
},
|
|
556
|
+
set(val) {
|
|
557
|
+
expanded.value = val;
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
const shouldShowPlaceholder = computed(() => {
|
|
561
|
+
if (props.multiple && !isUndefined(props.modelValue)) {
|
|
562
|
+
return castArray(props.modelValue).length === 0 && !states.inputValue;
|
|
563
|
+
}
|
|
564
|
+
const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
|
|
565
|
+
return props.filterable || isUndefined(value) ? !states.inputValue : true;
|
|
566
|
+
});
|
|
567
|
+
const currentPlaceholder = computed(() => {
|
|
568
|
+
var _a;
|
|
569
|
+
const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
|
|
570
|
+
return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
|
|
571
|
+
});
|
|
572
|
+
const mouseEnterEventName = computed(() => isIOS ? null : "mouseenter");
|
|
573
|
+
watch(() => props.modelValue, (val, oldVal) => {
|
|
574
|
+
if (props.multiple) {
|
|
575
|
+
if (props.filterable && !props.reserveKeyword) {
|
|
576
|
+
states.inputValue = "";
|
|
577
|
+
handleQueryChange("");
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
setSelected();
|
|
581
|
+
if (!isEqual(val, oldVal) && props.validateEvent) {
|
|
582
|
+
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
|
|
583
|
+
}
|
|
584
|
+
}, {
|
|
585
|
+
flush: "post",
|
|
586
|
+
deep: true
|
|
587
|
+
});
|
|
588
|
+
watch(() => expanded.value, (val) => {
|
|
589
|
+
if (val) {
|
|
590
|
+
handleQueryChange(states.inputValue);
|
|
591
|
+
} else {
|
|
592
|
+
states.inputValue = "";
|
|
593
|
+
states.previousQuery = null;
|
|
594
|
+
states.isBeforeHide = true;
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
watch(() => states.options.entries(), () => {
|
|
598
|
+
if (!isClient)
|
|
599
|
+
return;
|
|
600
|
+
setSelected();
|
|
601
|
+
if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
|
|
602
|
+
checkDefaultFirstOption();
|
|
603
|
+
}
|
|
604
|
+
}, {
|
|
605
|
+
flush: "post"
|
|
606
|
+
});
|
|
607
|
+
watch([() => states.hoveringIndex, optionsArray], ([val]) => {
|
|
608
|
+
if (isNumber(val) && val > -1) {
|
|
609
|
+
hoverOption.value = optionsArray.value[val] || {};
|
|
610
|
+
} else {
|
|
611
|
+
hoverOption.value = {};
|
|
612
|
+
}
|
|
613
|
+
optionsArray.value.forEach((option) => {
|
|
614
|
+
option.hover = hoverOption.value === option;
|
|
615
|
+
});
|
|
616
|
+
});
|
|
617
|
+
watchEffect(() => {
|
|
618
|
+
if (states.isBeforeHide)
|
|
619
|
+
return;
|
|
620
|
+
updateOptions();
|
|
621
|
+
});
|
|
622
|
+
const handleQueryChange = (val) => {
|
|
623
|
+
if (states.previousQuery === val || isComposing.value) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
states.previousQuery = val;
|
|
627
|
+
if (props.filterable && isFunction(props.filterMethod)) {
|
|
628
|
+
props.filterMethod(val);
|
|
629
|
+
} else if (props.filterable && props.remote && isFunction(props.remoteMethod)) {
|
|
630
|
+
props.remoteMethod(val);
|
|
631
|
+
}
|
|
632
|
+
if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
|
|
633
|
+
nextTick(checkDefaultFirstOption);
|
|
634
|
+
} else {
|
|
635
|
+
nextTick(updateHoveringIndex);
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
const checkDefaultFirstOption = () => {
|
|
639
|
+
const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
|
|
640
|
+
const userCreatedOption = optionsInDropdown.find((n) => n.created);
|
|
641
|
+
const firstOriginOption = optionsInDropdown[0];
|
|
642
|
+
const valueList = optionsArray.value.map((item) => item.value);
|
|
643
|
+
states.hoveringIndex = getValueIndex(valueList, userCreatedOption || firstOriginOption);
|
|
644
|
+
};
|
|
645
|
+
const setSelected = () => {
|
|
646
|
+
if (!props.multiple) {
|
|
647
|
+
const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
|
|
648
|
+
const option = getOption(value);
|
|
649
|
+
states.selectedLabel = option.currentLabel;
|
|
650
|
+
states.selected = [option];
|
|
651
|
+
return;
|
|
652
|
+
} else {
|
|
653
|
+
states.selectedLabel = "";
|
|
654
|
+
}
|
|
655
|
+
const result = [];
|
|
656
|
+
if (!isUndefined(props.modelValue)) {
|
|
657
|
+
castArray(props.modelValue).forEach((value) => {
|
|
658
|
+
result.push(getOption(value));
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
states.selected = result;
|
|
662
|
+
};
|
|
663
|
+
const getOption = (value) => {
|
|
664
|
+
let option;
|
|
665
|
+
const isObjectValue = isPlainObject(value);
|
|
666
|
+
for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
|
|
667
|
+
const cachedOption = cachedOptionsArray.value[i];
|
|
668
|
+
const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
|
|
669
|
+
if (isEqualValue) {
|
|
670
|
+
option = {
|
|
671
|
+
index: optionsArray.value.filter((opt) => !opt.created).indexOf(cachedOption),
|
|
672
|
+
value,
|
|
673
|
+
currentLabel: cachedOption.currentLabel,
|
|
674
|
+
get isDisabled() {
|
|
675
|
+
return cachedOption.isDisabled;
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
if (option)
|
|
682
|
+
return option;
|
|
683
|
+
const label = isObjectValue ? value.label : value != null ? value : "";
|
|
684
|
+
const newOption = {
|
|
685
|
+
index: -1,
|
|
686
|
+
value,
|
|
687
|
+
currentLabel: label
|
|
688
|
+
};
|
|
689
|
+
return newOption;
|
|
690
|
+
};
|
|
691
|
+
const updateHoveringIndex = () => {
|
|
692
|
+
const length = states.selected.length;
|
|
693
|
+
if (length > 0) {
|
|
694
|
+
const lastOption = states.selected[length - 1];
|
|
695
|
+
states.hoveringIndex = optionsArray.value.findIndex((item) => getValueKey(lastOption) === getValueKey(item));
|
|
696
|
+
} else {
|
|
697
|
+
states.hoveringIndex = -1;
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
const resetSelectionWidth = () => {
|
|
701
|
+
states.selectionWidth = Number.parseFloat(window.getComputedStyle(selectionRef.value).width);
|
|
702
|
+
};
|
|
703
|
+
const resetCollapseItemWidth = () => {
|
|
704
|
+
states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
|
|
705
|
+
};
|
|
706
|
+
const updateTooltip = () => {
|
|
707
|
+
var _a, _b;
|
|
708
|
+
(_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
|
|
709
|
+
};
|
|
710
|
+
const updateTagTooltip = () => {
|
|
711
|
+
var _a, _b;
|
|
712
|
+
(_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
|
|
713
|
+
};
|
|
714
|
+
const onInputChange = () => {
|
|
715
|
+
if (states.inputValue.length > 0 && !expanded.value) {
|
|
716
|
+
expanded.value = true;
|
|
717
|
+
}
|
|
718
|
+
handleQueryChange(states.inputValue);
|
|
719
|
+
};
|
|
720
|
+
const onInput = (event) => {
|
|
721
|
+
states.inputValue = event.target.value;
|
|
722
|
+
if (props.remote) {
|
|
723
|
+
debouncing.value = true;
|
|
724
|
+
debouncedOnInputChange();
|
|
725
|
+
} else {
|
|
726
|
+
return onInputChange();
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
const debouncedOnInputChange = useDebounceFn(() => {
|
|
730
|
+
onInputChange();
|
|
731
|
+
debouncing.value = false;
|
|
732
|
+
}, debounce);
|
|
733
|
+
const emitChange = (val) => {
|
|
734
|
+
if (!isEqual(props.modelValue, val)) {
|
|
735
|
+
emit(CHANGE_EVENT, val);
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => {
|
|
739
|
+
const option = states.cachedOptions.get(it);
|
|
740
|
+
return !(option == null ? void 0 : option.disabled) && !(option == null ? void 0 : option.states.groupDisabled);
|
|
741
|
+
});
|
|
742
|
+
const deletePrevTag = (e) => {
|
|
743
|
+
const code = getEventCode(e);
|
|
744
|
+
if (!props.multiple)
|
|
745
|
+
return;
|
|
746
|
+
if (code === EVENT_CODE.delete)
|
|
747
|
+
return;
|
|
748
|
+
if (e.target.value.length <= 0) {
|
|
749
|
+
const value = castArray(props.modelValue).slice();
|
|
750
|
+
const lastNotDisabledIndex = getLastNotDisabledIndex(value);
|
|
751
|
+
if (lastNotDisabledIndex < 0)
|
|
752
|
+
return;
|
|
753
|
+
const removeTagValue = value[lastNotDisabledIndex];
|
|
754
|
+
value.splice(lastNotDisabledIndex, 1);
|
|
755
|
+
emit(UPDATE_MODEL_EVENT, value);
|
|
756
|
+
emitChange(value);
|
|
757
|
+
emit("remove-tag", removeTagValue);
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
const deleteTag = (event, tag) => {
|
|
761
|
+
const index = states.selected.indexOf(tag);
|
|
762
|
+
if (index > -1 && !selectDisabled.value) {
|
|
763
|
+
const value = castArray(props.modelValue).slice();
|
|
764
|
+
value.splice(index, 1);
|
|
765
|
+
emit(UPDATE_MODEL_EVENT, value);
|
|
766
|
+
emitChange(value);
|
|
767
|
+
emit("remove-tag", tag.value);
|
|
768
|
+
}
|
|
769
|
+
event.stopPropagation();
|
|
770
|
+
focus();
|
|
771
|
+
};
|
|
772
|
+
const deleteSelected = (event) => {
|
|
773
|
+
event.stopPropagation();
|
|
774
|
+
const value = props.multiple ? [] : valueOnClear.value;
|
|
775
|
+
if (props.multiple) {
|
|
776
|
+
for (const item of states.selected) {
|
|
777
|
+
if (item.isDisabled)
|
|
778
|
+
value.push(item.value);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
emit(UPDATE_MODEL_EVENT, value);
|
|
782
|
+
emitChange(value);
|
|
783
|
+
states.hoveringIndex = -1;
|
|
784
|
+
expanded.value = false;
|
|
785
|
+
emit("clear");
|
|
786
|
+
focus();
|
|
787
|
+
};
|
|
788
|
+
const handleOptionSelect = (option) => {
|
|
789
|
+
var _a;
|
|
790
|
+
if (props.multiple) {
|
|
791
|
+
const value = castArray((_a = props.modelValue) != null ? _a : []).slice();
|
|
792
|
+
const optionIndex = getValueIndex(value, option);
|
|
793
|
+
if (optionIndex > -1) {
|
|
794
|
+
value.splice(optionIndex, 1);
|
|
795
|
+
} else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
|
|
796
|
+
value.push(option.value);
|
|
797
|
+
}
|
|
798
|
+
emit(UPDATE_MODEL_EVENT, value);
|
|
799
|
+
emitChange(value);
|
|
800
|
+
if (option.created) {
|
|
801
|
+
handleQueryChange("");
|
|
802
|
+
}
|
|
803
|
+
if (props.filterable && !props.reserveKeyword) {
|
|
804
|
+
states.inputValue = "";
|
|
805
|
+
}
|
|
806
|
+
} else {
|
|
807
|
+
!isEqual(props.modelValue, option.value) && emit(UPDATE_MODEL_EVENT, option.value);
|
|
808
|
+
emitChange(option.value);
|
|
809
|
+
expanded.value = false;
|
|
810
|
+
}
|
|
811
|
+
focus();
|
|
812
|
+
if (expanded.value)
|
|
813
|
+
return;
|
|
814
|
+
nextTick(() => {
|
|
815
|
+
scrollToOption(option);
|
|
816
|
+
});
|
|
817
|
+
};
|
|
818
|
+
const getValueIndex = (arr, option) => {
|
|
819
|
+
if (isUndefined(option))
|
|
820
|
+
return -1;
|
|
821
|
+
if (!isObject(option.value))
|
|
822
|
+
return arr.indexOf(option.value);
|
|
823
|
+
return arr.findIndex((item) => {
|
|
824
|
+
return isEqual(get(item, props.valueKey), getValueKey(option));
|
|
825
|
+
});
|
|
826
|
+
};
|
|
827
|
+
const scrollToOption = (option) => {
|
|
828
|
+
var _a, _b, _c, _d, _e;
|
|
829
|
+
const targetOption = isArray$1(option) ? option[option.length - 1] : option;
|
|
830
|
+
let target = null;
|
|
831
|
+
if (!isNil(targetOption == null ? void 0 : targetOption.value)) {
|
|
832
|
+
const options = optionsArray.value.filter((item) => item.value === targetOption.value);
|
|
833
|
+
if (options.length > 0) {
|
|
834
|
+
target = options[0].$el;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
if (tooltipRef.value && target) {
|
|
838
|
+
const menu = (_d = (_c = (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${nsSelect.be("dropdown", "wrap")}`);
|
|
839
|
+
if (menu) {
|
|
840
|
+
scrollIntoView(menu, target);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
(_e = scrollbarRef.value) == null ? void 0 : _e.handleScroll();
|
|
844
|
+
};
|
|
845
|
+
const onOptionCreate = (vm) => {
|
|
846
|
+
states.options.set(vm.value, vm);
|
|
847
|
+
states.cachedOptions.set(vm.value, vm);
|
|
848
|
+
};
|
|
849
|
+
const onOptionDestroy = (key, vm) => {
|
|
850
|
+
if (states.options.get(key) === vm) {
|
|
851
|
+
states.options.delete(key);
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
const popperRef = computed(() => {
|
|
855
|
+
var _a, _b;
|
|
856
|
+
return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
|
|
857
|
+
});
|
|
858
|
+
const handleMenuEnter = () => {
|
|
859
|
+
states.isBeforeHide = false;
|
|
860
|
+
nextTick(() => {
|
|
861
|
+
var _a;
|
|
862
|
+
(_a = scrollbarRef.value) == null ? void 0 : _a.update();
|
|
863
|
+
scrollToOption(states.selected);
|
|
864
|
+
});
|
|
865
|
+
};
|
|
866
|
+
const focus = () => {
|
|
867
|
+
var _a;
|
|
868
|
+
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
869
|
+
};
|
|
870
|
+
const blur = () => {
|
|
871
|
+
var _a;
|
|
872
|
+
if (expanded.value) {
|
|
873
|
+
expanded.value = false;
|
|
874
|
+
nextTick(() => {
|
|
875
|
+
var _a2;
|
|
876
|
+
return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
|
|
877
|
+
});
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
(_a = inputRef.value) == null ? void 0 : _a.blur();
|
|
881
|
+
};
|
|
882
|
+
const handleClearClick = (event) => {
|
|
883
|
+
deleteSelected(event);
|
|
884
|
+
};
|
|
885
|
+
const handleClickOutside = (event) => {
|
|
886
|
+
expanded.value = false;
|
|
887
|
+
if (isFocused.value) {
|
|
888
|
+
const _event = new FocusEvent("blur", event);
|
|
889
|
+
nextTick(() => handleBlur(_event));
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
const handleEsc = () => {
|
|
893
|
+
if (states.inputValue.length > 0) {
|
|
894
|
+
states.inputValue = "";
|
|
895
|
+
} else {
|
|
896
|
+
expanded.value = false;
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
const toggleMenu = (event) => {
|
|
900
|
+
var _a;
|
|
901
|
+
if (selectDisabled.value || props.filterable && expanded.value && event && !((_a = suffixRef.value) == null ? void 0 : _a.contains(event.target)))
|
|
902
|
+
return;
|
|
903
|
+
if (isIOS)
|
|
904
|
+
states.inputHovering = true;
|
|
905
|
+
if (states.menuVisibleOnFocus) {
|
|
906
|
+
states.menuVisibleOnFocus = false;
|
|
907
|
+
} else {
|
|
908
|
+
expanded.value = !expanded.value;
|
|
909
|
+
}
|
|
910
|
+
};
|
|
911
|
+
const selectOption = () => {
|
|
912
|
+
if (!expanded.value) {
|
|
913
|
+
toggleMenu();
|
|
914
|
+
} else {
|
|
915
|
+
const option = optionsArray.value[states.hoveringIndex];
|
|
916
|
+
if (option && !option.isDisabled) {
|
|
917
|
+
handleOptionSelect(option);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
const getValueKey = (item) => {
|
|
922
|
+
return isObject(item.value) ? get(item.value, props.valueKey) : item.value;
|
|
923
|
+
};
|
|
924
|
+
const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.isDisabled));
|
|
925
|
+
const showTagList = computed(() => {
|
|
926
|
+
if (!props.multiple) {
|
|
927
|
+
return [];
|
|
928
|
+
}
|
|
929
|
+
return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
|
|
930
|
+
});
|
|
931
|
+
const collapseTagList = computed(() => {
|
|
932
|
+
if (!props.multiple) {
|
|
933
|
+
return [];
|
|
934
|
+
}
|
|
935
|
+
return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
|
|
936
|
+
});
|
|
937
|
+
const navigateOptions = (direction) => {
|
|
938
|
+
if (!expanded.value) {
|
|
939
|
+
expanded.value = true;
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
if (states.options.size === 0 || filteredOptionsCount.value === 0 || isComposing.value)
|
|
943
|
+
return;
|
|
944
|
+
if (!optionsAllDisabled.value) {
|
|
945
|
+
if (direction === "next") {
|
|
946
|
+
states.hoveringIndex++;
|
|
947
|
+
if (states.hoveringIndex === states.options.size) {
|
|
948
|
+
states.hoveringIndex = 0;
|
|
949
|
+
}
|
|
950
|
+
} else if (direction === "prev") {
|
|
951
|
+
states.hoveringIndex--;
|
|
952
|
+
if (states.hoveringIndex < 0) {
|
|
953
|
+
states.hoveringIndex = states.options.size - 1;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
const option = optionsArray.value[states.hoveringIndex];
|
|
957
|
+
if (option.isDisabled || !option.visible) {
|
|
958
|
+
navigateOptions(direction);
|
|
959
|
+
}
|
|
960
|
+
nextTick(() => scrollToOption(hoverOption.value));
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
const findFocusableIndex = (arr, start, step, len) => {
|
|
964
|
+
for (let i = start; i >= 0 && i < len; i += step) {
|
|
965
|
+
const obj = arr[i];
|
|
966
|
+
if (!(obj == null ? void 0 : obj.isDisabled) && (obj == null ? void 0 : obj.visible)) {
|
|
967
|
+
return i;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
return null;
|
|
971
|
+
};
|
|
972
|
+
const focusOption = (targetIndex, mode) => {
|
|
973
|
+
var _a;
|
|
974
|
+
const len = states.options.size;
|
|
975
|
+
if (len === 0)
|
|
976
|
+
return;
|
|
977
|
+
const start = clamp(targetIndex, 0, len - 1);
|
|
978
|
+
const options = optionsArray.value;
|
|
979
|
+
const direction = mode === "up" ? -1 : 1;
|
|
980
|
+
const newIndex = (_a = findFocusableIndex(options, start, direction, len)) != null ? _a : findFocusableIndex(options, start - direction, -direction, len);
|
|
981
|
+
if (newIndex != null) {
|
|
982
|
+
states.hoveringIndex = newIndex;
|
|
983
|
+
nextTick(() => scrollToOption(hoverOption.value));
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
const handleKeydown = (e) => {
|
|
987
|
+
const code = getEventCode(e);
|
|
988
|
+
let isPreventDefault = true;
|
|
989
|
+
switch (code) {
|
|
990
|
+
case EVENT_CODE.up:
|
|
991
|
+
navigateOptions("prev");
|
|
992
|
+
break;
|
|
993
|
+
case EVENT_CODE.down:
|
|
994
|
+
navigateOptions("next");
|
|
995
|
+
break;
|
|
996
|
+
case EVENT_CODE.enter:
|
|
997
|
+
case EVENT_CODE.numpadEnter:
|
|
998
|
+
if (!isComposing.value) {
|
|
999
|
+
selectOption();
|
|
1000
|
+
}
|
|
1001
|
+
break;
|
|
1002
|
+
case EVENT_CODE.esc:
|
|
1003
|
+
handleEsc();
|
|
1004
|
+
break;
|
|
1005
|
+
case EVENT_CODE.backspace:
|
|
1006
|
+
isPreventDefault = false;
|
|
1007
|
+
deletePrevTag(e);
|
|
1008
|
+
return;
|
|
1009
|
+
case EVENT_CODE.home:
|
|
1010
|
+
if (!expanded.value)
|
|
1011
|
+
return;
|
|
1012
|
+
focusOption(0, "down");
|
|
1013
|
+
break;
|
|
1014
|
+
case EVENT_CODE.end:
|
|
1015
|
+
if (!expanded.value)
|
|
1016
|
+
return;
|
|
1017
|
+
focusOption(states.options.size - 1, "up");
|
|
1018
|
+
break;
|
|
1019
|
+
case EVENT_CODE.pageUp:
|
|
1020
|
+
if (!expanded.value)
|
|
1021
|
+
return;
|
|
1022
|
+
focusOption(states.hoveringIndex - 10, "up");
|
|
1023
|
+
break;
|
|
1024
|
+
case EVENT_CODE.pageDown:
|
|
1025
|
+
if (!expanded.value)
|
|
1026
|
+
return;
|
|
1027
|
+
focusOption(states.hoveringIndex + 10, "down");
|
|
1028
|
+
break;
|
|
1029
|
+
default:
|
|
1030
|
+
isPreventDefault = false;
|
|
1031
|
+
break;
|
|
1032
|
+
}
|
|
1033
|
+
if (isPreventDefault) {
|
|
1034
|
+
e.preventDefault();
|
|
1035
|
+
e.stopPropagation();
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
const getGapWidth = () => {
|
|
1039
|
+
if (!selectionRef.value)
|
|
1040
|
+
return 0;
|
|
1041
|
+
const style = window.getComputedStyle(selectionRef.value);
|
|
1042
|
+
return Number.parseFloat(style.gap || "6px");
|
|
1043
|
+
};
|
|
1044
|
+
const tagStyle = computed(() => {
|
|
1045
|
+
const gapWidth = getGapWidth();
|
|
1046
|
+
const inputSlotWidth = props.filterable ? gapWidth + MINIMUM_INPUT_WIDTH : 0;
|
|
1047
|
+
const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.selectionWidth - inputSlotWidth;
|
|
1048
|
+
return { maxWidth: `${maxWidth}px` };
|
|
1049
|
+
});
|
|
1050
|
+
const collapseTagStyle = computed(() => {
|
|
1051
|
+
return { maxWidth: `${states.selectionWidth}px` };
|
|
1052
|
+
});
|
|
1053
|
+
const popupScroll = (data) => {
|
|
1054
|
+
emit("popup-scroll", data);
|
|
1055
|
+
};
|
|
1056
|
+
useResizeObserver(selectionRef, resetSelectionWidth);
|
|
1057
|
+
useResizeObserver(wrapperRef, updateTooltip);
|
|
1058
|
+
useResizeObserver(tagMenuRef, updateTagTooltip);
|
|
1059
|
+
useResizeObserver(collapseItemRef, resetCollapseItemWidth);
|
|
1060
|
+
let stop;
|
|
1061
|
+
watch(() => dropdownMenuVisible.value, (newVal) => {
|
|
1062
|
+
if (newVal) {
|
|
1063
|
+
stop = useResizeObserver(menuRef, updateTooltip).stop;
|
|
1064
|
+
} else {
|
|
1065
|
+
stop == null ? void 0 : stop();
|
|
1066
|
+
stop = void 0;
|
|
1067
|
+
}
|
|
1068
|
+
emit("visible-change", newVal);
|
|
1069
|
+
});
|
|
1070
|
+
onMounted(() => {
|
|
1071
|
+
setSelected();
|
|
1072
|
+
});
|
|
1073
|
+
return {
|
|
1074
|
+
inputId,
|
|
1075
|
+
contentId,
|
|
1076
|
+
nsSelect,
|
|
1077
|
+
nsInput,
|
|
1078
|
+
states,
|
|
1079
|
+
isFocused,
|
|
1080
|
+
expanded,
|
|
1081
|
+
optionsArray,
|
|
1082
|
+
hoverOption,
|
|
1083
|
+
selectSize,
|
|
1084
|
+
filteredOptionsCount,
|
|
1085
|
+
updateTooltip,
|
|
1086
|
+
updateTagTooltip,
|
|
1087
|
+
debouncedOnInputChange,
|
|
1088
|
+
onInput,
|
|
1089
|
+
deletePrevTag,
|
|
1090
|
+
deleteTag,
|
|
1091
|
+
deleteSelected,
|
|
1092
|
+
handleOptionSelect,
|
|
1093
|
+
scrollToOption,
|
|
1094
|
+
hasModelValue,
|
|
1095
|
+
shouldShowPlaceholder,
|
|
1096
|
+
currentPlaceholder,
|
|
1097
|
+
mouseEnterEventName,
|
|
1098
|
+
needStatusIcon,
|
|
1099
|
+
showClearBtn,
|
|
1100
|
+
iconComponent,
|
|
1101
|
+
iconReverse,
|
|
1102
|
+
validateState,
|
|
1103
|
+
validateIcon,
|
|
1104
|
+
showNewOption,
|
|
1105
|
+
updateOptions,
|
|
1106
|
+
collapseTagSize,
|
|
1107
|
+
setSelected,
|
|
1108
|
+
selectDisabled,
|
|
1109
|
+
emptyText,
|
|
1110
|
+
handleCompositionStart,
|
|
1111
|
+
handleCompositionUpdate,
|
|
1112
|
+
handleCompositionEnd,
|
|
1113
|
+
handleKeydown,
|
|
1114
|
+
onOptionCreate,
|
|
1115
|
+
onOptionDestroy,
|
|
1116
|
+
handleMenuEnter,
|
|
1117
|
+
focus,
|
|
1118
|
+
blur,
|
|
1119
|
+
handleClearClick,
|
|
1120
|
+
handleClickOutside,
|
|
1121
|
+
handleEsc,
|
|
1122
|
+
toggleMenu,
|
|
1123
|
+
selectOption,
|
|
1124
|
+
getValueKey,
|
|
1125
|
+
navigateOptions,
|
|
1126
|
+
dropdownMenuVisible,
|
|
1127
|
+
showTagList,
|
|
1128
|
+
collapseTagList,
|
|
1129
|
+
popupScroll,
|
|
1130
|
+
getOption,
|
|
1131
|
+
tagStyle,
|
|
1132
|
+
collapseTagStyle,
|
|
1133
|
+
popperRef,
|
|
1134
|
+
inputRef,
|
|
1135
|
+
tooltipRef,
|
|
1136
|
+
tagTooltipRef,
|
|
1137
|
+
prefixRef,
|
|
1138
|
+
suffixRef,
|
|
1139
|
+
selectRef,
|
|
1140
|
+
wrapperRef,
|
|
1141
|
+
selectionRef,
|
|
1142
|
+
scrollbarRef,
|
|
1143
|
+
menuRef,
|
|
1144
|
+
tagMenuRef,
|
|
1145
|
+
collapseItemRef
|
|
1146
|
+
};
|
|
1147
|
+
};
|
|
1148
|
+
|
|
1149
|
+
var ElOptions = defineComponent({
|
|
1150
|
+
name: "ElOptions",
|
|
1151
|
+
setup(_, { slots }) {
|
|
1152
|
+
const select = inject(selectKey);
|
|
1153
|
+
let cachedValueList = [];
|
|
1154
|
+
return () => {
|
|
1155
|
+
var _a, _b;
|
|
1156
|
+
const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
|
1157
|
+
const valueList = [];
|
|
1158
|
+
function filterOptions(children2) {
|
|
1159
|
+
if (!isArray$1(children2))
|
|
1160
|
+
return;
|
|
1161
|
+
children2.forEach((item) => {
|
|
1162
|
+
var _a2, _b2, _c, _d;
|
|
1163
|
+
const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
|
|
1164
|
+
if (name === "ElOptionGroup") {
|
|
1165
|
+
filterOptions(!isString(item.children) && !isArray$1(item.children) && isFunction((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
|
|
1166
|
+
} else if (name === "ElOption") {
|
|
1167
|
+
valueList.push((_d = item.props) == null ? void 0 : _d.value);
|
|
1168
|
+
} else if (isArray$1(item.children)) {
|
|
1169
|
+
filterOptions(item.children);
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
if (children.length) {
|
|
1174
|
+
filterOptions((_b = children[0]) == null ? void 0 : _b.children);
|
|
1175
|
+
}
|
|
1176
|
+
if (!isEqual(valueList, cachedValueList)) {
|
|
1177
|
+
cachedValueList = valueList;
|
|
1178
|
+
if (select) {
|
|
1179
|
+
select.states.optionValues = valueList;
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
return children;
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
|
|
1187
|
+
const selectProps = buildProps({
|
|
1188
|
+
name: String,
|
|
1189
|
+
id: String,
|
|
1190
|
+
modelValue: {
|
|
1191
|
+
type: definePropType([
|
|
1192
|
+
Array,
|
|
1193
|
+
String,
|
|
1194
|
+
Number,
|
|
1195
|
+
Boolean,
|
|
1196
|
+
Object
|
|
1197
|
+
]),
|
|
1198
|
+
default: void 0
|
|
1199
|
+
},
|
|
1200
|
+
autocomplete: {
|
|
1201
|
+
type: String,
|
|
1202
|
+
default: "off"
|
|
1203
|
+
},
|
|
1204
|
+
automaticDropdown: Boolean,
|
|
1205
|
+
size: useSizeProp,
|
|
1206
|
+
effect: {
|
|
1207
|
+
type: definePropType(String),
|
|
1208
|
+
default: "light"
|
|
1209
|
+
},
|
|
1210
|
+
disabled: {
|
|
1211
|
+
type: Boolean,
|
|
1212
|
+
default: void 0
|
|
1213
|
+
},
|
|
1214
|
+
clearable: Boolean,
|
|
1215
|
+
filterable: Boolean,
|
|
1216
|
+
allowCreate: Boolean,
|
|
1217
|
+
loading: Boolean,
|
|
1218
|
+
popperClass: {
|
|
1219
|
+
type: String,
|
|
1220
|
+
default: ""
|
|
1221
|
+
},
|
|
1222
|
+
popperStyle: {
|
|
1223
|
+
type: definePropType([String, Object])
|
|
1224
|
+
},
|
|
1225
|
+
popperOptions: {
|
|
1226
|
+
type: definePropType(Object),
|
|
1227
|
+
default: () => ({})
|
|
1228
|
+
},
|
|
1229
|
+
remote: Boolean,
|
|
1230
|
+
debounce: {
|
|
1231
|
+
type: Number,
|
|
1232
|
+
default: 300
|
|
1233
|
+
},
|
|
1234
|
+
loadingText: String,
|
|
1235
|
+
noMatchText: String,
|
|
1236
|
+
noDataText: String,
|
|
1237
|
+
remoteMethod: {
|
|
1238
|
+
type: definePropType(Function)
|
|
1239
|
+
},
|
|
1240
|
+
filterMethod: {
|
|
1241
|
+
type: definePropType(Function)
|
|
1242
|
+
},
|
|
1243
|
+
multiple: Boolean,
|
|
1244
|
+
multipleLimit: {
|
|
1245
|
+
type: Number,
|
|
1246
|
+
default: 0
|
|
1247
|
+
},
|
|
1248
|
+
placeholder: {
|
|
1249
|
+
type: String
|
|
1250
|
+
},
|
|
1251
|
+
defaultFirstOption: Boolean,
|
|
1252
|
+
reserveKeyword: {
|
|
1253
|
+
type: Boolean,
|
|
1254
|
+
default: true
|
|
1255
|
+
},
|
|
1256
|
+
valueKey: {
|
|
1257
|
+
type: String,
|
|
1258
|
+
default: "value"
|
|
1259
|
+
},
|
|
1260
|
+
collapseTags: Boolean,
|
|
1261
|
+
collapseTagsTooltip: Boolean,
|
|
1262
|
+
maxCollapseTags: {
|
|
1263
|
+
type: Number,
|
|
1264
|
+
default: 1
|
|
1265
|
+
},
|
|
1266
|
+
teleported: useTooltipContentProps.teleported,
|
|
1267
|
+
persistent: {
|
|
1268
|
+
type: Boolean,
|
|
1269
|
+
default: true
|
|
1270
|
+
},
|
|
1271
|
+
clearIcon: {
|
|
1272
|
+
type: iconPropType,
|
|
1273
|
+
default: CircleClose
|
|
1274
|
+
},
|
|
1275
|
+
fitInputWidth: Boolean,
|
|
1276
|
+
suffixIcon: {
|
|
1277
|
+
type: iconPropType,
|
|
1278
|
+
default: ArrowDown
|
|
1279
|
+
},
|
|
1280
|
+
tagType: { ...tagProps.type, default: "info" },
|
|
1281
|
+
tagEffect: { ...tagProps.effect, default: "light" },
|
|
1282
|
+
validateEvent: {
|
|
1283
|
+
type: Boolean,
|
|
1284
|
+
default: true
|
|
1285
|
+
},
|
|
1286
|
+
remoteShowSuffix: Boolean,
|
|
1287
|
+
showArrow: {
|
|
1288
|
+
type: Boolean,
|
|
1289
|
+
default: true
|
|
1290
|
+
},
|
|
1291
|
+
offset: {
|
|
1292
|
+
type: Number,
|
|
1293
|
+
default: 12
|
|
1294
|
+
},
|
|
1295
|
+
placement: {
|
|
1296
|
+
type: definePropType(String),
|
|
1297
|
+
values: Ee,
|
|
1298
|
+
default: "bottom-start"
|
|
1299
|
+
},
|
|
1300
|
+
fallbackPlacements: {
|
|
1301
|
+
type: definePropType(Array),
|
|
1302
|
+
default: ["bottom-start", "top-start", "right", "left"]
|
|
1303
|
+
},
|
|
1304
|
+
tabindex: {
|
|
1305
|
+
type: [String, Number],
|
|
1306
|
+
default: 0
|
|
1307
|
+
},
|
|
1308
|
+
appendTo: useTooltipContentProps.appendTo,
|
|
1309
|
+
options: {
|
|
1310
|
+
type: definePropType(Array)
|
|
1311
|
+
},
|
|
1312
|
+
props: {
|
|
1313
|
+
type: definePropType(Object),
|
|
1314
|
+
default: () => defaultProps
|
|
1315
|
+
},
|
|
1316
|
+
...useEmptyValuesProps,
|
|
1317
|
+
...useAriaProps(["ariaLabel"])
|
|
1318
|
+
});
|
|
1319
|
+
({
|
|
1320
|
+
"popup-scroll": scrollbarEmits.scroll});
|
|
1321
|
+
|
|
1322
|
+
const _sfc_main$1 = defineComponent({
|
|
1323
|
+
name: "ElOptionGroup",
|
|
1324
|
+
componentName: "ElOptionGroup",
|
|
1325
|
+
props: {
|
|
1326
|
+
label: String,
|
|
1327
|
+
disabled: Boolean
|
|
1328
|
+
},
|
|
1329
|
+
setup(props) {
|
|
1330
|
+
const ns = useNamespace("select");
|
|
1331
|
+
const groupRef = ref();
|
|
1332
|
+
const instance = getCurrentInstance();
|
|
1333
|
+
const children = ref([]);
|
|
1334
|
+
provide(selectGroupKey, reactive({
|
|
1335
|
+
...toRefs(props)
|
|
1336
|
+
}));
|
|
1337
|
+
const visible = computed(() => children.value.some((option) => option.visible === true));
|
|
1338
|
+
const isOption = (node) => {
|
|
1339
|
+
var _a;
|
|
1340
|
+
return node.type.name === "ElOption" && !!((_a = node.component) == null ? void 0 : _a.proxy);
|
|
1341
|
+
};
|
|
1342
|
+
const flattedChildren = (node) => {
|
|
1343
|
+
const nodes = castArray(node);
|
|
1344
|
+
const children2 = [];
|
|
1345
|
+
nodes.forEach((child) => {
|
|
1346
|
+
var _a;
|
|
1347
|
+
if (!isVNode(child))
|
|
1348
|
+
return;
|
|
1349
|
+
if (isOption(child)) {
|
|
1350
|
+
children2.push(child.component.proxy);
|
|
1351
|
+
} else if (isArray$1(child.children) && child.children.length) {
|
|
1352
|
+
children2.push(...flattedChildren(child.children));
|
|
1353
|
+
} else if ((_a = child.component) == null ? void 0 : _a.subTree) {
|
|
1354
|
+
children2.push(...flattedChildren(child.component.subTree));
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1357
|
+
return children2;
|
|
1358
|
+
};
|
|
1359
|
+
const updateChildren = () => {
|
|
1360
|
+
children.value = flattedChildren(instance.subTree);
|
|
1361
|
+
};
|
|
1362
|
+
onMounted(() => {
|
|
1363
|
+
updateChildren();
|
|
1364
|
+
});
|
|
1365
|
+
useMutationObserver(groupRef, updateChildren, {
|
|
1366
|
+
attributes: true,
|
|
1367
|
+
subtree: true,
|
|
1368
|
+
childList: true
|
|
1369
|
+
});
|
|
1370
|
+
return {
|
|
1371
|
+
groupRef,
|
|
1372
|
+
visible,
|
|
1373
|
+
ns
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1378
|
+
return withDirectives((openBlock(), createElementBlock("ul", {
|
|
1379
|
+
ref: "groupRef",
|
|
1380
|
+
class: normalizeClass(_ctx.ns.be("group", "wrap"))
|
|
1381
|
+
}, [
|
|
1382
|
+
createElementVNode("li", {
|
|
1383
|
+
class: normalizeClass(_ctx.ns.be("group", "title"))
|
|
1384
|
+
}, toDisplayString(_ctx.label), 3),
|
|
1385
|
+
createElementVNode("li", null, [
|
|
1386
|
+
createElementVNode("ul", {
|
|
1387
|
+
class: normalizeClass(_ctx.ns.b("group"))
|
|
1388
|
+
}, [
|
|
1389
|
+
renderSlot(_ctx.$slots, "default")
|
|
1390
|
+
], 2)
|
|
1391
|
+
])
|
|
1392
|
+
], 2)), [
|
|
1393
|
+
[vShow, _ctx.visible]
|
|
1394
|
+
]);
|
|
1395
|
+
}
|
|
1396
|
+
var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "option-group.vue"]]);
|
|
1397
|
+
|
|
1398
|
+
const COMPONENT_NAME = "ElSelect";
|
|
1399
|
+
const warnHandlerMap = /* @__PURE__ */ new WeakMap();
|
|
1400
|
+
const createSelectWarnHandler = (appContext) => {
|
|
1401
|
+
return (...args) => {
|
|
1402
|
+
var _a, _b;
|
|
1403
|
+
const message = args[0];
|
|
1404
|
+
if (!message || message.includes('Slot "default" invoked outside of the render function') && ((_a = args[2]) == null ? void 0 : _a.includes("ElTreeSelect")))
|
|
1405
|
+
return;
|
|
1406
|
+
const original = (_b = warnHandlerMap.get(appContext)) == null ? void 0 : _b.originalWarnHandler;
|
|
1407
|
+
if (original) {
|
|
1408
|
+
original(...args);
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
console.warn(...args);
|
|
1412
|
+
};
|
|
1413
|
+
};
|
|
1414
|
+
const getWarnHandlerRecord = (appContext) => {
|
|
1415
|
+
let record = warnHandlerMap.get(appContext);
|
|
1416
|
+
if (!record) {
|
|
1417
|
+
record = {
|
|
1418
|
+
originalWarnHandler: appContext.config.warnHandler,
|
|
1419
|
+
handler: createSelectWarnHandler(appContext),
|
|
1420
|
+
count: 0
|
|
1421
|
+
};
|
|
1422
|
+
warnHandlerMap.set(appContext, record);
|
|
1423
|
+
}
|
|
1424
|
+
return record;
|
|
1425
|
+
};
|
|
1426
|
+
const _sfc_main = defineComponent({
|
|
1427
|
+
name: COMPONENT_NAME,
|
|
1428
|
+
componentName: COMPONENT_NAME,
|
|
1429
|
+
components: {
|
|
1430
|
+
ElSelectMenu,
|
|
1431
|
+
ElOption: Option,
|
|
1432
|
+
ElOptions,
|
|
1433
|
+
ElOptionGroup: OptionGroup,
|
|
1434
|
+
ElTag,
|
|
1435
|
+
ElScrollbar,
|
|
1436
|
+
ElTooltip,
|
|
1437
|
+
ElIcon
|
|
1438
|
+
},
|
|
1439
|
+
directives: { ClickOutside },
|
|
1440
|
+
props: selectProps,
|
|
1441
|
+
emits: [
|
|
1442
|
+
UPDATE_MODEL_EVENT,
|
|
1443
|
+
CHANGE_EVENT,
|
|
1444
|
+
"remove-tag",
|
|
1445
|
+
"clear",
|
|
1446
|
+
"visible-change",
|
|
1447
|
+
"focus",
|
|
1448
|
+
"blur",
|
|
1449
|
+
"popup-scroll"
|
|
1450
|
+
],
|
|
1451
|
+
setup(props, { emit, slots }) {
|
|
1452
|
+
const instance = getCurrentInstance();
|
|
1453
|
+
const warnRecord = getWarnHandlerRecord(instance.appContext);
|
|
1454
|
+
warnRecord.count += 1;
|
|
1455
|
+
instance.appContext.config.warnHandler = warnRecord.handler;
|
|
1456
|
+
const modelValue = computed(() => {
|
|
1457
|
+
const { modelValue: rawModelValue, multiple } = props;
|
|
1458
|
+
const fallback = multiple ? [] : void 0;
|
|
1459
|
+
if (isArray$1(rawModelValue)) {
|
|
1460
|
+
return multiple ? rawModelValue : fallback;
|
|
1461
|
+
}
|
|
1462
|
+
return multiple ? fallback : rawModelValue;
|
|
1463
|
+
});
|
|
1464
|
+
const _props = reactive({
|
|
1465
|
+
...toRefs(props),
|
|
1466
|
+
modelValue
|
|
1467
|
+
});
|
|
1468
|
+
const API = useSelect(_props, emit);
|
|
1469
|
+
const { calculatorRef, inputStyle } = useCalcInputWidth();
|
|
1470
|
+
const { getLabel, getValue, getOptions, getDisabled } = useProps(props);
|
|
1471
|
+
const getOptionProps = (option) => ({
|
|
1472
|
+
label: getLabel(option),
|
|
1473
|
+
value: getValue(option),
|
|
1474
|
+
disabled: getDisabled(option)
|
|
1475
|
+
});
|
|
1476
|
+
const flatTreeSelectData = (data) => {
|
|
1477
|
+
return data.reduce((acc, item) => {
|
|
1478
|
+
acc.push(item);
|
|
1479
|
+
if (item.children && item.children.length > 0) {
|
|
1480
|
+
acc.push(...flatTreeSelectData(item.children));
|
|
1481
|
+
}
|
|
1482
|
+
return acc;
|
|
1483
|
+
}, []);
|
|
1484
|
+
};
|
|
1485
|
+
const manuallyRenderSlots = (vnodes) => {
|
|
1486
|
+
const children = flattedChildren(vnodes || []);
|
|
1487
|
+
children.forEach((item) => {
|
|
1488
|
+
var _a;
|
|
1489
|
+
if (isObject(item) && (item.type.name === "ElOption" || item.type.name === "ElTree")) {
|
|
1490
|
+
const _name = item.type.name;
|
|
1491
|
+
if (_name === "ElTree") {
|
|
1492
|
+
const treeData = ((_a = item.props) == null ? void 0 : _a.data) || [];
|
|
1493
|
+
const flatData = flatTreeSelectData(treeData);
|
|
1494
|
+
flatData.forEach((treeItem) => {
|
|
1495
|
+
treeItem.currentLabel = treeItem.label || (isObject(treeItem.value) ? "" : treeItem.value);
|
|
1496
|
+
API.onOptionCreate(treeItem);
|
|
1497
|
+
});
|
|
1498
|
+
} else if (_name === "ElOption") {
|
|
1499
|
+
const obj = { ...item.props };
|
|
1500
|
+
obj.currentLabel = obj.label || (isObject(obj.value) ? "" : obj.value);
|
|
1501
|
+
API.onOptionCreate(obj);
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
});
|
|
1505
|
+
};
|
|
1506
|
+
watch(() => {
|
|
1507
|
+
var _a;
|
|
1508
|
+
return [(_a = slots.default) == null ? void 0 : _a.call(slots), modelValue.value];
|
|
1509
|
+
}, () => {
|
|
1510
|
+
var _a;
|
|
1511
|
+
if (props.persistent || API.expanded.value) {
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
API.states.options.clear();
|
|
1515
|
+
manuallyRenderSlots((_a = slots.default) == null ? void 0 : _a.call(slots));
|
|
1516
|
+
}, {
|
|
1517
|
+
immediate: true
|
|
1518
|
+
});
|
|
1519
|
+
provide(selectKey, reactive({
|
|
1520
|
+
props: _props,
|
|
1521
|
+
states: API.states,
|
|
1522
|
+
selectRef: API.selectRef,
|
|
1523
|
+
optionsArray: API.optionsArray,
|
|
1524
|
+
setSelected: API.setSelected,
|
|
1525
|
+
handleOptionSelect: API.handleOptionSelect,
|
|
1526
|
+
onOptionCreate: API.onOptionCreate,
|
|
1527
|
+
onOptionDestroy: API.onOptionDestroy
|
|
1528
|
+
}));
|
|
1529
|
+
const selectedLabel = computed(() => {
|
|
1530
|
+
if (!props.multiple) {
|
|
1531
|
+
return API.states.selectedLabel;
|
|
1532
|
+
}
|
|
1533
|
+
return API.states.selected.map((i) => i.currentLabel);
|
|
1534
|
+
});
|
|
1535
|
+
onBeforeUnmount(() => {
|
|
1536
|
+
const record = warnHandlerMap.get(instance.appContext);
|
|
1537
|
+
if (!record)
|
|
1538
|
+
return;
|
|
1539
|
+
record.count -= 1;
|
|
1540
|
+
if (record.count <= 0) {
|
|
1541
|
+
instance.appContext.config.warnHandler = record.originalWarnHandler;
|
|
1542
|
+
warnHandlerMap.delete(instance.appContext);
|
|
1543
|
+
}
|
|
1544
|
+
});
|
|
1545
|
+
return {
|
|
1546
|
+
...API,
|
|
1547
|
+
modelValue,
|
|
1548
|
+
selectedLabel,
|
|
1549
|
+
calculatorRef,
|
|
1550
|
+
inputStyle,
|
|
1551
|
+
getLabel,
|
|
1552
|
+
getValue,
|
|
1553
|
+
getOptions,
|
|
1554
|
+
getDisabled,
|
|
1555
|
+
getOptionProps
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
function _sfc_render(_ctx, _cache) {
|
|
1560
|
+
const _component_el_tag = resolveComponent("el-tag");
|
|
1561
|
+
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
1562
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
1563
|
+
const _component_el_option = resolveComponent("el-option");
|
|
1564
|
+
const _component_el_option_group = resolveComponent("el-option-group");
|
|
1565
|
+
const _component_el_options = resolveComponent("el-options");
|
|
1566
|
+
const _component_el_scrollbar = resolveComponent("el-scrollbar");
|
|
1567
|
+
const _component_el_select_menu = resolveComponent("el-select-menu");
|
|
1568
|
+
const _directive_click_outside = resolveDirective("click-outside");
|
|
1569
|
+
return withDirectives((openBlock(), createElementBlock("div", {
|
|
1570
|
+
ref: "selectRef",
|
|
1571
|
+
class: normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
|
|
1572
|
+
[toHandlerKey(_ctx.mouseEnterEventName)]: ($event) => _ctx.states.inputHovering = true,
|
|
1573
|
+
onMouseleave: ($event) => _ctx.states.inputHovering = false
|
|
1574
|
+
}, [
|
|
1575
|
+
createVNode(_component_el_tooltip, {
|
|
1576
|
+
ref: "tooltipRef",
|
|
1577
|
+
visible: _ctx.dropdownMenuVisible,
|
|
1578
|
+
placement: _ctx.placement,
|
|
1579
|
+
teleported: _ctx.teleported,
|
|
1580
|
+
"popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
|
|
1581
|
+
"popper-style": _ctx.popperStyle,
|
|
1582
|
+
"popper-options": _ctx.popperOptions,
|
|
1583
|
+
"fallback-placements": _ctx.fallbackPlacements,
|
|
1584
|
+
effect: _ctx.effect,
|
|
1585
|
+
pure: "",
|
|
1586
|
+
trigger: "click",
|
|
1587
|
+
transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
|
|
1588
|
+
"stop-popper-mouse-event": false,
|
|
1589
|
+
"gpu-acceleration": false,
|
|
1590
|
+
persistent: _ctx.persistent,
|
|
1591
|
+
"append-to": _ctx.appendTo,
|
|
1592
|
+
"show-arrow": _ctx.showArrow,
|
|
1593
|
+
offset: _ctx.offset,
|
|
1594
|
+
onBeforeShow: _ctx.handleMenuEnter,
|
|
1595
|
+
onHide: ($event) => _ctx.states.isBeforeHide = false
|
|
1596
|
+
}, {
|
|
1597
|
+
default: withCtx(() => {
|
|
1598
|
+
var _a;
|
|
1599
|
+
return [
|
|
1600
|
+
createElementVNode("div", {
|
|
1601
|
+
ref: "wrapperRef",
|
|
1602
|
+
class: normalizeClass([
|
|
1603
|
+
_ctx.nsSelect.e("wrapper"),
|
|
1604
|
+
_ctx.nsSelect.is("focused", _ctx.isFocused),
|
|
1605
|
+
_ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
|
|
1606
|
+
_ctx.nsSelect.is("filterable", _ctx.filterable),
|
|
1607
|
+
_ctx.nsSelect.is("disabled", _ctx.selectDisabled)
|
|
1608
|
+
]),
|
|
1609
|
+
onClick: withModifiers(_ctx.toggleMenu, ["prevent"])
|
|
1610
|
+
}, [
|
|
1611
|
+
_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
|
|
1612
|
+
key: 0,
|
|
1613
|
+
ref: "prefixRef",
|
|
1614
|
+
class: normalizeClass(_ctx.nsSelect.e("prefix"))
|
|
1615
|
+
}, [
|
|
1616
|
+
renderSlot(_ctx.$slots, "prefix")
|
|
1617
|
+
], 2)) : createCommentVNode("v-if", true),
|
|
1618
|
+
createElementVNode("div", {
|
|
1619
|
+
ref: "selectionRef",
|
|
1620
|
+
class: normalizeClass([
|
|
1621
|
+
_ctx.nsSelect.e("selection"),
|
|
1622
|
+
_ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)
|
|
1623
|
+
])
|
|
1624
|
+
}, [
|
|
1625
|
+
_ctx.multiple ? renderSlot(_ctx.$slots, "tag", {
|
|
1626
|
+
key: 0,
|
|
1627
|
+
data: _ctx.states.selected,
|
|
1628
|
+
deleteTag: _ctx.deleteTag,
|
|
1629
|
+
selectDisabled: _ctx.selectDisabled
|
|
1630
|
+
}, () => [
|
|
1631
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
|
|
1632
|
+
return openBlock(), createElementBlock("div", {
|
|
1633
|
+
key: _ctx.getValueKey(item),
|
|
1634
|
+
class: normalizeClass(_ctx.nsSelect.e("selected-item"))
|
|
1635
|
+
}, [
|
|
1636
|
+
createVNode(_component_el_tag, {
|
|
1637
|
+
closable: !_ctx.selectDisabled && !item.isDisabled,
|
|
1638
|
+
size: _ctx.collapseTagSize,
|
|
1639
|
+
type: _ctx.tagType,
|
|
1640
|
+
effect: _ctx.tagEffect,
|
|
1641
|
+
"disable-transitions": "",
|
|
1642
|
+
style: normalizeStyle(_ctx.tagStyle),
|
|
1643
|
+
onClose: ($event) => _ctx.deleteTag($event, item)
|
|
1644
|
+
}, {
|
|
1645
|
+
default: withCtx(() => [
|
|
1646
|
+
createElementVNode("span", {
|
|
1647
|
+
class: normalizeClass(_ctx.nsSelect.e("tags-text"))
|
|
1648
|
+
}, [
|
|
1649
|
+
renderSlot(_ctx.$slots, "label", {
|
|
1650
|
+
index: item.index,
|
|
1651
|
+
label: item.currentLabel,
|
|
1652
|
+
value: item.value
|
|
1653
|
+
}, () => [
|
|
1654
|
+
createTextVNode(toDisplayString(item.currentLabel), 1)
|
|
1655
|
+
])
|
|
1656
|
+
], 2)
|
|
1657
|
+
]),
|
|
1658
|
+
_: 2
|
|
1659
|
+
}, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
|
|
1660
|
+
], 2);
|
|
1661
|
+
}), 128)),
|
|
1662
|
+
_ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
|
|
1663
|
+
key: 0,
|
|
1664
|
+
ref: "tagTooltipRef",
|
|
1665
|
+
disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
|
|
1666
|
+
"fallback-placements": ["bottom", "top", "right", "left"],
|
|
1667
|
+
effect: _ctx.effect,
|
|
1668
|
+
placement: "bottom",
|
|
1669
|
+
"popper-class": _ctx.popperClass,
|
|
1670
|
+
"popper-style": _ctx.popperStyle,
|
|
1671
|
+
teleported: _ctx.teleported
|
|
1672
|
+
}, {
|
|
1673
|
+
default: withCtx(() => [
|
|
1674
|
+
createElementVNode("div", {
|
|
1675
|
+
ref: "collapseItemRef",
|
|
1676
|
+
class: normalizeClass(_ctx.nsSelect.e("selected-item"))
|
|
1677
|
+
}, [
|
|
1678
|
+
createVNode(_component_el_tag, {
|
|
1679
|
+
closable: false,
|
|
1680
|
+
size: _ctx.collapseTagSize,
|
|
1681
|
+
type: _ctx.tagType,
|
|
1682
|
+
effect: _ctx.tagEffect,
|
|
1683
|
+
"disable-transitions": "",
|
|
1684
|
+
style: normalizeStyle(_ctx.collapseTagStyle)
|
|
1685
|
+
}, {
|
|
1686
|
+
default: withCtx(() => [
|
|
1687
|
+
createElementVNode("span", {
|
|
1688
|
+
class: normalizeClass(_ctx.nsSelect.e("tags-text"))
|
|
1689
|
+
}, " + " + toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)
|
|
1690
|
+
]),
|
|
1691
|
+
_: 1
|
|
1692
|
+
}, 8, ["size", "type", "effect", "style"])
|
|
1693
|
+
], 2)
|
|
1694
|
+
]),
|
|
1695
|
+
content: withCtx(() => [
|
|
1696
|
+
createElementVNode("div", {
|
|
1697
|
+
ref: "tagMenuRef",
|
|
1698
|
+
class: normalizeClass(_ctx.nsSelect.e("selection"))
|
|
1699
|
+
}, [
|
|
1700
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
|
|
1701
|
+
return openBlock(), createElementBlock("div", {
|
|
1702
|
+
key: _ctx.getValueKey(item),
|
|
1703
|
+
class: normalizeClass(_ctx.nsSelect.e("selected-item"))
|
|
1704
|
+
}, [
|
|
1705
|
+
createVNode(_component_el_tag, {
|
|
1706
|
+
class: "in-tooltip",
|
|
1707
|
+
closable: !_ctx.selectDisabled && !item.isDisabled,
|
|
1708
|
+
size: _ctx.collapseTagSize,
|
|
1709
|
+
type: _ctx.tagType,
|
|
1710
|
+
effect: _ctx.tagEffect,
|
|
1711
|
+
"disable-transitions": "",
|
|
1712
|
+
onClose: ($event) => _ctx.deleteTag($event, item)
|
|
1713
|
+
}, {
|
|
1714
|
+
default: withCtx(() => [
|
|
1715
|
+
createElementVNode("span", {
|
|
1716
|
+
class: normalizeClass(_ctx.nsSelect.e("tags-text"))
|
|
1717
|
+
}, [
|
|
1718
|
+
renderSlot(_ctx.$slots, "label", {
|
|
1719
|
+
index: item.index,
|
|
1720
|
+
label: item.currentLabel,
|
|
1721
|
+
value: item.value
|
|
1722
|
+
}, () => [
|
|
1723
|
+
createTextVNode(toDisplayString(item.currentLabel), 1)
|
|
1724
|
+
])
|
|
1725
|
+
], 2)
|
|
1726
|
+
]),
|
|
1727
|
+
_: 2
|
|
1728
|
+
}, 1032, ["closable", "size", "type", "effect", "onClose"])
|
|
1729
|
+
], 2);
|
|
1730
|
+
}), 128))
|
|
1731
|
+
], 2)
|
|
1732
|
+
]),
|
|
1733
|
+
_: 3
|
|
1734
|
+
}, 8, ["disabled", "effect", "popper-class", "popper-style", "teleported"])) : createCommentVNode("v-if", true)
|
|
1735
|
+
]) : createCommentVNode("v-if", true),
|
|
1736
|
+
createElementVNode("div", {
|
|
1737
|
+
class: normalizeClass([
|
|
1738
|
+
_ctx.nsSelect.e("selected-item"),
|
|
1739
|
+
_ctx.nsSelect.e("input-wrapper"),
|
|
1740
|
+
_ctx.nsSelect.is("hidden", !_ctx.filterable || _ctx.selectDisabled)
|
|
1741
|
+
])
|
|
1742
|
+
}, [
|
|
1743
|
+
withDirectives(createElementVNode("input", {
|
|
1744
|
+
id: _ctx.inputId,
|
|
1745
|
+
ref: "inputRef",
|
|
1746
|
+
"onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
|
|
1747
|
+
type: "text",
|
|
1748
|
+
name: _ctx.name,
|
|
1749
|
+
class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
|
|
1750
|
+
disabled: _ctx.selectDisabled,
|
|
1751
|
+
autocomplete: _ctx.autocomplete,
|
|
1752
|
+
style: normalizeStyle(_ctx.inputStyle),
|
|
1753
|
+
tabindex: _ctx.tabindex,
|
|
1754
|
+
role: "combobox",
|
|
1755
|
+
readonly: !_ctx.filterable,
|
|
1756
|
+
spellcheck: "false",
|
|
1757
|
+
"aria-activedescendant": ((_a = _ctx.hoverOption) == null ? void 0 : _a.id) || "",
|
|
1758
|
+
"aria-controls": _ctx.contentId,
|
|
1759
|
+
"aria-expanded": _ctx.dropdownMenuVisible,
|
|
1760
|
+
"aria-label": _ctx.ariaLabel,
|
|
1761
|
+
"aria-autocomplete": "none",
|
|
1762
|
+
"aria-haspopup": "listbox",
|
|
1763
|
+
onKeydown: _ctx.handleKeydown,
|
|
1764
|
+
onCompositionstart: _ctx.handleCompositionStart,
|
|
1765
|
+
onCompositionupdate: _ctx.handleCompositionUpdate,
|
|
1766
|
+
onCompositionend: _ctx.handleCompositionEnd,
|
|
1767
|
+
onInput: _ctx.onInput,
|
|
1768
|
+
onClick: withModifiers(_ctx.toggleMenu, ["stop"])
|
|
1769
|
+
}, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "tabindex", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
|
|
1770
|
+
[vModelText, _ctx.states.inputValue]
|
|
1771
|
+
]),
|
|
1772
|
+
_ctx.filterable ? (openBlock(), createElementBlock("span", {
|
|
1773
|
+
key: 0,
|
|
1774
|
+
ref: "calculatorRef",
|
|
1775
|
+
"aria-hidden": "true",
|
|
1776
|
+
class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
|
|
1777
|
+
textContent: toDisplayString(_ctx.states.inputValue)
|
|
1778
|
+
}, null, 10, ["textContent"])) : createCommentVNode("v-if", true)
|
|
1779
|
+
], 2),
|
|
1780
|
+
_ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
|
|
1781
|
+
key: 1,
|
|
1782
|
+
class: normalizeClass([
|
|
1783
|
+
_ctx.nsSelect.e("selected-item"),
|
|
1784
|
+
_ctx.nsSelect.e("placeholder"),
|
|
1785
|
+
_ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
|
|
1786
|
+
])
|
|
1787
|
+
}, [
|
|
1788
|
+
_ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
|
|
1789
|
+
key: 0,
|
|
1790
|
+
index: _ctx.getOption(_ctx.modelValue).index,
|
|
1791
|
+
label: _ctx.currentPlaceholder,
|
|
1792
|
+
value: _ctx.modelValue
|
|
1793
|
+
}, () => [
|
|
1794
|
+
createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)
|
|
1795
|
+
]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.currentPlaceholder), 1))
|
|
1796
|
+
], 2)) : createCommentVNode("v-if", true)
|
|
1797
|
+
], 2),
|
|
1798
|
+
createElementVNode("div", {
|
|
1799
|
+
ref: "suffixRef",
|
|
1800
|
+
class: normalizeClass(_ctx.nsSelect.e("suffix"))
|
|
1801
|
+
}, [
|
|
1802
|
+
_ctx.iconComponent && !_ctx.showClearBtn ? (openBlock(), createBlock(_component_el_icon, {
|
|
1803
|
+
key: 0,
|
|
1804
|
+
class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
|
|
1805
|
+
}, {
|
|
1806
|
+
default: withCtx(() => [
|
|
1807
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
|
|
1808
|
+
]),
|
|
1809
|
+
_: 1
|
|
1810
|
+
}, 8, ["class"])) : createCommentVNode("v-if", true),
|
|
1811
|
+
_ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
|
|
1812
|
+
key: 1,
|
|
1813
|
+
class: normalizeClass([
|
|
1814
|
+
_ctx.nsSelect.e("caret"),
|
|
1815
|
+
_ctx.nsSelect.e("icon"),
|
|
1816
|
+
_ctx.nsSelect.e("clear")
|
|
1817
|
+
]),
|
|
1818
|
+
onClick: _ctx.handleClearClick
|
|
1819
|
+
}, {
|
|
1820
|
+
default: withCtx(() => [
|
|
1821
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
|
|
1822
|
+
]),
|
|
1823
|
+
_: 1
|
|
1824
|
+
}, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
|
|
1825
|
+
_ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
|
|
1826
|
+
key: 2,
|
|
1827
|
+
class: normalizeClass([
|
|
1828
|
+
_ctx.nsInput.e("icon"),
|
|
1829
|
+
_ctx.nsInput.e("validateIcon"),
|
|
1830
|
+
_ctx.nsInput.is("loading", _ctx.validateState === "validating")
|
|
1831
|
+
])
|
|
1832
|
+
}, {
|
|
1833
|
+
default: withCtx(() => [
|
|
1834
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))
|
|
1835
|
+
]),
|
|
1836
|
+
_: 1
|
|
1837
|
+
}, 8, ["class"])) : createCommentVNode("v-if", true)
|
|
1838
|
+
], 2)
|
|
1839
|
+
], 10, ["onClick"])
|
|
1840
|
+
];
|
|
1841
|
+
}),
|
|
1842
|
+
content: withCtx(() => [
|
|
1843
|
+
createVNode(_component_el_select_menu, { ref: "menuRef" }, {
|
|
1844
|
+
default: withCtx(() => [
|
|
1845
|
+
_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
|
|
1846
|
+
key: 0,
|
|
1847
|
+
class: normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
|
|
1848
|
+
onClick: withModifiers(() => {
|
|
1849
|
+
}, ["stop"])
|
|
1850
|
+
}, [
|
|
1851
|
+
renderSlot(_ctx.$slots, "header")
|
|
1852
|
+
], 10, ["onClick"])) : createCommentVNode("v-if", true),
|
|
1853
|
+
withDirectives(createVNode(_component_el_scrollbar, {
|
|
1854
|
+
id: _ctx.contentId,
|
|
1855
|
+
ref: "scrollbarRef",
|
|
1856
|
+
tag: "ul",
|
|
1857
|
+
"wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
|
|
1858
|
+
"view-class": _ctx.nsSelect.be("dropdown", "list"),
|
|
1859
|
+
class: normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
|
|
1860
|
+
role: "listbox",
|
|
1861
|
+
"aria-label": _ctx.ariaLabel,
|
|
1862
|
+
"aria-orientation": "vertical",
|
|
1863
|
+
onScroll: _ctx.popupScroll
|
|
1864
|
+
}, {
|
|
1865
|
+
default: withCtx(() => [
|
|
1866
|
+
_ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
|
|
1867
|
+
key: 0,
|
|
1868
|
+
value: _ctx.states.inputValue,
|
|
1869
|
+
created: true
|
|
1870
|
+
}, null, 8, ["value"])) : createCommentVNode("v-if", true),
|
|
1871
|
+
createVNode(_component_el_options, null, {
|
|
1872
|
+
default: withCtx(() => [
|
|
1873
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
1874
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
|
|
1875
|
+
var _a;
|
|
1876
|
+
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
1877
|
+
((_a = _ctx.getOptions(option)) == null ? void 0 : _a.length) ? (openBlock(), createBlock(_component_el_option_group, {
|
|
1878
|
+
key: 0,
|
|
1879
|
+
label: _ctx.getLabel(option),
|
|
1880
|
+
disabled: _ctx.getDisabled(option)
|
|
1881
|
+
}, {
|
|
1882
|
+
default: withCtx(() => [
|
|
1883
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.getOptions(option), (item) => {
|
|
1884
|
+
return openBlock(), createBlock(_component_el_option, mergeProps({
|
|
1885
|
+
key: _ctx.getValue(item)
|
|
1886
|
+
}, _ctx.getOptionProps(item)), null, 16);
|
|
1887
|
+
}), 128))
|
|
1888
|
+
]),
|
|
1889
|
+
_: 2
|
|
1890
|
+
}, 1032, ["label", "disabled"])) : (openBlock(), createBlock(_component_el_option, normalizeProps(mergeProps({ key: 1 }, _ctx.getOptionProps(option))), null, 16))
|
|
1891
|
+
], 64);
|
|
1892
|
+
}), 128))
|
|
1893
|
+
])
|
|
1894
|
+
]),
|
|
1895
|
+
_: 3
|
|
1896
|
+
})
|
|
1897
|
+
]),
|
|
1898
|
+
_: 3
|
|
1899
|
+
}, 8, ["id", "wrap-class", "view-class", "class", "aria-label", "onScroll"]), [
|
|
1900
|
+
[vShow, _ctx.states.options.size > 0 && !_ctx.loading]
|
|
1901
|
+
]),
|
|
1902
|
+
_ctx.$slots.loading && _ctx.loading ? (openBlock(), createElementBlock("div", {
|
|
1903
|
+
key: 1,
|
|
1904
|
+
class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
|
|
1905
|
+
}, [
|
|
1906
|
+
renderSlot(_ctx.$slots, "loading")
|
|
1907
|
+
], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (openBlock(), createElementBlock("div", {
|
|
1908
|
+
key: 2,
|
|
1909
|
+
class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
|
|
1910
|
+
}, [
|
|
1911
|
+
renderSlot(_ctx.$slots, "empty", {}, () => [
|
|
1912
|
+
createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)
|
|
1913
|
+
])
|
|
1914
|
+
], 2)) : createCommentVNode("v-if", true),
|
|
1915
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
|
|
1916
|
+
key: 3,
|
|
1917
|
+
class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
|
|
1918
|
+
onClick: withModifiers(() => {
|
|
1919
|
+
}, ["stop"])
|
|
1920
|
+
}, [
|
|
1921
|
+
renderSlot(_ctx.$slots, "footer")
|
|
1922
|
+
], 10, ["onClick"])) : createCommentVNode("v-if", true)
|
|
1923
|
+
]),
|
|
1924
|
+
_: 3
|
|
1925
|
+
}, 512)
|
|
1926
|
+
]),
|
|
1927
|
+
_: 3
|
|
1928
|
+
}, 8, ["visible", "placement", "teleported", "popper-class", "popper-style", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
|
|
1929
|
+
], 16, ["onMouseleave"])), [
|
|
1930
|
+
[_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
|
|
1931
|
+
]);
|
|
1932
|
+
}
|
|
1933
|
+
var Select = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "select.vue"]]);
|
|
1934
|
+
|
|
1935
|
+
const ElSelect = withInstall(Select, {
|
|
1936
|
+
Option,
|
|
1937
|
+
OptionGroup
|
|
1938
|
+
});
|
|
1939
|
+
const ElOption = withNoopInstall(Option);
|
|
1940
|
+
withNoopInstall(OptionGroup);
|
|
1941
|
+
|
|
1942
|
+
export { ElSelect as E, ElOption as a };
|