From d4221416979c1f1ae4380e288dd5b6f50f3187cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=90=86=E5=A1=98=E7=9A=84=E5=B8=8C=E6=9C=9B?= <1587315093@qq.com> Date: Tue, 27 Jun 2023 10:33:21 +0800 Subject: [PATCH 1/6] style: repair push(child) type warning (#6163) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * style: 修复多出push(child)的提示&import React处优化 * style: 重复的if语句合并 --- src/components/calendar/convert.ts | 8 ++------ src/components/capsule-tabs/capsule-tabs.tsx | 6 +++--- src/components/collapse/collapse.tsx | 7 ++++--- src/components/dropdown/dropdown.tsx | 3 ++- src/components/jumbo-tabs/jumbo-tabs.tsx | 7 ++++--- src/components/rate/star.tsx | 2 +- src/components/safe-area/safe-area.tsx | 5 +++-- src/components/side-bar/side-bar.tsx | 8 ++++---- src/components/skeleton/skeleton.tsx | 2 +- src/components/tab-bar/tab-bar.tsx | 7 +++---- src/components/tabs/tabs.tsx | 7 ++++--- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/components/calendar/convert.ts b/src/components/calendar/convert.ts index c692261608..11c6eea7d3 100644 --- a/src/components/calendar/convert.ts +++ b/src/components/calendar/convert.ts @@ -5,12 +5,8 @@ export function convertValueToRange( selectionMode: 'single' | 'range' | undefined, value: Date | [Date, Date] | null ): DateRange { - if (selectionMode === undefined) { - return null - } - if (value === null) { - return null - } + if (selectionMode === undefined || value === null) return null + if (Array.isArray(value)) { return value } diff --git a/src/components/capsule-tabs/capsule-tabs.tsx b/src/components/capsule-tabs/capsule-tabs.tsx index 1dc0470e35..b1bba7f26b 100644 --- a/src/components/capsule-tabs/capsule-tabs.tsx +++ b/src/components/capsule-tabs/capsule-tabs.tsx @@ -2,7 +2,7 @@ import React, { FC, ReactNode, ReactElement, - ComponentProps, + isValidElement, useRef, } from 'react' import classNames from 'classnames' @@ -42,10 +42,10 @@ export const CapsuleTabs: FC = props => { const keyToIndexRecord: Record = {} let firstActiveKey: string | null = null - const panes: ReactElement>[] = [] + const panes: ReactElement[] = [] traverseReactNode(props.children, (child, index) => { - if (!React.isValidElement(child)) return + if (!isValidElement(child)) return const key = child.key if (typeof key !== 'string') return if (index === 0) { diff --git a/src/components/collapse/collapse.tsx b/src/components/collapse/collapse.tsx index 0011063e49..02190e3138 100644 --- a/src/components/collapse/collapse.tsx +++ b/src/components/collapse/collapse.tsx @@ -1,4 +1,4 @@ -import React, { FC, ReactElement, ComponentProps, useRef } from 'react' +import React, { FC, ReactElement, isValidElement, useRef } from 'react' import { NativeProps, withNativeProps } from '../../utils/native-props' import List from '../list' import { DownOutline } from 'antd-mobile-icons' @@ -120,11 +120,12 @@ export type CollapseProps = ( } & NativeProps export const Collapse: FC = props => { - const panels: ReactElement>[] = [] + const panels: ReactElement[] = [] traverseReactNode(props.children, child => { - if (!React.isValidElement(child)) return + if (!isValidElement(child)) return const key = child.key if (typeof key !== 'string') return + panels.push(child) }) diff --git a/src/components/dropdown/dropdown.tsx b/src/components/dropdown/dropdown.tsx index ed60fe1324..3eb5f2e702 100644 --- a/src/components/dropdown/dropdown.tsx +++ b/src/components/dropdown/dropdown.tsx @@ -9,6 +9,7 @@ import React, { useState, forwardRef, useImperativeHandle, + isValidElement, } from 'react' import Popup, { PopupProps } from '../popup' import Item, { ItemChildrenWrap } from './item' @@ -84,7 +85,7 @@ const Dropdown = forwardRef< let popupForceRender = false const items: ReactElement>[] = [] const navs = React.Children.map(props.children, child => { - if (React.isValidElement(child)) { + if (isValidElement>(child)) { const childProps = { ...child.props, onClick: () => { diff --git a/src/components/jumbo-tabs/jumbo-tabs.tsx b/src/components/jumbo-tabs/jumbo-tabs.tsx index a0885837d1..176c5026b5 100644 --- a/src/components/jumbo-tabs/jumbo-tabs.tsx +++ b/src/components/jumbo-tabs/jumbo-tabs.tsx @@ -2,7 +2,7 @@ import React, { FC, ReactNode, ReactElement, - ComponentProps, + isValidElement, useRef, } from 'react' import classNames from 'classnames' @@ -43,12 +43,13 @@ export const JumboTabs: FC = props => { const keyToIndexRecord: Record = {} let firstActiveKey: string | null = null - const panes: ReactElement>[] = [] + const panes: ReactElement[] = [] traverseReactNode(props.children, (child, index) => { - if (!React.isValidElement(child)) return + if (!isValidElement(child)) return const key = child.key if (typeof key !== 'string') return + if (index === 0) { firstActiveKey = key } diff --git a/src/components/rate/star.tsx b/src/components/rate/star.tsx index cb640c4304..84ff300975 100644 --- a/src/components/rate/star.tsx +++ b/src/components/rate/star.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { FC } from 'react' +import type { FC } from 'react' export const Star: FC = () => { return ( diff --git a/src/components/safe-area/safe-area.tsx b/src/components/safe-area/safe-area.tsx index cdf9ef5809..ef1d3e7fa1 100644 --- a/src/components/safe-area/safe-area.tsx +++ b/src/components/safe-area/safe-area.tsx @@ -1,6 +1,7 @@ -import { FC } from 'react' -import { NativeProps, withNativeProps } from '../../utils/native-props' import React from 'react' +import type { FC } from 'react' +import { NativeProps, withNativeProps } from '../../utils/native-props' + import classNames from 'classnames' const classPrefix = 'adm-safe-area' diff --git a/src/components/side-bar/side-bar.tsx b/src/components/side-bar/side-bar.tsx index cce90d4343..e5243b4c9a 100644 --- a/src/components/side-bar/side-bar.tsx +++ b/src/components/side-bar/side-bar.tsx @@ -1,5 +1,4 @@ -import { FC, ReactNode, ReactElement, ComponentProps } from 'react' -import React from 'react' +import React, { FC, ReactNode, ReactElement, isValidElement } from 'react' import classNames from 'classnames' import Badge, { BadgeProps } from '../badge' import { NativeProps, withNativeProps } from '../../utils/native-props' @@ -32,12 +31,13 @@ export type SideBarProps = { export const SideBar: FC = props => { let firstActiveKey: string | null = null - const items: ReactElement>[] = [] + const items: ReactElement[] = [] traverseReactNode(props.children, (child, index) => { - if (!React.isValidElement(child)) return + if (!isValidElement(child)) return const key = child.key if (typeof key !== 'string') return + if (index === 0) { firstActiveKey = key } diff --git a/src/components/skeleton/skeleton.tsx b/src/components/skeleton/skeleton.tsx index 5fbbd81d86..5c08f4efbe 100644 --- a/src/components/skeleton/skeleton.tsx +++ b/src/components/skeleton/skeleton.tsx @@ -1,5 +1,5 @@ -import { FC } from 'react' import React from 'react' +import type { FC } from 'react' import { NativeProps, withNativeProps } from '../../utils/native-props' import classNames from 'classnames' import { generateIntArray } from '../../utils/generate-int-array' diff --git a/src/components/tab-bar/tab-bar.tsx b/src/components/tab-bar/tab-bar.tsx index df0fc130de..13be270d16 100644 --- a/src/components/tab-bar/tab-bar.tsx +++ b/src/components/tab-bar/tab-bar.tsx @@ -1,5 +1,4 @@ -import { FC, ReactNode, ReactElement, ComponentProps } from 'react' -import React from 'react' +import React, { FC, ReactNode, ReactElement, isValidElement } from 'react' import classNames from 'classnames' import { NativeProps, withNativeProps } from '../../utils/native-props' import { mergeProps } from '../../utils/with-default-props' @@ -38,10 +37,10 @@ export const TabBar: FC = p => { let firstActiveKey: string | null = null - const items: ReactElement>[] = [] + const items: ReactElement[] = [] traverseReactNode(props.children, (child, index) => { - if (!React.isValidElement(child)) return + if (!isValidElement(child)) return const key = child.key if (typeof key !== 'string') return if (index === 0) { diff --git a/src/components/tabs/tabs.tsx b/src/components/tabs/tabs.tsx index 9beab2cd13..3301f15ef0 100644 --- a/src/components/tabs/tabs.tsx +++ b/src/components/tabs/tabs.tsx @@ -2,7 +2,7 @@ import React, { FC, ReactNode, ReactElement, - ComponentProps, + isValidElement, useRef, } from 'react' import classNames from 'classnames' @@ -61,10 +61,11 @@ export const Tabs: FC = p => { const keyToIndexRecord: Record = {} let firstActiveKey: string | null = null - const panes: ReactElement>[] = [] + const panes: ReactElement[] = [] traverseReactNode(props.children, (child, index) => { - if (!React.isValidElement(child)) return + if (!isValidElement(child)) return + const key = child.key if (typeof key !== 'string') return if (index === 0) { From 1312272ec10ddbd90800dc876646f0aaf01f0c60 Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Wed, 28 Jun 2023 13:25:28 +0500 Subject: [PATCH 2/6] feat: russian language support added (#6224) Co-authored-by: goodmice --- docs/guide/i18n.en.md | 1 + docs/guide/i18n.zh.md | 1 + .../config-provider.test.tsx.snap | 1218 +++++++++++++++++ .../tests/config-provider.test.tsx | 2 + src/locales/ru-RU.ts | 141 ++ 5 files changed, 1363 insertions(+) create mode 100644 src/locales/ru-RU.ts diff --git a/docs/guide/i18n.en.md b/docs/guide/i18n.en.md index cb1c01666a..28805a62c1 100644 --- a/docs/guide/i18n.en.md +++ b/docs/guide/i18n.en.md @@ -33,6 +33,7 @@ The following languages are currently supported: | Danish | da-DK | | Norwegian (Bokmål) | nb-NO | | Dutch (Netherlands) | nl-NL | +| Russian (Russia) | ru-RU | See more usage at [ConfigProvider](../components/config-provider). diff --git a/docs/guide/i18n.zh.md b/docs/guide/i18n.zh.md index a692b6f23a..d0e8125762 100644 --- a/docs/guide/i18n.zh.md +++ b/docs/guide/i18n.zh.md @@ -33,6 +33,7 @@ return ( | 丹麦语 | da-DK | | 挪威 | nb-NO | | 荷兰语 | nl-NL | +| 俄罗斯语 | ru-RU | 具体的使用方法请参考 [ConfigProvider](../components/config-provider) 文档。 diff --git a/src/components/config-provider/tests/__snapshots__/config-provider.test.tsx.snap b/src/components/config-provider/tests/__snapshots__/config-provider.test.tsx.snap index 08dcae1e05..da49dbf8ce 100644 --- a/src/components/config-provider/tests/__snapshots__/config-provider.test.tsx.snap +++ b/src/components/config-provider/tests/__snapshots__/config-provider.test.tsx.snap @@ -14616,6 +14616,1224 @@ exports[`ConfigProvider should display the text as nl-NL 1`] = ` `; +exports[`ConfigProvider should display the text as ru 1`] = ` +
+
+ +
+
+ Вс +
+
+ Пн +
+
+ Вт +
+
+ Ср +
+
+ Чт +
+
+ Пт +
+
+ Сб +
+
+
+
+
+ 27 +
+
+
+
+
+ 28 +
+
+
+
+
+ 1 +
+
+
+
+
+ 2 +
+
+
+
+
+ 3 +
+
+
+
+
+ 4 +
+
+
+
+
+ 5 +
+
+
+
+
+ 6 +
+
+
+
+
+ 7 +
+
+
+
+
+ 8 +
+
+
+
+
+ 9 +
+
+
+
+
+ 10 +
+
+
+
+
+ 11 +
+
+
+
+
+ 12 +
+
+
+
+
+ 13 +
+
+
+
+
+ 14 +
+
+
+
+
+ 15 +
+
+
+
+
+ 16 +
+
+
+
+
+ 17 +
+
+
+
+
+ 18 +
+
+
+
+
+ 19 +
+
+
+
+
+ 20 +
+
+
+
+
+ 21 +
+
+
+
+
+ 22 +
+
+
+
+
+ 23 +
+
+
+
+
+ 24 +
+
+
+
+
+ 25 +
+
+
+
+
+ 26 +
+
+
+
+
+ 27 +
+
+
+
+
+ 28 +
+
+
+
+
+ 29 +
+
+
+
+
+ 30 +
+
+
+
+
+ 31 +
+
+
+
+
+ 1 +
+
+
+
+
+ 2 +
+
+
+
+
+ 3 +
+
+
+
+
+ 4 +
+
+
+
+
+ 5 +
+
+
+
+
+ 6 +
+
+
+
+
+ 7 +
+
+
+
+
+ 8 +
+
+
+
+
+ 9 +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ Упс! Что-то пошло не так +
+
+ Пожалуйста, подождите минуту и повторите попытку +
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+ + + +
+ +
+ + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + + +
+
+
+
+
+`; + exports[`ConfigProvider should display the text as zh-CH 1`] = `
{ diff --git a/src/locales/ru-RU.ts b/src/locales/ru-RU.ts new file mode 100644 index 0000000000..37d736257c --- /dev/null +++ b/src/locales/ru-RU.ts @@ -0,0 +1,141 @@ +import { mergeLocale } from '../utils/merge-locale' +import { base } from './base' + +const typeTemplate = '${label} не соответствует типу ${type}' + +const ruRU = mergeLocale(base, { + locale: 'ru', + common: { + confirm: 'Подтвердить', + cancel: 'Отменить', + loading: 'Загрузка', + close: 'Закрыть', + }, + Calendar: { + markItems: ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'], + renderYearAndMonth: (year: number, month: number) => `${year}/${month}`, + }, + Cascader: { + placeholder: 'Выбор', + }, + Dialog: { + ok: 'ОК', + }, + DatePicker: { + tillNow: 'До настоящего времени', + }, + ErrorBlock: { + default: { + title: 'Упс! Что-то пошло не так', + description: 'Пожалуйста, подождите минуту и повторите попытку', + }, + busy: { + title: 'Упс, не загружается', + description: 'Попробуйте обновить страницу', + }, + disconnected: { + title: 'Сеть занята', + description: 'Попробуйте обновить страницу', + }, + empty: { + title: 'Хм, не могу найти...', + description: 'Хотите попробовать другой запрос?', + }, + }, + Form: { + required: 'Обязательное', + optional: 'Опциональное', + defaultValidateMessages: { + default: 'Ошибка валидации поля ${label}', + required: 'Пожалуйста, заполните поле ${label}', + enum: 'Значение ${label} должно быть одним из [${enum}]', + whitespace: '${label} не может быть пустым символом', + date: { + format: '${label} имеет некорректный формат даты', + parse: '${label} не может быть конвертировано в дату', + invalid: '${label} не является валидной датой', + }, + types: { + string: typeTemplate, + method: typeTemplate, + array: typeTemplate, + object: typeTemplate, + number: typeTemplate, + date: typeTemplate, + boolean: typeTemplate, + integer: typeTemplate, + float: typeTemplate, + regexp: typeTemplate, + email: typeTemplate, + url: typeTemplate, + hex: typeTemplate, + }, + string: { + len: 'Длина ${label} должна быть ${len} символов(-а)', + min: 'Длина ${label} должна быть не меньше ${min} символов(-а)', + max: 'Длина ${label} должна быть не больше ${max} символов(-а)', + range: + 'Длина ${label} должна быть в диапазоне от ${min} до ${max} символов(-а)', + }, + number: { + len: '${label} должно быть равно ${len}', + min: '${label} должно быть значением не меньше ${min}', + max: '${label} должно быть значением не больше ${max}', + range: '${label} должно быть значением в диапазоне от ${min} до ${max}', + }, + array: { + len: 'Размер ${label} должен быть ${len}', + min: 'Размер ${label} должен быть не меньше ${min}', + max: 'Размер ${label} должен быть не больше ${max}', + range: 'Размер ${label} должен быть в диапазоне от ${min} до ${max}', + }, + pattern: { + mismatch: '${label} не соответствует шаблону ${pattern}', + }, + }, + }, + ImageUploader: { + uploading: 'Выгружается...', + upload: 'Выгрузить', + }, + InfiniteScroll: { + noMore: 'Больше нет', + failedToLoad: 'Ошибка загрузки', + retry: 'Повторить', + }, + Input: { + clear: 'очистить', + }, + Mask: { + name: 'Маска', + }, + Modal: { + ok: 'ОК', + }, + PasscodeInput: { + name: 'Ввод пароля', + }, + PullToRefresh: { + pulling: 'Прокрутите вниз, чтобы обновления', + canRelease: 'Отпустите, чтобы немедленно обновить', + complete: 'Обновление успешно', + }, + SearchBar: { + name: 'Панель поиска', + }, + Slider: { + name: 'Слайдер', + }, + Stepper: { + decrease: 'вычесть', + increase: 'прибавить', + }, + Switch: { + name: 'Переключатель', + }, + Selector: { + name: 'Селектор', + }, +}) + +export default ruRU From d6b0f92b357e661aeb6a0b5374ccdfc34b1f3543 Mon Sep 17 00:00:00 2001 From: Wing <1587315093@qq.com> Date: Tue, 4 Jul 2023 14:50:14 +0800 Subject: [PATCH 3/6] enhance: Radio add click event (#6228) * enhance: label add stopPropagation * enhance: radio add click event * test: add click case --- src/components/radio/index.en.md | 1 + src/components/radio/index.zh.md | 1 + src/components/radio/radio.tsx | 2 ++ src/components/radio/tests/radio.test.tsx | 10 +++++++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/radio/index.en.md b/src/components/radio/index.en.md index 2d5594cf39..74037c8215 100644 --- a/src/components/radio/index.en.md +++ b/src/components/radio/index.en.md @@ -31,6 +31,7 @@ type RadioValue = string | number | icon | Customized `icon` icon | `(checked: boolean) => React.ReactNode` | - | | id | The id of the input element, often used in conjunction with the label | `string` | - | | onChange | Callback function when checked is changed | `(val: boolean) => void` | - | +| onClick | Radio's click event | `(event: React.MouseEvent) => void` | - | | value | Value is carrying identification, used in `Group` mode | `RadioValue` | - | ### Radio.Group diff --git a/src/components/radio/index.zh.md b/src/components/radio/index.zh.md index 33e6753ce6..b9d448e89c 100644 --- a/src/components/radio/index.zh.md +++ b/src/components/radio/index.zh.md @@ -31,6 +31,7 @@ type RadioValue = string | number | icon | 自定义 `icon` 图标 | `(checked: boolean) => React.ReactNode` | - | | id | `input` 元素的 `id`,常用来配合 `label` 使用 | `string` | - | | onChange | 变化时回调函数 | `(val: boolean) => void` | - | +| onClick | Radio 的点击事件 | `(event: React.MouseEvent) => void` | - | | value | 携带的标识值,用于 `Group` 模式 | `RadioValue` | - | ### Radio.Group diff --git a/src/components/radio/radio.tsx b/src/components/radio/radio.tsx index c5457d199b..b50623f156 100644 --- a/src/components/radio/radio.tsx +++ b/src/components/radio/radio.tsx @@ -23,6 +23,7 @@ export type RadioProps = { id?: string icon?: (checked: boolean) => React.ReactNode children?: React.ReactNode + onClick?: (event: React.MouseEvent) => void } & NativeProps<'--icon-size' | '--font-size' | '--gap'> const defaultProps = { @@ -86,6 +87,7 @@ export const Radio: FC = p => { return withNativeProps( props,
)} - {links && links.length > 0 && ( + {!!links?.length && (
- {links.map((link, index) => { - return ( - - clickLinkItem(link, index, event)} - > - {link.text} - - {index !== links.length - 1 && } - - ) - })} + {links.map((link, index) => ( + + clickLinkItem(link, index, event)} + > + {link.text} + + {index !== links.length - 1 && } + + ))}
)} {content &&
{content}
} {chips && chips.length > 0 && (
- {chips.map((chip, index) => { - return ( -
clickChipItem(chip, index)} - className={classNames(`${classPrefix}-chip`, { - [`${classPrefix}-chip-link`]: chip.type === 'link', - })} - > - {chip.text} -
- ) - })} + {chips.map((chip, index) => ( +
clickChipItem(chip, index)} + className={classNames(`${classPrefix}-chip`, { + [`${classPrefix}-chip-link`]: chip.type === 'link', + })} + > + {chip.text} +
+ ))}
)}
diff --git a/src/components/form/form-array.tsx b/src/components/form/form-array.tsx index 1f84b1eb7e..64c07a5ed9 100644 --- a/src/components/form/form-array.tsx +++ b/src/components/form/form-array.tsx @@ -16,7 +16,6 @@ export interface FormArrayOperation { export interface FormArrayProps { name: string | number | (string | number)[] - // rules?: ValidatorRule[] initialValue?: any[] renderHeader?: ( field: FormArrayField, diff --git a/src/components/image-uploader/image-uploader.tsx b/src/components/image-uploader/image-uploader.tsx index 94c668730f..c38bd34d30 100644 --- a/src/components/image-uploader/image-uploader.tsx +++ b/src/components/image-uploader/image-uploader.tsx @@ -159,9 +159,7 @@ export const ImageUploader: FC = p => { e.target.value = '' // HACK: fix the same file doesn't trigger onChange if (props.beforeUpload) { - const postFiles = files.map(file => { - return processFile(file, files) - }) + const postFiles = files.map(file => processFile(file, files)) await Promise.all(postFiles).then(filesList => { files = filesList.filter(Boolean) as File[] diff --git a/src/components/modal/modal.tsx b/src/components/modal/modal.tsx index 22d0d22db9..59a2e0900e 100644 --- a/src/components/modal/modal.tsx +++ b/src/components/modal/modal.tsx @@ -72,23 +72,21 @@ export const Modal: FC = p => { props.actions.length === 0 && cls('footer-empty') )} > - {props.actions.map((action, index) => { - return ( - { - await Promise.all([ - action.onClick?.(), - props.onAction?.(action, index), - ]) - if (props.closeOnAction) { - props.onClose?.() - } - }} - /> - ) - })} + {props.actions.map((action, index) => ( + { + await Promise.all([ + action.onClick?.(), + props.onAction?.(action, index), + ]) + if (props.closeOnAction) { + props.onClose?.() + } + }} + /> + ))} ) diff --git a/src/components/popover/popover.tsx b/src/components/popover/popover.tsx index 036a17b867..3a56c4c399 100644 --- a/src/components/popover/popover.tsx +++ b/src/components/popover/popover.tsx @@ -77,13 +77,11 @@ export const Popover = forwardRef((p, ref) => { useImperativeHandle( ref, - () => { - return { - show: () => setVisible(true), - hide: () => setVisible(false), - visible, - } - }, + () => ({ + show: () => setVisible(true), + hide: () => setVisible(false), + visible, + }), [visible] ) diff --git a/src/components/popup/popup.tsx b/src/components/popup/popup.tsx index ab3e7a1b16..8726b3af36 100644 --- a/src/components/popup/popup.tsx +++ b/src/components/popup/popup.tsx @@ -32,7 +32,6 @@ const defaultProps = { export const Popup: FC = p => { const props = mergeProps(defaultProps, p) - const { locale } = useConfig() const bodyCls = classNames( `${classPrefix}-body`, @@ -40,16 +39,17 @@ export const Popup: FC = p => { `${classPrefix}-body-position-${props.position}` ) + const { locale } = useConfig() const [active, setActive] = useState(props.visible) + const ref = useRef(null) + useLockScroll(ref, props.disableBodyScroll && active ? 'strict' : false) + useIsomorphicLayoutEffect(() => { if (props.visible) { setActive(true) } }, [props.visible]) - const ref = useRef(null) - useLockScroll(ref, props.disableBodyScroll && active ? 'strict' : false) - const unmountedRef = useUnmountedRef() const { percent } = useSpring({ percent: props.visible ? 0 : 100, diff --git a/src/components/result/result.tsx b/src/components/result/result.tsx index b5b9c1a3c0..a1311b8fbf 100644 --- a/src/components/result/result.tsx +++ b/src/components/result/result.tsx @@ -42,9 +42,9 @@ export const Result: FC = p => {
{resultIcon}
{title}
- {description ? ( + {!!description && (
{description}
- ) : null} + )}
) } diff --git a/src/components/stepper/stepper.tsx b/src/components/stepper/stepper.tsx index 825b5f2d2c..e66cb7e0d3 100644 --- a/src/components/stepper/stepper.tsx +++ b/src/components/stepper/stepper.tsx @@ -101,7 +101,6 @@ export function InnerStepper( defaultValue = 0 as ValueType, value, onChange, - disabled, step, max, @@ -153,11 +152,7 @@ export function InnerStepper( const formatValue = (value: ValueType | null): string => { if (value === null) return '' - if (formatter) { - return formatter(value) - } else { - return fixedValue(value) - } + return formatter ? formatter(value) : fixedValue(value) } // ======================== Value & InputValue ======================== diff --git a/src/components/tree-select/multiple.tsx b/src/components/tree-select/multiple.tsx index 5ce9b26496..fa6b877648 100644 --- a/src/components/tree-select/multiple.tsx +++ b/src/components/tree-select/multiple.tsx @@ -320,18 +320,14 @@ export const Multiple: FC = p => { return ( <> {renderSelectAllLeafItem(columnOptions, index)} - {columnOptions.map(option => { - return renderLeafItem(option) - })} + {columnOptions.map(option => renderLeafItem(option))} ) } return ( <> {renderSelectAllItem(columnOptions, index)} - {columnOptions.map(option => { - return renderItem(option) - })} + {columnOptions.map(option => renderItem(option))} ) }