@cloudbase/weda-ui 3.1.9 → 3.2.0
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.json +3 -3
- package/dist/configs/components/chart/line.json +3 -3
- package/dist/configs/components/chart/pie.json +3 -3
- package/dist/configs/components/form/departTreeSelect.json +124 -0
- package/dist/configs/components/form/userTreeSelect.json +128 -0
- package/dist/configs/components/formdetail.json +105 -0
- package/dist/configs/components/listView.json +9 -1
- package/dist/configs/components/lottery.json +1 -1
- package/dist/configs/components/tabs.json +10 -9
- package/dist/configs/components/wxOpenApi/share.json +5 -2
- package/dist/configs/index.d.ts +6 -0
- package/dist/configs/index.js +6 -0
- package/dist/web/components/calendar/index.js +10 -2
- package/dist/web/components/carousel/index.js +4 -0
- package/dist/web/components/chart/common/core/eChartBase.js +8 -2
- package/dist/web/components/form/form/index.js +10 -7
- package/dist/web/components/form/location/common/mapChoose.js +2 -0
- package/dist/web/components/form/location/common/mapView.js +2 -0
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +3 -1
- package/dist/web/components/form/location/components/LocationH5/location.module.css +3 -0
- package/dist/web/components/form/select/h5.js +4 -0
- package/dist/web/components/form/select/index.js +2 -8
- package/dist/web/components/form/switch/index.js +3 -2
- package/dist/web/components/form/switch/switch.module.css +7 -0
- package/dist/web/components/form/uploader/uploader.h5.d.ts +1 -0
- package/dist/web/components/form/uploader/uploader.h5.js +14 -10
- package/dist/web/components/form/uploader/uploader.pc.js +1 -1
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +14 -12
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +8 -8
- package/dist/web/components/form/userOrgSelect/comTool.d.ts +7 -0
- package/dist/web/components/form/userOrgSelect/comTool.js +89 -0
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.d.ts +20 -0
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +259 -0
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.d.ts +4 -0
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +153 -0
- package/dist/web/components/form/userOrgSelect/departTreeSelect/index.d.ts +2 -0
- package/dist/web/components/form/userOrgSelect/departTreeSelect/index.js +17 -0
- package/dist/web/components/form/userOrgSelect/index.d.ts +2 -0
- package/dist/web/components/form/userOrgSelect/index.js +17 -0
- package/dist/web/components/form/userOrgSelect/userOrgSelect.less +643 -0
- package/dist/web/components/form/userOrgSelect/userTreeSelect.h5.d.ts +24 -0
- package/dist/web/components/form/userOrgSelect/userTreeSelect.h5.js +276 -0
- package/dist/web/components/form/userOrgSelect/userTreeSelect.pc.d.ts +9 -0
- package/dist/web/components/form/userOrgSelect/userTreeSelect.pc.js +229 -0
- package/dist/web/components/form/userOrgSelect/utils.d.ts +35 -0
- package/dist/web/components/form/userOrgSelect/utils.js +72 -0
- package/dist/web/components/formdetail/index.css +115 -0
- package/dist/web/components/formdetail/index.d.ts +28 -0
- package/dist/web/components/formdetail/index.js +170 -0
- package/dist/web/components/index.d.ts +3 -0
- package/dist/web/components/index.js +3 -0
- package/dist/web/components/listView/index.css +35 -5
- package/dist/web/components/listView/index.js +92 -68
- package/dist/web/components/listView/interface.d.ts +5 -0
- package/dist/web/components/lottery/index.js +2 -1
- package/dist/web/components/lottery/lotteryUtil.js +1 -0
- package/dist/web/components/navigationBar/index.css +21 -29
- package/dist/web/components/richText/index.css +1 -0
- package/dist/web/components/swiper/index.js +5 -1
- package/dist/web/components/wedaVideo/index.js +1 -0
- package/dist/web/utils/getUserService.d.ts +17 -0
- package/dist/web/utils/getUserService.js +148 -0
- package/dist/web/utils/platform.js +2 -0
- package/dist/web/weda-ui.css +9 -0
- package/package.json +13 -12
- package/dist/asset-manifest.json +0 -17
- package/dist/index.html +0 -88
- package/dist/static/js/bundle.js +0 -963
- package/dist/static/js/bundle.js.map +0 -1
- package/dist/static/js/main.chunk.js +0 -8841
- package/dist/static/js/main.chunk.js.map +0 -1
- package/dist/static/js/vendors~main.chunk.js +0 -247885
- package/dist/static/js/vendors~main.chunk.js.map +0 -1
- package/dist/static/media/ef6fa527e24e354765d806b826b41391.fa67580a.svg +0 -627
- package/dist/web/components/auth/index.d.ts +0 -10
- package/dist/web/components/auth/index.js +0 -37
- package/dist/web/utils/events.d.ts +0 -1
- package/dist/web/utils/events.js +0 -2
|
@@ -5,6 +5,7 @@ import { usePlatform, isInIde } from '../../../utils/platform';
|
|
|
5
5
|
import { callDataSource, callConnector } from '../../../utils/tcb';
|
|
6
6
|
import weui from '../../../utils/weui';
|
|
7
7
|
import './index.css';
|
|
8
|
+
const formTypeWithInitValue = ['edit', 'read'];
|
|
8
9
|
/**
|
|
9
10
|
* 表单容器组件
|
|
10
11
|
*/
|
|
@@ -27,7 +28,7 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
|
|
|
27
28
|
let initValue = {};
|
|
28
29
|
if (isDataModel) {
|
|
29
30
|
// 数据模型查询条件
|
|
30
|
-
if (formType
|
|
31
|
+
if (formTypeWithInitValue.includes(formType) && dataSourceName) {
|
|
31
32
|
initValue = await appCloud.callDataSource({
|
|
32
33
|
dataSourceName,
|
|
33
34
|
methodName: 'wedaGetItem',
|
|
@@ -37,13 +38,13 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
|
|
|
37
38
|
(_a = events === null || events === void 0 ? void 0 : events.onInitValue) === null || _a === void 0 ? void 0 : _a.call(events, initValue);
|
|
38
39
|
}
|
|
39
40
|
else {
|
|
40
|
-
alertError(platform);
|
|
41
|
+
alertError(platform, '表单容器数据查询失败');
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
46
|
// 连接器查询条件
|
|
46
|
-
if (formType
|
|
47
|
+
if (formTypeWithInitValue.includes(formType) &&
|
|
47
48
|
dataSourceName &&
|
|
48
49
|
methodGetItem &&
|
|
49
50
|
paramGetItem) {
|
|
@@ -59,13 +60,15 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
catch (e) {
|
|
62
|
-
alertError(platform);
|
|
63
|
+
alertError(platform, '表单容器数据查询失败');
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
|
-
if (dataSourceName && formType
|
|
66
|
+
if (dataSourceName && formTypeWithInitValue.includes(formType)) {
|
|
66
67
|
if ((isDataModel && _id) ||
|
|
67
68
|
(!isDataModel && paramGetItem && methodGetItem)) {
|
|
68
69
|
clearTimeout(timeRef.current);
|
|
70
|
+
// 防抖
|
|
71
|
+
// eslint-disable-next-line rulesdir/no-timer
|
|
69
72
|
timeRef.current = setTimeout(() => getData(), 100);
|
|
70
73
|
}
|
|
71
74
|
}
|
|
@@ -93,11 +96,11 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
|
|
|
93
96
|
/**
|
|
94
97
|
* 根据平台不同,展示不同的错误提示消息
|
|
95
98
|
*/
|
|
96
|
-
function alertError(platform = 'h5', message
|
|
99
|
+
function alertError(platform = 'h5', message) {
|
|
97
100
|
if (isInIde())
|
|
98
101
|
return;
|
|
99
102
|
if (platform === 'h5') {
|
|
100
|
-
weui.toast(message, { className: 'weda-form-toast' });
|
|
103
|
+
weui.toast(message, { duration: 2000, className: 'weda-form-toast' });
|
|
101
104
|
}
|
|
102
105
|
else {
|
|
103
106
|
TeaMessage.error({ content: message });
|
|
@@ -10,6 +10,7 @@ import SelectModal from '../../common/selectModal';
|
|
|
10
10
|
import { propTypes, defaultProps } from '../../common/propsConfig';
|
|
11
11
|
import { callDataSource } from '../../../../../utils/tcb';
|
|
12
12
|
import { inH5IsMobile } from '../../../../../utils/platform';
|
|
13
|
+
import styles from './location.module.css';
|
|
13
14
|
const { useEffect, useState, useRef } = React;
|
|
14
15
|
export default function LocationH5(props) {
|
|
15
16
|
const {
|
|
@@ -288,12 +289,13 @@ export default function LocationH5(props) {
|
|
|
288
289
|
return status;
|
|
289
290
|
};
|
|
290
291
|
const LocationEl = (React.createElement("div", { className: "form-location weda-ui_form-location", "data-testid": "form-location" },
|
|
291
|
-
React.createElement("div", { className:
|
|
292
|
+
React.createElement("div", { className: `form-location-warp ${styles.locationDisabled}`, style: { display: layout === 'vertical' ? 'block' : 'flex' } },
|
|
292
293
|
labelVisible && (React.createElement("div", { className: "form-location-label" },
|
|
293
294
|
React.createElement("label", null, label),
|
|
294
295
|
requiredFlag && React.createElement("span", null, "*"))),
|
|
295
296
|
React.createElement("div", { className: classNames({
|
|
296
297
|
'form-location-con': true,
|
|
298
|
+
[styles.locationContent]: true,
|
|
297
299
|
'form-location-con_vertical': layout === 'vertical',
|
|
298
300
|
}) },
|
|
299
301
|
React.createElement("img", { src: "https://qcloudimg.tencent-cloud.cn/raw/6542e1ce1dd36a90085b2eb979801df9.png", alt: "" }),
|
|
@@ -188,9 +188,13 @@ defaultRegion, defaultMutiRegion, separator, regionType, onChange, }) {
|
|
|
188
188
|
onRegionClick();
|
|
189
189
|
}
|
|
190
190
|
else {
|
|
191
|
+
// 轮询直到他不为空
|
|
192
|
+
// eslint-disable-next-line rulesdir/no-timer
|
|
191
193
|
setTimeout(cb, 200);
|
|
192
194
|
}
|
|
193
195
|
};
|
|
196
|
+
// 轮询直到他不为空
|
|
197
|
+
// eslint-disable-next-line rulesdir/no-timer
|
|
194
198
|
regionTimer = setTimeout(cb, 200);
|
|
195
199
|
};
|
|
196
200
|
const onRegionClick = function () {
|
|
@@ -174,7 +174,7 @@ function SelectPc({ where, dataSourceName, viewId, format, primaryField, enumNam
|
|
|
174
174
|
const createDropdown = () => {
|
|
175
175
|
switch (mode) {
|
|
176
176
|
case 'selector':
|
|
177
|
-
return (React.createElement(PureSelectPc, { size: size, onChange: (value) => {
|
|
177
|
+
return (React.createElement(PureSelectPc, { disabled: disabled, size: size, onChange: (value) => {
|
|
178
178
|
var _a;
|
|
179
179
|
onChange && onChange(value);
|
|
180
180
|
(_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
|
|
@@ -222,13 +222,7 @@ function SelectPc({ where, dataSourceName, viewId, format, primaryField, enumNam
|
|
|
222
222
|
index !== 0 && `${separator}`,
|
|
223
223
|
label || value))), value: region }));
|
|
224
224
|
case 'mutiRegion':
|
|
225
|
-
return (React.createElement(Cascader, { clearable: true, searchable: true, className: sizeClassName, type: "menu", disabled: disabled, data: regionTree, multiple: false, onChange: onDataChange,
|
|
226
|
-
return new Promise((resolve) => {
|
|
227
|
-
setTimeout(() => {
|
|
228
|
-
resolve();
|
|
229
|
-
}, 1000);
|
|
230
|
-
});
|
|
231
|
-
}, valueRender: (options) => options.map(({ label, value }, index) => (React.createElement(React.Fragment, { key: `${value}-${index}` },
|
|
225
|
+
return (React.createElement(Cascader, { clearable: true, searchable: true, className: sizeClassName, type: "menu", disabled: disabled, data: regionTree, multiple: false, onChange: onDataChange, valueRender: (options) => options.map(({ label, value }, index) => (React.createElement(React.Fragment, { key: `${value}-${index}` },
|
|
232
226
|
index !== 0 && ',',
|
|
233
227
|
label || value))), value: mutiRegion }));
|
|
234
228
|
}
|
|
@@ -6,6 +6,7 @@ import { ConfigProvider, Switch as TeaSwitch } from 'tea-component';
|
|
|
6
6
|
import { renderDecorator } from '../renderDecorator';
|
|
7
7
|
import { useSyncValue } from '../../../utils/useSyncValue';
|
|
8
8
|
import { emptyObject } from '../../../utils/constant';
|
|
9
|
+
import styles from './switch.module.css';
|
|
9
10
|
export default function Switch({
|
|
10
11
|
// 系统属性
|
|
11
12
|
id, className, style, events = emptyObject,
|
|
@@ -34,11 +35,11 @@ label = '标题', labelVisible = true, checked: defaultChecked, layout = 'horizo
|
|
|
34
35
|
isFlex ? React.createElement("div", { className: "weui-cell__bd" }) : null,
|
|
35
36
|
React.createElement("div", { className: isFlex ? 'weui-cell__ft' : 'weui-cell__bd' },
|
|
36
37
|
React.createElement("label", { htmlFor: _id, key: _id, className: "weui-switch-cp" },
|
|
37
|
-
|
|
38
|
+
React.createElement("input", { id: _id, className: `weui-switch-cp__input ${styles.wedaSwitchInput}`, type: "checkbox", checked: checked, disabled: disabled, onChange: (ev) => {
|
|
38
39
|
const value = ev.target.checked;
|
|
39
40
|
setChecked(value);
|
|
40
41
|
events.change({ value }, { orgianalEvent: ev });
|
|
41
|
-
} })
|
|
42
|
+
} }),
|
|
42
43
|
React.createElement("div", { className: "weui-switch-cp__box" }))))) : (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
43
44
|
React.createElement(TeaSwitch, { id: _id, value: checked, disabled: disabled, onChange: (value, context) => {
|
|
44
45
|
const originEvent = context.event;
|
|
@@ -7,6 +7,7 @@ export declare function ImageUploaderH5({ title, maxUploadCount, maxSize, accept
|
|
|
7
7
|
export interface SingleImageProps {
|
|
8
8
|
src: string;
|
|
9
9
|
deleteBySrc: (url: string) => void;
|
|
10
|
+
disabled: boolean;
|
|
10
11
|
}
|
|
11
12
|
export interface H5UploaderProps extends CommonFormPropsType {
|
|
12
13
|
title?: string;
|
|
@@ -135,7 +135,7 @@ export function ImageUploaderH5({ title, maxUploadCount, maxSize = 10, acceptTyp
|
|
|
135
135
|
React.createElement(UploaderLabel, { layout: layout, title: title, currentCount: fileIdList.length, maxCount: finalMaxImgCount, requiredFlag: requiredFlag })),
|
|
136
136
|
React.createElement("div", { className: "weui-uploader__bd" },
|
|
137
137
|
React.createElement("ul", { className: "weui-uploader__files", id: "uploaderFiles" },
|
|
138
|
-
(fileIdList !== null && fileIdList !== void 0 ? fileIdList : []).map((f) => (React.createElement(SingleImage, { key: f, src: f, deleteBySrc: deleteFile }))),
|
|
138
|
+
(fileIdList !== null && fileIdList !== void 0 ? fileIdList : []).map((f) => (React.createElement(SingleImage, { key: f, src: f, deleteBySrc: deleteFile, disabled: disabled }))),
|
|
139
139
|
uploading && (React.createElement("li", { className: "weui-uploader__file weui-uploader__file_status" },
|
|
140
140
|
React.createElement("div", { className: "weui-uploader__file-content" },
|
|
141
141
|
progress,
|
|
@@ -160,7 +160,7 @@ export function ImageUploaderH5({ title, maxUploadCount, maxSize = 10, acceptTyp
|
|
|
160
160
|
files.forEach((f) => uploadToTcb(f));
|
|
161
161
|
} }))))))));
|
|
162
162
|
}
|
|
163
|
-
function SingleImage({ src, deleteBySrc }) {
|
|
163
|
+
function SingleImage({ src, deleteBySrc, disabled }) {
|
|
164
164
|
const [error, setError] = React.useState(false);
|
|
165
165
|
const cls = classNames({
|
|
166
166
|
'weui-uploader__file': true,
|
|
@@ -190,12 +190,14 @@ function SingleImage({ src, deleteBySrc }) {
|
|
|
190
190
|
backgroundImage: `url(${realSrc})`,
|
|
191
191
|
};
|
|
192
192
|
const showGallery = () => {
|
|
193
|
-
const gallery = weui.gallery(realSrc,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
193
|
+
const gallery = weui.gallery(realSrc, disabled
|
|
194
|
+
? undefined
|
|
195
|
+
: {
|
|
196
|
+
onDelete: function () {
|
|
197
|
+
deleteBySrc(src);
|
|
198
|
+
gallery.hide();
|
|
199
|
+
},
|
|
200
|
+
});
|
|
199
201
|
};
|
|
200
202
|
return (React.createElement("li", { className: cls, style: imgStyle, onClick: showGallery }, error || status ? (React.createElement("div", { className: "weui-uploader__file-content" }, error ? (React.createElement("i", { role: "img", "aria-label": "\u9519\u8BEF", className: "weui-icon-warn" })) : (React.createElement("i", { className: "weui-loading", style: { width: 30, height: 30 } })))) : (false)));
|
|
201
203
|
}
|
|
@@ -207,7 +209,8 @@ const UploaderLabel = ({ layout, title, currentCount, maxCount, requiredFlag, })
|
|
|
207
209
|
React.createElement("p", { className: "weui-uploader__title" }, title),
|
|
208
210
|
React.createElement("div", { className: "weui-uploader__info" },
|
|
209
211
|
React.createElement("span", { id: "uploadCount" }, currentCount),
|
|
210
|
-
|
|
212
|
+
"/",
|
|
213
|
+
maxCount)),
|
|
211
214
|
requiredFlag && React.createElement("label", { className: "weda-formcells__flag" }, "*"))));
|
|
212
215
|
}
|
|
213
216
|
return (React.createElement("div", { className: "weda-formcells__label weui-cell" },
|
|
@@ -216,5 +219,6 @@ const UploaderLabel = ({ layout, title, currentCount, maxCount, requiredFlag, })
|
|
|
216
219
|
requiredFlag && React.createElement("label", { className: "weda-formcells__flag" }, "*")),
|
|
217
220
|
React.createElement("div", { className: "weui-uploader__info" },
|
|
218
221
|
React.createElement("span", { id: "uploadCount" }, currentCount),
|
|
219
|
-
|
|
222
|
+
"/",
|
|
223
|
+
maxCount)));
|
|
220
224
|
};
|
|
@@ -166,7 +166,7 @@ export function UploaderPCInner(props) {
|
|
|
166
166
|
fileIDList.map((d) => (React.createElement("div", { className: "_weda-fn-upload-result__item", key: d },
|
|
167
167
|
React.createElement(TcbImage, { fileID: d }),
|
|
168
168
|
React.createElement("div", { className: "_weda-fn-upload-result__op" },
|
|
169
|
-
React.createElement(Button, { onClick: () => deleteHandle(d), className: `${CLASS_PREFIX}__btn` }, "\u5220\u9664"))))),
|
|
169
|
+
React.createElement(Button, { disabled: disabled, onClick: () => deleteHandle(d), className: `${CLASS_PREFIX}__btn` }, "\u5220\u9664"))))),
|
|
170
170
|
uploading && (React.createElement("div", { className: "_weda-fn-upload-result__item" },
|
|
171
171
|
React.createElement("div", { className: "_weda-fn-upload-result__status", key: "_place_image" },
|
|
172
172
|
React.createElement(Icon, { type: "loading" }),
|
|
@@ -165,8 +165,8 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
165
165
|
!single && (React.createElement(Text, { className: `${CLASS_PREFIX}__tips` }, "\u652F\u6301\u6279\u91CF\u4E0A\u4F20"))))))),
|
|
166
166
|
React.createElement("div", { className: `${CLASS_PREFIX}__bd` },
|
|
167
167
|
React.createElement(List, null,
|
|
168
|
-
fileIDList.map((d) => (React.createElement(List.Item, { key: d }, React.createElement(TcbFileEcho, { fileID: d, fileList: fileList, onChange: handleChange, deleteVisible: deleteVisible, downloadVisible: downloadVisible })))),
|
|
169
|
-
fileList.map((item) => (React.createElement(List.Item, { key: item === null || item === void 0 ? void 0 : item._uuid }, React.createElement(TcbFileUpload, { file: item, downloadVisible: downloadVisible, deleteVisible: deleteVisible })))))))))))({
|
|
168
|
+
fileIDList.map((d) => (React.createElement(List.Item, { key: d }, React.createElement(TcbFileEcho, { fileID: d, fileList: fileList, onChange: handleChange, disabled: disabled, deleteVisible: deleteVisible, downloadVisible: downloadVisible })))),
|
|
169
|
+
fileList.map((item) => (React.createElement(List.Item, { key: item === null || item === void 0 ? void 0 : item._uuid }, React.createElement(TcbFileUpload, { disabled: disabled, file: item, downloadVisible: downloadVisible, deleteVisible: deleteVisible && !disabled })))))))))))({
|
|
170
170
|
id,
|
|
171
171
|
className: cls,
|
|
172
172
|
style,
|
|
@@ -179,7 +179,7 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
179
179
|
/**
|
|
180
180
|
* 基于 FileID 文件回显组件
|
|
181
181
|
*/
|
|
182
|
-
const TcbFileEcho = ({ fileID }) => {
|
|
182
|
+
const TcbFileEcho = ({ fileID, disabled }) => {
|
|
183
183
|
const [src, setSrc] = React.useState('');
|
|
184
184
|
const { fileSizeObj } = React.useContext(FileContext) || {};
|
|
185
185
|
React.useEffect(() => {
|
|
@@ -211,12 +211,12 @@ const TcbFileEcho = ({ fileID }) => {
|
|
|
211
211
|
React.createElement("div", { className: `${CLASS_PREFIX}__item-left` },
|
|
212
212
|
React.createElement(UploadFileStatus, { title: label, size: fileSizeObj[fileID] || '--' })),
|
|
213
213
|
React.createElement("div", { className: `${CLASS_PREFIX}__btn-group` },
|
|
214
|
-
React.createElement(UploadFileAction, { status: "UPLOAD_STATUS_SUCCESS", fileID: fileID, src: src }))));
|
|
214
|
+
React.createElement(UploadFileAction, { disabled: disabled, status: "UPLOAD_STATUS_SUCCESS", fileID: fileID, src: src }))));
|
|
215
215
|
};
|
|
216
216
|
/**
|
|
217
217
|
* 基于 File 上传文件过程组件
|
|
218
218
|
*/
|
|
219
|
-
const TcbFileUpload = ({ file }) => {
|
|
219
|
+
const TcbFileUpload = ({ file, disabled }) => {
|
|
220
220
|
const { uploadPath, onChange, events } = React.useContext(FileContext) || {};
|
|
221
221
|
const [percent, setPercent] = React.useState(0); // 上传进度
|
|
222
222
|
const [status, setStatus] = React.useState('UPLOAD_STATUS_PENDING'); // 上传状态
|
|
@@ -262,7 +262,7 @@ const TcbFileUpload = ({ file }) => {
|
|
|
262
262
|
React.createElement(UploadFileAction, { file: file, uuid: file === null || file === void 0 ? void 0 : file._uuid, status: status, onCancel: (uuid) => {
|
|
263
263
|
cancleRef.current = uuid;
|
|
264
264
|
onChange === null || onChange === void 0 ? void 0 : onChange({ type: 'delete', uuid });
|
|
265
|
-
}, onReLoad: handleUpload }))));
|
|
265
|
+
}, onReLoad: handleUpload, disabled: disabled }))));
|
|
266
266
|
};
|
|
267
267
|
/**
|
|
268
268
|
* 上传文件状态组件
|
|
@@ -281,7 +281,9 @@ const UploadFileStatus = ({ status = 'UPLOAD_STATUS_SUCCESS', percent = 0, size,
|
|
|
281
281
|
React.createElement(Progress, { percent: percent, theme: "default", strokeColor: '#0052D9', className: `${CLASS_PREFIX}__file-progress` })))),
|
|
282
282
|
React.createElement("div", { className: `${CLASS_PREFIX}__file-foot` },
|
|
283
283
|
React.createElement("div", null,
|
|
284
|
-
React.createElement(Text, null,
|
|
284
|
+
React.createElement(Text, null,
|
|
285
|
+
Math.floor(percentSize),
|
|
286
|
+
"K/"),
|
|
285
287
|
React.createElement(Text, null, size)),
|
|
286
288
|
React.createElement(Text, null, status === 'UPLOAD_STATUS_PENDING' ? '等待上传' : '上传中'))));
|
|
287
289
|
}
|
|
@@ -302,18 +304,18 @@ const UploadFileStatus = ({ status = 'UPLOAD_STATUS_SUCCESS', percent = 0, size,
|
|
|
302
304
|
* 操作列组件, onChange 从最外层 UploadFilePc 传进来
|
|
303
305
|
* props: { status, fileID, uuid, src, onChange }
|
|
304
306
|
*/
|
|
305
|
-
const UploadFileAction = ({ status = 'UPLOAD_STATUS_PENDING', fileID = '', uuid = '', src = '', file = null, onReLoad = null, onCancel = null, }) => {
|
|
307
|
+
const UploadFileAction = ({ status = 'UPLOAD_STATUS_PENDING', fileID = '', uuid = '', src = '', file = null, onReLoad = null, onCancel = null, disabled, }) => {
|
|
306
308
|
const { onChange, downloadVisible, deleteVisible, isEdit } = React.useContext(FileContext) || {};
|
|
307
309
|
// 操作列按钮-删除
|
|
308
|
-
const renderDelete = () => isEdit && (React.createElement(
|
|
310
|
+
const renderDelete = () => isEdit && (React.createElement(Button, { icon: "delete", onClick: () => onChange === null || onChange === void 0 ? void 0 : onChange({ fileID, uuid, type: 'delete' }), disabled: disabled }));
|
|
309
311
|
// 操作列按钮-取消
|
|
310
|
-
const renderCancel = () => isEdit &&
|
|
312
|
+
const renderCancel = () => isEdit && React.createElement(Button, { icon: "dismiss", onClick: () => onCancel === null || onCancel === void 0 ? void 0 : onCancel(uuid) });
|
|
311
313
|
// 操作列按钮-重新上传
|
|
312
|
-
const renderReLoad = () => isEdit && (React.createElement(
|
|
314
|
+
const renderReLoad = () => isEdit && (React.createElement(Button, { icon: "refresh", onClick: () => {
|
|
313
315
|
onReLoad === null || onReLoad === void 0 ? void 0 : onReLoad(file);
|
|
314
316
|
} }));
|
|
315
317
|
// 操作列按钮-下载
|
|
316
|
-
const renderDownLoad = () => (React.createElement(
|
|
318
|
+
const renderDownLoad = () => (React.createElement(Button, { icon: "download", onClick: () => downloadFile(src) }));
|
|
317
319
|
switch (status) {
|
|
318
320
|
case 'UPLOAD_STATUS_PENDING':
|
|
319
321
|
return renderCancel();
|
|
@@ -156,8 +156,8 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
156
156
|
React.createElement("div", { className: `${CLASS_PREFIX}--item-size ${CLASS_PREFIX}--item-label` }, "\u5927\u5C0F"),
|
|
157
157
|
React.createElement("div", { className: `${CLASS_PREFIX}--item-status ${CLASS_PREFIX}--item-label` }, "\u72B6\u6001"),
|
|
158
158
|
React.createElement("div", { className: `${CLASS_PREFIX}--item-action` }, "\u64CD\u4F5C"))),
|
|
159
|
-
fileIDList.map((d) => (React.createElement(List.Item, { key: d }, React.createElement(TcbFileEcho, { fileID: d })))),
|
|
160
|
-
fileList.map((item) => (React.createElement(List.Item, { key: item === null || item === void 0 ? void 0 : item._uuid }, React.createElement(TcbFileUpload, { file: item })))),
|
|
159
|
+
fileIDList.map((d) => (React.createElement(List.Item, { key: d }, React.createElement(TcbFileEcho, { disabled: disabled, fileID: d })))),
|
|
160
|
+
fileList.map((item) => (React.createElement(List.Item, { key: item === null || item === void 0 ? void 0 : item._uuid }, React.createElement(TcbFileUpload, { disabled: disabled, file: item })))),
|
|
161
161
|
isEdit && fileIDList.length === 0 && fileList.length === 0 && (React.createElement(List.Item, { className: `${CLASS_PREFIX}--item-empty` },
|
|
162
162
|
React.createElement("div", { className: `${CLASS_PREFIX}--item` },
|
|
163
163
|
"\u70B9\u51FB\u4E0A\u65B9\u201C",
|
|
@@ -175,7 +175,7 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
175
175
|
/**
|
|
176
176
|
* 基于 FileID 回显文件表格行组件
|
|
177
177
|
*/
|
|
178
|
-
const TcbFileEcho = ({ fileID }) => {
|
|
178
|
+
const TcbFileEcho = ({ fileID, disabled }) => {
|
|
179
179
|
const [src, setSrc] = React.useState('');
|
|
180
180
|
const { fileSizeObj } = React.useContext(FileContext) || {};
|
|
181
181
|
React.useEffect(() => {
|
|
@@ -207,12 +207,12 @@ const TcbFileEcho = ({ fileID }) => {
|
|
|
207
207
|
React.createElement("div", { className: `${CLASS_PREFIX}--item-status` },
|
|
208
208
|
React.createElement(UploadFileStatus, null)),
|
|
209
209
|
React.createElement("div", { className: `${CLASS_PREFIX}--item-action` },
|
|
210
|
-
React.createElement(UploadFileAction, { status: "2", fileID: fileID, src: src }))));
|
|
210
|
+
React.createElement(UploadFileAction, { disabled: disabled, status: "2", fileID: fileID, src: src }))));
|
|
211
211
|
};
|
|
212
212
|
/**
|
|
213
213
|
* 基于 File 上传文件过程表格行组件
|
|
214
214
|
*/
|
|
215
|
-
const TcbFileUpload = ({ file }) => {
|
|
215
|
+
const TcbFileUpload = ({ file, disabled }) => {
|
|
216
216
|
const { uploadPath, onChange, events } = React.useContext(FileContext) || {};
|
|
217
217
|
const [percent, setPercent] = React.useState(0); // 上传进度
|
|
218
218
|
const [status, setStatus] = React.useState('0'); // 上传状态
|
|
@@ -259,7 +259,7 @@ const TcbFileUpload = ({ file }) => {
|
|
|
259
259
|
React.createElement(UploadFileAction, { file: file, uuid: file === null || file === void 0 ? void 0 : file._uuid, status: status, onCancel: (uuid) => {
|
|
260
260
|
cancleRef.current = uuid;
|
|
261
261
|
onChange === null || onChange === void 0 ? void 0 : onChange({ type: 'delete', uuid });
|
|
262
|
-
}, onReLoad: handleUpload }))));
|
|
262
|
+
}, disabled: disabled, onReLoad: handleUpload }))));
|
|
263
263
|
};
|
|
264
264
|
/**
|
|
265
265
|
* 上传文件状态组件
|
|
@@ -281,11 +281,11 @@ const UploadFileStatus = ({ status = '2', percent = 0 }) => {
|
|
|
281
281
|
* 操作列组件, onChange 从最外层 UploadFilePc 传进来
|
|
282
282
|
* props: { status, fileID, uuid, src, onChange }
|
|
283
283
|
*/
|
|
284
|
-
const UploadFileAction = ({ status = '0', fileID = '', uuid = '', src = '', file = null, onReLoad = null, onCancel = null, }) => {
|
|
284
|
+
const UploadFileAction = ({ status = '0', fileID = '', uuid = '', src = '', file = null, onReLoad = null, onCancel = null, disabled, }) => {
|
|
285
285
|
const { onChange, downloadVisible, deleteVisible, isEdit } = React.useContext(FileContext) || {};
|
|
286
286
|
// 操作列按钮-删除
|
|
287
287
|
const renderDelete = () => isEdit &&
|
|
288
|
-
deleteVisible && (React.createElement(Button, { type: "link", onClick: () => onChange === null || onChange === void 0 ? void 0 : onChange({ fileID, uuid, type: 'delete' }) }, "\u5220\u9664"));
|
|
288
|
+
deleteVisible && (React.createElement(Button, { type: "link", disabled: disabled, onClick: () => onChange === null || onChange === void 0 ? void 0 : onChange({ fileID, uuid, type: 'delete' }) }, "\u5220\u9664"));
|
|
289
289
|
// 操作列按钮-取消
|
|
290
290
|
const renderCancel = () => isEdit && (React.createElement(Button, { onClick: () => onCancel === null || onCancel === void 0 ? void 0 : onCancel(uuid), type: "link" }, "\u53D6\u6D88"));
|
|
291
291
|
// 操作列按钮-重新上传
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { SearchBox, Status, Tree, LoadingTip, Button } from 'tea-component';
|
|
3
|
+
import { getNode, dealUserData, dealOrgData } from './utils';
|
|
4
|
+
export const DimTreeContent = (props) => {
|
|
5
|
+
const { selectedIds, onSelect, onActive, activeIds, treeClassName, data: treeData, setTreeData, onCancel, onConfirm, needUser, onReset, request, errorInfo = { errorStatus: false, errorMessage: '' }, } = props;
|
|
6
|
+
//const commonParams = [callWedaApi, showToast, showError];
|
|
7
|
+
const [loading, setLoading] = useState(false);
|
|
8
|
+
const [errInfo, setErrInfo] = useState(errorInfo);
|
|
9
|
+
const loadDepartData = async (id) => {
|
|
10
|
+
const node = getNode(treeData, id, 'id');
|
|
11
|
+
if (node.children) {
|
|
12
|
+
//resolve();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
// 部门
|
|
17
|
+
const { Orgs = [], Users = [] } = await request('LazyDescribeOrgs', {
|
|
18
|
+
OrgId: node.orgId,
|
|
19
|
+
DescribeCondition: {
|
|
20
|
+
NeedUser: !!needUser,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
// 如果不存在数据
|
|
24
|
+
if (!(Orgs === null || Orgs === void 0 ? void 0 : Orgs.length) && !(Users === null || Users === void 0 ? void 0 : Users.length)) {
|
|
25
|
+
node.expandable = false;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
//@ts-ignore jsx
|
|
29
|
+
const children = dealOrgData(Orgs).concat(needUser ? dealUserData(Users) : []);
|
|
30
|
+
Object.assign(node, { children });
|
|
31
|
+
}
|
|
32
|
+
setTreeData([...treeData]);
|
|
33
|
+
// resolve();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
//reject(error);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
// 根据关键词搜索
|
|
42
|
+
// const { run: runSearch, loading: searchLoading } = useRequest(searchByCondition, {
|
|
43
|
+
// manual: true,
|
|
44
|
+
// });
|
|
45
|
+
// 搜索
|
|
46
|
+
const search = async (key) => {
|
|
47
|
+
try {
|
|
48
|
+
setErrInfo({ errorStatus: false, errorMessage: null });
|
|
49
|
+
let resData = [];
|
|
50
|
+
if (key) {
|
|
51
|
+
setLoading(true);
|
|
52
|
+
const { Orgs = [], Users = [] } = await request('SearchByCondition', {
|
|
53
|
+
KeyWords: key,
|
|
54
|
+
SearchCondition: {
|
|
55
|
+
SearchType: 'SearchByOrg',
|
|
56
|
+
NeedUser: needUser,
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
// ...commonParams,
|
|
60
|
+
);
|
|
61
|
+
setLoading(false);
|
|
62
|
+
//@ts-ignore jsx
|
|
63
|
+
resData = dealOrgData(Orgs).concat(needUser ? dealUserData(Users) : []);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
resData = dealOrgData((await request('SearchByCondition', {})) || []);
|
|
67
|
+
}
|
|
68
|
+
setTreeData(resData);
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
setLoading(false);
|
|
72
|
+
setErrInfo({ errorStatus: true, errorMessage: e });
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return (React.createElement(React.Fragment, null,
|
|
76
|
+
React.createElement(SearchBox, { onSearch: search, onClear: () => onReset(), onChange: (val) => !val && onReset() }),
|
|
77
|
+
React.createElement("div", { className: "tree-search-loading" }, loading && React.createElement(LoadingTip, null)),
|
|
78
|
+
(errInfo === null || errInfo === void 0 ? void 0 : errInfo.errorStatus) && (React.createElement(ErrorStatus, { size: "l", title: "\u63A5\u53E3\u8C03\u7528\u5931\u8D25", description: (errInfo === null || errInfo === void 0 ? void 0 : errInfo.errorMessage) || null })),
|
|
79
|
+
!(treeData === null || treeData === void 0 ? void 0 : treeData.length) && !loading && !(errInfo === null || errInfo === void 0 ? void 0 : errInfo.errorStatus) && (React.createElement(Status, { className: "dim-tree-select--blank", icon: 'blank', size: 's', title: `暂无${needUser ? '成员' : '部门'}数据` })),
|
|
80
|
+
!!(treeData === null || treeData === void 0 ? void 0 : treeData.length) && !loading && !(errInfo === null || errInfo === void 0 ? void 0 : errInfo.errorStatus) && (React.createElement(React.Fragment, null,
|
|
81
|
+
React.createElement("div", { className: "tree-select-warp" },
|
|
82
|
+
React.createElement(Tree, { selectable: false, selectStrictly: true, activable: true, activeIds: activeIds, selectedIds: selectedIds, data: treeData, onLoad: loadDepartData, onActive: onActive, onSelect: onSelect, className: `tree-select ${treeClassName}` })),
|
|
83
|
+
React.createElement("div", { className: "dim-tree-footer" },
|
|
84
|
+
React.createElement(Button, { type: "weak", className: "din-btn din-btn--cancle", onClick: onCancel }, "\u53D6\u6D88"),
|
|
85
|
+
React.createElement(Button, { type: "primary", className: "din-btn din-btn--primary", onClick: onConfirm }, "\u786E\u5B9A"))))));
|
|
86
|
+
};
|
|
87
|
+
export const ErrorStatus = ({ size, title, description }) => {
|
|
88
|
+
return (React.createElement(Status, { className: "dim-tree-select--blank", icon: 'blank', size: size, title: title, description: description }));
|
|
89
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CommonFormPropsType } from '../../types';
|
|
3
|
+
import '../userOrgSelect.less';
|
|
4
|
+
export declare function DepartTreeSelectH5({ id, className, style, events, label, labelVisible, name, placeholder, defaultValueType, defaultValue, confirmValue, disabled, layout, requiredFlag, size, decorator, request, multiple, onChange, focus: autoFocus, getDepartByIdRequest, }: IDepartTreeSelec): JSX.Element;
|
|
5
|
+
export interface IDepartTreeSelec extends CommonFormPropsType {
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
confirmValue?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
defaultValueType?: 'noneDepart' | 'confirmDepart';
|
|
10
|
+
maxLength?: number;
|
|
11
|
+
focus?: boolean;
|
|
12
|
+
size?: 's' | 'm' | 'l' | 'full';
|
|
13
|
+
clearable?: boolean;
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
relation?: object;
|
|
16
|
+
isMuti?: boolean;
|
|
17
|
+
onChange?: (v: any) => void;
|
|
18
|
+
request?: any;
|
|
19
|
+
getDepartByIdRequest?: (v: any) => any;
|
|
20
|
+
}
|