@momo-kits/calendar 0.150.3-beta.40 → 0.151.1-beta.1
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/CalendarPro.tsx +20 -25
- package/Day.tsx +18 -21
- package/MonthList.tsx +24 -30
- package/index.tsx +0 -2
- package/package.json +20 -20
- package/types.ts +8 -17
package/CalendarPro.tsx
CHANGED
|
@@ -7,8 +7,8 @@ import React, {
|
|
|
7
7
|
forwardRef,
|
|
8
8
|
useImperativeHandle,
|
|
9
9
|
} from 'react';
|
|
10
|
-
import {
|
|
11
|
-
import moment, {
|
|
10
|
+
import {ScrollView, View} from 'react-native';
|
|
11
|
+
import moment, {Moment} from 'moment';
|
|
12
12
|
import {
|
|
13
13
|
ApplicationContext,
|
|
14
14
|
CheckBox,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
MonthListRef,
|
|
28
28
|
Holidays,
|
|
29
29
|
} from './types';
|
|
30
|
-
import {
|
|
30
|
+
import {ContainerContext} from './index';
|
|
31
31
|
import styles from './styles';
|
|
32
32
|
|
|
33
33
|
const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
@@ -46,11 +46,10 @@ const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
|
46
46
|
isOffLunar,
|
|
47
47
|
onCallbackCalendar,
|
|
48
48
|
disabledDays,
|
|
49
|
-
bestPriceColor,
|
|
50
49
|
},
|
|
51
|
-
ref
|
|
50
|
+
ref
|
|
52
51
|
) => {
|
|
53
|
-
const {
|
|
52
|
+
const {theme, translate} = useContext(ApplicationContext);
|
|
54
53
|
const size = useContext(ContainerContext);
|
|
55
54
|
|
|
56
55
|
const today = useMemo(() => moment(), []);
|
|
@@ -91,13 +90,15 @@ const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
|
91
90
|
setDoubleDateAndTabIndex: (
|
|
92
91
|
firstDate?: Moment | null,
|
|
93
92
|
secondDate?: Moment | null,
|
|
94
|
-
tabIdx?: number
|
|
93
|
+
tabIdx?: number
|
|
95
94
|
) => {
|
|
96
95
|
if (typeof tabIdx === 'number') setTabSelected(tabIdx);
|
|
97
96
|
if (firstDate) setStartDate(firstDate);
|
|
98
97
|
if (secondDate !== undefined) setEndDate(secondDate);
|
|
99
98
|
},
|
|
100
|
-
setDateRange: (
|
|
99
|
+
setDateRange: (
|
|
100
|
+
dateRange: {startDate: any; endDate: any},
|
|
101
|
+
) => {
|
|
101
102
|
if (monthListRef.current && dateRange.startDate) {
|
|
102
103
|
monthListRef.current.scrollToMonth(moment(dateRange.startDate));
|
|
103
104
|
}
|
|
@@ -147,7 +148,7 @@ const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
|
147
148
|
const filtered = showLunar
|
|
148
149
|
? allHolidays
|
|
149
150
|
: allHolidays.filter(item => !item.lunar || item.mixedLabel);
|
|
150
|
-
headerControlRef.current?.onUpdateInfo({
|
|
151
|
+
headerControlRef.current?.onUpdateInfo({date});
|
|
151
152
|
headerRef.current = date.clone().startOf('month');
|
|
152
153
|
setHolidays(allHolidays);
|
|
153
154
|
setTemp(filtered);
|
|
@@ -182,7 +183,7 @@ const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
|
182
183
|
.subtract(1, 'months');
|
|
183
184
|
if (prev.isSameOrAfter(minDate, 'month')) {
|
|
184
185
|
headerRef.current = prev;
|
|
185
|
-
headerControlRef.current?.onUpdateInfo({
|
|
186
|
+
headerControlRef.current?.onUpdateInfo({date: prev});
|
|
186
187
|
monthListRef.current?.scrollToMonth(prev);
|
|
187
188
|
}
|
|
188
189
|
};
|
|
@@ -191,7 +192,7 @@ const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
|
191
192
|
const next = headerRef.current.clone().startOf('month').add(1, 'months');
|
|
192
193
|
if (next.isSameOrBefore(maxDate, 'month')) {
|
|
193
194
|
headerRef.current = next;
|
|
194
|
-
headerControlRef.current?.onUpdateInfo({
|
|
195
|
+
headerControlRef.current?.onUpdateInfo({date: next});
|
|
195
196
|
monthListRef.current?.scrollToMonth(next);
|
|
196
197
|
}
|
|
197
198
|
};
|
|
@@ -221,9 +222,8 @@ const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
|
221
222
|
typography="label_s_medium"
|
|
222
223
|
style={[
|
|
223
224
|
styles.textDay,
|
|
224
|
-
{
|
|
225
|
-
]}
|
|
226
|
-
>
|
|
225
|
+
{width: (size.width - Spacing.M * 2) / 7},
|
|
226
|
+
]}>
|
|
227
227
|
{translate?.(Util.mapWeeKDate(dayIdx))}
|
|
228
228
|
</Text>
|
|
229
229
|
))}
|
|
@@ -245,16 +245,14 @@ const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
|
245
245
|
selectedDate={propSelectedDate}
|
|
246
246
|
priceList={priceListFormat}
|
|
247
247
|
disabledDays={disabledDays}
|
|
248
|
-
bestPriceColor={bestPriceColor}
|
|
249
248
|
/>
|
|
250
249
|
</View>
|
|
251
250
|
{!isOffLunar && (
|
|
252
251
|
<View
|
|
253
252
|
style={[
|
|
254
253
|
styles.viewLunar,
|
|
255
|
-
{
|
|
256
|
-
]}
|
|
257
|
-
>
|
|
254
|
+
{borderColor: theme.colors.border.default},
|
|
255
|
+
]}>
|
|
258
256
|
<CheckBox
|
|
259
257
|
onChange={onToggleLunar}
|
|
260
258
|
value={showLunar}
|
|
@@ -266,8 +264,7 @@ const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
|
266
264
|
<ScrollView
|
|
267
265
|
contentContainerStyle={styles.contentScroll}
|
|
268
266
|
showsVerticalScrollIndicator={false}
|
|
269
|
-
nestedScrollEnabled
|
|
270
|
-
>
|
|
267
|
+
nestedScrollEnabled>
|
|
271
268
|
{temp.map((item, idx) => {
|
|
272
269
|
const labelDate = `${item.day > 9 ? item.day : `0${item.day}`}/${
|
|
273
270
|
item.month > 9 ? item.month : `0${item.month}`
|
|
@@ -281,14 +278,12 @@ const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
|
281
278
|
<Text
|
|
282
279
|
color={theme.colors.error.primary}
|
|
283
280
|
typography="description_default_regular"
|
|
284
|
-
style={styles.txtMonthLunar}
|
|
285
|
-
>
|
|
281
|
+
style={styles.txtMonthLunar}>
|
|
286
282
|
{labelDate}
|
|
287
283
|
</Text>
|
|
288
284
|
<Text
|
|
289
285
|
typography="description_default_regular"
|
|
290
|
-
style={styles.subTextLunar}
|
|
291
|
-
>
|
|
286
|
+
style={styles.subTextLunar}>
|
|
292
287
|
{translate?.(labelHoliday)}
|
|
293
288
|
</Text>
|
|
294
289
|
<Text typography="description_default_regular">
|
|
@@ -301,7 +296,7 @@ const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
|
301
296
|
)}
|
|
302
297
|
</View>
|
|
303
298
|
);
|
|
304
|
-
}
|
|
299
|
+
}
|
|
305
300
|
);
|
|
306
301
|
|
|
307
302
|
export default CalendarPro;
|
package/Day.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, {useContext} from 'react';
|
|
2
|
+
import {Text as RNText, TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {
|
|
4
4
|
ApplicationContext,
|
|
5
5
|
Colors,
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
Spacing,
|
|
8
8
|
Text,
|
|
9
9
|
} from '@momo-kits/foundation';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import {DayProps} from './types';
|
|
11
|
+
import {ContainerContext} from './index';
|
|
12
12
|
import styles from './styles';
|
|
13
13
|
|
|
14
14
|
const Day: React.FC<DayProps> = props => {
|
|
@@ -30,15 +30,14 @@ const Day: React.FC<DayProps> = props => {
|
|
|
30
30
|
onChoose,
|
|
31
31
|
price,
|
|
32
32
|
isBestPrice,
|
|
33
|
-
bestPriceColor,
|
|
34
33
|
} = props;
|
|
35
34
|
|
|
36
|
-
const {
|
|
35
|
+
const {theme} = useContext(ApplicationContext);
|
|
37
36
|
const size = useContext(ContainerContext);
|
|
38
37
|
|
|
39
38
|
const itemWidth = (size.width - Spacing.M) / 7;
|
|
40
39
|
if (isEmpty || !date) {
|
|
41
|
-
return <View style={[styles.dayContainer, {
|
|
40
|
+
return <View style={[styles.dayContainer, {width: itemWidth}]} />;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
const isValid =
|
|
@@ -71,10 +70,11 @@ const Day: React.FC<DayProps> = props => {
|
|
|
71
70
|
|
|
72
71
|
if (isWeekEnd || isSolarHoliday || isLunarHoliday) {
|
|
73
72
|
textColor = theme.colors.error.primary;
|
|
73
|
+
priceColor = theme.colors.error.primary;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
if (isBestPrice
|
|
77
|
-
priceColor =
|
|
76
|
+
if (isBestPrice) {
|
|
77
|
+
priceColor = theme.colors.error.primary;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (isStart || isEnd) {
|
|
@@ -90,14 +90,13 @@ const Day: React.FC<DayProps> = props => {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
return (
|
|
93
|
-
<View style={[styles.dayContainer, {
|
|
93
|
+
<View style={[styles.dayContainer, {width: itemWidth}]}>
|
|
94
94
|
<View
|
|
95
95
|
style={[
|
|
96
|
-
isMid && {
|
|
96
|
+
isMid && {backgroundColor: theme.colors.background.tonal},
|
|
97
97
|
isStartPart && styles.dayStartContainer,
|
|
98
98
|
isEnd && styles.dayEndContainer,
|
|
99
|
-
]}
|
|
100
|
-
>
|
|
99
|
+
]}>
|
|
101
100
|
<TouchableOpacity
|
|
102
101
|
style={[
|
|
103
102
|
styles.day,
|
|
@@ -105,13 +104,12 @@ const Day: React.FC<DayProps> = props => {
|
|
|
105
104
|
width: itemWidth,
|
|
106
105
|
paddingVertical: !!price ? Spacing.XS : Spacing.S,
|
|
107
106
|
},
|
|
108
|
-
(isStart || isEnd) && {
|
|
109
|
-
!!price && {
|
|
110
|
-
{
|
|
107
|
+
(isStart || isEnd) && {backgroundColor: theme.colors.primary},
|
|
108
|
+
!!price && {height: scaleSize(48)},
|
|
109
|
+
{height: size.height},
|
|
111
110
|
]}
|
|
112
111
|
disabled={!(isValid && isInScope)}
|
|
113
|
-
onPress={chooseDay}
|
|
114
|
-
>
|
|
112
|
+
onPress={chooseDay}>
|
|
115
113
|
{lunarDate && showLunar && !!date && (
|
|
116
114
|
<RNText
|
|
117
115
|
style={{
|
|
@@ -121,14 +119,13 @@ const Day: React.FC<DayProps> = props => {
|
|
|
121
119
|
color: lunarTextColor,
|
|
122
120
|
fontSize: scaleSize(8),
|
|
123
121
|
lineHeight: scaleSize(12),
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
122
|
+
}}>
|
|
126
123
|
{lunarDate.lunarDay === 1
|
|
127
124
|
? `${lunarDate.lunarDay}/${lunarDate.lunarMonth}`
|
|
128
125
|
: lunarDate.lunarDay}
|
|
129
126
|
</RNText>
|
|
130
127
|
)}
|
|
131
|
-
<Text typography="
|
|
128
|
+
<Text typography="header_s_semibold" color={textColor}>
|
|
132
129
|
{date ? date.date() : ''}
|
|
133
130
|
</Text>
|
|
134
131
|
{!!price && (
|
package/MonthList.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import moment, {
|
|
1
|
+
import {scaleSize, Spacing} from '@momo-kits/foundation';
|
|
2
|
+
import moment, {Moment} from 'moment';
|
|
3
3
|
import React, {
|
|
4
4
|
forwardRef,
|
|
5
5
|
useImperativeHandle,
|
|
@@ -10,11 +10,11 @@ import React, {
|
|
|
10
10
|
useRef,
|
|
11
11
|
useState,
|
|
12
12
|
} from 'react';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import {FlatList, Platform} from 'react-native';
|
|
14
|
+
import {ContainerContext} from './index';
|
|
15
15
|
import LunarDateConverter from './LunarDateConverter';
|
|
16
16
|
import Month from './Month';
|
|
17
|
-
import {
|
|
17
|
+
import {MonthListProps, MonthListRef} from './types';
|
|
18
18
|
|
|
19
19
|
const MAX_RENDER_PER_BATCH = Platform.OS === 'android' ? 1 : 12;
|
|
20
20
|
|
|
@@ -43,7 +43,7 @@ const MonthList = forwardRef<MonthListRef, MonthListProps>((props, ref) => {
|
|
|
43
43
|
const [heightStyle, setHeightStyle] = useState({});
|
|
44
44
|
|
|
45
45
|
const data = useMemo(() => {
|
|
46
|
-
const months: {
|
|
46
|
+
const months: {date: Moment; dateList: any[]}[] = [];
|
|
47
47
|
const mMin = moment(minDate).date(1);
|
|
48
48
|
const mMax = moment(maxDate);
|
|
49
49
|
while (
|
|
@@ -57,13 +57,13 @@ const MonthList = forwardRef<MonthListRef, MonthListProps>((props, ref) => {
|
|
|
57
57
|
let weekday = cursor.isoWeekday();
|
|
58
58
|
if (weekday !== 1) {
|
|
59
59
|
dayList.push(
|
|
60
|
-
...new Array(weekday - 1).fill(0).map(() => ({ isEmpty: true }))
|
|
60
|
+
...new Array(weekday - 1).fill(0).map(() => ({ isEmpty: true }))
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
while (cursor.month() === monthIdx) {
|
|
64
64
|
const cloned = cursor.clone();
|
|
65
65
|
const hol = holidays.find(
|
|
66
|
-
h => h.day === cloned.date() && h.month === cloned.month() + 1
|
|
66
|
+
h => h.day === cloned.date() && h.month === cloned.month() + 1
|
|
67
67
|
);
|
|
68
68
|
dayList.push({
|
|
69
69
|
isEmpty: false,
|
|
@@ -82,10 +82,10 @@ const MonthList = forwardRef<MonthListRef, MonthListProps>((props, ref) => {
|
|
|
82
82
|
weekday = cursor.isoWeekday();
|
|
83
83
|
if (weekday !== 7) {
|
|
84
84
|
dayList.push(
|
|
85
|
-
...new Array(7 - weekday).fill(0).map(() => ({ isEmpty: true }))
|
|
85
|
+
...new Array(7 - weekday).fill(0).map(() => ({ isEmpty: true }))
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
months.push({
|
|
88
|
+
months.push({date: d, dateList: dayList});
|
|
89
89
|
mMin.add(1, 'month');
|
|
90
90
|
}
|
|
91
91
|
return months;
|
|
@@ -93,25 +93,25 @@ const MonthList = forwardRef<MonthListRef, MonthListProps>((props, ref) => {
|
|
|
93
93
|
|
|
94
94
|
const getIndexOfMonth = useCallback(
|
|
95
95
|
(date: Moment) => data.findIndex(item => item.date.isSame(date, 'month')),
|
|
96
|
-
[data]
|
|
96
|
+
[data]
|
|
97
97
|
);
|
|
98
98
|
|
|
99
99
|
const currentScrollIndex = useMemo(
|
|
100
100
|
() => getIndexOfMonth(moment(selectedDate)),
|
|
101
|
-
[selectedDate, getIndexOfMonth]
|
|
101
|
+
[selectedDate, getIndexOfMonth]
|
|
102
102
|
);
|
|
103
103
|
|
|
104
104
|
const scrollToMonth = useCallback(
|
|
105
105
|
(month: Moment) => {
|
|
106
106
|
const idx = getIndexOfMonth(month);
|
|
107
107
|
if (listRef.current && idx !== -1) {
|
|
108
|
-
listRef.current.scrollToIndex({
|
|
108
|
+
listRef.current.scrollToIndex({index: idx, animated: true});
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
-
[getIndexOfMonth]
|
|
111
|
+
[getIndexOfMonth]
|
|
112
112
|
);
|
|
113
113
|
|
|
114
|
-
useImperativeHandle(ref, () => ({
|
|
114
|
+
useImperativeHandle(ref, () => ({scrollToMonth}));
|
|
115
115
|
|
|
116
116
|
useEffect(() => {
|
|
117
117
|
const timer = setTimeout(() => {
|
|
@@ -120,9 +120,9 @@ const MonthList = forwardRef<MonthListRef, MonthListProps>((props, ref) => {
|
|
|
120
120
|
return () => clearTimeout(timer);
|
|
121
121
|
}, []);
|
|
122
122
|
|
|
123
|
-
const onViewableItemsChanged = useRef(({
|
|
123
|
+
const onViewableItemsChanged = useRef(({changed}: {changed: any[]}) => {
|
|
124
124
|
if (changed.length > 0) {
|
|
125
|
-
const {
|
|
125
|
+
const {item, key, index} = changed[0];
|
|
126
126
|
if (onScrollCalendar && item && currentKey.current !== key) {
|
|
127
127
|
currentKey.current = key;
|
|
128
128
|
try {
|
|
@@ -135,16 +135,16 @@ const MonthList = forwardRef<MonthListRef, MonthListProps>((props, ref) => {
|
|
|
135
135
|
} catch {
|
|
136
136
|
setHeightStyle({});
|
|
137
137
|
}
|
|
138
|
-
onScrollCalendar({
|
|
138
|
+
onScrollCalendar({date: item.date, key, currentIndex: index});
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}).current;
|
|
142
142
|
|
|
143
|
-
const viewabilityConfig = {
|
|
143
|
+
const viewabilityConfig = {itemVisiblePercentThreshold: 50};
|
|
144
144
|
|
|
145
145
|
const keyExtractor = useCallback(
|
|
146
|
-
(item: {
|
|
147
|
-
[]
|
|
146
|
+
(item: {date: Moment}) => `${item.date.month() + 1}/${item.date.year()}`,
|
|
147
|
+
[]
|
|
148
148
|
);
|
|
149
149
|
|
|
150
150
|
const getItemLayout = useCallback(
|
|
@@ -153,17 +153,11 @@ const MonthList = forwardRef<MonthListRef, MonthListProps>((props, ref) => {
|
|
|
153
153
|
offset: size.width * index,
|
|
154
154
|
index,
|
|
155
155
|
}),
|
|
156
|
-
[size.width]
|
|
156
|
+
[size.width]
|
|
157
157
|
);
|
|
158
158
|
|
|
159
159
|
const renderItem = useCallback(
|
|
160
|
-
({
|
|
161
|
-
item,
|
|
162
|
-
index,
|
|
163
|
-
}: {
|
|
164
|
-
item: { date: Moment; dateList: any[] };
|
|
165
|
-
index: number;
|
|
166
|
-
}) => {
|
|
160
|
+
({item, index}: {item: {date: Moment; dateList: any[]}; index: number}) => {
|
|
167
161
|
const keyMonth = moment(item.date).format('YYYY-MM');
|
|
168
162
|
const priceListDate = priceList?.[keyMonth]?.day;
|
|
169
163
|
return (
|
|
@@ -195,7 +189,7 @@ const MonthList = forwardRef<MonthListRef, MonthListProps>((props, ref) => {
|
|
|
195
189
|
isShowLunar,
|
|
196
190
|
isDoubleDateMode,
|
|
197
191
|
disabledDays,
|
|
198
|
-
]
|
|
192
|
+
]
|
|
199
193
|
);
|
|
200
194
|
|
|
201
195
|
return (
|
package/index.tsx
CHANGED
|
@@ -55,7 +55,6 @@ const Calendar: React.FC<CalendarProps> = props => {
|
|
|
55
55
|
style,
|
|
56
56
|
disabledDays = [],
|
|
57
57
|
hideHeaderTab = false,
|
|
58
|
-
bestPriceColor,
|
|
59
58
|
} = props;
|
|
60
59
|
|
|
61
60
|
const [containerWidth, setContainerWidth] = useState<number>(
|
|
@@ -371,7 +370,6 @@ const Calendar: React.FC<CalendarProps> = props => {
|
|
|
371
370
|
isHideHoliday={isHideHoliday}
|
|
372
371
|
isOffLunar={isOffLunar}
|
|
373
372
|
disabledDays={disabledDays}
|
|
374
|
-
bestPriceColor={bestPriceColor}
|
|
375
373
|
/>
|
|
376
374
|
</View>
|
|
377
375
|
</ContainerContext.Provider>
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
2
|
+
"name": "@momo-kits/calendar",
|
|
3
|
+
"version": "0.151.1-beta.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "index.tsx",
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"@momo-kits/foundation": "latest",
|
|
8
|
+
"react": "*",
|
|
9
|
+
"react-native": "*"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@momo-platform/versions": "4.1.11"
|
|
13
|
+
},
|
|
14
|
+
"license": "MoMo",
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"registry": "https://registry.npmjs.org/"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"moment": "^2.24.0"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Moment from 'moment';
|
|
2
|
-
import {
|
|
2
|
+
import {ViewStyle} from 'react-native';
|
|
3
3
|
|
|
4
4
|
export type Holidays = {
|
|
5
5
|
solar: object;
|
|
@@ -18,16 +18,12 @@ export type PriceInfo = {
|
|
|
18
18
|
export type PriceListData = {
|
|
19
19
|
inbound: {
|
|
20
20
|
[keyMonth: string]: {
|
|
21
|
-
|
|
22
|
-
[keyDay: string]: PriceInfo;
|
|
23
|
-
};
|
|
21
|
+
[keyDay: string]: PriceInfo;
|
|
24
22
|
};
|
|
25
23
|
};
|
|
26
24
|
outbound: {
|
|
27
25
|
[keyMonth: string]: {
|
|
28
|
-
|
|
29
|
-
[keyDay: string]: PriceInfo;
|
|
30
|
-
};
|
|
26
|
+
[keyDay: string]: PriceInfo;
|
|
31
27
|
};
|
|
32
28
|
};
|
|
33
29
|
};
|
|
@@ -49,7 +45,6 @@ export type CalendarProProps = {
|
|
|
49
45
|
isOffLunar?: boolean;
|
|
50
46
|
onCallbackCalendar?: (lunar: string, nextStateShowLunar: boolean) => void;
|
|
51
47
|
disabledDays?: Date[];
|
|
52
|
-
bestPriceColor?: string;
|
|
53
48
|
};
|
|
54
49
|
|
|
55
50
|
export type CalendarProState = {
|
|
@@ -69,7 +64,7 @@ export type DoubleDate = {
|
|
|
69
64
|
};
|
|
70
65
|
|
|
71
66
|
export type CalendarProps = {
|
|
72
|
-
doubleDate
|
|
67
|
+
doubleDate: DoubleDate;
|
|
73
68
|
selectedDate?: Moment.Moment;
|
|
74
69
|
mode?: 'doubleDate' | 'singleDate';
|
|
75
70
|
id?: number;
|
|
@@ -93,18 +88,17 @@ export type CalendarProps = {
|
|
|
93
88
|
hideHeaderTab?: boolean;
|
|
94
89
|
titleHeader?: string;
|
|
95
90
|
hideSwitchReturnSelection?: boolean;
|
|
96
|
-
bestPriceColor?: string;
|
|
97
91
|
};
|
|
98
92
|
|
|
99
93
|
export type CalendarProRef = {
|
|
100
94
|
setDoubleDateAndTabIndex: (
|
|
101
95
|
firstDate?: Moment.Moment | null,
|
|
102
96
|
secondDate?: Moment.Moment | null,
|
|
103
|
-
tabSelected?: number
|
|
97
|
+
tabSelected?: number
|
|
104
98
|
) => void;
|
|
105
99
|
setDateRange: (
|
|
106
|
-
dateRange: {
|
|
107
|
-
isScrollToStartDate: any
|
|
100
|
+
dateRange: {startDate: any; endDate: any},
|
|
101
|
+
isScrollToStartDate: any
|
|
108
102
|
) => void;
|
|
109
103
|
};
|
|
110
104
|
|
|
@@ -114,7 +108,7 @@ export type CalendarState = {
|
|
|
114
108
|
};
|
|
115
109
|
|
|
116
110
|
export type HeaderControlRef = {
|
|
117
|
-
onUpdateInfo: (date: {
|
|
111
|
+
onUpdateInfo: (date: {date: Moment.Moment}) => void;
|
|
118
112
|
};
|
|
119
113
|
|
|
120
114
|
export type HeaderControlProps = {
|
|
@@ -143,7 +137,6 @@ export type MonthListProps = {
|
|
|
143
137
|
}) => void;
|
|
144
138
|
lunarConverter: any;
|
|
145
139
|
disabledDays?: Date[];
|
|
146
|
-
bestPriceColor?: string;
|
|
147
140
|
};
|
|
148
141
|
|
|
149
142
|
export type MonthListState = {
|
|
@@ -167,7 +160,6 @@ export type MonthProps = {
|
|
|
167
160
|
isShowLunar: boolean;
|
|
168
161
|
isDoubleDateMode: boolean;
|
|
169
162
|
disabledDays?: Date[];
|
|
170
|
-
bestPriceColor?: string;
|
|
171
163
|
};
|
|
172
164
|
|
|
173
165
|
export type DayProps = {
|
|
@@ -189,7 +181,6 @@ export type DayProps = {
|
|
|
189
181
|
isBestPrice?: boolean;
|
|
190
182
|
havePriceList: boolean;
|
|
191
183
|
isDisabled?: boolean;
|
|
192
|
-
bestPriceColor?: string;
|
|
193
184
|
};
|
|
194
185
|
|
|
195
186
|
export type TabHeaderState = {
|