@momo-kits/calendar 0.0.71-beta.25 → 0.0.71-beta.29
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/index.js +1 -1
- package/package.json +1 -1
- package/publish.sh +1 -1
- package/src/Calendar.js +0 -2
- package/src/CalendarPro.js +7 -35
- package/src/Day/index.js +1 -4
- package/src/Day/style.js +0 -1
- package/src/HeaderControl.js +66 -72
- package/src/LunarDateConverter.js +185 -179
- package/src/LunarService.js +71 -40
- package/src/Month/index.js +3 -8
- package/src/MonthList.js +3 -6
- package/src/TabHeader.js +61 -68
- package/src/Util.js +273 -193
- package/src/holidayData.js +121 -121
package/index.js
CHANGED
package/package.json
CHANGED
package/publish.sh
CHANGED
|
@@ -26,4 +26,4 @@ cd ..
|
|
|
26
26
|
rm -rf dist
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
##curl -X POST 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/calendar new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/calendar"}'
|
package/src/Calendar.js
CHANGED
|
@@ -409,7 +409,6 @@ class Calendar extends Component {
|
|
|
409
409
|
maxDate,
|
|
410
410
|
doubleDate,
|
|
411
411
|
isHideHeaderPanel,
|
|
412
|
-
disabledWeekend,
|
|
413
412
|
style,
|
|
414
413
|
} = this.props;
|
|
415
414
|
const {isDoubleDateMode} = this.state;
|
|
@@ -432,7 +431,6 @@ class Calendar extends Component {
|
|
|
432
431
|
{!isHideHeaderPanel && this.renderHeaderPanel()}
|
|
433
432
|
</View>
|
|
434
433
|
<CalendarPro
|
|
435
|
-
disabledWeekend={disabledWeekend}
|
|
436
434
|
priceList={priceList}
|
|
437
435
|
ref={this.calendarPicker}
|
|
438
436
|
startDate={doubleDate?.first}
|
package/src/CalendarPro.js
CHANGED
|
@@ -60,10 +60,7 @@ export default class CalendarPro extends Component {
|
|
|
60
60
|
setDateRange = (dateRange, isScrollToStartDate) => {
|
|
61
61
|
if (dateRange && dateRange.startDate && dateRange.endDate) {
|
|
62
62
|
this.setState(
|
|
63
|
-
{
|
|
64
|
-
startDate: dateRange.startDate,
|
|
65
|
-
endDate: dateRange.endDate,
|
|
66
|
-
},
|
|
63
|
+
{startDate: dateRange.startDate, endDate: dateRange.endDate},
|
|
67
64
|
() => {
|
|
68
65
|
const dateScroll = isScrollToStartDate
|
|
69
66
|
? dateRange.startDate
|
|
@@ -75,10 +72,7 @@ export default class CalendarPro extends Component {
|
|
|
75
72
|
};
|
|
76
73
|
|
|
77
74
|
ownSetState(state) {
|
|
78
|
-
this.setState({
|
|
79
|
-
...state,
|
|
80
|
-
ownUpdate: true,
|
|
81
|
-
});
|
|
75
|
+
this.setState({...state, ownUpdate: true});
|
|
82
76
|
}
|
|
83
77
|
|
|
84
78
|
loadLabel = (data, type) => {
|
|
@@ -156,11 +150,7 @@ export default class CalendarPro extends Component {
|
|
|
156
150
|
} else {
|
|
157
151
|
data = holidays;
|
|
158
152
|
}
|
|
159
|
-
this.ownSetState({
|
|
160
|
-
holidays,
|
|
161
|
-
temp: data,
|
|
162
|
-
headerKey: key,
|
|
163
|
-
});
|
|
153
|
+
this.ownSetState({holidays, temp: data, headerKey: key});
|
|
164
154
|
};
|
|
165
155
|
|
|
166
156
|
onScrollCalendar = data => {
|
|
@@ -241,17 +231,12 @@ export default class CalendarPro extends Component {
|
|
|
241
231
|
isHideLabel,
|
|
242
232
|
isHideHoliday,
|
|
243
233
|
isOffLunar,
|
|
244
|
-
disabledWeekend,
|
|
245
|
-
isShowLunar,
|
|
246
234
|
} = this.props;
|
|
247
235
|
let priceListFormat = priceList?.outbound;
|
|
248
236
|
if (isDoubleDateMode) {
|
|
249
237
|
priceListFormat =
|
|
250
238
|
tabSelected === 0 ? priceList?.outbound : priceList?.inbound;
|
|
251
239
|
}
|
|
252
|
-
const isDisabledWeekend =
|
|
253
|
-
disabledWeekend && !priceList && !isShowLunar && !isDoubleDateMode;
|
|
254
|
-
|
|
255
240
|
return (
|
|
256
241
|
<View style={styles.container}>
|
|
257
242
|
<View style={styles.viewDate}>
|
|
@@ -272,9 +257,7 @@ export default class CalendarPro extends Component {
|
|
|
272
257
|
{
|
|
273
258
|
color:
|
|
274
259
|
item === 6 || item === 7
|
|
275
|
-
?
|
|
276
|
-
? Colors.red_07
|
|
277
|
-
: Colors.red_03
|
|
260
|
+
? Colors.red_03
|
|
278
261
|
: Colors.black_17,
|
|
279
262
|
},
|
|
280
263
|
]}
|
|
@@ -284,7 +267,6 @@ export default class CalendarPro extends Component {
|
|
|
284
267
|
))}
|
|
285
268
|
</View>
|
|
286
269
|
<MonthList
|
|
287
|
-
disabledWeekend={isDisabledWeekend}
|
|
288
270
|
ref="MonthList"
|
|
289
271
|
today={this.today}
|
|
290
272
|
minDate={this.minDate}
|
|
@@ -380,22 +362,12 @@ CalendarPro.defaultProps = {
|
|
|
380
362
|
|
|
381
363
|
const styles = StyleSheet.create({
|
|
382
364
|
row: {flexDirection: 'row'},
|
|
383
|
-
txtMonthLunar: {
|
|
384
|
-
color: Colors.red_03,
|
|
385
|
-
marginRight: Spacing.S,
|
|
386
|
-
},
|
|
365
|
+
txtMonthLunar: {color: Colors.red_03, marginRight: Spacing.S},
|
|
387
366
|
subTextLunar: {
|
|
388
367
|
color: Colors.black_17,
|
|
389
368
|
},
|
|
390
|
-
contentScroll: {
|
|
391
|
-
|
|
392
|
-
paddingVertical: 10,
|
|
393
|
-
},
|
|
394
|
-
iconSelected: {
|
|
395
|
-
width: 24,
|
|
396
|
-
height: 24,
|
|
397
|
-
resizeMode: 'cover',
|
|
398
|
-
},
|
|
369
|
+
contentScroll: {paddingHorizontal: 12, paddingVertical: 10},
|
|
370
|
+
iconSelected: {width: 24, height: 24, resizeMode: 'cover'},
|
|
399
371
|
txtLunar: {
|
|
400
372
|
paddingLeft: 6,
|
|
401
373
|
color: '#222222',
|
package/src/Day/index.js
CHANGED
|
@@ -108,8 +108,7 @@ class Day extends Component {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
render() {
|
|
111
|
-
const {date, empty, price, isBestPrice
|
|
112
|
-
|
|
111
|
+
const {date, empty, price, isBestPrice} = this.props;
|
|
113
112
|
const text = date ? date.date() : '';
|
|
114
113
|
return (
|
|
115
114
|
<View style={style.dayContainer}>
|
|
@@ -121,7 +120,6 @@ class Day extends Component {
|
|
|
121
120
|
]}>
|
|
122
121
|
{this.isValid && this.isInScope ? (
|
|
123
122
|
<TouchableHighlight
|
|
124
|
-
disabled={disabledWeekend && this.isWeekEnd}
|
|
125
123
|
style={[
|
|
126
124
|
style.day,
|
|
127
125
|
{
|
|
@@ -152,7 +150,6 @@ class Day extends Component {
|
|
|
152
150
|
this.isWeekEnd && style.weekendDay,
|
|
153
151
|
this.isSolarHoliday && style.weekendDay,
|
|
154
152
|
(this.isStart || this.isEnd) && style.focusedText,
|
|
155
|
-
this.isWeekEnd && disabledWeekend && style.disabledWeekend,
|
|
156
153
|
]}>
|
|
157
154
|
{text}
|
|
158
155
|
</Text.Label1>
|
package/src/Day/style.js
CHANGED
package/src/HeaderControl.js
CHANGED
|
@@ -1,85 +1,79 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, {useState, forwardRef, useImperativeHandle} from 'react';
|
|
2
|
+
import {View, TouchableOpacity, StyleSheet} from 'react-native';
|
|
3
3
|
import moment from 'moment';
|
|
4
|
-
import {
|
|
4
|
+
import {Icon, ScaleSize, Text, Colors, Spacing} from '@momo-kits/core-v2';
|
|
5
5
|
|
|
6
6
|
import Util from './Util';
|
|
7
7
|
|
|
8
8
|
const HeaderControl = forwardRef(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
({onPressBackArrow, onPressNextArrow, selectedDate}, ref) => {
|
|
10
|
+
const [info, setInfo] = useState({
|
|
11
|
+
date: moment(selectedDate || new Date()),
|
|
12
|
+
});
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
useImperativeHandle(ref, () => ({
|
|
15
|
+
onUpdateInfo,
|
|
16
|
+
}));
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const onUpdateInfo = date => {
|
|
19
|
+
setInfo(date);
|
|
20
|
+
};
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
</TouchableOpacity>
|
|
51
|
-
</View>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
return <View />;
|
|
55
|
-
},
|
|
22
|
+
if (info && info.date) {
|
|
23
|
+
const headerFormat = `${Util.mapMonth(
|
|
24
|
+
info.date.month() + 1,
|
|
25
|
+
)}/${info.date.year()}`;
|
|
26
|
+
return (
|
|
27
|
+
<View style={styles.container}>
|
|
28
|
+
<TouchableOpacity style={styles.btnLeft} onPress={onPressBackArrow}>
|
|
29
|
+
<Icon
|
|
30
|
+
name="24_arrow_chevron_left_small"
|
|
31
|
+
tintColor={Colors.black_17}
|
|
32
|
+
style={styles.icon}
|
|
33
|
+
/>
|
|
34
|
+
</TouchableOpacity>
|
|
35
|
+
<Text.HeaderText2 weight="semibold" style={styles.txtHeader}>
|
|
36
|
+
{headerFormat}
|
|
37
|
+
</Text.HeaderText2>
|
|
38
|
+
<TouchableOpacity style={styles.btnRight} onPress={onPressNextArrow}>
|
|
39
|
+
<Icon
|
|
40
|
+
name="24_arrow_chevron_right_small"
|
|
41
|
+
tintColor={Colors.black_17}
|
|
42
|
+
style={styles.icon}
|
|
43
|
+
/>
|
|
44
|
+
</TouchableOpacity>
|
|
45
|
+
</View>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return <View />;
|
|
49
|
+
},
|
|
56
50
|
);
|
|
57
51
|
|
|
58
52
|
export default HeaderControl;
|
|
59
53
|
const styles = StyleSheet.create({
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
54
|
+
icon: {width: 24, height: 24, resizeMode: 'contain'},
|
|
55
|
+
txtHeader: {
|
|
56
|
+
// fontSize: 15,
|
|
57
|
+
textAlign: 'center',
|
|
58
|
+
},
|
|
59
|
+
btnRight: {
|
|
60
|
+
width: 36,
|
|
61
|
+
height: 36,
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
},
|
|
65
|
+
btnLeft: {
|
|
66
|
+
width: 36,
|
|
67
|
+
height: 36,
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
},
|
|
71
|
+
container: {
|
|
72
|
+
height: ScaleSize(44),
|
|
73
|
+
flexDirection: 'row',
|
|
74
|
+
justifyContent: 'space-between',
|
|
75
|
+
backgroundColor: Colors.blue_10,
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
borderRadius: 4,
|
|
78
|
+
},
|
|
85
79
|
});
|