@momo-kits/calendar 0.79.6-beta.7 → 0.79.6-beta.9
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 +8 -1
- package/Day.tsx +2 -1
- package/Month.tsx +6 -0
- package/MonthList.tsx +2 -1
- package/index.tsx +2 -0
- package/package.json +1 -1
- package/styles.ts +1 -1
- package/types.ts +5 -0
package/CalendarPro.tsx
CHANGED
|
@@ -247,7 +247,13 @@ export default class CalendarPro extends Component<
|
|
|
247
247
|
holidays,
|
|
248
248
|
temp,
|
|
249
249
|
} = this.state;
|
|
250
|
-
const {
|
|
250
|
+
const {
|
|
251
|
+
isDoubleDateMode,
|
|
252
|
+
priceList,
|
|
253
|
+
disabledDays,
|
|
254
|
+
isHideHoliday,
|
|
255
|
+
isOffLunar,
|
|
256
|
+
} = this.props;
|
|
251
257
|
let priceListFormat = priceList?.outbound;
|
|
252
258
|
if (isDoubleDateMode) {
|
|
253
259
|
priceListFormat =
|
|
@@ -305,6 +311,7 @@ export default class CalendarPro extends Component<
|
|
|
305
311
|
holidays={holidays}
|
|
306
312
|
selectedDate={this.selectedDate}
|
|
307
313
|
priceList={priceListFormat}
|
|
314
|
+
disabledDays={disabledDays}
|
|
308
315
|
/>
|
|
309
316
|
</View>
|
|
310
317
|
</View>
|
package/Day.tsx
CHANGED
|
@@ -78,8 +78,10 @@ class Day extends Component<DayProps> {
|
|
|
78
78
|
isSolarHoliday,
|
|
79
79
|
isLunarHoliday,
|
|
80
80
|
tabSelected,
|
|
81
|
+
isDisabled = false,
|
|
81
82
|
} = props || this.props;
|
|
82
83
|
this.isValid =
|
|
84
|
+
!isDisabled &&
|
|
83
85
|
date &&
|
|
84
86
|
(date >= minDate || date.isSame(minDate, 'day')) &&
|
|
85
87
|
(date <= maxDate || date.isSame(maxDate, 'day'));
|
|
@@ -149,7 +151,6 @@ class Day extends Component<DayProps> {
|
|
|
149
151
|
render() {
|
|
150
152
|
const {theme} = this.context;
|
|
151
153
|
const {date, empty, price, isBestPrice} = this.props;
|
|
152
|
-
|
|
153
154
|
const text = date ? date.date() : '';
|
|
154
155
|
let textColor = theme.colors.text.default;
|
|
155
156
|
let lunarTextColor = theme.colors.text.hint;
|
package/Month.tsx
CHANGED
|
@@ -57,8 +57,13 @@ export default class Month extends PureComponent<MonthProps> {
|
|
|
57
57
|
endDate,
|
|
58
58
|
isShowLunar,
|
|
59
59
|
isDoubleDateMode,
|
|
60
|
+
disabledDays,
|
|
60
61
|
} = this.props;
|
|
61
62
|
|
|
63
|
+
const dateItem = new Date(item.date);
|
|
64
|
+
const mappedDisabledArray = disabledDays?.map(item => String(item));
|
|
65
|
+
const isDisabled = mappedDisabledArray?.includes(String(dateItem));
|
|
66
|
+
|
|
62
67
|
return (
|
|
63
68
|
<Day
|
|
64
69
|
{...this.props}
|
|
@@ -77,6 +82,7 @@ export default class Month extends PureComponent<MonthProps> {
|
|
|
77
82
|
index={i}
|
|
78
83
|
price={priceInfo?.priceAsString}
|
|
79
84
|
isBestPrice={priceInfo?.isBestPrice}
|
|
85
|
+
isDisabled={isDisabled}
|
|
80
86
|
/>
|
|
81
87
|
);
|
|
82
88
|
})}
|
package/MonthList.tsx
CHANGED
|
@@ -40,7 +40,7 @@ export default class MonthList extends Component<
|
|
|
40
40
|
item: {dateList: any; date: moment.Moment};
|
|
41
41
|
index: number;
|
|
42
42
|
}) => {
|
|
43
|
-
const {isDoubleDateMode, priceList, isShowLunar} = this.props;
|
|
43
|
+
const {isDoubleDateMode, disabledDays, priceList, isShowLunar} = this.props;
|
|
44
44
|
const {item, index} = data;
|
|
45
45
|
|
|
46
46
|
const keyMonth = moment(item.date)?.format('YYYY-MM');
|
|
@@ -55,6 +55,7 @@ export default class MonthList extends Component<
|
|
|
55
55
|
priceListDate={priceListDate}
|
|
56
56
|
isShowLunar={isShowLunar}
|
|
57
57
|
isDoubleDateMode={isDoubleDateMode}
|
|
58
|
+
disabledDays={disabledDays}
|
|
58
59
|
/>
|
|
59
60
|
);
|
|
60
61
|
};
|
package/index.tsx
CHANGED
|
@@ -427,6 +427,7 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
427
427
|
doubleDate,
|
|
428
428
|
isHideHeaderPanel,
|
|
429
429
|
style,
|
|
430
|
+
disabledDays = [],
|
|
430
431
|
} = this.props;
|
|
431
432
|
const {isDoubleDateMode, containerWidth} = this.state;
|
|
432
433
|
const {theme} = this.context;
|
|
@@ -462,6 +463,7 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
462
463
|
maxDate={maxDate}
|
|
463
464
|
isHideHoliday={isHideHoliday}
|
|
464
465
|
isOffLunar={isOffLunar}
|
|
466
|
+
disabledDays={disabledDays}
|
|
465
467
|
/>
|
|
466
468
|
</ScrollView>
|
|
467
469
|
</ContainerContext.Provider>
|
package/package.json
CHANGED
package/styles.ts
CHANGED
package/types.ts
CHANGED
|
@@ -40,6 +40,7 @@ export type CalendarProProps = {
|
|
|
40
40
|
isHideHoliday?: boolean;
|
|
41
41
|
isOffLunar?: boolean;
|
|
42
42
|
onCallbackCalendar?: (lunar: string, nextStateShowLunar: boolean) => void;
|
|
43
|
+
disabledDays?: Date[];
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
export type CalendarProState = {
|
|
@@ -81,6 +82,7 @@ export type CalendarProps = {
|
|
|
81
82
|
maxDate: Date;
|
|
82
83
|
isHideHeaderPanel?: boolean;
|
|
83
84
|
style: ViewStyle | ViewStyle[];
|
|
85
|
+
disabledDays?: Date[];
|
|
84
86
|
};
|
|
85
87
|
|
|
86
88
|
export type CalendarProRef = {
|
|
@@ -129,6 +131,7 @@ export type MonthListProps = {
|
|
|
129
131
|
currentIndex: number;
|
|
130
132
|
}) => void;
|
|
131
133
|
lunarConverter: any;
|
|
134
|
+
disabledDays?: Date[];
|
|
132
135
|
};
|
|
133
136
|
|
|
134
137
|
export type MonthListState = {
|
|
@@ -151,6 +154,7 @@ export type MonthProps = {
|
|
|
151
154
|
endDate: Moment.Moment;
|
|
152
155
|
isShowLunar: boolean;
|
|
153
156
|
isDoubleDateMode: boolean;
|
|
157
|
+
disabledDays?: Date[];
|
|
154
158
|
};
|
|
155
159
|
|
|
156
160
|
export type DayProps = {
|
|
@@ -171,6 +175,7 @@ export type DayProps = {
|
|
|
171
175
|
price?: string;
|
|
172
176
|
isBestPrice?: boolean;
|
|
173
177
|
havePriceList: boolean;
|
|
178
|
+
isDisabled: boolean;
|
|
174
179
|
};
|
|
175
180
|
|
|
176
181
|
export type TabHeaderState = {
|