vxe-pc-ui 0.0.2 → 0.1.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/es/anchor/src/anchor.js +1 -1
- package/es/anchor-link/index.js +1 -1
- package/es/{button-group → button}/src/button-group.js +2 -2
- package/es/button/src/button.js +3 -3
- package/es/button/style.css +17 -17
- package/es/button/style.min.css +1 -1
- package/es/button-group/index.js +1 -1
- package/es/checkbox/index.js +10 -0
- package/es/checkbox/src/checkbox.js +116 -0
- package/es/checkbox/src/group.js +108 -0
- package/es/checkbox/style.css +107 -0
- package/es/checkbox/style.min.css +1 -0
- package/es/checkbox-group/index.js +10 -0
- package/es/col/index.js +1 -1
- package/es/components.js +98 -35
- package/es/dynamics/index.js +27 -0
- package/es/form/index.js +8 -0
- package/es/form/src/form-config-item.js +178 -0
- package/es/form/src/form-gather.js +47 -0
- package/es/form/src/form-item.js +228 -0
- package/es/form/src/form.js +665 -0
- package/es/form/src/itemInfo.js +39 -0
- package/es/form/src/render.js +68 -0
- package/es/form/src/util.js +65 -0
- package/es/form/style.css +321 -0
- package/es/form/style.min.css +1 -0
- package/es/form-design/index.js +8 -0
- package/es/form-design/src/form-design.js +79 -0
- package/es/form-design/src/setting.js +12 -0
- package/es/form-design/src/util.js +8 -0
- package/es/form-design/src/view.js +113 -0
- package/es/form-design/src/widget.js +104 -0
- package/es/form-design/style.css +97 -0
- package/es/form-design/style.min.css +1 -0
- package/es/form-gather/index.js +8 -0
- package/es/form-item/index.js +8 -0
- package/es/icon/style.css +540 -1
- package/es/icon/style.min.css +1 -1
- package/es/input/index.js +10 -0
- package/es/input/src/date.js +41 -0
- package/es/input/src/input.js +2333 -0
- package/es/input/src/number.js +10 -0
- package/es/input/style.css +1000 -0
- package/es/input/style.min.css +1 -0
- package/es/layout-aside/style.css +1 -0
- package/es/layout-aside/style.min.css +1 -1
- package/es/layout-body/style.css +1 -0
- package/es/layout-body/style.min.css +1 -1
- package/es/layout-footer/style.css +1 -0
- package/es/layout-footer/style.min.css +1 -1
- package/es/layout-header/style.css +1 -0
- package/es/layout-header/style.min.css +1 -1
- package/es/list-design/index.js +8 -0
- package/es/{design/src/design.js → list-design/src/list-design.js} +7 -7
- package/es/loading/index.js +8 -0
- package/es/loading/src/loading.js +53 -0
- package/es/loading/style.css +75 -0
- package/es/loading/style.min.css +1 -0
- package/es/modal/index.js +96 -0
- package/es/modal/src/modal.js +876 -0
- package/es/modal/style.css +323 -0
- package/es/modal/style.min.css +1 -0
- package/es/optgroup/index.js +10 -0
- package/es/optgroup/style.css +0 -0
- package/es/optgroup/style.min.css +0 -0
- package/es/option/index.js +10 -0
- package/es/option/style.css +0 -0
- package/es/option/style.min.css +0 -0
- package/es/pager/index.js +10 -0
- package/es/pager/src/pager.js +539 -0
- package/es/pager/style.css +319 -0
- package/es/pager/style.min.css +1 -0
- package/es/pulldown/index.js +10 -0
- package/es/pulldown/src/pulldown.js +328 -0
- package/es/pulldown/style.css +57 -0
- package/es/pulldown/style.min.css +1 -0
- package/es/radio/index.js +10 -0
- package/es/radio/src/button.js +113 -0
- package/es/radio/src/group.js +93 -0
- package/es/radio/src/radio.js +118 -0
- package/es/radio/style.css +143 -0
- package/es/radio/style.min.css +1 -0
- package/es/radio-button/index.js +10 -0
- package/es/radio-button/style.css +0 -0
- package/es/radio-button/style.min.css +0 -0
- package/es/radio-group/index.js +10 -0
- package/es/radio-group/style.css +0 -0
- package/es/radio-group/style.min.css +0 -0
- package/es/select/index.js +10 -0
- package/es/select/src/optgroup.js +31 -0
- package/es/select/src/option.js +31 -0
- package/es/select/src/optionInfo.js +16 -0
- package/es/select/src/select.js +992 -0
- package/es/select/src/util.js +36 -0
- package/es/select/style.css +201 -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/index.js +10 -0
- package/es/switch/src/switch.js +151 -0
- package/es/switch/style.css +97 -0
- package/es/switch/style.min.css +1 -0
- package/es/textarea/index.js +10 -0
- package/es/textarea/src/textarea.js +245 -0
- package/es/textarea/style.css +102 -0
- package/es/textarea/style.min.css +1 -0
- package/es/tooltip/index.js +8 -0
- package/es/tooltip/src/tooltip.js +336 -0
- package/es/tooltip/style.css +103 -0
- package/es/tooltip/style.min.css +1 -0
- package/es/ui/src/core.js +12 -2
- package/es/ui/src/dom.js +20 -0
- package/es/ui/src/globalStore.js +119 -4
- package/es/ui/src/i18n.js +7 -0
- package/es/ui/src/log.js +2 -2
- package/es/ui/src/renderer.js +67 -0
- package/es/ui/src/store.js +41 -0
- package/es/ui/src/utils.js +10 -0
- package/es/ui/src/validators.js +5 -0
- package/es/ui/src/vn.js +10 -0
- package/es/vxe-button/style.css +17 -17
- package/es/vxe-button/style.min.css +1 -1
- package/es/vxe-checkbox/index.js +3 -0
- package/es/vxe-checkbox/style.css +107 -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-form/index.js +3 -0
- package/es/vxe-form/style.css +321 -0
- package/es/vxe-form/style.min.css +1 -0
- package/es/vxe-form-design/index.js +3 -0
- package/es/vxe-form-design/style.css +97 -0
- package/es/vxe-form-design/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/style.css +540 -1
- package/es/vxe-icon/style.min.css +1 -1
- package/es/vxe-input/index.js +3 -0
- package/es/vxe-input/style.css +1000 -0
- package/es/vxe-input/style.min.css +1 -0
- package/es/vxe-layout-aside/style.css +1 -0
- package/es/vxe-layout-aside/style.min.css +1 -1
- package/es/vxe-layout-body/style.css +1 -0
- package/es/vxe-layout-body/style.min.css +1 -1
- package/es/vxe-layout-footer/style.css +1 -0
- package/es/vxe-layout-footer/style.min.css +1 -1
- package/es/vxe-layout-header/style.css +1 -0
- package/es/vxe-layout-header/style.min.css +1 -1
- package/es/vxe-list-design/index.js +3 -0
- package/es/vxe-list-design/style.css +0 -0
- package/es/vxe-list-design/style.min.css +0 -0
- package/es/vxe-loading/index.js +3 -0
- package/es/vxe-loading/style.css +75 -0
- package/es/vxe-loading/style.min.css +1 -0
- package/es/vxe-modal/index.js +3 -0
- package/es/vxe-modal/style.css +323 -0
- package/es/vxe-modal/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 +319 -0
- package/es/vxe-pager/style.min.css +1 -0
- package/es/vxe-pulldown/index.js +3 -0
- package/es/vxe-pulldown/style.css +57 -0
- package/es/vxe-pulldown/style.min.css +1 -0
- package/es/vxe-radio/index.js +3 -0
- package/es/vxe-radio/style.css +143 -0
- package/es/vxe-radio/style.min.css +1 -0
- package/es/vxe-radio-button/index.js +3 -0
- package/es/vxe-radio-button/style.css +0 -0
- package/es/vxe-radio-button/style.min.css +0 -0
- package/es/vxe-radio-group/index.js +3 -0
- package/es/vxe-radio-group/style.css +0 -0
- package/es/vxe-radio-group/style.min.css +0 -0
- package/es/vxe-select/index.js +3 -0
- package/es/vxe-select/style.css +201 -0
- package/es/vxe-select/style.min.css +1 -0
- package/es/vxe-switch/index.js +3 -0
- package/es/vxe-switch/style.css +97 -0
- package/es/vxe-switch/style.min.css +1 -0
- package/es/vxe-textarea/index.js +3 -0
- package/es/vxe-textarea/style.css +102 -0
- package/es/vxe-textarea/style.min.css +1 -0
- package/es/vxe-tooltip/index.js +3 -0
- package/es/vxe-tooltip/style.css +103 -0
- package/es/vxe-tooltip/style.min.css +1 -0
- package/lib/anchor/src/anchor.js +1 -1
- package/lib/anchor/src/anchor.min.js +1 -1
- package/lib/anchor-link/index.js +1 -1
- package/lib/anchor-link/index.min.js +1 -1
- package/lib/{button-group → button}/src/button-group.js +2 -2
- package/lib/button/src/button-group.min.js +1 -0
- package/lib/button/src/button.js +3 -3
- package/lib/button/src/button.min.js +1 -1
- package/lib/button/style/style.css +17 -17
- package/lib/button/style/style.min.css +1 -1
- package/lib/button-group/index.js +1 -1
- package/lib/button-group/index.min.js +1 -1
- package/lib/checkbox/index.js +17 -0
- package/lib/checkbox/index.min.js +1 -0
- package/lib/checkbox/src/checkbox.js +144 -0
- package/lib/checkbox/src/checkbox.min.js +1 -0
- package/lib/checkbox/src/group.js +129 -0
- package/lib/checkbox/src/group.min.js +1 -0
- package/lib/checkbox/style/style.css +107 -0
- package/lib/checkbox/style/style.min.css +1 -0
- package/lib/checkbox-group/index.js +17 -0
- package/lib/checkbox-group/index.min.js +1 -0
- package/lib/checkbox-group/style/style.css +0 -0
- package/lib/checkbox-group/style/style.min.css +0 -0
- package/lib/col/index.js +1 -1
- package/lib/col/index.min.js +1 -1
- package/lib/components.js +290 -63
- package/lib/components.min.js +1 -1
- package/lib/dynamics/index.js +36 -0
- package/lib/dynamics/index.min.js +1 -0
- package/lib/form/index.js +15 -0
- package/lib/form/index.min.js +1 -0
- package/lib/form/src/form-config-item.js +192 -0
- package/lib/form/src/form-config-item.min.js +1 -0
- package/lib/form/src/form-gather.js +57 -0
- package/lib/form/src/form-gather.min.js +1 -0
- package/lib/form/src/form-item.js +247 -0
- package/lib/form/src/form-item.min.js +1 -0
- package/lib/form/src/form.js +768 -0
- package/lib/form/src/form.min.js +1 -0
- package/lib/form/src/itemInfo.js +47 -0
- package/lib/form/src/itemInfo.min.js +1 -0
- package/lib/form/src/render.js +84 -0
- package/lib/form/src/render.min.js +1 -0
- package/lib/form/src/util.js +108 -0
- package/lib/form/src/util.min.js +1 -0
- package/lib/form/style/index.js +1 -0
- package/lib/form/style/style.css +321 -0
- package/lib/form/style/style.min.css +1 -0
- package/lib/form-design/index.js +15 -0
- package/lib/form-design/index.min.js +1 -0
- package/lib/form-design/src/form-design.js +87 -0
- package/lib/form-design/src/form-design.min.js +1 -0
- package/lib/form-design/src/setting.js +18 -0
- package/lib/form-design/src/setting.min.js +1 -0
- package/lib/form-design/src/util.js +17 -0
- package/lib/form-design/src/util.min.js +1 -0
- package/lib/form-design/src/view.js +147 -0
- package/lib/form-design/src/view.min.js +1 -0
- package/lib/form-design/src/widget.js +114 -0
- package/lib/form-design/src/widget.min.js +1 -0
- package/lib/form-design/style/index.js +1 -0
- package/lib/form-design/style/style.css +97 -0
- package/lib/form-design/style/style.min.css +1 -0
- package/lib/form-gather/index.js +15 -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 +15 -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 +540 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +10741 -782
- package/lib/index.umd.min.js +1 -1
- package/lib/input/index.js +17 -0
- package/lib/input/index.min.js +1 -0
- package/lib/input/src/date.js +46 -0
- package/lib/input/src/date.min.js +1 -0
- package/lib/input/src/input.js +2546 -0
- package/lib/input/src/input.min.js +1 -0
- package/lib/input/src/number.js +18 -0
- package/lib/input/src/number.min.js +1 -0
- package/lib/input/style/index.js +1 -0
- package/lib/input/style/style.css +1000 -0
- package/lib/input/style/style.min.css +1 -0
- package/lib/layout-aside/style/style.css +1 -0
- package/lib/layout-aside/style/style.min.css +1 -1
- package/lib/layout-body/style/style.css +1 -0
- package/lib/layout-body/style/style.min.css +1 -1
- package/lib/layout-footer/style/style.css +1 -0
- package/lib/layout-footer/style/style.min.css +1 -1
- package/lib/layout-header/style/style.css +1 -0
- package/lib/layout-header/style/style.min.css +1 -1
- package/lib/list-design/index.js +15 -0
- package/lib/list-design/index.min.js +1 -0
- package/lib/{design/src/design.js → list-design/src/list-design.js} +7 -7
- package/lib/list-design/src/list-design.min.js +1 -0
- package/lib/list-design/style/index.js +1 -0
- package/lib/list-design/style/style.css +0 -0
- package/lib/list-design/style/style.min.css +0 -0
- package/lib/loading/index.js +15 -0
- package/lib/loading/index.min.js +1 -0
- package/lib/loading/src/loading.js +49 -0
- package/lib/loading/src/loading.min.js +1 -0
- package/lib/loading/style/index.js +1 -0
- package/lib/loading/style/style.css +75 -0
- package/lib/loading/style/style.min.css +1 -0
- package/lib/modal/index.js +110 -0
- package/lib/modal/index.min.js +1 -0
- package/lib/modal/src/modal.js +1064 -0
- package/lib/modal/src/modal.min.js +1 -0
- package/lib/modal/style/index.js +1 -0
- package/lib/modal/style/style.css +323 -0
- package/lib/modal/style/style.min.css +1 -0
- package/lib/optgroup/index.js +17 -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 +17 -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 +17 -0
- package/lib/pager/index.min.js +1 -0
- package/lib/pager/src/pager.js +593 -0
- package/lib/pager/src/pager.min.js +1 -0
- package/lib/pager/style/index.js +1 -0
- package/lib/pager/style/style.css +319 -0
- package/lib/pager/style/style.min.css +1 -0
- package/lib/pulldown/index.js +17 -0
- package/lib/pulldown/index.min.js +1 -0
- package/lib/pulldown/src/pulldown.js +359 -0
- package/lib/pulldown/src/pulldown.min.js +1 -0
- package/lib/pulldown/style/index.js +1 -0
- package/lib/pulldown/style/style.css +57 -0
- package/lib/pulldown/style/style.min.css +1 -0
- package/lib/radio/index.js +17 -0
- package/lib/radio/index.min.js +1 -0
- package/lib/radio/src/button.js +135 -0
- package/lib/radio/src/button.min.js +1 -0
- package/lib/radio/src/group.js +108 -0
- package/lib/radio/src/group.min.js +1 -0
- package/lib/radio/src/radio.js +139 -0
- package/lib/radio/src/radio.min.js +1 -0
- package/lib/radio/style/index.js +1 -0
- package/lib/radio/style/style.css +143 -0
- package/lib/radio/style/style.min.css +1 -0
- package/lib/radio-button/index.js +17 -0
- package/lib/radio-button/index.min.js +1 -0
- package/lib/radio-button/style/index.js +1 -0
- package/lib/radio-button/style/style.css +0 -0
- package/lib/radio-button/style/style.min.css +0 -0
- package/lib/radio-group/index.js +17 -0
- package/lib/radio-group/index.min.js +1 -0
- package/lib/radio-group/style/index.js +1 -0
- package/lib/radio-group/style/style.css +0 -0
- package/lib/radio-group/style/style.min.css +0 -0
- package/lib/select/index.js +17 -0
- package/lib/select/index.min.js +1 -0
- package/lib/select/src/optgroup.js +47 -0
- package/lib/select/src/optgroup.min.js +1 -0
- package/lib/select/src/option.js +45 -0
- package/lib/select/src/option.min.js +1 -0
- package/lib/select/src/optionInfo.js +24 -0
- package/lib/select/src/optionInfo.min.js +1 -0
- package/lib/select/src/select.js +1104 -0
- package/lib/select/src/select.min.js +1 -0
- package/lib/select/src/util.js +57 -0
- package/lib/select/src/util.min.js +1 -0
- package/lib/select/style/index.js +1 -0
- package/lib/select/style/style.css +201 -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/index.js +17 -0
- package/lib/switch/index.min.js +1 -0
- package/lib/switch/src/switch.js +161 -0
- package/lib/switch/src/switch.min.js +1 -0
- package/lib/switch/style/index.js +1 -0
- package/lib/switch/style/style.css +97 -0
- package/lib/switch/style/style.min.css +1 -0
- package/lib/textarea/index.js +17 -0
- package/lib/textarea/index.min.js +1 -0
- package/lib/textarea/src/textarea.js +298 -0
- package/lib/textarea/src/textarea.min.js +1 -0
- package/lib/textarea/style/index.js +1 -0
- package/lib/textarea/style/style.css +102 -0
- package/lib/textarea/style/style.min.css +1 -0
- package/lib/tooltip/index.js +15 -0
- package/lib/tooltip/index.min.js +1 -0
- package/lib/tooltip/src/tooltip.js +418 -0
- package/lib/tooltip/src/tooltip.min.js +1 -0
- package/lib/tooltip/style/index.js +1 -0
- package/lib/tooltip/style/style.css +103 -0
- package/lib/tooltip/style/style.min.css +1 -0
- package/lib/ui/src/core.js +49 -2
- package/lib/ui/src/core.min.js +1 -1
- package/lib/ui/src/dom.js +22 -0
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/globalStore.js +119 -4
- package/lib/ui/src/globalStore.min.js +1 -1
- package/lib/ui/src/i18n.js +14 -0
- package/lib/ui/src/i18n.min.js +1 -0
- package/lib/ui/src/log.js +2 -3
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/renderer.js +77 -0
- package/lib/ui/src/renderer.min.js +1 -0
- package/lib/ui/src/store.js +49 -0
- package/lib/ui/src/store.min.js +1 -0
- package/lib/ui/src/utils.js +12 -0
- package/lib/ui/src/utils.min.js +1 -1
- package/lib/ui/src/validators.js +14 -0
- package/lib/ui/src/validators.min.js +1 -0
- package/lib/ui/src/vn.js +18 -0
- package/lib/ui/src/vn.min.js +1 -0
- package/lib/vxe-button/style/style.css +17 -17
- package/lib/vxe-button/style/style.min.css +1 -1
- package/lib/vxe-checkbox/index.js +22 -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 +107 -0
- package/lib/vxe-checkbox/style/style.min.css +1 -0
- package/lib/vxe-checkbox-group/index.js +22 -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-design → vxe-form}/index.js +5 -5
- 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 +321 -0
- package/lib/vxe-form/style/style.min.css +1 -0
- package/lib/vxe-form-design/index.js +22 -0
- package/lib/vxe-form-design/index.min.js +1 -0
- package/lib/vxe-form-design/style/index.js +1 -0
- package/lib/vxe-form-design/style/style.css +97 -0
- package/lib/vxe-form-design/style/style.min.css +1 -0
- package/lib/vxe-form-gather/index.js +22 -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 +22 -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/style/style.css +540 -1
- package/lib/vxe-icon/style/style.min.css +1 -1
- package/lib/vxe-input/index.js +22 -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 +1000 -0
- package/lib/vxe-input/style/style.min.css +1 -0
- package/lib/vxe-layout-aside/style/style.css +1 -0
- package/lib/vxe-layout-aside/style/style.min.css +1 -1
- package/lib/vxe-layout-body/style/style.css +1 -0
- package/lib/vxe-layout-body/style/style.min.css +1 -1
- package/lib/vxe-layout-footer/style/style.css +1 -0
- package/lib/vxe-layout-footer/style/style.min.css +1 -1
- package/lib/vxe-layout-header/style/style.css +1 -0
- package/lib/vxe-layout-header/style/style.min.css +1 -1
- package/lib/vxe-list-design/index.js +22 -0
- package/lib/vxe-list-design/index.min.js +1 -0
- package/lib/vxe-list-design/style/index.js +1 -0
- package/lib/vxe-list-design/style/style.css +0 -0
- package/lib/vxe-list-design/style/style.min.css +0 -0
- package/lib/vxe-loading/index.js +22 -0
- package/lib/vxe-loading/index.min.js +1 -0
- package/lib/vxe-loading/style/index.js +1 -0
- package/lib/vxe-loading/style/style.css +75 -0
- package/lib/vxe-loading/style/style.min.css +1 -0
- package/lib/vxe-modal/index.js +22 -0
- package/lib/vxe-modal/index.min.js +1 -0
- package/lib/vxe-modal/style/index.js +1 -0
- package/lib/vxe-modal/style/style.css +323 -0
- package/lib/vxe-modal/style/style.min.css +1 -0
- package/lib/vxe-optgroup/index.js +22 -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 +22 -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 +22 -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 +319 -0
- package/lib/vxe-pager/style/style.min.css +1 -0
- package/lib/vxe-pulldown/index.js +22 -0
- package/lib/vxe-pulldown/index.min.js +1 -0
- package/lib/vxe-pulldown/style/index.js +1 -0
- package/lib/vxe-pulldown/style/style.css +57 -0
- package/lib/vxe-pulldown/style/style.min.css +1 -0
- package/lib/vxe-radio/index.js +22 -0
- package/lib/vxe-radio/index.min.js +1 -0
- package/lib/vxe-radio/style/index.js +1 -0
- package/lib/vxe-radio/style/style.css +143 -0
- package/lib/vxe-radio/style/style.min.css +1 -0
- package/lib/vxe-radio-button/index.js +22 -0
- package/lib/vxe-radio-button/index.min.js +1 -0
- package/lib/vxe-radio-button/style/index.js +1 -0
- package/lib/vxe-radio-button/style/style.css +0 -0
- package/lib/vxe-radio-button/style/style.min.css +0 -0
- package/lib/vxe-radio-group/index.js +22 -0
- package/lib/vxe-radio-group/index.min.js +1 -0
- package/lib/vxe-radio-group/style/index.js +1 -0
- package/lib/vxe-radio-group/style/style.css +0 -0
- package/lib/vxe-radio-group/style/style.min.css +0 -0
- package/lib/vxe-select/index.js +22 -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 +201 -0
- package/lib/vxe-select/style/style.min.css +1 -0
- package/lib/vxe-switch/index.js +22 -0
- package/lib/vxe-switch/index.min.js +1 -0
- package/lib/vxe-switch/style/index.js +1 -0
- package/lib/vxe-switch/style/style.css +97 -0
- package/lib/vxe-switch/style/style.min.css +1 -0
- package/lib/vxe-textarea/index.js +22 -0
- package/lib/vxe-textarea/index.min.js +1 -0
- package/lib/vxe-textarea/style/index.js +1 -0
- package/lib/vxe-textarea/style/style.css +102 -0
- package/lib/vxe-textarea/style/style.min.css +1 -0
- package/lib/vxe-tooltip/index.js +22 -0
- package/lib/vxe-tooltip/index.min.js +1 -0
- package/lib/vxe-tooltip/style/index.js +1 -0
- package/lib/vxe-tooltip/style/style.css +103 -0
- package/lib/vxe-tooltip/style/style.min.css +1 -0
- package/package.json +1 -1
- package/packages/anchor/src/anchor.ts +1 -1
- package/packages/anchor-link/index.ts +1 -1
- package/packages/{button-group → button}/src/button-group.ts +2 -2
- package/packages/button/src/button.ts +3 -3
- package/packages/button-group/index.ts +1 -1
- package/packages/checkbox/index.ts +15 -0
- package/packages/checkbox/src/checkbox.ts +131 -0
- package/packages/checkbox/src/group.ts +127 -0
- package/packages/checkbox-group/index.ts +15 -0
- package/packages/col/index.ts +1 -1
- package/packages/components.ts +100 -35
- package/packages/dynamics/index.ts +34 -0
- package/packages/form/index.ts +11 -0
- package/packages/form/src/form-config-item.ts +193 -0
- package/packages/form/src/form-gather.ts +60 -0
- package/packages/form/src/form-item.ts +253 -0
- package/packages/form/src/form.ts +716 -0
- package/packages/form/src/itemInfo.ts +43 -0
- package/packages/form/src/render.ts +83 -0
- package/packages/form/src/util.ts +79 -0
- package/packages/form-design/index.ts +11 -0
- package/packages/form-design/src/form-design.ts +99 -0
- package/packages/form-design/src/setting.ts +13 -0
- package/packages/form-design/src/util.ts +10 -0
- package/packages/form-design/src/view.ts +125 -0
- package/packages/form-design/src/widget.ts +117 -0
- package/packages/form-gather/index.ts +11 -0
- package/packages/form-item/index.ts +11 -0
- package/packages/icon/src/icon.ts +1 -1
- package/packages/input/index.ts +15 -0
- package/packages/input/src/date.ts +42 -0
- package/packages/input/src/input.ts +2480 -0
- package/packages/input/src/number.ts +12 -0
- package/packages/list-design/index.ts +11 -0
- package/packages/list-design/src/list-design.ts +55 -0
- package/packages/loading/index.ts +11 -0
- package/packages/loading/src/loading.ts +56 -0
- package/packages/modal/index.ts +110 -0
- package/packages/modal/src/modal.ts +950 -0
- package/packages/optgroup/index.ts +15 -0
- package/packages/option/index.ts +15 -0
- package/packages/pager/index.ts +15 -0
- package/packages/pager/src/pager.ts +595 -0
- package/packages/pulldown/index.ts +15 -0
- package/packages/pulldown/src/pulldown.ts +349 -0
- package/packages/radio/index.ts +15 -0
- package/packages/radio/src/button.ts +132 -0
- package/packages/radio/src/group.ts +110 -0
- package/packages/radio/src/radio.ts +137 -0
- package/packages/radio-button/index.ts +15 -0
- package/packages/radio-group/index.ts +15 -0
- package/packages/select/index.ts +15 -0
- package/packages/select/src/optgroup.ts +39 -0
- package/packages/select/src/option.ts +38 -0
- package/packages/select/src/optionInfo.ts +20 -0
- package/packages/select/src/select.ts +1034 -0
- package/packages/select/src/util.ts +47 -0
- package/packages/switch/index.ts +15 -0
- package/packages/switch/src/switch.ts +171 -0
- package/packages/textarea/index.ts +15 -0
- package/packages/textarea/src/textarea.ts +273 -0
- package/packages/tooltip/index.ts +11 -0
- package/packages/tooltip/src/tooltip.ts +360 -0
- package/packages/ui/src/core.ts +13 -1
- package/packages/ui/src/dom.ts +23 -0
- package/packages/ui/src/globalStore.ts +122 -5
- package/packages/ui/src/i18n.ts +8 -0
- package/packages/ui/src/log.ts +2 -2
- package/packages/ui/src/renderer.ts +71 -0
- package/packages/ui/src/store.ts +49 -0
- package/packages/ui/src/utils.ts +12 -0
- package/packages/ui/src/validators.ts +9 -0
- package/packages/ui/src/vn.ts +14 -0
- package/styles/all.scss +30 -10
- package/styles/base/common.scss +13 -0
- package/styles/components/button.scss +8 -8
- package/styles/components/checkbox-group.scss +0 -0
- package/styles/components/checkbox.scss +91 -0
- package/styles/components/form-design.scss +93 -0
- package/styles/components/form-gather.scss +0 -0
- package/styles/components/form-item.scss +0 -0
- package/styles/components/form.scss +339 -0
- package/styles/components/icon.scss +3 -1
- package/styles/components/input.scss +911 -0
- package/styles/components/layout-aside.scss +1 -0
- package/styles/components/layout-body.scss +1 -0
- package/styles/components/layout-footer.scss +1 -0
- package/styles/components/layout-header.scss +1 -0
- package/styles/components/list-design.scss +0 -0
- package/styles/components/list.scss +26 -0
- package/styles/components/loading.scss +84 -0
- package/styles/components/modal.scss +383 -0
- package/styles/components/old-icon.scss +712 -0
- package/styles/components/optgroup.scss +0 -0
- package/styles/components/option.scss +0 -0
- package/styles/components/pager.scss +287 -0
- package/styles/components/pulldown.scss +55 -0
- package/styles/components/radio-button.scss +0 -0
- package/styles/components/radio-group.scss +0 -0
- package/styles/components/radio.scss +149 -0
- package/styles/components/select.scss +226 -0
- package/styles/components/switch.scss +113 -0
- package/styles/components/textarea.scss +102 -0
- package/styles/components/tooltip.scss +124 -0
- package/styles/helpers/mixin.scss +12 -12
- package/styles/theme/base.scss +143 -6
- package/types/all.d.ts +66 -33
- package/types/{component → components}/anchor-link.d.ts +17 -2
- package/types/{component → components}/anchor.d.ts +10 -2
- package/types/{component → components}/breadcrumb-item.d.ts +12 -1
- package/types/{component → components}/breadcrumb.d.ts +10 -2
- package/types/{component → components}/button-group.d.ts +11 -3
- package/types/{component → components}/button.d.ts +14 -3
- package/types/components/checkbox-group.d.ts +112 -0
- package/types/components/checkbox.d.ts +119 -0
- package/types/{component → components}/col.d.ts +9 -1
- package/types/components/form-design.d.ts +88 -0
- package/types/components/form-gather.d.ts +75 -0
- package/types/components/form-item.d.ts +231 -0
- package/types/components/form.d.ts +349 -0
- package/types/{component → components}/icon.d.ts +7 -2
- package/types/components/input.d.ts +375 -0
- package/types/{component → components}/layout-aside.d.ts +10 -2
- package/types/{component → components}/layout-body.d.ts +10 -2
- package/types/{component → components}/layout-container.d.ts +10 -2
- package/types/{component → components}/layout-footer.d.ts +10 -2
- package/types/{component → components}/layout-header.d.ts +7 -1
- package/types/components/list-design.d.ts +67 -0
- package/types/components/loading.d.ts +66 -0
- package/types/components/modal.d.ts +381 -0
- package/types/components/optgroup.d.ts +80 -0
- package/types/components/option.d.ts +99 -0
- package/types/components/pager.d.ts +208 -0
- package/types/components/pulldown.d.ts +134 -0
- package/types/components/radio-button.d.ts +99 -0
- package/types/components/radio-group.d.ts +107 -0
- package/types/components/radio.d.ts +119 -0
- package/types/{component → components}/row.d.ts +10 -2
- package/types/components/select.d.ts +274 -0
- package/types/components/switch.d.ts +118 -0
- package/types/components/textarea.d.ts +212 -0
- package/types/components/tooltip.d.ts +122 -0
- package/types/ui/global-config.d.ts +43 -6
- package/types/ui/global-icon.d.ts +80 -10
- package/types/ui/index.d.ts +25 -2
- package/types/ui/renderer.d.ts +239 -0
- package/types/ui/validators.d.ts +26 -0
- package/es/design/index.js +0 -8
- package/es/vxe-design/index.js +0 -3
- package/lib/button-group/src/button-group.min.js +0 -1
- package/lib/design/index.js +0 -15
- package/lib/design/index.min.js +0 -1
- package/lib/design/src/design.min.js +0 -1
- package/lib/vxe-design/index.min.js +0 -1
- package/packages/design/index.ts +0 -11
- package/packages/design/src/design.ts +0 -55
- package/styles/components/design.scss +0 -1
- package/types/component/design.d.ts +0 -63
- /package/es/{anchor-link → anchor}/src/anchor-link.js +0 -0
- /package/es/{anchor-link → anchor}/src/util.js +0 -0
- /package/es/{design → checkbox-group}/style.css +0 -0
- /package/es/{design → checkbox-group}/style.min.css +0 -0
- /package/es/{vxe-design → form-gather}/style.css +0 -0
- /package/es/{vxe-design → form-gather}/style.min.css +0 -0
- /package/{lib/design/style → es/form-item}/style.css +0 -0
- /package/{lib/design/style → es/form-item}/style.min.css +0 -0
- /package/{lib/vxe-design/style → es/list-design}/style.css +0 -0
- /package/{lib/vxe-design/style → es/list-design}/style.min.css +0 -0
- /package/es/{col → row}/src/col.js +0 -0
- /package/lib/{anchor-link → anchor}/src/anchor-link.js +0 -0
- /package/lib/{anchor-link → anchor}/src/anchor-link.min.js +0 -0
- /package/lib/{anchor-link → anchor}/src/util.js +0 -0
- /package/lib/{anchor-link → anchor}/src/util.min.js +0 -0
- /package/lib/{vxe-design → checkbox}/style/index.js +0 -0
- /package/lib/{design → checkbox-group}/style/index.js +0 -0
- /package/lib/{col → row}/src/col.js +0 -0
- /package/lib/{col → row}/src/col.min.js +0 -0
- /package/packages/{anchor-link → anchor}/src/anchor-link.ts +0 -0
- /package/packages/{anchor-link → anchor}/src/util.ts +0 -0
- /package/packages/{col → row}/src/col.ts +0 -0
|
@@ -0,0 +1,1034 @@
|
|
|
1
|
+
import { defineComponent, h, Teleport, PropType, ref, Ref, inject, computed, provide, onUnmounted, reactive, nextTick, watch, onMounted, createCommentVNode } from 'vue'
|
|
2
|
+
import XEUtils from 'xe-utils'
|
|
3
|
+
import globalConfigStore from '../../ui/src/globalStore'
|
|
4
|
+
import iconConfigStore from '../../ui/src/iconStore'
|
|
5
|
+
import { useSize } from '../../hooks/size'
|
|
6
|
+
import { getEventTargetNode, getAbsolutePos } from '../../ui/src/dom'
|
|
7
|
+
import { getLastZIndex, nextZIndex, getFuncText, formatText } from '../../ui/src/utils'
|
|
8
|
+
import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../ui/src/event'
|
|
9
|
+
import { getI18n } from '../../ui/src/i18n'
|
|
10
|
+
import VxeInputComponent from '../../input/src/input'
|
|
11
|
+
import { getSlotVNs } from '../../ui/src/vn'
|
|
12
|
+
|
|
13
|
+
import { VxeSelectPropTypes, VxeSelectConstructor, SelectReactData, VxeSelectEmits, VxeInputConstructor, SelectMethods, SelectPrivateRef, VxeSelectMethods, VxeOptgroupProps, VxeOptionProps, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, VxeInputDefines, VxeComponentSlot } from '../../../types'
|
|
14
|
+
|
|
15
|
+
function isOptionVisible (option: any) {
|
|
16
|
+
return option.visible !== false
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getOptUniqueId () {
|
|
20
|
+
return XEUtils.uniqueId('opt_')
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default defineComponent({
|
|
24
|
+
name: 'VxeSelect',
|
|
25
|
+
props: {
|
|
26
|
+
modelValue: null,
|
|
27
|
+
clearable: Boolean as PropType<VxeSelectPropTypes.Clearable>,
|
|
28
|
+
placeholder: {
|
|
29
|
+
type: String as PropType<VxeSelectPropTypes.Placeholder>,
|
|
30
|
+
default: () => XEUtils.eqNull(globalConfigStore.select.placeholder) ? getI18n('vxe.base.pleaseSelect') : globalConfigStore.select.placeholder
|
|
31
|
+
},
|
|
32
|
+
loading: Boolean as PropType<VxeSelectPropTypes.Loading>,
|
|
33
|
+
disabled: Boolean as PropType<VxeSelectPropTypes.Disabled>,
|
|
34
|
+
multiple: Boolean as PropType<VxeSelectPropTypes.Multiple>,
|
|
35
|
+
multiCharOverflow: { type: [Number, String] as PropType<VxeSelectPropTypes.MultiCharOverflow>, default: () => globalConfigStore.select.multiCharOverflow },
|
|
36
|
+
prefixIcon: String as PropType<VxeSelectPropTypes.PrefixIcon>,
|
|
37
|
+
placement: String as PropType<VxeSelectPropTypes.Placement>,
|
|
38
|
+
options: Array as PropType<VxeSelectPropTypes.Options>,
|
|
39
|
+
optionProps: Object as PropType<VxeSelectPropTypes.OptionProps>,
|
|
40
|
+
optionGroups: Array as PropType<VxeSelectPropTypes.OptionGroups>,
|
|
41
|
+
optionGroupProps: Object as PropType<VxeSelectPropTypes.OptionGroupProps>,
|
|
42
|
+
optionConfig: Object as PropType<VxeSelectPropTypes.OptionConfig>,
|
|
43
|
+
className: [String, Function] as PropType<VxeSelectPropTypes.ClassName>,
|
|
44
|
+
popupClassName: [String, Function] as PropType<VxeSelectPropTypes.PopupClassName>,
|
|
45
|
+
max: { type: [String, Number] as PropType<VxeSelectPropTypes.Max>, default: null },
|
|
46
|
+
size: { type: String as PropType<VxeSelectPropTypes.Size>, default: () => globalConfigStore.select.size || globalConfigStore.size },
|
|
47
|
+
filterable: Boolean as PropType<VxeSelectPropTypes.Filterable>,
|
|
48
|
+
filterMethod: Function as PropType<VxeSelectPropTypes.FilterMethod>,
|
|
49
|
+
remote: Boolean as PropType<VxeSelectPropTypes.Remote>,
|
|
50
|
+
remoteMethod: Function as PropType<VxeSelectPropTypes.RemoteMethod>,
|
|
51
|
+
emptyText: String as PropType<VxeSelectPropTypes.EmptyText>,
|
|
52
|
+
// 已废弃,被 option-config.keyField 替换
|
|
53
|
+
optionId: { type: String as PropType<VxeSelectPropTypes.OptionId>, default: () => globalConfigStore.select.optionId },
|
|
54
|
+
// 已废弃,被 option-config.useKey 替换
|
|
55
|
+
optionKey: Boolean as PropType<VxeSelectPropTypes.OptionKey>,
|
|
56
|
+
transfer: { type: Boolean as PropType<VxeSelectPropTypes.Transfer>, default: () => globalConfigStore.select.transfer }
|
|
57
|
+
},
|
|
58
|
+
emits: [
|
|
59
|
+
'update:modelValue',
|
|
60
|
+
'change',
|
|
61
|
+
'clear',
|
|
62
|
+
'blur',
|
|
63
|
+
'focus'
|
|
64
|
+
] as VxeSelectEmits,
|
|
65
|
+
setup (props, context) {
|
|
66
|
+
const { slots, emit } = context
|
|
67
|
+
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeForm', null)
|
|
68
|
+
const $xeformiteminfo = inject<VxeFormDefines.ProvideItemInfo | null>('$xeFormItemInfo', null)
|
|
69
|
+
|
|
70
|
+
const xID = XEUtils.uniqueId()
|
|
71
|
+
|
|
72
|
+
const computeSize = useSize(props)
|
|
73
|
+
|
|
74
|
+
const reactData = reactive<SelectReactData>({
|
|
75
|
+
inited: false,
|
|
76
|
+
staticOptions: [],
|
|
77
|
+
fullGroupList: [],
|
|
78
|
+
fullOptionList: [],
|
|
79
|
+
visibleGroupList: [],
|
|
80
|
+
visibleOptionList: [],
|
|
81
|
+
remoteValueList: [],
|
|
82
|
+
panelIndex: 0,
|
|
83
|
+
panelStyle: {},
|
|
84
|
+
panelPlacement: null,
|
|
85
|
+
currentOption: null,
|
|
86
|
+
currentValue: null,
|
|
87
|
+
visiblePanel: false,
|
|
88
|
+
animatVisible: false,
|
|
89
|
+
isActivated: false,
|
|
90
|
+
searchValue: '',
|
|
91
|
+
searchLoading: false
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const refElem = ref() as Ref<HTMLDivElement>
|
|
95
|
+
const refInput = ref() as Ref<VxeInputConstructor>
|
|
96
|
+
const refInpSearch = ref() as Ref<VxeInputConstructor>
|
|
97
|
+
const refOptionWrapper = ref() as Ref<HTMLDivElement>
|
|
98
|
+
const refOptionPanel = ref() as Ref<HTMLDivElement>
|
|
99
|
+
|
|
100
|
+
const refMaps: SelectPrivateRef = {
|
|
101
|
+
refElem
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const $xeselect = {
|
|
105
|
+
xID,
|
|
106
|
+
props,
|
|
107
|
+
context,
|
|
108
|
+
reactData,
|
|
109
|
+
getRefMaps: () => refMaps
|
|
110
|
+
} as unknown as VxeSelectConstructor & VxeSelectMethods
|
|
111
|
+
|
|
112
|
+
let selectMethods = {} as SelectMethods
|
|
113
|
+
|
|
114
|
+
const computePropsOpts = computed(() => {
|
|
115
|
+
return props.optionProps || {}
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
const computeGroupPropsOpts = computed(() => {
|
|
119
|
+
return props.optionGroupProps || {}
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
const computeLabelField = computed(() => {
|
|
123
|
+
const propsOpts = computePropsOpts.value
|
|
124
|
+
return propsOpts.label || 'label'
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
const computeValueField = computed(() => {
|
|
128
|
+
const propsOpts = computePropsOpts.value
|
|
129
|
+
return propsOpts.value || 'value'
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
const computeGroupLabelField = computed(() => {
|
|
133
|
+
const groupPropsOpts = computeGroupPropsOpts.value
|
|
134
|
+
return groupPropsOpts.label || 'label'
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
const computeGroupOptionsField = computed(() => {
|
|
138
|
+
const groupPropsOpts = computeGroupPropsOpts.value
|
|
139
|
+
return groupPropsOpts.options || 'options'
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
const computeIsMaximize = computed(() => {
|
|
143
|
+
const { modelValue, multiple, max } = props
|
|
144
|
+
if (multiple && max) {
|
|
145
|
+
return (modelValue ? modelValue.length : 0) >= XEUtils.toNumber(max)
|
|
146
|
+
}
|
|
147
|
+
return false
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
const computeOptionOpts = computed(() => {
|
|
151
|
+
return Object.assign({}, globalConfigStore.select.optionConfig, props.optionConfig)
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
const computeIsGroup = computed(() => {
|
|
155
|
+
return reactData.fullGroupList.some((item) => item.options && item.options.length)
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
const computeMultiMaxCharNum = computed(() => {
|
|
159
|
+
return XEUtils.toNumber(props.multiCharOverflow)
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
const callSlot = <T>(slotFunc: ((params: T) => VxeComponentSlot | VxeComponentSlot[]) | string | null, params: T) => {
|
|
163
|
+
if (slotFunc) {
|
|
164
|
+
if (XEUtils.isString(slotFunc)) {
|
|
165
|
+
slotFunc = slots[slotFunc] || null
|
|
166
|
+
}
|
|
167
|
+
if (XEUtils.isFunction(slotFunc)) {
|
|
168
|
+
return getSlotVNs(slotFunc(params))
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return []
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const findOption = (optionValue: any) => {
|
|
175
|
+
const { fullOptionList, fullGroupList } = reactData
|
|
176
|
+
const isGroup = computeIsGroup.value
|
|
177
|
+
const valueField = computeValueField.value as 'value'
|
|
178
|
+
if (isGroup) {
|
|
179
|
+
for (let gIndex = 0; gIndex < fullGroupList.length; gIndex++) {
|
|
180
|
+
const group = fullGroupList[gIndex]
|
|
181
|
+
if (group.options) {
|
|
182
|
+
for (let index = 0; index < group.options.length; index++) {
|
|
183
|
+
const option = group.options[index]
|
|
184
|
+
if (optionValue === option[valueField]) {
|
|
185
|
+
return option
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return fullOptionList.find((item) => optionValue === item[valueField])
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const getRemoteSelectLabel = (value: any) => {
|
|
195
|
+
const { remoteValueList } = reactData
|
|
196
|
+
const labelField = computeLabelField.value
|
|
197
|
+
const remoteItem = remoteValueList.find(item => value === item.key)
|
|
198
|
+
const item = remoteItem ? remoteItem.result : null
|
|
199
|
+
return XEUtils.toValueString(item ? item[labelField] : value)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const getSelectLabel = (value: any) => {
|
|
203
|
+
const labelField = computeLabelField.value
|
|
204
|
+
const item = findOption(value)
|
|
205
|
+
return XEUtils.toValueString(item ? item[labelField as 'label'] : value)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const computeSelectLabel = computed(() => {
|
|
209
|
+
const { modelValue, multiple, remote } = props
|
|
210
|
+
const multiMaxCharNum = computeMultiMaxCharNum.value
|
|
211
|
+
if (modelValue && multiple) {
|
|
212
|
+
const vals = XEUtils.isArray(modelValue) ? modelValue : [modelValue]
|
|
213
|
+
if (remote) {
|
|
214
|
+
return vals.map(val => getRemoteSelectLabel(val)).join(', ')
|
|
215
|
+
}
|
|
216
|
+
return vals.map((val) => {
|
|
217
|
+
const label = getSelectLabel(val)
|
|
218
|
+
if (multiMaxCharNum > 0 && label.length > multiMaxCharNum) {
|
|
219
|
+
return `${label.substring(0, multiMaxCharNum)}...`
|
|
220
|
+
}
|
|
221
|
+
return label
|
|
222
|
+
}).join(', ')
|
|
223
|
+
}
|
|
224
|
+
if (remote) {
|
|
225
|
+
return getRemoteSelectLabel(modelValue)
|
|
226
|
+
}
|
|
227
|
+
return getSelectLabel(modelValue)
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
const getOptkey = () => {
|
|
231
|
+
const optionOpts = computeOptionOpts.value
|
|
232
|
+
return optionOpts.keyField || props.optionId || '_X_OPTION_KEY'
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const getOptid = (option: any) => {
|
|
236
|
+
const optid = option[getOptkey()]
|
|
237
|
+
return optid ? encodeURIComponent(optid) : ''
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* 刷新选项,当选项被动态显示/隐藏时可能会用到
|
|
242
|
+
*/
|
|
243
|
+
const refreshOption = () => {
|
|
244
|
+
const { filterable, filterMethod } = props
|
|
245
|
+
const { fullOptionList, fullGroupList, searchValue } = reactData
|
|
246
|
+
const isGroup = computeIsGroup.value
|
|
247
|
+
const groupLabelField = computeGroupLabelField.value
|
|
248
|
+
const labelField = computeLabelField.value
|
|
249
|
+
if (isGroup) {
|
|
250
|
+
if (filterable && filterMethod) {
|
|
251
|
+
reactData.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && filterMethod({ group, option: null, searchValue }))
|
|
252
|
+
} else if (filterable) {
|
|
253
|
+
reactData.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && (!searchValue || `${group[groupLabelField]}`.indexOf(searchValue) > -1))
|
|
254
|
+
} else {
|
|
255
|
+
reactData.visibleGroupList = fullGroupList.filter(isOptionVisible)
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
if (filterable && filterMethod) {
|
|
259
|
+
reactData.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && filterMethod({ group: null, option, searchValue }))
|
|
260
|
+
} else if (filterable) {
|
|
261
|
+
reactData.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && (!searchValue || `${option[labelField]}`.indexOf(searchValue) > -1))
|
|
262
|
+
} else {
|
|
263
|
+
reactData.visibleOptionList = fullOptionList.filter(isOptionVisible)
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return nextTick()
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const cacheItemMap = () => {
|
|
270
|
+
const { fullOptionList, fullGroupList } = reactData
|
|
271
|
+
const groupOptionsField = computeGroupOptionsField.value
|
|
272
|
+
const key = getOptkey()
|
|
273
|
+
const handleOptis = (item: any) => {
|
|
274
|
+
if (!getOptid(item)) {
|
|
275
|
+
item[key] = getOptUniqueId()
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (fullGroupList.length) {
|
|
279
|
+
fullGroupList.forEach((group: any) => {
|
|
280
|
+
handleOptis(group)
|
|
281
|
+
if (group[groupOptionsField]) {
|
|
282
|
+
group[groupOptionsField].forEach(handleOptis)
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
} else if (fullOptionList.length) {
|
|
286
|
+
fullOptionList.forEach(handleOptis)
|
|
287
|
+
}
|
|
288
|
+
refreshOption()
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const setCurrentOption = (option: any) => {
|
|
292
|
+
const valueField = computeValueField.value
|
|
293
|
+
if (option) {
|
|
294
|
+
reactData.currentOption = option
|
|
295
|
+
reactData.currentValue = option[valueField]
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const scrollToOption = (option: any, isAlignBottom?: boolean) => {
|
|
300
|
+
return nextTick().then(() => {
|
|
301
|
+
if (option) {
|
|
302
|
+
const optWrapperElem = refOptionWrapper.value
|
|
303
|
+
const panelElem = refOptionPanel.value
|
|
304
|
+
const optElem = panelElem.querySelector(`[optid='${getOptid(option)}']`) as HTMLElement
|
|
305
|
+
if (optWrapperElem && optElem) {
|
|
306
|
+
const wrapperHeight = optWrapperElem.offsetHeight
|
|
307
|
+
const offsetPadding = 5
|
|
308
|
+
if (isAlignBottom) {
|
|
309
|
+
if (optElem.offsetTop + optElem.offsetHeight - optWrapperElem.scrollTop > wrapperHeight) {
|
|
310
|
+
optWrapperElem.scrollTop = optElem.offsetTop + optElem.offsetHeight - wrapperHeight
|
|
311
|
+
}
|
|
312
|
+
} else {
|
|
313
|
+
if (optElem.offsetTop + offsetPadding < optWrapperElem.scrollTop || optElem.offsetTop + offsetPadding > optWrapperElem.scrollTop + optWrapperElem.clientHeight) {
|
|
314
|
+
optWrapperElem.scrollTop = optElem.offsetTop - offsetPadding
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
})
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const updateZindex = () => {
|
|
323
|
+
if (reactData.panelIndex < getLastZIndex()) {
|
|
324
|
+
reactData.panelIndex = nextZIndex()
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const updatePlacement = () => {
|
|
329
|
+
return nextTick().then(() => {
|
|
330
|
+
const { transfer, placement } = props
|
|
331
|
+
const { panelIndex } = reactData
|
|
332
|
+
const el = refElem.value
|
|
333
|
+
const panelElem = refOptionPanel.value
|
|
334
|
+
if (panelElem && el) {
|
|
335
|
+
const targetHeight = el.offsetHeight
|
|
336
|
+
const targetWidth = el.offsetWidth
|
|
337
|
+
const panelHeight = panelElem.offsetHeight
|
|
338
|
+
const panelWidth = panelElem.offsetWidth
|
|
339
|
+
const marginSize = 5
|
|
340
|
+
const panelStyle: { [key: string]: any } = {
|
|
341
|
+
zIndex: panelIndex
|
|
342
|
+
}
|
|
343
|
+
const { boundingTop, boundingLeft, visibleHeight, visibleWidth } = getAbsolutePos(el)
|
|
344
|
+
let panelPlacement = 'bottom'
|
|
345
|
+
if (transfer) {
|
|
346
|
+
let left = boundingLeft
|
|
347
|
+
let top = boundingTop + targetHeight
|
|
348
|
+
if (placement === 'top') {
|
|
349
|
+
panelPlacement = 'top'
|
|
350
|
+
top = boundingTop - panelHeight
|
|
351
|
+
} else if (!placement) {
|
|
352
|
+
// 如果下面不够放,则向上
|
|
353
|
+
if (top + panelHeight + marginSize > visibleHeight) {
|
|
354
|
+
panelPlacement = 'top'
|
|
355
|
+
top = boundingTop - panelHeight
|
|
356
|
+
}
|
|
357
|
+
// 如果上面不够放,则向下(优先)
|
|
358
|
+
if (top < marginSize) {
|
|
359
|
+
panelPlacement = 'bottom'
|
|
360
|
+
top = boundingTop + targetHeight
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
// 如果溢出右边
|
|
364
|
+
if (left + panelWidth + marginSize > visibleWidth) {
|
|
365
|
+
left -= left + panelWidth + marginSize - visibleWidth
|
|
366
|
+
}
|
|
367
|
+
// 如果溢出左边
|
|
368
|
+
if (left < marginSize) {
|
|
369
|
+
left = marginSize
|
|
370
|
+
}
|
|
371
|
+
Object.assign(panelStyle, {
|
|
372
|
+
left: `${left}px`,
|
|
373
|
+
top: `${top}px`,
|
|
374
|
+
minWidth: `${targetWidth}px`
|
|
375
|
+
})
|
|
376
|
+
} else {
|
|
377
|
+
if (placement === 'top') {
|
|
378
|
+
panelPlacement = 'top'
|
|
379
|
+
panelStyle.bottom = `${targetHeight}px`
|
|
380
|
+
} else if (!placement) {
|
|
381
|
+
// 如果下面不够放,则向上
|
|
382
|
+
if (boundingTop + targetHeight + panelHeight > visibleHeight) {
|
|
383
|
+
// 如果上面不够放,则向下(优先)
|
|
384
|
+
if (boundingTop - targetHeight - panelHeight > marginSize) {
|
|
385
|
+
panelPlacement = 'top'
|
|
386
|
+
panelStyle.bottom = `${targetHeight}px`
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
reactData.panelStyle = panelStyle
|
|
392
|
+
reactData.panelPlacement = panelPlacement
|
|
393
|
+
return nextTick()
|
|
394
|
+
}
|
|
395
|
+
})
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
let hidePanelTimeout: number
|
|
399
|
+
|
|
400
|
+
const showOptionPanel = () => {
|
|
401
|
+
const { loading, disabled, filterable } = props
|
|
402
|
+
if (!loading && !disabled) {
|
|
403
|
+
clearTimeout(hidePanelTimeout)
|
|
404
|
+
if (!reactData.inited) {
|
|
405
|
+
reactData.inited = true
|
|
406
|
+
}
|
|
407
|
+
reactData.isActivated = true
|
|
408
|
+
reactData.animatVisible = true
|
|
409
|
+
if (filterable) {
|
|
410
|
+
refreshOption()
|
|
411
|
+
}
|
|
412
|
+
setTimeout(() => {
|
|
413
|
+
const { modelValue, multiple } = props
|
|
414
|
+
const currOption = findOption(multiple && modelValue ? modelValue[0] : modelValue)
|
|
415
|
+
reactData.visiblePanel = true
|
|
416
|
+
if (currOption) {
|
|
417
|
+
setCurrentOption(currOption)
|
|
418
|
+
scrollToOption(currOption)
|
|
419
|
+
}
|
|
420
|
+
handleFocusSearch()
|
|
421
|
+
}, 10)
|
|
422
|
+
updateZindex()
|
|
423
|
+
updatePlacement()
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
const hideOptionPanel = () => {
|
|
428
|
+
reactData.searchValue = ''
|
|
429
|
+
reactData.searchLoading = false
|
|
430
|
+
reactData.visiblePanel = false
|
|
431
|
+
hidePanelTimeout = window.setTimeout(() => {
|
|
432
|
+
reactData.animatVisible = false
|
|
433
|
+
}, 350)
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const changeEvent = (evnt: Event, selectValue: any) => {
|
|
437
|
+
if (selectValue !== props.modelValue) {
|
|
438
|
+
emit('update:modelValue', selectValue)
|
|
439
|
+
selectMethods.dispatchEvent('change', { value: selectValue }, evnt)
|
|
440
|
+
// 自动更新校验状态
|
|
441
|
+
if ($xeform && $xeformiteminfo) {
|
|
442
|
+
$xeform.triggerItemEvent(evnt, $xeformiteminfo.itemConfig.field, selectValue)
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const clearValueEvent = (evnt: Event, selectValue: any) => {
|
|
448
|
+
reactData.remoteValueList = []
|
|
449
|
+
changeEvent(evnt, selectValue)
|
|
450
|
+
selectMethods.dispatchEvent('clear', { value: selectValue }, evnt)
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
const clearEvent = (params: any, evnt: Event) => {
|
|
454
|
+
clearValueEvent(evnt, null)
|
|
455
|
+
hideOptionPanel()
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const changeOptionEvent = (evnt: Event, selectValue: any, option: any) => {
|
|
459
|
+
const { modelValue, multiple } = props
|
|
460
|
+
const { remoteValueList } = reactData
|
|
461
|
+
if (multiple) {
|
|
462
|
+
let multipleValue
|
|
463
|
+
if (modelValue) {
|
|
464
|
+
if (modelValue.indexOf(selectValue) === -1) {
|
|
465
|
+
multipleValue = modelValue.concat([selectValue])
|
|
466
|
+
} else {
|
|
467
|
+
multipleValue = (modelValue as any[]).filter((val) => val !== selectValue)
|
|
468
|
+
}
|
|
469
|
+
} else {
|
|
470
|
+
multipleValue = [selectValue]
|
|
471
|
+
}
|
|
472
|
+
const remoteItem = remoteValueList.find(item => item.key === selectValue)
|
|
473
|
+
if (remoteItem) {
|
|
474
|
+
remoteItem.result = option
|
|
475
|
+
} else {
|
|
476
|
+
remoteValueList.push({ key: selectValue, result: option })
|
|
477
|
+
}
|
|
478
|
+
changeEvent(evnt, multipleValue)
|
|
479
|
+
} else {
|
|
480
|
+
reactData.remoteValueList = [{ key: selectValue, result: option }]
|
|
481
|
+
changeEvent(evnt, selectValue)
|
|
482
|
+
hideOptionPanel()
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
const handleGlobalMousewheelEvent = (evnt: MouseEvent) => {
|
|
487
|
+
const { disabled } = props
|
|
488
|
+
const { visiblePanel } = reactData
|
|
489
|
+
if (!disabled) {
|
|
490
|
+
if (visiblePanel) {
|
|
491
|
+
const panelElem = refOptionPanel.value
|
|
492
|
+
if (getEventTargetNode(evnt, panelElem).flag) {
|
|
493
|
+
updatePlacement()
|
|
494
|
+
} else {
|
|
495
|
+
hideOptionPanel()
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
const handleGlobalMousedownEvent = (evnt: MouseEvent) => {
|
|
502
|
+
const { disabled } = props
|
|
503
|
+
const { visiblePanel } = reactData
|
|
504
|
+
if (!disabled) {
|
|
505
|
+
const el = refElem.value
|
|
506
|
+
const panelElem = refOptionPanel.value
|
|
507
|
+
reactData.isActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelElem).flag
|
|
508
|
+
if (visiblePanel && !reactData.isActivated) {
|
|
509
|
+
hideOptionPanel()
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
const findOffsetOption = (optionValue: any, isUpArrow: boolean) => {
|
|
515
|
+
const { visibleOptionList, visibleGroupList } = reactData
|
|
516
|
+
const isGroup = computeIsGroup.value
|
|
517
|
+
const valueField = computeValueField.value as 'value'
|
|
518
|
+
const groupOptionsField = computeGroupOptionsField.value as 'options'
|
|
519
|
+
let firstOption
|
|
520
|
+
let prevOption
|
|
521
|
+
let nextOption
|
|
522
|
+
let currOption
|
|
523
|
+
if (isGroup) {
|
|
524
|
+
for (let gIndex = 0; gIndex < visibleGroupList.length; gIndex++) {
|
|
525
|
+
const group = visibleGroupList[gIndex]
|
|
526
|
+
const groupOptionList = group[groupOptionsField]
|
|
527
|
+
const isGroupDisabled = group.disabled
|
|
528
|
+
if (groupOptionList) {
|
|
529
|
+
for (let index = 0; index < groupOptionList.length; index++) {
|
|
530
|
+
const option = groupOptionList[index]
|
|
531
|
+
const isVisible = isOptionVisible(option)
|
|
532
|
+
const isDisabled = isGroupDisabled || option.disabled
|
|
533
|
+
if (!firstOption && !isDisabled) {
|
|
534
|
+
firstOption = option
|
|
535
|
+
}
|
|
536
|
+
if (currOption) {
|
|
537
|
+
if (isVisible && !isDisabled) {
|
|
538
|
+
nextOption = option
|
|
539
|
+
if (!isUpArrow) {
|
|
540
|
+
return { offsetOption: nextOption }
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
if (optionValue === option[valueField]) {
|
|
545
|
+
currOption = option
|
|
546
|
+
if (isUpArrow) {
|
|
547
|
+
return { offsetOption: prevOption }
|
|
548
|
+
}
|
|
549
|
+
} else {
|
|
550
|
+
if (isVisible && !isDisabled) {
|
|
551
|
+
prevOption = option
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
} else {
|
|
558
|
+
for (let index = 0; index < visibleOptionList.length; index++) {
|
|
559
|
+
const option = visibleOptionList[index]
|
|
560
|
+
const isDisabled = option.disabled
|
|
561
|
+
if (!firstOption && !isDisabled) {
|
|
562
|
+
firstOption = option
|
|
563
|
+
}
|
|
564
|
+
if (currOption) {
|
|
565
|
+
if (!isDisabled) {
|
|
566
|
+
nextOption = option
|
|
567
|
+
if (!isUpArrow) {
|
|
568
|
+
return { offsetOption: nextOption }
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
if (optionValue === option[valueField]) {
|
|
573
|
+
currOption = option
|
|
574
|
+
if (isUpArrow) {
|
|
575
|
+
return { offsetOption: prevOption }
|
|
576
|
+
}
|
|
577
|
+
} else {
|
|
578
|
+
if (!isDisabled) {
|
|
579
|
+
prevOption = option
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return { firstOption }
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
const handleGlobalKeydownEvent = (evnt: KeyboardEvent) => {
|
|
588
|
+
const { clearable, disabled } = props
|
|
589
|
+
const { visiblePanel, currentValue, currentOption } = reactData
|
|
590
|
+
if (!disabled) {
|
|
591
|
+
const isTab = hasEventKey(evnt, EVENT_KEYS.TAB)
|
|
592
|
+
const isEnter = hasEventKey(evnt, EVENT_KEYS.ENTER)
|
|
593
|
+
const isEsc = hasEventKey(evnt, EVENT_KEYS.ESCAPE)
|
|
594
|
+
const isUpArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_UP)
|
|
595
|
+
const isDwArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_DOWN)
|
|
596
|
+
const isDel = hasEventKey(evnt, EVENT_KEYS.DELETE)
|
|
597
|
+
const isSpacebar = hasEventKey(evnt, EVENT_KEYS.SPACEBAR)
|
|
598
|
+
if (isTab) {
|
|
599
|
+
reactData.isActivated = false
|
|
600
|
+
}
|
|
601
|
+
if (visiblePanel) {
|
|
602
|
+
if (isEsc || isTab) {
|
|
603
|
+
hideOptionPanel()
|
|
604
|
+
} else if (isEnter) {
|
|
605
|
+
evnt.preventDefault()
|
|
606
|
+
evnt.stopPropagation()
|
|
607
|
+
changeOptionEvent(evnt, currentValue, currentOption)
|
|
608
|
+
} else if (isUpArrow || isDwArrow) {
|
|
609
|
+
evnt.preventDefault()
|
|
610
|
+
let { firstOption, offsetOption } = findOffsetOption(currentValue, isUpArrow)
|
|
611
|
+
if (!offsetOption && !findOption(currentValue)) {
|
|
612
|
+
offsetOption = firstOption
|
|
613
|
+
}
|
|
614
|
+
setCurrentOption(offsetOption)
|
|
615
|
+
scrollToOption(offsetOption, isDwArrow)
|
|
616
|
+
} else if (isSpacebar) {
|
|
617
|
+
evnt.preventDefault()
|
|
618
|
+
}
|
|
619
|
+
} else if ((isUpArrow || isDwArrow || isEnter || isSpacebar) && reactData.isActivated) {
|
|
620
|
+
evnt.preventDefault()
|
|
621
|
+
showOptionPanel()
|
|
622
|
+
}
|
|
623
|
+
if (reactData.isActivated) {
|
|
624
|
+
if (isDel && clearable) {
|
|
625
|
+
clearValueEvent(evnt, null)
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
const handleGlobalBlurEvent = () => {
|
|
632
|
+
hideOptionPanel()
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
const handleFocusSearch = () => {
|
|
636
|
+
if (props.filterable) {
|
|
637
|
+
nextTick(() => {
|
|
638
|
+
const inpSearch = refInpSearch.value
|
|
639
|
+
if (inpSearch) {
|
|
640
|
+
inpSearch.focus()
|
|
641
|
+
}
|
|
642
|
+
})
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
const focusEvent = (evnt: FocusEvent) => {
|
|
647
|
+
if (!props.disabled) {
|
|
648
|
+
reactData.isActivated = true
|
|
649
|
+
}
|
|
650
|
+
selectMethods.dispatchEvent('focus', {}, evnt)
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
const blurEvent = (evnt: FocusEvent) => {
|
|
654
|
+
reactData.isActivated = false
|
|
655
|
+
selectMethods.dispatchEvent('blur', {}, evnt)
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const modelSearchEvent = (value: string) => {
|
|
659
|
+
reactData.searchValue = value
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
const focusSearchEvent = () => {
|
|
663
|
+
reactData.isActivated = true
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
const keydownSearchEvent = (params: VxeInputDefines.KeydownEventParams) => {
|
|
667
|
+
const { $event } = params
|
|
668
|
+
const isEnter = hasEventKey($event, EVENT_KEYS.ENTER)
|
|
669
|
+
if (isEnter) {
|
|
670
|
+
$event.preventDefault()
|
|
671
|
+
$event.stopPropagation()
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
const triggerSearchEvent = XEUtils.debounce(function () {
|
|
676
|
+
const { remote, remoteMethod } = props
|
|
677
|
+
const { searchValue } = reactData
|
|
678
|
+
if (remote && remoteMethod) {
|
|
679
|
+
reactData.searchLoading = true
|
|
680
|
+
Promise.resolve(remoteMethod({ searchValue })).then(() => nextTick()).catch(() => nextTick()).finally(() => {
|
|
681
|
+
reactData.searchLoading = false
|
|
682
|
+
refreshOption()
|
|
683
|
+
})
|
|
684
|
+
} else {
|
|
685
|
+
refreshOption()
|
|
686
|
+
}
|
|
687
|
+
}, 350, { trailing: true })
|
|
688
|
+
|
|
689
|
+
const togglePanelEvent = (params: any) => {
|
|
690
|
+
const { $event } = params
|
|
691
|
+
$event.preventDefault()
|
|
692
|
+
if (reactData.visiblePanel) {
|
|
693
|
+
hideOptionPanel()
|
|
694
|
+
} else {
|
|
695
|
+
showOptionPanel()
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
const checkOptionDisabled = (isSelected: any, option: VxeOptionProps, group?: VxeOptgroupProps) => {
|
|
700
|
+
if (option.disabled) {
|
|
701
|
+
return true
|
|
702
|
+
}
|
|
703
|
+
if (group && group.disabled) {
|
|
704
|
+
return true
|
|
705
|
+
}
|
|
706
|
+
const isMaximize = computeIsMaximize.value
|
|
707
|
+
if (isMaximize && !isSelected) {
|
|
708
|
+
return true
|
|
709
|
+
}
|
|
710
|
+
return false
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
const renderOption = (list: VxeOptionProps[], group?: VxeOptgroupProps) => {
|
|
714
|
+
const { optionKey, modelValue, multiple } = props
|
|
715
|
+
const { currentValue } = reactData
|
|
716
|
+
const optionOpts = computeOptionOpts.value
|
|
717
|
+
const labelField = computeLabelField.value
|
|
718
|
+
const valueField = computeValueField.value
|
|
719
|
+
const isGroup = computeIsGroup.value
|
|
720
|
+
const { useKey } = optionOpts
|
|
721
|
+
const optionSlot = slots.option
|
|
722
|
+
return list.map((option, cIndex) => {
|
|
723
|
+
const { slots, className } = option
|
|
724
|
+
const optionValue = option[valueField as 'value']
|
|
725
|
+
const isSelected = multiple ? (modelValue && modelValue.indexOf(optionValue) > -1) : modelValue === optionValue
|
|
726
|
+
const isVisible = !isGroup || isOptionVisible(option)
|
|
727
|
+
const isDisabled = checkOptionDisabled(isSelected, option, group)
|
|
728
|
+
const optid = getOptid(option)
|
|
729
|
+
const defaultSlot = slots ? slots.default : null
|
|
730
|
+
const optParams = { option, group: null, $select: $xeselect }
|
|
731
|
+
return isVisible
|
|
732
|
+
? h('div', {
|
|
733
|
+
key: useKey || optionKey ? optid : cIndex,
|
|
734
|
+
class: ['vxe-select-option', className ? (XEUtils.isFunction(className) ? className(optParams) : className) : '', {
|
|
735
|
+
'is--disabled': isDisabled,
|
|
736
|
+
'is--selected': isSelected,
|
|
737
|
+
'is--hover': currentValue === optionValue
|
|
738
|
+
}],
|
|
739
|
+
// attrs
|
|
740
|
+
optid: optid,
|
|
741
|
+
// event
|
|
742
|
+
onMousedown: (evnt: MouseEvent) => {
|
|
743
|
+
const isLeftBtn = evnt.button === 0
|
|
744
|
+
if (isLeftBtn) {
|
|
745
|
+
evnt.stopPropagation()
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
onClick: (evnt: MouseEvent) => {
|
|
749
|
+
if (!isDisabled) {
|
|
750
|
+
changeOptionEvent(evnt, optionValue, option)
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
onMouseenter: () => {
|
|
754
|
+
if (!isDisabled) {
|
|
755
|
+
setCurrentOption(option)
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}, optionSlot ? callSlot(optionSlot, optParams) : (defaultSlot ? callSlot(defaultSlot, optParams) : formatText(getFuncText(option[labelField as 'label']))))
|
|
759
|
+
: createCommentVNode()
|
|
760
|
+
})
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
const renderOptgroup = () => {
|
|
764
|
+
const { optionKey } = props
|
|
765
|
+
const { visibleGroupList } = reactData
|
|
766
|
+
const optionOpts = computeOptionOpts.value
|
|
767
|
+
const groupLabelField = computeGroupLabelField.value
|
|
768
|
+
const groupOptionsField = computeGroupOptionsField.value
|
|
769
|
+
const { useKey } = optionOpts
|
|
770
|
+
const optionSlot = slots.option
|
|
771
|
+
return visibleGroupList.map((group, gIndex) => {
|
|
772
|
+
const { slots, className } = group
|
|
773
|
+
const optid = getOptid(group)
|
|
774
|
+
const isGroupDisabled = group.disabled
|
|
775
|
+
const defaultSlot = slots ? slots.default : null
|
|
776
|
+
const optParams = { option: group, group, $select: $xeselect }
|
|
777
|
+
return h('div', {
|
|
778
|
+
key: useKey || optionKey ? optid : gIndex,
|
|
779
|
+
class: ['vxe-optgroup', className ? (XEUtils.isFunction(className) ? className(optParams) : className) : '', {
|
|
780
|
+
'is--disabled': isGroupDisabled
|
|
781
|
+
}],
|
|
782
|
+
// attrs
|
|
783
|
+
optid: optid
|
|
784
|
+
}, [
|
|
785
|
+
h('div', {
|
|
786
|
+
class: 'vxe-optgroup--title'
|
|
787
|
+
}, optionSlot ? callSlot(optionSlot, optParams) : (defaultSlot ? callSlot(defaultSlot, optParams) : getFuncText(group[groupLabelField as 'label']))),
|
|
788
|
+
h('div', {
|
|
789
|
+
class: 'vxe-optgroup--wrapper'
|
|
790
|
+
}, renderOption(group[groupOptionsField as 'options'] || [], group))
|
|
791
|
+
])
|
|
792
|
+
})
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
const renderOpts = () => {
|
|
796
|
+
const { visibleGroupList, visibleOptionList, searchLoading } = reactData
|
|
797
|
+
const isGroup = computeIsGroup.value
|
|
798
|
+
if (searchLoading) {
|
|
799
|
+
return [
|
|
800
|
+
h('div', {
|
|
801
|
+
class: 'vxe-select--search-loading'
|
|
802
|
+
}, [
|
|
803
|
+
h('i', {
|
|
804
|
+
class: ['vxe-select--search-icon', iconConfigStore.SELECT_LOADED]
|
|
805
|
+
}),
|
|
806
|
+
h('span', {
|
|
807
|
+
class: 'vxe-select--search-text'
|
|
808
|
+
}, getI18n('vxe.select.loadingText'))
|
|
809
|
+
])
|
|
810
|
+
]
|
|
811
|
+
}
|
|
812
|
+
if (isGroup) {
|
|
813
|
+
if (visibleGroupList.length) {
|
|
814
|
+
return renderOptgroup()
|
|
815
|
+
}
|
|
816
|
+
} else {
|
|
817
|
+
if (visibleOptionList.length) {
|
|
818
|
+
return renderOption(visibleOptionList)
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
return [
|
|
822
|
+
h('div', {
|
|
823
|
+
class: 'vxe-select--empty-placeholder'
|
|
824
|
+
}, props.emptyText || getI18n('vxe.select.emptyText'))
|
|
825
|
+
]
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
selectMethods = {
|
|
829
|
+
dispatchEvent (type, params, evnt) {
|
|
830
|
+
emit(type, Object.assign({ $select: $xeselect, $event: evnt }, params))
|
|
831
|
+
},
|
|
832
|
+
isPanelVisible () {
|
|
833
|
+
return reactData.visiblePanel
|
|
834
|
+
},
|
|
835
|
+
togglePanel () {
|
|
836
|
+
if (reactData.visiblePanel) {
|
|
837
|
+
hideOptionPanel()
|
|
838
|
+
} else {
|
|
839
|
+
showOptionPanel()
|
|
840
|
+
}
|
|
841
|
+
return nextTick()
|
|
842
|
+
},
|
|
843
|
+
hidePanel () {
|
|
844
|
+
if (reactData.visiblePanel) {
|
|
845
|
+
hideOptionPanel()
|
|
846
|
+
}
|
|
847
|
+
return nextTick()
|
|
848
|
+
},
|
|
849
|
+
showPanel () {
|
|
850
|
+
if (!reactData.visiblePanel) {
|
|
851
|
+
showOptionPanel()
|
|
852
|
+
}
|
|
853
|
+
return nextTick()
|
|
854
|
+
},
|
|
855
|
+
refreshOption,
|
|
856
|
+
focus () {
|
|
857
|
+
const $input = refInput.value
|
|
858
|
+
reactData.isActivated = true
|
|
859
|
+
$input.blur()
|
|
860
|
+
return nextTick()
|
|
861
|
+
},
|
|
862
|
+
blur () {
|
|
863
|
+
const $input = refInput.value
|
|
864
|
+
$input.blur()
|
|
865
|
+
reactData.isActivated = false
|
|
866
|
+
return nextTick()
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
Object.assign($xeselect, selectMethods)
|
|
871
|
+
|
|
872
|
+
watch(() => reactData.staticOptions, (value) => {
|
|
873
|
+
if (value.some((item) => item.options && item.options.length)) {
|
|
874
|
+
reactData.fullOptionList = []
|
|
875
|
+
reactData.fullGroupList = value
|
|
876
|
+
} else {
|
|
877
|
+
reactData.fullGroupList = []
|
|
878
|
+
reactData.fullOptionList = value || []
|
|
879
|
+
}
|
|
880
|
+
cacheItemMap()
|
|
881
|
+
})
|
|
882
|
+
|
|
883
|
+
watch(() => props.options, (value) => {
|
|
884
|
+
reactData.fullGroupList = []
|
|
885
|
+
reactData.fullOptionList = value || []
|
|
886
|
+
cacheItemMap()
|
|
887
|
+
})
|
|
888
|
+
|
|
889
|
+
watch(() => props.optionGroups, (value) => {
|
|
890
|
+
reactData.fullOptionList = []
|
|
891
|
+
reactData.fullGroupList = value || []
|
|
892
|
+
cacheItemMap()
|
|
893
|
+
})
|
|
894
|
+
|
|
895
|
+
onMounted(() => {
|
|
896
|
+
nextTick(() => {
|
|
897
|
+
const { options, optionGroups } = props
|
|
898
|
+
if (optionGroups) {
|
|
899
|
+
reactData.fullGroupList = optionGroups
|
|
900
|
+
} else if (options) {
|
|
901
|
+
reactData.fullOptionList = options
|
|
902
|
+
}
|
|
903
|
+
cacheItemMap()
|
|
904
|
+
})
|
|
905
|
+
GlobalEvent.on($xeselect, 'mousewheel', handleGlobalMousewheelEvent)
|
|
906
|
+
GlobalEvent.on($xeselect, 'mousedown', handleGlobalMousedownEvent)
|
|
907
|
+
GlobalEvent.on($xeselect, 'keydown', handleGlobalKeydownEvent)
|
|
908
|
+
GlobalEvent.on($xeselect, 'blur', handleGlobalBlurEvent)
|
|
909
|
+
})
|
|
910
|
+
|
|
911
|
+
onUnmounted(() => {
|
|
912
|
+
GlobalEvent.off($xeselect, 'mousewheel')
|
|
913
|
+
GlobalEvent.off($xeselect, 'mousedown')
|
|
914
|
+
GlobalEvent.off($xeselect, 'keydown')
|
|
915
|
+
GlobalEvent.off($xeselect, 'blur')
|
|
916
|
+
})
|
|
917
|
+
|
|
918
|
+
const renderVN = () => {
|
|
919
|
+
const { className, popupClassName, transfer, disabled, loading, filterable } = props
|
|
920
|
+
const { inited, isActivated, visiblePanel } = reactData
|
|
921
|
+
const vSize = computeSize.value
|
|
922
|
+
const selectLabel = computeSelectLabel.value
|
|
923
|
+
const defaultSlot = slots.default
|
|
924
|
+
const headerSlot = slots.header
|
|
925
|
+
const footerSlot = slots.footer
|
|
926
|
+
const prefixSlot = slots.prefix
|
|
927
|
+
return h('div', {
|
|
928
|
+
ref: refElem,
|
|
929
|
+
class: ['vxe-select', className ? (XEUtils.isFunction(className) ? className({ $select: $xeselect }) : className) : '', {
|
|
930
|
+
[`size--${vSize}`]: vSize,
|
|
931
|
+
'is--visivle': visiblePanel,
|
|
932
|
+
'is--disabled': disabled,
|
|
933
|
+
'is--filter': filterable,
|
|
934
|
+
'is--loading': loading,
|
|
935
|
+
'is--active': isActivated
|
|
936
|
+
}]
|
|
937
|
+
}, [
|
|
938
|
+
h('div', {
|
|
939
|
+
class: 'vxe-select-slots',
|
|
940
|
+
ref: 'hideOption'
|
|
941
|
+
}, defaultSlot ? defaultSlot({}) : []),
|
|
942
|
+
h(VxeInputComponent, {
|
|
943
|
+
ref: refInput,
|
|
944
|
+
clearable: props.clearable,
|
|
945
|
+
placeholder: props.placeholder,
|
|
946
|
+
readonly: true,
|
|
947
|
+
disabled: disabled,
|
|
948
|
+
type: 'text',
|
|
949
|
+
prefixIcon: props.prefixIcon,
|
|
950
|
+
suffixIcon: loading ? iconConfigStore.SELECT_LOADED : (visiblePanel ? iconConfigStore.SELECT_OPEN : iconConfigStore.SELECT_CLOSE),
|
|
951
|
+
modelValue: selectLabel,
|
|
952
|
+
onClear: clearEvent,
|
|
953
|
+
onClick: togglePanelEvent,
|
|
954
|
+
onFocus: focusEvent,
|
|
955
|
+
onBlur: blurEvent,
|
|
956
|
+
onSuffixClick: togglePanelEvent
|
|
957
|
+
}, prefixSlot
|
|
958
|
+
? {
|
|
959
|
+
prefix: () => prefixSlot({})
|
|
960
|
+
}
|
|
961
|
+
: {}),
|
|
962
|
+
h(Teleport, {
|
|
963
|
+
to: 'body',
|
|
964
|
+
disabled: transfer ? !inited : true
|
|
965
|
+
}, [
|
|
966
|
+
h('div', {
|
|
967
|
+
ref: refOptionPanel,
|
|
968
|
+
class: ['vxe-table--ignore-clear vxe-select--panel', popupClassName ? (XEUtils.isFunction(popupClassName) ? popupClassName({ $select: $xeselect }) : popupClassName) : '', {
|
|
969
|
+
[`size--${vSize}`]: vSize,
|
|
970
|
+
'is--transfer': transfer,
|
|
971
|
+
'animat--leave': !loading && reactData.animatVisible,
|
|
972
|
+
'animat--enter': !loading && visiblePanel
|
|
973
|
+
}],
|
|
974
|
+
placement: reactData.panelPlacement,
|
|
975
|
+
style: reactData.panelStyle
|
|
976
|
+
}, inited
|
|
977
|
+
? [
|
|
978
|
+
filterable
|
|
979
|
+
? h('div', {
|
|
980
|
+
class: 'vxe-select--panel-search'
|
|
981
|
+
}, [
|
|
982
|
+
h(VxeInputComponent, {
|
|
983
|
+
ref: refInpSearch,
|
|
984
|
+
class: 'vxe-select-search--input',
|
|
985
|
+
modelValue: reactData.searchValue,
|
|
986
|
+
clearable: true,
|
|
987
|
+
placeholder: getI18n('vxe.select.search'),
|
|
988
|
+
prefixIcon: iconConfigStore.INPUT_SEARCH,
|
|
989
|
+
'onUpdate:modelValue': modelSearchEvent,
|
|
990
|
+
onFocus: focusSearchEvent,
|
|
991
|
+
onKeydown: keydownSearchEvent,
|
|
992
|
+
onChange: triggerSearchEvent,
|
|
993
|
+
onSearch: triggerSearchEvent
|
|
994
|
+
})
|
|
995
|
+
])
|
|
996
|
+
: createCommentVNode(),
|
|
997
|
+
h('div', {
|
|
998
|
+
class: 'vxe-select--panel-wrapper'
|
|
999
|
+
}, [
|
|
1000
|
+
headerSlot
|
|
1001
|
+
? h('div', {
|
|
1002
|
+
class: 'vxe-select--panel-header'
|
|
1003
|
+
}, headerSlot({}))
|
|
1004
|
+
: createCommentVNode(),
|
|
1005
|
+
h('div', {
|
|
1006
|
+
class: 'vxe-select--panel-body'
|
|
1007
|
+
}, [
|
|
1008
|
+
h('div', {
|
|
1009
|
+
ref: refOptionWrapper,
|
|
1010
|
+
class: 'vxe-select-option--wrapper'
|
|
1011
|
+
}, renderOpts())
|
|
1012
|
+
]),
|
|
1013
|
+
footerSlot
|
|
1014
|
+
? h('div', {
|
|
1015
|
+
class: 'vxe-select--panel-footer'
|
|
1016
|
+
}, footerSlot({}))
|
|
1017
|
+
: createCommentVNode()
|
|
1018
|
+
])
|
|
1019
|
+
]
|
|
1020
|
+
: [])
|
|
1021
|
+
])
|
|
1022
|
+
])
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
$xeselect.renderVN = renderVN
|
|
1026
|
+
|
|
1027
|
+
provide('$xeselect', $xeselect)
|
|
1028
|
+
|
|
1029
|
+
return $xeselect
|
|
1030
|
+
},
|
|
1031
|
+
render () {
|
|
1032
|
+
return this.renderVN()
|
|
1033
|
+
}
|
|
1034
|
+
})
|