@tplc/business 0.4.4 → 0.4.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/CHANGELOG.md +39 -0
- package/components/lcb-calendar/lcb-calendar.vue +2 -41
- package/components/lcb-calendar-filter/api.ts +4 -0
- package/components/lcb-calendar-filter/components/CalendarItem/index.vue +43 -0
- package/components/lcb-calendar-filter/lcb-calendar-filter.vue +112 -5
- package/components/lcb-calendar-filter/types.ts +31 -2
- package/package.json +1 -1
- package/types/components/lcb-calendar-filter/api.d.ts +5 -0
- package/types/components/lcb-calendar-filter/components/CalendarItem/index.vue.d.ts +40 -0
- package/types/components/lcb-calendar-filter/lcb-calendar-filter.vue.d.ts +51 -17
- package/types/components/lcb-calendar-filter/types.d.ts +28 -1
- package/types/components/lcb-waterfall/lcb-waterfall.vue.d.ts +1 -1
- package/types/utils/formatter.d.ts +5 -0
- package/utils/formatter.ts +43 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,45 @@
|
|
|
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
|
+
### [0.4.6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.5...v0.4.6) (2025-03-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* 新增过滤属性 ([1550bf8](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1550bf828d51340111c293d3e6e856397d02480f))
|
|
11
|
+
|
|
12
|
+
### [0.4.5](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.3.94...v0.4.5) (2025-03-24)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### 🚀 Chore | 构建/工程依赖/工具
|
|
16
|
+
|
|
17
|
+
* **release:** 0.3.100 ([b2e8ec6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b2e8ec601f623535f7001bdd99bb03458ed14b84))
|
|
18
|
+
* **release:** 0.3.101 ([c547cbb](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c547cbb175f74dcb7f52b07ece54da3d1698bc30))
|
|
19
|
+
* **release:** 0.3.95 ([f9ca9ff](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/f9ca9ff0416ef0bda24eea8dbf689b26129a78a5))
|
|
20
|
+
* **release:** 0.3.96 ([5f357d3](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/5f357d3ef08c67bd3d930d90eec47d61f6aaa66e))
|
|
21
|
+
* **release:** 0.3.97 ([d8e0beb](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d8e0bebb7608cdd554156f7ab5879c711cc6c32a))
|
|
22
|
+
* **release:** 0.3.98 ([1b3a356](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1b3a3564eae8c662f8fc1feb4445799f5b56bdbb))
|
|
23
|
+
* **release:** 0.3.99 ([7f9861f](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7f9861f7a59476307b09a5f7bf0de9cf12ccf969))
|
|
24
|
+
* **release:** 0.4.1 ([fa913d1](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/fa913d1a0e9cadd70aac45147e0b1e4819606ef5))
|
|
25
|
+
* **release:** 0.4.2 ([cf71a5b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/cf71a5b2e29e1fcfcd5527bb56abe7d8a920607d))
|
|
26
|
+
* **release:** 0.4.3 ([21d38cb](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/21d38cb80f3c41a0a4be99b4cbb28dd32c849c6e))
|
|
27
|
+
* **release:** 0.4.4 ([34e2c09](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/34e2c09c3c8d992c3cbcdaf3b1d4dc63a2d4a113))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### ✨ Features | 新功能
|
|
31
|
+
|
|
32
|
+
* form 校验 ([51cce50](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/51cce50ece8f98479fecf9e30c26d755e6188c82))
|
|
33
|
+
* 修改 addresName ([bbc369d](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/bbc369dad73eb961c74b2aa1dfa6b833bb5cb572))
|
|
34
|
+
* 修改ui ([ae50efe](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ae50efe91a667d8f040479d6274853c091a791f1))
|
|
35
|
+
* 修改地址 ([dba8297](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/dba82970fccf44096fed203b46316c7da2f9f9b9))
|
|
36
|
+
* 修改接口 ([d3a0193](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d3a01931b2a4f86b992d9df0e390ce3bf5870cf4))
|
|
37
|
+
* 差协议弹出 ([53ecf7d](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/53ecf7dd6ee37cf94abaf3d8ffb2ad8adfcc1841))
|
|
38
|
+
* 新增tag ([74b9c29](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/74b9c2971b69986c6c0428406eeca0a57d66eef4))
|
|
39
|
+
* 调整全局 ([c7ef8db](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c7ef8db507c2b199cebfed02c6051bc81fd6d6ff))
|
|
40
|
+
* 调整底部数据 ([9f72871](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/9f72871c2c3b3a70c2140828182cd3ecd527a3f7))
|
|
41
|
+
* 调整过滤选择 ([764ce1f](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/764ce1f68a6a851777835ea0ff5f0d588c715937))
|
|
42
|
+
* 还差数据统一 ([4f87b06](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/4f87b06331726ae4bf505c4ebae62076688ee9dc))
|
|
43
|
+
|
|
5
44
|
### [0.4.4](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.3...v0.4.4) (2025-03-23)
|
|
6
45
|
|
|
7
46
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
@confirm="handleConfirm"
|
|
5
5
|
type="daterange"
|
|
6
6
|
use-default-slot
|
|
7
|
-
:formatter="
|
|
7
|
+
:formatter="calendarFormatter(holidayInfo, translate)"
|
|
8
8
|
:min-date="minDate"
|
|
9
9
|
:max-date="maxDate"
|
|
10
10
|
@open="emits('open')"
|
|
@@ -20,6 +20,7 @@ import { useTranslate } from '@tplc/wot'
|
|
|
20
20
|
import dayjs from 'dayjs/esm'
|
|
21
21
|
import { ref } from 'vue'
|
|
22
22
|
import { LcbHistoryResult, queryHolidayInfoList } from './api'
|
|
23
|
+
import { calendarFormatter } from '../../utils/formatter'
|
|
23
24
|
const { translate } = useTranslate()
|
|
24
25
|
|
|
25
26
|
defineOptions({
|
|
@@ -83,46 +84,6 @@ const getDayInfo = async () => {
|
|
|
83
84
|
)
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
const formatter = (day: any) => {
|
|
87
|
-
const date = new Date(day.date)
|
|
88
|
-
const now = new Date()
|
|
89
|
-
|
|
90
|
-
const year = date.getFullYear()
|
|
91
|
-
const month = date.getMonth()
|
|
92
|
-
const da = date.getDate()
|
|
93
|
-
const nowYear = now.getFullYear()
|
|
94
|
-
const nowMonth = now.getMonth()
|
|
95
|
-
const nowDa = now.getDate()
|
|
96
|
-
|
|
97
|
-
const info = holidayInfo.value[dayjs(day.date).format('YYYY-MM-DD')]
|
|
98
|
-
if (info?.topText) {
|
|
99
|
-
day.topInfo = info.topText
|
|
100
|
-
}
|
|
101
|
-
if (info?.bottomText) {
|
|
102
|
-
day.bottomInfo = info.bottomText
|
|
103
|
-
}
|
|
104
|
-
if (info?.centerText) {
|
|
105
|
-
day.text = info.centerText
|
|
106
|
-
}
|
|
107
|
-
if (year === nowYear && month === nowMonth && da === nowDa) {
|
|
108
|
-
day.topInfo = translate('今天')
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (day.type === 'start') {
|
|
112
|
-
day.topInfo = translate('开始')
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (day.type === 'end') {
|
|
116
|
-
day.topInfo = translate('结束')
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (day.type === 'same') {
|
|
120
|
-
day.bottomInfo = translate('开始/结束')
|
|
121
|
-
}
|
|
122
|
-
day.restFlag = info?.restFlag
|
|
123
|
-
|
|
124
|
-
return day
|
|
125
|
-
}
|
|
126
87
|
const handleConfirm = ({ value }: { value: number[] }) => {
|
|
127
88
|
model.value = value
|
|
128
89
|
emits('confirm', value)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="gap-0.25 flex flex-col p-2 justify-center border-solid border-1 border-#eeeeee rounded-1 relative"
|
|
4
|
+
@click="date?.status !== 0 ? (currentDate = date?.date) : undefined"
|
|
5
|
+
:class="{
|
|
6
|
+
'bg-[var(--theme-bg-color)] text-primary !border-[var(--wot-primary-color)]':
|
|
7
|
+
currentDate === date?.date,
|
|
8
|
+
'opacity-50': date?.status === 0,
|
|
9
|
+
[customClass]: true,
|
|
10
|
+
}"
|
|
11
|
+
>
|
|
12
|
+
<template v-if="date">
|
|
13
|
+
<text class="whitespace-nowrap">
|
|
14
|
+
{{ date.topTextOutside }} {{ dayjs(date.date).format('MM-DD') }}
|
|
15
|
+
</text>
|
|
16
|
+
<view class="text-[var(--font1-color)]">{{ date.buttomText }}</view>
|
|
17
|
+
<view v-if="date.floorText" class="text-[var(--font2-color)]">
|
|
18
|
+
{{ date.floorText }}
|
|
19
|
+
</view>
|
|
20
|
+
<view
|
|
21
|
+
v-if="date.corner"
|
|
22
|
+
class="absolute top--2 left--0.25 bg-primary text-white text-2 px-2 py-0.25 rounded-tl-2 rounded-br-1"
|
|
23
|
+
>
|
|
24
|
+
{{ date.corner }}
|
|
25
|
+
</view>
|
|
26
|
+
</template>
|
|
27
|
+
<template v-if="showAll">
|
|
28
|
+
<text class="whitespace-nowrap">全部</text>
|
|
29
|
+
</template>
|
|
30
|
+
</view>
|
|
31
|
+
</template>
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
import dayjs from 'dayjs/esm'
|
|
34
|
+
import { HolidayInfo } from '../../types'
|
|
35
|
+
|
|
36
|
+
defineProps<{
|
|
37
|
+
date?: HolidayInfo
|
|
38
|
+
showAll?: boolean
|
|
39
|
+
customClass: string
|
|
40
|
+
}>()
|
|
41
|
+
|
|
42
|
+
const currentDate = defineModel<string | undefined>()
|
|
43
|
+
</script>
|
|
@@ -1,9 +1,60 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<lcb-block
|
|
2
|
+
<lcb-block v-bind="$props">
|
|
3
|
+
<view class="relative flex">
|
|
4
|
+
<!-- 左侧固定的"全部"选项 -->
|
|
5
|
+
<CalendarItem showAll v-model="currentDate" custom-class="mt-3" />
|
|
6
|
+
|
|
7
|
+
<scroll-view
|
|
8
|
+
scroll-x
|
|
9
|
+
class="whitespace-nowrap overflow-x-auto overflow-y-auto flex-1 w-0 pl-2 box-border"
|
|
10
|
+
:show-scrollbar="false"
|
|
11
|
+
:scroll-into-view="`id_${currentDate}`"
|
|
12
|
+
:scroll-with-animation="true"
|
|
13
|
+
>
|
|
14
|
+
<view class="flex gap-2 inline-flex h-full">
|
|
15
|
+
<CalendarItem
|
|
16
|
+
v-for="date in datePriceList"
|
|
17
|
+
:key="date.date"
|
|
18
|
+
:id="`id_${date.date}`"
|
|
19
|
+
:date="date"
|
|
20
|
+
custom-class="mt-3 !justify-start"
|
|
21
|
+
v-model="currentDate"
|
|
22
|
+
/>
|
|
23
|
+
</view>
|
|
24
|
+
</scroll-view>
|
|
25
|
+
<view
|
|
26
|
+
class="flex flex-col justify-center items-center px-2 py-1 w-8 text-primary bg-white mt-3"
|
|
27
|
+
@click="onMore"
|
|
28
|
+
v-if="showMore"
|
|
29
|
+
>
|
|
30
|
+
<text class="text-center">更多时间</text>
|
|
31
|
+
<wd-icon name="caret-right-small" size="18px" />
|
|
32
|
+
</view>
|
|
33
|
+
</view>
|
|
34
|
+
|
|
35
|
+
<wd-calendar
|
|
36
|
+
ref="calendarRef"
|
|
37
|
+
:with-cell="false"
|
|
38
|
+
v-model="calendarValue"
|
|
39
|
+
:formatter="calendarFormatter(holidayInfo, t)"
|
|
40
|
+
@confirm="handleCalendarChange"
|
|
41
|
+
:modal="false"
|
|
42
|
+
v-bind="dateRange"
|
|
43
|
+
/>
|
|
44
|
+
</lcb-block>
|
|
3
45
|
</template>
|
|
4
46
|
|
|
5
47
|
<script setup lang="ts">
|
|
6
|
-
import {
|
|
48
|
+
import { useTranslate } from '@tplc/wot'
|
|
49
|
+
import { CalendarExpose } from '@tplc/wot/types/components/wd-calendar/types'
|
|
50
|
+
import dayjs from 'dayjs/esm'
|
|
51
|
+
import 'dayjs/esm/locale/zh-cn'
|
|
52
|
+
import { onMounted, ref, watchEffect, inject, Ref } from 'vue'
|
|
53
|
+
import { HolidayInfo, LcbCalendarFilterProps } from './types'
|
|
54
|
+
import CalendarItem from './components/CalendarItem/index.vue'
|
|
55
|
+
import { queryHolidayInfoList } from './api'
|
|
56
|
+
import { FORM_KEY } from '../../constants'
|
|
57
|
+
import { calendarFormatter } from '../../utils/formatter'
|
|
7
58
|
defineOptions({
|
|
8
59
|
name: 'LcbCalendarFilter',
|
|
9
60
|
options: {
|
|
@@ -12,7 +63,63 @@ defineOptions({
|
|
|
12
63
|
styleIsolation: 'shared',
|
|
13
64
|
},
|
|
14
65
|
})
|
|
15
|
-
|
|
16
|
-
|
|
66
|
+
const { translate: t } = useTranslate()
|
|
67
|
+
const props = withDefaults(defineProps<LcbCalendarFilterProps>(), {
|
|
68
|
+
showAll: true,
|
|
69
|
+
showMore: true,
|
|
70
|
+
formKey: 'date',
|
|
71
|
+
fontSize: 24,
|
|
72
|
+
})
|
|
73
|
+
const dateRange = ref({
|
|
74
|
+
minDate: dayjs().valueOf(),
|
|
75
|
+
maxDate: dayjs().add(30, 'day').valueOf(),
|
|
76
|
+
})
|
|
77
|
+
const currentDate = ref<string>()
|
|
78
|
+
const holidayInfo = ref<Record<string, HolidayInfo>>({})
|
|
79
|
+
const datePriceList = ref<HolidayInfo[]>()
|
|
80
|
+
const calendarRef = ref<CalendarExpose>()
|
|
81
|
+
const calendarValue = ref<number | number[] | null>(null)
|
|
82
|
+
const from = inject(FORM_KEY) as Ref<Record<string, any>>
|
|
83
|
+
onMounted(async () => {
|
|
84
|
+
const { data } = await queryHolidayInfoList({
|
|
85
|
+
productType: 'activity',
|
|
86
|
+
})
|
|
87
|
+
holidayInfo.value = data.reduce(
|
|
88
|
+
(acc, cur) => {
|
|
89
|
+
acc[cur.date] = cur
|
|
90
|
+
return acc
|
|
91
|
+
},
|
|
92
|
+
{} as Record<string, HolidayInfo>,
|
|
93
|
+
)
|
|
94
|
+
const sortedHolidayInfo = Object.keys(holidayInfo.value).sort((a, b) => {
|
|
95
|
+
return dayjs(a).valueOf() - dayjs(b).valueOf()
|
|
96
|
+
})
|
|
97
|
+
dateRange.value.minDate = dayjs(sortedHolidayInfo[0]).valueOf()
|
|
98
|
+
dateRange.value.maxDate = dayjs(sortedHolidayInfo[sortedHolidayInfo.length - 1]).valueOf()
|
|
99
|
+
handleCalendarChange({ value: dayjs().valueOf() })
|
|
100
|
+
})
|
|
101
|
+
const handleCalendarChange = ({ value }: { value: number }) => {
|
|
102
|
+
const targetDate = dayjs(value)
|
|
103
|
+
// 前七天
|
|
104
|
+
const startDate = targetDate.subtract(7, 'day')
|
|
105
|
+
// 往后算15天
|
|
106
|
+
const priceList: HolidayInfo[] = []
|
|
107
|
+
for (let i = 0; i < 15; i++) {
|
|
108
|
+
const date = startDate.add(i, 'day')
|
|
109
|
+
const formattedDate = date.format('YYYY-MM-DD')
|
|
110
|
+
const holidayData = holidayInfo.value[formattedDate]
|
|
111
|
+
if (holidayData) {
|
|
112
|
+
priceList.push(holidayData)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
datePriceList.value = priceList as HolidayInfo[]
|
|
116
|
+
}
|
|
17
117
|
|
|
18
|
-
|
|
118
|
+
watchEffect(() => {
|
|
119
|
+
calendarValue.value = currentDate.value ? dayjs(currentDate.value).valueOf() : null
|
|
120
|
+
from!.value[props.formKey] = currentDate.value
|
|
121
|
+
})
|
|
122
|
+
const onMore = async () => {
|
|
123
|
+
calendarRef.value?.open()
|
|
124
|
+
}
|
|
125
|
+
</script>
|
|
@@ -1,3 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { LcbBlockProps } from '../../components/lcb-block/types'
|
|
2
|
+
|
|
3
|
+
export interface LcbCalendarFilterProps extends LcbBlockProps {
|
|
4
|
+
/**
|
|
5
|
+
* 是否显示"全部"按钮
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
showAll?: boolean
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 当前选中的日期值
|
|
12
|
+
*/
|
|
13
|
+
showMore?: boolean
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 表单key
|
|
17
|
+
*/
|
|
18
|
+
formKey?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface HolidayInfo {
|
|
22
|
+
bottomText?: string
|
|
23
|
+
date: string
|
|
24
|
+
floorText?: string
|
|
25
|
+
topTextOutside?: string
|
|
26
|
+
buttomText?: string
|
|
27
|
+
price: number
|
|
28
|
+
topText?: string
|
|
29
|
+
status: number
|
|
30
|
+
corner?: string
|
|
31
|
+
restFlag: boolean
|
|
3
32
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { HolidayInfo } from '../../types'
|
|
2
|
+
declare let __VLS_typeProps: {
|
|
3
|
+
date?: HolidayInfo
|
|
4
|
+
showAll?: boolean
|
|
5
|
+
customClass: string
|
|
6
|
+
}
|
|
7
|
+
type __VLS_PublicProps = {
|
|
8
|
+
modelValue?: string | undefined
|
|
9
|
+
} & typeof __VLS_typeProps
|
|
10
|
+
declare const _default: import('vue').DefineComponent<
|
|
11
|
+
__VLS_TypePropsToOption<__VLS_PublicProps>,
|
|
12
|
+
{},
|
|
13
|
+
unknown,
|
|
14
|
+
{},
|
|
15
|
+
{},
|
|
16
|
+
import('vue').ComponentOptionsMixin,
|
|
17
|
+
import('vue').ComponentOptionsMixin,
|
|
18
|
+
{
|
|
19
|
+
'update:modelValue': (modelValue: string | undefined) => void
|
|
20
|
+
},
|
|
21
|
+
string,
|
|
22
|
+
import('vue').PublicProps,
|
|
23
|
+
Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<__VLS_PublicProps>>> & {
|
|
24
|
+
'onUpdate:modelValue'?: ((modelValue: string | undefined) => any) | undefined
|
|
25
|
+
},
|
|
26
|
+
{},
|
|
27
|
+
{}
|
|
28
|
+
>
|
|
29
|
+
export default _default
|
|
30
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
|
|
31
|
+
type __VLS_TypePropsToOption<T> = {
|
|
32
|
+
[K in keyof T]-?: {} extends Pick<T, K>
|
|
33
|
+
? {
|
|
34
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>
|
|
35
|
+
}
|
|
36
|
+
: {
|
|
37
|
+
type: import('vue').PropType<T[K]>
|
|
38
|
+
required: true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import 'dayjs/esm/locale/zh-cn'
|
|
2
|
+
import { LcbCalendarFilterProps } from './types'
|
|
1
3
|
declare const _default: import('vue').DefineComponent<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
__VLS_WithDefaults<
|
|
5
|
+
__VLS_TypePropsToOption<LcbCalendarFilterProps>,
|
|
6
|
+
{
|
|
7
|
+
showAll: boolean
|
|
8
|
+
showMore: boolean
|
|
9
|
+
formKey: string
|
|
10
|
+
fontSize: number
|
|
11
|
+
}
|
|
6
12
|
>,
|
|
7
13
|
{},
|
|
8
14
|
unknown,
|
|
@@ -13,20 +19,48 @@ declare const _default: import('vue').DefineComponent<
|
|
|
13
19
|
{},
|
|
14
20
|
string,
|
|
15
21
|
import('vue').PublicProps,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Readonly<
|
|
23
|
+
import('vue').ExtractPropTypes<
|
|
24
|
+
__VLS_WithDefaults<
|
|
25
|
+
__VLS_TypePropsToOption<LcbCalendarFilterProps>,
|
|
26
|
+
{
|
|
27
|
+
showAll: boolean
|
|
28
|
+
showMore: boolean
|
|
29
|
+
formKey: string
|
|
30
|
+
fontSize: number
|
|
31
|
+
}
|
|
24
32
|
>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
>
|
|
34
|
+
>,
|
|
35
|
+
{
|
|
36
|
+
fontSize: number
|
|
37
|
+
showAll: boolean
|
|
38
|
+
showMore: boolean
|
|
39
|
+
formKey: string
|
|
40
|
+
},
|
|
30
41
|
{}
|
|
31
42
|
>
|
|
32
43
|
export default _default
|
|
44
|
+
type __VLS_WithDefaults<P, D> = {
|
|
45
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D
|
|
46
|
+
? __VLS_Prettify<
|
|
47
|
+
P[K] & {
|
|
48
|
+
default: D[K]
|
|
49
|
+
}
|
|
50
|
+
>
|
|
51
|
+
: P[K]
|
|
52
|
+
}
|
|
53
|
+
type __VLS_Prettify<T> = {
|
|
54
|
+
[K in keyof T]: T[K]
|
|
55
|
+
} & {}
|
|
56
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
|
|
57
|
+
type __VLS_TypePropsToOption<T> = {
|
|
58
|
+
[K in keyof T]-?: {} extends Pick<T, K>
|
|
59
|
+
? {
|
|
60
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>
|
|
61
|
+
}
|
|
62
|
+
: {
|
|
63
|
+
type: import('vue').PropType<T[K]>
|
|
64
|
+
required: true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -1 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
import { LcbBlockProps } from '../../components/lcb-block/types'
|
|
2
|
+
export interface LcbCalendarFilterProps extends LcbBlockProps {
|
|
3
|
+
/**
|
|
4
|
+
* 是否显示"全部"按钮
|
|
5
|
+
* @default true
|
|
6
|
+
*/
|
|
7
|
+
showAll?: boolean
|
|
8
|
+
/**
|
|
9
|
+
* 当前选中的日期值
|
|
10
|
+
*/
|
|
11
|
+
showMore?: boolean
|
|
12
|
+
/**
|
|
13
|
+
* 表单key
|
|
14
|
+
*/
|
|
15
|
+
formKey?: string
|
|
16
|
+
}
|
|
17
|
+
export interface HolidayInfo {
|
|
18
|
+
bottomText?: string
|
|
19
|
+
date: string
|
|
20
|
+
floorText?: string
|
|
21
|
+
topTextOutside?: string
|
|
22
|
+
buttomText?: string
|
|
23
|
+
price: number
|
|
24
|
+
topText?: string
|
|
25
|
+
status: number
|
|
26
|
+
corner?: string
|
|
27
|
+
restFlag: boolean
|
|
28
|
+
}
|
|
@@ -179,13 +179,13 @@ declare const _default: import('vue').DefineComponent<
|
|
|
179
179
|
modelValue: unknown[]
|
|
180
180
|
width: string | number
|
|
181
181
|
height: string | number
|
|
182
|
+
showScrollbar: boolean
|
|
182
183
|
columnCount: string | number
|
|
183
184
|
columnGap: string | number
|
|
184
185
|
idKey: string
|
|
185
186
|
addTime: number
|
|
186
187
|
leftGap: string | number
|
|
187
188
|
rightGap: string | number
|
|
188
|
-
showScrollbar: boolean
|
|
189
189
|
},
|
|
190
190
|
{}
|
|
191
191
|
>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { HolidayInfo } from '../components/lcb-calendar-filter/types'
|
|
2
|
+
import dayjs from 'dayjs/esm'
|
|
3
|
+
|
|
4
|
+
export const calendarFormatter =
|
|
5
|
+
(holidayInfo: Record<string, HolidayInfo>, t: (key: string) => string) => (day: any) => {
|
|
6
|
+
const date = new Date(day.date)
|
|
7
|
+
const now = new Date()
|
|
8
|
+
|
|
9
|
+
const year = date.getFullYear()
|
|
10
|
+
const month = date.getMonth()
|
|
11
|
+
const da = date.getDate()
|
|
12
|
+
const nowYear = now.getFullYear()
|
|
13
|
+
const nowMonth = now.getMonth()
|
|
14
|
+
const nowDa = now.getDate()
|
|
15
|
+
const info = holidayInfo[dayjs(day.date).format('YYYY-MM-DD')]
|
|
16
|
+
if (info?.bottomText) {
|
|
17
|
+
day.bottomInfo = info.bottomText
|
|
18
|
+
}
|
|
19
|
+
if (year === nowYear && month === nowMonth && da === nowDa) {
|
|
20
|
+
day.topInfo = t('今天')
|
|
21
|
+
}
|
|
22
|
+
if (info?.floorText) {
|
|
23
|
+
day.floorText = info.floorText
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (day.type === 'start') {
|
|
27
|
+
day.topInfo = t('开始')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (day.type === 'end') {
|
|
31
|
+
day.topInfo = t('结束')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (day.type === 'same') {
|
|
35
|
+
day.bottomInfo = t('开始/结束')
|
|
36
|
+
}
|
|
37
|
+
if (info?.status !== 1) {
|
|
38
|
+
day.disabled = true
|
|
39
|
+
}
|
|
40
|
+
day.restFlag = info?.restFlag
|
|
41
|
+
|
|
42
|
+
return day
|
|
43
|
+
}
|