Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(calendar-view): [calendar-view] Fix bug with invalid calendar hei… #2520

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/sites/demos/apis/calendar-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default {
},
{
name: 'height',
type: 'string',
type: 'string | number',
defaultValue: '',
desc: {
'zh-CN': '日历高度',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { test, expect } from '@playwright/test'
test('日期禁用', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('calendar-view#calendar-disabled-day')
const day10 = page.getByText('10').nth(3)
const day10 = page.getByText('10').nth(1)
const day14 = page.getByText('14').nth(1)
const day15 = page.getByText('15').nth(1)
const day15 = page.getByText('15').nth(2)
await expect(day10).toHaveClass(/is-disabled/)
await expect(day14).toHaveClass(/is-disabled/)
await expect(day15).toHaveClass('date')
Expand Down
1 change: 1 addition & 0 deletions packages/theme/src/calendar-view/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
padding-top: 32px;
border: 1px solid #ebebeb;
background-color: var(--tv-CalendarView-bg-color);
overflow: auto;

&__header {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/src/calendar-view/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const calendarViewProps = {
}
},
height: {
type: String,
type: [String, Number],
Youyou-smiles marked this conversation as resolved.
Show resolved Hide resolved
default: ''
},
markColor: {
Expand Down
10 changes: 5 additions & 5 deletions packages/vue/src/calendar-view/src/pc.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="tiny-calendar-view">
<div class="tiny-calendar-view" :style="{ 'height': typeof height === 'number' ? height + 'px' : height }">
<div class="tiny-calendar-view__header">
<div>
<tiny-button @click="toToday">{{ t('ui.calendarView.backToday') }}</tiny-button>
Expand Down Expand Up @@ -58,8 +58,8 @@
day.isLast || day.isNext
? 'is-next-or-last'
: isToday(day) || isSelectedDate(day)
? 'is-selected'
: '',
? 'is-selected'
: '',
day.disabled ? 'is-disabled' : ''
]"
>
Expand Down Expand Up @@ -133,7 +133,7 @@
<icon-chevron-right></icon-chevron-right>
</div>
</div>
<div v-if="state.mode === 'timeline'" class="tiny-calendar-view-week__timeline" :style="{ 'height': height }">
<div v-if="state.mode === 'timeline'" class="tiny-calendar-view-week__timeline">
<div class="day-times">
<ul>
<li v-for="(item, i) in state.dayTimes" :key="item.time" :class="i % 2 === 1 && 'is-odd-num'">
Expand Down Expand Up @@ -186,7 +186,7 @@
</ul>
</div>
</div>
<div v-if="state.mode === 'schedule'" class="tiny-calendar-view-week__schedule" :style="{ 'height': height }">
<div v-if="state.mode === 'schedule'" class="tiny-calendar-view-week__schedule">
<ul>
<li v-for="(date, index) in state.weekDates" :key="date.value" style="width: 14.28%">
<slot
Expand Down
Loading