@gm-mobile/c-react 3.12.7-beta.3 → 3.12.7-beta.5
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gm-mobile/c-react",
|
|
3
|
-
"version": "3.12.7-beta.
|
|
3
|
+
"version": "3.12.7-beta.5",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "liyatang <liyatang@qq.com>",
|
|
6
6
|
"homepage": "https://github.com/gmfe/gm-mobile#readme",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"url": "https://github.com/gmfe/gm-mobile/issues"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@gm-mobile/c-font": "^3.12.7-beta.
|
|
25
|
-
"@gm-mobile/c-tool": "^3.12.7-beta.
|
|
26
|
-
"@gm-mobile/locales": "^3.12.7-beta.
|
|
24
|
+
"@gm-mobile/c-font": "^3.12.7-beta.5",
|
|
25
|
+
"@gm-mobile/c-tool": "^3.12.7-beta.5",
|
|
26
|
+
"@gm-mobile/locales": "^3.12.7-beta.5",
|
|
27
27
|
"dayjs": "^1.11.6"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"prop-types": "^15.7.2",
|
|
35
35
|
"react": "^16.13.1"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "6305b0d3f16a98761987b8ab0af644135f7c14c6"
|
|
38
38
|
}
|
|
@@ -49,6 +49,7 @@ const MonthsList: FC<MonthListProps> = ({
|
|
|
49
49
|
}) => {
|
|
50
50
|
const refList = useRef<VListRef>(null)
|
|
51
51
|
const previous = usePreviousObject(selected)
|
|
52
|
+
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
52
53
|
|
|
53
54
|
const computedMonthList = () => {
|
|
54
55
|
// 优先 min,其次 begin ,其次 当前
|
|
@@ -79,6 +80,9 @@ const MonthsList: FC<MonthListProps> = ({
|
|
|
79
80
|
const monthsList = computedMonthList()
|
|
80
81
|
|
|
81
82
|
const scrollToTarget = (flag: boolean) => {
|
|
83
|
+
if (timeoutRef.current) {
|
|
84
|
+
clearTimeout(timeoutRef.current)
|
|
85
|
+
}
|
|
82
86
|
if (selected.length) {
|
|
83
87
|
const date = type === CALENDAR_TYPE.RANGE ? selected[1] : selected[0]
|
|
84
88
|
const targetId = _.findIndex(
|
|
@@ -88,13 +92,9 @@ const MonthsList: FC<MonthListProps> = ({
|
|
|
88
92
|
moment(item).month() === moment(date).month()
|
|
89
93
|
)
|
|
90
94
|
|
|
91
|
-
|
|
92
|
-
setTimeout(() => {
|
|
93
|
-
refList.current && refList.current.apiDoScrollToKey(targetId)
|
|
94
|
-
}, 200)
|
|
95
|
-
} else {
|
|
95
|
+
timeoutRef.current = setTimeout(() => {
|
|
96
96
|
refList.current && refList.current.apiDoScrollToKey(targetId)
|
|
97
|
-
}
|
|
97
|
+
}, 200)
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -106,9 +106,12 @@ const MonthsList: FC<MonthListProps> = ({
|
|
|
106
106
|
if (!canScrollWhenMaxOrMinChange) {
|
|
107
107
|
return
|
|
108
108
|
}
|
|
109
|
+
if (timeoutRef.current) {
|
|
110
|
+
clearTimeout(timeoutRef.current)
|
|
111
|
+
}
|
|
109
112
|
if (max || min) {
|
|
110
|
-
const
|
|
111
|
-
|
|
113
|
+
const date = selected[0]
|
|
114
|
+
|
|
112
115
|
const targetId = _.findIndex(
|
|
113
116
|
monthsList,
|
|
114
117
|
(item) =>
|
|
@@ -116,10 +119,12 @@ const MonthsList: FC<MonthListProps> = ({
|
|
|
116
119
|
moment(item).month() === moment(date).month()
|
|
117
120
|
)
|
|
118
121
|
if (targetId !== -1) {
|
|
119
|
-
|
|
122
|
+
setTimeout(() => {
|
|
123
|
+
refList.current && refList.current.apiDoScrollToKey(targetId)
|
|
124
|
+
}, 200)
|
|
120
125
|
}
|
|
121
126
|
}
|
|
122
|
-
}, [max, min])
|
|
127
|
+
}, [max, min, monthsList])
|
|
123
128
|
|
|
124
129
|
return (
|
|
125
130
|
<VList
|