vxe-pc-ui 4.1.19 → 4.1.21
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 +83 -2
- package/es/anchor/src/anchor-link.js +1 -1
- package/es/anchor/src/anchor.js +1 -1
- package/es/breadcrumb/src/breadcrumb.js +1 -1
- package/es/button/src/button-group.js +4 -1
- package/es/button/src/button.js +2 -1
- package/es/calendar/src/calendar.js +64 -32
- package/es/card/src/card.js +4 -3
- package/es/carousel/src/carousel-item.js +13 -3
- package/es/carousel/src/carousel.js +16 -8
- package/es/checkbox/src/checkbox.js +30 -14
- package/es/checkbox/src/group.js +17 -8
- package/es/collapse-pane/index.js +1 -1
- package/es/countdown/src/countdown.js +17 -8
- package/es/date-picker/src/date-picker.js +148 -69
- package/es/drawer/src/drawer.js +86 -46
- package/es/form/render/index.js +1 -2
- package/es/form/src/form-config-item.js +4 -3
- package/es/form/src/form-gather.js +5 -3
- package/es/form/src/form-item.js +15 -10
- package/es/form/src/form.js +11 -8
- package/es/form/src/render.js +2 -1
- package/es/form/src/util.js +2 -1
- package/es/icon/src/icon.js +3 -0
- package/es/icon/style.css +1 -1
- package/es/icon-picker/src/icon-picker.js +24 -11
- package/es/image/src/group.js +4 -1
- package/es/image/src/preview.js +1 -1
- package/es/input/src/input.js +131 -66
- package/es/layout-aside/src/layout-aside.js +1 -1
- package/es/list/src/list.js +7 -5
- package/es/list-design/src/list-design.js +1 -1
- package/es/list-design/src/list-view.js +1 -1
- package/es/loading/src/loading.js +4 -1
- package/es/menu/src/menu.js +4 -3
- package/es/number-input/src/number-input.js +100 -77
- package/es/pager/src/pager.js +85 -45
- package/es/password-input/src/password-input.js +2 -2
- package/es/print/src/page-break.js +11 -2
- package/es/print/src/print.js +6 -4
- package/es/pulldown/src/pulldown.js +19 -13
- package/es/radio/src/button.js +2 -2
- package/es/radio/src/group.js +8 -4
- package/es/row/src/row.js +1 -1
- package/es/select/src/optgroup.js +19 -10
- package/es/select/src/option.js +17 -9
- package/es/select/src/select.js +64 -41
- package/es/select/src/util.js +2 -2
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/tabs/src/tab-pane.js +13 -3
- package/es/tabs/src/tabs.js +57 -47
- package/es/textarea/src/textarea.js +28 -10
- package/es/tooltip/src/tooltip.js +107 -78
- package/es/tree/src/tree.js +6 -3
- package/es/tree-select/src/tree-select.js +18 -10
- package/es/ui/index.js +1 -7
- package/es/ui/src/log.js +1 -1
- package/es/upload/src/upload.js +5 -5
- package/lib/anchor/src/anchor-link.js +1 -1
- package/lib/anchor/src/anchor-link.min.js +1 -1
- package/lib/anchor/src/anchor.js +1 -1
- package/lib/anchor/src/anchor.min.js +1 -1
- package/lib/breadcrumb/src/breadcrumb.js +1 -1
- package/lib/breadcrumb/src/breadcrumb.min.js +1 -1
- package/lib/button/src/button-group.js +4 -1
- package/lib/button/src/button-group.min.js +1 -1
- package/lib/button/src/button.js +2 -1
- package/lib/button/src/button.min.js +1 -1
- package/lib/calendar/src/calendar.js +42 -24
- package/lib/calendar/src/calendar.min.js +1 -1
- package/lib/card/src/card.js +6 -5
- package/lib/card/src/card.min.js +1 -1
- package/lib/carousel/src/carousel-item.js +16 -3
- package/lib/carousel/src/carousel-item.min.js +1 -1
- package/lib/carousel/src/carousel.js +18 -8
- package/lib/carousel/src/carousel.min.js +1 -1
- package/lib/checkbox/src/checkbox.js +16 -12
- package/lib/checkbox/src/checkbox.min.js +1 -1
- package/lib/checkbox/src/group.js +10 -7
- package/lib/checkbox/src/group.min.js +1 -1
- package/lib/collapse-pane/index.js +1 -1
- package/lib/collapse-pane/index.min.js +1 -1
- package/lib/countdown/src/countdown.js +15 -7
- package/lib/countdown/src/countdown.min.js +1 -1
- package/lib/date-picker/src/date-picker.js +124 -62
- package/lib/date-picker/src/date-picker.min.js +1 -1
- package/lib/drawer/src/drawer.js +15 -30
- package/lib/drawer/src/drawer.min.js +1 -1
- package/lib/form/render/index.js +1 -4
- package/lib/form/render/index.min.js +1 -1
- package/lib/form/src/form-config-item.js +4 -5
- package/lib/form/src/form-config-item.min.js +1 -1
- package/lib/form/src/form-gather.js +11 -9
- package/lib/form/src/form-gather.min.js +1 -1
- package/lib/form/src/form-item.js +11 -12
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/form.js +7 -7
- package/lib/form/src/form.min.js +1 -1
- package/lib/form/src/render.js +2 -1
- package/lib/form/src/util.js +2 -1
- package/lib/icon/src/icon.js +3 -0
- package/lib/icon/src/icon.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/icon-picker/src/icon-picker.js +22 -12
- package/lib/icon-picker/src/icon-picker.min.js +1 -1
- package/lib/image/src/group.js +4 -1
- package/lib/image/src/group.min.js +1 -1
- package/lib/image/src/preview.js +1 -1
- package/lib/image/src/preview.min.js +1 -1
- package/lib/index.umd.js +884 -649
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +79 -51
- package/lib/input/src/input.min.js +1 -1
- package/lib/layout-aside/src/layout-aside.js +1 -1
- package/lib/layout-aside/src/layout-aside.min.js +1 -1
- package/lib/list/src/list.js +9 -5
- package/lib/list/src/list.min.js +1 -1
- package/lib/list-design/src/list-design.js +1 -1
- package/lib/list-design/src/list-design.min.js +1 -1
- package/lib/list-design/src/list-view.js +1 -1
- package/lib/list-design/src/list-view.min.js +1 -1
- package/lib/loading/src/loading.js +4 -1
- package/lib/loading/src/loading.min.js +1 -1
- package/lib/menu/src/menu.js +4 -3
- package/lib/menu/src/menu.min.js +1 -1
- package/lib/number-input/src/number-input.js +67 -69
- package/lib/number-input/src/number-input.min.js +1 -1
- package/lib/pager/src/pager.js +40 -39
- package/lib/pager/src/pager.min.js +1 -1
- package/lib/password-input/src/password-input.js +2 -2
- package/lib/print/src/page-break.js +14 -2
- package/lib/print/src/page-break.min.js +1 -1
- package/lib/print/src/print.js +8 -6
- package/lib/print/src/print.min.js +1 -1
- package/lib/pulldown/src/pulldown.js +19 -13
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/radio/src/button.js +2 -2
- package/lib/radio/src/group.js +8 -4
- package/lib/radio/src/group.min.js +1 -1
- package/lib/row/src/row.js +1 -1
- package/lib/row/src/row.min.js +1 -1
- package/lib/select/src/optgroup.js +12 -9
- package/lib/select/src/optgroup.min.js +1 -1
- package/lib/select/src/option.js +9 -7
- package/lib/select/src/option.min.js +1 -1
- package/lib/select/src/select.js +52 -41
- package/lib/select/src/select.min.js +1 -1
- package/lib/select/src/util.js +2 -2
- package/lib/select/src/util.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/tabs/src/tab-pane.js +16 -3
- package/lib/tabs/src/tab-pane.min.js +1 -1
- package/lib/tabs/src/tabs.js +62 -50
- package/lib/tabs/src/tabs.min.js +1 -1
- package/lib/textarea/src/textarea.js +4 -4
- package/lib/tooltip/src/tooltip.js +96 -88
- package/lib/tooltip/src/tooltip.min.js +1 -1
- package/lib/tree/src/tree.js +2 -2
- package/lib/tree/src/tree.min.js +1 -1
- package/lib/tree-select/src/tree-select.js +13 -8
- package/lib/tree-select/src/tree-select.min.js +1 -1
- package/lib/ui/index.js +3 -10
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/upload/src/upload.js +5 -5
- package/lib/upload/src/upload.min.js +1 -1
- package/package.json +2 -2
- package/packages/anchor/src/anchor-link.ts +2 -2
- package/packages/anchor/src/anchor.ts +2 -2
- package/packages/breadcrumb/src/breadcrumb.ts +2 -2
- package/packages/button/src/button-group.ts +4 -1
- package/packages/button/src/button.ts +6 -5
- package/packages/calendar/src/calendar.ts +67 -35
- package/packages/card/src/card.ts +6 -4
- package/packages/carousel/src/carousel-item.ts +19 -4
- package/packages/carousel/src/carousel.ts +19 -11
- package/packages/checkbox/src/checkbox.ts +34 -15
- package/packages/checkbox/src/group.ts +22 -10
- package/packages/collapse-pane/index.ts +1 -1
- package/packages/countdown/src/countdown.ts +20 -11
- package/packages/date-picker/src/date-picker.ts +160 -80
- package/packages/drawer/src/drawer.ts +91 -50
- package/packages/form/render/index.ts +1 -3
- package/packages/form/src/form-config-item.ts +4 -3
- package/packages/form/src/form-gather.ts +5 -3
- package/packages/form/src/form-item.ts +15 -10
- package/packages/form/src/form.ts +12 -10
- package/packages/form/src/render.ts +2 -1
- package/packages/form/src/util.ts +2 -1
- package/packages/icon/src/icon.ts +3 -0
- package/packages/icon-picker/src/icon-picker.ts +31 -17
- package/packages/image/src/group.ts +4 -1
- package/packages/image/src/preview.ts +2 -2
- package/packages/input/src/input.ts +138 -75
- package/packages/layout-aside/src/layout-aside.ts +2 -2
- package/packages/list/src/list.ts +12 -11
- package/packages/list-design/src/list-design.ts +2 -2
- package/packages/list-design/src/list-view.ts +2 -2
- package/packages/loading/src/loading.ts +5 -2
- package/packages/menu/src/menu.ts +5 -4
- package/packages/number-input/src/number-input.ts +102 -79
- package/packages/pager/src/pager.ts +91 -50
- package/packages/password-input/src/password-input.ts +2 -2
- package/packages/print/src/page-break.ts +18 -4
- package/packages/print/src/print.ts +10 -5
- package/packages/pulldown/src/pulldown.ts +28 -22
- package/packages/radio/src/button.ts +2 -2
- package/packages/radio/src/group.ts +9 -5
- package/packages/row/src/row.ts +2 -2
- package/packages/select/src/optgroup.ts +22 -13
- package/packages/select/src/option.ts +18 -10
- package/packages/select/src/select.ts +79 -52
- package/packages/select/src/util.ts +3 -3
- package/packages/tabs/src/tab-pane.ts +20 -5
- package/packages/tabs/src/tabs.ts +59 -49
- package/packages/textarea/src/textarea.ts +28 -10
- package/packages/tooltip/src/tooltip.ts +118 -84
- package/packages/tree/src/tree.ts +7 -4
- package/packages/tree-select/src/tree-select.ts +25 -16
- package/packages/ui/index.ts +0 -7
- package/packages/upload/src/upload.ts +6 -6
- package/types/components/calendar.d.ts +6 -0
- package/types/components/carousel.d.ts +5 -0
- package/types/components/countdown.d.ts +4 -0
- package/types/components/date-picker.d.ts +23 -5
- package/types/components/drawer.d.ts +0 -1
- package/types/components/form.d.ts +4 -2
- package/types/components/icon-picker.d.ts +4 -0
- package/types/components/input.d.ts +9 -1
- package/types/components/list.d.ts +1 -0
- package/types/components/number-input.d.ts +6 -2
- package/types/components/optgroup.d.ts +10 -4
- package/types/components/pulldown.d.ts +5 -1
- package/types/components/select.d.ts +4 -0
- package/types/components/tabs.d.ts +4 -0
- package/types/components/toolbar.d.ts +5 -0
- package/types/components/tooltip.d.ts +4 -0
- package/types/components/tree-select.d.ts +4 -0
- package/types/ui/index.d.ts +0 -22
- /package/es/{collapse-pane → collapse}/src/collapse-pane.js +0 -0
- /package/es/icon/style/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/es/icon/style/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/es/icon/style/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/es/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/es/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/es/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/lib/{collapse-pane → collapse}/src/collapse-pane.js +0 -0
- /package/lib/{collapse-pane → collapse}/src/collapse-pane.min.js +0 -0
- /package/lib/icon/style/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/lib/icon/style/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/lib/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/lib/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/lib/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/packages/{collapse-pane → collapse}/src/collapse-pane.ts +0 -0
|
@@ -5,31 +5,55 @@ import { toCssUnit } from '../..//ui/src/dom'
|
|
|
5
5
|
import VxeButtonComponent from '../../button/src/button'
|
|
6
6
|
import XEUtils from 'xe-utils'
|
|
7
7
|
|
|
8
|
-
import type { VxeCalendarConstructor, VxeCalendarEmits, CalendarReactData, CalendarMethods, VxeCalendarPropTypes, CalendarPrivateRef, VxeDatePickerDefines } from '../../../types'
|
|
8
|
+
import type { VxeCalendarConstructor, VxeCalendarEmits, CalendarInternalData, CalendarReactData, CalendarMethods, VxeCalendarPropTypes, CalendarPrivateRef, VxeDatePickerDefines } from '../../../types'
|
|
9
9
|
|
|
10
10
|
export default defineComponent({
|
|
11
11
|
name: 'VxeCalendar',
|
|
12
12
|
props: {
|
|
13
13
|
modelValue: [String, Number, Date] as PropType<VxeCalendarPropTypes.ModelValue>,
|
|
14
|
-
type: {
|
|
14
|
+
type: {
|
|
15
|
+
type: String as PropType<VxeCalendarPropTypes.Type>,
|
|
16
|
+
default: 'date'
|
|
17
|
+
},
|
|
15
18
|
className: String as PropType<VxeCalendarPropTypes.ClassName>,
|
|
16
|
-
size: {
|
|
19
|
+
size: {
|
|
20
|
+
type: String as PropType<VxeCalendarPropTypes.Size>,
|
|
21
|
+
default: () => getConfig().calendar.size || getConfig().size
|
|
22
|
+
},
|
|
17
23
|
multiple: Boolean as PropType<VxeCalendarPropTypes.Multiple>,
|
|
18
24
|
|
|
19
25
|
width: [String, Number] as PropType<VxeCalendarPropTypes.Width>,
|
|
20
26
|
height: [String, Number] as PropType<VxeCalendarPropTypes.Height>,
|
|
21
27
|
|
|
22
28
|
// date、week、month、quarter、year
|
|
23
|
-
minDate: {
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
minDate: {
|
|
30
|
+
type: [String, Number, Date] as PropType<VxeCalendarPropTypes.MinDate>,
|
|
31
|
+
default: () => getConfig().calendar.minDate
|
|
32
|
+
},
|
|
33
|
+
maxDate: {
|
|
34
|
+
type: [String, Number, Date] as PropType<VxeCalendarPropTypes.MaxDate>,
|
|
35
|
+
default: () => getConfig().calendar.maxDate
|
|
36
|
+
},
|
|
37
|
+
startDay: {
|
|
38
|
+
type: [String, Number] as PropType<VxeCalendarPropTypes.StartDay>,
|
|
39
|
+
default: () => getConfig().calendar.startDay
|
|
40
|
+
},
|
|
26
41
|
labelFormat: String as PropType<VxeCalendarPropTypes.LabelFormat>,
|
|
27
42
|
valueFormat: String as PropType<VxeCalendarPropTypes.ValueFormat>,
|
|
28
|
-
festivalMethod: {
|
|
29
|
-
|
|
43
|
+
festivalMethod: {
|
|
44
|
+
type: Function as PropType<VxeCalendarPropTypes.FestivalMethod>,
|
|
45
|
+
default: () => getConfig().calendar.festivalMethod
|
|
46
|
+
},
|
|
47
|
+
disabledMethod: {
|
|
48
|
+
type: Function as PropType<VxeCalendarPropTypes.DisabledMethod>,
|
|
49
|
+
default: () => getConfig().calendar.disabledMethod
|
|
50
|
+
},
|
|
30
51
|
|
|
31
52
|
// week
|
|
32
|
-
selectDay: {
|
|
53
|
+
selectDay: {
|
|
54
|
+
type: [String, Number] as PropType<VxeCalendarPropTypes.SelectDay>,
|
|
55
|
+
default: () => getConfig().calendar.selectDay
|
|
56
|
+
}
|
|
33
57
|
},
|
|
34
58
|
emits: [
|
|
35
59
|
'update:modelValue',
|
|
@@ -46,10 +70,6 @@ export default defineComponent({
|
|
|
46
70
|
|
|
47
71
|
const { computeSize } = useSize(props)
|
|
48
72
|
|
|
49
|
-
const yearSize = 12
|
|
50
|
-
const monthSize = 20
|
|
51
|
-
const quarterSize = 8
|
|
52
|
-
|
|
53
73
|
const reactData = reactive<CalendarReactData>({
|
|
54
74
|
selectValue: props.modelValue,
|
|
55
75
|
inputValue: props.modelValue,
|
|
@@ -60,19 +80,13 @@ export default defineComponent({
|
|
|
60
80
|
currentDate: null
|
|
61
81
|
})
|
|
62
82
|
|
|
63
|
-
const
|
|
83
|
+
const internalData: CalendarInternalData = {
|
|
84
|
+
yearSize: 12,
|
|
85
|
+
monthSize: 20,
|
|
86
|
+
quarterSize: 8
|
|
87
|
+
}
|
|
64
88
|
|
|
65
|
-
const
|
|
66
|
-
const { height, width } = props
|
|
67
|
-
const stys: Record<string, string> = {}
|
|
68
|
-
if (width) {
|
|
69
|
-
stys.width = toCssUnit(width)
|
|
70
|
-
}
|
|
71
|
-
if (height) {
|
|
72
|
-
stys.height = toCssUnit(height)
|
|
73
|
-
}
|
|
74
|
-
return stys
|
|
75
|
-
})
|
|
89
|
+
const refElem = ref() as Ref<HTMLDivElement>
|
|
76
90
|
|
|
77
91
|
const refMaps: CalendarPrivateRef = {
|
|
78
92
|
refElem
|
|
@@ -83,14 +97,23 @@ export default defineComponent({
|
|
|
83
97
|
props,
|
|
84
98
|
context,
|
|
85
99
|
reactData,
|
|
100
|
+
internalData,
|
|
86
101
|
getRefMaps: () => refMaps
|
|
87
102
|
} as unknown as VxeCalendarConstructor
|
|
88
103
|
|
|
89
104
|
let calendarMethods = {} as CalendarMethods
|
|
90
105
|
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
106
|
+
const computeCalendarStyle = computed(() => {
|
|
107
|
+
const { height, width } = props
|
|
108
|
+
const stys: Record<string, string> = {}
|
|
109
|
+
if (width) {
|
|
110
|
+
stys.width = toCssUnit(width)
|
|
111
|
+
}
|
|
112
|
+
if (height) {
|
|
113
|
+
stys.height = toCssUnit(height)
|
|
114
|
+
}
|
|
115
|
+
return stys
|
|
116
|
+
})
|
|
94
117
|
|
|
95
118
|
const computeIsDisabled = computed(() => {
|
|
96
119
|
return false
|
|
@@ -198,6 +221,7 @@ export default defineComponent({
|
|
|
198
221
|
|
|
199
222
|
const computeYearList = computed(() => {
|
|
200
223
|
const { selectMonth, currentDate } = reactData
|
|
224
|
+
const { yearSize } = internalData
|
|
201
225
|
const years: VxeDatePickerDefines.DateYearItem[] = []
|
|
202
226
|
if (selectMonth && currentDate) {
|
|
203
227
|
const currFullYear = currentDate.getFullYear()
|
|
@@ -295,6 +319,7 @@ export default defineComponent({
|
|
|
295
319
|
|
|
296
320
|
const computeQuarterList = computed(() => {
|
|
297
321
|
const { selectMonth, currentDate } = reactData
|
|
322
|
+
const { quarterSize } = internalData
|
|
298
323
|
const quarters: VxeDatePickerDefines.DateQuarterItem[] = []
|
|
299
324
|
if (selectMonth && currentDate) {
|
|
300
325
|
const currFullYear = currentDate.getFullYear()
|
|
@@ -326,6 +351,7 @@ export default defineComponent({
|
|
|
326
351
|
|
|
327
352
|
const computeMonthList = computed(() => {
|
|
328
353
|
const { selectMonth, currentDate } = reactData
|
|
354
|
+
const { monthSize } = internalData
|
|
329
355
|
const months: VxeDatePickerDefines.DateMonthItem[] = []
|
|
330
356
|
if (selectMonth && currentDate) {
|
|
331
357
|
const currFullYear = currentDate.getFullYear()
|
|
@@ -410,7 +436,11 @@ export default defineComponent({
|
|
|
410
436
|
})
|
|
411
437
|
})
|
|
412
438
|
|
|
413
|
-
const
|
|
439
|
+
const parseDate = (value: VxeCalendarPropTypes.ModelValue, format: string) => {
|
|
440
|
+
return XEUtils.toStringDate(value, format)
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const handleChange = (value: string, evnt: Event | { type: string }) => {
|
|
414
444
|
reactData.inputValue = value
|
|
415
445
|
emit('update:modelValue', value)
|
|
416
446
|
if (XEUtils.toValueString(props.modelValue) !== value) {
|
|
@@ -495,14 +525,14 @@ export default defineComponent({
|
|
|
495
525
|
const dateMultipleValue = computeDateMultipleValue.value
|
|
496
526
|
// 如果是日期类型
|
|
497
527
|
if (dateMultipleValue.some(val => XEUtils.isEqual(val, inpVal))) {
|
|
498
|
-
|
|
528
|
+
handleChange(dateMultipleValue.filter(val => !XEUtils.isEqual(val, inpVal)).join(','), { type: 'update' })
|
|
499
529
|
} else {
|
|
500
|
-
|
|
530
|
+
handleChange(dateMultipleValue.concat([inpVal]).join(','), { type: 'update' })
|
|
501
531
|
}
|
|
502
532
|
} else {
|
|
503
533
|
// 如果为单选
|
|
504
534
|
if (!XEUtils.isEqual(modelValue, inpVal)) {
|
|
505
|
-
|
|
535
|
+
handleChange(inpVal, { type: 'update' })
|
|
506
536
|
}
|
|
507
537
|
}
|
|
508
538
|
}
|
|
@@ -530,6 +560,7 @@ export default defineComponent({
|
|
|
530
560
|
const datePrevEvent = (evnt: Event) => {
|
|
531
561
|
const { type } = props
|
|
532
562
|
const { datePanelType, selectMonth } = reactData
|
|
563
|
+
const { yearSize } = internalData
|
|
533
564
|
const isDisabledPrevDateBtn = computeIsDisabledPrevDateBtn.value
|
|
534
565
|
if (!isDisabledPrevDateBtn) {
|
|
535
566
|
if (type === 'year') {
|
|
@@ -564,6 +595,7 @@ export default defineComponent({
|
|
|
564
595
|
const dateNextEvent = (evnt: Event) => {
|
|
565
596
|
const { type } = props
|
|
566
597
|
const { datePanelType, selectMonth } = reactData
|
|
598
|
+
const { yearSize } = internalData
|
|
567
599
|
const isDisabledNextDateBtn = computeIsDisabledNextDateBtn.value
|
|
568
600
|
if (!isDisabledNextDateBtn) {
|
|
569
601
|
if (type === 'year') {
|
|
@@ -720,13 +752,13 @@ export default defineComponent({
|
|
|
720
752
|
}]
|
|
721
753
|
}, extraItem && extraItem.label
|
|
722
754
|
? [
|
|
723
|
-
h('span', label),
|
|
755
|
+
h('span', `${label || ''}`),
|
|
724
756
|
h('span', {
|
|
725
757
|
class: ['vxe-calendar--date-label--extra', extraItem.important ? 'is-important' : '', extraItem.className],
|
|
726
758
|
style: extraItem.style
|
|
727
759
|
}, XEUtils.toValueString(extraItem.label))
|
|
728
760
|
]
|
|
729
|
-
: label)
|
|
761
|
+
: [`${label || ''}`])
|
|
730
762
|
]
|
|
731
763
|
const festivalLabel = festivalItem.label
|
|
732
764
|
if (festivalLabel) {
|
|
@@ -749,7 +781,7 @@ export default defineComponent({
|
|
|
749
781
|
}
|
|
750
782
|
return labels
|
|
751
783
|
}
|
|
752
|
-
return label
|
|
784
|
+
return `${label || ''}`
|
|
753
785
|
}
|
|
754
786
|
|
|
755
787
|
const renderDateDayTable = () => {
|
|
@@ -5,7 +5,7 @@ import { toCssUnit } from '../..//ui/src/dom'
|
|
|
5
5
|
import VxeLoadingComponent from '../../loading/src/loading'
|
|
6
6
|
import XEUtils from 'xe-utils'
|
|
7
7
|
|
|
8
|
-
import type { CardReactData, VxeCardEmits, VxeCardPropTypes, CardPrivateRef, CardMethods, CardPrivateMethods, VxeCardPrivateComputed, VxeCardConstructor, VxeCardPrivateMethods } from '../../../types'
|
|
8
|
+
import type { CardReactData, VxeCardEmits, VxeCardPropTypes, CardPrivateRef, ValueOf, CardMethods, CardPrivateMethods, VxeCardPrivateComputed, VxeCardConstructor, VxeCardPrivateMethods } from '../../../types'
|
|
9
9
|
|
|
10
10
|
export default defineComponent({
|
|
11
11
|
name: 'VxeCard',
|
|
@@ -72,10 +72,12 @@ export default defineComponent({
|
|
|
72
72
|
getComputeMaps: () => computeMaps
|
|
73
73
|
} as unknown as VxeCardConstructor & VxeCardPrivateMethods
|
|
74
74
|
|
|
75
|
+
const dispatchEvent = (type: ValueOf<VxeCardEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
76
|
+
emit(type, createEvent(evnt, { $card: $xeCard }, params))
|
|
77
|
+
}
|
|
78
|
+
|
|
75
79
|
const cardMethods: CardMethods = {
|
|
76
|
-
dispatchEvent
|
|
77
|
-
emit(type, createEvent(evnt, { $card: $xeCard }, params))
|
|
78
|
-
}
|
|
80
|
+
dispatchEvent
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
const cardPrivateMethods: CardPrivateMethods = {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { defineComponent, ref, h, reactive, PropType, inject, watch, onMounted, onUnmounted } from 'vue'
|
|
2
|
+
import { createEvent } from '../../ui'
|
|
2
3
|
import { assembleCarouselItem, destroyCarouselItem } from './util'
|
|
3
4
|
import XEUtils from 'xe-utils'
|
|
4
5
|
|
|
5
|
-
import type { VxeCarouselItemPropTypes, CarouselItemReactData, CarouselItemPrivateRef, VxeCarouselItemEmits, VxeCarouselDefines, VxeCarouselItemPrivateComputed, VxeCarouselItemConstructor, VxeCarouselItemPrivateMethods, VxeCarouselConstructor, VxeCarouselPrivateMethods } from '../../../types'
|
|
6
|
+
import type { VxeCarouselItemPropTypes, CarouselItemReactData, CarouselItemPrivateRef, CarouselItemMethods, CarouselItemPrivateMethods, ValueOf, VxeCarouselItemEmits, VxeCarouselDefines, VxeCarouselItemPrivateComputed, VxeCarouselItemConstructor, VxeCarouselItemPrivateMethods, VxeCarouselConstructor, VxeCarouselPrivateMethods } from '../../../types'
|
|
6
7
|
|
|
7
8
|
export default defineComponent({
|
|
8
9
|
name: 'VxeCarouselItem',
|
|
@@ -14,7 +15,7 @@ export default defineComponent({
|
|
|
14
15
|
emits: [
|
|
15
16
|
] as VxeCarouselItemEmits,
|
|
16
17
|
setup (props, context) {
|
|
17
|
-
const { slots } = context
|
|
18
|
+
const { slots, emit } = context
|
|
18
19
|
|
|
19
20
|
const $xeCarousel = inject<(VxeCarouselConstructor & VxeCarouselPrivateMethods) | null>('$xeCarousel', null)
|
|
20
21
|
|
|
@@ -50,6 +51,19 @@ export default defineComponent({
|
|
|
50
51
|
getComputeMaps: () => computeMaps
|
|
51
52
|
} as unknown as VxeCarouselItemConstructor & VxeCarouselItemPrivateMethods
|
|
52
53
|
|
|
54
|
+
const dispatchEvent = (type: ValueOf<VxeCarouselItemEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
55
|
+
emit(type, createEvent(evnt, { $carouselItem: $xeCarouselItem }, params))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const carouselItemMethods: CarouselItemMethods = {
|
|
59
|
+
dispatchEvent
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const carouselItemPrivateMethods: CarouselItemPrivateMethods = {
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
Object.assign($xeCarouselItem, carouselItemMethods, carouselItemPrivateMethods)
|
|
66
|
+
|
|
53
67
|
const renderVN = () => {
|
|
54
68
|
return h('div', {
|
|
55
69
|
ref: refElem
|
|
@@ -65,8 +79,9 @@ export default defineComponent({
|
|
|
65
79
|
})
|
|
66
80
|
|
|
67
81
|
onMounted(() => {
|
|
68
|
-
|
|
69
|
-
|
|
82
|
+
const elem = refElem.value
|
|
83
|
+
if ($xeCarousel && elem) {
|
|
84
|
+
assembleCarouselItem($xeCarousel, elem, itemConfig)
|
|
70
85
|
}
|
|
71
86
|
})
|
|
72
87
|
|
|
@@ -5,7 +5,7 @@ import { toCssUnit } from '../..//ui/src/dom'
|
|
|
5
5
|
import VxeLoadingComponent from '../../loading/src/loading'
|
|
6
6
|
import XEUtils from 'xe-utils'
|
|
7
7
|
|
|
8
|
-
import type { CarouselReactData, CarouselPrivateRef, VxeCarouselPropTypes, CarouselMethods, CarouselPrivateMethods, VxeCarouselEmits, VxeCarouselDefines, VxeCarouselPrivateComputed, VxeCarouselConstructor, ValueOf, VxeCarouselPrivateMethods } from '../../../types'
|
|
8
|
+
import type { CarouselReactData, CarouselPrivateRef, VxeCarouselPropTypes, CarouselInternalData, CarouselMethods, CarouselPrivateMethods, VxeCarouselEmits, VxeCarouselDefines, VxeCarouselPrivateComputed, VxeCarouselConstructor, ValueOf, VxeCarouselPrivateMethods } from '../../../types'
|
|
9
9
|
|
|
10
10
|
export default defineComponent({
|
|
11
11
|
name: 'VxeCarousel',
|
|
@@ -61,6 +61,11 @@ export default defineComponent({
|
|
|
61
61
|
itemHeight: 0
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
+
const internalData: CarouselInternalData = {
|
|
65
|
+
apTimeout: undefined,
|
|
66
|
+
stopFlag: false
|
|
67
|
+
}
|
|
68
|
+
|
|
64
69
|
const refMaps: CarouselPrivateRef = {
|
|
65
70
|
refElem
|
|
66
71
|
}
|
|
@@ -88,6 +93,7 @@ export default defineComponent({
|
|
|
88
93
|
props,
|
|
89
94
|
context,
|
|
90
95
|
reactData,
|
|
96
|
+
internalData,
|
|
91
97
|
|
|
92
98
|
getRefMaps: () => refMaps,
|
|
93
99
|
getComputeMaps: () => computeMaps
|
|
@@ -198,22 +204,22 @@ export default defineComponent({
|
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
206
|
|
|
201
|
-
let apTimeout: any = null
|
|
202
|
-
let stopFlag = false
|
|
203
|
-
|
|
204
207
|
const stopAutoPlay = () => {
|
|
205
|
-
|
|
206
|
-
|
|
208
|
+
const { apTimeout } = internalData
|
|
209
|
+
internalData.stopFlag = true
|
|
210
|
+
if (apTimeout) {
|
|
207
211
|
clearTimeout(apTimeout)
|
|
212
|
+
internalData.apTimeout = undefined
|
|
208
213
|
}
|
|
209
214
|
}
|
|
210
215
|
|
|
211
216
|
const handleAutoPlay = () => {
|
|
212
217
|
const { autoPlay, interval } = props
|
|
218
|
+
const { stopFlag } = internalData
|
|
213
219
|
stopAutoPlay()
|
|
214
220
|
if (autoPlay) {
|
|
215
|
-
stopFlag = false
|
|
216
|
-
apTimeout = setTimeout(() => {
|
|
221
|
+
internalData.stopFlag = false
|
|
222
|
+
internalData.apTimeout = setTimeout(() => {
|
|
217
223
|
if (!stopFlag) {
|
|
218
224
|
handlePrevNext(true)
|
|
219
225
|
}
|
|
@@ -324,7 +330,9 @@ export default defineComponent({
|
|
|
324
330
|
height: toCssUnit(height)
|
|
325
331
|
}
|
|
326
332
|
: null
|
|
327
|
-
},
|
|
333
|
+
}, [
|
|
334
|
+
renderItemWrapper(list)
|
|
335
|
+
]),
|
|
328
336
|
showIndicators ? renderIndicators(list) : createCommentVNode(),
|
|
329
337
|
h('div', {
|
|
330
338
|
class: 'vxe-carousel--btn-wrapper'
|
|
@@ -356,8 +364,6 @@ export default defineComponent({
|
|
|
356
364
|
])
|
|
357
365
|
}
|
|
358
366
|
|
|
359
|
-
$xeCarousel.renderVN = renderVN
|
|
360
|
-
|
|
361
367
|
const optsFlag = ref(0)
|
|
362
368
|
watch(() => props.options ? props.options.length : -1, () => {
|
|
363
369
|
optsFlag.value++
|
|
@@ -397,6 +403,8 @@ export default defineComponent({
|
|
|
397
403
|
|
|
398
404
|
provide('$xeCarousel', $xeCarousel)
|
|
399
405
|
|
|
406
|
+
$xeCarousel.renderVN = renderVN
|
|
407
|
+
|
|
400
408
|
return $xeCarousel
|
|
401
409
|
},
|
|
402
410
|
render () {
|
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
import { defineComponent, h, computed, inject, PropType } from 'vue'
|
|
1
|
+
import { defineComponent, h, computed, inject, PropType, reactive } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { getFuncText } from '../../ui/src/utils'
|
|
4
4
|
import { getConfig, createEvent, useSize, getIcon } from '../../ui'
|
|
5
5
|
|
|
6
|
-
import type { VxeCheckboxConstructor, VxeCheckboxGroupConstructor, VxeCheckboxEmits, VxeCheckboxGroupPrivateMethods, CheckboxMethods, VxeCheckboxPropTypes, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types'
|
|
6
|
+
import type { VxeCheckboxConstructor, VxeCheckboxGroupConstructor, CheckboxReactData, VxeCheckboxEmits, ValueOf, VxeCheckboxGroupPrivateMethods, CheckboxMethods, VxeCheckboxPropTypes, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types'
|
|
7
7
|
|
|
8
8
|
export default defineComponent({
|
|
9
9
|
name: 'VxeCheckbox',
|
|
10
10
|
props: {
|
|
11
11
|
modelValue: [String, Number, Boolean] as PropType<VxeCheckboxPropTypes.ModelValue>,
|
|
12
|
-
label: {
|
|
12
|
+
label: {
|
|
13
|
+
type: [String, Number] as PropType<VxeCheckboxPropTypes.Label>,
|
|
14
|
+
default: null
|
|
15
|
+
},
|
|
13
16
|
indeterminate: Boolean as PropType<VxeCheckboxPropTypes.Indeterminate>,
|
|
14
17
|
title: [String, Number] as PropType<VxeCheckboxPropTypes.Title>,
|
|
15
|
-
checkedValue: {
|
|
16
|
-
|
|
18
|
+
checkedValue: {
|
|
19
|
+
type: [String, Number, Boolean] as PropType<VxeCheckboxPropTypes.CheckedValue>,
|
|
20
|
+
default: true
|
|
21
|
+
},
|
|
22
|
+
uncheckedValue: {
|
|
23
|
+
type: [String, Number, Boolean] as PropType<VxeCheckboxPropTypes.UncheckedValue>,
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
17
26
|
content: [String, Number] as PropType<VxeCheckboxPropTypes.Content>,
|
|
18
27
|
disabled: {
|
|
19
28
|
type: Boolean as PropType<VxeCheckboxPropTypes.Disabled>,
|
|
20
29
|
default: null
|
|
21
30
|
},
|
|
22
|
-
size: {
|
|
31
|
+
size: {
|
|
32
|
+
type: String as PropType<VxeCheckboxPropTypes.Size>,
|
|
33
|
+
default: () => getConfig().checkbox.size || getConfig().size
|
|
34
|
+
}
|
|
23
35
|
},
|
|
24
36
|
emits: [
|
|
25
37
|
'update:modelValue',
|
|
@@ -34,10 +46,14 @@ export default defineComponent({
|
|
|
34
46
|
|
|
35
47
|
const xID = XEUtils.uniqueId()
|
|
36
48
|
|
|
49
|
+
const reactData: CheckboxReactData = reactive({
|
|
50
|
+
})
|
|
51
|
+
|
|
37
52
|
const $xeCheckbox = {
|
|
38
53
|
xID,
|
|
39
54
|
props,
|
|
40
|
-
context
|
|
55
|
+
context,
|
|
56
|
+
reactData
|
|
41
57
|
} as unknown as VxeCheckboxConstructor
|
|
42
58
|
|
|
43
59
|
let checkboxMethods = {} as CheckboxMethods
|
|
@@ -53,12 +69,13 @@ export default defineComponent({
|
|
|
53
69
|
|
|
54
70
|
const computeIsDisabled = computed(() => {
|
|
55
71
|
const { disabled } = props
|
|
72
|
+
const isChecked = computeIsChecked.value
|
|
56
73
|
if (disabled === null) {
|
|
57
74
|
if ($xeCheckboxGroup) {
|
|
58
|
-
const { computeIsDisabled, computeIsMaximize } = $xeCheckboxGroup.getComputeMaps()
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
return
|
|
75
|
+
const { computeIsDisabled: computeIsGroupDisabled, computeIsMaximize: computeIsGroupMaximize } = $xeCheckboxGroup.getComputeMaps()
|
|
76
|
+
const isGroupDisabled = computeIsGroupDisabled.value
|
|
77
|
+
const isGroupMaximize = computeIsGroupMaximize.value
|
|
78
|
+
return isGroupDisabled || (isGroupMaximize && !isChecked)
|
|
62
79
|
}
|
|
63
80
|
}
|
|
64
81
|
return disabled
|
|
@@ -84,10 +101,12 @@ export default defineComponent({
|
|
|
84
101
|
}
|
|
85
102
|
}
|
|
86
103
|
|
|
104
|
+
const dispatchEvent = (type: ValueOf<VxeCheckboxEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
105
|
+
emit(type, createEvent(evnt, { $checkbox: $xeCheckbox }, params))
|
|
106
|
+
}
|
|
107
|
+
|
|
87
108
|
checkboxMethods = {
|
|
88
|
-
dispatchEvent
|
|
89
|
-
emit(type, createEvent(evnt, { $checkbox: $xeCheckbox }, params))
|
|
90
|
-
}
|
|
109
|
+
dispatchEvent
|
|
91
110
|
}
|
|
92
111
|
|
|
93
112
|
Object.assign($xeCheckbox, checkboxMethods)
|
|
@@ -96,7 +115,7 @@ export default defineComponent({
|
|
|
96
115
|
const vSize = computeSize.value
|
|
97
116
|
const isDisabled = computeIsDisabled.value
|
|
98
117
|
const isChecked = computeIsChecked.value
|
|
99
|
-
const indeterminate = props.indeterminate
|
|
118
|
+
const indeterminate = !isChecked && props.indeterminate
|
|
100
119
|
return h('label', {
|
|
101
120
|
class: ['vxe-checkbox', {
|
|
102
121
|
[`size--${vSize}`]: vSize,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent, h, provide, PropType, computed, inject } from 'vue'
|
|
1
|
+
import { defineComponent, h, provide, PropType, computed, inject, reactive } from 'vue'
|
|
2
2
|
import { getConfig, createEvent, useSize } from '../../ui'
|
|
3
3
|
import XEUtils from 'xe-utils'
|
|
4
4
|
import VxeCheckboxComponent from './checkbox'
|
|
5
5
|
|
|
6
|
-
import type { VxeCheckboxGroupConstructor, VxeCheckboxGroupEmits, VxeCheckboxGroupPrivateMethods, CheckboxGroupPrivateMethods, CheckboxGroupPrivateComputed, CheckboxGroupMethods, VxeCheckboxGroupPropTypes, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types'
|
|
6
|
+
import type { VxeCheckboxGroupConstructor, VxeCheckboxGroupEmits, ValueOf, CheckboxGroupReactData, VxeCheckboxGroupPrivateMethods, CheckboxGroupPrivateMethods, CheckboxGroupPrivateComputed, CheckboxGroupMethods, VxeCheckboxGroupPropTypes, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types'
|
|
7
7
|
|
|
8
8
|
export default defineComponent({
|
|
9
9
|
name: 'VxeCheckboxGroup',
|
|
@@ -15,8 +15,14 @@ export default defineComponent({
|
|
|
15
15
|
type: Boolean as PropType<VxeCheckboxGroupPropTypes.Disabled>,
|
|
16
16
|
default: null
|
|
17
17
|
},
|
|
18
|
-
max: {
|
|
19
|
-
|
|
18
|
+
max: {
|
|
19
|
+
type: [String, Number] as PropType<VxeCheckboxGroupPropTypes.Max>,
|
|
20
|
+
default: null
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
type: String as PropType<VxeCheckboxGroupPropTypes.Size>,
|
|
24
|
+
default: () => getConfig().checkboxGroup.size || getConfig().size
|
|
25
|
+
}
|
|
20
26
|
},
|
|
21
27
|
emits: [
|
|
22
28
|
'update:modelValue',
|
|
@@ -29,6 +35,9 @@ export default defineComponent({
|
|
|
29
35
|
|
|
30
36
|
const xID = XEUtils.uniqueId()
|
|
31
37
|
|
|
38
|
+
const reactData: CheckboxGroupReactData = reactive({
|
|
39
|
+
})
|
|
40
|
+
|
|
32
41
|
const computeIsDisabled = computed(() => {
|
|
33
42
|
const { disabled } = props
|
|
34
43
|
if (disabled === null) {
|
|
@@ -49,7 +58,7 @@ export default defineComponent({
|
|
|
49
58
|
})
|
|
50
59
|
|
|
51
60
|
const computePropsOpts = computed(() => {
|
|
52
|
-
return props.optionProps
|
|
61
|
+
return Object.assign({}, props.optionProps)
|
|
53
62
|
})
|
|
54
63
|
|
|
55
64
|
const computeLabelField = computed(() => {
|
|
@@ -76,16 +85,19 @@ export default defineComponent({
|
|
|
76
85
|
xID,
|
|
77
86
|
props,
|
|
78
87
|
context,
|
|
88
|
+
reactData,
|
|
79
89
|
|
|
80
90
|
getComputeMaps: () => computeMaps
|
|
81
91
|
} as unknown as VxeCheckboxGroupConstructor & VxeCheckboxGroupPrivateMethods
|
|
82
92
|
|
|
83
93
|
useSize(props)
|
|
84
94
|
|
|
95
|
+
const dispatchEvent = (type: ValueOf<VxeCheckboxGroupEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
96
|
+
emit(type, createEvent(evnt, { $checkboxGroup: $xeCheckboxGroup }, params))
|
|
97
|
+
}
|
|
98
|
+
|
|
85
99
|
const checkboxGroupMethods: CheckboxGroupMethods = {
|
|
86
|
-
dispatchEvent
|
|
87
|
-
emit(type, createEvent(evnt, { $checkboxGroup: $xeCheckboxGroup }, params))
|
|
88
|
-
}
|
|
100
|
+
dispatchEvent
|
|
89
101
|
}
|
|
90
102
|
|
|
91
103
|
const checkboxGroupPrivateMethods: CheckboxGroupPrivateMethods = {
|
|
@@ -132,10 +144,10 @@ export default defineComponent({
|
|
|
132
144
|
: []))
|
|
133
145
|
}
|
|
134
146
|
|
|
135
|
-
$xeCheckboxGroup.renderVN = renderVN
|
|
136
|
-
|
|
137
147
|
provide('$xeCheckboxGroup', $xeCheckboxGroup)
|
|
138
148
|
|
|
149
|
+
$xeCheckboxGroup.renderVN = renderVN
|
|
150
|
+
|
|
139
151
|
return renderVN
|
|
140
152
|
}
|
|
141
153
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { App } from 'vue'
|
|
2
2
|
import { VxeUI } from '@vxe-ui/core'
|
|
3
|
-
import VxeCollapsePaneComponent from '
|
|
3
|
+
import VxeCollapsePaneComponent from '../collapse/src/collapse-pane'
|
|
4
4
|
import { dynamicApp } from '../dynamics'
|
|
5
5
|
|
|
6
6
|
export const VxeCollapsePane = Object.assign({}, VxeCollapsePaneComponent, {
|
|
@@ -4,7 +4,7 @@ import { getSlotVNs } from '../../ui/src/vn'
|
|
|
4
4
|
import VxeTextComponent from '../../text/src/text'
|
|
5
5
|
import XEUtils from 'xe-utils'
|
|
6
6
|
|
|
7
|
-
import type { VxeCountdownPropTypes, CountdownReactData, CountdownPrivateRef, VxeCountdownEmits, VxeCountdownPrivateComputed, VxeCountdownConstructor, VxeCountdownPrivateMethods, ValueOf, CountdownMethods, CountdownPrivateMethods } from '../../../types'
|
|
7
|
+
import type { VxeCountdownPropTypes, CountdownReactData, CountdownInternalData, CountdownPrivateRef, VxeCountdownEmits, VxeCountdownPrivateComputed, VxeCountdownConstructor, VxeCountdownPrivateMethods, ValueOf, CountdownMethods, CountdownPrivateMethods } from '../../../types'
|
|
8
8
|
|
|
9
9
|
export default defineComponent({
|
|
10
10
|
name: 'VxeCountdown',
|
|
@@ -13,7 +13,10 @@ export default defineComponent({
|
|
|
13
13
|
format: String as PropType<VxeCountdownPropTypes.Format>,
|
|
14
14
|
prefixConfig: Object as PropType<VxeCountdownPropTypes.PrefixConfig>,
|
|
15
15
|
suffixConfig: Object as PropType<VxeCountdownPropTypes.SuffixConfig>,
|
|
16
|
-
size: {
|
|
16
|
+
size: {
|
|
17
|
+
type: String as PropType<VxeCountdownPropTypes.Size>,
|
|
18
|
+
default: () => getConfig().countdown.size || getConfig().size
|
|
19
|
+
}
|
|
17
20
|
},
|
|
18
21
|
emits: [
|
|
19
22
|
'update:modelValue',
|
|
@@ -34,6 +37,10 @@ export default defineComponent({
|
|
|
34
37
|
secondNum: 0
|
|
35
38
|
})
|
|
36
39
|
|
|
40
|
+
const internalData: CountdownInternalData = {
|
|
41
|
+
dnTimeout: undefined
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
const refMaps: CountdownPrivateRef = {
|
|
38
45
|
refElem
|
|
39
46
|
}
|
|
@@ -94,13 +101,12 @@ export default defineComponent({
|
|
|
94
101
|
props,
|
|
95
102
|
context,
|
|
96
103
|
reactData,
|
|
104
|
+
internalData,
|
|
97
105
|
|
|
98
106
|
getRefMaps: () => refMaps,
|
|
99
107
|
getComputeMaps: () => computeMaps
|
|
100
108
|
} as unknown as VxeCountdownConstructor & VxeCountdownPrivateMethods
|
|
101
109
|
|
|
102
|
-
let htime: any = null
|
|
103
|
-
|
|
104
110
|
const dispatchEvent = (type: ValueOf<VxeCountdownEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
105
111
|
emit(type, createEvent(evnt, { $carousel: $xeCountdown }, params))
|
|
106
112
|
}
|
|
@@ -115,10 +121,12 @@ export default defineComponent({
|
|
|
115
121
|
const { currNum } = reactData
|
|
116
122
|
if (currNum > 1000) {
|
|
117
123
|
reactData.currNum -= 1000
|
|
118
|
-
|
|
124
|
+
internalData.dnTimeout = setTimeout(() => {
|
|
125
|
+
handleTime()
|
|
126
|
+
}, 1000)
|
|
119
127
|
} else {
|
|
120
128
|
reactData.currNum = 0
|
|
121
|
-
|
|
129
|
+
handleStop()
|
|
122
130
|
}
|
|
123
131
|
}
|
|
124
132
|
|
|
@@ -132,9 +140,10 @@ export default defineComponent({
|
|
|
132
140
|
}
|
|
133
141
|
|
|
134
142
|
const handleStop = () => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
143
|
+
const { dnTimeout } = internalData
|
|
144
|
+
if (dnTimeout) {
|
|
145
|
+
clearTimeout(dnTimeout)
|
|
146
|
+
internalData.dnTimeout = undefined
|
|
138
147
|
dispatchEvent('end', {}, null)
|
|
139
148
|
}
|
|
140
149
|
}
|
|
@@ -225,8 +234,6 @@ export default defineComponent({
|
|
|
225
234
|
])
|
|
226
235
|
}
|
|
227
236
|
|
|
228
|
-
$xeCountdown.renderVN = renderVN
|
|
229
|
-
|
|
230
237
|
watch(() => props.modelValue, () => {
|
|
231
238
|
updateCount()
|
|
232
239
|
handleStop()
|
|
@@ -243,6 +250,8 @@ export default defineComponent({
|
|
|
243
250
|
|
|
244
251
|
updateCount()
|
|
245
252
|
|
|
253
|
+
$xeCountdown.renderVN = renderVN
|
|
254
|
+
|
|
246
255
|
return $xeCountdown
|
|
247
256
|
},
|
|
248
257
|
render () {
|