@tplc/wot 1.0.29 → 1.0.30
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/CHANGELOG.md +7 -0
- package/components/wd-calendar/types.ts +5 -0
- package/components/wd-calendar/wd-calendar.vue +1 -0
- package/components/wd-calendar-view/month/month.vue +80 -28
- package/components/wd-calendar-view/month/types.ts +5 -0
- package/components/wd-calendar-view/monthPanel/month-panel.vue +1 -0
- package/components/wd-calendar-view/monthPanel/types.ts +4 -0
- package/components/wd-calendar-view/types.ts +5 -0
- package/components/wd-calendar-view/wd-calendar-view.vue +1 -0
- package/package.json +1 -1
- package/types/components/wd-calendar/types.d.ts +5 -0
- package/types/components/wd-calendar/wd-calendar.vue.d.ts +2 -0
- package/types/components/wd-calendar-view/month/month.vue.d.ts +2 -0
- package/types/components/wd-calendar-view/month/types.d.ts +5 -0
- package/types/components/wd-calendar-view/monthPanel/month-panel.vue.d.ts +2 -0
- package/types/components/wd-calendar-view/monthPanel/types.d.ts +4 -0
- package/types/components/wd-calendar-view/types.d.ts +5 -0
- package/types/components/wd-calendar-view/wd-calendar-view.vue.d.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.0.30](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v1.0.29...v1.0.30) (2026-01-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* **wd-calendar:** add header slot support to calendar component ([67d4872](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/67d487278240242b97edd97ec22279d33fb9d769))
|
|
11
|
+
|
|
5
12
|
### [1.0.29](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.77...v1.0.29) (2026-01-18)
|
|
6
13
|
|
|
7
14
|
### [1.0.28](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.67...v1.0.28) (2026-01-13)
|
|
@@ -212,6 +212,11 @@ export const calendarProps = {
|
|
|
212
212
|
* 默认为 true,使用内置单元格
|
|
213
213
|
*/
|
|
214
214
|
withCell: makeBooleanProp(true),
|
|
215
|
+
/**
|
|
216
|
+
* type 为 daterange 或 datetimerange 时有效,默认选中的天数
|
|
217
|
+
* 当传入该参数时,用户点击开始日期后会自动选中结束日期(开始日期 + defaultDays 天)
|
|
218
|
+
*/
|
|
219
|
+
defaultDays: Number,
|
|
215
220
|
}
|
|
216
221
|
|
|
217
222
|
export type CalendarDisplayFormat = (value: number | number[], type: CalendarType) => string
|
|
@@ -318,40 +318,65 @@ function handleDateRangeChange(date: CalendarDayItem) {
|
|
|
318
318
|
const [startDate, endDate] = deepClone(isArray(props.value) ? props.value : [])
|
|
319
319
|
const compare = compareDate(date.date, startDate)
|
|
320
320
|
|
|
321
|
-
//
|
|
322
|
-
if (
|
|
323
|
-
|
|
324
|
-
compare === 0
|
|
325
|
-
(props.type === 'daterange' || props.type === 'datetimerange') &&
|
|
326
|
-
!endDate
|
|
327
|
-
) {
|
|
328
|
-
return
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if (startDate && !endDate && compare > -1) {
|
|
332
|
-
// 不能选择超过最大范围的日期
|
|
333
|
-
if (props.maxRange && getDayOffset(date.date, startDate) > props.maxRange) {
|
|
334
|
-
const maxEndDate = getDayByOffset(startDate, props.maxRange - 1)
|
|
335
|
-
value = [startDate, getDate(maxEndDate, true)]
|
|
336
|
-
toast.show({
|
|
337
|
-
msg: props.rangePrompt || translate('rangePrompt', props.maxRange),
|
|
338
|
-
})
|
|
339
|
-
} else {
|
|
340
|
-
value = [startDate, getDate(date.date, true)]
|
|
341
|
-
}
|
|
342
|
-
} else if (props.type === 'datetimerange' && startDate && endDate) {
|
|
343
|
-
// 时间范围类型,且有开始时间和结束时间,需要支持重新点击开始日期和结束日期可以重新修改时间
|
|
344
|
-
if (compare === 0) {
|
|
321
|
+
// 如果设置了 defaultDays,则用户不能修改结束日期,只能重新选择开始日期
|
|
322
|
+
if (props.defaultDays && startDate && endDate) {
|
|
323
|
+
// 如果是 datetimerange 类型,点击开始日期可以重新修改开始时间
|
|
324
|
+
if (props.type === 'datetimerange' && compare === 0) {
|
|
345
325
|
type = 'start'
|
|
346
326
|
value = props.value as number[]
|
|
347
|
-
} else if (compareDate(date.date, endDate) === 0) {
|
|
348
|
-
type = 'end'
|
|
349
|
-
value = props.value as number[]
|
|
350
327
|
} else {
|
|
328
|
+
// 其他情况重新选择开始日期
|
|
351
329
|
value = [getDate(date.date), null]
|
|
330
|
+
// 自动计算结束日期
|
|
331
|
+
const autoEndDate = calculateAutoEndDate(date.date)
|
|
332
|
+
if (autoEndDate) {
|
|
333
|
+
value = [getDate(date.date), getDate(autoEndDate, true)]
|
|
334
|
+
}
|
|
352
335
|
}
|
|
353
|
-
} else {
|
|
336
|
+
} else if (props.defaultDays && !startDate) {
|
|
337
|
+
// 首次选择开始日期,自动计算结束日期
|
|
354
338
|
value = [getDate(date.date), null]
|
|
339
|
+
const autoEndDate = calculateAutoEndDate(date.date)
|
|
340
|
+
if (autoEndDate) {
|
|
341
|
+
value = [getDate(date.date), getDate(autoEndDate, true)]
|
|
342
|
+
}
|
|
343
|
+
} else {
|
|
344
|
+
// 原有逻辑:没有设置 defaultDays 的情况
|
|
345
|
+
// 禁止选择同个日期
|
|
346
|
+
if (
|
|
347
|
+
!props.allowSameDay &&
|
|
348
|
+
compare === 0 &&
|
|
349
|
+
(props.type === 'daterange' || props.type === 'datetimerange') &&
|
|
350
|
+
!endDate
|
|
351
|
+
) {
|
|
352
|
+
return
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (startDate && !endDate && compare > -1) {
|
|
356
|
+
// 不能选择超过最大范围的日期
|
|
357
|
+
if (props.maxRange && getDayOffset(date.date, startDate) > props.maxRange) {
|
|
358
|
+
const maxEndDate = getDayByOffset(startDate, props.maxRange - 1)
|
|
359
|
+
value = [startDate, getDate(maxEndDate, true)]
|
|
360
|
+
toast.show({
|
|
361
|
+
msg: props.rangePrompt || translate('rangePrompt', props.maxRange),
|
|
362
|
+
})
|
|
363
|
+
} else {
|
|
364
|
+
value = [startDate, getDate(date.date, true)]
|
|
365
|
+
}
|
|
366
|
+
} else if (props.type === 'datetimerange' && startDate && endDate) {
|
|
367
|
+
// 时间范围类型,且有开始时间和结束时间,需要支持重新点击开始日期和结束日期可以重新修改时间
|
|
368
|
+
if (compare === 0) {
|
|
369
|
+
type = 'start'
|
|
370
|
+
value = props.value as number[]
|
|
371
|
+
} else if (compareDate(date.date, endDate) === 0) {
|
|
372
|
+
type = 'end'
|
|
373
|
+
value = props.value as number[]
|
|
374
|
+
} else {
|
|
375
|
+
value = [getDate(date.date), null]
|
|
376
|
+
}
|
|
377
|
+
} else {
|
|
378
|
+
value = [getDate(date.date), null]
|
|
379
|
+
}
|
|
355
380
|
}
|
|
356
381
|
|
|
357
382
|
emit('change', {
|
|
@@ -359,6 +384,33 @@ function handleDateRangeChange(date: CalendarDayItem) {
|
|
|
359
384
|
type: type || (value[1] ? 'end' : 'start'),
|
|
360
385
|
})
|
|
361
386
|
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* 根据 defaultDays 计算自动结束日期
|
|
390
|
+
* @param startDate 开始日期时间戳
|
|
391
|
+
* @returns 结束日期时间戳,如果超出限制则返回限制边界
|
|
392
|
+
*/
|
|
393
|
+
function calculateAutoEndDate(startDate: number): number | null {
|
|
394
|
+
if (!props.defaultDays) return null
|
|
395
|
+
|
|
396
|
+
// 计算目标结束日期
|
|
397
|
+
let targetDays = props.defaultDays
|
|
398
|
+
|
|
399
|
+
// 如果设置了 maxRange,取两者中较小的值
|
|
400
|
+
if (props.maxRange && targetDays > props.maxRange) {
|
|
401
|
+
targetDays = props.maxRange
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// 计算结束日期 (开始日期 + defaultDays - 1 天,因为包含开始日期当天)
|
|
405
|
+
const endDate = getDayByOffset(startDate, targetDays - 1)
|
|
406
|
+
|
|
407
|
+
// 如果计算出的结束日期超过 maxDate,则截断到 maxDate
|
|
408
|
+
if (compareDate(endDate, props.maxDate) === 1) {
|
|
409
|
+
return props.maxDate
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
return endDate
|
|
413
|
+
}
|
|
362
414
|
function handleWeekChange(date: CalendarDayItem) {
|
|
363
415
|
const [weekStart] = getWeekRange(date.date, props.firstDayOfWeek)
|
|
364
416
|
|
|
@@ -32,6 +32,10 @@ export const monthPanelProps = {
|
|
|
32
32
|
* 是否在手指松开时立即触发picker-view的 change 事件。若不开启则会在滚动动画结束后触发 change 事件,1.2.25版本起提供,仅微信小程序和支付宝小程序支持。
|
|
33
33
|
*/
|
|
34
34
|
immediateChange: makeBooleanProp(false),
|
|
35
|
+
/**
|
|
36
|
+
* type 为 daterange 或 datetimerange 时有效,默认选中的天数
|
|
37
|
+
*/
|
|
38
|
+
defaultDays: Number,
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
export type MonthPanelProps = ExtractPropTypes<typeof monthPanelProps>
|
|
@@ -92,6 +92,11 @@ export const calendarViewProps = {
|
|
|
92
92
|
* 是否在手指松开时立即触发picker-view的 change 事件。若不开启则会在滚动动画结束后触发 change 事件,1.2.25版本起提供,仅微信小程序和支付宝小程序支持。
|
|
93
93
|
*/
|
|
94
94
|
immediateChange: makeBooleanProp(false),
|
|
95
|
+
/**
|
|
96
|
+
* type 为 daterange 或 datetimerange 时有效,默认选中的天数
|
|
97
|
+
* 当传入该参数时,用户点击开始日期后会自动选中结束日期(开始日期 + defaultDays 天)
|
|
98
|
+
*/
|
|
99
|
+
defaultDays: Number,
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
export type CalendarViewProps = ExtractPropTypes<typeof calendarViewProps>
|
package/package.json
CHANGED
|
@@ -266,6 +266,11 @@ export declare const calendarProps: {
|
|
|
266
266
|
type: BooleanConstructor
|
|
267
267
|
default: boolean
|
|
268
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* type 为 daterange 或 datetimerange 时有效,默认选中的天数
|
|
271
|
+
* 当传入该参数时,用户点击开始日期后会自动选中结束日期(开始日期 + defaultDays 天)
|
|
272
|
+
*/
|
|
273
|
+
defaultDays: NumberConstructor
|
|
269
274
|
customStyle: {
|
|
270
275
|
type: PropType<string>
|
|
271
276
|
default: string
|
|
@@ -134,6 +134,7 @@ declare const _default: __VLS_WithTemplateSlots<
|
|
|
134
134
|
type: BooleanConstructor
|
|
135
135
|
default: boolean
|
|
136
136
|
}
|
|
137
|
+
defaultDays: NumberConstructor
|
|
137
138
|
customStyle: {
|
|
138
139
|
type: import('vue').PropType<string>
|
|
139
140
|
default: string
|
|
@@ -294,6 +295,7 @@ declare const _default: __VLS_WithTemplateSlots<
|
|
|
294
295
|
type: BooleanConstructor
|
|
295
296
|
default: boolean
|
|
296
297
|
}
|
|
298
|
+
defaultDays: NumberConstructor
|
|
297
299
|
customStyle: {
|
|
298
300
|
type: import('vue').PropType<string>
|
|
299
301
|
default: string
|
|
@@ -35,6 +35,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
35
35
|
defaultTime: {
|
|
36
36
|
type: import('vue').PropType<Array<number[]>>
|
|
37
37
|
}
|
|
38
|
+
defaultDays: NumberConstructor
|
|
38
39
|
},
|
|
39
40
|
{},
|
|
40
41
|
unknown,
|
|
@@ -83,6 +84,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
83
84
|
defaultTime: {
|
|
84
85
|
type: import('vue').PropType<Array<number[]>>
|
|
85
86
|
}
|
|
87
|
+
defaultDays: NumberConstructor
|
|
86
88
|
}>
|
|
87
89
|
> & {
|
|
88
90
|
onChange?: ((...args: any[]) => any) | undefined
|
|
@@ -47,6 +47,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
47
47
|
type: BooleanConstructor
|
|
48
48
|
default: boolean
|
|
49
49
|
}
|
|
50
|
+
defaultDays: NumberConstructor
|
|
50
51
|
},
|
|
51
52
|
{
|
|
52
53
|
scrollIntoView: () => void
|
|
@@ -112,6 +113,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
112
113
|
type: BooleanConstructor
|
|
113
114
|
default: boolean
|
|
114
115
|
}
|
|
116
|
+
defaultDays: NumberConstructor
|
|
115
117
|
}>
|
|
116
118
|
> & {
|
|
117
119
|
onChange?: ((...args: any[]) => any) | undefined
|
|
@@ -58,6 +58,10 @@ export declare const monthPanelProps: {
|
|
|
58
58
|
type: BooleanConstructor
|
|
59
59
|
default: boolean
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* type 为 daterange 或 datetimerange 时有效,默认选中的天数
|
|
63
|
+
*/
|
|
64
|
+
defaultDays: NumberConstructor
|
|
61
65
|
}
|
|
62
66
|
export type MonthPanelProps = ExtractPropTypes<typeof monthPanelProps>
|
|
63
67
|
export type MonthPanelTimeType = 'start' | 'end' | ''
|
|
@@ -100,6 +100,11 @@ export declare const calendarViewProps: {
|
|
|
100
100
|
type: BooleanConstructor
|
|
101
101
|
default: boolean
|
|
102
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* type 为 daterange 或 datetimerange 时有效,默认选中的天数
|
|
105
|
+
* 当传入该参数时,用户点击开始日期后会自动选中结束日期(开始日期 + defaultDays 天)
|
|
106
|
+
*/
|
|
107
|
+
defaultDays: NumberConstructor
|
|
103
108
|
customStyle: {
|
|
104
109
|
type: PropType<string>
|
|
105
110
|
default: string
|
|
@@ -48,6 +48,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
48
48
|
type: BooleanConstructor
|
|
49
49
|
default: boolean
|
|
50
50
|
}
|
|
51
|
+
defaultDays: NumberConstructor
|
|
51
52
|
customStyle: {
|
|
52
53
|
type: import('vue').PropType<string>
|
|
53
54
|
default: string
|
|
@@ -123,6 +124,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
123
124
|
type: BooleanConstructor
|
|
124
125
|
default: boolean
|
|
125
126
|
}
|
|
127
|
+
defaultDays: NumberConstructor
|
|
126
128
|
customStyle: {
|
|
127
129
|
type: import('vue').PropType<string>
|
|
128
130
|
default: string
|