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,191 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="classes">
|
|
3
|
-
<div class="header">
|
|
4
|
-
<div
|
|
5
|
-
class="left"
|
|
6
|
-
@click="cancle"
|
|
7
|
-
>
|
|
8
|
-
取消
|
|
9
|
-
</div>
|
|
10
|
-
<div
|
|
11
|
-
class="right"
|
|
12
|
-
@click="sure"
|
|
13
|
-
>
|
|
14
|
-
确定
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<div class="main">
|
|
19
|
-
<PickerSlot
|
|
20
|
-
v-if="year"
|
|
21
|
-
:list="yearList"
|
|
22
|
-
:init-item="date.year.code"
|
|
23
|
-
target="year"
|
|
24
|
-
@change="change"
|
|
25
|
-
/>
|
|
26
|
-
<PickerSlot
|
|
27
|
-
v-if="month"
|
|
28
|
-
:list="monthList"
|
|
29
|
-
:init-item="date.month.code"
|
|
30
|
-
target="month"
|
|
31
|
-
@change="change"
|
|
32
|
-
/>
|
|
33
|
-
<PickerSlot
|
|
34
|
-
v-if="day"
|
|
35
|
-
:list="dayList"
|
|
36
|
-
:init-item="date.day.code"
|
|
37
|
-
target="day"
|
|
38
|
-
@change="change"
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<script>
|
|
45
|
-
import { defineComponent, ref, computed, watch, inject } from 'vue'
|
|
46
|
-
import PickerSlot from '../picker-slot.vue'
|
|
47
|
-
import props from './props'
|
|
48
|
-
|
|
49
|
-
const DAYS = {
|
|
50
|
-
30: [4, 6, 9, 11],
|
|
51
|
-
31: [1, 3, 5, 7, 8, 10, 12]
|
|
52
|
-
}
|
|
53
|
-
const prefixCls = 'dpzvc3-date-picker'
|
|
54
|
-
|
|
55
|
-
export default defineComponent({
|
|
56
|
-
name: 'DatePicker',
|
|
57
|
-
components: { PickerSlot },
|
|
58
|
-
props: {
|
|
59
|
-
...props,
|
|
60
|
-
dateValue: String,
|
|
61
|
-
year: [Boolean, Array],
|
|
62
|
-
month: [Boolean, Array],
|
|
63
|
-
day: [Boolean, Array],
|
|
64
|
-
valueSeparator: { type: String, default: '-' }
|
|
65
|
-
},
|
|
66
|
-
setup (props, { emit }) {
|
|
67
|
-
const { pickerOnOk, pickeronFail } = inject('DpzVc3Picker')
|
|
68
|
-
const currentValue = ref(props.dateValue || '')
|
|
69
|
-
|
|
70
|
-
const date = ref({
|
|
71
|
-
year: { code: new Date().getFullYear(), value: String(new Date().getFullYear()), target: 'year', index: 0 },
|
|
72
|
-
month: { code: new Date().getMonth() + 1, value: String(new Date().getMonth() + 1), target: 'month', index: 0 },
|
|
73
|
-
day: { code: new Date().getDate(), value: String(new Date().getDate()), target: 'day', index: 0 },
|
|
74
|
-
formatDate: ''
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
const classes = computed(() => [prefixCls])
|
|
78
|
-
|
|
79
|
-
const yearList = computed(() => {
|
|
80
|
-
if (!props.year) return []
|
|
81
|
-
let from = 1900
|
|
82
|
-
let to = new Date().getFullYear()
|
|
83
|
-
if (Array.isArray(props.year)) {
|
|
84
|
-
from = props.year[0] ?? from
|
|
85
|
-
to = props.year[1] ?? to
|
|
86
|
-
}
|
|
87
|
-
const list = []
|
|
88
|
-
for (let i = from, index = 0; i <= to; i++, index++) {
|
|
89
|
-
list.push({ code: i, value: String(i), target: 'year', index })
|
|
90
|
-
}
|
|
91
|
-
return list
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
const monthList = computed(() => {
|
|
95
|
-
if (!props.month) return []
|
|
96
|
-
let from = 1
|
|
97
|
-
let to = 12
|
|
98
|
-
if (Array.isArray(props.month)) {
|
|
99
|
-
from = props.month[0] ?? from
|
|
100
|
-
to = props.month[1] ?? to
|
|
101
|
-
}
|
|
102
|
-
const list = []
|
|
103
|
-
for (let i = from, index = 0; i <= to; i++, index++) {
|
|
104
|
-
list.push({ code: i, value: String(i), target: 'month', index })
|
|
105
|
-
}
|
|
106
|
-
return list
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
const dayList = computed(() => {
|
|
110
|
-
if (!props.day) return []
|
|
111
|
-
let from = 1
|
|
112
|
-
let to = 31
|
|
113
|
-
|
|
114
|
-
const month = Number(date.value.month.value)
|
|
115
|
-
const year = Number(date.value.year.code)
|
|
116
|
-
|
|
117
|
-
if (DAYS[30].includes(month)) to = 30
|
|
118
|
-
else if (DAYS[31].includes(month)) to = 31
|
|
119
|
-
else {
|
|
120
|
-
// 二月
|
|
121
|
-
if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) to = 29
|
|
122
|
-
else to = 28
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (Array.isArray(props.day)) {
|
|
126
|
-
from = props.day[0] ?? from
|
|
127
|
-
to = props.day[1] ?? to
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const list = []
|
|
131
|
-
for (let i = from, index = 0; i <= to; i++, index++) {
|
|
132
|
-
list.push({ code: i, value: String(i), target: 'day', index })
|
|
133
|
-
}
|
|
134
|
-
return list
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
watch(() => props.dateValue, (val) => {
|
|
138
|
-
currentValue.value = val
|
|
139
|
-
initVal()
|
|
140
|
-
}, { immediate: true })
|
|
141
|
-
|
|
142
|
-
function initVal () {
|
|
143
|
-
if (!currentValue.value) return
|
|
144
|
-
const [y = '', m = '', d = ''] = currentValue.value.split(props.valueSeparator)
|
|
145
|
-
if (props.year) date.value.year = { ...date.value.year, code: Number(y), value: y }
|
|
146
|
-
if (props.month) date.value.month = { ...date.value.month, code: Number(m), value: m }
|
|
147
|
-
if (props.day) date.value.day = { ...date.value.day, code: Number(d), value: d }
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function cancle () {
|
|
151
|
-
// emit('cancle')
|
|
152
|
-
pickeronFail()
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function sure () {
|
|
156
|
-
date.value.formatDate = [date.value.year.value, date.value.month.value, date.value.day.value]
|
|
157
|
-
.filter(Boolean)
|
|
158
|
-
.join(props.valueSeparator)
|
|
159
|
-
// emit('sure', date.value)
|
|
160
|
-
pickerOnOk(date.value)
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function change (target, current) {
|
|
164
|
-
if (target === 'year') date.value.year = { ...date.value.year, ...current }
|
|
165
|
-
if (target === 'month') date.value.month = { ...date.value.month, ...current }
|
|
166
|
-
if (target === 'day') date.value.day = { ...date.value.day, ...current }
|
|
167
|
-
|
|
168
|
-
date.value.formatDate = [date.value.year.value, date.value.month.value, date.value.day.value]
|
|
169
|
-
.filter(Boolean)
|
|
170
|
-
.join(props.valueSeparator)
|
|
171
|
-
|
|
172
|
-
emit('change', target, current)
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return {
|
|
176
|
-
classes,
|
|
177
|
-
date,
|
|
178
|
-
yearList,
|
|
179
|
-
monthList,
|
|
180
|
-
dayList,
|
|
181
|
-
cancle,
|
|
182
|
-
sure,
|
|
183
|
-
change
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
})
|
|
187
|
-
</script>
|
|
188
|
-
|
|
189
|
-
<style lang="less">
|
|
190
|
-
|
|
191
|
-
</style>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by yishide on 2025/9/13.
|
|
3
|
-
*/
|
|
4
|
-
export default {
|
|
5
|
-
props: {
|
|
6
|
-
dateValue: String,
|
|
7
|
-
year: {
|
|
8
|
-
type: [Boolean, Array],
|
|
9
|
-
default: true
|
|
10
|
-
},
|
|
11
|
-
month: {
|
|
12
|
-
type: [Boolean, Array],
|
|
13
|
-
default: true
|
|
14
|
-
},
|
|
15
|
-
day: {
|
|
16
|
-
type: [Boolean, Array],
|
|
17
|
-
default: true
|
|
18
|
-
},
|
|
19
|
-
valueSeparator: {
|
|
20
|
-
type: String,
|
|
21
|
-
default: '/'
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by admin on 2025/11/19.
|
|
3
|
-
*/
|
|
4
|
-
import type { App } from 'vue'
|
|
5
|
-
import Picker from './picker'
|
|
6
|
-
Picker.install = (app: App): void => {
|
|
7
|
-
app.component('Picker', Picker); // 注册全局组件
|
|
8
|
-
}
|
|
9
|
-
type IWithInstall<T> = T & { install(app: App): void };
|
|
10
|
-
const _Picker=Picker as IWithInstall<typeof Picker>;
|
|
11
|
-
export default _Picker
|
|
12
|
-
export type { PickerProps } from './types'
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="classes">
|
|
3
|
-
<div class="header">
|
|
4
|
-
<div
|
|
5
|
-
class="left"
|
|
6
|
-
@click="cancle"
|
|
7
|
-
>
|
|
8
|
-
取消
|
|
9
|
-
</div>
|
|
10
|
-
<div
|
|
11
|
-
class="right"
|
|
12
|
-
@click="sure"
|
|
13
|
-
>
|
|
14
|
-
确定
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
<div class="main">
|
|
18
|
-
<PickerSlot
|
|
19
|
-
v-for="(item, key) in shadowList"
|
|
20
|
-
:key="item.target"
|
|
21
|
-
:target="item.target"
|
|
22
|
-
:init-item="initItems[key]"
|
|
23
|
-
:list="item.list"
|
|
24
|
-
@change="change"
|
|
25
|
-
/>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
</template>
|
|
29
|
-
|
|
30
|
-
<script>
|
|
31
|
-
import { defineComponent, ref, computed, watch, inject } from 'vue'
|
|
32
|
-
import PickerSlot from '../picker-slot.vue'
|
|
33
|
-
|
|
34
|
-
const prefixCls = 'dpzvc3-normal-picker'
|
|
35
|
-
|
|
36
|
-
export default defineComponent({
|
|
37
|
-
name: 'NormalPicker',
|
|
38
|
-
components: { PickerSlot },
|
|
39
|
-
props: {
|
|
40
|
-
list: { type: Array, default: () => [] },
|
|
41
|
-
initArr: { type: Array, default: () => [] }
|
|
42
|
-
},
|
|
43
|
-
setup (props, { emit }) {
|
|
44
|
-
const { pickerOnOk, pickeronFail } = inject('DpzVc3Picker')
|
|
45
|
-
|
|
46
|
-
/** 初始化选中项 */
|
|
47
|
-
const initItems = ref(
|
|
48
|
-
props.initArr.length
|
|
49
|
-
? [...props.initArr]
|
|
50
|
-
: props.list.map(item => item.list?.[0]?.code ?? '')
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
const normal = ref({})
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* ⚠️ 关键修复点:
|
|
57
|
-
* - 不修改 props.list
|
|
58
|
-
* - 返回全新对象
|
|
59
|
-
*/
|
|
60
|
-
const shadowList = computed(() => {
|
|
61
|
-
return props.list.map(item => {
|
|
62
|
-
const list = (item.list || []).map((child, index) => ({
|
|
63
|
-
code: child.code ?? child.value,
|
|
64
|
-
value: child.value,
|
|
65
|
-
target: child.target ?? item.target,
|
|
66
|
-
index
|
|
67
|
-
}))
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
...item,
|
|
71
|
-
list
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
const classes = computed(() => [prefixCls])
|
|
77
|
-
|
|
78
|
-
watch(
|
|
79
|
-
() => props.initArr,
|
|
80
|
-
val => {
|
|
81
|
-
initItems.value =
|
|
82
|
-
val.length > 0
|
|
83
|
-
? [...val]
|
|
84
|
-
: props.list.map(item => item.list?.[0]?.code ?? '')
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
function cancle () {
|
|
89
|
-
pickeronFail()
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function sure () {
|
|
93
|
-
pickerOnOk(normal.value)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function change (target, current) {
|
|
97
|
-
const index = shadowList.value.findIndex(i => i.target === target)
|
|
98
|
-
if (index !== -1) {
|
|
99
|
-
initItems.value[index] = current.code
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
normal.value = {
|
|
103
|
-
...normal.value,
|
|
104
|
-
[target]: current
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
emit('scroll', current)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return {
|
|
111
|
-
classes,
|
|
112
|
-
shadowList,
|
|
113
|
-
initItems,
|
|
114
|
-
cancle,
|
|
115
|
-
sure,
|
|
116
|
-
change
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
</script>
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
:class="classes"
|
|
4
|
-
:style="getStyles"
|
|
5
|
-
>
|
|
6
|
-
<ul
|
|
7
|
-
:class="draggingClass"
|
|
8
|
-
:style="{ transform: `translate3d(0,${translateY}px,0)` }"
|
|
9
|
-
@touchstart="_onTouchStart"
|
|
10
|
-
@touchmove="_onTouchMove"
|
|
11
|
-
@touchend="_onTouchEnd"
|
|
12
|
-
>
|
|
13
|
-
<!-- 上方占位 -->
|
|
14
|
-
<li :style="{ height: height + 'px' }" />
|
|
15
|
-
<li :style="{ height: height + 'px' }" />
|
|
16
|
-
|
|
17
|
-
<!-- 数据列表 -->
|
|
18
|
-
<li
|
|
19
|
-
v-for="(item, index) in list"
|
|
20
|
-
:key="index"
|
|
21
|
-
:class="{
|
|
22
|
-
current: index === current.index,
|
|
23
|
-
level_1_1: index - current.index === 1,
|
|
24
|
-
level_2_1: index - current.index === 2,
|
|
25
|
-
level_3_1: index - current.index >= 3,
|
|
26
|
-
level_1: index - current.index === -1,
|
|
27
|
-
level_2: index - current.index === -2,
|
|
28
|
-
level_3: index - current.index <= -3
|
|
29
|
-
}"
|
|
30
|
-
:style="{ textAlign: align, height: height + 'px' }"
|
|
31
|
-
>
|
|
32
|
-
{{ item.value }}
|
|
33
|
-
</li>
|
|
34
|
-
|
|
35
|
-
<!-- 下方占位 -->
|
|
36
|
-
<li :style="{ height: height + 'px' }" />
|
|
37
|
-
<li :style="{ height: height + 'px' }" />
|
|
38
|
-
</ul>
|
|
39
|
-
</div>
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<script>
|
|
43
|
-
import { defineComponent, ref, computed, watch, onMounted } from 'vue'
|
|
44
|
-
|
|
45
|
-
export default defineComponent({
|
|
46
|
-
name: 'PickerSlot',
|
|
47
|
-
props: {
|
|
48
|
-
styles: Object,
|
|
49
|
-
list: {
|
|
50
|
-
type: Array,
|
|
51
|
-
default: () => []
|
|
52
|
-
},
|
|
53
|
-
align: {
|
|
54
|
-
type: String,
|
|
55
|
-
default: 'center'
|
|
56
|
-
},
|
|
57
|
-
target: {
|
|
58
|
-
type: String,
|
|
59
|
-
required: true
|
|
60
|
-
},
|
|
61
|
-
initItem: {
|
|
62
|
-
type: [String, Number],
|
|
63
|
-
default: ''
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
setup (props, { emit }) {
|
|
67
|
-
const count = 7
|
|
68
|
-
const height = ref(35)
|
|
69
|
-
const current = ref({})
|
|
70
|
-
const translateY = ref(0)
|
|
71
|
-
const currentTranslateY = ref(0)
|
|
72
|
-
const dragging = ref(false)
|
|
73
|
-
const startX = ref(0)
|
|
74
|
-
const startY = ref(0)
|
|
75
|
-
const delta = ref({ x: 0, y: 0 })
|
|
76
|
-
|
|
77
|
-
const classes = computed(() => ['dpzvc3-picker-slot'])
|
|
78
|
-
const draggingClass = computed(() => ({
|
|
79
|
-
'dpzvc3-picker-slot-dragging': dragging.value
|
|
80
|
-
}))
|
|
81
|
-
|
|
82
|
-
const wrapperHeight = computed(() => count * height.value)
|
|
83
|
-
|
|
84
|
-
const getStyles = ref({})
|
|
85
|
-
const updateStyles = () => {
|
|
86
|
-
const styles = { ...props.styles }
|
|
87
|
-
if (styles.height) {
|
|
88
|
-
height.value = styles.height / count
|
|
89
|
-
}
|
|
90
|
-
getStyles.value = { ...styles, height: wrapperHeight.value + 'px' }
|
|
91
|
-
}
|
|
92
|
-
const getSelectedIndex = () => {
|
|
93
|
-
const maxIndex = props.list.length - 1
|
|
94
|
-
let index = -Math.round(currentTranslateY.value / height.value)
|
|
95
|
-
index = Math.max(index, 0)
|
|
96
|
-
index = Math.min(index, maxIndex)
|
|
97
|
-
return index
|
|
98
|
-
}
|
|
99
|
-
// 初始化样式
|
|
100
|
-
updateStyles()
|
|
101
|
-
|
|
102
|
-
watch(
|
|
103
|
-
() => props.styles,
|
|
104
|
-
() => {
|
|
105
|
-
updateStyles()
|
|
106
|
-
},
|
|
107
|
-
{ deep: true }
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
// list 数据变化
|
|
111
|
-
watch(
|
|
112
|
-
() => props.list,
|
|
113
|
-
(list) => {
|
|
114
|
-
if (list.length) {
|
|
115
|
-
let index = getSelectedIndex()
|
|
116
|
-
if (index > list.length - 1) index = 0
|
|
117
|
-
current.value = { ...current.value, ...list[index] }
|
|
118
|
-
emit('change', props.target, current.value)
|
|
119
|
-
} else {
|
|
120
|
-
translateY.value = 0
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
{ immediate: true }
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
const setSelectedItem = (index) => {
|
|
127
|
-
translateY.value = currentTranslateY.value = -index * height.value
|
|
128
|
-
try {
|
|
129
|
-
if (
|
|
130
|
-
current.value.code === props.list[index].code &&
|
|
131
|
-
current.value.value === props.list[index].value
|
|
132
|
-
) {
|
|
133
|
-
return
|
|
134
|
-
}
|
|
135
|
-
current.value = {
|
|
136
|
-
code: props.list[index].code,
|
|
137
|
-
value: props.list[index].value,
|
|
138
|
-
target: props.target,
|
|
139
|
-
index
|
|
140
|
-
}
|
|
141
|
-
} catch (e) {
|
|
142
|
-
current.value = { code: '', value: '', target: props.target, index: '' }
|
|
143
|
-
}
|
|
144
|
-
emit('change', props.target, current.value)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const scrollToItem = (code) => {
|
|
148
|
-
props.list.forEach((item, i) => {
|
|
149
|
-
if (item.code === code) {
|
|
150
|
-
currentTranslateY.value = translateY.value
|
|
151
|
-
setSelectedItem(i)
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const _onTouchStart = (e) => {
|
|
157
|
-
e.preventDefault()
|
|
158
|
-
e.stopPropagation()
|
|
159
|
-
currentTranslateY.value = translateY.value
|
|
160
|
-
startX.value = e.touches[0].pageX
|
|
161
|
-
startY.value = e.touches[0].pageY
|
|
162
|
-
dragging.value = true
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const _onTouchMove = (e) => {
|
|
166
|
-
e.preventDefault()
|
|
167
|
-
e.stopPropagation()
|
|
168
|
-
delta.value.x = e.touches[0].pageX - startX.value
|
|
169
|
-
delta.value.y = e.touches[0].pageY - startY.value
|
|
170
|
-
translateY.value = delta.value.y + currentTranslateY.value
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const _onTouchEnd = (e) => {
|
|
174
|
-
e.preventDefault()
|
|
175
|
-
e.stopPropagation()
|
|
176
|
-
dragging.value = false
|
|
177
|
-
currentTranslateY.value = translateY.value
|
|
178
|
-
const index = getSelectedIndex()
|
|
179
|
-
setSelectedItem(index)
|
|
180
|
-
}
|
|
181
|
-
// initItem 变化
|
|
182
|
-
watch(
|
|
183
|
-
() => props.initItem,
|
|
184
|
-
(value) => {
|
|
185
|
-
if (value === '' || value === null) {
|
|
186
|
-
current.value = { code: '', target: props.target, index: '', value: '' }
|
|
187
|
-
emit('change', props.target, current.value)
|
|
188
|
-
} else {
|
|
189
|
-
scrollToItem(value)
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
{ immediate: true }
|
|
193
|
-
)
|
|
194
|
-
|
|
195
|
-
onMounted(() => {
|
|
196
|
-
if (!props.initItem && props.initItem !== 0) {
|
|
197
|
-
current.value = { code: '', target: props.target, index: '', value: '' }
|
|
198
|
-
emit('change', props.target, current.value)
|
|
199
|
-
} else {
|
|
200
|
-
scrollToItem(props.initItem)
|
|
201
|
-
}
|
|
202
|
-
})
|
|
203
|
-
return {
|
|
204
|
-
classes,
|
|
205
|
-
draggingClass,
|
|
206
|
-
translateY,
|
|
207
|
-
height,
|
|
208
|
-
current,
|
|
209
|
-
_onTouchStart,
|
|
210
|
-
_onTouchMove,
|
|
211
|
-
_onTouchEnd,
|
|
212
|
-
getStyles,
|
|
213
|
-
getSelectedIndex
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
})
|
|
217
|
-
</script>
|