diff --git a/.github/workflows/doc-site.yml b/.github/workflows/doc-site.yml index b91fb02193..772ede7fec 100644 --- a/.github/workflows/doc-site.yml +++ b/.github/workflows/doc-site.yml @@ -44,13 +44,14 @@ jobs: run: | pnpm run build-doc - - name: Deploy to Surge - uses: dswistowski/surge-sh-action@v1 - with: - domain: 'antd-mobile.surge.sh' - project: './dist' - login: ${{ secrets.SURGE_LOGIN }} - token: ${{ secrets.SURGE_TOKEN }} + # Note: We miss the url permission for surge.sh, so we can't use it now. + # - name: Deploy to Surge + # uses: dswistowski/surge-sh-action@v1 + # with: + # domain: 'antd-mobile.surge.sh' + # project: './dist' + # login: ${{ secrets.SURGE_LOGIN }} + # token: ${{ secrets.SURGE_TOKEN }} - name: Deploy to Surge (with SHA) uses: dswistowski/surge-sh-action@v1 diff --git a/docs/components/components/Main/MainSection/index.tsx b/docs/components/components/Main/MainSection/index.tsx index 1cdc5d283f..b45b7993de 100644 --- a/docs/components/components/Main/MainSection/index.tsx +++ b/docs/components/components/Main/MainSection/index.tsx @@ -2,6 +2,7 @@ import { Button } from 'antd-mobile' import React, { useEffect, useState } from 'react' import Lottie from 'react-lottie' import { useTrans } from '../../../../hooks/useTrans' +import { openUrl } from '../../../../utils' import styles from './index.local.less' export default (props: { isWidthScreen: boolean }) => { @@ -39,7 +40,11 @@ export default (props: { isWidthScreen: boolean }) => { color='primary' shape='rounded' className={styles.buttonLeft} - href={trans('/guide/quick-start', '/zh/guide/quick-start')} + onClick={() => + openUrl({ + href: trans('/guide/quick-start', '/zh/guide/quick-start'), + }) + } > {trans('Get Start', '开始使用')} @@ -47,7 +52,11 @@ export default (props: { isWidthScreen: boolean }) => { color='primary' shape='rounded' className={styles.buttonRight} - href={trans('/components', '/zh/components')} + onClick={() => + openUrl({ + href: trans('/components', '/zh/components'), + }) + } > {trans('Preview Online', '在线体验')} diff --git a/docs/components/components/Main/index.tsx b/docs/components/components/Main/index.tsx index 72858027d7..9187d6974e 100644 --- a/docs/components/components/Main/index.tsx +++ b/docs/components/components/Main/index.tsx @@ -4,6 +4,7 @@ import { Button, Card } from 'antd-mobile' import React, { useEffect, useRef, useState } from 'react' import Lottie from 'react-lottie' import { useTrans } from '../../../hooks/useTrans' +import { openUrl } from '../../../utils' import MainSection from './MainSection' import { getGuides, @@ -99,10 +100,12 @@ export default () => { diff --git a/docs/utils/index.ts b/docs/utils/index.ts new file mode 100644 index 0000000000..475892cdda --- /dev/null +++ b/docs/utils/index.ts @@ -0,0 +1,15 @@ +export const openUrl = ({ + href, + target, +}: { + href: string + target?: string +}) => { + switch (target) { + case '_blank': + window.open(href, target) + break + default: + window.location.href = href + } +} diff --git a/package.json b/package.json index 285a806a52..737d913bde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd-mobile", - "version": "5.38.0", + "version": "5.38.1", "homepage": "https://github.com/ant-design/ant-design-mobile#readme", "bugs": { "url": "https://github.com/ant-design/ant-design-mobile/issues" diff --git a/src/components/calendar-picker-view/calendar-picker-view.en.md b/src/components/calendar-picker-view/calendar-picker-view.en.md index 101399cd95..606192c3e5 100644 --- a/src/components/calendar-picker-view/calendar-picker-view.en.md +++ b/src/components/calendar-picker-view/calendar-picker-view.en.md @@ -21,8 +21,8 @@ Only the simplest content area is shown here, and other more usages can be consu | max | Maximum value of a selectable range. | `Date` | - | | min | Minimum value of a selectable range. | `Date` | - | - | | onChange | Trigger when selected date changes. | `(val: Date \| null) => void` when selection mode is "single". `(val: [Date, Date] \| null) => void` when selection mode is "range". | - | -| renderTop | The top information of date render function. | `(date: Date) => ReactNode \| null \| undefined` | - | -| renderBottom | The bottom information of date render function. | `(date: Date) => ReactNode \| null \| undefined` | - | +| renderTop | The top information of date render function. | `((date: Date) => ReactNode \| null \| undefined) \| false` | - | `false`: 5.38.0 | +| renderBottom | The bottom information of date render function. | `((date: Date) => ReactNode \| null \| undefined) \| false` | - | `false`: 5.38.0 | | selectionMode | The selection mode. Disable selection when this prop is not set. | `'single' \| 'range'` | - | | shouldDisableDate | Set whether the date is disable selection. The min and max Settings are ignored | `(date: Date) => boolean` | - | | title | The title of calendar | `React.ReactNode` | `Date selection` | diff --git a/src/components/calendar-picker-view/calendar-picker-view.tsx b/src/components/calendar-picker-view/calendar-picker-view.tsx index f08621e975..e3eda2bc82 100644 --- a/src/components/calendar-picker-view/calendar-picker-view.tsx +++ b/src/components/calendar-picker-view/calendar-picker-view.tsx @@ -41,13 +41,15 @@ export type CalendarPickerViewRef = { getDateRange: () => DateRange } +export type CalendarPickerViewColumRender = (date: Date) => ReactNode + export type CalendarPickerViewProps = { title?: React.ReactNode | false confirmText?: string weekStartsOn?: 'Monday' | 'Sunday' - renderTop?: (date: Date) => React.ReactNode - renderDate?: (date: Date) => React.ReactNode - renderBottom?: (date: Date) => React.ReactNode + renderTop?: CalendarPickerViewColumRender | false + renderDate?: CalendarPickerViewColumRender + renderBottom?: CalendarPickerViewColumRender | false allowClear?: boolean max?: Date min?: Date @@ -269,26 +271,45 @@ export const CalendarPickerView = forwardRef< (minDay && d.isBefore(minDay, 'day')) const renderTop = () => { + if (props.renderTop === false) return null + + const contentWrapper = (content: ReactNode) => ( +