@ledvance/group-ui-biz-bundle 1.0.157 → 1.0.159
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
CHANGED
|
@@ -14,6 +14,7 @@ interface DateSelectedItemProps extends PropsWithChildren<ViewProps> {
|
|
|
14
14
|
theme?: ThemeType
|
|
15
15
|
date: string,
|
|
16
16
|
dateType: DateType,
|
|
17
|
+
minDate?: Date
|
|
17
18
|
onDateChange: (string) => void
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -43,7 +44,7 @@ const getDateForDateType = (year, month, day, dateType: DateType) => {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
export default withTheme(function DateSelectedItem(props: DateSelectedItemProps) {
|
|
46
|
-
const {dateType, date, onDateChange, theme} = props;
|
|
47
|
+
const {dateType, date, minDate, onDateChange, theme} = props;
|
|
47
48
|
const state = useReactive({
|
|
48
49
|
showDateModal: false,
|
|
49
50
|
date: date,
|
|
@@ -129,6 +130,7 @@ export default withTheme(function DateSelectedItem(props: DateSelectedItemProps)
|
|
|
129
130
|
mode={state.modalMode}
|
|
130
131
|
dateSortKeys={['day', 'month', 'year']}
|
|
131
132
|
maxDate={new Date()}
|
|
133
|
+
minDate={minDate}
|
|
132
134
|
style={{backgroundColor: theme?.popup.cellBg}}
|
|
133
135
|
pickerFontColor={theme?.global.fontColor}
|
|
134
136
|
onDateChange={date => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ThemeType from "@ledvance/base/src/config/themeType";
|
|
2
|
-
import React, {PropsWithChildren, useCallback, useEffect} from "react";
|
|
2
|
+
import React, {PropsWithChildren, useCallback, useEffect, useMemo} from "react";
|
|
3
3
|
import {Image, TouchableOpacity, View, ViewProps} from "react-native";
|
|
4
4
|
import {Utils} from "tuya-panel-kit";
|
|
5
5
|
import {useReactive} from "ahooks";
|
|
@@ -16,11 +16,12 @@ interface DateSwitchProps extends PropsWithChildren<ViewProps> {
|
|
|
16
16
|
headlineText: string,
|
|
17
17
|
date: string,
|
|
18
18
|
dateType: DateType,
|
|
19
|
+
minDate?: string,
|
|
19
20
|
onDateChange: (string) => void
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export default withTheme(function DateSwitch(props: DateSwitchProps) {
|
|
23
|
-
const {dateType, date, onDateChange, theme, headlineText} = props;
|
|
24
|
+
const {dateType, date, minDate, onDateChange, theme, headlineText} = props;
|
|
24
25
|
const state = useReactive({
|
|
25
26
|
date: date,
|
|
26
27
|
dateType: dateType,
|
|
@@ -38,8 +39,12 @@ export default withTheme(function DateSwitch(props: DateSwitchProps) {
|
|
|
38
39
|
state.disableArrowLeft = !canPreChangeDate;
|
|
39
40
|
}, [date, headlineText, dateType]);
|
|
40
41
|
|
|
42
|
+
const minDateObj = useMemo(
|
|
43
|
+
() => (minDate ? new Date(minDate) : undefined),
|
|
44
|
+
[minDate]);
|
|
45
|
+
|
|
41
46
|
const canPreOrNextChangeDate = useCallback((datejs: dayjs.Dayjs) => {
|
|
42
|
-
const minDatejs = dayjs('2000-1-1');
|
|
47
|
+
const minDatejs = dayjs(minDateObj || '2000-1-1');
|
|
43
48
|
const nowDatejs = dayjs();
|
|
44
49
|
const year = datejs.year();
|
|
45
50
|
const month = (datejs.month() + 1).toString().padStart(2, '0');
|
|
@@ -94,6 +99,7 @@ export default withTheme(function DateSwitch(props: DateSwitchProps) {
|
|
|
94
99
|
style={{flex: 1}}
|
|
95
100
|
dateType={state.dateType}
|
|
96
101
|
date={state.date}
|
|
102
|
+
minDate={minDateObj}
|
|
97
103
|
onDateChange={date => {
|
|
98
104
|
props.onDateChange(date)
|
|
99
105
|
}}
|
|
@@ -78,7 +78,7 @@ const MoodItem = (props: MoodItemProps) => {
|
|
|
78
78
|
<View style={styles.contentContainer}>
|
|
79
79
|
{/* 顶部内容 */}
|
|
80
80
|
<View style={styles.row}>
|
|
81
|
-
<Text style={styles.headText}>{mood.name}</Text>
|
|
81
|
+
<Text style={styles.headText} numberOfLines={2}>{mood.name}</Text>
|
|
82
82
|
{/* checkbox 的 TouchableOpacity 现在也应用了阴影样式 */}
|
|
83
83
|
<TouchableOpacity style={styles.checkbox} onPress={() => onSwitch(!enable)}>
|
|
84
84
|
<Image
|