@lynx-js/lynx-ui-common 3.130.0 → 3.133.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/hooks/index.d.ts +1 -3
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.jsx +2 -3
- package/dist/hooks/index.jsx.map +1 -1
- package/dist/hooks/usePreCommit.d.ts +15 -0
- package/dist/hooks/usePreCommit.d.ts.map +1 -0
- package/dist/hooks/usePreCommit.jsx +49 -0
- package/dist/hooks/usePreCommit.jsx.map +1 -0
- package/dist/types/interfaces/BaseScrollEvents.d.ts +0 -1
- package/dist/types/interfaces/BaseScrollEvents.d.ts.map +1 -1
- package/dist/types/interfaces/LazyInterface.d.ts +0 -1
- package/dist/types/interfaces/LazyInterface.d.ts.map +1 -1
- package/dist/types/interfaces/index.d.ts +0 -2
- package/dist/types/interfaces/index.d.ts.map +1 -1
- package/dist/utils/areDepsEqual.d.ts +6 -0
- package/dist/utils/areDepsEqual.d.ts.map +1 -0
- package/dist/utils/areDepsEqual.jsx +9 -0
- package/dist/utils/areDepsEqual.jsx.map +1 -0
- package/package.json +3 -3
- package/src/hooks/docs/useBounce.mdx +0 -1
- package/src/hooks/docs/useRefresh.mdx +0 -1
- package/src/hooks/index.ts +1 -3
- package/src/hooks/usePreCommit.tsx +111 -0
- package/src/types/interfaces/BaseScrollEvents.ts +0 -1
- package/src/types/interfaces/LazyInterface.tsx +0 -1
- package/src/types/interfaces/index.ts +0 -2
- package/src/utils/areDepsEqual.ts +26 -0
- package/dist/hooks/useBounce.d.ts +0 -26
- package/dist/hooks/useBounce.d.ts.map +0 -1
- package/dist/hooks/useBounce.jsx +0 -383
- package/dist/hooks/useBounce.jsx.map +0 -1
- package/dist/hooks/useRefresh.d.ts +0 -24
- package/dist/hooks/useRefresh.d.ts.map +0 -1
- package/dist/hooks/useRefresh.jsx +0 -554
- package/dist/hooks/useRefresh.jsx.map +0 -1
- package/dist/types/interfaces/BounceableInterface.d.ts +0 -120
- package/dist/types/interfaces/BounceableInterface.d.ts.map +0 -1
- package/dist/types/interfaces/BounceableInterface.jsx +0 -0
- package/dist/types/interfaces/RefreshInterface.d.ts +0 -98
- package/dist/types/interfaces/RefreshInterface.d.ts.map +0 -1
- package/dist/types/interfaces/RefreshInterface.jsx +0 -10
- package/dist/types/interfaces/RefreshInterface.jsx.map +0 -1
- package/src/hooks/useBounce.tsx +0 -814
- package/src/hooks/useRefresh.ts +0 -1054
- package/src/types/interfaces/BounceableInterface.ts +0 -125
- package/src/types/interfaces/RefreshInterface.ts +0 -105
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
2
|
-
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
-
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
|
|
5
|
-
import type { ReactElement } from '@lynx-js/react'
|
|
6
|
-
|
|
7
|
-
export interface scrollToBouncesInfo {
|
|
8
|
-
direction: 'upper' | 'lower'
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface BounceableBasicProps {
|
|
12
|
-
/**
|
|
13
|
-
* Whether to enable bounce effect
|
|
14
|
-
* @zh 是否开启回弹效果
|
|
15
|
-
* @iOS
|
|
16
|
-
* @Android
|
|
17
|
-
* @Harmony
|
|
18
|
-
*/
|
|
19
|
-
enableBounces: boolean
|
|
20
|
-
/**
|
|
21
|
-
* Trigger bounces effect during fling
|
|
22
|
-
* @zh 在快速滑动(fling)时触发回弹效果
|
|
23
|
-
* @defaultValue false
|
|
24
|
-
* @iOS
|
|
25
|
-
* @Android
|
|
26
|
-
* @Harmony
|
|
27
|
-
*/
|
|
28
|
-
enableBounceEventInFling?: boolean
|
|
29
|
-
/**
|
|
30
|
-
* The threshold distance of upper bounces, in pixels, when triggering the scrollToBounces event
|
|
31
|
-
* @zh 触发 `scrollToBounces` 事件时,上部回弹的阈值距离(单位:px)
|
|
32
|
-
* @defaultValue 0
|
|
33
|
-
* @iOS
|
|
34
|
-
* @Android
|
|
35
|
-
* @Harmony
|
|
36
|
-
*/
|
|
37
|
-
startBounceTriggerDistance?: number
|
|
38
|
-
/**
|
|
39
|
-
* The threshold distance of lower bounces, in pixels, when triggering the scrollToBounces event
|
|
40
|
-
* @zh 触发 `scrollToBounces` 事件时,下部回弹的阈值距离(单位:px)
|
|
41
|
-
* @defaultValue 0
|
|
42
|
-
* @iOS
|
|
43
|
-
* @Android
|
|
44
|
-
* @Harmony
|
|
45
|
-
*/
|
|
46
|
-
endBounceTriggerDistance?: number
|
|
47
|
-
/**
|
|
48
|
-
* Content of upper bounces view, which will be displayed during the upper bouncing effect.
|
|
49
|
-
* @zh 上部回弹视图的内容,将在上部回弹效果期间显示。
|
|
50
|
-
* @iOS
|
|
51
|
-
* @Android
|
|
52
|
-
* @Harmony
|
|
53
|
-
*/
|
|
54
|
-
upperBounceItem?: ReactElement
|
|
55
|
-
/**
|
|
56
|
-
* Content of lower bounces view, which will be displayed during the lower bouncing effect.
|
|
57
|
-
* @zh 下部回弹视图的内容,将在下部回弹效果期间显示。
|
|
58
|
-
* @iOS
|
|
59
|
-
* @Android
|
|
60
|
-
* @Harmony
|
|
61
|
-
*/
|
|
62
|
-
lowerBounceItem?: ReactElement
|
|
63
|
-
/**
|
|
64
|
-
* Whether the scrollable container can bounce when the content area of the scrollable container is smaller than the viewport area.
|
|
65
|
-
* @zh 当可滚动容器的内容区域小于视口区域时,是否允许容器回弹。
|
|
66
|
-
* @defaultValue true
|
|
67
|
-
* @iOS
|
|
68
|
-
* @Android
|
|
69
|
-
* @Harmony
|
|
70
|
-
*/
|
|
71
|
-
alwaysBouncing?: boolean
|
|
72
|
-
/**
|
|
73
|
-
* The direction of the bounce effect. 'both' for bouncing on both ends, 'none' to disable bounce, and 'upper'/'lower' for bouncing on either end
|
|
74
|
-
* @zh 回弹效果的方向。'both' 表示两端都回弹,'none' 表示禁用回弹,'upper'/'lower' 表示只在上端或下端回弹。
|
|
75
|
-
* @defaultValue 'both'
|
|
76
|
-
* @iOS
|
|
77
|
-
* @Android
|
|
78
|
-
* @Harmony
|
|
79
|
-
*/
|
|
80
|
-
singleSidedBounce?: 'upper' | 'lower' | 'both' | 'iOSBounces' | 'none'
|
|
81
|
-
/**
|
|
82
|
-
* Unit: px. Optional size hint for bounce effect. Recommended when used in List or <list/>.
|
|
83
|
-
* @zh 单位:px。可选的回弹效果尺寸提示。在列表或 `<list/>` 中使用时推荐设置。
|
|
84
|
-
* @Android
|
|
85
|
-
* @iOS
|
|
86
|
-
* @Harmony
|
|
87
|
-
*/
|
|
88
|
-
estimatedHeight?: number
|
|
89
|
-
/**
|
|
90
|
-
* Unit: px. Optional size hint for bounce effect. Recommended when used in List or <list/>.
|
|
91
|
-
* @zh 单位:px。可选的回弹效果尺寸提示。在列表或 `<list/>` 中使用时推荐设置。
|
|
92
|
-
* @Android
|
|
93
|
-
* @iOS
|
|
94
|
-
* @Harmony
|
|
95
|
-
*/
|
|
96
|
-
estimatedWidth?: number
|
|
97
|
-
/**
|
|
98
|
-
* Display debug logs. Open it when you find a bug.
|
|
99
|
-
* @zh 显示调试日志。当您发现错误时,请打开此选项。
|
|
100
|
-
* @defaultValue false
|
|
101
|
-
* @iOS
|
|
102
|
-
* @Android
|
|
103
|
-
* @Harmony
|
|
104
|
-
*/
|
|
105
|
-
debugLog?: boolean
|
|
106
|
-
/**
|
|
107
|
-
* requestAnimationFrame don't work under lynx version 2.15.2. This switch should be opened when the version is higher than 2.15.2.
|
|
108
|
-
* @zh `requestAnimationFrame` 在 lynx 2.15.2 以下版本中不起作用。当版本高于 2.15.2 时,应打开此开关。
|
|
109
|
-
* @defaultValue false
|
|
110
|
-
* @iOS
|
|
111
|
-
* @Android
|
|
112
|
-
* @Harmony
|
|
113
|
-
*/
|
|
114
|
-
validAnimationVersion?: boolean
|
|
115
|
-
/**
|
|
116
|
-
* When bounces effect is triggered and the bounce distance is larger than startBounceDistance or endBounceDistance on the upper or lower side, the scrollToBounces event will be triggered.
|
|
117
|
-
* @zh 当触发回弹效果并且回弹距离在上侧或下侧大于 `startBounceDistance` 或 `endBounceDistance` 时,将触发 `scrollToBounces` 事件。
|
|
118
|
-
* @defaultValue 0
|
|
119
|
-
* @eventProperty
|
|
120
|
-
* @iOS
|
|
121
|
-
* @Android
|
|
122
|
-
* @Harmony
|
|
123
|
-
*/
|
|
124
|
-
onScrollToBounces?: (e: scrollToBouncesInfo) => void
|
|
125
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
2
|
-
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
-
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
|
|
5
|
-
import type { ReactElement } from '@lynx-js/react'
|
|
6
|
-
|
|
7
|
-
export interface RefreshEvent {
|
|
8
|
-
triggeredBy: 'startRefresh' | 'drag'
|
|
9
|
-
}
|
|
10
|
-
export interface refreshOffsetEvent {
|
|
11
|
-
offset: number
|
|
12
|
-
headerSize: number
|
|
13
|
-
isDragging: boolean
|
|
14
|
-
}
|
|
15
|
-
export interface headerReleased {
|
|
16
|
-
offset: number
|
|
17
|
-
headerSize: number
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export enum RefreshState {
|
|
21
|
-
IDLE = 0, // Hide
|
|
22
|
-
OVER_DRAG_RELEASE = 1, // Drag over refresh header size and release
|
|
23
|
-
REFRESHING = 2, // During refresh
|
|
24
|
-
DRAGGING = 3, // Dragging
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface RefreshStateChange {
|
|
28
|
-
/**
|
|
29
|
-
* Status of refreshHeader
|
|
30
|
-
* @zh 刷新头的状态
|
|
31
|
-
* @Android
|
|
32
|
-
* @iOS
|
|
33
|
-
* @Harmony
|
|
34
|
-
*/
|
|
35
|
-
state: RefreshState
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface RefreshProps {
|
|
39
|
-
/**
|
|
40
|
-
* Enable refresh
|
|
41
|
-
* @zh 启用刷新
|
|
42
|
-
* @Android
|
|
43
|
-
* @iOS
|
|
44
|
-
* @Harmony
|
|
45
|
-
*/
|
|
46
|
-
enableRefresh: boolean
|
|
47
|
-
/**
|
|
48
|
-
* header children
|
|
49
|
-
* @zh 头部内容
|
|
50
|
-
* @Android
|
|
51
|
-
* @iOS
|
|
52
|
-
* @Harmony
|
|
53
|
-
*/
|
|
54
|
-
headerContent: ReactElement
|
|
55
|
-
/**
|
|
56
|
-
* Display debug logs. Open it when you find a bug.
|
|
57
|
-
* @zh 显示调试日志。当您发现错误时请打开它。
|
|
58
|
-
* @defaultValue false
|
|
59
|
-
* @Android
|
|
60
|
-
* @iOS
|
|
61
|
-
* @Harmony
|
|
62
|
-
*/
|
|
63
|
-
debugLog?: boolean
|
|
64
|
-
/**
|
|
65
|
-
* requestAnimationFrame don't work under lynx version 2.15.2. This switch should be opened when the version is higher than 2.15.2.
|
|
66
|
-
* @zh requestAnimationFrame 在 lynx 2.15.2 以下版本中不起作用。当版本高于 2.15.2 时,应打开此开关。
|
|
67
|
-
* @defaultValue false
|
|
68
|
-
* @Android
|
|
69
|
-
* @iOS
|
|
70
|
-
* @Harmony
|
|
71
|
-
*/
|
|
72
|
-
validAnimationVersion?: boolean
|
|
73
|
-
/**
|
|
74
|
-
* Send when refresh started.
|
|
75
|
-
* @zh 刷新开始时发送。
|
|
76
|
-
* @Android
|
|
77
|
-
* @iOS
|
|
78
|
-
* @Harmony
|
|
79
|
-
*/
|
|
80
|
-
onStartRefresh?: (e: RefreshEvent) => void
|
|
81
|
-
/**
|
|
82
|
-
* Send when header shows and moves.
|
|
83
|
-
* @zh 当头部显示和移动时发送。
|
|
84
|
-
* @Android
|
|
85
|
-
* @iOS
|
|
86
|
-
* @Harmony
|
|
87
|
-
*/
|
|
88
|
-
onRefreshOffsetChange?: (e: refreshOffsetEvent) => void
|
|
89
|
-
/**
|
|
90
|
-
* Send during refresh dragging and header is visible.
|
|
91
|
-
* @zh 在刷新拖动期间并且头部可见时发送。
|
|
92
|
-
* @Android
|
|
93
|
-
* @iOS
|
|
94
|
-
* @Harmony
|
|
95
|
-
*/
|
|
96
|
-
onRefreshStateChange?: (e: RefreshStateChange) => void
|
|
97
|
-
/**
|
|
98
|
-
* Send when drag is end.
|
|
99
|
-
* @zh 拖动结束时发送。
|
|
100
|
-
* @Android
|
|
101
|
-
* @iOS
|
|
102
|
-
* @Harmony
|
|
103
|
-
*/
|
|
104
|
-
onHeaderReleased?: (e: headerReleased) => void
|
|
105
|
-
}
|