@cloudbase/weda-ui 3.20.0 → 3.20.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/dist/configs/components/chart/bar.js +2 -2
- package/dist/configs/components/chart/line.js +2 -2
- package/dist/configs/components/chart/pie.js +2 -2
- package/dist/configs/components/chart/statisticsCard.json +5 -12
- package/dist/configs/components/form/location.json +3 -9
- package/dist/configs/components/form-location.d.ts +2 -2
- package/dist/configs/components/form-location.js +1 -1
- package/dist/configs/components/scrollVeiw.json +43 -79
- package/dist/configs/components/wd-calendar.d.ts +4 -0
- package/dist/configs/components/wd-calendar.js +23 -1
- package/dist/configs/components/wd-cascader.d.ts +7 -12
- package/dist/configs/components/wd-cascader.js +12 -1
- package/dist/configs/components/wd-checkbox.d.ts +4 -1
- package/dist/configs/components/wd-checkbox.js +11 -1
- package/dist/configs/components/wd-form.js +2 -1
- package/dist/configs/components/wd-location.d.ts +2 -2
- package/dist/configs/components/wd-location.js +1 -1
- package/dist/configs/components/wd-radio.d.ts +4 -1
- package/dist/configs/components/wd-select-multiple.d.ts +4 -1
- package/dist/configs/components/wd-select-multiple.js +11 -1
- package/dist/configs/components/wd-select.d.ts +4 -1
- package/dist/configs/components/wd-table.js +3 -2
- package/dist/configs/components/wd-tag-select.d.ts +4 -1
- package/dist/configs/components/wd-tag-select.js +11 -1
- package/dist/configs/components/wd-top-tab.d.ts +1 -1
- package/dist/configs/components/wd-top-tab.js +2 -1
- package/dist/configs/index.d.ts +102 -60
- package/dist/configs/type-utils/type-form.d.ts +10 -4
- package/dist/configs/type-utils/type-form.js +31 -4
- package/dist/enum/index.js +1 -0
- package/dist/style/index.css +1 -0
- package/dist/style/index.scss +1 -1
- package/dist/style/weda-ui.min.css +2 -2
- package/dist/web/components/form/location/common/propsConfig.d.ts +3 -3
- package/dist/web/components/form/location/common/propsConfig.js +2 -2
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +36 -27
- package/dist/web/components/form/location/components/LocationPC/Header.js +2 -2
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +38 -41
- package/dist/web/components/form-location/index.d.ts +1 -1
- package/dist/web/components/form-location/index.js +3 -3
- package/dist/web/components/form-rich-text/index.d.ts +2 -2
- package/dist/web/components/form-rich-text/index.js +2 -2
- package/dist/web/components/wd-calendar/wd-calendar.js +4 -11
- package/dist/web/components/wd-calendar/weeks.d.ts +1 -1
- package/dist/web/components/wd-calendar/weeks.js +2 -2
- package/dist/web/components/wd-form/form-utils.d.ts +0 -1
- package/dist/web/components/wd-form/form-utils.js +0 -32
- package/dist/web/components/wd-form/index.js +17 -7
- package/dist/web/components/wd-form-obj/base-form-obj.js +9 -0
- package/dist/web/components/wd-input-number/wd-input-number.js +3 -15
- package/dist/web/components/wd-location/wd-location.d.ts +1 -1
- package/dist/web/components/wd-location/wd-location.js +2 -2
- package/dist/web/components/wd-select/select/selectUI.js +12 -2
- package/dist/web/components/wd-table/components/ExportFileModalByApi/index.js +3 -2
- package/dist/web/components/wd-table/components/Table/index.js +9 -14
- package/dist/web/components/wd-table/hooks/useTableData.js +8 -3
- package/dist/web/components/wd-table/utils/index.d.ts +1 -0
- package/dist/web/components/wd-table/utils/index.js +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ export namespace propTypes {
|
|
|
8
8
|
const APIKEY: PropTypes.Requireable<string>;
|
|
9
9
|
const showLngLat: PropTypes.Requireable<boolean>;
|
|
10
10
|
const showMap: PropTypes.Requireable<boolean>;
|
|
11
|
-
const
|
|
11
|
+
const defaultShowLocation: PropTypes.Requireable<boolean>;
|
|
12
12
|
const drag: PropTypes.Requireable<boolean>;
|
|
13
13
|
const zoom: PropTypes.Requireable<boolean>;
|
|
14
14
|
const disabled: PropTypes.Requireable<boolean>;
|
|
@@ -31,8 +31,8 @@ export namespace defaultProps {
|
|
|
31
31
|
export { showLngLat_1 as showLngLat };
|
|
32
32
|
const showMap_1: boolean;
|
|
33
33
|
export { showMap_1 as showMap };
|
|
34
|
-
const
|
|
35
|
-
export {
|
|
34
|
+
const defaultShowLocation_1: boolean;
|
|
35
|
+
export { defaultShowLocation_1 as defaultShowLocation };
|
|
36
36
|
const drag_1: boolean;
|
|
37
37
|
export { drag_1 as drag };
|
|
38
38
|
const zoom_1: boolean;
|
|
@@ -11,7 +11,7 @@ export const propTypes = {
|
|
|
11
11
|
APIKEY: PropTypes.string,
|
|
12
12
|
showLngLat: PropTypes.bool,
|
|
13
13
|
showMap: PropTypes.bool,
|
|
14
|
-
|
|
14
|
+
defaultShowLocation: PropTypes.bool,
|
|
15
15
|
drag: PropTypes.bool,
|
|
16
16
|
zoom: PropTypes.bool,
|
|
17
17
|
disabled: PropTypes.bool,
|
|
@@ -30,7 +30,7 @@ export const defaultProps = {
|
|
|
30
30
|
APIKEY: '',
|
|
31
31
|
showLngLat: false,
|
|
32
32
|
showMap: false,
|
|
33
|
-
|
|
33
|
+
defaultShowLocation: false,
|
|
34
34
|
drag: true,
|
|
35
35
|
zoom: true,
|
|
36
36
|
disabled: false,
|
|
@@ -52,33 +52,24 @@ export default function LocationH5(props) {
|
|
|
52
52
|
const currentLocations = useRef();
|
|
53
53
|
const customLocation = useRef();
|
|
54
54
|
useEffect(() => {
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
if (locationType !== 3) {
|
|
56
|
+
// 默认位置选择无时【locationType=1】
|
|
57
|
+
let location = {
|
|
58
|
+
latlng: {
|
|
59
|
+
lat: 39.98410411,
|
|
60
|
+
lng: 116.307503,
|
|
61
|
+
},
|
|
62
|
+
poiname: '',
|
|
63
|
+
detailedAddress: '',
|
|
64
|
+
locationType,
|
|
65
|
+
};
|
|
66
|
+
// 默认位置选择当前用户位置时【locationType=2】
|
|
67
|
+
if (locationType === 2 && currentLocations.current) {
|
|
68
|
+
location = currentLocations.current;
|
|
69
|
+
}
|
|
70
|
+
setLocation(location);
|
|
71
|
+
setUserSelectStatus((location === null || location === void 0 ? void 0 : location.detailedAddress) ? 'selected' : '');
|
|
67
72
|
}
|
|
68
|
-
setLocation(location);
|
|
69
|
-
}, [value, locationType]);
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
let loc = {
|
|
72
|
-
latlng: {
|
|
73
|
-
lat: 39.98410411,
|
|
74
|
-
lng: 116.307503,
|
|
75
|
-
},
|
|
76
|
-
poiname: '',
|
|
77
|
-
detailedAddress: '',
|
|
78
|
-
locationType,
|
|
79
|
-
};
|
|
80
|
-
setLocation(loc);
|
|
81
|
-
// 暂不支持自定位置,初始化表单值都是{}
|
|
82
73
|
}, [locationType]);
|
|
83
74
|
useEffect(() => {
|
|
84
75
|
if (checkCustomLocation(value)) {
|
|
@@ -91,8 +82,26 @@ export default function LocationH5(props) {
|
|
|
91
82
|
latlng: { lng: coordinates[0], lat: coordinates[1] },
|
|
92
83
|
};
|
|
93
84
|
customLocation.current = value;
|
|
94
|
-
setUserSelectStatus('selected');
|
|
95
85
|
setLocation(loc);
|
|
86
|
+
setUserSelectStatus('selected');
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
// 默认位置选择无时【locationType=1】
|
|
90
|
+
let location = {
|
|
91
|
+
latlng: {
|
|
92
|
+
lat: 39.98410411,
|
|
93
|
+
lng: 116.307503,
|
|
94
|
+
},
|
|
95
|
+
poiname: '',
|
|
96
|
+
detailedAddress: '',
|
|
97
|
+
locationType,
|
|
98
|
+
};
|
|
99
|
+
// 默认位置选择当前用户位置时【locationType=2】
|
|
100
|
+
if (locationType === 2 && currentLocations.current) {
|
|
101
|
+
location = currentLocations.current;
|
|
102
|
+
}
|
|
103
|
+
setLocation(location);
|
|
104
|
+
setUserSelectStatus((location === null || location === void 0 ? void 0 : location.poiname) ? 'selected' : '');
|
|
96
105
|
}
|
|
97
106
|
}, [value]);
|
|
98
107
|
// 获取定位信息
|
|
@@ -13,10 +13,10 @@ const Header = ({ onClick, isEdit, info, disabled, showLngLat, locationType, dat
|
|
|
13
13
|
if (locationType === 1 && info.locationType === 1) {
|
|
14
14
|
status = false;
|
|
15
15
|
}
|
|
16
|
-
else if (locationType
|
|
16
|
+
else if ([2, 3].includes(locationType) && !dataSourceStatus) {
|
|
17
17
|
status = false;
|
|
18
18
|
}
|
|
19
|
-
else if (locationType
|
|
19
|
+
else if ([2, 3].includes(locationType) && !apiKeyStatus.status) {
|
|
20
20
|
status = false;
|
|
21
21
|
}
|
|
22
22
|
else if (!currentLocStatus) {
|
|
@@ -56,6 +56,26 @@ export default function LocationPC(props) {
|
|
|
56
56
|
dataSourceStatus,
|
|
57
57
|
eventsChange,
|
|
58
58
|
});
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (locationType !== 3) {
|
|
61
|
+
// 默认位置选择无时【locationType=1】
|
|
62
|
+
let location = {
|
|
63
|
+
latlng: {
|
|
64
|
+
lat: 39.98410411,
|
|
65
|
+
lng: 116.307503,
|
|
66
|
+
},
|
|
67
|
+
poiname: '',
|
|
68
|
+
detailedAddress: '',
|
|
69
|
+
locationType,
|
|
70
|
+
};
|
|
71
|
+
// 默认位置选择当前用户位置时【locationType=2】
|
|
72
|
+
if (locationType === 2 && currentLocations.current) {
|
|
73
|
+
location = currentLocations.current;
|
|
74
|
+
}
|
|
75
|
+
setLocation(location);
|
|
76
|
+
setUserSelectStatus((location === null || location === void 0 ? void 0 : location.detailedAddress) ? 'selected' : '');
|
|
77
|
+
}
|
|
78
|
+
}, [locationType]);
|
|
59
79
|
useEffect(() => {
|
|
60
80
|
if (checkCustomLocation(value)) {
|
|
61
81
|
// 表单为新增时回传点位信息
|
|
@@ -70,23 +90,25 @@ export default function LocationPC(props) {
|
|
|
70
90
|
setLocation(loc);
|
|
71
91
|
setUserSelectStatus('selected');
|
|
72
92
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
93
|
+
else {
|
|
94
|
+
// 默认位置选择无时【locationType=1】
|
|
95
|
+
let location = {
|
|
96
|
+
latlng: {
|
|
97
|
+
lat: 39.98410411,
|
|
98
|
+
lng: 116.307503,
|
|
99
|
+
},
|
|
100
|
+
poiname: '',
|
|
101
|
+
detailedAddress: '',
|
|
102
|
+
locationType,
|
|
103
|
+
};
|
|
104
|
+
// 默认位置选择当前用户位置时【locationType=2】
|
|
105
|
+
if (locationType === 2 && currentLocations.current) {
|
|
106
|
+
location = currentLocations.current;
|
|
107
|
+
}
|
|
108
|
+
setLocation(location);
|
|
109
|
+
setUserSelectStatus((location === null || location === void 0 ? void 0 : location.poiname) ? 'selected' : '');
|
|
87
110
|
}
|
|
88
|
-
|
|
89
|
-
}, [value, locationType]);
|
|
111
|
+
}, [value]);
|
|
90
112
|
const showToast = (message) => {
|
|
91
113
|
weui.toast(message, {
|
|
92
114
|
duration: 3000,
|
|
@@ -156,31 +178,6 @@ export default function LocationPC(props) {
|
|
|
156
178
|
});
|
|
157
179
|
}
|
|
158
180
|
}, [dataSource]);
|
|
159
|
-
useEffect(() => {
|
|
160
|
-
let loc = {
|
|
161
|
-
latlng: {
|
|
162
|
-
lat: 39.98410411,
|
|
163
|
-
lng: 116.307503,
|
|
164
|
-
},
|
|
165
|
-
poiname: '',
|
|
166
|
-
detailedAddress: '',
|
|
167
|
-
locationType,
|
|
168
|
-
};
|
|
169
|
-
switch (locationType) {
|
|
170
|
-
case 2:
|
|
171
|
-
loc = {
|
|
172
|
-
latlng: {
|
|
173
|
-
lat: location.latlng.lat,
|
|
174
|
-
lng: location.latlng.lng,
|
|
175
|
-
},
|
|
176
|
-
poiname: location.poiname,
|
|
177
|
-
detailedAddress: location.detailedAddress,
|
|
178
|
-
};
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
setLocation(loc);
|
|
182
|
-
// 暂不支持自定位置,初始化表单值都是{}
|
|
183
|
-
}, [locationType]);
|
|
184
181
|
const getIsShowMap = () => {
|
|
185
182
|
let status = showMap;
|
|
186
183
|
if (locationType === 1 && location.locationType === 1) {
|
|
@@ -30,7 +30,7 @@ declare const FormLocation: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
|
30
30
|
customRange: number;
|
|
31
31
|
requiredFlag: boolean;
|
|
32
32
|
requiredMsg: string;
|
|
33
|
-
|
|
33
|
+
defaultShowLocation: boolean;
|
|
34
34
|
dataSource: Record<string, unknown>;
|
|
35
35
|
} & {
|
|
36
36
|
onChange: (v: DataType['value']) => void;
|
|
@@ -5,10 +5,10 @@ import Location from '../form/location';
|
|
|
5
5
|
import Tips from '../form/tips';
|
|
6
6
|
import { useFormInputTrait } from '../form-input-hooks';
|
|
7
7
|
const FormLocation = React.forwardRef(function FormLocation(props, inputRef) {
|
|
8
|
-
const { className, id, style, events, required, requiredFlag, label, labelVisible, customRange, dataSource,
|
|
8
|
+
const { className, id, style, events, required, requiredFlag, label, labelVisible, customRange, dataSource, defaultShowLocation, locationRange, locationType, showLngLat, showMap, zoom, drag,
|
|
9
9
|
// @ts-expect-error 里面有,但dataForm没有,但json有传
|
|
10
10
|
customLocation, ...restProps } = props;
|
|
11
|
-
const { value, name, onChange, disabled, layout, readOnly, validateErrorMsg, validateState, visible
|
|
11
|
+
const { value, name, onChange, disabled, layout, readOnly, validateErrorMsg, validateState, visible } = useFormInputTrait({
|
|
12
12
|
name: restProps.name,
|
|
13
13
|
inputRef,
|
|
14
14
|
required,
|
|
@@ -18,6 +18,6 @@ const FormLocation = React.forwardRef(function FormLocation(props, inputRef) {
|
|
|
18
18
|
if (!visible) {
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
return (_jsxs(FormItemWrapper, { children: [_jsx(Location, { id: id, style: style, className: className, events: events, name: name, disabled: disabled, label: label, labelVisible: labelVisible, layout: layout, requiredFlag: required && requiredFlag, value: value, customLocation: customLocation, customRange: customRange, dataSource: dataSource,
|
|
21
|
+
return (_jsxs(FormItemWrapper, { children: [_jsx(Location, { id: id, style: style, className: className, events: events, name: name, disabled: disabled, label: label, labelVisible: labelVisible, layout: layout, requiredFlag: required && requiredFlag, value: value, customLocation: customLocation, customRange: customRange, dataSource: dataSource, defaultShowLocation: defaultShowLocation, drag: drag, locationType: locationType, locationRange: locationRange, showLngLat: showLngLat, showMap: showMap, zoom: zoom, onChange: onChange, readOnly: readOnly }), (validateState === 'error' || validateState === 'warn') && _jsx(Tips, { tips: validateErrorMsg, type: "warn" })] }));
|
|
22
22
|
});
|
|
23
23
|
export default FormLocation;
|
|
@@ -6,7 +6,7 @@ export type FormRichTextProps = CommonPropsType & DataType & {
|
|
|
6
6
|
disabled: boolean;
|
|
7
7
|
readOnly: boolean;
|
|
8
8
|
} & EventsType;
|
|
9
|
-
declare const
|
|
9
|
+
declare const FormRichText: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
10
10
|
name: string;
|
|
11
11
|
title: string;
|
|
12
12
|
value: string;
|
|
@@ -28,4 +28,4 @@ declare const FromRichText: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
|
28
28
|
change: (eventDetail: unknown, ...args: unknown[]) => unknown;
|
|
29
29
|
};
|
|
30
30
|
} & React.RefAttributes<unknown>>;
|
|
31
|
-
export default
|
|
31
|
+
export default FormRichText;
|
|
@@ -4,7 +4,7 @@ import { useFormInputTrait } from '../form-input-hooks';
|
|
|
4
4
|
import Tips from '../form/tips';
|
|
5
5
|
import RichText from '../richText';
|
|
6
6
|
import { FormItemWrapper } from '../common/form-item-wrapper';
|
|
7
|
-
const
|
|
7
|
+
const FormRichText = React.forwardRef(function FormRichText(props, inputRef) {
|
|
8
8
|
const { className, id, style, events, title, titleVisible, maxSize, acceptTypes, required, requiredFlag, ...restProps } = props;
|
|
9
9
|
const { value, name, disabled, layout, validateErrorMsg, validateState, readOnly, visible } = useFormInputTrait({
|
|
10
10
|
name: restProps.name,
|
|
@@ -22,4 +22,4 @@ const FromRichText = React.forwardRef(function FormRichText(props, inputRef) {
|
|
|
22
22
|
}
|
|
23
23
|
return (_jsxs(FormItemWrapper, { children: [_jsx(RichText, { id: id, style: style, className: className, events: events, onChange: onChange, acceptTypes: acceptTypes, label: title, labelVisible: titleVisible, disabled: disabled, layout: layout, maxSize: maxSize, name: name, readOnly: readOnly, requiredFlag: required && requiredFlag, value: value }), (validateState === 'error' || validateState === 'warn') && _jsx(Tips, { tips: validateErrorMsg, type: "warn" })] }));
|
|
24
24
|
});
|
|
25
|
-
export default
|
|
25
|
+
export default FormRichText;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, forwardRef, useImperativeHandle, useCallback
|
|
2
|
+
import { useMemo, forwardRef, useImperativeHandle, useCallback } from 'react';
|
|
3
3
|
import { usePlatform } from '../../utils/platform';
|
|
4
4
|
import { setRefProp } from '../../utils/tool';
|
|
5
5
|
import classNames from '../../utils/classnames';
|
|
@@ -12,7 +12,7 @@ import './style';
|
|
|
12
12
|
* 日历标准化
|
|
13
13
|
*/
|
|
14
14
|
export const WdClendar = forwardRef(function WdClendar(props, ref) {
|
|
15
|
-
const { initVisible = true, configData, events, id, className, style, } = props;
|
|
15
|
+
const { initVisible = true, configData, events, id, className, style, start = null, end = null } = props;
|
|
16
16
|
const valueStamp = useMemo(() => { var _a, _b; return (_b = (_a = getStartMoment('day', props.value)) === null || _a === void 0 ? void 0 : _a.valueOf()) !== null && _b !== void 0 ? _b : null; }, [props.value]);
|
|
17
17
|
const monthStamp = useMemo(() => { var _a, _b; return (_b = (_a = getStartMoment('month', props.initMonth)) === null || _a === void 0 ? void 0 : _a.valueOf()) !== null && _b !== void 0 ? _b : null; }, [props.initMonth]);
|
|
18
18
|
const [value, setValue] = useSyncValue(valueStamp);
|
|
@@ -23,7 +23,7 @@ export const WdClendar = forwardRef(function WdClendar(props, ref) {
|
|
|
23
23
|
const cls = classNames(blockName, 'weda-ui', `${blockName}-${platform}`, className);
|
|
24
24
|
const { year: monthYear, month: monthMonth } = yearMonthItem;
|
|
25
25
|
const configDataObj = useMemo(() => getConfigDataObj(configData), [configData]);
|
|
26
|
-
const weeks = useMemo(() => convertWeeks(monthYear, monthMonth, configDataObj), [monthYear, monthMonth, configDataObj]);
|
|
26
|
+
const weeks = useMemo(() => convertWeeks(monthYear, monthMonth, configDataObj, [start, end]), [monthYear, monthMonth, configDataObj, start, end]);
|
|
27
27
|
// 含转时间戳逻辑
|
|
28
28
|
const setValueMethod = useCallback((v) => {
|
|
29
29
|
var _a;
|
|
@@ -45,14 +45,7 @@ export const WdClendar = forwardRef(function WdClendar(props, ref) {
|
|
|
45
45
|
initMonth: monthValue,
|
|
46
46
|
initVisible,
|
|
47
47
|
value,
|
|
48
|
-
}), [
|
|
49
|
-
setValueMethod,
|
|
50
|
-
setInitMonthMethod,
|
|
51
|
-
configData,
|
|
52
|
-
monthValue,
|
|
53
|
-
initVisible,
|
|
54
|
-
value,
|
|
55
|
-
]);
|
|
48
|
+
}), [setValueMethod, setInitMonthMethod, configData, monthValue, initVisible, value]);
|
|
56
49
|
// 选中日期
|
|
57
50
|
const handleChange = (item) => {
|
|
58
51
|
var _a, _b;
|
|
@@ -9,7 +9,7 @@ interface IconfigDataObj {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const blockName = "weda-calendar";
|
|
11
11
|
export declare const getConfigDataObj: (configData?: IconfigData[]) => IconfigDataObj;
|
|
12
|
-
export declare const convertWeeks: (year: any, month: any, configDataObj?: IconfigDataObj) => import("../../utils/hooks/useFormLegacy").IWeekItem[][] | {
|
|
12
|
+
export declare const convertWeeks: (year: any, month: any, configDataObj?: IconfigDataObj, range?: any[]) => import("../../utils/hooks/useFormLegacy").IWeekItem[][] | {
|
|
13
13
|
matchDate?: string;
|
|
14
14
|
disabled?: string | boolean;
|
|
15
15
|
marked?: string | boolean;
|
|
@@ -17,8 +17,8 @@ export const getConfigDataObj = (configData) => {
|
|
|
17
17
|
return obj;
|
|
18
18
|
};
|
|
19
19
|
// 年月转星期
|
|
20
|
-
export const convertWeeks = (year, month, configDataObj) => {
|
|
21
|
-
const weeks = convertYearMonthToWeeks(year, month,
|
|
20
|
+
export const convertWeeks = (year, month, configDataObj, range) => {
|
|
21
|
+
const weeks = convertYearMonthToWeeks(year, month, range, {
|
|
22
22
|
isPreNext: true,
|
|
23
23
|
isDynamic: true,
|
|
24
24
|
});
|
|
@@ -40,35 +40,3 @@ export function getErrorObjectFromValidateResult(errObj) {
|
|
|
40
40
|
return acc;
|
|
41
41
|
}, {});
|
|
42
42
|
}
|
|
43
|
-
export function removeUnusedPaths(data, formItemMapList) {
|
|
44
|
-
// 1. 将路径列表转为Set提高查询效率
|
|
45
|
-
const validPaths = new Set(formItemMapList);
|
|
46
|
-
// 2. 递归清理函数
|
|
47
|
-
function clean(obj, currentPath = '') {
|
|
48
|
-
var _a;
|
|
49
|
-
// 处理数组空项(可选)
|
|
50
|
-
if (Array.isArray(obj) && obj.length) {
|
|
51
|
-
obj.forEach((item, index) => {
|
|
52
|
-
if (typeof item === 'object' && item !== null) {
|
|
53
|
-
const path = `${currentPath}[${index}]`;
|
|
54
|
-
clean(item, path); // 递归处理嵌套对象
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
else if (typeof obj === 'object' && obj !== null) {
|
|
59
|
-
(_a = Object.keys(obj)) === null || _a === void 0 ? void 0 : _a.forEach((key) => {
|
|
60
|
-
const path = currentPath ? `${currentPath}.${key}` : key;
|
|
61
|
-
if (!validPaths.has(path)) {
|
|
62
|
-
delete obj[key]; // 删除无效属性
|
|
63
|
-
}
|
|
64
|
-
else if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
65
|
-
clean(obj[key], path); // 递归处理嵌套对象
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return obj;
|
|
70
|
-
}
|
|
71
|
-
// 3. 执行清理并返回新对象(不修改原data)
|
|
72
|
-
const a = clean(JSON.parse(JSON.stringify(data)));
|
|
73
|
-
return a;
|
|
74
|
-
}
|
|
@@ -19,6 +19,7 @@ import { useDataSource } from '../../utils/hooks/useDataSource';
|
|
|
19
19
|
import { WdForm as FormUi } from './wd-form';
|
|
20
20
|
import EmptyContent from '../statusContent';
|
|
21
21
|
import { deepClone } from '../../utils/tool';
|
|
22
|
+
import isObjectEqual from '../../utils/isObjectEqual';
|
|
22
23
|
import '../style';
|
|
23
24
|
import { getErrorObjectFromValidateResult } from './form-utils';
|
|
24
25
|
import { isNil } from '../../utils/lodash';
|
|
@@ -346,7 +347,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
346
347
|
useSetWidgetApi(() => {
|
|
347
348
|
const r = {
|
|
348
349
|
formType,
|
|
349
|
-
addFormItem(name, formItem, { initialValue, namePath }) {
|
|
350
|
+
addFormItem(name, formItem, { initialValue, namePath } = {}) {
|
|
350
351
|
if (isNil(name) || (typeof name === 'string' && name.length === 0)) {
|
|
351
352
|
// name 没设置或为空串的时候不受表单容器控制
|
|
352
353
|
console.warn(`组件 #${formItem === null || formItem === void 0 ? void 0 : formItem.id} 表单key(表单输入类组件 name 属性)没设置或为空串的时候不受表单容器控制`);
|
|
@@ -394,8 +395,8 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
394
395
|
setValueDebounce(value);
|
|
395
396
|
}
|
|
396
397
|
else {
|
|
397
|
-
const
|
|
398
|
-
setValueDebounce({ ...
|
|
398
|
+
const _formData = deepClone(formData);
|
|
399
|
+
setValueDebounce({ ..._formData, ...value });
|
|
399
400
|
}
|
|
400
401
|
},
|
|
401
402
|
reset() {
|
|
@@ -452,8 +453,6 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
452
453
|
}, [
|
|
453
454
|
formType,
|
|
454
455
|
submitParams,
|
|
455
|
-
setValue,
|
|
456
|
-
setValueDebounce,
|
|
457
456
|
initialValues,
|
|
458
457
|
authValue,
|
|
459
458
|
layout,
|
|
@@ -472,6 +471,9 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
472
471
|
enableSubmit,
|
|
473
472
|
fieldInitValueCache,
|
|
474
473
|
formsItemMap,
|
|
474
|
+
setValueDebounce,
|
|
475
|
+
formData,
|
|
476
|
+
setValue,
|
|
475
477
|
validate,
|
|
476
478
|
eventsRef,
|
|
477
479
|
submit,
|
|
@@ -516,9 +518,17 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
516
518
|
}, [formFieldsValue]);
|
|
517
519
|
const setFieldValue = useCallback(({ namePath, value }) => {
|
|
518
520
|
const _formData = deepClone(formData);
|
|
521
|
+
const _value = lodashGet(_formData, namePath, NOT_EXISTED_VALUE);
|
|
522
|
+
if (isObjectEqual(_value, value)) {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
519
525
|
lodashSet(_formData, namePath, value);
|
|
520
|
-
|
|
521
|
-
|
|
526
|
+
if (typeof _formData !== 'object' || _formData === null) {
|
|
527
|
+
console.warn('setValue data need expect a object but got null', _formData);
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
setFormData(_formData);
|
|
531
|
+
}, [formData]);
|
|
522
532
|
if (initValueLoadingStatus === 'hidden') {
|
|
523
533
|
return null;
|
|
524
534
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
3
3
|
import { forwardRef, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useDeepCompareEffect } from '@react-hookz/web';
|
|
4
5
|
import { useConfig } from '../../utils/config-context';
|
|
5
6
|
import { WdFormItem } from '../wd-form-item';
|
|
6
7
|
import { usePlatform } from '../../utils/platform';
|
|
@@ -49,6 +50,13 @@ export const BaseFormObj = forwardRef(function BaseFormObj(props, ref) {
|
|
|
49
50
|
onChange: noop,
|
|
50
51
|
$node: props.$node,
|
|
51
52
|
});
|
|
53
|
+
const valueRef = useRef(props.value);
|
|
54
|
+
useDeepCompareEffect(() => {
|
|
55
|
+
if (isObjectEqual(valueRef.current, objValue)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
triggerOnDataChange(objValue);
|
|
59
|
+
}, [objValue]);
|
|
52
60
|
useEffect(() => {
|
|
53
61
|
setIsInformObjContainer(true);
|
|
54
62
|
}, []);
|
|
@@ -68,6 +76,7 @@ export const BaseFormObj = forwardRef(function BaseFormObj(props, ref) {
|
|
|
68
76
|
*/
|
|
69
77
|
const triggerOnDataChange = useDebouncedCallback(useCallback((value) => {
|
|
70
78
|
var _a, _b;
|
|
79
|
+
valueRef.current = value;
|
|
71
80
|
(_b = (_a = props.events) === null || _a === void 0 ? void 0 : _a.onDataChange) === null || _b === void 0 ? void 0 : _b.call(_a, { data: value });
|
|
72
81
|
}, [props.events]), 500);
|
|
73
82
|
const dealArrChange = useCallback((params, objValue) => {
|
|
@@ -244,7 +244,7 @@ export const WdInputNumber = forwardRef(function WdInputNumber(props, ref) {
|
|
|
244
244
|
}
|
|
245
245
|
initValidate(validState, validMsg);
|
|
246
246
|
}, [showValue, props.min, props.max, max, min, initValidate, validMsgObj.max, validMsgObj.min]);
|
|
247
|
-
const valueRef = useRef(
|
|
247
|
+
const valueRef = useRef(null);
|
|
248
248
|
const [focus, setFocus] = useSyncValue(props.focus);
|
|
249
249
|
const hasClearIcon = getHasClearIcon(clearable, focus, disabled, readOnly, realValue);
|
|
250
250
|
const isRow = props.stepOption === 'both'; // 右侧调整只在pc端生效
|
|
@@ -320,24 +320,12 @@ export const WdInputNumber = forwardRef(function WdInputNumber(props, ref) {
|
|
|
320
320
|
/**
|
|
321
321
|
* 监听非输入引起的value变化,比如调用 setValue, clearValue
|
|
322
322
|
*/
|
|
323
|
-
|
|
324
|
-
if (valueRef.current
|
|
325
|
-
setIsInit(false);
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
if (!isInit) {
|
|
323
|
+
useEffect(() => {
|
|
324
|
+
if (valueRef.current !== value) {
|
|
329
325
|
setRealValue(value);
|
|
330
326
|
setShowValue(getShowValue(`${value}`, props.format));
|
|
331
327
|
valueRef.current = value;
|
|
332
328
|
}
|
|
333
|
-
// 初始化时同步真实值到表单
|
|
334
|
-
if (isNumber(realValue) && isInit) {
|
|
335
|
-
changeForm(realValue);
|
|
336
|
-
}
|
|
337
|
-
setIsInit(false);
|
|
338
|
-
};
|
|
339
|
-
useEffect(() => {
|
|
340
|
-
updateValueByListen();
|
|
341
329
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
342
330
|
}, [value]);
|
|
343
331
|
/**
|
|
@@ -13,7 +13,7 @@ import './style';
|
|
|
13
13
|
* 地图-标准化
|
|
14
14
|
*/
|
|
15
15
|
export const WdLocation = forwardRef(function WdLocation(props, ref) {
|
|
16
|
-
const { classRoot = 'location', clearable = X_RUNTIME_DEFAULT.clearable, placeholder = '选择地理位置', customLocation, customRange = X_RUNTIME_DEFAULT.customRange, dataSource = X_RUNTIME_DEFAULT._dataSourceInLocation,
|
|
16
|
+
const { classRoot = 'location', clearable = X_RUNTIME_DEFAULT.clearable, placeholder = '选择地理位置', customLocation, customRange = X_RUNTIME_DEFAULT.customRange, dataSource = X_RUNTIME_DEFAULT._dataSourceInLocation, defaultShowLocation, drag = X_RUNTIME_DEFAULT.drag, locationType = X_RUNTIME_DEFAULT.locationType, locationRange = X_RUNTIME_DEFAULT.locationRange, showLngLat = X_RUNTIME_DEFAULT.showLngLat, showMap = X_RUNTIME_DEFAULT.showMap, zoom = X_RUNTIME_DEFAULT.zoom, events = emptyObject, id, } = props;
|
|
17
17
|
const traitProps = { ...props, inputRef: ref };
|
|
18
18
|
const trait = useFormInputTrait(traitProps);
|
|
19
19
|
const { value, onChange, disabled, readOnly, visible } = trait;
|
|
@@ -48,5 +48,5 @@ export const WdLocation = forwardRef(function WdLocation(props, ref) {
|
|
|
48
48
|
const inputWrapProps = { ...props, classRoot, disabled, ...clearProps };
|
|
49
49
|
if (!visible)
|
|
50
50
|
return null;
|
|
51
|
-
return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(RecycleProvider, { recycleBack: setIsInit, children: _jsx(Location, { events: events, labelVisible: false, placeholder: placeholder, value: value, customLocation: customLocation, customRange: customRange, dataSource: dataSource,
|
|
51
|
+
return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(RecycleProvider, { recycleBack: setIsInit, children: _jsx(Location, { events: events, labelVisible: false, placeholder: placeholder, value: value, customLocation: customLocation, customRange: customRange, dataSource: dataSource, defaultShowLocation: defaultShowLocation, drag: drag, locationType: locationType, locationRange: locationRange, showLngLat: showLngLat, showMap: showMap, zoom: zoom, readOnly: readOnly, disabled: disabled, decorator: null, onChange: onChange, id: id }) }) }) }) }));
|
|
52
52
|
});
|
|
@@ -148,9 +148,19 @@ export function SelectUI(props) {
|
|
|
148
148
|
}
|
|
149
149
|
}, [currentOption, setAllOption]);
|
|
150
150
|
const isMultiple = mode === 'multiple';
|
|
151
|
+
const [selectedItem, setSelectedItem] = useState([]);
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
// 缓存展示的选中项
|
|
154
|
+
setSelectedItem((selectItem) => {
|
|
155
|
+
const newSelectItem = getSelectedItem(options, value);
|
|
156
|
+
if (value !== null && value !== undefined) {
|
|
157
|
+
return (newSelectItem === null || newSelectItem === void 0 ? void 0 : newSelectItem.length) ? newSelectItem : selectItem;
|
|
158
|
+
}
|
|
159
|
+
return newSelectItem;
|
|
160
|
+
});
|
|
161
|
+
}, [options, value]);
|
|
151
162
|
const readValue = useMemo(() => {
|
|
152
163
|
var _a, _b;
|
|
153
|
-
const selectedItem = getSelectedItem(options, value);
|
|
154
164
|
if (isMultiple) {
|
|
155
165
|
return selectedItem
|
|
156
166
|
.map((i) => textToString(i === null || i === void 0 ? void 0 : i.label) || textToString(i.value) || textToString(value))
|
|
@@ -159,7 +169,7 @@ export function SelectUI(props) {
|
|
|
159
169
|
else {
|
|
160
170
|
return textToString((_a = selectedItem[0]) === null || _a === void 0 ? void 0 : _a.label) || textToString((_b = selectedItem[0]) === null || _b === void 0 ? void 0 : _b.value) || textToString(value);
|
|
161
171
|
}
|
|
162
|
-
}, [isMultiple,
|
|
172
|
+
}, [isMultiple, selectedItem, value]);
|
|
163
173
|
const render = () => {
|
|
164
174
|
if (platform === 'h5') {
|
|
165
175
|
return _jsx(SelectH5, { ...props, readValue: readValue, searchPlaceholder: searchPlaceholder });
|
|
@@ -18,7 +18,8 @@ export const ExportFileModal = ({ fields, columns, isExportFileModalByApiVisible
|
|
|
18
18
|
(field === null || field === void 0 ? void 0 : field.format) !== 'many-many' &&
|
|
19
19
|
(field === null || field === void 0 ? void 0 : field.format) !== 'many-one' &&
|
|
20
20
|
(field === null || field === void 0 ? void 0 : field.format) !== 'one-many' &&
|
|
21
|
-
(field === null || field === void 0 ? void 0 : field.format) !== 'one-one'
|
|
21
|
+
(field === null || field === void 0 ? void 0 : field.format) !== 'one-one' &&
|
|
22
|
+
(field === null || field === void 0 ? void 0 : field.format) !== 'one-one-r') {
|
|
22
23
|
supportFields.push(field);
|
|
23
24
|
}
|
|
24
25
|
});
|
|
@@ -36,7 +37,7 @@ export const ExportFileModal = ({ fields, columns, isExportFileModalByApiVisible
|
|
|
36
37
|
.filter((el) => {
|
|
37
38
|
const field = fields.find((i) => (i === null || i === void 0 ? void 0 : i.name) === (el === null || el === void 0 ? void 0 : el.key) && el.isRelated);
|
|
38
39
|
const format = field === null || field === void 0 ? void 0 : field.format;
|
|
39
|
-
return el.isRelated && el.isExport && format !== 'many-many' && format !== 'one-many';
|
|
40
|
+
return el.isRelated && el.isExport && format !== 'many-many' && format !== 'one-many' && format !== 'one-one-r';
|
|
40
41
|
})
|
|
41
42
|
.map((item) => {
|
|
42
43
|
return {
|