@momo-kits/calendar 0.0.55-beta → 0.0.55-beta.2
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 +17 -16
- package/publish.sh +2 -2
- package/src/Calendar.js +214 -90
- package/src/CalendarPro.js +158 -88
- package/src/Day/index.js +119 -96
- package/src/HeaderControl.js +50 -45
- package/src/MonthList.js +81 -53
- package/src/TabHeader.js +47 -34
- package/src/calendarPicker/Day.js +33 -32
- package/src/calendarPicker/WeekDaysLabels.js +6 -7
package/src/TabHeader.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TouchableWithoutFeedback, View
|
|
2
|
+
import { TouchableWithoutFeedback, View } from 'react-native';
|
|
3
3
|
import Moment from 'moment';
|
|
4
4
|
import Util from './Util';
|
|
5
|
+
import { Colors, Text } from '@momo-kits/core';
|
|
5
6
|
|
|
6
7
|
export default class TabHeader extends React.Component {
|
|
7
8
|
constructor(props) {
|
|
8
9
|
super(props);
|
|
9
10
|
this.state = {
|
|
10
|
-
active: props.activeTab
|
|
11
|
+
active: props.activeTab,
|
|
11
12
|
};
|
|
12
13
|
this.label = props.label;
|
|
13
14
|
this.defaultDate = props.date ? Moment(props.date) : '';
|
|
@@ -23,7 +24,7 @@ export default class TabHeader extends React.Component {
|
|
|
23
24
|
updateView = (date, activeTab) => {
|
|
24
25
|
this.setState({
|
|
25
26
|
date: date ? Moment(date) : '',
|
|
26
|
-
active: activeTab
|
|
27
|
+
active: activeTab,
|
|
27
28
|
});
|
|
28
29
|
};
|
|
29
30
|
|
|
@@ -35,42 +36,54 @@ export default class TabHeader extends React.Component {
|
|
|
35
36
|
const { label, disabled } = this.props;
|
|
36
37
|
const { date, active } = this.state;
|
|
37
38
|
const formattedDateFromState = date ? date.format('DD/MM/YYYY') : '';
|
|
38
|
-
const formattedDateFromDefault = this.defaultDate
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const formattedDateFromDefault = this.defaultDate
|
|
40
|
+
? this.defaultDate.format('DD/MM/YYYY')
|
|
41
|
+
: '';
|
|
42
|
+
const dayOfWeekFromState = date
|
|
43
|
+
? `${Util.WEEKDAYSFROMMOMENT[date.day()]} -`
|
|
44
|
+
: '';
|
|
45
|
+
const dayOfWeekFromDefault = this.defaultDate
|
|
46
|
+
? `${Util.WEEKDAYSFROMMOMENT[this.defaultDate.day()]} -`
|
|
47
|
+
: '';
|
|
41
48
|
|
|
42
49
|
return (
|
|
43
|
-
<TouchableWithoutFeedback
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}}
|
|
58
|
-
>
|
|
50
|
+
<TouchableWithoutFeedback
|
|
51
|
+
disabled={disabled}
|
|
52
|
+
onPress={this.onChangeTab}>
|
|
53
|
+
<View
|
|
54
|
+
style={{
|
|
55
|
+
flex: 1,
|
|
56
|
+
backgroundColor: Colors.white,
|
|
57
|
+
}}>
|
|
58
|
+
<Text
|
|
59
|
+
style={{
|
|
60
|
+
fontSize: 12,
|
|
61
|
+
lineHeight: 16,
|
|
62
|
+
color: Colors.black_09,
|
|
63
|
+
}}>
|
|
59
64
|
{label}
|
|
60
|
-
|
|
61
65
|
</Text>
|
|
62
|
-
<Text
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<Text
|
|
70
|
-
{
|
|
71
|
-
|
|
66
|
+
<Text
|
|
67
|
+
weight={active ? 'semibold' : 'regular'}
|
|
68
|
+
style={{
|
|
69
|
+
marginTop: 3,
|
|
70
|
+
fontSize: 14,
|
|
71
|
+
color: Colors.black_17,
|
|
72
|
+
}}>
|
|
73
|
+
<Text
|
|
74
|
+
weight={active ? 'semibold' : 'regular'}
|
|
75
|
+
style={{
|
|
76
|
+
color: Colors.black_17,
|
|
77
|
+
}}>
|
|
78
|
+
{`${
|
|
79
|
+
dayOfWeekFromState ||
|
|
80
|
+
dayOfWeekFromDefault ||
|
|
81
|
+
'--'
|
|
82
|
+
} `}
|
|
72
83
|
</Text>
|
|
73
|
-
{formattedDateFromState ||
|
|
84
|
+
{formattedDateFromState ||
|
|
85
|
+
formattedDateFromDefault ||
|
|
86
|
+
'--/--/----'}
|
|
74
87
|
</Text>
|
|
75
88
|
</View>
|
|
76
89
|
</TouchableWithoutFeedback>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Component
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
2
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { Text } from '@momo-kits/core';
|
|
@@ -26,9 +26,8 @@ export default class Day extends Component {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
processDoubleDate() {
|
|
29
|
-
const {
|
|
30
|
-
|
|
31
|
-
} = this.props;
|
|
29
|
+
const { mode, otherMonth, firstDate, secondDate, tabSelected } =
|
|
30
|
+
this.props;
|
|
32
31
|
const { date } = this;
|
|
33
32
|
if (mode === 'doubleDate' && !otherMonth) {
|
|
34
33
|
if (firstDate && tabSelected === 1) {
|
|
@@ -100,9 +99,7 @@ export default class Day extends Component {
|
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
render() {
|
|
103
|
-
const {
|
|
104
|
-
day, month, year, otherMonth, onDayChange
|
|
105
|
-
} = this.props;
|
|
102
|
+
const { day, month, year, otherMonth, onDayChange } = this.props;
|
|
106
103
|
this.colorCanTouch = 'white';
|
|
107
104
|
this.colorText = '#393939';
|
|
108
105
|
this.colorTextDisable = '#DADADA';
|
|
@@ -114,33 +111,37 @@ export default class Day extends Component {
|
|
|
114
111
|
this.date.setHours(0, 0, 0, 0);
|
|
115
112
|
this.processRender();
|
|
116
113
|
return (
|
|
117
|
-
|
|
118
114
|
<View style={styles.dayWrapper}>
|
|
119
115
|
<View style={this.styleDouble} />
|
|
120
|
-
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
116
|
+
{this.disableTouch || otherMonth ? (
|
|
117
|
+
<View style={styles.dayButton}>
|
|
118
|
+
<Text.Title1
|
|
119
|
+
style={[
|
|
120
|
+
styles.dayLabel,
|
|
121
|
+
{ color: this.colorTextDisable },
|
|
122
|
+
]}>
|
|
123
|
+
{day}
|
|
124
|
+
</Text.Title1>
|
|
125
|
+
</View>
|
|
126
|
+
) : (
|
|
127
|
+
<View
|
|
128
|
+
style={[
|
|
129
|
+
styles.dayButtonSelected,
|
|
130
|
+
{ backgroundColor: this.colorCanTouch },
|
|
131
|
+
]}>
|
|
132
|
+
<TouchableOpacity
|
|
133
|
+
style={styles.dayButton}
|
|
134
|
+
onPress={() => onDayChange(day, month, year)}>
|
|
135
|
+
<Text.Title1
|
|
136
|
+
style={[
|
|
137
|
+
styles.dayLabel,
|
|
138
|
+
{ color: this.colorText },
|
|
139
|
+
]}>
|
|
140
|
+
{day}
|
|
141
|
+
</Text.Title1>
|
|
142
|
+
</TouchableOpacity>
|
|
143
|
+
</View>
|
|
144
|
+
)}
|
|
144
145
|
</View>
|
|
145
146
|
);
|
|
146
147
|
}
|
|
@@ -3,19 +3,18 @@ import { View } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import { Text } from '@momo-kits/core';
|
|
5
5
|
import styles from './styles';
|
|
6
|
-
import { WEEKDAYS
|
|
6
|
+
import { WEEKDAYS } from './util';
|
|
7
7
|
|
|
8
8
|
const colorDay = '#9199a2';
|
|
9
9
|
const WeekDaysLabels = () => (
|
|
10
10
|
<View style={styles.dayLabelsWrapper}>
|
|
11
|
-
{
|
|
12
|
-
<Text.
|
|
11
|
+
{WEEKDAYS.map((day, key) => (
|
|
12
|
+
<Text.Title1
|
|
13
13
|
key={key.toString()}
|
|
14
|
-
style={[styles.dayLabels, { color: colorDay, fontSize: 16 }]}
|
|
15
|
-
>
|
|
14
|
+
style={[styles.dayLabels, { color: colorDay, fontSize: 16 }]}>
|
|
16
15
|
{day}
|
|
17
|
-
</Text.
|
|
18
|
-
))
|
|
16
|
+
</Text.Title1>
|
|
17
|
+
))}
|
|
19
18
|
</View>
|
|
20
19
|
);
|
|
21
20
|
|