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,950 @@
|
|
|
1
|
+
import { defineComponent, h, Teleport, ref, Ref, computed, reactive, nextTick, watch, PropType, VNode, onMounted, onUnmounted } from 'vue'
|
|
2
|
+
import XEUtils from 'xe-utils'
|
|
3
|
+
import { useSize } from '../../hooks/size'
|
|
4
|
+
import { getDomNode, getEventTargetNode } from '../../ui/src/dom'
|
|
5
|
+
import { getLastZIndex, nextZIndex, getFuncText } from '../../ui/src/utils'
|
|
6
|
+
import { errLog } from '../../ui/src/log'
|
|
7
|
+
import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../ui/src/event'
|
|
8
|
+
import globalConfigStore from '../../ui/src/globalStore'
|
|
9
|
+
import iconConfigStore from '../../ui/src/iconStore'
|
|
10
|
+
import VxeButtonConstructor from '../../button/src/button'
|
|
11
|
+
import VxeLoading from '../../loading/index'
|
|
12
|
+
import { getSlotVNs } from '../../ui/src/vn'
|
|
13
|
+
import { getI18n } from '../../ui/src/i18n'
|
|
14
|
+
|
|
15
|
+
import { VxeModalConstructor, VxeModalPropTypes, ModalReactData, VxeModalEmits, ModalEventTypes, VxeButtonInstance, ModalMethods, ModalPrivateRef, VxeModalMethods } from '../../../types'
|
|
16
|
+
|
|
17
|
+
export const allActivedModals: VxeModalConstructor[] = []
|
|
18
|
+
export const msgQueue: VxeModalConstructor[] = []
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: 'VxeModal',
|
|
22
|
+
props: {
|
|
23
|
+
modelValue: Boolean as PropType<VxeModalPropTypes.ModelValue>,
|
|
24
|
+
id: String as PropType<VxeModalPropTypes.ID>,
|
|
25
|
+
type: { type: String as PropType<VxeModalPropTypes.Type>, default: 'modal' },
|
|
26
|
+
loading: { type: Boolean as PropType<VxeModalPropTypes.Loading>, default: null },
|
|
27
|
+
status: String as PropType<VxeModalPropTypes.Status>,
|
|
28
|
+
iconStatus: String as PropType<VxeModalPropTypes.IconStatus>,
|
|
29
|
+
className: String as PropType<VxeModalPropTypes.ClassName>,
|
|
30
|
+
top: { type: [Number, String] as PropType<VxeModalPropTypes.Top>, default: () => globalConfigStore.modal.top },
|
|
31
|
+
position: [String, Object] as PropType<VxeModalPropTypes.Position>,
|
|
32
|
+
title: String as PropType<VxeModalPropTypes.Title>,
|
|
33
|
+
duration: { type: [Number, String] as PropType<VxeModalPropTypes.Duration>, default: () => globalConfigStore.modal.duration },
|
|
34
|
+
message: [Number, String] as PropType<VxeModalPropTypes.Message>,
|
|
35
|
+
content: [Number, String] as PropType<VxeModalPropTypes.Content>,
|
|
36
|
+
cancelButtonText: { type: String as PropType<VxeModalPropTypes.CancelButtonText>, default: () => globalConfigStore.modal.cancelButtonText },
|
|
37
|
+
confirmButtonText: { type: String as PropType<VxeModalPropTypes.ConfirmButtonText>, default: () => globalConfigStore.modal.confirmButtonText },
|
|
38
|
+
lockView: { type: Boolean as PropType<VxeModalPropTypes.LockView>, default: () => globalConfigStore.modal.lockView },
|
|
39
|
+
lockScroll: Boolean as PropType<VxeModalPropTypes.LockScroll>,
|
|
40
|
+
mask: { type: Boolean as PropType<VxeModalPropTypes.Mask>, default: () => globalConfigStore.modal.mask },
|
|
41
|
+
maskClosable: { type: Boolean as PropType<VxeModalPropTypes.MaskClosable>, default: () => globalConfigStore.modal.maskClosable },
|
|
42
|
+
escClosable: { type: Boolean as PropType<VxeModalPropTypes.EscClosable>, default: () => globalConfigStore.modal.escClosable },
|
|
43
|
+
resize: Boolean as PropType<VxeModalPropTypes.Resize>,
|
|
44
|
+
showHeader: { type: Boolean as PropType<VxeModalPropTypes.ShowHeader>, default: () => globalConfigStore.modal.showHeader },
|
|
45
|
+
showFooter: { type: Boolean as PropType<VxeModalPropTypes.ShowFooter>, default: () => globalConfigStore.modal.showFooter },
|
|
46
|
+
showZoom: Boolean as PropType<VxeModalPropTypes.ShowZoom>,
|
|
47
|
+
showClose: { type: Boolean as PropType<VxeModalPropTypes.ShowClose>, default: () => globalConfigStore.modal.showClose },
|
|
48
|
+
dblclickZoom: { type: Boolean as PropType<VxeModalPropTypes.DblclickZoom>, default: () => globalConfigStore.modal.dblclickZoom },
|
|
49
|
+
width: [Number, String] as PropType<VxeModalPropTypes.Width>,
|
|
50
|
+
height: [Number, String] as PropType<VxeModalPropTypes.Height>,
|
|
51
|
+
minWidth: { type: [Number, String] as PropType<VxeModalPropTypes.MinWidth>, default: () => globalConfigStore.modal.minWidth },
|
|
52
|
+
minHeight: { type: [Number, String] as PropType<VxeModalPropTypes.MinHeight>, default: () => globalConfigStore.modal.minHeight },
|
|
53
|
+
zIndex: Number as PropType<VxeModalPropTypes.ZIndex>,
|
|
54
|
+
marginSize: { type: [Number, String] as PropType<VxeModalPropTypes.MarginSize>, default: () => globalConfigStore.modal.marginSize },
|
|
55
|
+
fullscreen: Boolean as PropType<VxeModalPropTypes.Fullscreen>,
|
|
56
|
+
draggable: { type: Boolean as PropType<VxeModalPropTypes.Draggable>, default: () => globalConfigStore.modal.draggable },
|
|
57
|
+
remember: { type: Boolean, default: () => globalConfigStore.modal.remember },
|
|
58
|
+
destroyOnClose: { type: Boolean as PropType<VxeModalPropTypes.DestroyOnClose>, default: () => globalConfigStore.modal.destroyOnClose },
|
|
59
|
+
showTitleOverflow: { type: Boolean as PropType<VxeModalPropTypes.ShowTitleOverflow>, default: () => globalConfigStore.modal.showTitleOverflow },
|
|
60
|
+
transfer: { type: Boolean as PropType<VxeModalPropTypes.Transfer>, default: () => globalConfigStore.modal.transfer },
|
|
61
|
+
storage: { type: Boolean as PropType<VxeModalPropTypes.Storage>, default: () => globalConfigStore.modal.storage },
|
|
62
|
+
storageKey: { type: String as PropType<VxeModalPropTypes.StorageKey>, default: () => globalConfigStore.modal.storageKey },
|
|
63
|
+
animat: { type: Boolean as PropType<VxeModalPropTypes.Animat>, default: () => globalConfigStore.modal.animat },
|
|
64
|
+
size: { type: String as PropType<VxeModalPropTypes.Size>, default: () => globalConfigStore.modal.size || globalConfigStore.size },
|
|
65
|
+
beforeHideMethod: { type: Function as PropType<VxeModalPropTypes.BeforeHideMethod>, default: () => globalConfigStore.modal.beforeHideMethod },
|
|
66
|
+
slots: Object as PropType<VxeModalPropTypes.Slots>
|
|
67
|
+
},
|
|
68
|
+
emits: [
|
|
69
|
+
'update:modelValue',
|
|
70
|
+
'show',
|
|
71
|
+
'hide',
|
|
72
|
+
'before-hide',
|
|
73
|
+
'close',
|
|
74
|
+
'confirm',
|
|
75
|
+
'cancel',
|
|
76
|
+
'zoom'
|
|
77
|
+
] as VxeModalEmits,
|
|
78
|
+
setup (props, context) {
|
|
79
|
+
const { slots, emit } = context
|
|
80
|
+
|
|
81
|
+
const xID = XEUtils.uniqueId()
|
|
82
|
+
|
|
83
|
+
const computeSize = useSize(props)
|
|
84
|
+
|
|
85
|
+
const reactData = reactive<ModalReactData>({
|
|
86
|
+
inited: false,
|
|
87
|
+
visible: false,
|
|
88
|
+
contentVisible: false,
|
|
89
|
+
modalTop: 0,
|
|
90
|
+
modalZindex: 0,
|
|
91
|
+
zoomLocat: null,
|
|
92
|
+
firstOpen: true
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
const refElem = ref() as Ref<HTMLDivElement>
|
|
96
|
+
const refModalBox = ref() as Ref<HTMLDivElement>
|
|
97
|
+
const refConfirmBtn = ref() as Ref<VxeButtonInstance>
|
|
98
|
+
const refCancelBtn = ref() as Ref<VxeButtonInstance>
|
|
99
|
+
|
|
100
|
+
const refMaps: ModalPrivateRef = {
|
|
101
|
+
refElem
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const $xemodal = {
|
|
105
|
+
xID,
|
|
106
|
+
props,
|
|
107
|
+
context,
|
|
108
|
+
reactData,
|
|
109
|
+
getRefMaps: () => refMaps
|
|
110
|
+
} as unknown as VxeModalConstructor & VxeModalMethods
|
|
111
|
+
|
|
112
|
+
let modalMethods = {} as ModalMethods
|
|
113
|
+
|
|
114
|
+
const computeIsMsg = computed(() => {
|
|
115
|
+
return props.type === 'message'
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
const getBox = () => {
|
|
119
|
+
const boxElem = refModalBox.value
|
|
120
|
+
return boxElem
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const recalculate = () => {
|
|
124
|
+
const { width, height } = props
|
|
125
|
+
const boxElem = getBox()
|
|
126
|
+
boxElem.style.width = `${width ? (isNaN(width as number) ? width : `${width}px`) : ''}`
|
|
127
|
+
boxElem.style.height = `${height ? (isNaN(height as number) ? height : `${height}px`) : ''}`
|
|
128
|
+
return nextTick()
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const updateZindex = () => {
|
|
132
|
+
const { zIndex } = props
|
|
133
|
+
const { modalZindex } = reactData
|
|
134
|
+
if (zIndex) {
|
|
135
|
+
reactData.modalZindex = zIndex
|
|
136
|
+
} else if (modalZindex < getLastZIndex()) {
|
|
137
|
+
reactData.modalZindex = nextZIndex()
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const updatePosition = () => {
|
|
142
|
+
return nextTick().then(() => {
|
|
143
|
+
const { position } = props
|
|
144
|
+
const marginSize = XEUtils.toNumber(props.marginSize)
|
|
145
|
+
const boxElem = getBox()
|
|
146
|
+
const clientVisibleWidth = document.documentElement.clientWidth || document.body.clientWidth
|
|
147
|
+
const clientVisibleHeight = document.documentElement.clientHeight || document.body.clientHeight
|
|
148
|
+
const isPosCenter = position === 'center'
|
|
149
|
+
const { top, left }: any = XEUtils.isString(position) ? { top: position, left: position } : Object.assign({}, position)
|
|
150
|
+
const topCenter = isPosCenter || top === 'center'
|
|
151
|
+
const leftCenter = isPosCenter || left === 'center'
|
|
152
|
+
let posTop = ''
|
|
153
|
+
let posLeft = ''
|
|
154
|
+
if (left && !leftCenter) {
|
|
155
|
+
posLeft = isNaN(left) ? left : `${left}px`
|
|
156
|
+
} else {
|
|
157
|
+
posLeft = `${Math.max(marginSize, clientVisibleWidth / 2 - boxElem.offsetWidth / 2)}px`
|
|
158
|
+
}
|
|
159
|
+
if (top && !topCenter) {
|
|
160
|
+
posTop = isNaN(top) ? top : `${top}px`
|
|
161
|
+
} else {
|
|
162
|
+
posTop = `${Math.max(marginSize, clientVisibleHeight / 2 - boxElem.offsetHeight / 2)}px`
|
|
163
|
+
}
|
|
164
|
+
boxElem.style.top = posTop
|
|
165
|
+
boxElem.style.left = posLeft
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const updateStyle = () => {
|
|
170
|
+
nextTick(() => {
|
|
171
|
+
let offsetTop = 0
|
|
172
|
+
msgQueue.forEach(comp => {
|
|
173
|
+
const boxElem = comp.getBox()
|
|
174
|
+
offsetTop += XEUtils.toNumber(comp.props.top)
|
|
175
|
+
comp.reactData.modalTop = offsetTop
|
|
176
|
+
offsetTop += boxElem.clientHeight
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const removeMsgQueue = () => {
|
|
182
|
+
if (msgQueue.indexOf($xemodal) > -1) {
|
|
183
|
+
XEUtils.remove(msgQueue, comp => comp === $xemodal)
|
|
184
|
+
}
|
|
185
|
+
updateStyle()
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const closeModal = (type: ModalEventTypes) => {
|
|
189
|
+
const { remember, beforeHideMethod } = props
|
|
190
|
+
const { visible } = reactData
|
|
191
|
+
const isMsg = computeIsMsg.value
|
|
192
|
+
const params = { type }
|
|
193
|
+
if (visible) {
|
|
194
|
+
Promise.resolve(beforeHideMethod ? beforeHideMethod(params) : null).then((rest) => {
|
|
195
|
+
if (!XEUtils.isError(rest)) {
|
|
196
|
+
if (isMsg) {
|
|
197
|
+
removeMsgQueue()
|
|
198
|
+
}
|
|
199
|
+
reactData.contentVisible = false
|
|
200
|
+
if (!remember) {
|
|
201
|
+
reactData.zoomLocat = null
|
|
202
|
+
}
|
|
203
|
+
XEUtils.remove(allActivedModals, item => item === $xemodal)
|
|
204
|
+
modalMethods.dispatchEvent('before-hide', params)
|
|
205
|
+
setTimeout(() => {
|
|
206
|
+
reactData.visible = false
|
|
207
|
+
emit('update:modelValue', false)
|
|
208
|
+
modalMethods.dispatchEvent('hide', params)
|
|
209
|
+
}, 200)
|
|
210
|
+
}
|
|
211
|
+
}).catch(e => e)
|
|
212
|
+
}
|
|
213
|
+
return nextTick()
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const closeEvent = (evnt: Event) => {
|
|
217
|
+
const type = 'close'
|
|
218
|
+
modalMethods.dispatchEvent(type, { type }, evnt)
|
|
219
|
+
closeModal(type)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const confirmEvent = (evnt: Event) => {
|
|
223
|
+
const type = 'confirm'
|
|
224
|
+
modalMethods.dispatchEvent(type, { type }, evnt)
|
|
225
|
+
closeModal(type)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const cancelEvent = (evnt: Event) => {
|
|
229
|
+
const type = 'cancel'
|
|
230
|
+
modalMethods.dispatchEvent(type, { type }, evnt)
|
|
231
|
+
closeModal(type)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const getStorageMap = (key: string) => {
|
|
235
|
+
const version = globalConfigStore.version
|
|
236
|
+
const rest = XEUtils.toStringJSON(localStorage.getItem(key) || '')
|
|
237
|
+
return rest && rest._v === version ? rest : { _v: version }
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const hasPosStorage = () => {
|
|
241
|
+
const { id, remember, storage, storageKey } = props
|
|
242
|
+
return !!(id && remember && storage && getStorageMap(storageKey)[id])
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const restorePosStorage = () => {
|
|
246
|
+
const { id, remember, storage, storageKey } = props
|
|
247
|
+
if (id && remember && storage) {
|
|
248
|
+
const posStorage = getStorageMap(storageKey)[id]
|
|
249
|
+
if (posStorage) {
|
|
250
|
+
const boxElem = getBox()
|
|
251
|
+
const [left, top, width, height, zoomLeft, zoomTop, zoomWidth, zoomHeight] = posStorage.split(',')
|
|
252
|
+
if (left) {
|
|
253
|
+
boxElem.style.left = `${left}px`
|
|
254
|
+
}
|
|
255
|
+
if (top) {
|
|
256
|
+
boxElem.style.top = `${top}px`
|
|
257
|
+
}
|
|
258
|
+
if (width) {
|
|
259
|
+
boxElem.style.width = `${width}px`
|
|
260
|
+
}
|
|
261
|
+
if (height) {
|
|
262
|
+
boxElem.style.height = `${height}px`
|
|
263
|
+
}
|
|
264
|
+
if (zoomLeft && zoomTop) {
|
|
265
|
+
reactData.zoomLocat = {
|
|
266
|
+
left: zoomLeft,
|
|
267
|
+
top: zoomTop,
|
|
268
|
+
width: zoomWidth,
|
|
269
|
+
height: zoomHeight
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const addMsgQueue = () => {
|
|
277
|
+
if (msgQueue.indexOf($xemodal) === -1) {
|
|
278
|
+
msgQueue.push($xemodal)
|
|
279
|
+
}
|
|
280
|
+
updateStyle()
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const savePosStorage = () => {
|
|
284
|
+
const { id, remember, storage, storageKey } = props
|
|
285
|
+
const { zoomLocat } = reactData
|
|
286
|
+
if (id && remember && storage) {
|
|
287
|
+
const boxElem = getBox()
|
|
288
|
+
const posStorageMap = getStorageMap(storageKey)
|
|
289
|
+
posStorageMap[id] = ([
|
|
290
|
+
boxElem.style.left,
|
|
291
|
+
boxElem.style.top,
|
|
292
|
+
boxElem.style.width,
|
|
293
|
+
boxElem.style.height
|
|
294
|
+
] as (string | number)[]).concat(zoomLocat
|
|
295
|
+
? [
|
|
296
|
+
zoomLocat.left,
|
|
297
|
+
zoomLocat.top,
|
|
298
|
+
zoomLocat.width,
|
|
299
|
+
zoomLocat.height
|
|
300
|
+
]
|
|
301
|
+
: []).map(val => val ? XEUtils.toNumber(val) : '').join(',')
|
|
302
|
+
localStorage.setItem(storageKey, XEUtils.toJSONString(posStorageMap))
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const maximize = () => {
|
|
307
|
+
return nextTick().then(() => {
|
|
308
|
+
if (!reactData.zoomLocat) {
|
|
309
|
+
const marginSize = Math.max(0, XEUtils.toNumber(props.marginSize))
|
|
310
|
+
const boxElem = getBox()
|
|
311
|
+
const { visibleHeight, visibleWidth } = getDomNode()
|
|
312
|
+
reactData.zoomLocat = {
|
|
313
|
+
top: boxElem.offsetTop,
|
|
314
|
+
left: boxElem.offsetLeft,
|
|
315
|
+
width: boxElem.offsetWidth + (boxElem.style.width ? 0 : 1),
|
|
316
|
+
height: boxElem.offsetHeight + (boxElem.style.height ? 0 : 1)
|
|
317
|
+
}
|
|
318
|
+
Object.assign(boxElem.style, {
|
|
319
|
+
top: `${marginSize}px`,
|
|
320
|
+
left: `${marginSize}px`,
|
|
321
|
+
width: `${visibleWidth - marginSize * 2}px`,
|
|
322
|
+
height: `${visibleHeight - marginSize * 2}px`
|
|
323
|
+
})
|
|
324
|
+
savePosStorage()
|
|
325
|
+
}
|
|
326
|
+
})
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const openModal = () => {
|
|
330
|
+
const { duration, remember, showFooter } = props
|
|
331
|
+
const { inited, visible } = reactData
|
|
332
|
+
const isMsg = computeIsMsg.value
|
|
333
|
+
if (!inited) {
|
|
334
|
+
reactData.inited = true
|
|
335
|
+
}
|
|
336
|
+
if (!visible) {
|
|
337
|
+
if (!remember) {
|
|
338
|
+
recalculate()
|
|
339
|
+
}
|
|
340
|
+
reactData.visible = true
|
|
341
|
+
reactData.contentVisible = false
|
|
342
|
+
updateZindex()
|
|
343
|
+
allActivedModals.push($xemodal)
|
|
344
|
+
setTimeout(() => {
|
|
345
|
+
reactData.contentVisible = true
|
|
346
|
+
nextTick(() => {
|
|
347
|
+
if (showFooter) {
|
|
348
|
+
const confirmBtn = refConfirmBtn.value
|
|
349
|
+
const cancelBtn = refCancelBtn.value
|
|
350
|
+
const operBtn = confirmBtn || cancelBtn
|
|
351
|
+
if (operBtn) {
|
|
352
|
+
operBtn.focus()
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
const type = ''
|
|
356
|
+
const params = { type }
|
|
357
|
+
emit('update:modelValue', true)
|
|
358
|
+
modalMethods.dispatchEvent('show', params)
|
|
359
|
+
})
|
|
360
|
+
}, 10)
|
|
361
|
+
if (isMsg) {
|
|
362
|
+
addMsgQueue()
|
|
363
|
+
if (duration !== -1) {
|
|
364
|
+
setTimeout(() => closeModal('close'), XEUtils.toNumber(duration))
|
|
365
|
+
}
|
|
366
|
+
} else {
|
|
367
|
+
nextTick(() => {
|
|
368
|
+
const { fullscreen } = props
|
|
369
|
+
const { firstOpen } = reactData
|
|
370
|
+
if (!remember || firstOpen) {
|
|
371
|
+
updatePosition().then(() => {
|
|
372
|
+
setTimeout(() => updatePosition(), 20)
|
|
373
|
+
})
|
|
374
|
+
}
|
|
375
|
+
if (firstOpen) {
|
|
376
|
+
reactData.firstOpen = false
|
|
377
|
+
if (hasPosStorage()) {
|
|
378
|
+
restorePosStorage()
|
|
379
|
+
} else if (fullscreen) {
|
|
380
|
+
nextTick(() => maximize())
|
|
381
|
+
}
|
|
382
|
+
} else {
|
|
383
|
+
if (fullscreen) {
|
|
384
|
+
nextTick(() => maximize())
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
})
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return nextTick()
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const selfClickEvent = (evnt: Event) => {
|
|
394
|
+
const el = refElem.value
|
|
395
|
+
if (props.maskClosable && evnt.target === el) {
|
|
396
|
+
const type = 'mask'
|
|
397
|
+
closeModal(type)
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
const handleGlobalKeydownEvent = (evnt: KeyboardEvent) => {
|
|
402
|
+
const isEsc = hasEventKey(evnt, EVENT_KEYS.ESCAPE)
|
|
403
|
+
if (isEsc) {
|
|
404
|
+
const lastModal = XEUtils.max(allActivedModals, (item) => item.reactData.modalZindex)
|
|
405
|
+
// 多个时,只关掉最上层的窗口
|
|
406
|
+
if (lastModal) {
|
|
407
|
+
setTimeout(() => {
|
|
408
|
+
if (lastModal === $xemodal && (lastModal as VxeModalConstructor).props.escClosable) {
|
|
409
|
+
closeModal('exit')
|
|
410
|
+
}
|
|
411
|
+
}, 10)
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const isMaximized = () => {
|
|
417
|
+
return !!reactData.zoomLocat
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const revert = () => {
|
|
421
|
+
return nextTick().then(() => {
|
|
422
|
+
const { zoomLocat } = reactData
|
|
423
|
+
if (zoomLocat) {
|
|
424
|
+
const boxElem = getBox()
|
|
425
|
+
reactData.zoomLocat = null
|
|
426
|
+
Object.assign(boxElem.style, {
|
|
427
|
+
top: `${zoomLocat.top}px`,
|
|
428
|
+
left: `${zoomLocat.left}px`,
|
|
429
|
+
width: `${zoomLocat.width}px`,
|
|
430
|
+
height: `${zoomLocat.height}px`
|
|
431
|
+
})
|
|
432
|
+
savePosStorage()
|
|
433
|
+
}
|
|
434
|
+
})
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
const zoom = () => {
|
|
438
|
+
if (reactData.zoomLocat) {
|
|
439
|
+
return revert().then(() => isMaximized())
|
|
440
|
+
}
|
|
441
|
+
return maximize().then(() => isMaximized())
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const toggleZoomEvent = (evnt: Event) => {
|
|
445
|
+
const { zoomLocat } = reactData
|
|
446
|
+
const params = { type: zoomLocat ? 'revert' : 'max' }
|
|
447
|
+
return zoom().then(() => {
|
|
448
|
+
modalMethods.dispatchEvent('zoom', params, evnt)
|
|
449
|
+
})
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const getPosition = () => {
|
|
453
|
+
const isMsg = computeIsMsg.value
|
|
454
|
+
if (!isMsg) {
|
|
455
|
+
const boxElem = getBox()
|
|
456
|
+
if (boxElem) {
|
|
457
|
+
return {
|
|
458
|
+
top: boxElem.offsetTop,
|
|
459
|
+
left: boxElem.offsetLeft
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return null
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
const setPosition = (top?: number, left?: number) => {
|
|
467
|
+
const isMsg = computeIsMsg.value
|
|
468
|
+
if (!isMsg) {
|
|
469
|
+
const boxElem = getBox()
|
|
470
|
+
if (XEUtils.isNumber(top)) {
|
|
471
|
+
boxElem.style.top = `${top}px`
|
|
472
|
+
}
|
|
473
|
+
if (XEUtils.isNumber(left)) {
|
|
474
|
+
boxElem.style.left = `${left}px`
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return nextTick()
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
const boxMousedownEvent = () => {
|
|
481
|
+
const { modalZindex } = reactData
|
|
482
|
+
if (allActivedModals.some(comp => comp.reactData.visible && comp.reactData.modalZindex > modalZindex)) {
|
|
483
|
+
updateZindex()
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const mousedownEvent = (evnt: MouseEvent) => {
|
|
488
|
+
const { remember, storage } = props
|
|
489
|
+
const { zoomLocat } = reactData
|
|
490
|
+
const marginSize = XEUtils.toNumber(props.marginSize)
|
|
491
|
+
const boxElem = getBox()
|
|
492
|
+
if (!zoomLocat && evnt.button === 0 && !getEventTargetNode(evnt, boxElem, 'trigger--btn').flag) {
|
|
493
|
+
evnt.preventDefault()
|
|
494
|
+
const domMousemove = document.onmousemove
|
|
495
|
+
const domMouseup = document.onmouseup
|
|
496
|
+
const disX = evnt.clientX - boxElem.offsetLeft
|
|
497
|
+
const disY = evnt.clientY - boxElem.offsetTop
|
|
498
|
+
const { visibleHeight, visibleWidth } = getDomNode()
|
|
499
|
+
document.onmousemove = evnt => {
|
|
500
|
+
evnt.preventDefault()
|
|
501
|
+
const offsetWidth = boxElem.offsetWidth
|
|
502
|
+
const offsetHeight = boxElem.offsetHeight
|
|
503
|
+
const minX = marginSize
|
|
504
|
+
const maxX = visibleWidth - offsetWidth - marginSize - 1
|
|
505
|
+
const minY = marginSize
|
|
506
|
+
const maxY = visibleHeight - offsetHeight - marginSize - 1
|
|
507
|
+
let left = evnt.clientX - disX
|
|
508
|
+
let top = evnt.clientY - disY
|
|
509
|
+
if (left > maxX) {
|
|
510
|
+
left = maxX
|
|
511
|
+
}
|
|
512
|
+
if (left < minX) {
|
|
513
|
+
left = minX
|
|
514
|
+
}
|
|
515
|
+
if (top > maxY) {
|
|
516
|
+
top = maxY
|
|
517
|
+
}
|
|
518
|
+
if (top < minY) {
|
|
519
|
+
top = minY
|
|
520
|
+
}
|
|
521
|
+
boxElem.style.left = `${left}px`
|
|
522
|
+
boxElem.style.top = `${top}px`
|
|
523
|
+
boxElem.className = boxElem.className.replace(/\s?is--drag/, '') + ' is--drag'
|
|
524
|
+
}
|
|
525
|
+
document.onmouseup = () => {
|
|
526
|
+
document.onmousemove = domMousemove
|
|
527
|
+
document.onmouseup = domMouseup
|
|
528
|
+
if (remember && storage) {
|
|
529
|
+
nextTick(() => {
|
|
530
|
+
savePosStorage()
|
|
531
|
+
})
|
|
532
|
+
}
|
|
533
|
+
setTimeout(() => {
|
|
534
|
+
boxElem.className = boxElem.className.replace(/\s?is--drag/, '')
|
|
535
|
+
}, 50)
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
const dragEvent = (evnt: MouseEvent) => {
|
|
541
|
+
evnt.preventDefault()
|
|
542
|
+
const { remember, storage } = props
|
|
543
|
+
const { visibleHeight, visibleWidth } = getDomNode()
|
|
544
|
+
const marginSize = XEUtils.toNumber(props.marginSize)
|
|
545
|
+
const targetElem = evnt.target as HTMLSpanElement
|
|
546
|
+
const type = targetElem.getAttribute('type')
|
|
547
|
+
const minWidth = XEUtils.toNumber(props.minWidth)
|
|
548
|
+
const minHeight = XEUtils.toNumber(props.minHeight)
|
|
549
|
+
const maxWidth = visibleWidth
|
|
550
|
+
const maxHeight = visibleHeight
|
|
551
|
+
const boxElem = getBox()
|
|
552
|
+
const domMousemove = document.onmousemove
|
|
553
|
+
const domMouseup = document.onmouseup
|
|
554
|
+
const clientWidth = boxElem.clientWidth
|
|
555
|
+
const clientHeight = boxElem.clientHeight
|
|
556
|
+
const disX = evnt.clientX
|
|
557
|
+
const disY = evnt.clientY
|
|
558
|
+
const offsetTop = boxElem.offsetTop
|
|
559
|
+
const offsetLeft = boxElem.offsetLeft
|
|
560
|
+
const params = { type: 'resize' }
|
|
561
|
+
document.onmousemove = evnt => {
|
|
562
|
+
evnt.preventDefault()
|
|
563
|
+
let dragLeft
|
|
564
|
+
let dragTop
|
|
565
|
+
let width
|
|
566
|
+
let height
|
|
567
|
+
switch (type) {
|
|
568
|
+
case 'wl':
|
|
569
|
+
dragLeft = disX - evnt.clientX
|
|
570
|
+
width = dragLeft + clientWidth
|
|
571
|
+
if (offsetLeft - dragLeft > marginSize) {
|
|
572
|
+
if (width > minWidth) {
|
|
573
|
+
boxElem.style.width = `${width < maxWidth ? width : maxWidth}px`
|
|
574
|
+
boxElem.style.left = `${offsetLeft - dragLeft}px`
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
break
|
|
578
|
+
case 'swst':
|
|
579
|
+
dragLeft = disX - evnt.clientX
|
|
580
|
+
dragTop = disY - evnt.clientY
|
|
581
|
+
width = dragLeft + clientWidth
|
|
582
|
+
height = dragTop + clientHeight
|
|
583
|
+
if (offsetLeft - dragLeft > marginSize) {
|
|
584
|
+
if (width > minWidth) {
|
|
585
|
+
boxElem.style.width = `${width < maxWidth ? width : maxWidth}px`
|
|
586
|
+
boxElem.style.left = `${offsetLeft - dragLeft}px`
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
if (offsetTop - dragTop > marginSize) {
|
|
590
|
+
if (height > minHeight) {
|
|
591
|
+
boxElem.style.height = `${height < maxHeight ? height : maxHeight}px`
|
|
592
|
+
boxElem.style.top = `${offsetTop - dragTop}px`
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
break
|
|
596
|
+
case 'swlb':
|
|
597
|
+
dragLeft = disX - evnt.clientX
|
|
598
|
+
dragTop = evnt.clientY - disY
|
|
599
|
+
width = dragLeft + clientWidth
|
|
600
|
+
height = dragTop + clientHeight
|
|
601
|
+
if (offsetLeft - dragLeft > marginSize) {
|
|
602
|
+
if (width > minWidth) {
|
|
603
|
+
boxElem.style.width = `${width < maxWidth ? width : maxWidth}px`
|
|
604
|
+
boxElem.style.left = `${offsetLeft - dragLeft}px`
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
if (offsetTop + height + marginSize < visibleHeight) {
|
|
608
|
+
if (height > minHeight) {
|
|
609
|
+
boxElem.style.height = `${height < maxHeight ? height : maxHeight}px`
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
break
|
|
613
|
+
case 'st':
|
|
614
|
+
dragTop = disY - evnt.clientY
|
|
615
|
+
height = clientHeight + dragTop
|
|
616
|
+
if (offsetTop - dragTop > marginSize) {
|
|
617
|
+
if (height > minHeight) {
|
|
618
|
+
boxElem.style.height = `${height < maxHeight ? height : maxHeight}px`
|
|
619
|
+
boxElem.style.top = `${offsetTop - dragTop}px`
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
break
|
|
623
|
+
case 'wr':
|
|
624
|
+
dragLeft = evnt.clientX - disX
|
|
625
|
+
width = dragLeft + clientWidth
|
|
626
|
+
if (offsetLeft + width + marginSize < visibleWidth) {
|
|
627
|
+
if (width > minWidth) {
|
|
628
|
+
boxElem.style.width = `${width < maxWidth ? width : maxWidth}px`
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
break
|
|
632
|
+
case 'sest':
|
|
633
|
+
dragLeft = evnt.clientX - disX
|
|
634
|
+
dragTop = disY - evnt.clientY
|
|
635
|
+
width = dragLeft + clientWidth
|
|
636
|
+
height = dragTop + clientHeight
|
|
637
|
+
if (offsetLeft + width + marginSize < visibleWidth) {
|
|
638
|
+
if (width > minWidth) {
|
|
639
|
+
boxElem.style.width = `${width < maxWidth ? width : maxWidth}px`
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
if (offsetTop - dragTop > marginSize) {
|
|
643
|
+
if (height > minHeight) {
|
|
644
|
+
boxElem.style.height = `${height < maxHeight ? height : maxHeight}px`
|
|
645
|
+
boxElem.style.top = `${offsetTop - dragTop}px`
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
break
|
|
649
|
+
case 'selb':
|
|
650
|
+
dragLeft = evnt.clientX - disX
|
|
651
|
+
dragTop = evnt.clientY - disY
|
|
652
|
+
width = dragLeft + clientWidth
|
|
653
|
+
height = dragTop + clientHeight
|
|
654
|
+
if (offsetLeft + width + marginSize < visibleWidth) {
|
|
655
|
+
if (width > minWidth) {
|
|
656
|
+
boxElem.style.width = `${width < maxWidth ? width : maxWidth}px`
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
if (offsetTop + height + marginSize < visibleHeight) {
|
|
660
|
+
if (height > minHeight) {
|
|
661
|
+
boxElem.style.height = `${height < maxHeight ? height : maxHeight}px`
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
break
|
|
665
|
+
case 'sb':
|
|
666
|
+
dragTop = evnt.clientY - disY
|
|
667
|
+
height = dragTop + clientHeight
|
|
668
|
+
if (offsetTop + height + marginSize < visibleHeight) {
|
|
669
|
+
if (height > minHeight) {
|
|
670
|
+
boxElem.style.height = `${height < maxHeight ? height : maxHeight}px`
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
break
|
|
674
|
+
}
|
|
675
|
+
boxElem.className = boxElem.className.replace(/\s?is--drag/, '') + ' is--drag'
|
|
676
|
+
if (remember && storage) {
|
|
677
|
+
savePosStorage()
|
|
678
|
+
}
|
|
679
|
+
modalMethods.dispatchEvent('zoom', params, evnt)
|
|
680
|
+
}
|
|
681
|
+
document.onmouseup = () => {
|
|
682
|
+
reactData.zoomLocat = null
|
|
683
|
+
document.onmousemove = domMousemove
|
|
684
|
+
document.onmouseup = domMouseup
|
|
685
|
+
setTimeout(() => {
|
|
686
|
+
boxElem.className = boxElem.className.replace(/\s?is--drag/, '')
|
|
687
|
+
}, 50)
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
const renderTitles = () => {
|
|
692
|
+
const { slots: propSlots = {}, showClose, showZoom, title } = props
|
|
693
|
+
const { zoomLocat } = reactData
|
|
694
|
+
const titleSlot = slots.title || propSlots.title
|
|
695
|
+
const cornerSlot = slots.corner || propSlots.corner
|
|
696
|
+
const titVNs = [
|
|
697
|
+
h('div', {
|
|
698
|
+
class: 'vxe-modal--header-title'
|
|
699
|
+
}, titleSlot ? getSlotVNs(titleSlot({ $modal: $xemodal })) : (title ? getFuncText(title) : getI18n('vxe.alert.title')))
|
|
700
|
+
]
|
|
701
|
+
const rightVNs = []
|
|
702
|
+
if (cornerSlot) {
|
|
703
|
+
rightVNs.push(
|
|
704
|
+
h('span', {
|
|
705
|
+
class: 'vxe-modal--corner-wrapper'
|
|
706
|
+
}, getSlotVNs(cornerSlot({ $modal: $xemodal })))
|
|
707
|
+
)
|
|
708
|
+
}
|
|
709
|
+
if (showZoom) {
|
|
710
|
+
rightVNs.push(
|
|
711
|
+
h('i', {
|
|
712
|
+
class: ['vxe-modal--zoom-btn', 'trigger--btn', zoomLocat ? iconConfigStore.MODAL_ZOOM_OUT : iconConfigStore.MODAL_ZOOM_IN],
|
|
713
|
+
title: getI18n(`vxe.modal.zoom${zoomLocat ? 'Out' : 'In'}`),
|
|
714
|
+
onClick: toggleZoomEvent
|
|
715
|
+
})
|
|
716
|
+
)
|
|
717
|
+
}
|
|
718
|
+
if (showClose) {
|
|
719
|
+
rightVNs.push(
|
|
720
|
+
h('i', {
|
|
721
|
+
class: ['vxe-modal--close-btn', 'trigger--btn', iconConfigStore.MODAL_CLOSE],
|
|
722
|
+
title: getI18n('vxe.modal.close'),
|
|
723
|
+
onClick: closeEvent
|
|
724
|
+
})
|
|
725
|
+
)
|
|
726
|
+
}
|
|
727
|
+
titVNs.push(
|
|
728
|
+
h('div', {
|
|
729
|
+
class: 'vxe-modal--header-right'
|
|
730
|
+
}, rightVNs)
|
|
731
|
+
)
|
|
732
|
+
return titVNs
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
const renderHeaders = () => {
|
|
736
|
+
const { slots: propSlots = {}, showZoom, draggable } = props
|
|
737
|
+
const isMsg = computeIsMsg.value
|
|
738
|
+
const headerSlot = slots.header || propSlots.header
|
|
739
|
+
const headVNs: VNode[] = []
|
|
740
|
+
if (props.showHeader) {
|
|
741
|
+
const headerOns: {
|
|
742
|
+
onMousedown?: typeof mousedownEvent;
|
|
743
|
+
onDblclick?: typeof toggleZoomEvent;
|
|
744
|
+
} = {}
|
|
745
|
+
if (draggable) {
|
|
746
|
+
headerOns.onMousedown = mousedownEvent
|
|
747
|
+
}
|
|
748
|
+
if (showZoom && props.dblclickZoom && props.type === 'modal') {
|
|
749
|
+
headerOns.onDblclick = toggleZoomEvent
|
|
750
|
+
}
|
|
751
|
+
headVNs.push(
|
|
752
|
+
h('div', {
|
|
753
|
+
class: ['vxe-modal--header', {
|
|
754
|
+
'is--draggable': draggable,
|
|
755
|
+
'is--ellipsis': !isMsg && props.showTitleOverflow
|
|
756
|
+
}],
|
|
757
|
+
...headerOns
|
|
758
|
+
}, headerSlot ? (!reactData.inited || (props.destroyOnClose && !reactData.visible) ? [] : getSlotVNs(headerSlot({ $modal: $xemodal }))) : renderTitles())
|
|
759
|
+
)
|
|
760
|
+
}
|
|
761
|
+
return headVNs
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
const renderBodys = () => {
|
|
765
|
+
const { slots: propSlots = {}, status, message } = props
|
|
766
|
+
const content = props.content || message
|
|
767
|
+
const isMsg = computeIsMsg.value
|
|
768
|
+
const defaultSlot = slots.default || propSlots.default
|
|
769
|
+
const contVNs: VNode[] = []
|
|
770
|
+
if (status) {
|
|
771
|
+
contVNs.push(
|
|
772
|
+
h('div', {
|
|
773
|
+
class: 'vxe-modal--status-wrapper'
|
|
774
|
+
}, [
|
|
775
|
+
h('i', {
|
|
776
|
+
class: ['vxe-modal--status-icon', props.iconStatus || iconConfigStore[`MODAL_${status}`.toLocaleUpperCase() as 'MODAL_SUCCESS' | 'MODAL_ERROR']]
|
|
777
|
+
})
|
|
778
|
+
])
|
|
779
|
+
)
|
|
780
|
+
}
|
|
781
|
+
contVNs.push(
|
|
782
|
+
h('div', {
|
|
783
|
+
class: 'vxe-modal--content'
|
|
784
|
+
}, defaultSlot ? (!reactData.inited || (props.destroyOnClose && !reactData.visible) ? [] : getSlotVNs(defaultSlot({ $modal: $xemodal }))) as VNode[] : getFuncText(content))
|
|
785
|
+
)
|
|
786
|
+
if (!isMsg) {
|
|
787
|
+
/**
|
|
788
|
+
* 加载中
|
|
789
|
+
*/
|
|
790
|
+
contVNs.push(
|
|
791
|
+
h(VxeLoading, {
|
|
792
|
+
class: 'vxe-modal--loading',
|
|
793
|
+
modelValue: props.loading
|
|
794
|
+
})
|
|
795
|
+
)
|
|
796
|
+
}
|
|
797
|
+
return [
|
|
798
|
+
h('div', {
|
|
799
|
+
class: 'vxe-modal--body'
|
|
800
|
+
}, contVNs)
|
|
801
|
+
]
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
const renderBtns = () => {
|
|
805
|
+
const { type } = props
|
|
806
|
+
const btnVNs = []
|
|
807
|
+
if (type === 'confirm') {
|
|
808
|
+
btnVNs.push(
|
|
809
|
+
h(VxeButtonConstructor, {
|
|
810
|
+
ref: refCancelBtn,
|
|
811
|
+
content: props.cancelButtonText || getI18n('vxe.button.cancel'),
|
|
812
|
+
onClick: cancelEvent
|
|
813
|
+
})
|
|
814
|
+
)
|
|
815
|
+
}
|
|
816
|
+
btnVNs.push(
|
|
817
|
+
h(VxeButtonConstructor, {
|
|
818
|
+
ref: refConfirmBtn,
|
|
819
|
+
status: 'primary',
|
|
820
|
+
content: props.confirmButtonText || getI18n('vxe.button.confirm'),
|
|
821
|
+
onClick: confirmEvent
|
|
822
|
+
})
|
|
823
|
+
)
|
|
824
|
+
return btnVNs
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
const renderFooters = () => {
|
|
828
|
+
const { slots: propSlots = {} } = props
|
|
829
|
+
const isMsg = computeIsMsg.value
|
|
830
|
+
const footerSlot = slots.footer || propSlots.footer
|
|
831
|
+
const footVNs: VNode[] = []
|
|
832
|
+
if (props.showFooter) {
|
|
833
|
+
footVNs.push(
|
|
834
|
+
h('div', {
|
|
835
|
+
class: 'vxe-modal--footer'
|
|
836
|
+
}, footerSlot ? (!reactData.inited || (props.destroyOnClose && !reactData.visible) ? [] : getSlotVNs(footerSlot({ $modal: $xemodal }))) as VNode[] : renderBtns())
|
|
837
|
+
)
|
|
838
|
+
}
|
|
839
|
+
if (!isMsg && props.resize) {
|
|
840
|
+
footVNs.push(
|
|
841
|
+
h('span', {
|
|
842
|
+
class: 'vxe-modal--resize'
|
|
843
|
+
}, ['wl', 'wr', 'swst', 'sest', 'st', 'swlb', 'selb', 'sb'].map(type => {
|
|
844
|
+
return h('span', {
|
|
845
|
+
class: `${type}-resize`,
|
|
846
|
+
type: type,
|
|
847
|
+
onMousedown: dragEvent
|
|
848
|
+
})
|
|
849
|
+
}))
|
|
850
|
+
)
|
|
851
|
+
}
|
|
852
|
+
return footVNs
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
modalMethods = {
|
|
856
|
+
dispatchEvent (type, params, evnt) {
|
|
857
|
+
emit(type, Object.assign({ $modal: $xemodal, $event: evnt }, params))
|
|
858
|
+
},
|
|
859
|
+
open: openModal,
|
|
860
|
+
close () {
|
|
861
|
+
return closeModal('close')
|
|
862
|
+
},
|
|
863
|
+
getBox,
|
|
864
|
+
getPosition,
|
|
865
|
+
setPosition,
|
|
866
|
+
isMaximized,
|
|
867
|
+
zoom,
|
|
868
|
+
maximize,
|
|
869
|
+
revert
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
Object.assign($xemodal, modalMethods)
|
|
873
|
+
|
|
874
|
+
watch(() => props.width, recalculate)
|
|
875
|
+
watch(() => props.height, recalculate)
|
|
876
|
+
|
|
877
|
+
watch(() => props.modelValue, (value) => {
|
|
878
|
+
if (value) {
|
|
879
|
+
openModal()
|
|
880
|
+
} else {
|
|
881
|
+
closeModal('model')
|
|
882
|
+
}
|
|
883
|
+
})
|
|
884
|
+
|
|
885
|
+
onMounted(() => {
|
|
886
|
+
nextTick(() => {
|
|
887
|
+
if (props.storage && !props.id) {
|
|
888
|
+
errLog('vxe.error.reqProp', ['modal.id'])
|
|
889
|
+
}
|
|
890
|
+
if (props.modelValue) {
|
|
891
|
+
openModal()
|
|
892
|
+
}
|
|
893
|
+
recalculate()
|
|
894
|
+
})
|
|
895
|
+
if (props.escClosable) {
|
|
896
|
+
GlobalEvent.on($xemodal, 'keydown', handleGlobalKeydownEvent)
|
|
897
|
+
}
|
|
898
|
+
})
|
|
899
|
+
|
|
900
|
+
onUnmounted(() => {
|
|
901
|
+
GlobalEvent.off($xemodal, 'keydown')
|
|
902
|
+
removeMsgQueue()
|
|
903
|
+
})
|
|
904
|
+
|
|
905
|
+
const renderVN = () => {
|
|
906
|
+
const { className, type, animat, loading, status, lockScroll, lockView, mask, resize } = props
|
|
907
|
+
const { inited, zoomLocat, modalTop, contentVisible, visible } = reactData
|
|
908
|
+
const vSize = computeSize.value
|
|
909
|
+
return h(Teleport, {
|
|
910
|
+
to: 'body',
|
|
911
|
+
disabled: props.transfer ? !inited : true
|
|
912
|
+
}, [
|
|
913
|
+
h('div', {
|
|
914
|
+
ref: refElem,
|
|
915
|
+
class: ['vxe-modal--wrapper', `type--${type}`, className || '', {
|
|
916
|
+
[`size--${vSize}`]: vSize,
|
|
917
|
+
[`status--${status}`]: status,
|
|
918
|
+
'is--animat': animat,
|
|
919
|
+
'lock--scroll': lockScroll,
|
|
920
|
+
'lock--view': lockView,
|
|
921
|
+
'is--resize': resize,
|
|
922
|
+
'is--mask': mask,
|
|
923
|
+
'is--maximize': zoomLocat,
|
|
924
|
+
'is--visible': contentVisible,
|
|
925
|
+
'is--active': visible,
|
|
926
|
+
'is--loading': loading
|
|
927
|
+
}],
|
|
928
|
+
style: {
|
|
929
|
+
zIndex: reactData.modalZindex,
|
|
930
|
+
top: modalTop ? `${modalTop}px` : null
|
|
931
|
+
},
|
|
932
|
+
onClick: selfClickEvent
|
|
933
|
+
}, [
|
|
934
|
+
h('div', {
|
|
935
|
+
ref: refModalBox,
|
|
936
|
+
class: 'vxe-modal--box',
|
|
937
|
+
onMousedown: boxMousedownEvent
|
|
938
|
+
}, renderHeaders().concat(renderBodys(), renderFooters()))
|
|
939
|
+
])
|
|
940
|
+
])
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
$xemodal.renderVN = renderVN
|
|
944
|
+
|
|
945
|
+
return $xemodal
|
|
946
|
+
},
|
|
947
|
+
render () {
|
|
948
|
+
return this.renderVN()
|
|
949
|
+
}
|
|
950
|
+
})
|