Skip to content

Commit 9dd46da

Browse files
authored
feat(calendar): support deleteIcon props (#2644)
1 parent f9047d6 commit 9dd46da

File tree

8 files changed

+14
-0
lines changed

8 files changed

+14
-0
lines changed

src/packages/calendar/calendar.taro.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface CalendarProps {
2323
showSubTitle?: boolean
2424
scrollAnimation?: boolean
2525
firstDayOfWeek: number
26+
closeIcon?: ReactNode
2627
disableDate: (date: CalendarDay) => boolean
2728
renderHeaderButtons?: () => string | JSX.Element
2829
renderDay?: (date: CalendarDay) => string | JSX.Element
@@ -88,6 +89,7 @@ export const Calendar = React.forwardRef<
8889
showSubTitle,
8990
scrollAnimation,
9091
firstDayOfWeek,
92+
closeIcon,
9193
disableDate,
9294
renderHeaderButtons,
9395
renderDay,
@@ -176,6 +178,7 @@ export const Calendar = React.forwardRef<
176178
onOverlayClick={closePopup}
177179
onCloseIconClick={closePopup}
178180
style={{ height: '83%' }}
181+
closeIcon={closeIcon}
179182
>
180183
{renderItem()}
181184
</Popup>

src/packages/calendar/calendar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface CalendarProps {
2323
showSubTitle?: boolean
2424
scrollAnimation?: boolean
2525
firstDayOfWeek: number
26+
closeIcon?: ReactNode
2627
disableDate: (date: CalendarDay) => boolean
2728
renderHeaderButtons?: () => string | JSX.Element
2829
renderDay?: (date: CalendarDay) => string | JSX.Element
@@ -88,6 +89,7 @@ export const Calendar = React.forwardRef<
8889
showSubTitle,
8990
scrollAnimation,
9091
firstDayOfWeek,
92+
closeIcon,
9193
disableDate,
9294
renderHeaderButtons,
9395
renderDay,
@@ -172,6 +174,7 @@ export const Calendar = React.forwardRef<
172174
position="bottom"
173175
round
174176
closeable
177+
closeIcon={closeIcon}
175178
destroyOnClose
176179
onOverlayClick={closePopup}
177180
onCloseIconClick={closePopup}

src/packages/calendar/demos/h5/demo1.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState } from 'react'
22
import { Cell, Calendar } from '@nutui/nutui-react'
3+
import { Star } from '@nutui/icons-react'
34

45
const Demo1 = () => {
56
const d = new Date()
@@ -39,6 +40,7 @@ const Demo1 = () => {
3940
onClose={closeSwitch}
4041
onConfirm={setChooseValue}
4142
onDayClick={select}
43+
closeIcon={<Star />}
4244
/>
4345
</>
4446
)

src/packages/calendar/demos/taro/demo1.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState } from 'react'
22
import { Cell, Calendar } from '@nutui/nutui-react-taro'
3+
import { Star } from '@nutui/icons-react'
34

45
const Demo1 = () => {
56
const d = new Date()
@@ -39,6 +40,7 @@ const Demo1 = () => {
3940
onClose={closeSwitch}
4041
onConfirm={setChooseValue}
4142
onDayClick={select}
43+
closeIcon={<Star />}
4244
/>
4345
</>
4446
)

src/packages/calendar/doc.en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ import { Calendar } from '@nutui/nutui-react'
120120
| showSubTitle | whether to show sub title for calendar | `boolean` | `true` |
121121
| scrollAnimation | whether to start scroll animation | `boolean` | `true` |
122122
| firstDayOfWeek | first day of week | `0-6` | `0` |
123+
| closeIcon | Custom Icon | `ReactNode` | `close` |
123124
| disableDate | set disable date | `(date: CalendarDay) => boolean` | `-` |
124125
| renderHeaderButtons | custom buttons, under the title but above the subtitle | `() => string` \| `JSX.Element` | `-` |
125126
| renderDay | day info | `(date: CalendarDay) => string` \| `JSX.Element` | `-` |

src/packages/calendar/doc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ import { Calendar } from '@nutui/nutui-react'
120120
| showSubTitle | 是否展示日期标题 | `boolean` | `true` |
121121
| scrollAnimation | 是否启动滚动动画 | `boolean` | `true` |
122122
| firstDayOfWeek | 设置周起始日 | `0-6` | `0` |
123+
| closeIcon | 自定义 Icon | `ReactNode` | `close` |
123124
| disableDate | 设置不可选日期 | `(date: CalendarDay) => boolean` | `-` |
124125
| renderHeaderButtons | 自定义日历标题下部,可用以添加自定义操作 | `() => string` \| `JSX.Element` | `-` |
125126
| renderDay | 日期信息 | `(date: CalendarDay) => string` \| `JSX.Element` | `-` |

src/packages/calendar/doc.taro.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ import { Calendar } from '@nutui/nutui-react-taro'
120120
| showSubTitle | 是否展示日期标题 | `boolean` | `true` |
121121
| scrollAnimation | 是否启动滚动动画 | `boolean` | `true` |
122122
| firstDayOfWeek | 设置周起始日 | `0-6` | `0` |
123+
| closeIcon | 自定义 Icon | `ReactNode` | `close` |
123124
| disableDate | 设置不可选日期 | `(date: CalendarDay) => boolean` | `-` |
124125
| renderHeaderButtons | 自定义日历标题下部,可用以添加自定义操作 | `() => string` \| `JSX.Element` | `-` |
125126
| renderDay | 日期信息 | `(date: CalendarDay) => string` \| `JSX.Element` | `-` |

src/packages/calendar/doc.zh-TW.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ import { Calendar } from '@nutui/nutui-react'
120120
| showSubTitle | 是否展示日期標題 | `boolean` | `true` |
121121
| scrollAnimation | 是否啟動滾動動畫 | `boolean` | `true` |
122122
| firstDayOfWeek | 設置周起始日 | `0-6` | `0` |
123+
| closeIcon | 自定義 Icon | `ReactNode` | `close` |
123124
| disableDate | 設置不可選日期 | `(date: CalendarDay) => boolean` | `-` |
124125
| renderHeaderButtons | 自定義日歴標題下部,可用以添加自定義操作 | `() => string` \| `JSX.Element` | `-` |
125126
| renderDay | 日期信息 | `(date: CalendarDay) => string` \| `JSX.Element` | `-` |

0 commit comments

Comments
 (0)