vxe-pc-ui 3.0.0 → 3.0.2
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 +23 -25
- package/es/button/src/button.js +3 -0
- package/es/calendar/index.js +12 -0
- package/es/calendar/src/calendar.js +1227 -0
- package/es/calendar/style.css +247 -0
- package/es/calendar/style.min.css +1 -0
- package/es/carousel/index.js +12 -0
- package/es/carousel/src/carousel-item.js +100 -0
- package/es/carousel/src/carousel.js +418 -0
- package/es/carousel/src/util.js +17 -0
- package/es/carousel/style.css +185 -0
- package/es/carousel/style.min.css +1 -0
- package/es/carousel-item/index.js +12 -0
- package/es/carousel-item/style.css +0 -0
- package/es/carousel-item/style.min.css +0 -0
- package/es/checkbox/index.js +12 -0
- package/es/checkbox/src/checkbox.js +164 -0
- package/es/checkbox/src/group.js +159 -0
- package/es/checkbox/style.css +117 -0
- package/es/checkbox/style.min.css +1 -0
- package/es/checkbox-group/index.js +12 -0
- package/es/checkbox-group/style.css +0 -0
- package/es/checkbox-group/style.min.css +0 -0
- package/es/collapse/index.js +12 -0
- package/es/collapse/src/collapse-pane.js +39 -0
- package/es/collapse/src/collapse.js +39 -0
- package/es/collapse/style.css +0 -0
- package/es/collapse/style.min.css +0 -0
- package/es/collapse-pane/index.js +12 -0
- package/es/collapse-pane/style.css +0 -0
- package/es/collapse-pane/style.min.css +0 -0
- package/es/components.js +66 -66
- package/es/date-picker/src/date-picker.js +20 -13
- package/es/drawer/src/drawer.js +17 -12
- package/es/form/index.js +13 -0
- package/es/form/render/index.js +461 -0
- package/es/form/src/form-config-item.js +201 -0
- package/es/form/src/form-gather.js +87 -0
- package/es/form/src/form-item.js +291 -0
- package/es/form/src/form.js +762 -0
- package/es/form/src/itemInfo.js +43 -0
- package/es/form/src/render.js +78 -0
- package/es/form/src/util.js +66 -0
- package/es/form/style.css +470 -0
- package/es/form/style.min.css +1 -0
- package/es/form-gather/index.js +12 -0
- package/es/form-gather/style.css +0 -0
- package/es/form-gather/style.min.css +0 -0
- package/es/form-item/index.js +12 -0
- package/es/form-item/style.css +0 -0
- package/es/form-item/style.min.css +0 -0
- package/es/icon/style.css +1 -1
- package/es/icon-picker/index.js +12 -0
- package/es/icon-picker/src/icon-picker.js +672 -0
- package/es/icon-picker/style.css +207 -0
- package/es/icon-picker/style.min.css +1 -0
- package/es/image/src/preview.js +1 -2
- package/es/input/index.js +12 -0
- package/es/input/src/input.js +2896 -0
- package/es/input/style.css +941 -0
- package/es/input/style.min.css +1 -0
- package/es/layout-footer/src/layout-footer.js +2 -1
- package/es/layout-header/src/layout-header.js +2 -1
- package/es/list/index.js +12 -0
- package/es/list/src/list.js +373 -0
- package/es/list/style.css +28 -0
- package/es/list/style.min.css +1 -0
- package/es/loading/src/loading.js +5 -0
- package/es/menu/src/menu.js +6 -2
- package/es/modal/src/modal.js +7 -4
- package/es/number-input/src/number-input.js +11 -7
- package/es/optgroup/index.js +12 -0
- package/es/optgroup/style.css +0 -0
- package/es/optgroup/style.min.css +0 -0
- package/es/option/index.js +12 -0
- package/es/option/style.css +0 -0
- package/es/option/style.min.css +0 -0
- package/es/pager/index.js +12 -0
- package/es/pager/src/pager.js +687 -0
- package/es/pager/style.css +303 -0
- package/es/pager/style.min.css +1 -0
- package/es/password-input/index.js +12 -0
- package/es/password-input/src/password-input.js +392 -0
- package/es/password-input/style.css +604 -0
- package/es/password-input/style.min.css +1 -0
- package/es/pulldown/src/pulldown.js +11 -3
- package/es/radio/src/button.js +6 -2
- package/es/radio/src/group.js +6 -2
- package/es/radio/src/radio.js +6 -2
- package/es/select/index.js +12 -0
- package/es/select/src/optgroup.js +90 -0
- package/es/select/src/option-info.js +16 -0
- package/es/select/src/option.js +86 -0
- package/es/select/src/select.js +1284 -0
- package/es/select/src/util.js +36 -0
- package/es/select/style.css +207 -0
- package/es/select/style.min.css +1 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/switch/src/switch.js +6 -2
- package/es/tab-pane/index.js +12 -0
- package/es/tab-pane/style.css +0 -0
- package/es/tab-pane/style.min.css +0 -0
- package/es/tabs/index.js +12 -0
- package/es/tabs/src/tab-pane.js +119 -0
- package/es/tabs/src/tabs.js +598 -0
- package/es/tabs/src/util.js +17 -0
- package/es/tabs/style.css +342 -0
- package/es/tabs/style.min.css +1 -0
- package/es/textarea/src/textarea.js +9 -5
- package/es/tooltip/src/tooltip.js +6 -1
- package/es/tree/index.js +12 -0
- package/es/tree/src/tree.js +1216 -0
- package/es/tree/style.css +219 -0
- package/es/tree/style.min.css +1 -0
- package/es/tree-select/index.js +12 -0
- package/es/tree-select/src/tree-select.js +685 -0
- package/es/tree-select/style.css +129 -0
- package/es/tree-select/style.min.css +1 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/vn.js +1 -1
- package/es/upload/src/upload.js +9 -5
- package/es/vxe-calendar/index.js +3 -0
- package/es/vxe-calendar/style.css +247 -0
- package/es/vxe-calendar/style.min.css +1 -0
- package/es/vxe-carousel/index.js +3 -0
- package/es/vxe-carousel/style.css +185 -0
- package/es/vxe-carousel/style.min.css +1 -0
- package/es/vxe-carousel-item/index.js +3 -0
- package/es/vxe-carousel-item/style.css +0 -0
- package/es/vxe-carousel-item/style.min.css +0 -0
- package/es/vxe-checkbox/index.js +3 -0
- package/es/vxe-checkbox/style.css +117 -0
- package/es/vxe-checkbox/style.min.css +1 -0
- package/es/vxe-checkbox-group/index.js +3 -0
- package/es/vxe-checkbox-group/style.css +0 -0
- package/es/vxe-checkbox-group/style.min.css +0 -0
- package/es/vxe-collapse/index.js +3 -0
- package/es/vxe-collapse/style.css +0 -0
- package/es/vxe-collapse/style.min.css +0 -0
- package/es/vxe-collapse-pane/index.js +3 -0
- package/es/vxe-collapse-pane/style.css +0 -0
- package/es/vxe-collapse-pane/style.min.css +0 -0
- package/es/vxe-form/index.js +3 -0
- package/es/vxe-form/style.css +470 -0
- package/es/vxe-form/style.min.css +1 -0
- package/es/vxe-form-gather/index.js +3 -0
- package/es/vxe-form-gather/style.css +0 -0
- package/es/vxe-form-gather/style.min.css +0 -0
- package/es/vxe-form-item/index.js +3 -0
- package/es/vxe-form-item/style.css +0 -0
- package/es/vxe-form-item/style.min.css +0 -0
- package/es/vxe-icon-picker/index.js +3 -0
- package/es/vxe-icon-picker/style.css +207 -0
- package/es/vxe-icon-picker/style.min.css +1 -0
- package/es/vxe-input/index.js +3 -0
- package/es/vxe-input/style.css +941 -0
- package/es/vxe-input/style.min.css +1 -0
- package/es/vxe-list/index.js +3 -0
- package/es/vxe-list/style.css +28 -0
- package/es/vxe-list/style.min.css +1 -0
- package/es/vxe-optgroup/index.js +3 -0
- package/es/vxe-optgroup/style.css +0 -0
- package/es/vxe-optgroup/style.min.css +0 -0
- package/es/vxe-option/index.js +3 -0
- package/es/vxe-option/style.css +0 -0
- package/es/vxe-option/style.min.css +0 -0
- package/es/vxe-pager/index.js +3 -0
- package/es/vxe-pager/style.css +303 -0
- package/es/vxe-pager/style.min.css +1 -0
- package/es/vxe-password-input/index.js +3 -0
- package/es/vxe-password-input/style.css +604 -0
- package/es/vxe-password-input/style.min.css +1 -0
- package/es/vxe-select/index.js +3 -0
- package/es/vxe-select/style.css +207 -0
- package/es/vxe-select/style.min.css +1 -0
- package/es/vxe-tab-pane/index.js +3 -0
- package/es/vxe-tab-pane/style.css +0 -0
- package/es/vxe-tab-pane/style.min.css +0 -0
- package/es/vxe-tabs/index.js +3 -0
- package/es/vxe-tabs/style.css +342 -0
- package/es/vxe-tabs/style.min.css +1 -0
- package/es/vxe-tree/index.js +3 -0
- package/es/vxe-tree/style.css +219 -0
- package/es/vxe-tree/style.min.css +1 -0
- package/es/vxe-tree-select/index.js +3 -0
- package/es/vxe-tree-select/style.css +129 -0
- package/es/vxe-tree-select/style.min.css +1 -0
- package/lib/button/src/button.js +3 -0
- package/lib/button/src/button.min.js +1 -1
- package/lib/calendar/index.js +19 -0
- package/lib/calendar/index.min.js +1 -0
- package/lib/calendar/src/calendar.js +1286 -0
- package/lib/calendar/src/calendar.min.js +1 -0
- package/lib/calendar/style/index.js +1 -0
- package/lib/calendar/style/style.css +247 -0
- package/lib/calendar/style/style.min.css +1 -0
- package/lib/carousel/index.js +19 -0
- package/lib/carousel/index.min.js +1 -0
- package/lib/carousel/src/carousel-item.js +107 -0
- package/lib/carousel/src/carousel-item.min.js +1 -0
- package/lib/carousel/src/carousel.js +437 -0
- package/lib/carousel/src/carousel.min.js +1 -0
- package/lib/carousel/src/util.js +27 -0
- package/lib/carousel/src/util.min.js +1 -0
- package/lib/carousel/style/index.js +1 -0
- package/lib/carousel/style/style.css +185 -0
- package/lib/carousel/style/style.min.css +1 -0
- package/lib/carousel-item/index.js +19 -0
- package/lib/carousel-item/index.min.js +1 -0
- package/lib/carousel-item/style/index.js +1 -0
- package/lib/carousel-item/style/style.css +0 -0
- package/lib/carousel-item/style/style.min.css +0 -0
- package/lib/checkbox/index.js +19 -0
- package/lib/checkbox/index.min.js +1 -0
- package/lib/checkbox/src/checkbox.js +174 -0
- package/lib/checkbox/src/checkbox.min.js +1 -0
- package/lib/checkbox/src/group.js +169 -0
- package/lib/checkbox/src/group.min.js +1 -0
- package/lib/checkbox/style/index.js +1 -0
- package/lib/checkbox/style/style.css +117 -0
- package/lib/checkbox/style/style.min.css +1 -0
- package/lib/checkbox-group/index.js +19 -0
- package/lib/checkbox-group/index.min.js +1 -0
- package/lib/checkbox-group/style/index.js +1 -0
- package/lib/checkbox-group/style/style.css +0 -0
- package/lib/checkbox-group/style/style.min.css +0 -0
- package/lib/collapse/index.js +19 -0
- package/lib/collapse/index.min.js +1 -0
- package/lib/collapse/src/collapse-pane.js +48 -0
- package/lib/collapse/src/collapse-pane.min.js +1 -0
- package/lib/collapse/src/collapse.js +48 -0
- package/lib/collapse/src/collapse.min.js +1 -0
- package/lib/collapse/style/index.js +1 -0
- package/lib/collapse/style/style.css +0 -0
- package/lib/collapse/style/style.min.css +0 -0
- package/lib/collapse-pane/index.js +19 -0
- package/lib/collapse-pane/index.min.js +1 -0
- package/lib/collapse-pane/style/index.js +1 -0
- package/lib/collapse-pane/style/style.css +0 -0
- package/lib/collapse-pane/style/style.min.css +0 -0
- package/lib/components.js +271 -97
- package/lib/components.min.js +1 -1
- package/lib/date-picker/src/date-picker.js +20 -13
- package/lib/date-picker/src/date-picker.min.js +1 -1
- package/lib/drawer/src/drawer.js +17 -12
- package/lib/drawer/src/drawer.min.js +1 -1
- package/lib/form/index.js +20 -0
- package/lib/form/index.min.js +1 -0
- package/lib/form/render/index.js +509 -0
- package/lib/form/render/index.min.js +1 -0
- package/lib/form/src/form-config-item.js +210 -0
- package/lib/form/src/form-config-item.min.js +1 -0
- package/lib/form/src/form-gather.js +99 -0
- package/lib/form/src/form-gather.min.js +1 -0
- package/lib/form/src/form-item.js +299 -0
- package/lib/form/src/form-item.min.js +1 -0
- package/lib/form/src/form.js +856 -0
- package/lib/form/src/form.min.js +1 -0
- package/lib/form/src/itemInfo.js +60 -0
- package/lib/form/src/itemInfo.min.js +1 -0
- package/lib/form/src/render.js +94 -0
- package/lib/form/src/render.min.js +1 -0
- package/lib/form/src/util.js +93 -0
- package/lib/form/src/util.min.js +1 -0
- package/lib/form/style/index.js +1 -0
- package/lib/form/style/style.css +470 -0
- package/lib/form/style/style.min.css +1 -0
- package/lib/form-gather/index.js +19 -0
- package/lib/form-gather/index.min.js +1 -0
- package/lib/form-gather/style/index.js +1 -0
- package/lib/form-gather/style/style.css +0 -0
- package/lib/form-gather/style/style.min.css +0 -0
- package/lib/form-item/index.js +19 -0
- package/lib/form-item/index.min.js +1 -0
- package/lib/form-item/style/index.js +1 -0
- package/lib/form-item/style/style.css +0 -0
- package/lib/form-item/style/style.min.css +0 -0
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/icon-picker/index.js +19 -0
- package/lib/icon-picker/index.min.js +1 -0
- package/lib/icon-picker/src/icon-picker.js +650 -0
- package/lib/icon-picker/src/icon-picker.min.js +1 -0
- package/lib/icon-picker/style/index.js +1 -0
- package/lib/icon-picker/style/style.css +207 -0
- package/lib/icon-picker/style/style.min.css +1 -0
- package/lib/image/src/preview.js +1 -2
- package/lib/image/src/preview.min.js +1 -1
- package/lib/index.umd.js +23171 -8764
- package/lib/index.umd.min.js +1 -1
- package/lib/input/index.js +19 -0
- package/lib/input/index.min.js +1 -0
- package/lib/input/src/input.js +2901 -0
- package/lib/input/src/input.min.js +1 -0
- package/lib/input/style/index.js +1 -0
- package/lib/input/style/style.css +941 -0
- package/lib/input/style/style.min.css +1 -0
- package/lib/layout-footer/src/layout-footer.js +2 -1
- package/lib/layout-header/src/layout-header.js +2 -1
- package/lib/list/index.js +19 -0
- package/lib/list/index.min.js +1 -0
- package/lib/list/src/list.js +415 -0
- package/lib/list/src/list.min.js +1 -0
- package/lib/list/style/index.js +1 -0
- package/lib/list/style/style.css +28 -0
- package/lib/list/style/style.min.css +1 -0
- package/lib/loading/src/loading.js +5 -0
- package/lib/loading/src/loading.min.js +1 -1
- package/lib/menu/src/menu.js +6 -2
- package/lib/menu/src/menu.min.js +1 -1
- package/lib/modal/src/modal.js +7 -4
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/number-input/src/number-input.js +11 -7
- package/lib/number-input/src/number-input.min.js +1 -1
- package/lib/optgroup/index.js +19 -0
- package/lib/optgroup/index.min.js +1 -0
- package/lib/optgroup/style/index.js +1 -0
- package/lib/optgroup/style/style.css +0 -0
- package/lib/optgroup/style/style.min.css +0 -0
- package/lib/option/index.js +19 -0
- package/lib/option/index.min.js +1 -0
- package/lib/option/style/index.js +1 -0
- package/lib/option/style/style.css +0 -0
- package/lib/option/style/style.min.css +0 -0
- package/lib/pager/index.js +19 -0
- package/lib/pager/index.min.js +1 -0
- package/lib/pager/src/pager.js +714 -0
- package/lib/pager/src/pager.min.js +1 -0
- package/lib/pager/style/index.js +1 -0
- package/lib/pager/style/style.css +303 -0
- package/lib/pager/style/style.min.css +1 -0
- package/lib/password-input/index.js +19 -0
- package/lib/password-input/index.min.js +1 -0
- package/lib/password-input/src/password-input.js +402 -0
- package/lib/password-input/src/password-input.min.js +1 -0
- package/lib/password-input/style/index.js +1 -0
- package/lib/password-input/style/style.css +604 -0
- package/lib/password-input/style/style.min.css +1 -0
- package/lib/pulldown/src/pulldown.js +11 -3
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/radio/src/button.js +6 -2
- package/lib/radio/src/button.min.js +1 -1
- package/lib/radio/src/group.js +6 -2
- package/lib/radio/src/group.min.js +1 -1
- package/lib/radio/src/radio.js +6 -2
- package/lib/radio/src/radio.min.js +1 -1
- package/lib/select/index.js +19 -0
- package/lib/select/index.min.js +1 -0
- package/lib/select/src/optgroup.js +97 -0
- package/lib/select/src/optgroup.min.js +1 -0
- package/lib/select/src/option-info.js +33 -0
- package/lib/select/src/option-info.min.js +1 -0
- package/lib/select/src/option.js +93 -0
- package/lib/select/src/option.min.js +1 -0
- package/lib/select/src/select.js +1330 -0
- package/lib/select/src/select.min.js +1 -0
- package/lib/select/src/util.js +51 -0
- package/lib/select/src/util.min.js +1 -0
- package/lib/select/style/index.js +1 -0
- package/lib/select/style/style.css +207 -0
- package/lib/select/style/style.min.css +1 -0
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/switch/src/switch.js +6 -2
- package/lib/switch/src/switch.min.js +1 -1
- package/lib/tab-pane/index.js +19 -0
- package/lib/tab-pane/index.min.js +1 -0
- package/lib/tab-pane/style/index.js +1 -0
- package/lib/tab-pane/style/style.css +0 -0
- package/lib/tab-pane/style/style.min.css +0 -0
- package/lib/tabs/index.js +19 -0
- package/lib/tabs/index.min.js +1 -0
- package/lib/tabs/src/tab-pane.js +128 -0
- package/lib/tabs/src/tab-pane.min.js +1 -0
- package/lib/tabs/src/tabs.js +635 -0
- package/lib/tabs/src/tabs.min.js +1 -0
- package/lib/tabs/src/util.js +29 -0
- package/lib/tabs/src/util.min.js +1 -0
- package/lib/tabs/style/index.js +1 -0
- package/lib/tabs/style/style.css +342 -0
- package/lib/tabs/style/style.min.css +1 -0
- package/lib/textarea/src/textarea.js +9 -5
- package/lib/textarea/src/textarea.min.js +1 -1
- package/lib/tooltip/src/tooltip.js +6 -1
- package/lib/tooltip/src/tooltip.min.js +1 -1
- package/lib/tree/index.js +19 -0
- package/lib/tree/index.min.js +1 -0
- package/lib/tree/src/tree.js +1324 -0
- package/lib/tree/src/tree.min.js +1 -0
- package/lib/tree/style/index.js +1 -0
- package/lib/tree/style/style.css +219 -0
- package/lib/tree/style/style.min.css +1 -0
- package/lib/tree-select/index.js +19 -0
- package/lib/tree-select/index.min.js +1 -0
- package/lib/tree-select/src/tree-select.js +695 -0
- package/lib/tree-select/src/tree-select.min.js +1 -0
- package/lib/tree-select/style/index.js +1 -0
- package/lib/tree-select/style/style.css +129 -0
- package/lib/tree-select/style/style.min.css +1 -0
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/vn.js +1 -1
- package/lib/ui/src/vn.min.js +1 -1
- package/lib/upload/src/upload.js +9 -5
- package/lib/upload/src/upload.min.js +1 -1
- package/lib/vxe-calendar/index.js +23 -0
- package/lib/vxe-calendar/index.min.js +1 -0
- package/lib/vxe-calendar/style/index.js +1 -0
- package/lib/vxe-calendar/style/style.css +247 -0
- package/lib/vxe-calendar/style/style.min.css +1 -0
- package/lib/vxe-carousel/index.js +23 -0
- package/lib/vxe-carousel/index.min.js +1 -0
- package/lib/vxe-carousel/style/index.js +1 -0
- package/lib/vxe-carousel/style/style.css +185 -0
- package/lib/vxe-carousel/style/style.min.css +1 -0
- package/lib/vxe-carousel-item/index.js +23 -0
- package/lib/vxe-carousel-item/index.min.js +1 -0
- package/lib/vxe-carousel-item/style/index.js +1 -0
- package/lib/vxe-carousel-item/style/style.css +0 -0
- package/lib/vxe-carousel-item/style/style.min.css +0 -0
- package/lib/vxe-checkbox/index.js +23 -0
- package/lib/vxe-checkbox/index.min.js +1 -0
- package/lib/vxe-checkbox/style/index.js +1 -0
- package/lib/vxe-checkbox/style/style.css +117 -0
- package/lib/vxe-checkbox/style/style.min.css +1 -0
- package/lib/vxe-checkbox-group/index.js +23 -0
- package/lib/vxe-checkbox-group/index.min.js +1 -0
- package/lib/vxe-checkbox-group/style/index.js +1 -0
- package/lib/vxe-checkbox-group/style/style.css +0 -0
- package/lib/vxe-checkbox-group/style/style.min.css +0 -0
- package/lib/vxe-collapse/index.js +23 -0
- package/lib/vxe-collapse/index.min.js +1 -0
- package/lib/vxe-collapse/style/index.js +1 -0
- package/lib/vxe-collapse/style/style.css +0 -0
- package/lib/vxe-collapse/style/style.min.css +0 -0
- package/lib/vxe-collapse-pane/index.js +23 -0
- package/lib/vxe-collapse-pane/index.min.js +1 -0
- package/lib/vxe-collapse-pane/style/index.js +1 -0
- package/lib/vxe-collapse-pane/style/style.css +0 -0
- package/lib/vxe-collapse-pane/style/style.min.css +0 -0
- package/lib/vxe-form/index.js +23 -0
- package/lib/vxe-form/index.min.js +1 -0
- package/lib/vxe-form/style/index.js +1 -0
- package/lib/vxe-form/style/style.css +470 -0
- package/lib/vxe-form/style/style.min.css +1 -0
- package/lib/vxe-form-gather/index.js +23 -0
- package/lib/vxe-form-gather/index.min.js +1 -0
- package/lib/vxe-form-gather/style/index.js +1 -0
- package/lib/vxe-form-gather/style/style.css +0 -0
- package/lib/vxe-form-gather/style/style.min.css +0 -0
- package/lib/vxe-form-item/index.js +23 -0
- package/lib/vxe-form-item/index.min.js +1 -0
- package/lib/vxe-form-item/style/index.js +1 -0
- package/lib/vxe-form-item/style/style.css +0 -0
- package/lib/vxe-form-item/style/style.min.css +0 -0
- package/lib/vxe-icon-picker/index.js +23 -0
- package/lib/vxe-icon-picker/index.min.js +1 -0
- package/lib/vxe-icon-picker/style/index.js +1 -0
- package/lib/vxe-icon-picker/style/style.css +207 -0
- package/lib/vxe-icon-picker/style/style.min.css +1 -0
- package/lib/vxe-input/index.js +23 -0
- package/lib/vxe-input/index.min.js +1 -0
- package/lib/vxe-input/style/index.js +1 -0
- package/lib/vxe-input/style/style.css +941 -0
- package/lib/vxe-input/style/style.min.css +1 -0
- package/lib/vxe-list/index.js +23 -0
- package/lib/vxe-list/index.min.js +1 -0
- package/lib/vxe-list/style/index.js +1 -0
- package/lib/vxe-list/style/style.css +28 -0
- package/lib/vxe-list/style/style.min.css +1 -0
- package/lib/vxe-optgroup/index.js +23 -0
- package/lib/vxe-optgroup/index.min.js +1 -0
- package/lib/vxe-optgroup/style/index.js +1 -0
- package/lib/vxe-optgroup/style/style.css +0 -0
- package/lib/vxe-optgroup/style/style.min.css +0 -0
- package/lib/vxe-option/index.js +23 -0
- package/lib/vxe-option/index.min.js +1 -0
- package/lib/vxe-option/style/index.js +1 -0
- package/lib/vxe-option/style/style.css +0 -0
- package/lib/vxe-option/style/style.min.css +0 -0
- package/lib/vxe-pager/index.js +23 -0
- package/lib/vxe-pager/index.min.js +1 -0
- package/lib/vxe-pager/style/index.js +1 -0
- package/lib/vxe-pager/style/style.css +303 -0
- package/lib/vxe-pager/style/style.min.css +1 -0
- package/lib/vxe-password-input/index.js +23 -0
- package/lib/vxe-password-input/index.min.js +1 -0
- package/lib/vxe-password-input/style/index.js +1 -0
- package/lib/vxe-password-input/style/style.css +604 -0
- package/lib/vxe-password-input/style/style.min.css +1 -0
- package/lib/vxe-select/index.js +23 -0
- package/lib/vxe-select/index.min.js +1 -0
- package/lib/vxe-select/style/index.js +1 -0
- package/lib/vxe-select/style/style.css +207 -0
- package/lib/vxe-select/style/style.min.css +1 -0
- package/lib/vxe-tab-pane/index.js +23 -0
- package/lib/vxe-tab-pane/index.min.js +1 -0
- package/lib/vxe-tab-pane/style/index.js +1 -0
- package/lib/vxe-tab-pane/style/style.css +0 -0
- package/lib/vxe-tab-pane/style/style.min.css +0 -0
- package/lib/vxe-tabs/index.js +23 -0
- package/lib/vxe-tabs/index.min.js +1 -0
- package/lib/vxe-tabs/style/index.js +1 -0
- package/lib/vxe-tabs/style/style.css +342 -0
- package/lib/vxe-tabs/style/style.min.css +1 -0
- package/lib/vxe-tree/index.js +23 -0
- package/lib/vxe-tree/index.min.js +1 -0
- package/lib/vxe-tree/style/index.js +1 -0
- package/lib/vxe-tree/style/style.css +219 -0
- package/lib/vxe-tree/style/style.min.css +1 -0
- package/lib/vxe-tree-select/index.js +23 -0
- package/lib/vxe-tree-select/index.min.js +1 -0
- package/lib/vxe-tree-select/style/index.js +1 -0
- package/lib/vxe-tree-select/style/style.css +129 -0
- package/lib/vxe-tree-select/style/style.min.css +1 -0
- package/package.json +1 -1
- package/packages/button/src/button.ts +3 -0
- package/packages/calendar/index.ts +16 -0
- package/packages/calendar/src/calendar.ts +1281 -0
- package/packages/carousel/index.ts +16 -0
- package/packages/carousel/src/carousel-item.ts +114 -0
- package/packages/carousel/src/carousel.ts +449 -0
- package/packages/carousel/src/util.ts +21 -0
- package/packages/carousel-item/index.ts +16 -0
- package/packages/checkbox/index.ts +16 -0
- package/packages/checkbox/src/checkbox.ts +182 -0
- package/packages/checkbox/src/group.ts +184 -0
- package/packages/checkbox-group/index.ts +16 -0
- package/packages/collapse/index.ts +16 -0
- package/packages/collapse/src/collapse-pane.ts +47 -0
- package/packages/collapse/src/collapse.ts +47 -0
- package/packages/collapse-pane/index.ts +16 -0
- package/packages/components.ts +66 -66
- package/packages/date-picker/src/date-picker.ts +21 -13
- package/packages/drawer/src/drawer.ts +18 -12
- package/packages/form/index.ts +17 -0
- package/packages/form/render/index.ts +499 -0
- package/packages/form/src/form-config-item.ts +219 -0
- package/packages/form/src/form-gather.ts +104 -0
- package/packages/form/src/form-item.ts +322 -0
- package/packages/form/src/form.ts +809 -0
- package/packages/form/src/itemInfo.ts +47 -0
- package/packages/form/src/render.ts +98 -0
- package/packages/form/src/util.ts +80 -0
- package/packages/form-gather/index.ts +16 -0
- package/packages/form-item/index.ts +16 -0
- package/packages/icon-picker/index.ts +16 -0
- package/packages/icon-picker/src/icon-picker.ts +716 -0
- package/packages/image/src/preview.ts +1 -2
- package/packages/input/index.ts +16 -0
- package/packages/input/src/input.ts +3000 -0
- package/packages/layout-footer/src/layout-footer.ts +5 -3
- package/packages/layout-header/src/layout-header.ts +2 -1
- package/packages/list/index.ts +16 -0
- package/packages/list/src/list.ts +403 -0
- package/packages/loading/src/loading.ts +6 -0
- package/packages/menu/src/menu.ts +7 -2
- package/packages/modal/src/modal.ts +8 -4
- package/packages/number-input/src/number-input.ts +12 -7
- package/packages/optgroup/index.ts +16 -0
- package/packages/option/index.ts +16 -0
- package/packages/pager/index.ts +16 -0
- package/packages/pager/src/pager.ts +743 -0
- package/packages/password-input/index.ts +16 -0
- package/packages/password-input/src/password-input.ts +432 -0
- package/packages/pulldown/src/pulldown.ts +12 -3
- package/packages/radio/src/button.ts +7 -2
- package/packages/radio/src/group.ts +7 -2
- package/packages/radio/src/radio.ts +7 -2
- package/packages/select/index.ts +16 -0
- package/packages/select/src/optgroup.ts +107 -0
- package/packages/select/src/option-info.ts +20 -0
- package/packages/select/src/option.ts +103 -0
- package/packages/select/src/select.ts +1341 -0
- package/packages/select/src/util.ts +47 -0
- package/packages/switch/src/switch.ts +7 -2
- package/packages/tab-pane/index.ts +16 -0
- package/packages/tabs/index.ts +16 -0
- package/packages/tabs/src/tab-pane.ts +136 -0
- package/packages/tabs/src/tabs.ts +636 -0
- package/packages/tabs/src/util.ts +21 -0
- package/packages/textarea/src/textarea.ts +10 -5
- package/packages/tooltip/src/tooltip.ts +7 -1
- package/packages/tree/index.ts +16 -0
- package/packages/tree/src/tree.ts +1292 -0
- package/packages/tree-select/index.ts +16 -0
- package/packages/tree-select/src/tree-select.ts +743 -0
- package/packages/ui/src/vn.ts +1 -1
- package/packages/upload/src/upload.ts +10 -5
- package/types/components/calendar.d.ts +6 -0
- package/types/components/carousel.d.ts +5 -0
- package/types/components/colgroup.d.ts +1 -0
- package/types/components/column.d.ts +1 -0
- package/types/components/drawer.d.ts +11 -10
- package/types/components/form-item.d.ts +1 -1
- package/types/components/form.d.ts +8 -1
- package/types/components/icon-picker.d.ts +4 -0
- package/types/components/input.d.ts +9 -1
- package/types/components/list.d.ts +1 -0
- package/types/components/optgroup.d.ts +10 -4
- package/types/components/table.d.ts +43 -4
- package/types/components/tabs.d.ts +4 -0
- package/types/components/toolbar.d.ts +5 -0
- package/types/components/tree-select.d.ts +4 -0
- package/types/ui/index.d.ts +0 -5
- package/types/ui/renderer.d.ts +37 -36
- package/types/handles/form-design.d.ts +0 -4
- package/types/handles/index.d.ts +0 -3
- package/types/handles/list-design.d.ts +0 -4
- package/types/handles/table.d.ts +0 -4
- /package/es/icon/style/{iconfont.1725630285930.ttf → iconfont.1725869586078.ttf} +0 -0
- /package/es/icon/style/{iconfont.1725630285930.woff → iconfont.1725869586078.woff} +0 -0
- /package/es/icon/style/{iconfont.1725630285930.woff2 → iconfont.1725869586078.woff2} +0 -0
- /package/es/{iconfont.1725630285930.ttf → iconfont.1725869586078.ttf} +0 -0
- /package/es/{iconfont.1725630285930.woff → iconfont.1725869586078.woff} +0 -0
- /package/es/{iconfont.1725630285930.woff2 → iconfont.1725869586078.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1725630285930.ttf → iconfont.1725869586078.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1725630285930.woff → iconfont.1725869586078.woff} +0 -0
- /package/lib/icon/style/{iconfont.1725630285930.woff2 → iconfont.1725869586078.woff2} +0 -0
- /package/lib/{iconfont.1725630285930.ttf → iconfont.1725869586078.ttf} +0 -0
- /package/lib/{iconfont.1725630285930.woff → iconfont.1725869586078.woff} +0 -0
- /package/lib/{iconfont.1725630285930.woff2 → iconfont.1725869586078.woff2} +0 -0
|
@@ -0,0 +1,1341 @@
|
|
|
1
|
+
import { PropType, CreateElement, VNode } from 'vue'
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import XEUtils from 'xe-utils'
|
|
4
|
+
import { getConfig, getIcon, getI18n, globalEvents, GLOBAL_EVENT_KEYS, createEvent, globalMixins, renderEmptyElement } from '../../ui'
|
|
5
|
+
import { getEventTargetNode, getAbsolutePos } from '../../ui/src/dom'
|
|
6
|
+
import { getLastZIndex, nextZIndex, getFuncText } from '../../ui/src/utils'
|
|
7
|
+
import VxeInputComponent from '../../input/src/input'
|
|
8
|
+
import { getSlotVNs } from '../../ui/src/vn'
|
|
9
|
+
|
|
10
|
+
import type { VxeSelectPropTypes, SelectInternalData, ValueOf, VxeComponentSizeType, SelectReactData, VxeSelectEmits, VxeSelectDefines, VxeOptgroupProps, VxeOptionProps, VxeTableConstructor, VxeDrawerConstructor, VxeDrawerMethods, VxeTablePrivateMethods, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, VxeModalConstructor, VxeModalMethods, VxeInputConstructor } from '../../../types'
|
|
11
|
+
|
|
12
|
+
function isOptionVisible (option: any) {
|
|
13
|
+
return option.visible !== false
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getOptUniqueId () {
|
|
17
|
+
return XEUtils.uniqueId('opt_')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default defineVxeComponent({
|
|
21
|
+
name: 'VxeSelect',
|
|
22
|
+
mixins: [
|
|
23
|
+
globalMixins.sizeMixin
|
|
24
|
+
],
|
|
25
|
+
model: {
|
|
26
|
+
prop: 'value',
|
|
27
|
+
event: 'modelValue'
|
|
28
|
+
},
|
|
29
|
+
props: {
|
|
30
|
+
value: [String, Number, Boolean, Array] as PropType<VxeSelectPropTypes.ModelValue>,
|
|
31
|
+
clearable: Boolean as PropType<VxeSelectPropTypes.Clearable>,
|
|
32
|
+
placeholder: String as PropType<VxeSelectPropTypes.Placeholder>,
|
|
33
|
+
readonly: {
|
|
34
|
+
type: Boolean as PropType<VxeSelectPropTypes.Readonly>,
|
|
35
|
+
default: null
|
|
36
|
+
},
|
|
37
|
+
loading: Boolean as PropType<VxeSelectPropTypes.Loading>,
|
|
38
|
+
disabled: {
|
|
39
|
+
type: Boolean as PropType<VxeSelectPropTypes.Disabled>,
|
|
40
|
+
default: null
|
|
41
|
+
},
|
|
42
|
+
multiple: Boolean as PropType<VxeSelectPropTypes.Multiple>,
|
|
43
|
+
multiCharOverflow: {
|
|
44
|
+
type: [Number, String] as PropType<VxeSelectPropTypes.MultiCharOverflow>,
|
|
45
|
+
default: () => getConfig().select.multiCharOverflow
|
|
46
|
+
},
|
|
47
|
+
prefixIcon: String as PropType<VxeSelectPropTypes.PrefixIcon>,
|
|
48
|
+
placement: String as PropType<VxeSelectPropTypes.Placement>,
|
|
49
|
+
options: Array as PropType<VxeSelectPropTypes.Options>,
|
|
50
|
+
optionProps: Object as PropType<VxeSelectPropTypes.OptionProps>,
|
|
51
|
+
optionGroups: Array as PropType<VxeSelectPropTypes.OptionGroups>,
|
|
52
|
+
optionGroupProps: Object as PropType<VxeSelectPropTypes.OptionGroupProps>,
|
|
53
|
+
optionConfig: Object as PropType<VxeSelectPropTypes.OptionConfig>,
|
|
54
|
+
className: [String, Function] as PropType<VxeSelectPropTypes.ClassName>,
|
|
55
|
+
popupClassName: [String, Function] as PropType<VxeSelectPropTypes.PopupClassName>,
|
|
56
|
+
max: {
|
|
57
|
+
type: [String, Number] as PropType<VxeSelectPropTypes.Max>,
|
|
58
|
+
default: null
|
|
59
|
+
},
|
|
60
|
+
size: {
|
|
61
|
+
type: String as PropType<VxeSelectPropTypes.Size>,
|
|
62
|
+
default: () => getConfig().select.size || getConfig().size
|
|
63
|
+
},
|
|
64
|
+
filterable: Boolean as PropType<VxeSelectPropTypes.Filterable>,
|
|
65
|
+
filterMethod: Function as PropType<VxeSelectPropTypes.FilterMethod>,
|
|
66
|
+
remote: Boolean as PropType<VxeSelectPropTypes.Remote>,
|
|
67
|
+
remoteMethod: Function as PropType<VxeSelectPropTypes.RemoteMethod>,
|
|
68
|
+
emptyText: String as PropType<VxeSelectPropTypes.EmptyText>,
|
|
69
|
+
transfer: {
|
|
70
|
+
type: Boolean as PropType<VxeSelectPropTypes.Transfer>,
|
|
71
|
+
default: null
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
// 已废弃,被 option-config.keyField 替换
|
|
75
|
+
optionId: {
|
|
76
|
+
type: String as PropType<VxeSelectPropTypes.OptionId>,
|
|
77
|
+
default: () => getConfig().select.optionId
|
|
78
|
+
},
|
|
79
|
+
// 已废弃,被 option-config.useKey 替换
|
|
80
|
+
optionKey: Boolean as PropType<VxeSelectPropTypes.OptionKey>
|
|
81
|
+
},
|
|
82
|
+
inject: {
|
|
83
|
+
$xeModal: {
|
|
84
|
+
default: null
|
|
85
|
+
},
|
|
86
|
+
$xeDrawer: {
|
|
87
|
+
default: null
|
|
88
|
+
},
|
|
89
|
+
$xeTable: {
|
|
90
|
+
default: null
|
|
91
|
+
},
|
|
92
|
+
$xeForm: {
|
|
93
|
+
default: null
|
|
94
|
+
},
|
|
95
|
+
formItemInfo: {
|
|
96
|
+
from: 'xeFormItemInfo',
|
|
97
|
+
default: null
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
provide () {
|
|
101
|
+
const $xeSelect = this
|
|
102
|
+
return {
|
|
103
|
+
$xeSelect
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
data () {
|
|
107
|
+
const xID = XEUtils.uniqueId()
|
|
108
|
+
const reactData: SelectReactData = {
|
|
109
|
+
initialized: false,
|
|
110
|
+
staticOptions: [],
|
|
111
|
+
fullGroupList: [],
|
|
112
|
+
fullOptionList: [],
|
|
113
|
+
visibleGroupList: [],
|
|
114
|
+
visibleOptionList: [],
|
|
115
|
+
remoteValueList: [],
|
|
116
|
+
panelIndex: 0,
|
|
117
|
+
panelStyle: {},
|
|
118
|
+
panelPlacement: null,
|
|
119
|
+
currentOption: null,
|
|
120
|
+
currentValue: null,
|
|
121
|
+
triggerFocusPanel: false,
|
|
122
|
+
visiblePanel: false,
|
|
123
|
+
isAniVisible: false,
|
|
124
|
+
isActivated: false,
|
|
125
|
+
searchValue: '',
|
|
126
|
+
searchLoading: false
|
|
127
|
+
}
|
|
128
|
+
const internalData: SelectInternalData = {
|
|
129
|
+
hpTimeout: undefined
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
xID,
|
|
133
|
+
reactData,
|
|
134
|
+
internalData
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
computed: {
|
|
138
|
+
...({} as {
|
|
139
|
+
computeSize(): VxeComponentSizeType
|
|
140
|
+
$xeModal(): (VxeModalConstructor & VxeModalMethods) | null
|
|
141
|
+
$xeDrawer(): (VxeDrawerConstructor & VxeDrawerMethods) | null
|
|
142
|
+
$xeTable(): (VxeTableConstructor & VxeTablePrivateMethods) | null
|
|
143
|
+
$xeForm(): (VxeFormConstructor & VxeFormPrivateMethods) | null
|
|
144
|
+
formItemInfo(): VxeFormDefines.ProvideItemInfo | null
|
|
145
|
+
}),
|
|
146
|
+
computeFormReadonly () {
|
|
147
|
+
const $xeSelect = this
|
|
148
|
+
const props = $xeSelect
|
|
149
|
+
const $xeForm = $xeSelect.$xeForm
|
|
150
|
+
|
|
151
|
+
const { readonly } = props
|
|
152
|
+
if (readonly === null) {
|
|
153
|
+
if ($xeForm) {
|
|
154
|
+
return $xeForm.readonly
|
|
155
|
+
}
|
|
156
|
+
return false
|
|
157
|
+
}
|
|
158
|
+
return readonly
|
|
159
|
+
},
|
|
160
|
+
computeIsDisabled () {
|
|
161
|
+
const $xeSelect = this
|
|
162
|
+
const props = $xeSelect
|
|
163
|
+
const $xeForm = $xeSelect.$xeForm
|
|
164
|
+
|
|
165
|
+
const { disabled } = props
|
|
166
|
+
if (disabled === null) {
|
|
167
|
+
if ($xeForm) {
|
|
168
|
+
return $xeForm.disabled
|
|
169
|
+
}
|
|
170
|
+
return false
|
|
171
|
+
}
|
|
172
|
+
return disabled
|
|
173
|
+
},
|
|
174
|
+
computeBtnTransfer () {
|
|
175
|
+
const $xeSelect = this
|
|
176
|
+
const props = $xeSelect
|
|
177
|
+
const $xeTable = $xeSelect.$xeTable
|
|
178
|
+
const $xeModal = $xeSelect.$xeModal
|
|
179
|
+
const $xeDrawer = $xeSelect.$xeDrawer
|
|
180
|
+
const $xeForm = $xeSelect.$xeForm
|
|
181
|
+
|
|
182
|
+
const { transfer } = props
|
|
183
|
+
if (transfer === null) {
|
|
184
|
+
const globalTransfer = getConfig().select.transfer
|
|
185
|
+
if (XEUtils.isBoolean(globalTransfer)) {
|
|
186
|
+
return globalTransfer
|
|
187
|
+
}
|
|
188
|
+
if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
|
|
189
|
+
return true
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return transfer
|
|
193
|
+
},
|
|
194
|
+
computeInpPlaceholder () {
|
|
195
|
+
const $xeSelect = this
|
|
196
|
+
const props = $xeSelect
|
|
197
|
+
|
|
198
|
+
const { placeholder } = props
|
|
199
|
+
if (placeholder) {
|
|
200
|
+
return getFuncText(placeholder)
|
|
201
|
+
}
|
|
202
|
+
const globalPlaceholder = getConfig().select.placeholder
|
|
203
|
+
if (globalPlaceholder) {
|
|
204
|
+
return getFuncText(globalPlaceholder)
|
|
205
|
+
}
|
|
206
|
+
return getI18n('vxe.base.pleaseSelect')
|
|
207
|
+
},
|
|
208
|
+
computePropsOpts () {
|
|
209
|
+
const $xeSelect = this
|
|
210
|
+
const props = $xeSelect
|
|
211
|
+
|
|
212
|
+
return Object.assign({}, props.optionProps)
|
|
213
|
+
},
|
|
214
|
+
computeGroupPropsOpts () {
|
|
215
|
+
const $xeSelect = this
|
|
216
|
+
const props = $xeSelect
|
|
217
|
+
|
|
218
|
+
return Object.assign({}, props.optionGroupProps)
|
|
219
|
+
},
|
|
220
|
+
computeLabelField () {
|
|
221
|
+
const $xeSelect = this
|
|
222
|
+
|
|
223
|
+
const propsOpts = $xeSelect.computePropsOpts as VxeSelectPropTypes.OptionProps
|
|
224
|
+
return propsOpts.label || 'label'
|
|
225
|
+
},
|
|
226
|
+
computeValueField () {
|
|
227
|
+
const $xeSelect = this
|
|
228
|
+
|
|
229
|
+
const propsOpts = $xeSelect.computePropsOpts as VxeSelectPropTypes.OptionProps
|
|
230
|
+
return propsOpts.value || 'value'
|
|
231
|
+
},
|
|
232
|
+
computeGroupLabelField () {
|
|
233
|
+
const $xeSelect = this
|
|
234
|
+
|
|
235
|
+
const groupPropsOpts = $xeSelect.computeGroupPropsOpts as VxeSelectPropTypes.OptionGroupProps
|
|
236
|
+
return groupPropsOpts.label || 'label'
|
|
237
|
+
},
|
|
238
|
+
computeGroupOptionsField () {
|
|
239
|
+
const $xeSelect = this
|
|
240
|
+
|
|
241
|
+
const groupPropsOpts = $xeSelect.computeGroupPropsOpts as VxeSelectPropTypes.OptionGroupProps
|
|
242
|
+
return groupPropsOpts.options || 'options'
|
|
243
|
+
},
|
|
244
|
+
computeIsMaximize () {
|
|
245
|
+
const $xeSelect = this
|
|
246
|
+
const props = $xeSelect
|
|
247
|
+
|
|
248
|
+
const { value, multiple, max } = props
|
|
249
|
+
if (multiple && max) {
|
|
250
|
+
return (XEUtils.isArray(value) ? value.length : (XEUtils.eqNull(value) ? 0 : 1)) >= XEUtils.toNumber(max)
|
|
251
|
+
}
|
|
252
|
+
return false
|
|
253
|
+
},
|
|
254
|
+
computeOptionOpts () {
|
|
255
|
+
const $xeSelect = this
|
|
256
|
+
const props = $xeSelect
|
|
257
|
+
|
|
258
|
+
return Object.assign({}, getConfig().select.optionConfig, props.optionConfig)
|
|
259
|
+
},
|
|
260
|
+
computeIsGroup (this: any) {
|
|
261
|
+
const $xeSelect = this
|
|
262
|
+
const reactData = $xeSelect.reactData
|
|
263
|
+
|
|
264
|
+
return reactData.fullGroupList.some((item: any) => item.options && item.options.length)
|
|
265
|
+
},
|
|
266
|
+
computeMultiMaxCharNum () {
|
|
267
|
+
const $xeSelect = this
|
|
268
|
+
const props = $xeSelect
|
|
269
|
+
|
|
270
|
+
return XEUtils.toNumber(props.multiCharOverflow)
|
|
271
|
+
},
|
|
272
|
+
computeSelectLabel (this: any) {
|
|
273
|
+
const $xeSelect = this
|
|
274
|
+
const props = $xeSelect
|
|
275
|
+
|
|
276
|
+
const { value, multiple, remote } = props
|
|
277
|
+
const multiMaxCharNum = $xeSelect.computeMultiMaxCharNum
|
|
278
|
+
if (value && multiple) {
|
|
279
|
+
const vals = XEUtils.isArray(value) ? value : [value]
|
|
280
|
+
if (remote) {
|
|
281
|
+
return vals.map(val => $xeSelect.getRemoteSelectLabel(val)).join(', ')
|
|
282
|
+
}
|
|
283
|
+
return vals.map((val) => {
|
|
284
|
+
const label = $xeSelect.getSelectLabel(val)
|
|
285
|
+
if (multiMaxCharNum > 0 && label.length > multiMaxCharNum) {
|
|
286
|
+
return `${label.substring(0, multiMaxCharNum)}...`
|
|
287
|
+
}
|
|
288
|
+
return label
|
|
289
|
+
}).join(', ')
|
|
290
|
+
}
|
|
291
|
+
if (remote) {
|
|
292
|
+
return $xeSelect.getRemoteSelectLabel(value)
|
|
293
|
+
}
|
|
294
|
+
return $xeSelect.getSelectLabel(value)
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
methods: {
|
|
298
|
+
//
|
|
299
|
+
// Method
|
|
300
|
+
//
|
|
301
|
+
dispatchEvent (type: ValueOf<VxeSelectEmits>, params: Record<string, any>, evnt: Event | null) {
|
|
302
|
+
const $xeSelect = this
|
|
303
|
+
$xeSelect.$emit(type, createEvent(evnt, { $select: $xeSelect }, params))
|
|
304
|
+
},
|
|
305
|
+
emitModel (value: any) {
|
|
306
|
+
const $xeSelect = this
|
|
307
|
+
|
|
308
|
+
$xeSelect.$emit('modelValue', value)
|
|
309
|
+
},
|
|
310
|
+
isPanelVisible () {
|
|
311
|
+
const $xeSelect = this
|
|
312
|
+
const reactData = $xeSelect.reactData
|
|
313
|
+
|
|
314
|
+
return reactData.visiblePanel
|
|
315
|
+
},
|
|
316
|
+
togglePanel () {
|
|
317
|
+
const $xeSelect = this
|
|
318
|
+
const reactData = $xeSelect.reactData
|
|
319
|
+
|
|
320
|
+
if (reactData.visiblePanel) {
|
|
321
|
+
$xeSelect.hideOptionPanel()
|
|
322
|
+
} else {
|
|
323
|
+
$xeSelect.showOptionPanel()
|
|
324
|
+
}
|
|
325
|
+
return $xeSelect.$nextTick()
|
|
326
|
+
},
|
|
327
|
+
hidePanel () {
|
|
328
|
+
const $xeSelect = this
|
|
329
|
+
const reactData = $xeSelect.reactData
|
|
330
|
+
|
|
331
|
+
if (reactData.visiblePanel) {
|
|
332
|
+
$xeSelect.hideOptionPanel()
|
|
333
|
+
}
|
|
334
|
+
return $xeSelect.$nextTick()
|
|
335
|
+
},
|
|
336
|
+
showPanel () {
|
|
337
|
+
const $xeSelect = this
|
|
338
|
+
const reactData = $xeSelect.reactData
|
|
339
|
+
|
|
340
|
+
if (!reactData.visiblePanel) {
|
|
341
|
+
$xeSelect.showOptionPanel()
|
|
342
|
+
}
|
|
343
|
+
return $xeSelect.$nextTick()
|
|
344
|
+
},
|
|
345
|
+
focus () {
|
|
346
|
+
const $xeSelect = this
|
|
347
|
+
const reactData = $xeSelect.reactData
|
|
348
|
+
|
|
349
|
+
const $input = $xeSelect.$refs.refInput as VxeInputConstructor
|
|
350
|
+
reactData.isActivated = true
|
|
351
|
+
$input.blur()
|
|
352
|
+
return $xeSelect.$nextTick()
|
|
353
|
+
},
|
|
354
|
+
blur () {
|
|
355
|
+
const $xeSelect = this
|
|
356
|
+
const reactData = $xeSelect.reactData
|
|
357
|
+
|
|
358
|
+
const $input = $xeSelect.$refs.refInput as VxeInputConstructor
|
|
359
|
+
$input.blur()
|
|
360
|
+
reactData.isActivated = false
|
|
361
|
+
return $xeSelect.$nextTick()
|
|
362
|
+
},
|
|
363
|
+
callSlot (slotFunc: any, params: any) {
|
|
364
|
+
const $xeSelect = this
|
|
365
|
+
const slots = $xeSelect.$scopedSlots
|
|
366
|
+
|
|
367
|
+
if (slotFunc) {
|
|
368
|
+
if (XEUtils.isString(slotFunc)) {
|
|
369
|
+
slotFunc = slots[slotFunc] || null
|
|
370
|
+
}
|
|
371
|
+
if (XEUtils.isFunction(slotFunc)) {
|
|
372
|
+
return getSlotVNs(slotFunc(params))
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return []
|
|
376
|
+
},
|
|
377
|
+
findOption (optionValue: any) {
|
|
378
|
+
const $xeSelect = this
|
|
379
|
+
const reactData = $xeSelect.reactData
|
|
380
|
+
|
|
381
|
+
const { fullOptionList, fullGroupList } = reactData
|
|
382
|
+
const isGroup = $xeSelect.computeIsGroup
|
|
383
|
+
const valueField = $xeSelect.computeValueField as 'value'
|
|
384
|
+
if (isGroup) {
|
|
385
|
+
for (let gIndex = 0; gIndex < fullGroupList.length; gIndex++) {
|
|
386
|
+
const group = fullGroupList[gIndex]
|
|
387
|
+
if (group.options) {
|
|
388
|
+
for (let index = 0; index < group.options.length; index++) {
|
|
389
|
+
const option = group.options[index]
|
|
390
|
+
if (optionValue === option[valueField]) {
|
|
391
|
+
return option
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return fullOptionList.find((item) => optionValue === item[valueField])
|
|
398
|
+
},
|
|
399
|
+
findVisibleOption (optionValue: any) {
|
|
400
|
+
const $xeSelect = this
|
|
401
|
+
const reactData = $xeSelect.reactData
|
|
402
|
+
|
|
403
|
+
const { visibleOptionList, visibleGroupList } = reactData
|
|
404
|
+
const isGroup = $xeSelect.computeIsGroup
|
|
405
|
+
const valueField = $xeSelect.computeValueField as 'value'
|
|
406
|
+
if (isGroup) {
|
|
407
|
+
for (let gIndex = 0; gIndex < visibleGroupList.length; gIndex++) {
|
|
408
|
+
const group = visibleGroupList[gIndex]
|
|
409
|
+
if (group.options) {
|
|
410
|
+
for (let index = 0; index < group.options.length; index++) {
|
|
411
|
+
const option = group.options[index]
|
|
412
|
+
if (optionValue === option[valueField]) {
|
|
413
|
+
return option
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return visibleOptionList.find((item) => optionValue === item[valueField])
|
|
420
|
+
},
|
|
421
|
+
getRemoteSelectLabel (value: any) {
|
|
422
|
+
const $xeSelect = this
|
|
423
|
+
const reactData = $xeSelect.reactData
|
|
424
|
+
|
|
425
|
+
const { remoteValueList } = reactData
|
|
426
|
+
const labelField = $xeSelect.computeLabelField
|
|
427
|
+
const remoteItem = remoteValueList.find(item => value === item.key)
|
|
428
|
+
const item = remoteItem ? remoteItem.result : null
|
|
429
|
+
return XEUtils.toValueString(item ? item[labelField] : value)
|
|
430
|
+
},
|
|
431
|
+
getSelectLabel (value: any) {
|
|
432
|
+
const $xeSelect = this
|
|
433
|
+
|
|
434
|
+
const labelField = $xeSelect.computeLabelField
|
|
435
|
+
const item = $xeSelect.findOption(value)
|
|
436
|
+
return XEUtils.toValueString(item ? item[labelField as 'label'] : value)
|
|
437
|
+
},
|
|
438
|
+
getOptkey () {
|
|
439
|
+
const $xeSelect = this
|
|
440
|
+
const props = $xeSelect
|
|
441
|
+
|
|
442
|
+
const optionOpts = $xeSelect.computeOptionOpts
|
|
443
|
+
return optionOpts.keyField || props.optionId || '_X_OPTION_KEY'
|
|
444
|
+
},
|
|
445
|
+
getOptid (option: any) {
|
|
446
|
+
const $xeSelect = this
|
|
447
|
+
|
|
448
|
+
const optid = option[$xeSelect.getOptkey()]
|
|
449
|
+
return optid ? encodeURIComponent(optid) : ''
|
|
450
|
+
},
|
|
451
|
+
/**
|
|
452
|
+
* 刷新选项,当选项被动态显示/隐藏时可能会用到
|
|
453
|
+
*/
|
|
454
|
+
refreshOption () {
|
|
455
|
+
const $xeSelect = this
|
|
456
|
+
const props = $xeSelect
|
|
457
|
+
const reactData = $xeSelect.reactData
|
|
458
|
+
|
|
459
|
+
const { filterable, filterMethod } = props
|
|
460
|
+
const { fullOptionList, fullGroupList, searchValue } = reactData
|
|
461
|
+
const isGroup = $xeSelect.computeIsGroup
|
|
462
|
+
const groupLabelField = $xeSelect.computeGroupLabelField
|
|
463
|
+
const labelField = $xeSelect.computeLabelField
|
|
464
|
+
const searchStr = `${searchValue || ''}`.toLowerCase()
|
|
465
|
+
if (isGroup) {
|
|
466
|
+
if (filterable && filterMethod) {
|
|
467
|
+
reactData.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && filterMethod({ group, option: null, searchValue: searchStr }))
|
|
468
|
+
} else if (filterable) {
|
|
469
|
+
reactData.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && (!searchStr || `${group[groupLabelField]}`.toLowerCase().indexOf(searchStr) > -1))
|
|
470
|
+
} else {
|
|
471
|
+
reactData.visibleGroupList = fullGroupList.filter(isOptionVisible)
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
if (filterable && filterMethod) {
|
|
475
|
+
reactData.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && filterMethod({ group: null, option, searchValue: searchStr }))
|
|
476
|
+
} else if (filterable) {
|
|
477
|
+
reactData.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && (!searchStr || `${option[labelField]}`.toLowerCase().indexOf(searchStr) > -1))
|
|
478
|
+
} else {
|
|
479
|
+
reactData.visibleOptionList = fullOptionList.filter(isOptionVisible)
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return $xeSelect.$nextTick()
|
|
483
|
+
},
|
|
484
|
+
cacheItemMap () {
|
|
485
|
+
const $xeSelect = this
|
|
486
|
+
const reactData = $xeSelect.reactData
|
|
487
|
+
|
|
488
|
+
const { fullOptionList, fullGroupList } = reactData
|
|
489
|
+
const groupOptionsField = $xeSelect.computeGroupOptionsField
|
|
490
|
+
const key = $xeSelect.getOptkey()
|
|
491
|
+
const handleOptis = (item: any) => {
|
|
492
|
+
if (!$xeSelect.getOptid(item)) {
|
|
493
|
+
item[key] = getOptUniqueId()
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
if (fullGroupList.length) {
|
|
497
|
+
fullGroupList.forEach((group: any) => {
|
|
498
|
+
handleOptis(group)
|
|
499
|
+
if (group[groupOptionsField]) {
|
|
500
|
+
group[groupOptionsField].forEach(handleOptis)
|
|
501
|
+
}
|
|
502
|
+
})
|
|
503
|
+
} else if (fullOptionList.length) {
|
|
504
|
+
fullOptionList.forEach(handleOptis)
|
|
505
|
+
}
|
|
506
|
+
$xeSelect.refreshOption()
|
|
507
|
+
},
|
|
508
|
+
setCurrentOption (option: any) {
|
|
509
|
+
const $xeSelect = this
|
|
510
|
+
const reactData = $xeSelect.reactData
|
|
511
|
+
|
|
512
|
+
const valueField = $xeSelect.computeValueField
|
|
513
|
+
if (option) {
|
|
514
|
+
reactData.currentOption = option
|
|
515
|
+
reactData.currentValue = option[valueField]
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
scrollToOption (option: any, isAlignBottom?: boolean) {
|
|
519
|
+
const $xeSelect = this
|
|
520
|
+
|
|
521
|
+
return $xeSelect.$nextTick().then(() => {
|
|
522
|
+
if (option) {
|
|
523
|
+
const optWrapperElem = $xeSelect.$refs.refOptionWrapper as HTMLDivElement
|
|
524
|
+
const panelElem = $xeSelect.$refs.refOptionPanel as HTMLDivElement
|
|
525
|
+
const optElem = panelElem.querySelector(`[optid='${$xeSelect.getOptid(option)}']`) as HTMLElement
|
|
526
|
+
if (optWrapperElem && optElem) {
|
|
527
|
+
const wrapperHeight = optWrapperElem.offsetHeight
|
|
528
|
+
const offsetPadding = 5
|
|
529
|
+
if (isAlignBottom) {
|
|
530
|
+
if (optElem.offsetTop + optElem.offsetHeight - optWrapperElem.scrollTop > wrapperHeight) {
|
|
531
|
+
optWrapperElem.scrollTop = optElem.offsetTop + optElem.offsetHeight - wrapperHeight
|
|
532
|
+
}
|
|
533
|
+
} else {
|
|
534
|
+
if (optElem.offsetTop + offsetPadding < optWrapperElem.scrollTop || optElem.offsetTop + offsetPadding > optWrapperElem.scrollTop + optWrapperElem.clientHeight) {
|
|
535
|
+
optWrapperElem.scrollTop = optElem.offsetTop - offsetPadding
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
})
|
|
541
|
+
},
|
|
542
|
+
updateZindex () {
|
|
543
|
+
const $xeSelect = this
|
|
544
|
+
const reactData = $xeSelect.reactData
|
|
545
|
+
|
|
546
|
+
if (reactData.panelIndex < getLastZIndex()) {
|
|
547
|
+
reactData.panelIndex = nextZIndex()
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
updatePlacement () {
|
|
551
|
+
const $xeSelect = this
|
|
552
|
+
const props = $xeSelect
|
|
553
|
+
const reactData = $xeSelect.reactData
|
|
554
|
+
|
|
555
|
+
return $xeSelect.$nextTick().then(() => {
|
|
556
|
+
const { placement } = props
|
|
557
|
+
const { panelIndex } = reactData
|
|
558
|
+
const el = $xeSelect.$refs.refElem as HTMLDivElement
|
|
559
|
+
const panelElem = $xeSelect.$refs.refOptionPanel as HTMLDivElement
|
|
560
|
+
const btnTransfer = $xeSelect.computeBtnTransfer
|
|
561
|
+
if (panelElem && el) {
|
|
562
|
+
const targetHeight = el.offsetHeight
|
|
563
|
+
const targetWidth = el.offsetWidth
|
|
564
|
+
const panelHeight = panelElem.offsetHeight
|
|
565
|
+
const panelWidth = panelElem.offsetWidth
|
|
566
|
+
const marginSize = 5
|
|
567
|
+
const panelStyle: { [key: string]: any } = {
|
|
568
|
+
zIndex: panelIndex
|
|
569
|
+
}
|
|
570
|
+
const { boundingTop, boundingLeft, visibleHeight, visibleWidth } = getAbsolutePos(el)
|
|
571
|
+
let panelPlacement = 'bottom'
|
|
572
|
+
if (btnTransfer) {
|
|
573
|
+
let left = boundingLeft
|
|
574
|
+
let top = boundingTop + targetHeight
|
|
575
|
+
if (placement === 'top') {
|
|
576
|
+
panelPlacement = 'top'
|
|
577
|
+
top = boundingTop - panelHeight
|
|
578
|
+
} else if (!placement) {
|
|
579
|
+
// 如果下面不够放,则向上
|
|
580
|
+
if (top + panelHeight + marginSize > visibleHeight) {
|
|
581
|
+
panelPlacement = 'top'
|
|
582
|
+
top = boundingTop - panelHeight
|
|
583
|
+
}
|
|
584
|
+
// 如果上面不够放,则向下(优先)
|
|
585
|
+
if (top < marginSize) {
|
|
586
|
+
panelPlacement = 'bottom'
|
|
587
|
+
top = boundingTop + targetHeight
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
// 如果溢出右边
|
|
591
|
+
if (left + panelWidth + marginSize > visibleWidth) {
|
|
592
|
+
left -= left + panelWidth + marginSize - visibleWidth
|
|
593
|
+
}
|
|
594
|
+
// 如果溢出左边
|
|
595
|
+
if (left < marginSize) {
|
|
596
|
+
left = marginSize
|
|
597
|
+
}
|
|
598
|
+
Object.assign(panelStyle, {
|
|
599
|
+
left: `${left}px`,
|
|
600
|
+
top: `${top}px`,
|
|
601
|
+
minWidth: `${targetWidth}px`
|
|
602
|
+
})
|
|
603
|
+
} else {
|
|
604
|
+
if (placement === 'top') {
|
|
605
|
+
panelPlacement = 'top'
|
|
606
|
+
panelStyle.bottom = `${targetHeight}px`
|
|
607
|
+
} else if (!placement) {
|
|
608
|
+
// 如果下面不够放,则向上
|
|
609
|
+
if (boundingTop + targetHeight + panelHeight > visibleHeight) {
|
|
610
|
+
// 如果上面不够放,则向下(优先)
|
|
611
|
+
if (boundingTop - targetHeight - panelHeight > marginSize) {
|
|
612
|
+
panelPlacement = 'top'
|
|
613
|
+
panelStyle.bottom = `${targetHeight}px`
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
reactData.panelStyle = panelStyle
|
|
619
|
+
reactData.panelPlacement = panelPlacement
|
|
620
|
+
return $xeSelect.$nextTick()
|
|
621
|
+
}
|
|
622
|
+
})
|
|
623
|
+
},
|
|
624
|
+
showOptionPanel () {
|
|
625
|
+
const $xeSelect = this
|
|
626
|
+
const props = $xeSelect
|
|
627
|
+
const reactData = $xeSelect.reactData
|
|
628
|
+
const internalData = $xeSelect.internalData
|
|
629
|
+
|
|
630
|
+
const { loading, filterable } = props
|
|
631
|
+
const { hpTimeout } = internalData
|
|
632
|
+
const isDisabled = $xeSelect.computeIsDisabled
|
|
633
|
+
if (!loading && !isDisabled) {
|
|
634
|
+
if (hpTimeout) {
|
|
635
|
+
clearTimeout(hpTimeout)
|
|
636
|
+
internalData.hpTimeout = undefined
|
|
637
|
+
}
|
|
638
|
+
if (!reactData.initialized) {
|
|
639
|
+
reactData.initialized = true
|
|
640
|
+
const btnTransfer = $xeSelect.computeBtnTransfer
|
|
641
|
+
const panelElem = $xeSelect.$refs.refOptionPanel as HTMLElement
|
|
642
|
+
if (btnTransfer) {
|
|
643
|
+
if (panelElem) {
|
|
644
|
+
document.body.appendChild(panelElem)
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
reactData.isActivated = true
|
|
649
|
+
reactData.isAniVisible = true
|
|
650
|
+
if (filterable) {
|
|
651
|
+
$xeSelect.refreshOption()
|
|
652
|
+
}
|
|
653
|
+
setTimeout(() => {
|
|
654
|
+
const { value } = props
|
|
655
|
+
const currOption = $xeSelect.findOption(XEUtils.isArray(value) ? value[0] : value)
|
|
656
|
+
reactData.visiblePanel = true
|
|
657
|
+
if (currOption) {
|
|
658
|
+
$xeSelect.setCurrentOption(currOption)
|
|
659
|
+
$xeSelect.scrollToOption(currOption)
|
|
660
|
+
}
|
|
661
|
+
$xeSelect.handleFocusSearch()
|
|
662
|
+
}, 10)
|
|
663
|
+
$xeSelect.updateZindex()
|
|
664
|
+
$xeSelect.updatePlacement()
|
|
665
|
+
}
|
|
666
|
+
},
|
|
667
|
+
hideOptionPanel () {
|
|
668
|
+
const $xeSelect = this
|
|
669
|
+
const reactData = $xeSelect.reactData
|
|
670
|
+
const internalData = $xeSelect.internalData
|
|
671
|
+
|
|
672
|
+
reactData.searchValue = ''
|
|
673
|
+
reactData.searchLoading = false
|
|
674
|
+
reactData.visiblePanel = false
|
|
675
|
+
internalData.hpTimeout = window.setTimeout(() => {
|
|
676
|
+
reactData.isAniVisible = false
|
|
677
|
+
}, 350)
|
|
678
|
+
},
|
|
679
|
+
changeEvent (evnt: Event, selectValue: any) {
|
|
680
|
+
const $xeSelect = this
|
|
681
|
+
const props = $xeSelect
|
|
682
|
+
const $xeForm = $xeSelect.$xeForm
|
|
683
|
+
const formItemInfo = $xeSelect.formItemInfo
|
|
684
|
+
|
|
685
|
+
$xeSelect.emitModel(selectValue)
|
|
686
|
+
if (selectValue !== props.value) {
|
|
687
|
+
$xeSelect.dispatchEvent('change', { value: selectValue }, evnt)
|
|
688
|
+
// 自动更新校验状态
|
|
689
|
+
if ($xeForm && formItemInfo) {
|
|
690
|
+
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, selectValue)
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
clearValueEvent (evnt: Event, selectValue: any) {
|
|
695
|
+
const $xeSelect = this
|
|
696
|
+
const reactData = $xeSelect.reactData
|
|
697
|
+
|
|
698
|
+
reactData.remoteValueList = []
|
|
699
|
+
$xeSelect.changeEvent(evnt, selectValue)
|
|
700
|
+
$xeSelect.dispatchEvent('clear', { value: selectValue }, evnt)
|
|
701
|
+
},
|
|
702
|
+
clearEvent (params: any, evnt: Event) {
|
|
703
|
+
const $xeSelect = this
|
|
704
|
+
|
|
705
|
+
$xeSelect.clearValueEvent(evnt, null)
|
|
706
|
+
$xeSelect.hideOptionPanel()
|
|
707
|
+
},
|
|
708
|
+
changeOptionEvent (evnt: Event, selectValue: any, option: any) {
|
|
709
|
+
const $xeSelect = this
|
|
710
|
+
const props = $xeSelect
|
|
711
|
+
const reactData = $xeSelect.reactData
|
|
712
|
+
|
|
713
|
+
const { value, multiple } = props
|
|
714
|
+
const { remoteValueList } = reactData
|
|
715
|
+
if (multiple) {
|
|
716
|
+
let multipleValue: any[] = []
|
|
717
|
+
const selectVals = XEUtils.eqNull(value) ? [] : (XEUtils.isArray(value) ? value : [value])
|
|
718
|
+
const index = XEUtils.findIndexOf(selectVals, val => val === selectValue)
|
|
719
|
+
if (index === -1) {
|
|
720
|
+
multipleValue = selectVals.concat([selectValue])
|
|
721
|
+
} else {
|
|
722
|
+
multipleValue = selectVals.filter((val) => val !== selectValue)
|
|
723
|
+
}
|
|
724
|
+
const remoteItem = remoteValueList.find(item => item.key === selectValue)
|
|
725
|
+
if (remoteItem) {
|
|
726
|
+
remoteItem.result = option
|
|
727
|
+
} else {
|
|
728
|
+
remoteValueList.push({ key: selectValue, result: option })
|
|
729
|
+
}
|
|
730
|
+
$xeSelect.changeEvent(evnt, multipleValue)
|
|
731
|
+
} else {
|
|
732
|
+
reactData.remoteValueList = [{ key: selectValue, result: option }]
|
|
733
|
+
$xeSelect.changeEvent(evnt, selectValue)
|
|
734
|
+
$xeSelect.hideOptionPanel()
|
|
735
|
+
}
|
|
736
|
+
},
|
|
737
|
+
handleGlobalMousewheelEvent (evnt: MouseEvent) {
|
|
738
|
+
const $xeSelect = this
|
|
739
|
+
const reactData = $xeSelect.reactData
|
|
740
|
+
|
|
741
|
+
const { visiblePanel } = reactData
|
|
742
|
+
const isDisabled = $xeSelect.computeIsDisabled
|
|
743
|
+
if (!isDisabled) {
|
|
744
|
+
if (visiblePanel) {
|
|
745
|
+
const panelElem = $xeSelect.$refs.refOptionPanel as HTMLDivElement
|
|
746
|
+
if (getEventTargetNode(evnt, panelElem).flag) {
|
|
747
|
+
$xeSelect.updatePlacement()
|
|
748
|
+
} else {
|
|
749
|
+
$xeSelect.hideOptionPanel()
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
handleGlobalMousedownEvent (evnt: MouseEvent) {
|
|
755
|
+
const $xeSelect = this
|
|
756
|
+
const reactData = $xeSelect.reactData
|
|
757
|
+
|
|
758
|
+
const { visiblePanel } = reactData
|
|
759
|
+
const isDisabled = $xeSelect.computeIsDisabled
|
|
760
|
+
if (!isDisabled) {
|
|
761
|
+
const el = $xeSelect.$refs.refElem as HTMLDivElement
|
|
762
|
+
const panelElem = $xeSelect.$refs.refOptionPanel as HTMLDivElement
|
|
763
|
+
reactData.isActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelElem).flag
|
|
764
|
+
if (visiblePanel && !reactData.isActivated) {
|
|
765
|
+
$xeSelect.hideOptionPanel()
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
findOffsetOption (optionValue: any, isUpArrow: boolean) {
|
|
770
|
+
const $xeSelect = this
|
|
771
|
+
const reactData = $xeSelect.reactData
|
|
772
|
+
|
|
773
|
+
const { visibleOptionList, visibleGroupList } = reactData
|
|
774
|
+
const isGroup = $xeSelect.computeIsGroup
|
|
775
|
+
const valueField = $xeSelect.computeValueField as 'value'
|
|
776
|
+
const groupOptionsField = $xeSelect.computeGroupOptionsField as 'options'
|
|
777
|
+
let firstOption
|
|
778
|
+
let prevOption
|
|
779
|
+
let nextOption
|
|
780
|
+
let currOption
|
|
781
|
+
if (isGroup) {
|
|
782
|
+
for (let gIndex = 0; gIndex < visibleGroupList.length; gIndex++) {
|
|
783
|
+
const group = visibleGroupList[gIndex]
|
|
784
|
+
const groupOptionList = group[groupOptionsField]
|
|
785
|
+
const isGroupDisabled = group.disabled
|
|
786
|
+
if (groupOptionList) {
|
|
787
|
+
for (let index = 0; index < groupOptionList.length; index++) {
|
|
788
|
+
const option = groupOptionList[index]
|
|
789
|
+
const isVisible = isOptionVisible(option)
|
|
790
|
+
const isDisabled = isGroupDisabled || option.disabled
|
|
791
|
+
if (!firstOption && !isDisabled) {
|
|
792
|
+
firstOption = option
|
|
793
|
+
}
|
|
794
|
+
if (currOption) {
|
|
795
|
+
if (isVisible && !isDisabled) {
|
|
796
|
+
nextOption = option
|
|
797
|
+
if (!isUpArrow) {
|
|
798
|
+
return { offsetOption: nextOption }
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
if (optionValue === option[valueField]) {
|
|
803
|
+
currOption = option
|
|
804
|
+
if (isUpArrow) {
|
|
805
|
+
return { offsetOption: prevOption }
|
|
806
|
+
}
|
|
807
|
+
} else {
|
|
808
|
+
if (isVisible && !isDisabled) {
|
|
809
|
+
prevOption = option
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
} else {
|
|
816
|
+
for (let index = 0; index < visibleOptionList.length; index++) {
|
|
817
|
+
const option = visibleOptionList[index]
|
|
818
|
+
const isDisabled = option.disabled
|
|
819
|
+
if (!firstOption && !isDisabled) {
|
|
820
|
+
firstOption = option
|
|
821
|
+
}
|
|
822
|
+
if (currOption) {
|
|
823
|
+
if (!isDisabled) {
|
|
824
|
+
nextOption = option
|
|
825
|
+
if (!isUpArrow) {
|
|
826
|
+
return { offsetOption: nextOption }
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
if (optionValue === option[valueField]) {
|
|
831
|
+
currOption = option
|
|
832
|
+
if (isUpArrow) {
|
|
833
|
+
return { offsetOption: prevOption }
|
|
834
|
+
}
|
|
835
|
+
} else {
|
|
836
|
+
if (!isDisabled) {
|
|
837
|
+
prevOption = option
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return { firstOption }
|
|
843
|
+
},
|
|
844
|
+
handleGlobalKeydownEvent (evnt: KeyboardEvent) {
|
|
845
|
+
const $xeSelect = this
|
|
846
|
+
const props = $xeSelect
|
|
847
|
+
const reactData = $xeSelect.reactData
|
|
848
|
+
|
|
849
|
+
const { clearable } = props
|
|
850
|
+
const { visiblePanel, currentValue, currentOption } = reactData
|
|
851
|
+
const isDisabled = $xeSelect.computeIsDisabled
|
|
852
|
+
if (!isDisabled) {
|
|
853
|
+
const isTab = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.TAB)
|
|
854
|
+
const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER)
|
|
855
|
+
const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
|
|
856
|
+
const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)
|
|
857
|
+
const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)
|
|
858
|
+
const isDel = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.DELETE)
|
|
859
|
+
const isSpacebar = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR)
|
|
860
|
+
if (isTab) {
|
|
861
|
+
reactData.isActivated = false
|
|
862
|
+
}
|
|
863
|
+
if (visiblePanel) {
|
|
864
|
+
if (isEsc || isTab) {
|
|
865
|
+
$xeSelect.hideOptionPanel()
|
|
866
|
+
} else if (isEnter) {
|
|
867
|
+
evnt.preventDefault()
|
|
868
|
+
evnt.stopPropagation()
|
|
869
|
+
$xeSelect.changeOptionEvent(evnt, currentValue, currentOption)
|
|
870
|
+
} else if (isUpArrow || isDwArrow) {
|
|
871
|
+
evnt.preventDefault()
|
|
872
|
+
let { firstOption, offsetOption } = $xeSelect.findOffsetOption(currentValue, isUpArrow)
|
|
873
|
+
if (!offsetOption && !$xeSelect.findVisibleOption(currentValue)) {
|
|
874
|
+
offsetOption = firstOption
|
|
875
|
+
}
|
|
876
|
+
$xeSelect.setCurrentOption(offsetOption)
|
|
877
|
+
$xeSelect.scrollToOption(offsetOption, isDwArrow)
|
|
878
|
+
} else if (isSpacebar) {
|
|
879
|
+
evnt.preventDefault()
|
|
880
|
+
}
|
|
881
|
+
} else if ((isUpArrow || isDwArrow || isEnter || isSpacebar) && reactData.isActivated) {
|
|
882
|
+
evnt.preventDefault()
|
|
883
|
+
$xeSelect.showOptionPanel()
|
|
884
|
+
}
|
|
885
|
+
if (reactData.isActivated) {
|
|
886
|
+
if (isDel && clearable) {
|
|
887
|
+
$xeSelect.clearValueEvent(evnt, null)
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
},
|
|
892
|
+
handleGlobalBlurEvent () {
|
|
893
|
+
const $xeSelect = this
|
|
894
|
+
|
|
895
|
+
$xeSelect.hideOptionPanel()
|
|
896
|
+
},
|
|
897
|
+
handleFocusSearch () {
|
|
898
|
+
const $xeSelect = this
|
|
899
|
+
const props = $xeSelect
|
|
900
|
+
|
|
901
|
+
if (props.filterable) {
|
|
902
|
+
$xeSelect.$nextTick(() => {
|
|
903
|
+
const inpSearch = $xeSelect.$refs.refInpSearch as VxeInputConstructor
|
|
904
|
+
if (inpSearch) {
|
|
905
|
+
inpSearch.focus()
|
|
906
|
+
}
|
|
907
|
+
})
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
focusEvent (evnt: FocusEvent) {
|
|
911
|
+
const $xeSelect = this
|
|
912
|
+
const reactData = $xeSelect.reactData
|
|
913
|
+
|
|
914
|
+
const isDisabled = $xeSelect.computeIsDisabled
|
|
915
|
+
if (!isDisabled) {
|
|
916
|
+
if (!reactData.visiblePanel) {
|
|
917
|
+
reactData.triggerFocusPanel = true
|
|
918
|
+
$xeSelect.showOptionPanel()
|
|
919
|
+
setTimeout(() => {
|
|
920
|
+
reactData.triggerFocusPanel = false
|
|
921
|
+
}, 150)
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
$xeSelect.dispatchEvent('focus', {}, evnt)
|
|
925
|
+
},
|
|
926
|
+
clickEvent (evnt: MouseEvent) {
|
|
927
|
+
const $xeSelect = this
|
|
928
|
+
|
|
929
|
+
$xeSelect.togglePanelEvent(evnt)
|
|
930
|
+
$xeSelect.dispatchEvent('click', {}, evnt)
|
|
931
|
+
},
|
|
932
|
+
blurEvent (evnt: FocusEvent) {
|
|
933
|
+
const $xeSelect = this
|
|
934
|
+
const reactData = $xeSelect.reactData
|
|
935
|
+
|
|
936
|
+
reactData.isActivated = false
|
|
937
|
+
$xeSelect.dispatchEvent('blur', {}, evnt)
|
|
938
|
+
},
|
|
939
|
+
modelSearchEvent (value: string) {
|
|
940
|
+
const $xeSelect = this
|
|
941
|
+
const reactData = $xeSelect.reactData
|
|
942
|
+
|
|
943
|
+
reactData.searchValue = value
|
|
944
|
+
},
|
|
945
|
+
focusSearchEvent () {
|
|
946
|
+
const $xeSelect = this
|
|
947
|
+
const reactData = $xeSelect.reactData
|
|
948
|
+
|
|
949
|
+
reactData.isActivated = true
|
|
950
|
+
},
|
|
951
|
+
handleSearchEvent () {
|
|
952
|
+
const $xeSelect = this
|
|
953
|
+
const props = $xeSelect
|
|
954
|
+
const reactData = $xeSelect.reactData
|
|
955
|
+
|
|
956
|
+
const { remote, remoteMethod } = props
|
|
957
|
+
const { searchValue } = reactData
|
|
958
|
+
if (remote && remoteMethod) {
|
|
959
|
+
reactData.searchLoading = true
|
|
960
|
+
Promise.resolve(
|
|
961
|
+
remoteMethod({ searchValue })
|
|
962
|
+
).then(() => $xeSelect.$nextTick())
|
|
963
|
+
.catch(() => $xeSelect.$nextTick())
|
|
964
|
+
.finally(() => {
|
|
965
|
+
reactData.searchLoading = false
|
|
966
|
+
$xeSelect.refreshOption()
|
|
967
|
+
})
|
|
968
|
+
} else {
|
|
969
|
+
$xeSelect.refreshOption()
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
triggerSearchEvent: XEUtils.debounce(function (this: any) {
|
|
973
|
+
const $xeSelect = this
|
|
974
|
+
|
|
975
|
+
$xeSelect.handleSearchEvent()
|
|
976
|
+
}, 350, { trailing: true }),
|
|
977
|
+
togglePanelEvent (params: any) {
|
|
978
|
+
const $xeSelect = this
|
|
979
|
+
const reactData = $xeSelect.reactData
|
|
980
|
+
|
|
981
|
+
const { $event } = params
|
|
982
|
+
$event.preventDefault()
|
|
983
|
+
if (reactData.triggerFocusPanel) {
|
|
984
|
+
reactData.triggerFocusPanel = false
|
|
985
|
+
} else {
|
|
986
|
+
if (reactData.visiblePanel) {
|
|
987
|
+
$xeSelect.hideOptionPanel()
|
|
988
|
+
} else {
|
|
989
|
+
$xeSelect.showOptionPanel()
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
checkOptionDisabled (isSelected: any, option: VxeOptionProps, group?: VxeOptgroupProps) {
|
|
994
|
+
const $xeSelect = this
|
|
995
|
+
|
|
996
|
+
if (option.disabled) {
|
|
997
|
+
return true
|
|
998
|
+
}
|
|
999
|
+
if (group && group.disabled) {
|
|
1000
|
+
return true
|
|
1001
|
+
}
|
|
1002
|
+
const isMaximize = $xeSelect.computeIsMaximize
|
|
1003
|
+
if (isMaximize && !isSelected) {
|
|
1004
|
+
return true
|
|
1005
|
+
}
|
|
1006
|
+
return false
|
|
1007
|
+
},
|
|
1008
|
+
|
|
1009
|
+
//
|
|
1010
|
+
// Render
|
|
1011
|
+
//
|
|
1012
|
+
renderOption (h: CreateElement, list: VxeOptionProps[], group?: VxeOptgroupProps) {
|
|
1013
|
+
const $xeSelect = this
|
|
1014
|
+
const props = $xeSelect
|
|
1015
|
+
const slots = $xeSelect.$scopedSlots
|
|
1016
|
+
const reactData = $xeSelect.reactData
|
|
1017
|
+
|
|
1018
|
+
const { optionKey, value } = props
|
|
1019
|
+
const { currentValue } = reactData
|
|
1020
|
+
const optionOpts = $xeSelect.computeOptionOpts
|
|
1021
|
+
const labelField = $xeSelect.computeLabelField
|
|
1022
|
+
const valueField = $xeSelect.computeValueField
|
|
1023
|
+
const isGroup = $xeSelect.computeIsGroup
|
|
1024
|
+
const { useKey } = optionOpts
|
|
1025
|
+
const optionSlot = slots.option
|
|
1026
|
+
return list.map((option, cIndex) => {
|
|
1027
|
+
const { slots, className } = option
|
|
1028
|
+
const optionValue = option[valueField as 'value']
|
|
1029
|
+
const isSelected = XEUtils.isArray(value) ? value.indexOf(optionValue) > -1 : value === optionValue
|
|
1030
|
+
const isVisible = !isGroup || isOptionVisible(option)
|
|
1031
|
+
const isDisabled = $xeSelect.checkOptionDisabled(isSelected, option, group)
|
|
1032
|
+
const optid = $xeSelect.getOptid(option)
|
|
1033
|
+
const defaultSlot = slots ? slots.default : null
|
|
1034
|
+
const optParams = { option, group: null, $select: $xeSelect }
|
|
1035
|
+
return isVisible
|
|
1036
|
+
? h('div', {
|
|
1037
|
+
key: useKey || optionKey ? optid : cIndex,
|
|
1038
|
+
class: ['vxe-select-option', className ? (XEUtils.isFunction(className) ? className(optParams) : className) : '', {
|
|
1039
|
+
'is--disabled': isDisabled,
|
|
1040
|
+
'is--selected': isSelected,
|
|
1041
|
+
'is--hover': currentValue === optionValue
|
|
1042
|
+
}],
|
|
1043
|
+
attrs: {
|
|
1044
|
+
optid: optid
|
|
1045
|
+
},
|
|
1046
|
+
on: {
|
|
1047
|
+
mousedown: (evnt: MouseEvent) => {
|
|
1048
|
+
const isLeftBtn = evnt.button === 0
|
|
1049
|
+
if (isLeftBtn) {
|
|
1050
|
+
evnt.stopPropagation()
|
|
1051
|
+
}
|
|
1052
|
+
},
|
|
1053
|
+
click: (evnt: MouseEvent) => {
|
|
1054
|
+
if (!isDisabled) {
|
|
1055
|
+
$xeSelect.changeOptionEvent(evnt, optionValue, option)
|
|
1056
|
+
}
|
|
1057
|
+
},
|
|
1058
|
+
mouseenter: () => {
|
|
1059
|
+
if (!isDisabled) {
|
|
1060
|
+
$xeSelect.setCurrentOption(option)
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}, optionSlot ? $xeSelect.callSlot(optionSlot, optParams) : (defaultSlot ? $xeSelect.callSlot(defaultSlot, optParams) : getFuncText(option[labelField as 'label'])))
|
|
1065
|
+
: renderEmptyElement($xeSelect)
|
|
1066
|
+
})
|
|
1067
|
+
},
|
|
1068
|
+
renderOptgroup (h: CreateElement) {
|
|
1069
|
+
const $xeSelect = this
|
|
1070
|
+
const props = $xeSelect
|
|
1071
|
+
const slots = $xeSelect.$scopedSlots
|
|
1072
|
+
const reactData = $xeSelect.reactData
|
|
1073
|
+
|
|
1074
|
+
const { optionKey } = props
|
|
1075
|
+
const { visibleGroupList } = reactData
|
|
1076
|
+
const optionOpts = $xeSelect.computeOptionOpts
|
|
1077
|
+
const groupLabelField = $xeSelect.computeGroupLabelField
|
|
1078
|
+
const groupOptionsField = $xeSelect.computeGroupOptionsField
|
|
1079
|
+
const { useKey } = optionOpts
|
|
1080
|
+
const optionSlot = slots.option
|
|
1081
|
+
return visibleGroupList.map((group, gIndex) => {
|
|
1082
|
+
const { slots, className } = group
|
|
1083
|
+
const optid = $xeSelect.getOptid(group)
|
|
1084
|
+
const isGroupDisabled = group.disabled
|
|
1085
|
+
const defaultSlot = slots ? slots.default : null
|
|
1086
|
+
const optParams = { option: group, group, $select: $xeSelect }
|
|
1087
|
+
return h('div', {
|
|
1088
|
+
key: useKey || optionKey ? optid : gIndex,
|
|
1089
|
+
class: ['vxe-optgroup', className ? (XEUtils.isFunction(className) ? className(optParams) : className) : '', {
|
|
1090
|
+
'is--disabled': isGroupDisabled
|
|
1091
|
+
}],
|
|
1092
|
+
attrs: {
|
|
1093
|
+
optid: optid
|
|
1094
|
+
}
|
|
1095
|
+
}, [
|
|
1096
|
+
h('div', {
|
|
1097
|
+
class: 'vxe-optgroup--title'
|
|
1098
|
+
}, optionSlot ? $xeSelect.callSlot(optionSlot, optParams) : (defaultSlot ? $xeSelect.callSlot(defaultSlot, optParams) : getFuncText(group[groupLabelField as 'label']))),
|
|
1099
|
+
h('div', {
|
|
1100
|
+
class: 'vxe-optgroup--wrapper'
|
|
1101
|
+
}, $xeSelect.renderOption(h, group[groupOptionsField as 'options'] || [], group))
|
|
1102
|
+
])
|
|
1103
|
+
})
|
|
1104
|
+
},
|
|
1105
|
+
renderOpts (h: CreateElement): VNode[] {
|
|
1106
|
+
const $xeSelect = this
|
|
1107
|
+
const props = $xeSelect
|
|
1108
|
+
const reactData = $xeSelect.reactData
|
|
1109
|
+
|
|
1110
|
+
const { visibleGroupList, visibleOptionList, searchLoading } = reactData
|
|
1111
|
+
const isGroup = $xeSelect.computeIsGroup
|
|
1112
|
+
if (searchLoading) {
|
|
1113
|
+
return [
|
|
1114
|
+
h('div', {
|
|
1115
|
+
class: 'vxe-select--search-loading'
|
|
1116
|
+
}, [
|
|
1117
|
+
h('i', {
|
|
1118
|
+
class: ['vxe-select--search-icon', getIcon().SELECT_LOADED]
|
|
1119
|
+
}),
|
|
1120
|
+
h('span', {
|
|
1121
|
+
class: 'vxe-select--search-text'
|
|
1122
|
+
}, getI18n('vxe.select.loadingText'))
|
|
1123
|
+
])
|
|
1124
|
+
]
|
|
1125
|
+
}
|
|
1126
|
+
if (isGroup) {
|
|
1127
|
+
if (visibleGroupList.length) {
|
|
1128
|
+
return $xeSelect.renderOptgroup(h)
|
|
1129
|
+
}
|
|
1130
|
+
} else {
|
|
1131
|
+
if (visibleOptionList.length) {
|
|
1132
|
+
return $xeSelect.renderOption(h, visibleOptionList)
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
return [
|
|
1136
|
+
h('div', {
|
|
1137
|
+
class: 'vxe-select--empty-placeholder'
|
|
1138
|
+
}, props.emptyText || getI18n('vxe.select.emptyText'))
|
|
1139
|
+
]
|
|
1140
|
+
},
|
|
1141
|
+
renderVN (h: CreateElement): VNode {
|
|
1142
|
+
const $xeSelect = this
|
|
1143
|
+
const props = $xeSelect
|
|
1144
|
+
const slots = $xeSelect.$scopedSlots
|
|
1145
|
+
const reactData = $xeSelect.reactData
|
|
1146
|
+
|
|
1147
|
+
const { className, popupClassName, loading, filterable } = props
|
|
1148
|
+
const { initialized, isActivated, visiblePanel } = reactData
|
|
1149
|
+
const vSize = $xeSelect.computeSize
|
|
1150
|
+
const isDisabled = $xeSelect.computeIsDisabled
|
|
1151
|
+
const selectLabel = $xeSelect.computeSelectLabel
|
|
1152
|
+
const btnTransfer = $xeSelect.computeBtnTransfer
|
|
1153
|
+
const formReadonly = $xeSelect.computeFormReadonly
|
|
1154
|
+
const inpPlaceholder = $xeSelect.computeInpPlaceholder
|
|
1155
|
+
const defaultSlot = slots.default
|
|
1156
|
+
const headerSlot = slots.header
|
|
1157
|
+
const footerSlot = slots.footer
|
|
1158
|
+
const prefixSlot = slots.prefix
|
|
1159
|
+
if (formReadonly) {
|
|
1160
|
+
return h('div', {
|
|
1161
|
+
ref: 'refElem',
|
|
1162
|
+
class: ['vxe-select--readonly', className]
|
|
1163
|
+
}, [
|
|
1164
|
+
h('div', {
|
|
1165
|
+
class: 'vxe-select-slots',
|
|
1166
|
+
ref: 'hideOption'
|
|
1167
|
+
}, defaultSlot ? defaultSlot({}) : []),
|
|
1168
|
+
h('span', {
|
|
1169
|
+
class: 'vxe-select-label'
|
|
1170
|
+
}, [selectLabel])
|
|
1171
|
+
])
|
|
1172
|
+
}
|
|
1173
|
+
return h('div', {
|
|
1174
|
+
ref: 'refElem',
|
|
1175
|
+
class: ['vxe-select', className ? (XEUtils.isFunction(className) ? className({ $select: $xeSelect }) : className) : '', {
|
|
1176
|
+
[`size--${vSize}`]: vSize,
|
|
1177
|
+
'is--visible': visiblePanel,
|
|
1178
|
+
'is--disabled': isDisabled,
|
|
1179
|
+
'is--filter': filterable,
|
|
1180
|
+
'is--loading': loading,
|
|
1181
|
+
'is--active': isActivated
|
|
1182
|
+
}]
|
|
1183
|
+
}, [
|
|
1184
|
+
h('div', {
|
|
1185
|
+
class: 'vxe-select-slots',
|
|
1186
|
+
ref: 'hideOption'
|
|
1187
|
+
}, defaultSlot ? defaultSlot({}) : []),
|
|
1188
|
+
h(VxeInputComponent, {
|
|
1189
|
+
ref: 'refInput',
|
|
1190
|
+
props: {
|
|
1191
|
+
clearable: props.clearable,
|
|
1192
|
+
placeholder: inpPlaceholder,
|
|
1193
|
+
readonly: true,
|
|
1194
|
+
disabled: isDisabled,
|
|
1195
|
+
type: 'text',
|
|
1196
|
+
prefixIcon: props.prefixIcon,
|
|
1197
|
+
suffixIcon: loading ? getIcon().SELECT_LOADED : (visiblePanel ? getIcon().SELECT_OPEN : getIcon().SELECT_CLOSE),
|
|
1198
|
+
value: selectLabel
|
|
1199
|
+
},
|
|
1200
|
+
on: {
|
|
1201
|
+
clear: $xeSelect.clearEvent,
|
|
1202
|
+
click: $xeSelect.clickEvent,
|
|
1203
|
+
focus: $xeSelect.focusEvent,
|
|
1204
|
+
blur: $xeSelect.blurEvent,
|
|
1205
|
+
suffixClick: $xeSelect.togglePanelEvent
|
|
1206
|
+
},
|
|
1207
|
+
scopedSlots: prefixSlot
|
|
1208
|
+
? {
|
|
1209
|
+
prefix: () => prefixSlot({})
|
|
1210
|
+
}
|
|
1211
|
+
: {}
|
|
1212
|
+
}),
|
|
1213
|
+
h('div', {
|
|
1214
|
+
ref: 'refOptionPanel',
|
|
1215
|
+
class: ['vxe-table--ignore-clear vxe-select--panel', popupClassName ? (XEUtils.isFunction(popupClassName) ? popupClassName({ $select: $xeSelect }) : popupClassName) : '', {
|
|
1216
|
+
[`size--${vSize}`]: vSize,
|
|
1217
|
+
'is--transfer': btnTransfer,
|
|
1218
|
+
'ani--leave': !loading && reactData.isAniVisible,
|
|
1219
|
+
'ani--enter': !loading && visiblePanel
|
|
1220
|
+
}],
|
|
1221
|
+
attrs: {
|
|
1222
|
+
placement: reactData.panelPlacement
|
|
1223
|
+
},
|
|
1224
|
+
style: reactData.panelStyle
|
|
1225
|
+
}, initialized
|
|
1226
|
+
? [
|
|
1227
|
+
filterable
|
|
1228
|
+
? h('div', {
|
|
1229
|
+
class: 'vxe-select--panel-search'
|
|
1230
|
+
}, [
|
|
1231
|
+
h(VxeInputComponent, {
|
|
1232
|
+
ref: 'refInpSearch',
|
|
1233
|
+
class: 'vxe-select-search--input',
|
|
1234
|
+
props: {
|
|
1235
|
+
value: reactData.searchValue,
|
|
1236
|
+
clearable: true,
|
|
1237
|
+
placeholder: getI18n('vxe.select.search'),
|
|
1238
|
+
prefixIcon: getIcon().INPUT_SEARCH
|
|
1239
|
+
},
|
|
1240
|
+
on: {
|
|
1241
|
+
modelValue: $xeSelect.modelSearchEvent,
|
|
1242
|
+
focus: $xeSelect.focusSearchEvent,
|
|
1243
|
+
change: $xeSelect.triggerSearchEvent,
|
|
1244
|
+
search: $xeSelect.triggerSearchEvent
|
|
1245
|
+
}
|
|
1246
|
+
})
|
|
1247
|
+
])
|
|
1248
|
+
: renderEmptyElement($xeSelect),
|
|
1249
|
+
h('div', {
|
|
1250
|
+
class: 'vxe-select--panel-wrapper'
|
|
1251
|
+
}, [
|
|
1252
|
+
headerSlot
|
|
1253
|
+
? h('div', {
|
|
1254
|
+
class: 'vxe-select--panel-header'
|
|
1255
|
+
}, headerSlot({}))
|
|
1256
|
+
: renderEmptyElement($xeSelect),
|
|
1257
|
+
h('div', {
|
|
1258
|
+
class: 'vxe-select--panel-body'
|
|
1259
|
+
}, [
|
|
1260
|
+
h('div', {
|
|
1261
|
+
ref: 'refOptionWrapper',
|
|
1262
|
+
class: 'vxe-select-option--wrapper'
|
|
1263
|
+
}, $xeSelect.renderOpts(h))
|
|
1264
|
+
]),
|
|
1265
|
+
footerSlot
|
|
1266
|
+
? h('div', {
|
|
1267
|
+
class: 'vxe-select--panel-footer'
|
|
1268
|
+
}, footerSlot({}))
|
|
1269
|
+
: renderEmptyElement($xeSelect)
|
|
1270
|
+
])
|
|
1271
|
+
]
|
|
1272
|
+
: [])
|
|
1273
|
+
])
|
|
1274
|
+
}
|
|
1275
|
+
},
|
|
1276
|
+
watch: {
|
|
1277
|
+
'reactData.staticOptions' (val: VxeSelectDefines.OptionInfo[]) {
|
|
1278
|
+
const $xeSelect = this
|
|
1279
|
+
const reactData = $xeSelect.reactData
|
|
1280
|
+
|
|
1281
|
+
if (val.some((item) => item.options && item.options.length)) {
|
|
1282
|
+
reactData.fullOptionList = []
|
|
1283
|
+
reactData.fullGroupList = val
|
|
1284
|
+
} else {
|
|
1285
|
+
reactData.fullGroupList = []
|
|
1286
|
+
reactData.fullOptionList = val || []
|
|
1287
|
+
}
|
|
1288
|
+
$xeSelect.cacheItemMap()
|
|
1289
|
+
},
|
|
1290
|
+
options (val) {
|
|
1291
|
+
const $xeSelect = this
|
|
1292
|
+
const reactData = $xeSelect.reactData
|
|
1293
|
+
|
|
1294
|
+
reactData.fullGroupList = []
|
|
1295
|
+
reactData.fullOptionList = val || []
|
|
1296
|
+
$xeSelect.cacheItemMap()
|
|
1297
|
+
},
|
|
1298
|
+
optionGroups (val) {
|
|
1299
|
+
const $xeSelect = this
|
|
1300
|
+
const reactData = $xeSelect.reactData
|
|
1301
|
+
|
|
1302
|
+
reactData.fullOptionList = []
|
|
1303
|
+
reactData.fullGroupList = val || []
|
|
1304
|
+
$xeSelect.cacheItemMap()
|
|
1305
|
+
}
|
|
1306
|
+
},
|
|
1307
|
+
mounted () {
|
|
1308
|
+
const $xeSelect = this
|
|
1309
|
+
const props = $xeSelect
|
|
1310
|
+
const reactData = $xeSelect.reactData
|
|
1311
|
+
|
|
1312
|
+
$xeSelect.$nextTick(() => {
|
|
1313
|
+
const { options, optionGroups } = props
|
|
1314
|
+
if (optionGroups) {
|
|
1315
|
+
reactData.fullGroupList = optionGroups
|
|
1316
|
+
} else if (options) {
|
|
1317
|
+
reactData.fullOptionList = options
|
|
1318
|
+
}
|
|
1319
|
+
$xeSelect.cacheItemMap()
|
|
1320
|
+
})
|
|
1321
|
+
globalEvents.on($xeSelect, 'mousewheel', $xeSelect.handleGlobalMousewheelEvent)
|
|
1322
|
+
globalEvents.on($xeSelect, 'mousedown', $xeSelect.handleGlobalMousedownEvent)
|
|
1323
|
+
globalEvents.on($xeSelect, 'keydown', $xeSelect.handleGlobalKeydownEvent)
|
|
1324
|
+
globalEvents.on($xeSelect, 'blur', $xeSelect.handleGlobalBlurEvent)
|
|
1325
|
+
},
|
|
1326
|
+
beforeDestroy () {
|
|
1327
|
+
const $xeSelect = this
|
|
1328
|
+
|
|
1329
|
+
const panelElem = $xeSelect.$refs.refOptionPanel as HTMLElement | undefined
|
|
1330
|
+
if (panelElem && panelElem.parentNode) {
|
|
1331
|
+
panelElem.parentNode.removeChild(panelElem)
|
|
1332
|
+
}
|
|
1333
|
+
globalEvents.off($xeSelect, 'mousewheel')
|
|
1334
|
+
globalEvents.off($xeSelect, 'mousedown')
|
|
1335
|
+
globalEvents.off($xeSelect, 'keydown')
|
|
1336
|
+
globalEvents.off($xeSelect, 'blur')
|
|
1337
|
+
},
|
|
1338
|
+
render (this: any, h) {
|
|
1339
|
+
return this.renderVN(h)
|
|
1340
|
+
}
|
|
1341
|
+
})
|