@momo-kits/calendar 0.0.73-beta → 0.72.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/index.js +1 -1
- package/package.json +17 -16
- package/publish.sh +2 -2
- package/src/Calendar.js +476 -343
- package/src/CalendarPro.js +391 -318
- package/src/Day/index.js +215 -175
- package/src/Day/style.js +114 -116
- package/src/HeaderControl.js +65 -61
- package/src/LunarDateConverter.js +186 -179
- package/src/LunarService.js +76 -40
- package/src/Month/index.js +74 -65
- package/src/MonthList.js +232 -237
- package/src/TabHeader.js +60 -67
- package/src/Util.js +273 -193
- package/src/calendarPicker/Day.js +120 -128
- package/src/calendarPicker/Days.js +208 -181
- package/src/calendarPicker/HeaderControls.js +145 -136
- package/src/calendarPicker/WeekDaysLabels.js +18 -13
- package/src/calendarPicker/index.js +100 -100
- package/src/calendarPicker/styles.js +175 -176
- package/src/calendarPicker/util.js +75 -41
- package/src/holidayData.js +121 -123
|
@@ -1,184 +1,183 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Dimensions, StyleSheet} from 'react-native';
|
|
2
2
|
|
|
3
3
|
const widthScreen = Dimensions.get('window').width;
|
|
4
4
|
|
|
5
5
|
const styles = StyleSheet.create({
|
|
6
|
-
|
|
6
|
+
calendar: {
|
|
7
7
|
// height:widthScreen - 20,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
8
|
+
backgroundColor: 'white',
|
|
9
|
+
borderColor: '#DADADA',
|
|
10
|
+
borderBottomWidth: 1,
|
|
11
|
+
borderTopWidth: 1,
|
|
12
|
+
},
|
|
13
|
+
dayWrapper: {
|
|
14
|
+
width: widthScreen / 7,
|
|
15
|
+
height: 40,
|
|
16
|
+
backgroundColor: 'rgba(0,0,0,0.0)',
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
dayButton: {
|
|
20
|
+
width: 50,
|
|
21
|
+
height: 50,
|
|
22
|
+
alignSelf: 'center',
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
styleFirstDate: {
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
// width:45,
|
|
28
|
+
height: 40,
|
|
29
|
+
top: 0,
|
|
30
|
+
left: widthScreen / 14,
|
|
31
|
+
right: -1,
|
|
32
|
+
backgroundColor: '#90d6f3',
|
|
33
|
+
borderRadius: 0,
|
|
34
|
+
},
|
|
35
|
+
styleSecondDate: {
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
// width:45,
|
|
38
|
+
height: 40,
|
|
39
|
+
top: 0,
|
|
40
|
+
right: widthScreen / 14,
|
|
41
|
+
left: 0,
|
|
42
|
+
backgroundColor: '#90d6f3',
|
|
43
|
+
borderRadius: 0,
|
|
44
|
+
},
|
|
45
|
+
styleBetween: {
|
|
46
|
+
height: 40,
|
|
47
|
+
// width:60,
|
|
48
|
+
top: 0,
|
|
49
|
+
left: 0,
|
|
50
|
+
right: -1,
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
backgroundColor: '#90d6f3',
|
|
53
|
+
borderRadius: 0,
|
|
54
|
+
},
|
|
55
|
+
dayButtonSelected: {
|
|
56
|
+
width: 40,
|
|
57
|
+
height: 40,
|
|
58
|
+
borderRadius: 20,
|
|
59
|
+
backgroundColor: '#2eb3e8',
|
|
60
|
+
alignSelf: 'center',
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
dayButtonNow: {
|
|
64
|
+
width: 40,
|
|
65
|
+
height: 40,
|
|
66
|
+
borderRadius: 20,
|
|
67
|
+
backgroundColor: '#8F8E94',
|
|
68
|
+
alignSelf: 'center',
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
dayLabel: {
|
|
72
|
+
fontSize: 16,
|
|
73
|
+
color: '#393939',
|
|
74
|
+
marginTop: 10,
|
|
75
|
+
alignSelf: 'center',
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
dayLabelsWrapper: {
|
|
79
|
+
width: widthScreen,
|
|
80
|
+
flexDirection: 'row',
|
|
81
|
+
marginBottom: 10,
|
|
82
|
+
paddingTop: 5,
|
|
83
|
+
paddingBottom: 5,
|
|
84
|
+
borderColor: '#DADADA',
|
|
85
|
+
borderBottomWidth: 1,
|
|
86
|
+
borderTopWidth: 1,
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
daysWrapper: {
|
|
90
|
+
alignSelf: 'center',
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
dayLabels: {
|
|
94
|
+
width: widthScreen / 7,
|
|
95
|
+
fontSize: 12,
|
|
96
|
+
color: '#000',
|
|
97
|
+
textAlign: 'center',
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
selectedDay: {
|
|
101
|
+
width: 60,
|
|
102
|
+
height: 60,
|
|
103
|
+
backgroundColor: '#5ce600',
|
|
104
|
+
borderRadius: 30,
|
|
105
|
+
alignSelf: 'center',
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
monthLabel: {
|
|
109
|
+
fontSize: widthScreen > 320 ? 20 : 17,
|
|
110
|
+
fontWeight: '300',
|
|
111
|
+
color: '#000',
|
|
112
|
+
width: 180,
|
|
113
|
+
textAlign: 'center',
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
headerWrapper: {
|
|
117
|
+
width: widthScreen,
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
justifyContent: 'space-between',
|
|
120
|
+
flexDirection: 'row',
|
|
121
|
+
marginVertical: 10,
|
|
122
|
+
backgroundColor: 'rgba(0,0,0,0.0)',
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
monthSelector: {
|
|
126
|
+
width: 80,
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
prev: {
|
|
130
|
+
textAlign: 'left',
|
|
131
|
+
fontSize: 16,
|
|
132
|
+
color: '#dadada',
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
next: {
|
|
136
|
+
textAlign: 'right',
|
|
137
|
+
fontSize: 16,
|
|
138
|
+
color: '#dadada',
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
yearLabel: {
|
|
142
|
+
fontSize: 14,
|
|
143
|
+
fontWeight: 'bold',
|
|
144
|
+
color: '#000',
|
|
145
|
+
textAlign: 'center',
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
weeks: {
|
|
149
|
+
flexDirection: 'column',
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
weekRow: {
|
|
153
|
+
flexDirection: 'row',
|
|
154
|
+
},
|
|
155
|
+
btnCellHeader: {
|
|
156
|
+
flex: 1,
|
|
157
|
+
justifyContent: 'center',
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
borderWidth: 1,
|
|
160
|
+
borderColor: '#DADADA',
|
|
161
|
+
backgroundColor: 'white',
|
|
162
|
+
},
|
|
163
|
+
center: {
|
|
164
|
+
justifyContent: 'center',
|
|
165
|
+
alignItems: 'center',
|
|
166
|
+
},
|
|
167
|
+
txtDate: {
|
|
168
|
+
color: '#4D4D4D',
|
|
169
|
+
fontSize: 18,
|
|
170
|
+
fontWeight: 'bold',
|
|
171
|
+
paddingVertical: 10,
|
|
172
|
+
},
|
|
173
|
+
lineActiveTab: {
|
|
174
|
+
height: 3,
|
|
175
|
+
width: '100%',
|
|
176
|
+
position: 'absolute',
|
|
177
|
+
bottom: 0,
|
|
178
|
+
left: 0,
|
|
179
|
+
backgroundColor: '#49A3BC',
|
|
180
|
+
},
|
|
182
181
|
});
|
|
183
182
|
|
|
184
183
|
export default styles;
|
|
@@ -1,50 +1,84 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {SwitchLanguage} from '@momo-kits/core';
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
en: ['Mon', 'Tues', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun'],
|
|
9
|
-
}),
|
|
4
|
+
WEEKDAYS: SwitchLanguage.getLocalize({
|
|
5
|
+
vi: ['T2', 'T3', 'T4', 'T5', 'T6', 'T7', 'CN'],
|
|
6
|
+
en: ['Mon', 'Tues', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun'],
|
|
7
|
+
}),
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
en: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
|
21
|
-
}),
|
|
9
|
+
WEEKDAYSNAME: [
|
|
10
|
+
'Thứ 2',
|
|
11
|
+
'Thứ 3',
|
|
12
|
+
'Thứ 4',
|
|
13
|
+
'Thứ 5',
|
|
14
|
+
'Thứ 6',
|
|
15
|
+
'Thứ 7',
|
|
16
|
+
'Chủ nhật',
|
|
17
|
+
],
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
MONTHS: SwitchLanguage.getLocalize({
|
|
20
|
+
vi: [
|
|
21
|
+
'Tháng 1',
|
|
22
|
+
'Tháng 2',
|
|
23
|
+
'Tháng 3',
|
|
24
|
+
'Tháng 4',
|
|
25
|
+
'Tháng 5',
|
|
26
|
+
'Tháng 6',
|
|
27
|
+
'Tháng 7',
|
|
28
|
+
'Tháng 8',
|
|
29
|
+
'Tháng 9',
|
|
30
|
+
'Tháng 10',
|
|
31
|
+
'Tháng 11',
|
|
32
|
+
'Tháng 12',
|
|
33
|
+
],
|
|
34
|
+
en: [
|
|
35
|
+
'Jan',
|
|
36
|
+
'Feb',
|
|
37
|
+
'Mar',
|
|
38
|
+
'Apr',
|
|
39
|
+
'May',
|
|
40
|
+
'Jun',
|
|
41
|
+
'Jul',
|
|
42
|
+
'Aug',
|
|
43
|
+
'Sep',
|
|
44
|
+
'Oct',
|
|
45
|
+
'Nov',
|
|
46
|
+
'Dec',
|
|
47
|
+
],
|
|
48
|
+
}),
|
|
24
49
|
|
|
25
|
-
|
|
50
|
+
MAX_ROWS: 7,
|
|
26
51
|
|
|
27
|
-
|
|
28
|
-
const lastDayOfMonth = new Date(year, month + 1, 0);
|
|
29
|
-
return lastDayOfMonth.getDate();
|
|
30
|
-
},
|
|
52
|
+
MAX_COLUMNS: 7,
|
|
31
53
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
day = 7;
|
|
37
|
-
}
|
|
38
|
-
return WEEKDAYSNAME[day - 1];
|
|
39
|
-
},
|
|
40
|
-
formatDate(date) {
|
|
41
|
-
const padding = (input) => `${input > 9 ? input : `0${input}`}`;
|
|
42
|
-
if (date && typeof date.getDate === 'function') {
|
|
43
|
-
return `${padding(date.getDate())}/${
|
|
44
|
-
padding(date.getMonth() + 1)}/${
|
|
45
|
-
(date.getFullYear()).toString()}`;
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
},
|
|
54
|
+
getDaysInMonth(month, year) {
|
|
55
|
+
const lastDayOfMonth = new Date(year, month + 1, 0);
|
|
56
|
+
return lastDayOfMonth.getDate();
|
|
57
|
+
},
|
|
49
58
|
|
|
59
|
+
getDayofDate(date) {
|
|
60
|
+
const WEEKDAYSNAME = [
|
|
61
|
+
'Thứ hai',
|
|
62
|
+
'Thứ ba',
|
|
63
|
+
'Thứ tư',
|
|
64
|
+
'Thứ năm',
|
|
65
|
+
'Thứ sáu',
|
|
66
|
+
'Thứ bảy',
|
|
67
|
+
'Chủ nhật',
|
|
68
|
+
];
|
|
69
|
+
let day = date.getDay();
|
|
70
|
+
if (date.getDay() === 0) {
|
|
71
|
+
day = 7;
|
|
72
|
+
}
|
|
73
|
+
return WEEKDAYSNAME[day - 1];
|
|
74
|
+
},
|
|
75
|
+
formatDate(date) {
|
|
76
|
+
const padding = input => `${input > 9 ? input : `0${input}`}`;
|
|
77
|
+
if (date && typeof date.getDate === 'function') {
|
|
78
|
+
return `${padding(date.getDate())}/${padding(date.getMonth() + 1)}/${date
|
|
79
|
+
.getFullYear()
|
|
80
|
+
.toString()}`;
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
},
|
|
50
84
|
};
|