dpzvc3-ui 3.1.4 → 3.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/dpzvc3.esm.js +5 -4
- package/dist/dpzvc3.esm.js.map +1 -1
- package/dist/dpzvc3.esm.min.js +1 -1
- package/dist/dpzvc3.esm.min.js.map +1 -1
- package/dist/dpzvc3.js +5 -4
- package/dist/dpzvc3.js.map +1 -1
- package/dist/dpzvc3.min.js +1 -1
- package/dist/dpzvc3.min.js.map +1 -1
- package/dist/types/components/actionSheet/index.d.ts +6 -1
- package/dist/types/components/actionSheet/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +7 -2
- package/build-style.js +0 -58
- package/dist-prod/91.05c8ec5277a15f939b0f.js +0 -3
- package/dist-prod/91.05c8ec5277a15f939b0f.js.LICENSE.txt +0 -25
- package/dist-prod/91.05c8ec5277a15f939b0f.js.map +0 -1
- package/dist-prod/actionsheet.0d67b6b08a62cf9360be.chunk.js +0 -2
- package/dist-prod/actionsheet.0d67b6b08a62cf9360be.chunk.js.map +0 -1
- package/dist-prod/badge.16ab5c05734fe1530701.chunk.js +0 -2
- package/dist-prod/badge.16ab5c05734fe1530701.chunk.js.map +0 -1
- package/dist-prod/button.39ac33aa7aaccc24b6a1.chunk.js +0 -2
- package/dist-prod/button.39ac33aa7aaccc24b6a1.chunk.js.map +0 -1
- package/dist-prod/card.16ed7eafe471bcc60ec6.chunk.js +0 -2
- package/dist-prod/card.16ed7eafe471bcc60ec6.chunk.js.map +0 -1
- package/dist-prod/cell.70ff74fba57e27df7f5a.chunk.js +0 -2
- package/dist-prod/cell.70ff74fba57e27df7f5a.chunk.js.map +0 -1
- package/dist-prod/cellswipe.f3ec62abd60729d8bc5a.chunk.js +0 -2
- package/dist-prod/cellswipe.f3ec62abd60729d8bc5a.chunk.js.map +0 -1
- package/dist-prod/checkbox.05c63a947ac98293c9f2.chunk.js +0 -2
- package/dist-prod/checkbox.05c63a947ac98293c9f2.chunk.js.map +0 -1
- package/dist-prod/guide.24f1968a568f20fbc84b.chunk.js +0 -2
- package/dist-prod/guide.24f1968a568f20fbc84b.chunk.js.map +0 -1
- package/dist-prod/header.eb10433dd892738ee95a.chunk.js +0 -2
- package/dist-prod/header.eb10433dd892738ee95a.chunk.js.map +0 -1
- package/dist-prod/index.html +0 -19
- package/dist-prod/indicator.0c09e3f238791cb478e0.chunk.js +0 -2
- package/dist-prod/indicator.0c09e3f238791cb478e0.chunk.js.map +0 -1
- package/dist-prod/loadmore.9bad88767cc43603f473.chunk.js +0 -2
- package/dist-prod/loadmore.9bad88767cc43603f473.chunk.js.map +0 -1
- package/dist-prod/main.662ad15361e7f3d20234.js +0 -2
- package/dist-prod/main.662ad15361e7f3d20234.js.map +0 -1
- package/dist-prod/message.de17fea3de4daa70bab4.chunk.js +0 -2
- package/dist-prod/message.de17fea3de4daa70bab4.chunk.js.map +0 -1
- package/dist-prod/modal.f9ec857acd9fbdf53f3b.chunk.js +0 -2
- package/dist-prod/modal.f9ec857acd9fbdf53f3b.chunk.js.map +0 -1
- package/dist-prod/picker.bca059ef59e3c42a401f.chunk.js +0 -2
- package/dist-prod/picker.bca059ef59e3c42a401f.chunk.js.map +0 -1
- package/dist-prod/popup.538422c7e188363a468d.chunk.js +0 -2
- package/dist-prod/popup.538422c7e188363a468d.chunk.js.map +0 -1
- package/dist-prod/progress.240de4b633002f573030.chunk.js +0 -2
- package/dist-prod/progress.240de4b633002f573030.chunk.js.map +0 -1
- package/dist-prod/prompt.dcda0b05ea02d59106b7.chunk.js +0 -2
- package/dist-prod/prompt.dcda0b05ea02d59106b7.chunk.js.map +0 -1
- package/dist-prod/radiobox.7c10f77aba5ae04b2e5c.chunk.js +0 -2
- package/dist-prod/radiobox.7c10f77aba5ae04b2e5c.chunk.js.map +0 -1
- package/dist-prod/rater.d46ae462c598c458e5a8.chunk.js +0 -2
- package/dist-prod/rater.d46ae462c598c458e5a8.chunk.js.map +0 -1
- package/dist-prod/slidebar.833e75b9eb0abef92453.chunk.js +0 -2
- package/dist-prod/slidebar.833e75b9eb0abef92453.chunk.js.map +0 -1
- package/dist-prod/spinner.6afb4f84cc29f0e2f8eb.chunk.js +0 -2
- package/dist-prod/spinner.6afb4f84cc29f0e2f8eb.chunk.js.map +0 -1
- package/dist-prod/swipe.3fe6ee6638765ec52d94.chunk.js +0 -2
- package/dist-prod/swipe.3fe6ee6638765ec52d94.chunk.js.map +0 -1
- package/dist-prod/switchbar.f24c76a03120f1bd961a.chunk.js +0 -2
- package/dist-prod/switchbar.f24c76a03120f1bd961a.chunk.js.map +0 -1
- package/dist-prod/tab.29f19483f699b7811259.chunk.js +0 -2
- package/dist-prod/tab.29f19483f699b7811259.chunk.js.map +0 -1
- package/dist-prod/text.a6e4251f772d23843e2b.chunk.js +0 -2
- package/dist-prod/text.a6e4251f772d23843e2b.chunk.js.map +0 -1
- package/dist-prod/totop.713c5ab7f7dbcffbf2a3.chunk.js +0 -2
- package/dist-prod/totop.713c5ab7f7dbcffbf2a3.chunk.js.map +0 -1
- package/dist-prod/upload.0638581e551ed9afaba2.chunk.js +0 -2
- package/dist-prod/upload.0638581e551ed9afaba2.chunk.js.map +0 -1
- package/postcss.config.js +0 -5
- package/src/components/Indicator/Indicator.tsx +0 -67
- package/src/components/Indicator/Indicator.vue +0 -82
- package/src/components/Indicator/index.ts +0 -111
- package/src/components/Indicator/types.ts +0 -15
- package/src/components/Text/index.ts +0 -14
- package/src/components/Text/textBar.tsx +0 -104
- package/src/components/Text/types.ts +0 -13
- package/src/components/actionSheet/actionSheet.d.ts +0 -16
- package/src/components/actionSheet/actionSheet.tsx +0 -86
- package/src/components/actionSheet/index.ts +0 -6
- package/src/components/actionSheet/types.ts +0 -10
- package/src/components/app.vue +0 -59
- package/src/components/badge/badge.tsx +0 -80
- package/src/components/badge/index.ts +0 -12
- package/src/components/badge/types.ts +0 -8
- package/src/components/button/button.tsx +0 -105
- package/src/components/button/index.ts +0 -13
- package/src/components/button/types.ts +0 -13
- package/src/components/card/card.d.ts +0 -16
- package/src/components/card/card.tsx +0 -38
- package/src/components/card/index.ts +0 -12
- package/src/components/card/types.ts +0 -3
- package/src/components/cell/cell.tsx +0 -89
- package/src/components/cell/index.ts +0 -12
- package/src/components/cell/types.ts +0 -8
- package/src/components/cellSwipe/cellSwipe.tsx +0 -188
- package/src/components/cellSwipe/index.ts +0 -13
- package/src/components/cellSwipe/types.ts +0 -17
- package/src/components/checkBox/checkbox-group.tsx +0 -75
- package/src/components/checkBox/checkbox.tsx +0 -107
- package/src/components/checkBox/index.ts +0 -29
- package/src/components/checkBox/types.ts +0 -32
- package/src/components/header/header.tsx +0 -119
- package/src/components/header/index.ts +0 -13
- package/src/components/header/types.ts +0 -7
- package/src/components/loadMore/index.ts +0 -14
- package/src/components/loadMore/loadMore.tsx +0 -265
- package/src/components/loadMore/types.ts +0 -26
- package/src/components/message/confirm.ts +0 -104
- package/src/components/message/index.ts +0 -113
- package/src/components/message/message.tsx +0 -100
- package/src/components/message/messageGroup.tsx +0 -59
- package/src/components/message/types.ts +0 -48
- package/src/components/modal/confirm.ts +0 -123
- package/src/components/modal/index.ts +0 -68
- package/src/components/modal/modal.tsx +0 -248
- package/src/components/modal/types.ts +0 -51
- package/src/components/number/Number.tsx +0 -143
- package/src/components/number/index.ts +0 -10
- package/src/components/number/types.ts +0 -13
- package/src/components/picker/area-picker/area-picker.vue +0 -230
- package/src/components/picker/area-picker/props.js +0 -17
- package/src/components/picker/date-picker/date-picker.vue +0 -191
- package/src/components/picker/date-picker/props.js +0 -24
- package/src/components/picker/index.ts +0 -12
- package/src/components/picker/normal-picker/normal-picker.vue +0 -120
- package/src/components/picker/normal-picker/props.js +0 -20
- package/src/components/picker/picker-slot.vue +0 -217
- package/src/components/picker/picker.tsx +0 -112
- package/src/components/picker/types.ts +0 -17
- package/src/components/popup/index.ts +0 -12
- package/src/components/popup/popup.d.ts +0 -16
- package/src/components/popup/popup.tsx +0 -68
- package/src/components/popup/types.ts +0 -9
- package/src/components/progress/index.ts +0 -12
- package/src/components/progress/progress.tsx +0 -81
- package/src/components/progress/types.ts +0 -9
- package/src/components/prompt/confirm.ts +0 -104
- package/src/components/prompt/index.ts +0 -50
- package/src/components/prompt/prompt.tsx +0 -161
- package/src/components/prompt/types.ts +0 -45
- package/src/components/radioBox/index.ts +0 -34
- package/src/components/radioBox/radiobox-group.tsx +0 -66
- package/src/components/radioBox/radiobox-group1.vue +0 -66
- package/src/components/radioBox/radiobox.tsx +0 -115
- package/src/components/radioBox/radiobox1.vue +0 -89
- package/src/components/radioBox/types.ts +0 -24
- package/src/components/rater/index.ts +0 -12
- package/src/components/rater/rater.d.ts +0 -16
- package/src/components/rater/raters.tsx +0 -101
- package/src/components/rater/types.ts +0 -10
- package/src/components/slideBar/index.ts +0 -13
- package/src/components/slideBar/slideBar.tsx +0 -288
- package/src/components/slideBar/types.ts +0 -20
- package/src/components/spinner/behavior/blade.vue +0 -42
- package/src/components/spinner/behavior/double-bounce.vue +0 -38
- package/src/components/spinner/behavior/fading-circle.vue +0 -55
- package/src/components/spinner/behavior/snake.vue +0 -41
- package/src/components/spinner/behavior/triple-bounce.vue +0 -52
- package/src/components/spinner/index.ts +0 -13
- package/src/components/spinner/props.js +0 -28
- package/src/components/spinner/spinner.tsx +0 -85
- package/src/components/spinner/types.ts +0 -20
- package/src/components/swipe/index.ts +0 -13
- package/src/components/swipe/swipe.tsx +0 -292
- package/src/components/swipe/types.ts +0 -21
- package/src/components/switchbar/index.ts +0 -13
- package/src/components/switchbar/switchbar.tsx +0 -58
- package/src/components/switchbar/types.ts +0 -6
- package/src/components/tab/index.ts +0 -12
- package/src/components/tab/tab.tsx +0 -71
- package/src/components/tab/types.ts +0 -15
- package/src/components/toTop/index.ts +0 -13
- package/src/components/toTop/toTop.tsx +0 -54
- package/src/components/toTop/types.ts +0 -7
- package/src/components/upload/index.ts +0 -13
- package/src/components/upload/types.ts +0 -9
- package/src/components/upload/upload.tsx +0 -180
- package/src/config/config.js +0 -16
- package/src/directives/clickoutside.js +0 -42
- package/src/directives/tranferDom.js +0 -66
- package/src/index.d.ts +0 -131
- package/src/index.ts +0 -136
- package/src/lib/MegaPixImage.js +0 -164
- package/src/lib/MegaPixImageOld.js +0 -153
- package/src/lib/exif-js.js +0 -235
- package/src/lib/exif.js +0 -789
- package/src/lib/lib.js +0 -22
- package/src/main.ts +0 -33
- package/src/mixin/emitter.js +0 -72
- package/src/mixin/input.js +0 -41
- package/src/router.ts +0 -36
- package/src/shims-vue.d.ts +0 -37
- package/src/styles/base/font.less +0 -99
- package/src/styles/base/reset.less +0 -135
- package/src/styles/base/variable.less +0 -108
- package/src/styles/components/actionSheet.less +0 -43
- package/src/styles/components/badge.less +0 -81
- package/src/styles/components/button.less +0 -124
- package/src/styles/components/card.less +0 -31
- package/src/styles/components/cell-swipe.less +0 -20
- package/src/styles/components/cell.less +0 -75
- package/src/styles/components/checkBox.less +0 -113
- package/src/styles/components/editor.less +0 -3
- package/src/styles/components/header.less +0 -72
- package/src/styles/components/indicator.less +0 -39
- package/src/styles/components/loadmore.less +0 -48
- package/src/styles/components/message.less +0 -57
- package/src/styles/components/modal.less +0 -84
- package/src/styles/components/number.less +0 -60
- package/src/styles/components/picker.less +0 -152
- package/src/styles/components/popup.less +0 -46
- package/src/styles/components/progress.less +0 -52
- package/src/styles/components/prompt.less +0 -37
- package/src/styles/components/radioBox.less +0 -142
- package/src/styles/components/rater.less +0 -16
- package/src/styles/components/slide-Bar.less +0 -149
- package/src/styles/components/spinner.less +0 -329
- package/src/styles/components/swipe.less +0 -125
- package/src/styles/components/switchBar.less +0 -88
- package/src/styles/components/tab.less +0 -71
- package/src/styles/components/text.less +0 -82
- package/src/styles/components/toTop.less +0 -28
- package/src/styles/components/upload.less +0 -23
- package/src/styles/index.less +0 -39
- package/src/styles/utils/1px.less +0 -206
- package/src/styles/utils/animation.less +0 -165
- package/src/styles/utils/nowrap.less +0 -19
- package/src/template/index.ejs +0 -40
- package/src/types/index.d.ts +0 -127
- package/src/types/js-shims.d.ts +0 -36
- package/src/utils/test.ts +0 -2
- package/src/utils/util.ts +0 -168
- package/src/utils/util1.js +0 -202
- package/src/vconsole-resources.min.js +0 -6
- package/src/vconsole-sources.min.js +0 -6
- package/src/vconsole.min.js +0 -7
- package/src/views/ActionSheet.vue +0 -46
- package/src/views/Badge/Badge.less +0 -12
- package/src/views/Badge/Badge.tsx +0 -23
- package/src/views/Badge.vue +0 -53
- package/src/views/Button.vue +0 -69
- package/src/views/Card.vue +0 -89
- package/src/views/Cell.vue +0 -31
- package/src/views/CellSwipe.vue +0 -80
- package/src/views/CheckBox.vue +0 -78
- package/src/views/Header.vue +0 -71
- package/src/views/Indicator.vue +0 -82
- package/src/views/LoadMore.vue +0 -76
- package/src/views/Message.vue +0 -61
- package/src/views/Modal.vue +0 -69
- package/src/views/Picker.vue +0 -142
- package/src/views/Popup.vue +0 -103
- package/src/views/Progress.vue +0 -49
- package/src/views/Prompt.vue +0 -43
- package/src/views/RadioBox.vue +0 -70
- package/src/views/Rater.vue +0 -53
- package/src/views/SlideBar.vue +0 -62
- package/src/views/Spinner.vue +0 -27
- package/src/views/Swipe.vue +0 -59
- package/src/views/SwitchBar.vue +0 -49
- package/src/views/Tab.vue +0 -55
- package/src/views/Text.vue +0 -97
- package/src/views/ToTop.vue +0 -31
- package/src/views/Upload.vue +0 -65
- package/src/views/guide.vue +0 -164
- package/src/views/index.vue +0 -554
- package/tsconfig.build.json +0 -31
- package/tsconfig.json +0 -41
- package/webpack.base.config.js +0 -85
- package/webpack.dev.config.js +0 -43
- package/webpack.dist.dev.config.js +0 -76
- package/webpack.dist.prod.config.js +0 -90
- package/webpack.prod.config.js +0 -52
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { createVNode, render } from 'vue'
|
|
2
|
-
import type { ComponentPublicInstance } from 'vue'
|
|
3
|
-
import MessageGroup from './messageGroup'
|
|
4
|
-
|
|
5
|
-
// MessageGroup.newInstance = function (props = {}) {
|
|
6
|
-
function createMessageInstance(props = {}) {
|
|
7
|
-
const container = document.createElement('div')
|
|
8
|
-
document.body.appendChild(container)
|
|
9
|
-
|
|
10
|
-
let vnode = createVNode(MessageGroup, { ...props })
|
|
11
|
-
render(vnode, container)
|
|
12
|
-
|
|
13
|
-
// vnode.component.proxy 会有 expose 出来的方法
|
|
14
|
-
const instance = vnode.component?.proxy as ComponentPublicInstance
|
|
15
|
-
const { add, remove, closeAll } = vnode.component?.exposed || {}
|
|
16
|
-
// console.log(vnode.component.exposed
|
|
17
|
-
// , 'instance---messageGroup')
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
add(options: any) {
|
|
21
|
-
// instance?.add?.(options)
|
|
22
|
-
add?.(options)
|
|
23
|
-
},
|
|
24
|
-
remove(name: string | number) {
|
|
25
|
-
// instance?.remove?.(name)
|
|
26
|
-
remove?.(name)
|
|
27
|
-
},
|
|
28
|
-
closeAll() {
|
|
29
|
-
// instance?.closeAll?.()
|
|
30
|
-
closeAll?.()
|
|
31
|
-
},
|
|
32
|
-
component: instance,
|
|
33
|
-
destroy() {
|
|
34
|
-
closeAll?.()
|
|
35
|
-
setTimeout(() => {
|
|
36
|
-
render(null, container)
|
|
37
|
-
container.parentNode?.removeChild(container)
|
|
38
|
-
}, 500)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export {createMessageInstance}
|
|
44
|
-
// /**
|
|
45
|
-
// * confirm.js - Vue 3 版本
|
|
46
|
-
// * 负责创建 MessageGroup 实例
|
|
47
|
-
// */
|
|
48
|
-
|
|
49
|
-
// import { createVNode, render } from 'vue'
|
|
50
|
-
// import MessageGroup from './messageGroup'
|
|
51
|
-
|
|
52
|
-
// MessageGroup.newInstance = function (props = {}) {
|
|
53
|
-
// // alert(4)
|
|
54
|
-
// const container = document.createElement('div')
|
|
55
|
-
// document.body.appendChild(container)
|
|
56
|
-
|
|
57
|
-
// let vnode = null
|
|
58
|
-
// let instance = null // 组件实例 proxy
|
|
59
|
-
|
|
60
|
-
// const mount = () => {
|
|
61
|
-
// vnode = createVNode(MessageGroup, {
|
|
62
|
-
// ...props
|
|
63
|
-
// // 这里使用 ref 拿到组件实例 proxy
|
|
64
|
-
// })
|
|
65
|
-
// render(vnode, container)
|
|
66
|
-
// instance = vnode.component.proxy
|
|
67
|
-
// }
|
|
68
|
-
|
|
69
|
-
// mount()
|
|
70
|
-
|
|
71
|
-
// return {
|
|
72
|
-
// add (options) {
|
|
73
|
-
// if (instance && instance.add) {
|
|
74
|
-
// instance.add(options)
|
|
75
|
-
// }
|
|
76
|
-
// },
|
|
77
|
-
// remove (name) {
|
|
78
|
-
// if (instance && instance.remove) {
|
|
79
|
-
// instance.remove(name)
|
|
80
|
-
// }
|
|
81
|
-
// },
|
|
82
|
-
// closeAll () {
|
|
83
|
-
// if (instance && instance.closeAll) {
|
|
84
|
-
// instance.closeAll()
|
|
85
|
-
// }
|
|
86
|
-
// },
|
|
87
|
-
// component: instance,
|
|
88
|
-
// destroy () {
|
|
89
|
-
// if (instance && instance.closeAll) {
|
|
90
|
-
// instance.closeAll()
|
|
91
|
-
// }
|
|
92
|
-
|
|
93
|
-
// setTimeout(() => {
|
|
94
|
-
// render(null, container)
|
|
95
|
-
// if (container.parentNode) {
|
|
96
|
-
// container.parentNode.removeChild(container)
|
|
97
|
-
// }
|
|
98
|
-
// instance = null
|
|
99
|
-
// }, 500)
|
|
100
|
-
// }
|
|
101
|
-
// }
|
|
102
|
-
// }
|
|
103
|
-
|
|
104
|
-
// export default MessageGroup
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* message/index.js - Vue 3 版本
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { createMessageInstance } from './confirm'
|
|
6
|
-
import { randomStr } from '../../utils/util'
|
|
7
|
-
import type { MergeMessageOptions,MessageInstance,MgInstance } from './types'
|
|
8
|
-
let defaultDuration = 1
|
|
9
|
-
let top = '0'
|
|
10
|
-
|
|
11
|
-
let MGInstance:MgInstance = null
|
|
12
|
-
let seed = 1
|
|
13
|
-
const time = Date.now()
|
|
14
|
-
|
|
15
|
-
function getName () {
|
|
16
|
-
return `dpzvc3-message-group_${time}_${seed++}_${randomStr()}`
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function getNewInstance () {
|
|
20
|
-
if (!MGInstance) {
|
|
21
|
-
MGInstance = createMessageInstance({
|
|
22
|
-
styles: {
|
|
23
|
-
top,
|
|
24
|
-
right: '0'
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return MGInstance
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function message (props:MergeMessageOptions) {
|
|
33
|
-
const {
|
|
34
|
-
text = '',
|
|
35
|
-
name = getName(),
|
|
36
|
-
duration = props.duration === 0 ? 0 : (props.duration || defaultDuration),
|
|
37
|
-
showLeft = false,
|
|
38
|
-
rightHide = true,
|
|
39
|
-
loading = false,
|
|
40
|
-
onClose = () => {},
|
|
41
|
-
styles = {},
|
|
42
|
-
type = 'normal',
|
|
43
|
-
position = 'center'
|
|
44
|
-
} = props
|
|
45
|
-
|
|
46
|
-
const instance = getNewInstance()
|
|
47
|
-
// console.log(instance.add, 'instance')
|
|
48
|
-
instance.add({
|
|
49
|
-
name,
|
|
50
|
-
text,
|
|
51
|
-
duration,
|
|
52
|
-
showLeft,
|
|
53
|
-
rightHide,
|
|
54
|
-
loading,
|
|
55
|
-
onClose,
|
|
56
|
-
styles,
|
|
57
|
-
type,
|
|
58
|
-
position
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
// 返回手动关闭函数(保持旧行为)
|
|
62
|
-
return function remove () {
|
|
63
|
-
instance.remove(name)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const Message: MessageInstance= {
|
|
68
|
-
|
|
69
|
-
show(options:MergeMessageOptions) {
|
|
70
|
-
// alert(1)
|
|
71
|
-
return message(options)
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
success (options:MergeMessageOptions) {
|
|
75
|
-
return message({
|
|
76
|
-
...options,
|
|
77
|
-
type: 'success'
|
|
78
|
-
})
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
error (options:MergeMessageOptions) {
|
|
82
|
-
return message({
|
|
83
|
-
...options,
|
|
84
|
-
type: 'error'
|
|
85
|
-
})
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
loading (options:MergeMessageOptions) {
|
|
89
|
-
return message({
|
|
90
|
-
...options,
|
|
91
|
-
type: 'loading',
|
|
92
|
-
duration: 0,
|
|
93
|
-
showLeft: true
|
|
94
|
-
})
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
// config (options:MergeMessageOptions) {
|
|
98
|
-
// if (options?.top !== undefined) {
|
|
99
|
-
// top = options.top
|
|
100
|
-
// }
|
|
101
|
-
|
|
102
|
-
// if (options.duration !== undefined) {
|
|
103
|
-
// defaultDuration = options.duration
|
|
104
|
-
// }
|
|
105
|
-
// },
|
|
106
|
-
|
|
107
|
-
destroy () {
|
|
108
|
-
if (!MGInstance) return
|
|
109
|
-
MGInstance.destroy()
|
|
110
|
-
MGInstance = null
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
export default Message
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { defineComponent, computed, onMounted, onBeforeUnmount, inject, PropType } from 'vue'
|
|
2
|
-
import Spinner from '../spinner'
|
|
3
|
-
import type { MessageProps } from './types'
|
|
4
|
-
|
|
5
|
-
const prefixCls = 'dpzvc3-message'
|
|
6
|
-
|
|
7
|
-
export default defineComponent({
|
|
8
|
-
name: 'DpzMessage',
|
|
9
|
-
props: {
|
|
10
|
-
name: {
|
|
11
|
-
type: [String, Number] as PropType<string | number>,
|
|
12
|
-
required: true
|
|
13
|
-
},
|
|
14
|
-
text: {
|
|
15
|
-
type: [String, Number] as PropType<string | number>,
|
|
16
|
-
default: ''
|
|
17
|
-
},
|
|
18
|
-
duration: {
|
|
19
|
-
type: Number,
|
|
20
|
-
default: 1.5
|
|
21
|
-
},
|
|
22
|
-
showLeft: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: false
|
|
25
|
-
},
|
|
26
|
-
rightHide: {
|
|
27
|
-
type: Boolean,
|
|
28
|
-
default: true
|
|
29
|
-
},
|
|
30
|
-
type: {
|
|
31
|
-
type: String as PropType<MessageProps['type']>,
|
|
32
|
-
default: 'normal'
|
|
33
|
-
},
|
|
34
|
-
onClose: {
|
|
35
|
-
type: Function as PropType<() => void>,
|
|
36
|
-
default: () => {}
|
|
37
|
-
},
|
|
38
|
-
position: {
|
|
39
|
-
type: String as PropType<MessageProps['position']>,
|
|
40
|
-
default: 'top'
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
setup(props) {
|
|
44
|
-
/** 🔑 从 MessageGroup 注入 remove 方法 */
|
|
45
|
-
const remove = inject<(name: string | number) => void>('removeMessage')
|
|
46
|
-
|
|
47
|
-
let timer: number | null = null
|
|
48
|
-
|
|
49
|
-
const classes = computed(() => [prefixCls, `${prefixCls}-position-${props.position}`])
|
|
50
|
-
const wrapperClasses = computed(() => [`${prefixCls}-text`])
|
|
51
|
-
const leftClasses = computed(() => [`${prefixCls}-left`])
|
|
52
|
-
const rightClasses = computed(() => [`${prefixCls}-right`])
|
|
53
|
-
|
|
54
|
-
const closeTimer = () => {
|
|
55
|
-
if (timer) {
|
|
56
|
-
clearTimeout(timer)
|
|
57
|
-
timer = null
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const close = () => {
|
|
62
|
-
closeTimer()
|
|
63
|
-
remove?.(props.name)
|
|
64
|
-
props.onClose?.()
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
onMounted(() => {
|
|
68
|
-
closeTimer()
|
|
69
|
-
if (props.duration !== 0) {
|
|
70
|
-
timer = window.setTimeout(() => {
|
|
71
|
-
close()
|
|
72
|
-
}, props.duration * 1000)
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
onBeforeUnmount(() => {
|
|
77
|
-
closeTimer()
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
return () => (
|
|
81
|
-
<div class={classes.value}>
|
|
82
|
-
{props.showLeft && (
|
|
83
|
-
<div class={leftClasses.value}>
|
|
84
|
-
<slot name="message-left">
|
|
85
|
-
<Spinner size="65" type="blade" color="#ffffff" />
|
|
86
|
-
</slot>
|
|
87
|
-
</div>
|
|
88
|
-
)}
|
|
89
|
-
|
|
90
|
-
<p class={wrapperClasses.value}>{props.text}</p>
|
|
91
|
-
|
|
92
|
-
{!props.rightHide && (
|
|
93
|
-
<div class={rightClasses.value}>
|
|
94
|
-
<slot name="message-right" />
|
|
95
|
-
</div>
|
|
96
|
-
)}
|
|
97
|
-
</div>
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
})
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, provide, PropType } from 'vue'
|
|
2
|
-
import Message from './message'
|
|
3
|
-
import type { MessageProps } from './types' // 引入类型
|
|
4
|
-
|
|
5
|
-
export default defineComponent({
|
|
6
|
-
name: 'MessageGroup',
|
|
7
|
-
props: {
|
|
8
|
-
styles: {
|
|
9
|
-
type: Object as PropType<Record<string, any>>,
|
|
10
|
-
default: () => ({})
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
setup(props, { expose }) {
|
|
14
|
-
const messages = ref<MessageProps[]>([])
|
|
15
|
-
|
|
16
|
-
const add = (msgProps: Partial<MessageProps> = {}) => {
|
|
17
|
-
const message: MessageProps = {
|
|
18
|
-
name: '',
|
|
19
|
-
text: '',
|
|
20
|
-
duration: 1.5,
|
|
21
|
-
showLeft: false,
|
|
22
|
-
rightHide: true,
|
|
23
|
-
type: 'normal',
|
|
24
|
-
position: 'top',
|
|
25
|
-
onClose: () => {},
|
|
26
|
-
...msgProps
|
|
27
|
-
}
|
|
28
|
-
// alert(1)
|
|
29
|
-
messages.value.push(message)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const remove = (name: string) => {
|
|
33
|
-
messages.value = messages.value.filter(item => item.name !== name)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const closeAll = () => {
|
|
37
|
-
messages.value = []
|
|
38
|
-
}
|
|
39
|
-
provide('removeMessage', remove)
|
|
40
|
-
expose({add, closeAll, remove})
|
|
41
|
-
return () => (
|
|
42
|
-
<div class="dpzvc3-message-group" style={props.styles}>
|
|
43
|
-
{messages.value.map(message => (
|
|
44
|
-
<Message
|
|
45
|
-
key={message.name}
|
|
46
|
-
name={message.name}
|
|
47
|
-
text={message.text}
|
|
48
|
-
duration={message.duration}
|
|
49
|
-
show-left={message.showLeft}
|
|
50
|
-
right-hide={message.rightHide}
|
|
51
|
-
type={message.type}
|
|
52
|
-
position={message.position}
|
|
53
|
-
on-close={message.onClose}
|
|
54
|
-
/>
|
|
55
|
-
))}
|
|
56
|
-
</div>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
})
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// export interface MessageItem {
|
|
2
|
-
// name: string
|
|
3
|
-
// text: string
|
|
4
|
-
// duration?: number
|
|
5
|
-
// showLeft?: boolean
|
|
6
|
-
// rightHide?: boolean
|
|
7
|
-
// type?: 'normal' | 'success' | 'error' | 'warning'
|
|
8
|
-
// position?: 'top' | 'bottom'
|
|
9
|
-
// onClose?: () => void
|
|
10
|
-
|
|
11
|
-
import type { ComponentPublicInstance } from 'vue'
|
|
12
|
-
|
|
13
|
-
// }
|
|
14
|
-
export interface MessageProps {
|
|
15
|
-
name?: string | number
|
|
16
|
-
text?: string | number
|
|
17
|
-
duration?: number
|
|
18
|
-
showLeft?: boolean
|
|
19
|
-
rightHide?: boolean
|
|
20
|
-
type?: 'success' | 'loading' | 'error' | 'normal' | 'warning' | 'danger'
|
|
21
|
-
position?: 'top' | 'bottom'
|
|
22
|
-
onClose?: () => void
|
|
23
|
-
}
|
|
24
|
-
// type stylesOptions = "left" | "top"
|
|
25
|
-
export type MergeMessageOptions<T = MessageProps> = {
|
|
26
|
-
[K in keyof T]: T[K]
|
|
27
|
-
} & {
|
|
28
|
-
loading?: boolean,
|
|
29
|
-
styles?: Record<string, any>
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// message实例
|
|
33
|
-
export type MessageInstance = {
|
|
34
|
-
show: (options:MergeMessageOptions) => any
|
|
35
|
-
success: (options:MergeMessageOptions) => any
|
|
36
|
-
error: (options: MergeMessageOptions) => any
|
|
37
|
-
loading: (options: MergeMessageOptions) => any
|
|
38
|
-
// config: (options: MergeMessageOptions) => void
|
|
39
|
-
destroy: () => void
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export type MgInstance = {
|
|
43
|
-
add: (options: any) => void
|
|
44
|
-
remove: (name: string | number) => void
|
|
45
|
-
closeAll: () => void
|
|
46
|
-
component: ComponentPublicInstance
|
|
47
|
-
destroy: () => void
|
|
48
|
-
} | null
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* confirm.js - Vue 3 版本(修复 enter 过渡)
|
|
3
|
-
*/
|
|
4
|
-
import { h, createVNode, render } from 'vue'
|
|
5
|
-
import Modal from './modal'
|
|
6
|
-
import VButton from '../button'
|
|
7
|
-
// import type { ModalInstance } from './types'
|
|
8
|
-
const prefixCls = 'dpzvc3-modal'
|
|
9
|
-
|
|
10
|
-
function createModalInstance (properties = {}) {
|
|
11
|
-
const container = document.createElement('div')
|
|
12
|
-
document.body.appendChild(container)
|
|
13
|
-
|
|
14
|
-
let vnode = null
|
|
15
|
-
|
|
16
|
-
const defaultProps = {
|
|
17
|
-
// visible: false,
|
|
18
|
-
modelValue: false,
|
|
19
|
-
width: '70%',
|
|
20
|
-
body: '',
|
|
21
|
-
title: '',
|
|
22
|
-
okText: '确定',
|
|
23
|
-
cancleText: '取消',
|
|
24
|
-
loading: false,
|
|
25
|
-
buttonLoading: false,
|
|
26
|
-
showCancle: true,
|
|
27
|
-
showHead: true,
|
|
28
|
-
onOk: () => {},
|
|
29
|
-
onCancle: () => {},
|
|
30
|
-
onRemove: () => {}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const props = { ...defaultProps, ...properties }
|
|
34
|
-
|
|
35
|
-
const updateVNode = () => {
|
|
36
|
-
const footer = [
|
|
37
|
-
props.showCancle
|
|
38
|
-
? h(VButton, { type: 'primary', radius: false, onClick: cancle }, () => props.cancleText)
|
|
39
|
-
: null,
|
|
40
|
-
h(
|
|
41
|
-
VButton,
|
|
42
|
-
{ type: 'normal', radius: false, loading: props.buttonLoading, onClick: ok },
|
|
43
|
-
() => props.okText
|
|
44
|
-
)
|
|
45
|
-
]
|
|
46
|
-
|
|
47
|
-
vnode = createVNode(
|
|
48
|
-
Modal,
|
|
49
|
-
{
|
|
50
|
-
modelValue: props.modelValue,
|
|
51
|
-
width: props.width,
|
|
52
|
-
showHead: props.showHead,
|
|
53
|
-
footerHide: false,
|
|
54
|
-
onOk: ok,
|
|
55
|
-
onCancle: cancle
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
header: () =>
|
|
59
|
-
h('div', {
|
|
60
|
-
class: `${prefixCls}-header-inner ellipse-fir`,
|
|
61
|
-
innerHTML: props.title
|
|
62
|
-
}),
|
|
63
|
-
body: () =>
|
|
64
|
-
h('div', {
|
|
65
|
-
class: `${prefixCls}-body-inner`,
|
|
66
|
-
innerHTML: props.body
|
|
67
|
-
}),
|
|
68
|
-
footer: () => footer
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
render(vnode, container)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const remove = () => {
|
|
76
|
-
props.modelValue = false
|
|
77
|
-
updateVNode()
|
|
78
|
-
setTimeout(destroy, 300)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const destroy = () => {
|
|
82
|
-
render(null, container)
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
84
|
-
container.parentNode && container.parentNode.removeChild(container)
|
|
85
|
-
props.onRemove()
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const ok = () => {
|
|
89
|
-
if (props.loading) {
|
|
90
|
-
props.buttonLoading = true
|
|
91
|
-
} else {
|
|
92
|
-
remove()
|
|
93
|
-
}
|
|
94
|
-
props.onOk()
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const cancle = () => {
|
|
98
|
-
remove()
|
|
99
|
-
props.onCancle()
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
show (newProps = {}) {
|
|
104
|
-
Object.assign(props, newProps)
|
|
105
|
-
|
|
106
|
-
// 👇 关键:先 render hidden
|
|
107
|
-
props.modelValue = false
|
|
108
|
-
updateVNode()
|
|
109
|
-
|
|
110
|
-
// 👇 下一帧再显示,触发 enter
|
|
111
|
-
requestAnimationFrame(() => {
|
|
112
|
-
props.modelValue = true
|
|
113
|
-
updateVNode()
|
|
114
|
-
})
|
|
115
|
-
},
|
|
116
|
-
remove,
|
|
117
|
-
component: props
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// const ModalMethods:ModalInstance = {
|
|
121
|
-
// newInstance: createModalInstance,
|
|
122
|
-
// }
|
|
123
|
-
export { createModalInstance }
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* index.js - Vue 3 版本
|
|
3
|
-
*/
|
|
4
|
-
import {createModalInstance } from './confirm'
|
|
5
|
-
import type { MergeOptions,DefaultProps, ModalInstance } from './types'
|
|
6
|
-
let modalInstance:DefaultProps
|
|
7
|
-
|
|
8
|
-
function getModalInstance () {
|
|
9
|
-
if (!modalInstance) {
|
|
10
|
-
modalInstance = createModalInstance({
|
|
11
|
-
showHead: true,
|
|
12
|
-
// closable: true,
|
|
13
|
-
maskClosable: false,
|
|
14
|
-
footerHide: false
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
return modalInstance
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function confirm (options: MergeOptions) {
|
|
21
|
-
const instance = getModalInstance()
|
|
22
|
-
|
|
23
|
-
options.onRemove = () => {
|
|
24
|
-
modalInstance = null
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
instance!.show(options)
|
|
28
|
-
return instance
|
|
29
|
-
}
|
|
30
|
-
const Modal: ModalInstance = {
|
|
31
|
-
info: (props: MergeOptions) => {
|
|
32
|
-
props.showCancle = true
|
|
33
|
-
props.showHead = false
|
|
34
|
-
return confirm(props)
|
|
35
|
-
},
|
|
36
|
-
confirm: (props: MergeOptions) => {
|
|
37
|
-
props.showCancle = false
|
|
38
|
-
props.showHead = false
|
|
39
|
-
return confirm(props)
|
|
40
|
-
},
|
|
41
|
-
remove: () => {
|
|
42
|
-
if (!modalInstance) return false
|
|
43
|
-
const instance = getModalInstance()
|
|
44
|
-
instance!.remove()
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
// info 模态框,显示取消按钮
|
|
48
|
-
// Modal.info = function (props: MergeOptions) {
|
|
49
|
-
// props.showCancle = true
|
|
50
|
-
// props.showHead = false
|
|
51
|
-
// return confirm(props)
|
|
52
|
-
// }
|
|
53
|
-
|
|
54
|
-
// confirm 模态框,不显示取消按钮
|
|
55
|
-
// Modal.confirm = function (props: MergeOptions) {
|
|
56
|
-
// props.showCancle = false
|
|
57
|
-
// props.showHead = false
|
|
58
|
-
// return confirm(props)
|
|
59
|
-
// }
|
|
60
|
-
|
|
61
|
-
// 移除当前 modal
|
|
62
|
-
// Modal.remove = function () {
|
|
63
|
-
// if (!modalInstance) return false
|
|
64
|
-
// const instance = getModalInstance()
|
|
65
|
-
// instance!.remove()
|
|
66
|
-
// }
|
|
67
|
-
|
|
68
|
-
export default Modal
|