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

chore: feature merge master #6323

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7f85638
docs: update doc of SwipeAction ProgressBar ProgressCircle Popover S…
1587315093 Jul 4, 2023
1029d6f
test: fix failed test (#6227)
miracles1919 Jul 5, 2023
6337f96
doc: Improve doc descriptions of some components (#6233)
1587315093 Jul 5, 2023
374e13d
fix: virtual input value 0 (#6231)
wulisensen Jul 10, 2023
d12f5de
fix(TextArea): hidden textarea element is not positioned relative to …
1587315093 Jul 10, 2023
a765ced
chore: auto merge branches (#6244)
github-actions[bot] Jul 12, 2023
be422bc
chore: bump 5.32.0
zombieJ Jul 12, 2023
adf776f
enhance: useWheel dir change (#6240)
1587315093 Jul 14, 2023
5892da7
Merge branch 'master' of https://github.com/ant-design/ant-design-mobile
zombieJ Jul 14, 2023
be7369a
chore: prompt when repairing step cloneElement (#6259)
1587315093 Jul 19, 2023
7f3d91d
fix(TextArea): reset rows when rows exceed autoSize (#6256)
miracles1919 Jul 20, 2023
3e0c0cd
chore: side add type specification (#6258)
1587315093 Jul 28, 2023
ace65c1
chore: type enhance (#6262)
1587315093 Jul 28, 2023
e2f82a6
refactor: to simplify the judge (#6263)
1587315093 Jul 28, 2023
4cf67a3
chore: repair type warning (#6267)
1587315093 Jul 28, 2023
bed51d6
fix: classname use repeatedly (#6278)
1587315093 Aug 1, 2023
317c116
chore: form's code style optimization (#6279)
1587315093 Aug 2, 2023
bf44a5c
refactor(Calendar): change locale from method to string (#6276)
whwnow Aug 2, 2023
49a1ef5
chore: add `--inactive-color-half` type (#6281)
HydenLiu Aug 4, 2023
121468b
enhance: passive and preventDefault coexist repair (#6284)
1587315093 Aug 7, 2023
180f18d
chore: pick type to InputHTMLAttributes (#6290)
1587315093 Aug 7, 2023
edbd0e8
enhance(toast): compatible with rtl mode (#6287)
Fog3211 Aug 7, 2023
e4d9aed
test(useLockScroll): update test (#6292)
miracles1919 Aug 8, 2023
83b5947
fix: repir passive and preventDefault in components (#6296)
1587315093 Aug 9, 2023
d919096
chore: eventOptions type fix (#6298)
1587315093 Aug 10, 2023
1561d15
enhance: floating-panel add classPrefix (#6297)
1587315093 Aug 10, 2023
a76c9b0
chore: code simplify (#6295)
1587315093 Aug 10, 2023
46ffd90
fix: useLockScroll whether the element scroll is in the end #6253 (#6…
19Qingfeng Aug 10, 2023
e1fd659
fix: error-block Normal display 0 (#6309)
1587315093 Aug 11, 2023
384373e
chore: center-popup use classPrefix (#6305)
1587315093 Aug 14, 2023
6b21558
chore: pickview use classPrefix (#6304)
1587315093 Aug 15, 2023
8a3f426
enhance: replace missing colors with css variables. fix #6319 (#6320)
cytle Aug 15, 2023
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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "antd-mobile",
"version": "5.31.1",
"version": "5.32.0",
"scripts": {
"start": "dumi dev",
"build": "gulp",
Expand Down
2 changes: 1 addition & 1 deletion src/components/action-sheet/action-sheet.less
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
background-color: var(--adm-color-background);
padding: 16px;
&:active {
background-color: #eeeeee;
background-color: var(--adm-color-border);
}
&-disabled {
cursor: not-allowed;
Expand Down
5 changes: 3 additions & 2 deletions src/components/button/button.less
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
);
width: 100%;
height: 100%;
background-color: #000;
border: var(--border-width) var(--border-style) #000;
background-color: var(--adm-color-text-dark-solid);
border: var(--border-width) var(--border-style)
var(--adm-color-text-dark-solid);
border-radius: var(--border-radius);
opacity: 0;
content: ' ';
Expand Down
9 changes: 5 additions & 4 deletions src/components/calendar/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useConfig } from '../config-provider'
import isoWeek from 'dayjs/plugin/isoWeek'
import { useUpdateEffect } from 'ahooks'
import { usePropsValue } from '../../utils/use-props-value'
import { replaceMessage } from '../../utils/replace-message'
import {
convertValueToRange,
convertPageToDayjs,
Expand Down Expand Up @@ -171,10 +172,10 @@ export const Calendar = forwardRef<CalendarRef, CalendarProps>((p, ref) => {
{props.prevMonthButton}
</a>
<div className={`${classPrefix}-title`}>
{locale.Calendar.renderYearAndMonth(
current.year(),
current.month() + 1
)}
{replaceMessage(locale.Calendar.yearAndMonth, {
year: current.year().toString(),
month: (current.month() + 1).toString(),
})}
</div>
<a
className={classNames(
Expand Down
12 changes: 7 additions & 5 deletions src/components/center-popup/center-popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
PopupBaseProps,
} from '../popup/popup-base-props'

const classPrefix = 'adm-center-popup'

export type CenterPopupProps = PopupBaseProps &
PropsWithChildren<{
// These props currently are only used internally. They are not exported to users:
Expand Down Expand Up @@ -72,7 +74,7 @@ export const CenterPopup: FC<CenterPopupProps> = p => {

const body = (
<div
className={classNames('adm-center-popup-body', props.bodyClassName)}
className={classNames(`${classPrefix}-body`, props.bodyClassName)}
style={props.bodyStyle}
>
{props.children}
Expand All @@ -84,7 +86,7 @@ export const CenterPopup: FC<CenterPopupProps> = p => {
withNativeProps(
props,
<div
className='adm-center-popup'
className={classPrefix}
style={{
display: active ? undefined : 'none',
pointerEvents: active ? undefined : 'none',
Expand All @@ -102,21 +104,21 @@ export const CenterPopup: FC<CenterPopupProps> = p => {
}
}}
style={props.maskStyle}
className={classNames('adm-center-popup-mask', props.maskClassName)}
className={classNames(`${classPrefix}-mask`, props.maskClassName)}
disableBodyScroll={false}
stopPropagation={props.stopPropagation}
/>
)}
<div
className='adm-center-popup-wrap'
className={`${classPrefix}-wrap`}
role={props.role}
aria-label={props['aria-label']}
>
<animated.div style={style} ref={ref}>
{props.showCloseButton && (
<a
className={classNames(
'adm-center-popup-close',
`${classPrefix}-close`,
'adm-plain-anchor'
)}
onClick={() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/checkbox/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type CheckboxValue = string | number
| block | Whether to render as a block-level element | `boolean` | `false` |
| checked | To specify whether selected or not currently | `boolean` | `false` |
| defaultChecked | Selected or not initially | `boolean` | `false` |
| disabled | Failure state | `boolean` | `false` |
| disabled | Disabled state | `boolean` | `false` |
| icon | The customized `icon` | `(checked: boolean, indeterminate: boolean) => React.ReactNode` | - |
| id | The id of the input element, often used in conjunction with the label | `string` | - |
| indeterminate | To set the `indeterminate` state, only responsible for style control | `boolean` | `false` |
Expand Down
2 changes: 1 addition & 1 deletion src/components/checkbox/index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type CheckboxValue = string | number
| block | 是否渲染为块级元素 | `boolean` | `false` |
| checked | 指定当前是否选中 | `boolean` | `false` |
| defaultChecked | 初始是否选中 | `boolean` | `false` |
| disabled | 失效状态 | `boolean` | `false` |
| disabled | 禁用状态 | `boolean` | `false` |
| icon | 自定义 `icon` 图标 | `(checked: boolean, indeterminate: boolean) => React.ReactNode` | - |
| id | `input` 元素的 `id`,常用来配合 `label` 使用 | `string` | - |
| indeterminate | 设置 `indeterminate` 状态,只负责样式控制 | `boolean` | `false` |
Expand Down
62 changes: 38 additions & 24 deletions src/components/collapse/collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,30 +129,44 @@ export const Collapse: FC<CollapseProps> = props => {
panels.push(child)
})

const [activeKey, setActiveKey] = usePropsValue<string[]>(
props.accordion
? {
value:
props.activeKey === undefined
? undefined
: props.activeKey === null
? []
: [props.activeKey],
defaultValue:
props.defaultActiveKey === undefined ||
props.defaultActiveKey === null
? []
: [props.defaultActiveKey],
onChange: v => {
props.onChange?.(v[0] ?? null)
},
}
: {
value: props.activeKey,
defaultValue: props.defaultActiveKey ?? [],
onChange: props.onChange,
}
)
const handlePropsValue = () => {
if (!props.accordion) {
return {
value: props.activeKey,
defaultValue: props.defaultActiveKey ?? [],
onChange: props.onChange,
}
}

const initValue: {
value?: string[]
defaultValue: string[]
onChange: (v: string[]) => void
} = {
value: [],
defaultValue: [],
onChange: v => {
props.onChange?.(v[0] ?? null)
},
}

if (props.activeKey === undefined) {
initValue.value = undefined
} else if (props.activeKey !== null) {
initValue.value = [props.activeKey]
}

if (
![null, undefined].includes(props.defaultActiveKey as null | undefined)
) {
initValue.defaultValue = [props.defaultActiveKey as string]
}

return initValue
}

const [activeKey, setActiveKey] = usePropsValue<string[]>(handlePropsValue())

const activeKeyList =
activeKey === null ? [] : Array.isArray(activeKey) ? activeKey : [activeKey]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8618,7 +8618,7 @@ exports[`ConfigProvider should display the text as ja-JP 1`] = `
<div
class="adm-calendar-title"
>
2022年3月
2022年3月
</div>
<a
class="adm-calendar-arrow-button adm-calendar-arrow-button-right adm-calendar-arrow-button-right-month"
Expand Down
50 changes: 24 additions & 26 deletions src/components/ellipsis/ellipsis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,34 +194,32 @@ export const Ellipsis: FC<EllipsisProps> = p => {
])

const expandActionElement =
exceeded && props.expandText
? withStopPropagation(
props.stopPropagationForActionButtons,
<a
ref={expandElRef}
onClick={() => {
setExpanded(true)
}}
>
{props.expandText}
</a>
)
: null
!!props.expandText &&
withStopPropagation(
props.stopPropagationForActionButtons,
<a
ref={expandElRef}
onClick={() => {
setExpanded(true)
}}
>
{props.expandText}
</a>
)

const collapseActionElement =
exceeded && props.collapseText
? withStopPropagation(
props.stopPropagationForActionButtons,
<a
ref={collapseElRef}
onClick={() => {
setExpanded(false)
}}
>
{props.collapseText}
</a>
)
: null
!!props.collapseText &&
withStopPropagation(
props.stopPropagationForActionButtons,
<a
ref={collapseElRef}
onClick={() => {
setExpanded(false)
}}
>
{props.collapseText}
</a>
)

const renderContent = () => {
if (!exceeded) return props.content
Expand Down
10 changes: 6 additions & 4 deletions src/components/error-block/create-error-block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export function createErrorBlock(imageRecord: ImageRecord) {
const props = mergeProps(defaultProps, p)
const { locale } = useConfig()
const contentPack = locale.ErrorBlock[props.status]
const des =
const desc =
'description' in props ? props.description : contentPack.description
const title = 'title' in props ? props.title : contentPack.title

const image: ReactNode = props.image ?? imageRecord[props.status]
const imageNode =
typeof image === 'string' ? (
Expand All @@ -50,11 +51,12 @@ export function createErrorBlock(imageRecord: ImageRecord) {
>
<div className={`${classPrefix}-image`}>{imageNode}</div>
<div className={`${classPrefix}-description`}>
{title && (
{![undefined, null].includes(title as null) && (
<div className={`${classPrefix}-description-title`}>{title}</div>
)}
{des && (
<div className={`${classPrefix}-description-subtitle`}>{des}</div>

{![undefined, null].includes(desc as null) && (
<div className={`${classPrefix}-description-subtitle`}>{desc}</div>
)}
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/components/error-block/error-block.less
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

&-description {
font-size: var(--adm-font-size-4);
color: #999;
color: var(--adm-color-weak);
line-height: 1.4;
margin-top: 12px;
&-title {
Expand Down
20 changes: 20 additions & 0 deletions src/components/error-block/tests/error-block.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,24 @@ describe('ErrorBlock', () => {

expect(container).toMatchSnapshot()
})
test('renders when description and title', async () => {
const title = 0
const description = 0

const { container } = render(
<ErrorBlock title={title} description={description} />
)

const titleElement = container.querySelector(
`.${classPrefix}-description-title`
)
expect(titleElement).toBeInTheDocument()
expect(titleElement?.textContent).toBe(title + '')

const descElement = container.querySelector(
`.${classPrefix}-description-subtitle`
)
expect(descElement).toBeInTheDocument()
expect(descElement?.textContent).toBe(description + '')
})
})
18 changes: 9 additions & 9 deletions src/components/floating-panel/floating-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { mergeProps } from '../../utils/with-default-props'
import { useLockScroll } from '../../utils/use-lock-scroll'
import { useMemoizedFn } from 'ahooks'

const classPrefix = 'adm-floating-panel'

export type FloatingPanelRef = {
setHeight: (
height: number,
Expand Down Expand Up @@ -88,7 +90,7 @@ export const FloatingPanel = forwardRef<FloatingPanelRef, FloatingPanelProps>(
setPulling(pullingRef.current)
if (!pullingRef.current) return
const { event } = state
if (event.cancelable) {
if (event.cancelable && supportsPassive) {
event.preventDefault()
}
event.stopPropagation()
Expand All @@ -109,9 +111,7 @@ export const FloatingPanel = forwardRef<FloatingPanelRef, FloatingPanelProps>(
from: () => [0, y.get()],
pointer: { touch: true },
target: elementRef,
eventOptions: supportsPassive
? { passive: false }
: (false as unknown as AddEventListenerOptions),
eventOptions: supportsPassive ? { passive: false } : undefined,
}
)

Expand Down Expand Up @@ -139,22 +139,22 @@ export const FloatingPanel = forwardRef<FloatingPanelRef, FloatingPanelProps>(
props,
<animated.div
ref={elementRef}
className='adm-floating-panel'
className={classPrefix}
style={{
height: Math.round(maxHeight),
translateY: y.to(y => `calc(100% + (${Math.round(y)}px))`),
}}
>
<div
className='adm-floating-panel-mask'
className={`${classPrefix}-mask`}
style={{
display: pulling ? 'block' : 'none',
}}
/>
<div className='adm-floating-panel-header' ref={headerRef}>
<div className='adm-floating-panel-bar' />
<div className={`${classPrefix}-header`} ref={headerRef}>
<div className={`${classPrefix}-bar`} />
</div>
<div className='adm-floating-panel-content' ref={contentRef}>
<div className={`${classPrefix}-content`} ref={contentRef}>
{props.children}
</div>
</animated.div>
Expand Down
Loading
Loading