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 #6408

Merged
merged 66 commits into from
Oct 23, 2023
Merged
Changes from 2 commits
Commits
Show all changes
66 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
dd02e14
fix: (WaterMark) when not set zIndex props, --adm-water-mark-z-index …
liangskyli Aug 25, 2023
681671d
chore: bump 5.32.1
zombieJ Aug 25, 2023
bb991b8
fix(Ellipsis): the `whiteSpace` style of the calc container should be…
miracles1919 Aug 29, 2023
fc9031c
doc(icon): add margin (#6347)
Jackie-llv Aug 30, 2023
c4de325
fix: page background in dark theme (#6346)
Fog3211 Aug 30, 2023
adff6a1
feat(CheckList): allow using number as value (#6335)
aso1datov Aug 31, 2023
62f23d8
feat: hard-coded colors to use variables instead (#6340)
cytle Sep 6, 2023
7481c63
chore: bump 5.32.2
zombieJ Sep 6, 2023
707dcf8
fix(toast): toast content textAlign (#6345)
Fog3211 Sep 7, 2023
43177be
Merge branch 'master' of https://github.com/ant-design/ant-design-mobile
zombieJ Sep 13, 2023
482d15a
doc: update slogan (#6362)
zombieJ Sep 13, 2023
815e272
enhance: move background color from body to html to enable developer …
zombieJ Sep 13, 2023
b8a7b47
chore: bump 5.32.3
zombieJ Sep 15, 2023
d9957ac
enhance: reset html bg color with transparent (#6368)
zombieJ Sep 15, 2023
7a494a6
fix: (WaterMark) content 设置空值时,控制台存在错误提示 (#6331)
liangskyli Sep 15, 2023
f04e809
fix(result-page): footer not align to center (#6355)
kongmoumou Sep 15, 2023
422272a
fix(CenterPopup): set pointer-events none while animating (#6358)
IronKinoko Sep 15, 2023
c1d4a90
chore: bump 5.32.4
zombieJ Sep 15, 2023
7fa85a1
feat(image-viewer): support zoomed picture slide (#5701)
HuberTRoy Sep 19, 2023
bf5f8d9
feat: update @use-gesture/react (#6379)
joannazhu88 Sep 22, 2023
0bfd9ef
chore: type and code optimize (#6378)
1587315093 Sep 22, 2023
25e7333
feat: add tr-TR locale (#6382)
osmanyz Sep 25, 2023
fde80e3
fix: result page enhancement (#6387)
kongmoumou Oct 7, 2023
a85f2b9
doc: 文档更新 (#6389)
heiyu4585 Oct 10, 2023
9d0edaa
fix(image-viewer): testcase (#6380)
HuberTRoy Oct 10, 2023
88557ef
doc: add installation instructions for bun (#6315)
colinhacks Oct 10, 2023
cc765ac
fix: license field is missing on npmjs.com #6392 (#6393)
IronKinoko Oct 11, 2023
ed86f9a
style: arrow functions optimization (#6395)
1587315093 Oct 13, 2023
9c994eb
style: className optimization (#6396)
1587315093 Oct 13, 2023
06ff9cc
chore: master merge feature
zombieJ Oct 19, 2023
9072ec3
chore: update config
zombieJ Oct 19, 2023
e572c7b
test: update snapshot
zombieJ Oct 19, 2023
d24b0e1
chore: auto merge branches (#6403)
github-actions[bot] Oct 19, 2023
729d024
chore: bump 5.33.0
zombieJ Oct 20, 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
91 changes: 74 additions & 17 deletions src/components/picker-view/wheel.tsx
Original file line number Diff line number Diff line change
@@ -85,29 +85,52 @@ export const Wheel = memo<Props>(
onSelect(item.value)
}

const handleDrag = (
const handleGestureState = (
state:
| (Omit<FullGestureState<'wheel'>, 'event'> & {
event: EventTypes['wheel']
})
| (Omit<FullGestureState<'drag'>, 'event'> & {
event: EventTypes['drag']
})
) => {
const {
direction: [, direction],
distance: [, distance],
velocity: [, velocity],
offset: [, offset],
last,
} = state
return {
direction,
distance,
velocity,
offset,
last,
}
}

const handleDrag = (
state: Omit<FullGestureState<'drag'>, 'event'> & {
event: EventTypes['drag']
}
) => {
draggingRef.current = true
const min = -((column.length - 1) * itemHeight.current)
const max = 0
if (state.last) {
const { direction, last, velocity, offset } = handleGestureState(state)

if (last) {
draggingRef.current = false
const position =
state.offset[1] + state.velocity[1] * state.direction[1] * 50
const targetIndex =
min < max
? -Math.round(bound(position, min, max) / itemHeight.current)
: 0

const position = offset + velocity * direction * 50
const boundNum = bound(position, min, max)
const targetIndex = -Math.round(boundNum / itemHeight.current)

scrollSelect(targetIndex)
} else {
const position = state.offset[1]
const position = offset

api.start({
y: rubberbandIfOutOfBounds(
position,
@@ -119,7 +142,41 @@ export const Wheel = memo<Props>(
})
}
}
const handleWheel = (
state: Omit<FullGestureState<'wheel'>, 'event'> & {
event: EventTypes['wheel']
}
) => {
draggingRef.current = true
const min = -((column.length - 1) * itemHeight.current)
const max = 0
const { direction, last, velocity, distance } = handleGestureState(state)
const whellDir = -direction // 取反
const scrollY = y.get()

if (last) {
draggingRef.current = false

const speed = velocity * whellDir * 50
const position = scrollY + distance * whellDir + speed
const boundNum = bound(position, min, max)
const targetIndex = -Math.round(boundNum / itemHeight.current)

scrollSelect(targetIndex)
} else {
const position = scrollY + distance * whellDir

api.start({
y: rubberbandIfOutOfBounds(
position,
min,
max,
itemHeight.current * 50,
0.2
),
})
}
}
useDrag(
state => {
state.event.stopPropagation()
@@ -137,16 +194,17 @@ export const Wheel = memo<Props>(
useWheel(
state => {
state.event.stopPropagation()
handleDrag(state)
handleWheel(state)
},
{
target: props.mouseWheel ? rootRef : undefined,
axis: 'y',
from: () => [0, y.get()],
preventDefault: true,
target: props.mouseWheel ? rootRef : undefined,
eventOptions: supportsPassive
? { passive: false }
: (false as unknown as AddEventListenerOptions),
eventOptions:
(supportsPassive as unknown as AddEventListenerOptions) && {
passive: false,
},
}
)

@@ -245,9 +303,8 @@ export const Wheel = memo<Props>(
if (prev.onSelect !== next.onSelect) return false
if (prev.renderLabel !== next.renderLabel) return false
if (prev.mouseWheel !== next.mouseWheel) return false
if (!isEqual(prev.column, next.column)) {
return false
}
if (!isEqual(prev.column, next.column)) return false

return true
}
)