@cloudbase/weda-ui 3.4.11-alpha.1 → 3.4.12
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/common/form-input-required.js +3 -3
- package/dist/configs/components/dataView.js +20 -10
- package/dist/configs/components/form-checkbox.js +15 -2
- package/dist/configs/components/form-email.js +17 -2
- package/dist/configs/components/form-input.js +17 -2
- package/dist/configs/components/form-phone.js +17 -2
- package/dist/configs/components/form-radio.js +15 -2
- package/dist/configs/components/form-select-multiple.js +362 -0
- package/dist/configs/components/form-switch.js +15 -2
- package/dist/configs/components/form-text-area.js +15 -2
- package/dist/configs/components/form-url.js +17 -2
- package/dist/configs/components/listView.js +32 -49
- package/dist/configs/components/table.json +1 -54
- package/dist/configs/components/wd-bubble.js +46 -8
- package/dist/configs/components/wd-checkbox.js +464 -0
- package/dist/configs/components/wd-form.js +66 -10
- package/dist/configs/components/wd-input-email.js +37 -0
- package/dist/configs/components/wd-input-phone.js +43 -0
- package/dist/configs/components/wd-input-url.js +37 -0
- package/dist/configs/components/wd-input.js +94 -0
- package/dist/configs/components/wd-official-account.js +87 -0
- package/dist/configs/components/wd-radio.js +443 -0
- package/dist/configs/components/wd-switch.js +315 -0
- package/dist/configs/components/wd-table.js +1 -54
- package/dist/configs/components/wd-textarea.js +82 -0
- package/dist/configs/components/wd-tree.js +443 -0
- package/dist/configs/index.js +24 -1
- package/dist/configs/type-utils/type-form.js +681 -0
- package/dist/docs/common/components/methods-view.js +1 -1
- package/dist/docs/common/components/properties-view.js +3 -1
- package/dist/docs/common/format.js +7 -7
- package/dist/docs/common/tableView.js +3 -1
- package/dist/enum/index.js +196 -0
- package/dist/style/index.scss +1 -1
- package/dist/web/components/calendar/index.js +1 -1
- package/dist/web/components/customer-service/customer-service.js +19 -2
- package/dist/web/components/dataView/index.js +16 -3
- package/dist/web/components/flow/common/hooks/useCommonFlowData/flow-get.js +5 -1
- package/dist/web/components/flow/common/request.js +5 -5
- package/dist/web/components/flow/modules/operations/controls-items/flow-task-info-modal.js +8 -16
- package/dist/web/components/form/enumSelect/MultipleSelect.js +1 -0
- package/dist/web/components/form/enumSelect/SelectContainer.js +1 -0
- package/dist/web/components/form/formcell/index.css +13 -1
- package/dist/web/components/form/formcell/index.js +1 -1
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +1 -1
- package/dist/web/components/form/location/components/LocationPC/Header.js +1 -0
- package/dist/web/components/form/location/index.js +1 -0
- package/dist/web/components/form/select/h5.js +8 -7
- package/dist/web/components/form/select/index.js +9 -9
- package/dist/web/components/form/select/region/index.js +1 -1
- package/dist/web/components/form/selectMultiple/dropdown-select/h5.js +111 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/index.css +270 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/index.js +206 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/pc.js +115 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/ui.js +113 -0
- package/dist/web/components/form/selectMultiple/h5.js +40 -0
- package/dist/web/components/form/selectMultiple/index.js +94 -0
- package/dist/web/components/form/selectMultiple/request.js +76 -0
- package/dist/web/components/form/selectMultiple/status/allEmpty.js +5 -0
- package/dist/web/components/form/selectMultiple/status/empty.js +19 -0
- package/dist/web/components/form/selectMultiple/status/index.css +63 -0
- package/dist/web/components/form/selectMultiple/status/index.js +7 -0
- package/dist/web/components/form/selectMultiple/status/loading.js +19 -0
- package/dist/web/components/form/selectMultiple/status/propsType.js +1 -0
- package/dist/web/components/form/selectMultiple/status/retry.js +19 -0
- package/dist/web/components/form/tips/index.css +9 -3
- package/dist/web/components/form/uploader/index.css +10 -0
- package/dist/web/components/form/uploader/uploader.h5.js +6 -6
- package/dist/web/components/form/uploader/uploader.pc.js +1 -1
- package/dist/web/components/form/uploaderFile/index.js +2 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +0 -19
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +3 -24
- package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +7 -4
- package/dist/web/components/form/userOrgSelect/common/utils.js +1 -0
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +15 -5
- package/dist/web/components/form-input-hooks/index.js +39 -14
- package/dist/web/components/form-select-multiple/index.js +26 -0
- package/dist/web/components/formdetail/index.css +31 -1
- package/dist/web/components/formdetail/index.js +30 -0
- package/dist/web/components/index.js +17 -1
- package/dist/web/components/listView/index.js +20 -5
- package/dist/web/components/phone/index.js +26 -1
- package/dist/web/components/phoneCode/index.js +3 -1
- package/dist/web/components/repeater/index.js +1 -0
- package/dist/web/components/repeater-item/index.js +1 -0
- package/dist/web/components/richText/index.css +70 -67
- package/dist/web/components/richText/index.js +311 -251
- package/dist/web/components/richText/richtext.module.css +1 -0
- package/dist/web/components/richTextView/index.css +39 -0
- package/dist/web/components/richTextView/index.js +1 -1
- package/dist/web/components/share/index.js +26 -1
- package/dist/web/components/statusContent/index.js +1 -0
- package/dist/web/components/wd-checkbox/checkbox.js +34 -0
- package/dist/web/components/wd-checkbox/index.js +3 -0
- package/dist/web/components/wd-checkbox-list/checkboxList.js +140 -0
- package/dist/web/components/wd-checkbox-list/index.js +3 -0
- package/dist/web/components/wd-form/index.js +25 -12
- package/dist/web/components/wd-form/wd-form.js +42 -0
- package/dist/web/components/wd-form-cell/index.js +3 -0
- package/dist/web/components/wd-form-cell/wd-form-cell.js +42 -0
- package/dist/web/components/wd-form-item/index.js +4 -0
- package/dist/web/components/wd-form-item/wd-form-item.js +55 -0
- package/dist/web/components/wd-form-item/wd-input-group.js +24 -0
- package/dist/web/components/wd-input/index.js +3 -0
- package/dist/web/components/wd-input/wd-input.js +155 -0
- package/dist/web/components/wd-input-email/index.js +3 -0
- package/dist/web/components/wd-input-email/wd-input-email.js +13 -0
- package/dist/web/components/wd-input-group/index.js +3 -0
- package/dist/web/components/wd-input-group/wd-input-group.js +10 -0
- package/dist/web/components/wd-input-phone/index.js +3 -0
- package/dist/web/components/wd-input-phone/wd-input-phone.js +14 -0
- package/dist/web/components/wd-input-url/index.js +3 -0
- package/dist/web/components/wd-input-url/wd-input-url.js +13 -0
- package/dist/web/components/wd-input-wrap/index.js +3 -0
- package/dist/web/components/wd-input-wrap/wd-input-wrap.js +18 -0
- package/dist/web/components/wd-official-account/index.css +29 -0
- package/dist/web/components/wd-official-account/index.js +36 -0
- package/dist/web/components/wd-radio/index.js +3 -0
- package/dist/web/components/wd-radio/wd-radio.js +30 -0
- package/dist/web/components/wd-radio-list/index.js +3 -0
- package/dist/web/components/wd-radio-list/wd-radio-list.js +104 -0
- package/dist/web/components/wd-switch/index.js +3 -0
- package/dist/web/components/wd-switch/wd-switch.js +52 -0
- package/dist/web/components/wd-table/components/Table/index.js +12 -2
- package/dist/web/components/wd-table/hooks/useQueryParams.js +4 -1
- package/dist/web/components/wd-table/utils/index.js +6 -2
- package/dist/web/components/wd-table/wd-table.js +70 -57
- package/dist/web/components/wd-textarea/index.js +3 -0
- package/dist/web/components/wd-textarea/wd-textarea.js +78 -0
- package/dist/web/components/wd-tree/index.js +3 -0
- package/dist/web/components/wd-tree/utils.js +291 -0
- package/dist/web/components/wd-tree/wd-tree.js +193 -0
- package/dist/web/utils/constant.js +16 -0
- package/dist/web/utils/datasource.js +2 -2
- package/dist/web/utils/hooks/useFormLegacy.js +111 -0
- package/dist/web/utils/tool.js +12 -2
- package/dist/web/weda-ui.css +193 -3
- package/package.json +6 -5
- package/dist/web/components/emptyContent/index.js +0 -46
- package/dist/web/components/flow/components/FlowModuleText/Content.js +0 -6
- package/dist/web/components/flow/components/FlowModuleText/Title.js +0 -16
- package/dist/web/components/flow/components/FlowModuleText/index.js +0 -7
- package/dist/web/components/flow/components/FlowModuleText/utils.js +0 -34
- package/dist/web/components/flow/components/FlowStatusText/index.js +0 -37
- package/dist/web/components/flow/components/HighLightComment/index.js +0 -31
- package/dist/web/components/flow/components/index.js +0 -3
- package/dist/web/components/flow/constants/index.js +0 -65
- package/dist/web/components/flow/frame/getCommonFlowData.js +0 -80
- package/dist/web/components/flow/frame/hooks/index.js +0 -2
- package/dist/web/components/flow/frame/hooks/useCommonFlowRequest.js +0 -148
- package/dist/web/components/flow/frame/hooks/useElementMediaQuery.js +0 -15
- package/dist/web/components/flow/frame/index.js +0 -76
- package/dist/web/components/flow/frame/types.js +0 -277
- package/dist/web/components/flow/frame/utils.js +0 -149
- package/dist/web/components/flow/modules/chart/Chart.js +0 -282
- package/dist/web/components/flow/modules/chart/constants.js +0 -28
- package/dist/web/components/flow/modules/chart/index.css +0 -84
- package/dist/web/components/flow/modules/chart/isString.js +0 -5
- package/dist/web/components/flow/modules/chart/utils.js +0 -111
- package/dist/web/components/flow/modules/process/Process.js +0 -73
- package/dist/web/components/flow/modules/process/ProcessMobile.js +0 -81
- package/dist/web/components/flow/modules/process/index.js +0 -14
- package/dist/web/components/flow/modules/process/utils/index.js +0 -32
- package/dist/web/components/flow/services/flow.js +0 -111
- package/dist/web/components/flow/services/ideData/chart.js +0 -88
- package/dist/web/components/flow/services/ideData/index.js +0 -5
- package/dist/web/components/flow/services/ideData/instance.js +0 -23
- package/dist/web/components/flow/services/ideData/pageDetail.js +0 -42
- package/dist/web/components/flow/services/ideData/process.js +0 -27
- package/dist/web/components/flow/services/index.js +0 -2
- package/dist/web/components/flow/services/user.js +0 -23
- package/dist/web/components/flow/services/utils.js +0 -28
- package/dist/web/components/form/userOrgSelect/component/OrgPaths.js +0 -12
- package/dist/web/components/form/userOrgSelect/component/depart-select/departTreeSelect.h5.js +0 -156
|
@@ -57,7 +57,7 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
57
57
|
}
|
|
58
58
|
}, [defaultValue]);
|
|
59
59
|
React.useEffect(() => {
|
|
60
|
-
var _a;
|
|
60
|
+
var _a, _b;
|
|
61
61
|
if (isObjectEqual(fileRef.current, fileIDList))
|
|
62
62
|
return;
|
|
63
63
|
// 外部 onChange 事件
|
|
@@ -65,6 +65,8 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
65
65
|
const value = single ? pureFileIDList[0] || '' : pureFileIDList;
|
|
66
66
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
67
67
|
(_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
|
|
68
|
+
(_b = events === null || events === void 0 ? void 0 : events.success) === null || _b === void 0 ? void 0 : _b.call(events, { value: pureFileIDList });
|
|
69
|
+
fileRef.current = fileIDList;
|
|
68
70
|
}, [fileIDList]);
|
|
69
71
|
// 外层组件类
|
|
70
72
|
const cls = classNames({
|
|
@@ -73,11 +75,6 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
73
75
|
});
|
|
74
76
|
// 批量上传文件前置事件
|
|
75
77
|
const handleBefore = (file, fileList, isAccepted, error) => {
|
|
76
|
-
if (!((acceptTypes === null || acceptTypes === void 0 ? void 0 : acceptTypes.includes('*')) ||
|
|
77
|
-
(acceptTypes === null || acceptTypes === void 0 ? void 0 : acceptTypes.includes('')) ||
|
|
78
|
-
(acceptTypes === null || acceptTypes === void 0 ? void 0 : acceptTypes.length) === 0) &&
|
|
79
|
-
!islegalType(fileList, uploadProps['accept']))
|
|
80
|
-
return;
|
|
81
78
|
if (fileList.length + fileIDList.length > maxUploadCount) {
|
|
82
79
|
message.warning({ content: `上传文件总数不能超过${maxUploadCount}个` });
|
|
83
80
|
return false;
|
|
@@ -129,24 +126,6 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
129
126
|
(single && fileList.length > 0) ||
|
|
130
127
|
disabled);
|
|
131
128
|
}, [disabled, fileIDList.length, fileList, maxUploadCount, single]);
|
|
132
|
-
//验证上传文件类型是否合法
|
|
133
|
-
const islegalType = (files, accepts) => {
|
|
134
|
-
const illegalType = [];
|
|
135
|
-
for (const file of files) {
|
|
136
|
-
if (!accepts.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
137
|
-
illegalType.push(file === null || file === void 0 ? void 0 : file.type);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
if (illegalType.length > 0) {
|
|
141
|
-
message.error({
|
|
142
|
-
content: '不支持上传' +
|
|
143
|
-
Array.from(new Set(illegalType)).join(',') +
|
|
144
|
-
'格式文件',
|
|
145
|
-
});
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
return true;
|
|
149
|
-
};
|
|
150
129
|
return renderDecorator(_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(FileContext.Provider, { value: {
|
|
151
130
|
uploadPath,
|
|
152
131
|
downloadVisible,
|
|
@@ -26,12 +26,15 @@ export const getUserListByIds = async (porps) => {
|
|
|
26
26
|
* @returns
|
|
27
27
|
*/
|
|
28
28
|
export const errorHandle = (error, action) => {
|
|
29
|
-
var _a;
|
|
29
|
+
var _a, _b;
|
|
30
|
+
console.error(`接口 ${action} 出错: `, error);
|
|
30
31
|
if (error === null || error === void 0 ? void 0 : error.result) {
|
|
31
|
-
return
|
|
32
|
+
return (error === null || error === void 0 ? void 0 : error.requestId)
|
|
33
|
+
? `${(_a = error === null || error === void 0 ? void 0 : error.result) === null || _a === void 0 ? void 0 : _a.message}(${error === null || error === void 0 ? void 0 : error.requestId})`
|
|
34
|
+
: `${(_b = error === null || error === void 0 ? void 0 : error.result) === null || _b === void 0 ? void 0 : _b.message}`;
|
|
32
35
|
}
|
|
33
36
|
else {
|
|
34
|
-
return `${
|
|
37
|
+
return `${(error === null || error === void 0 ? void 0 : error.message) || error}`;
|
|
35
38
|
}
|
|
36
39
|
};
|
|
37
40
|
/**
|
|
@@ -54,7 +57,7 @@ export const fetchUserListByIds = async (selectUserIds = [], request) => {
|
|
|
54
57
|
UserType: 'internalUser',
|
|
55
58
|
NeedPrimaryColumn: true,
|
|
56
59
|
IsNoRelatedOrgFlag: false,
|
|
57
|
-
PageNo:
|
|
60
|
+
PageNo: 1,
|
|
58
61
|
PageSize: PAGE_SIZE,
|
|
59
62
|
}));
|
|
60
63
|
}
|
|
@@ -13,6 +13,7 @@ export const dealUserData = (data = []) => {
|
|
|
13
13
|
const mainDep = (user === null || user === void 0 ? void 0 : user.MainOrg) ? [].concat(user === null || user === void 0 ? void 0 : user.MainOrg) : (user === null || user === void 0 ? void 0 : user.Orgs) || [];
|
|
14
14
|
return {
|
|
15
15
|
id: user === null || user === void 0 ? void 0 : user.UserId,
|
|
16
|
+
name: user === null || user === void 0 ? void 0 : user.Name,
|
|
16
17
|
userName: name,
|
|
17
18
|
content: name,
|
|
18
19
|
userId: user === null || user === void 0 ? void 0 : user.UserId,
|
|
@@ -11,6 +11,7 @@ import { emptyArray, emptyObject } from '../../../../../utils/constant';
|
|
|
11
11
|
import { useViewData } from '../../hooks/use-views-data';
|
|
12
12
|
import { useDepartData } from '../../hooks/use-depart-data';
|
|
13
13
|
import { parseStrToArr } from '../../common/utils';
|
|
14
|
+
import { useDeepCompareEffect } from '@react-hookz/web';
|
|
14
15
|
export default function UserTreeSelect(props) {
|
|
15
16
|
const { events = emptyObject, defaultValue = emptyArray, confirmValue = '', defaultValueType = 'noneUser', onChange = null, multiple = false, request = defaultRequest, where, confirmAction, closeAction, secondDisplay, // 辅助信息
|
|
16
17
|
corpScope, // 展示企业范围
|
|
@@ -114,13 +115,12 @@ export default function UserTreeSelect(props) {
|
|
|
114
115
|
catch (e) { }
|
|
115
116
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
116
117
|
}, [defaultValueType, selectUserIds]);
|
|
117
|
-
|
|
118
|
+
useDeepCompareEffect(() => {
|
|
118
119
|
var _a;
|
|
119
120
|
setSelectedUserList(confirmUserList);
|
|
120
121
|
onChange === null || onChange === void 0 ? void 0 : onChange(setOnChangeValue(multiple, confirmUserList));
|
|
121
122
|
(_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, setOnChangeValue(multiple, confirmUserList, true));
|
|
122
|
-
|
|
123
|
-
}, [confirmUserList]);
|
|
123
|
+
}, [confirmUserList === null || confirmUserList === void 0 ? void 0 : confirmUserList.map((user) => filterUserInfo(user))]);
|
|
124
124
|
/** 点击确认时获取所选用户,调用confirmAction,将所选用户向外传出 */
|
|
125
125
|
const onConfirmSelectUser = (selectedUserList) => {
|
|
126
126
|
const selectedUser = setOnChangeValue(multiple, selectedUserList, true);
|
|
@@ -193,11 +193,11 @@ function setOnChangeValue(multiple, confirmUserList, isEventChange = false) {
|
|
|
193
193
|
return e === null || e === void 0 ? void 0 : e.id;
|
|
194
194
|
})
|
|
195
195
|
: null,
|
|
196
|
-
data: confirmUserList,
|
|
196
|
+
data: confirmUserList.map((user) => filterUserInfo(user)),
|
|
197
197
|
}
|
|
198
198
|
: {
|
|
199
199
|
value: ((_a = confirmUserList[0]) === null || _a === void 0 ? void 0 : _a.id) || null,
|
|
200
|
-
data: confirmUserList[0]
|
|
200
|
+
data: confirmUserList[0] ? filterUserInfo(confirmUserList[0]) : null,
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
203
|
return multiple
|
|
@@ -208,3 +208,13 @@ function setOnChangeValue(multiple, confirmUserList, isEventChange = false) {
|
|
|
208
208
|
: null
|
|
209
209
|
: (_b = confirmUserList[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
210
210
|
}
|
|
211
|
+
function filterUserInfo(userInfo) {
|
|
212
|
+
return pick(userInfo || {}, ['id', 'userName', 'userId', 'type']);
|
|
213
|
+
}
|
|
214
|
+
function pick(obj = {}, keys) {
|
|
215
|
+
const ret = {};
|
|
216
|
+
for (const key of keys) {
|
|
217
|
+
ret[key] = obj[key];
|
|
218
|
+
}
|
|
219
|
+
return ret;
|
|
220
|
+
}
|
|
@@ -9,6 +9,7 @@ import { getParentForm, useWedaAppContext } from '../../utils/widget-api';
|
|
|
9
9
|
import { validType } from './validator';
|
|
10
10
|
import { emptyArray, noop } from '../../utils/constant';
|
|
11
11
|
import { useRerender, useSyncedRef, useUnmountEffect } from '@react-hookz/web';
|
|
12
|
+
import { useStatus, convertMethodParam } from '../../utils/hooks/useFormLegacy';
|
|
12
13
|
const logger = debug('wd-form-item');
|
|
13
14
|
export function useParentForm($widget) {
|
|
14
15
|
const { ready } = useWedaAppContext();
|
|
@@ -42,8 +43,9 @@ export function useFormInputTrait(inputParams) {
|
|
|
42
43
|
}
|
|
43
44
|
const eventsRef = useSyncedRef(events);
|
|
44
45
|
const [name] = useSyncValue(inputParams.name);
|
|
45
|
-
const
|
|
46
|
-
const [
|
|
46
|
+
const statusParams = useStatus(inputParams);
|
|
47
|
+
const [disabled, setDisabled] = useSyncValue((_a = statusParams.disabled) !== null && _a !== void 0 ? _a : false);
|
|
48
|
+
const [readOnly, setReadOnly] = useSyncValue(statusParams.readOnly);
|
|
47
49
|
const [validateState, setValidateState] = useState(inputParams.validateStatus);
|
|
48
50
|
const [validateErrorMsg, setValidateErrorMsg] = useState('');
|
|
49
51
|
const [visible, setVisible] = useState(true);
|
|
@@ -90,23 +92,27 @@ export function useFormInputTrait(inputParams) {
|
|
|
90
92
|
}, [setValidateErrorMsg, setValidateState]);
|
|
91
93
|
// 挂在setValue方法到 $widget上
|
|
92
94
|
React.useImperativeHandle(inputRef, () => {
|
|
95
|
+
logger.debug('useImperativeHandle', { name, syncValue });
|
|
93
96
|
const result = {
|
|
94
97
|
setValue(val) {
|
|
95
|
-
|
|
98
|
+
const value = convertMethodParam(val);
|
|
99
|
+
setSyncedValue(value);
|
|
96
100
|
},
|
|
97
101
|
setVisible(val) {
|
|
98
|
-
|
|
102
|
+
const value = convertMethodParam(val);
|
|
103
|
+
if (typeof value !== 'boolean') {
|
|
99
104
|
console.warn('参数需要为boolean');
|
|
100
105
|
return;
|
|
101
106
|
}
|
|
102
|
-
setVisible(
|
|
107
|
+
setVisible(value);
|
|
103
108
|
},
|
|
104
109
|
setHidden() {
|
|
105
110
|
setVisible(false);
|
|
106
111
|
},
|
|
107
112
|
initialDisabled: inputParams.disabled,
|
|
108
|
-
setDisable(
|
|
113
|
+
setDisable(val) {
|
|
109
114
|
const originalValue = disabled;
|
|
115
|
+
const value = convertMethodParam(val);
|
|
110
116
|
setDisabled(value);
|
|
111
117
|
return () => {
|
|
112
118
|
setDisabled(originalValue);
|
|
@@ -115,12 +121,14 @@ export function useFormInputTrait(inputParams) {
|
|
|
115
121
|
clearValue() {
|
|
116
122
|
setSyncedValue(null);
|
|
117
123
|
},
|
|
118
|
-
setReadOnly(
|
|
119
|
-
const
|
|
120
|
-
|
|
124
|
+
setReadOnly(val) {
|
|
125
|
+
const [originalReadOnly, originalDisabled] = [readOnly, disabled];
|
|
126
|
+
const value = convertMethodParam(val);
|
|
127
|
+
setReadOnly(value);
|
|
121
128
|
setDisabled(value);
|
|
122
129
|
return () => {
|
|
123
|
-
|
|
130
|
+
setReadOnly(originalReadOnly);
|
|
131
|
+
setDisabled(originalDisabled);
|
|
124
132
|
};
|
|
125
133
|
},
|
|
126
134
|
async handleValidate() {
|
|
@@ -163,11 +171,27 @@ export function useFormInputTrait(inputParams) {
|
|
|
163
171
|
if (item.pattern) {
|
|
164
172
|
// 正则校验
|
|
165
173
|
// console.log("pattern 校验>>>>")
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
try {
|
|
175
|
+
let reg;
|
|
176
|
+
if (typeof item.pattern === 'string') {
|
|
177
|
+
const m = item.pattern.match(/(\/?)(.+)\1([a-z]*)/i);
|
|
178
|
+
if (m[3] &&
|
|
179
|
+
!/^(?!.*?(.).*?\1)[gmixXsuUAJ]+$/.test(m[3])) {
|
|
180
|
+
reg = RegExp(item.pattern);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
reg = new RegExp(m[2], m[3]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
reg = new RegExp(item.pattern);
|
|
188
|
+
}
|
|
189
|
+
if (!reg.test(String(finalValue))) {
|
|
190
|
+
validPromise.push(Promise.resolve(item));
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
170
193
|
}
|
|
194
|
+
catch (e) { }
|
|
171
195
|
}
|
|
172
196
|
}
|
|
173
197
|
});
|
|
@@ -209,6 +233,7 @@ export function useFormInputTrait(inputParams) {
|
|
|
209
233
|
setSyncedValue,
|
|
210
234
|
disabled,
|
|
211
235
|
setDisabled,
|
|
236
|
+
setReadOnly,
|
|
212
237
|
required,
|
|
213
238
|
rules,
|
|
214
239
|
requiredMsg,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { FormItemWrapper } from '../common/form-item-wrapper';
|
|
4
|
+
import SelectMultiple from '../form/selectMultiple';
|
|
5
|
+
import Tips from '../form/tips';
|
|
6
|
+
import { useFormInputTrait } from '../form-input-hooks';
|
|
7
|
+
const FormSelectMultiple = React.forwardRef(function FormSelectMultiple(props, inputRef) {
|
|
8
|
+
const { className, id, style, events, required, requiredFlag, label, labelVisible, dataSourceName, enumName, format, placeholder, primaryField, range, size, tipBlock, viewId,
|
|
9
|
+
// where,
|
|
10
|
+
...restProps } = props;
|
|
11
|
+
const { value, name, onChange, disabled, layout,
|
|
12
|
+
// readOnly,
|
|
13
|
+
validateErrorMsg, validateState, visible, } = useFormInputTrait({
|
|
14
|
+
name: restProps.name,
|
|
15
|
+
inputRef,
|
|
16
|
+
required,
|
|
17
|
+
...restProps,
|
|
18
|
+
});
|
|
19
|
+
if (!visible) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return (_jsxs(FormItemWrapper, { children: [_jsx(SelectMultiple, { id: id, style: style, className: className, events: events, name: name, onChange: onChange, disabled: disabled, label: label, labelVisible: labelVisible, layout: layout, requiredFlag: required && requiredFlag, defaultValue: value, enumName: enumName, format: format, placeholder: placeholder, primaryField: primaryField, range: range, size: size, tipBlock: tipBlock, viewId: viewId,
|
|
23
|
+
// where={where}
|
|
24
|
+
dataSourceName: dataSourceName, mode: "selector" }), (validateState === 'error' || validateState === 'warn') && (_jsx(Tips, { tips: validateErrorMsg, type: "warn" }))] }));
|
|
25
|
+
});
|
|
26
|
+
export default FormSelectMultiple;
|
|
@@ -228,6 +228,30 @@
|
|
|
228
228
|
float: unset;
|
|
229
229
|
width: 100%;
|
|
230
230
|
}
|
|
231
|
+
|
|
232
|
+
.wd-form--vertical-left
|
|
233
|
+
.form-detail-wrap.pc-form-detail-wrap
|
|
234
|
+
.form-detail-group-parent-container,
|
|
235
|
+
.wd-form--vertical-right
|
|
236
|
+
.form-detail-wrap.pc-form-detail-wrap
|
|
237
|
+
.form-detail-group-parent-container {
|
|
238
|
+
float: unset;
|
|
239
|
+
width: 100%;
|
|
240
|
+
}
|
|
241
|
+
.wd-form--vertical-left
|
|
242
|
+
.form-detail-wrap.pc-form-detail-wrap
|
|
243
|
+
.form-detail-group-label-container {
|
|
244
|
+
float: unset;
|
|
245
|
+
width: 100%;
|
|
246
|
+
}
|
|
247
|
+
.wd-form--vertical-right
|
|
248
|
+
.form-detail-wrap.pc-form-detail-wrap
|
|
249
|
+
.form-detail-group-label-container {
|
|
250
|
+
float: unset;
|
|
251
|
+
width: 100%;
|
|
252
|
+
text-align: right;
|
|
253
|
+
}
|
|
254
|
+
|
|
231
255
|
/* 升级后组件样式兼容 */
|
|
232
256
|
.form-detail-wrap .form-detail-add-button .wd-typography,
|
|
233
257
|
.form-detail-wrap .form-detail-delete-button .wd-typography {
|
|
@@ -400,10 +424,12 @@
|
|
|
400
424
|
}
|
|
401
425
|
.form-detail-table .tableHeaderCellContainer {
|
|
402
426
|
display: flex;
|
|
427
|
+
position: relative;
|
|
403
428
|
}
|
|
404
429
|
.form-detail-table .tableHeaderCellContainer .tableFieldRequired {
|
|
405
430
|
color: #e34d59;
|
|
406
|
-
|
|
431
|
+
position: absolute;
|
|
432
|
+
left: -10px;
|
|
407
433
|
}
|
|
408
434
|
.form-detail-table .wd-grid-col.form-detail-table-option-container {
|
|
409
435
|
background-color: #f3f3f3;
|
|
@@ -442,3 +468,7 @@
|
|
|
442
468
|
.form-detail-wrap .wd-grid-row > div {
|
|
443
469
|
margin: 0;
|
|
444
470
|
}
|
|
471
|
+
|
|
472
|
+
.form-detail-wrap.form-detail-table .weda-ui.gsd-h5-react-formitem > .weda-ui {
|
|
473
|
+
padding: 0;
|
|
474
|
+
}
|
|
@@ -10,6 +10,28 @@ import { useFormInputTrait, useParentForm } from '../form-input-hooks';
|
|
|
10
10
|
import { debug } from '../../utils/console';
|
|
11
11
|
import { noop } from '../../utils/constant';
|
|
12
12
|
import { WdText } from '../wd-text';
|
|
13
|
+
// 获取明细组件子项初始值
|
|
14
|
+
const getChildFormItem = (isPureArray, name, parent) => {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
16
|
+
let childFormItem = [];
|
|
17
|
+
let fieldSchema = null;
|
|
18
|
+
if ('model' === (parent === null || parent === void 0 ? void 0 : parent.datasourceType)) {
|
|
19
|
+
fieldSchema = (_c = (_b = (_a = parent === null || parent === void 0 ? void 0 : parent.dataSourceProfile) === null || _a === void 0 ? void 0 : _a.schema) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c[name];
|
|
20
|
+
}
|
|
21
|
+
else if (['connector', 'custom-connector'].includes(parent === null || parent === void 0 ? void 0 : parent.datasourceType)) {
|
|
22
|
+
const method = (parent === null || parent === void 0 ? void 0 : parent.methodCreate) || (parent === null || parent === void 0 ? void 0 : parent.methodUpdate) || (parent === null || parent === void 0 ? void 0 : parent.methodGetItem);
|
|
23
|
+
const inParams = (_f = (_e = (_d = parent === null || parent === void 0 ? void 0 : parent.dataSourceProfile) === null || _d === void 0 ? void 0 : _d.methods) === null || _e === void 0 ? void 0 : _e.find((i) => i.name === method)) === null || _f === void 0 ? void 0 : _f.inParams;
|
|
24
|
+
fieldSchema = (_g = inParams === null || inParams === void 0 ? void 0 : inParams.properties) === null || _g === void 0 ? void 0 : _g[name];
|
|
25
|
+
}
|
|
26
|
+
childFormItem = ((_h = fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.items) === null || _h === void 0 ? void 0 : _h.properties)
|
|
27
|
+
? Object.keys((_j = fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.items) === null || _j === void 0 ? void 0 : _j.properties)
|
|
28
|
+
: [];
|
|
29
|
+
// 纯数组,默认key值为'arrayItem'
|
|
30
|
+
if (isPureArray) {
|
|
31
|
+
childFormItem = ['arrayItem'];
|
|
32
|
+
}
|
|
33
|
+
return childFormItem;
|
|
34
|
+
};
|
|
13
35
|
const logger = debug('form-detail');
|
|
14
36
|
export const reorderContext = (data, name, isPureArray) => data.map((i, index) => {
|
|
15
37
|
const item = { ...i };
|
|
@@ -66,6 +88,7 @@ export const changeHandle = ({ type, name, data, childFormItem, isPureArray, par
|
|
|
66
88
|
return data;
|
|
67
89
|
};
|
|
68
90
|
const FormDetailCom = forwardRef(function FormDetail(props, ref) {
|
|
91
|
+
var _a;
|
|
69
92
|
const { className, id, style, children, events, name, isPureArray, fieldAuth = 'rw', $widget, hasInitValue = false, isWdFormDetail, viewType = 'table', label, } = props;
|
|
70
93
|
const [innerHandle, setInnerHandle] = useState({});
|
|
71
94
|
const inputRef = useRef({});
|
|
@@ -144,6 +167,13 @@ const FormDetailCom = forwardRef(function FormDetail(props, ref) {
|
|
|
144
167
|
setHasScroll(bodyHasScroll);
|
|
145
168
|
}
|
|
146
169
|
}, []);
|
|
170
|
+
// 初始化明细组件子项初始值
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.dataSourceProfile) && name) {
|
|
173
|
+
const childFormItem = getChildFormItem(isPureArray, name, parent);
|
|
174
|
+
setChildFormItem(childFormItem);
|
|
175
|
+
}
|
|
176
|
+
}, [isPureArray, name, (_a = parent === null || parent === void 0 ? void 0 : parent.dataSourceProfile) === null || _a === void 0 ? void 0 : _a.name]);
|
|
147
177
|
// 初始化context的值
|
|
148
178
|
useEffect(() => {
|
|
149
179
|
logger.debug('initDetailValue', initDetailValue);
|
|
@@ -70,6 +70,7 @@ export { default as Checkbox } from './form/checkbox';
|
|
|
70
70
|
export { default as Radio } from './form/radio';
|
|
71
71
|
export { default as Switch } from './form/switch';
|
|
72
72
|
export { default as Select } from './form/select';
|
|
73
|
+
export { default as SelectMultiple } from './form/selectMultiple';
|
|
73
74
|
// export const Select = loadable(() => import('./form/select'), { fallback });
|
|
74
75
|
export { default as Uploader } from './form/uploader';
|
|
75
76
|
export { default as UploaderFile } from './form/uploaderFile';
|
|
@@ -132,7 +133,6 @@ export { default as Grid } from './grid/grid';
|
|
|
132
133
|
export { default as Repeater } from './repeater';
|
|
133
134
|
export { default as RepeaterItem } from './repeater-item';
|
|
134
135
|
export { default as WebView } from './web-view';
|
|
135
|
-
export { default as WdForm } from './wd-form';
|
|
136
136
|
export { default as FormInput } from './form-input';
|
|
137
137
|
export { default as FormTextArea } from './form-text-area';
|
|
138
138
|
export { default as FormRadio } from './form-radio';
|
|
@@ -153,12 +153,14 @@ export { default as FormImageUploader } from './form-image-uploader';
|
|
|
153
153
|
export { default as FormUploadFile } from './form-upload-file';
|
|
154
154
|
export { default as FormMultiRegion } from './form-multi-region';
|
|
155
155
|
export { default as FormSelect } from './form-select';
|
|
156
|
+
export { default as FormSelectMultiple } from './form-select-multiple';
|
|
156
157
|
export { default as FormDate } from './form-date';
|
|
157
158
|
export { default as FormRegion } from './form-region';
|
|
158
159
|
export { default as FormTime } from './form-time';
|
|
159
160
|
export { default as WdFormDetail } from './formdetail';
|
|
160
161
|
export { default as QrCode } from './qrcode';
|
|
161
162
|
export { default as CustomerService } from './customer-service';
|
|
163
|
+
export { default as WdOfficialAccount } from './wd-official-account';
|
|
162
164
|
import 'weui/dist/style/weui.css';
|
|
163
165
|
import '../weda-ui.css';
|
|
164
166
|
// 组件标准化
|
|
@@ -171,3 +173,17 @@ export { default as WdText } from './wd-text';
|
|
|
171
173
|
export { default as WdImage } from './wd-image';
|
|
172
174
|
export { default as WdBubble } from './wd-bubble';
|
|
173
175
|
export { default as WdIcon } from './wd-icon';
|
|
176
|
+
export { default as WdTree } from './wd-tree';
|
|
177
|
+
export { default as WdForm } from './wd-form';
|
|
178
|
+
export { default as WdTextarea } from './wd-textarea';
|
|
179
|
+
export { default as WdInput } from './wd-input';
|
|
180
|
+
export { default as WdInputEmail } from './wd-input-email';
|
|
181
|
+
export { default as WdInputUrl } from './wd-input-url';
|
|
182
|
+
export { default as WdInputGroup } from './wd-input-group';
|
|
183
|
+
export { default as WdInputPhone } from './wd-input-phone';
|
|
184
|
+
export { default as WdInputWrap } from './wd-input-wrap';
|
|
185
|
+
export { default as WdSwitch } from './wd-switch';
|
|
186
|
+
export { default as WdRadioList } from './wd-radio-list';
|
|
187
|
+
export { default as WdRadio } from './wd-radio';
|
|
188
|
+
export { default as WdCheckboxList } from './wd-checkbox-list';
|
|
189
|
+
export { default as WdCheckbox } from './wd-checkbox';
|
|
@@ -381,13 +381,28 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
381
381
|
alertErrorMessage({ message: LISTVIEW_MESSAGE.deleteOne_fail });
|
|
382
382
|
}
|
|
383
383
|
}, [appCloud, isModel, methodRefreshKeepPage]);
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
384
|
+
const { total, pageNo, pageSize: statePageSize } = getContextState();
|
|
385
|
+
// widget api
|
|
386
|
+
useImperativeHandle(ref, () => {
|
|
387
|
+
return {
|
|
388
|
+
// 当前页数据
|
|
389
|
+
records: dataRef.current.records,
|
|
390
|
+
// 当前总数
|
|
391
|
+
total,
|
|
392
|
+
pageNo,
|
|
393
|
+
pageSize: statePageSize,
|
|
394
|
+
// 组件方法
|
|
387
395
|
deleteOne: methodDeleteOne,
|
|
388
396
|
refresh: methodRefresh,
|
|
389
|
-
}
|
|
390
|
-
}
|
|
397
|
+
};
|
|
398
|
+
}, [
|
|
399
|
+
total,
|
|
400
|
+
pageNo,
|
|
401
|
+
statePageSize,
|
|
402
|
+
methodDeleteOne,
|
|
403
|
+
methodRefresh,
|
|
404
|
+
dataRef.current.records,
|
|
405
|
+
]);
|
|
391
406
|
/**
|
|
392
407
|
* 分页,加载更多
|
|
393
408
|
*/
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* @Date: 2023-04-12 16:43:55
|
|
4
|
+
* @LastEditTime: 2023-05-04 12:09:27
|
|
5
|
+
* @Description:
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
2
8
|
import Button from '../../components/button';
|
|
3
9
|
import { Bubble, ConfigProvider } from 'tea-component';
|
|
4
|
-
|
|
10
|
+
// @ts-ignore忽略ts交验
|
|
11
|
+
// eslint-disable-next-line rulesdir/no-phantom-deps,import/no-unresolved
|
|
12
|
+
import { autorun } from 'mobx';
|
|
13
|
+
const Phone = (props) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const [editorPlatforms, setEditorPlatforms] = React.useState([]);
|
|
16
|
+
const dispose = React.useMemo(() => {
|
|
17
|
+
return autorun(() => {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
setEditorPlatforms((_b = (_a = window === null || window === void 0 ? void 0 : window.$w) === null || _a === void 0 ? void 0 : _a.wedaContext) === null || _b === void 0 ? void 0 : _b.editorPlatforms);
|
|
20
|
+
});
|
|
21
|
+
}, []);
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
return () => {
|
|
24
|
+
dispose();
|
|
25
|
+
};
|
|
26
|
+
}, [dispose]);
|
|
27
|
+
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: ((_b = (_a = window.$w) === null || _a === void 0 ? void 0 : _a.wedaContext) === null || _b === void 0 ? void 0 : _b.isEditorMode) ||
|
|
28
|
+
(editorPlatforms === null || editorPlatforms === void 0 ? void 0 : editorPlatforms.includes('MP')) ? (_jsx(Bubble, { content: "\u8BE5\u7EC4\u4EF6\u5FC5\u987B\u5728\u5C0F\u7A0B\u5E8F\u771F\u5B9E\u73AF\u5883\u4F7F\u7528\u624D\u80FD\u591F\u770B\u5230\u5B9E\u9645\u6548\u679C, \u5E76\u4E14\u5C0F\u7A0B\u5E8F\u5FC5\u987B\u4E3A\u4F01\u4E1A\u4E3B\u4F53\u3002", children: _jsx(Button, { ...props }) })) : null }));
|
|
29
|
+
};
|
|
5
30
|
export default Phone;
|
|
@@ -2,5 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import Button from '../../components/button';
|
|
3
3
|
import { Bubble, ConfigProvider } from 'tea-component';
|
|
4
4
|
// export type PhoneCodeProps =
|
|
5
|
-
const PhoneCode = (props) =>
|
|
5
|
+
const PhoneCode = (props) => {
|
|
6
|
+
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(Bubble, { content: "\u8BE5\u7EC4\u4EF6\u5FC5\u987B\u5728\u5C0F\u7A0B\u5E8F\u771F\u5B9E\u73AF\u5883\u4F7F\u7528\u624D\u80FD\u591F\u770B\u5230\u5B9E\u9645\u6548\u679C, \u5E76\u4E14\u5C0F\u7A0B\u5E8F\u5FC5\u987B\u4E3A\u4F01\u4E1A\u4E3B\u4F53\u3002", children: _jsx(Button, { ...props }) }) }));
|
|
7
|
+
};
|
|
6
8
|
export default PhoneCode;
|