@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
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import classNames from '../../../../utils/classnames';
|
|
4
|
+
import { noop } from '../../../../utils/constant';
|
|
5
|
+
import { useSyncValue } from '../../../../utils/hooks/useSyncValue';
|
|
6
|
+
import { alertErrorMessage } from '../../../../utils/platform';
|
|
7
|
+
import { PureSelect } from './index';
|
|
8
|
+
const transformValue = (value) => {
|
|
9
|
+
return value ? value : null;
|
|
10
|
+
};
|
|
11
|
+
export function PureSelectPc(props) {
|
|
12
|
+
const { size, onChange, value, placeholder, params, disabled } = props;
|
|
13
|
+
const previousValueRef = useRef();
|
|
14
|
+
return (_jsx(PureSelect, { isShow: false, params: params, placeholder: placeholder, size: size, selectedValue: value, disabled: disabled, updateValue: (value) => {
|
|
15
|
+
if (previousValueRef.current != transformValue(value)) {
|
|
16
|
+
if (value.length > 50) {
|
|
17
|
+
alertErrorMessage({
|
|
18
|
+
message: '最多选择50条数据',
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
onChange(value);
|
|
23
|
+
}
|
|
24
|
+
previousValueRef.current = value;
|
|
25
|
+
}
|
|
26
|
+
}, closeModal: undefined, allOption: () => { } }));
|
|
27
|
+
}
|
|
28
|
+
export function PureSelectH5(props) {
|
|
29
|
+
const { placeholder, name, disabled, onChange = noop, layout, className, params, } = props;
|
|
30
|
+
const [value, setValue] = useSyncValue(props.value);
|
|
31
|
+
const [currentMultiLabels, setCurrentMultiLabels] = useState([]);
|
|
32
|
+
const [allOption, setAllOption] = useState([]);
|
|
33
|
+
const [isShow, setIsShow] = useState(false);
|
|
34
|
+
const subCls = classNames({
|
|
35
|
+
'weui-cell': true,
|
|
36
|
+
'weui-cell_active': true,
|
|
37
|
+
'weui-cell_form': true,
|
|
38
|
+
'weui-flex__item': layout !== 'vertical',
|
|
39
|
+
'weui-cell_disabled': disabled,
|
|
40
|
+
}, className);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
var _a;
|
|
43
|
+
const labels = [];
|
|
44
|
+
if (value && !((_a = props === null || props === void 0 ? void 0 : props.params) === null || _a === void 0 ? void 0 : _a.dataSourceName)) {
|
|
45
|
+
Array.isArray(value) &&
|
|
46
|
+
value.forEach((item) => {
|
|
47
|
+
const obj = props.params.controlledValue.find((el) => el.value === item);
|
|
48
|
+
obj && labels.push(obj.label);
|
|
49
|
+
});
|
|
50
|
+
setCurrentMultiLabels(labels);
|
|
51
|
+
}
|
|
52
|
+
}, [value, props.params]);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const label = [];
|
|
55
|
+
Array.isArray(value) &&
|
|
56
|
+
value.forEach((item) => {
|
|
57
|
+
const obj = allOption.find((el) => el.value === item);
|
|
58
|
+
obj && label.push(obj.label);
|
|
59
|
+
});
|
|
60
|
+
setCurrentMultiLabels(label);
|
|
61
|
+
}, [allOption, value]);
|
|
62
|
+
// 选择回调
|
|
63
|
+
const onChooseCallback = (option) => {
|
|
64
|
+
if (!option || Object.keys(option).length === 0) {
|
|
65
|
+
setValue([]);
|
|
66
|
+
onChange([]);
|
|
67
|
+
setCurrentMultiLabels([]);
|
|
68
|
+
setIsShow(false);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
if (typeof value === 'object') {
|
|
72
|
+
const arr = value;
|
|
73
|
+
// const labels = currentMultiLabels;
|
|
74
|
+
const obj = arr.find((item) => item === option.value);
|
|
75
|
+
if (obj) {
|
|
76
|
+
// const labelIndex = currentMultiLabels.indexOf(option.label);
|
|
77
|
+
// labels.splice(labelIndex, 1);
|
|
78
|
+
const valueIndex = value.indexOf(option.value);
|
|
79
|
+
arr.splice(valueIndex, 1);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// labels.push(option?.label);
|
|
83
|
+
arr.push(option === null || option === void 0 ? void 0 : option.value);
|
|
84
|
+
}
|
|
85
|
+
const label = [];
|
|
86
|
+
arr.forEach((item) => {
|
|
87
|
+
const obj = allOption.find((el) => el.value === item);
|
|
88
|
+
obj && label.push(obj.label);
|
|
89
|
+
});
|
|
90
|
+
setCurrentMultiLabels(label);
|
|
91
|
+
setValue(arr);
|
|
92
|
+
onChange(arr);
|
|
93
|
+
// setCurrentMultiLabels(labels);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const onClick = () => {
|
|
98
|
+
setIsShow(true);
|
|
99
|
+
};
|
|
100
|
+
const close = () => {
|
|
101
|
+
setIsShow(false);
|
|
102
|
+
};
|
|
103
|
+
const getAllOption = (val) => {
|
|
104
|
+
setAllOption(val);
|
|
105
|
+
};
|
|
106
|
+
return (_jsxs("div", { children: [_jsx("div", { className: subCls, children: _jsxs("div", { className: "weui-cell__bd weui-flex select-picker", children: [_jsx("div", { style: { width: '100%' }, onClick: disabled ? null : onClick, children: _jsx("input", { className: "weui-input multiple weda-ui-show-label",
|
|
107
|
+
// style={{
|
|
108
|
+
// display: currentMultiLabels.length > 0 ? 'none' : 'block',
|
|
109
|
+
// }}
|
|
110
|
+
type: "select", name: name, placeholder: placeholder, value: currentMultiLabels, disabled: disabled, autoComplete: 'off', readOnly: true, "data-testid": "form-item-select-multiple" }) }), currentMultiLabels.length > 0 && (_jsx("span", { className: 'weui-input-clear', onClick: () => {
|
|
111
|
+
onChooseCallback(undefined);
|
|
112
|
+
} })), _jsx("span", { className: 'weui-input-arrow' })] }) }), _jsx(PureSelect, { params: params, updateValue: onChooseCallback, selectedValue: value, isShow: isShow, size: undefined, disabled: undefined, placeholder: undefined, closeModal: close, allOption: getAllOption })] }));
|
|
113
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { defaultProps } from './index';
|
|
4
|
+
import { emptyObject } from '../../../utils/constant';
|
|
5
|
+
import { PureSelectH5 } from './dropdown-select/ui';
|
|
6
|
+
export default function SelectH5({ events = emptyObject, name, placeholder, disabled = false, range = defaultProps.range, primaryField, dataSourceName, format, onChange, defaultValue, }) {
|
|
7
|
+
const [selectedValue, setSelectedValue] = React.useState(defaultValue);
|
|
8
|
+
// 两次默认值不同, 需要刷新;
|
|
9
|
+
const prevDefaultRef = React.useRef({});
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
var _a;
|
|
12
|
+
let hasChange = false;
|
|
13
|
+
if (((_a = prevDefaultRef.current) === null || _a === void 0 ? void 0 : _a.defaultValue) !== defaultValue) {
|
|
14
|
+
setSelectedValue(defaultValue);
|
|
15
|
+
hasChange = true;
|
|
16
|
+
}
|
|
17
|
+
if (hasChange) {
|
|
18
|
+
prevDefaultRef.current = {
|
|
19
|
+
defaultValue,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
let params = {
|
|
24
|
+
controlledValue: range,
|
|
25
|
+
};
|
|
26
|
+
if (format === 'many-many' || format === 'one-many') {
|
|
27
|
+
params = {
|
|
28
|
+
format,
|
|
29
|
+
dataSourceName,
|
|
30
|
+
primaryField,
|
|
31
|
+
controlledValue: range,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return (_jsx(PureSelectH5, { className: "weda-ui weda-picker", name: name, value: selectedValue, placeholder: placeholder, disabled: disabled, params: params, onChange: (value) => {
|
|
35
|
+
var _a;
|
|
36
|
+
setSelectedValue(value);
|
|
37
|
+
(_a = events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
|
|
38
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
39
|
+
} }));
|
|
40
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { usePlatform } from '../../../utils/platform';
|
|
4
|
+
import SelectH5 from './h5';
|
|
5
|
+
import classNames from '../../../utils/classnames';
|
|
6
|
+
import { ConfigProvider } from 'tea-component';
|
|
7
|
+
import { renderDecorator } from '../renderDecorator';
|
|
8
|
+
import { emptyObject } from '../../../utils/constant';
|
|
9
|
+
import { CommonErrorBoundary } from '../../common/error-boundary';
|
|
10
|
+
import { useLoopRenderDetect } from '../../common/use-loop-render-detect';
|
|
11
|
+
import { PureSelectPc } from './dropdown-select/ui';
|
|
12
|
+
export default function SelectMultiple(props) {
|
|
13
|
+
return (_jsx(CommonErrorBoundary, { children: _jsx(SelectImpl, { ...props }) }));
|
|
14
|
+
}
|
|
15
|
+
function SelectImpl(props) {
|
|
16
|
+
const { id, style, className, label = '标题', labelVisible = true, layout = 'horizontal', requiredFlag = false, size = 'l', decorator, } = props;
|
|
17
|
+
const platform = usePlatform();
|
|
18
|
+
useLoopRenderDetect();
|
|
19
|
+
let selectEl;
|
|
20
|
+
if (platform === 'h5') {
|
|
21
|
+
selectEl = _jsx(SelectH5, { ...props });
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
selectEl = _jsx(SelectPc, { ...props });
|
|
25
|
+
}
|
|
26
|
+
const cls = classNames({
|
|
27
|
+
'weda-ui': true,
|
|
28
|
+
'weda-select': true,
|
|
29
|
+
[className]: className,
|
|
30
|
+
});
|
|
31
|
+
return renderDecorator(selectEl, decorator)({
|
|
32
|
+
id,
|
|
33
|
+
className: cls,
|
|
34
|
+
style,
|
|
35
|
+
label: labelVisible ? label : null,
|
|
36
|
+
layout,
|
|
37
|
+
multiCell: false,
|
|
38
|
+
requiredFlag,
|
|
39
|
+
size,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export const defaultProps = {
|
|
43
|
+
// 系统属性
|
|
44
|
+
events: {},
|
|
45
|
+
// 组件属性
|
|
46
|
+
label: '标题',
|
|
47
|
+
size: 'l',
|
|
48
|
+
labelVisible: true,
|
|
49
|
+
name: 'formSelectMultiple',
|
|
50
|
+
placeholder: '请选择',
|
|
51
|
+
layout: 'horizontal',
|
|
52
|
+
disabled: false,
|
|
53
|
+
requiredFlag: false,
|
|
54
|
+
range: [{ name: '选项1', value: '1' }],
|
|
55
|
+
};
|
|
56
|
+
function SelectPc({ dataSourceName, format, primaryField, defaultValue, placeholder = '请选择', events = emptyObject, disabled = false, range = defaultProps.range, size = defaultProps.size, onChange, }) {
|
|
57
|
+
// 两次默认值不同, 需要刷新
|
|
58
|
+
const prevDefaultRef = React.useRef();
|
|
59
|
+
const [selectedValue, setSelectedValue] = React.useState(defaultValue);
|
|
60
|
+
let params = {
|
|
61
|
+
controlledValue: range,
|
|
62
|
+
};
|
|
63
|
+
if (format === 'many-many' || format === 'one-many') {
|
|
64
|
+
params = {
|
|
65
|
+
format,
|
|
66
|
+
dataSourceName,
|
|
67
|
+
primaryField,
|
|
68
|
+
controlledValue: range,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
var _a;
|
|
73
|
+
let hasChange = false;
|
|
74
|
+
if (((_a = prevDefaultRef.current) === null || _a === void 0 ? void 0 : _a.defaultValue) !== defaultValue) {
|
|
75
|
+
setSelectedValue(defaultValue);
|
|
76
|
+
hasChange = true;
|
|
77
|
+
}
|
|
78
|
+
if (hasChange) {
|
|
79
|
+
prevDefaultRef.current = {
|
|
80
|
+
defaultValue,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const createDropdown = () => {
|
|
85
|
+
return (_jsx(PureSelectPc, { params: params, disabled: disabled, placeholder: placeholder, size: size, value: selectedValue, onChange: (value) => {
|
|
86
|
+
var _a;
|
|
87
|
+
onChange && onChange(value);
|
|
88
|
+
(_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
|
|
89
|
+
setSelectedValue(value);
|
|
90
|
+
} }));
|
|
91
|
+
};
|
|
92
|
+
const dropdown = createDropdown();
|
|
93
|
+
return _jsx(ConfigProvider, { classPrefix: "wedatea2td", children: dropdown });
|
|
94
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { getWhereList } from '../../../utils/platform';
|
|
2
|
+
import { callDataSource } from '../../../utils/tcb';
|
|
3
|
+
export const formatNeedDataFetch = ['many-many', 'one-many'];
|
|
4
|
+
export const PAGE_SIZE = 200;
|
|
5
|
+
export const RequestOptionType = {
|
|
6
|
+
ALL: 0,
|
|
7
|
+
SEARCH: 1,
|
|
8
|
+
EQUAL: 2,
|
|
9
|
+
};
|
|
10
|
+
function isEmpty(s) {
|
|
11
|
+
if (s == null || s === '') {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
export const requestFatherRelatedOption = async (params, pageNo, type, searchValue) => {
|
|
17
|
+
const { dataSourceName, where, primaryField } = params;
|
|
18
|
+
const empty = {
|
|
19
|
+
option: [],
|
|
20
|
+
isLoadMore: false,
|
|
21
|
+
};
|
|
22
|
+
if (isEmpty(dataSourceName)) {
|
|
23
|
+
return empty;
|
|
24
|
+
}
|
|
25
|
+
let realWhere;
|
|
26
|
+
if (type === RequestOptionType.SEARCH) {
|
|
27
|
+
realWhere = [{ key: primaryField, val: searchValue, rel: 'search' }];
|
|
28
|
+
}
|
|
29
|
+
else if (type === RequestOptionType.EQUAL) {
|
|
30
|
+
realWhere = [{ key: '_id', val: searchValue, rel: 'eq' }];
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
realWhere = [].concat(getWhereList(where));
|
|
34
|
+
}
|
|
35
|
+
const data = await callDataSource({
|
|
36
|
+
dataSourceName: dataSourceName,
|
|
37
|
+
methodName: 'wedaGetRecords',
|
|
38
|
+
params: {
|
|
39
|
+
pageNo: pageNo,
|
|
40
|
+
pageSize: PAGE_SIZE,
|
|
41
|
+
where: realWhere,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
const results = data === null || data === void 0 ? void 0 : data.records;
|
|
45
|
+
if (primaryField) {
|
|
46
|
+
if (results && results.length !== 0) {
|
|
47
|
+
const option = results.map((item) => {
|
|
48
|
+
return {
|
|
49
|
+
label: item[primaryField] || item._id,
|
|
50
|
+
value: item._id,
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
option,
|
|
55
|
+
isLoadMore: results.length === PAGE_SIZE,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (results && results.length === 0) {
|
|
59
|
+
return empty;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const defaultData = results === null || results === void 0 ? void 0 : results.map((opt) => ({
|
|
63
|
+
option: [{ label: opt._id, value: opt._id }],
|
|
64
|
+
})); // 兜底 正常来说一定有primaryField
|
|
65
|
+
return !isEmpty(defaultData)
|
|
66
|
+
? { option: defaultData, isLoadMore: false }
|
|
67
|
+
: Promise.reject('network error');
|
|
68
|
+
};
|
|
69
|
+
export const transFormatTeaSelectKey = (options) => {
|
|
70
|
+
return options.map((item) => {
|
|
71
|
+
return {
|
|
72
|
+
value: item.value,
|
|
73
|
+
text: item.label,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import './index.css';
|
|
4
|
+
import { usePlatform } from '../../../../utils/platform';
|
|
5
|
+
export default function Empty({ height }) {
|
|
6
|
+
const platform = usePlatform();
|
|
7
|
+
const loadingHeight = useMemo(() => {
|
|
8
|
+
if (height) {
|
|
9
|
+
return height;
|
|
10
|
+
}
|
|
11
|
+
if (platform === 'h5') {
|
|
12
|
+
return '48px';
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return '21px';
|
|
16
|
+
}
|
|
17
|
+
}, [platform]);
|
|
18
|
+
return (_jsx("div", { className: "weda-ui-custom-picker__status weda-ui-custom-picker__status--empty", style: { height: loadingHeight, lineHeight: loadingHeight }, children: "\u6682\u65E0\u6570\u636E" }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.weda-ui-custom-picker__empty {
|
|
2
|
+
color: rgba(0, 0, 0, 0.4);
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
font-size: 15px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.weda-ui-custom-picker__status {
|
|
12
|
+
left: 16px;
|
|
13
|
+
color: rgba(0, 0, 0, 0.4);
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
height: 48px;
|
|
16
|
+
line-height: 48px;
|
|
17
|
+
display: flex;
|
|
18
|
+
vertical-align: middle;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.weda-ui-custom-picker__status--loading {
|
|
22
|
+
color: #0052d9;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.weda-ui-custom-picker__status--empty {
|
|
28
|
+
color: #00000042;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.weda-ui-custom-picker__loading-icon {
|
|
32
|
+
width: 20px;
|
|
33
|
+
height: 20px;
|
|
34
|
+
display: inline-block;
|
|
35
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAsQSURBVHgB7Vp9bJVXGX/Ox3tvW0qhpViQD0cZmWxuLBsYzRwRExOzhM2POOMSItkyJ3OwzcXonzNRY0YcySYgjoVNnfvDBLdM5jaNzEQSNs2IRBxzjAmM0gJe2tvS+/We8/h7zrkFYu7tF23Jkj70ct77vn3f9/zO7/k+JZqWaZmWaZlEUTRJsm5z94yuSnpDUk7np5R0OvYz2XMLKaW8I5Uyn2b23UR8RLvSW/se+3g/TYJMKEAB1ZuWb2evr3dMKzyzZibtPWuPd3lPhom083ivxxiuK4xyzR8hpj1e69cPPLa4iyZIJgTgVx4/dR1X6Gtg5IYwWZk4QOE4TB7HRs4BF8AqRXLeeXzXEaQLCxDukYVgT78vJnr7OxMA9LIAfnMHN+X6T67HHNeQx4RZCzjjPCvGmFJkSsC5wCQYFOYiCDApwJUKrDpvCMcCODKuhP0XU222/XvLopM0Thk3wHWPd62sMG/AvGc4AUfCDCbsg0rKSI5kxGQjk8JeOPZVRl0AryJzHBdCrkFtVZVxY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|
|
37
|
+
animation: rotate360 0.8s linear infinite;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@keyframes rotate360 {
|
|
41
|
+
0% {
|
|
42
|
+
transform: rotate(0deg);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
100% {
|
|
46
|
+
transform: rotate(360deg);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.weda-ui-custom-picker__status--loading .weda-ui-custom-picker__loading-icon {
|
|
51
|
+
margin-right: 8px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.weda-ui-custom-picker__btn {
|
|
55
|
+
background-color: transparent;
|
|
56
|
+
border: none;
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
margin-left: 8px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.weda-ui-custom-picker__btn--link {
|
|
62
|
+
color: #0052d9;
|
|
63
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import './index.css';
|
|
4
|
+
import { usePlatform } from '../../../../utils/platform';
|
|
5
|
+
export default function Loading({ height }) {
|
|
6
|
+
const platform = usePlatform();
|
|
7
|
+
const loadingHeight = useMemo(() => {
|
|
8
|
+
if (height) {
|
|
9
|
+
return height;
|
|
10
|
+
}
|
|
11
|
+
if (platform === 'h5') {
|
|
12
|
+
return '48px';
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return '21px';
|
|
16
|
+
}
|
|
17
|
+
}, [platform]);
|
|
18
|
+
return (_jsxs("div", { className: "weda-ui-custom-picker__status weda-ui-custom-picker__status--loading", style: { height: loadingHeight }, children: [_jsx("i", { className: "weda-ui-custom-picker__loading-icon" }), "\u52A0\u8F7D\u4E2D..."] }));
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import './index.css';
|
|
4
|
+
import { usePlatform } from '../../../../utils/platform';
|
|
5
|
+
export default function Retry({ reTry, height }) {
|
|
6
|
+
const platform = usePlatform();
|
|
7
|
+
const loadingHeight = useMemo(() => {
|
|
8
|
+
if (height) {
|
|
9
|
+
return height;
|
|
10
|
+
}
|
|
11
|
+
if (platform === 'h5') {
|
|
12
|
+
return '48px';
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return '21px';
|
|
16
|
+
}
|
|
17
|
+
}, [platform]);
|
|
18
|
+
return (_jsxs("div", { className: "weda-ui-custom-picker__status ", style: { height: loadingHeight, lineHeight: loadingHeight }, children: ["\u52A0\u8F7D\u5931\u8D25", _jsx("button", { className: "weda-ui-custom-picker__btn weda-ui-custom-picker__btn--link", onClick: reTry, children: "\u91CD\u8BD5" })] }));
|
|
19
|
+
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
.weda-form .weui-cells__tips_warn {
|
|
2
|
-
color:
|
|
3
|
-
|
|
1
|
+
.weda-form .weda-ui.gsd-h5-react-formitem .weui-cells__tips_warn {
|
|
2
|
+
color: var(--wd-color-text-error);
|
|
3
|
+
font-family: var(--wd-font-family);
|
|
4
|
+
font-size: var(--wd-font-size-default);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.wd-pc-form.weda-form .weda-ui.gsd-h5-react-formitem .weui-cells__tips_warn {
|
|
8
|
+
padding-left: 0;
|
|
9
|
+
padding-right: 0;
|
|
4
10
|
}
|
|
5
11
|
|
|
6
12
|
/* h5 */
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
width: 100%;
|
|
55
55
|
cursor: zoom-in;
|
|
56
56
|
}
|
|
57
|
+
|
|
57
58
|
._weda-fn-upload-result__item .weda-uploader-pc__image {
|
|
58
59
|
width: 100%;
|
|
59
60
|
object-fit: cover;
|
|
@@ -106,6 +107,10 @@
|
|
|
106
107
|
flex: unset;
|
|
107
108
|
}
|
|
108
109
|
|
|
110
|
+
.weui-uploader.horizontal .weui-uploader__title {
|
|
111
|
+
display: inline-block;
|
|
112
|
+
}
|
|
113
|
+
|
|
109
114
|
.weda-ui .weui-uploader.horizontal .weui-uploader__bd {
|
|
110
115
|
padding: 16px 0;
|
|
111
116
|
}
|
|
@@ -127,18 +132,23 @@
|
|
|
127
132
|
width: 6.85714em;
|
|
128
133
|
height: 6.85714em;
|
|
129
134
|
}
|
|
135
|
+
|
|
130
136
|
.weda-ui .img-shape-ectangle {
|
|
131
137
|
border-radius: 0;
|
|
132
138
|
}
|
|
139
|
+
|
|
133
140
|
.weda-ui .img-shape-circular {
|
|
134
141
|
border-radius: 50%;
|
|
135
142
|
}
|
|
143
|
+
|
|
136
144
|
.weda-ui .img-shape-rounded-tectangle {
|
|
137
145
|
border-radius: 6px;
|
|
138
146
|
}
|
|
147
|
+
|
|
139
148
|
.img-shape-circular:before {
|
|
140
149
|
border-radius: 50%;
|
|
141
150
|
}
|
|
151
|
+
|
|
142
152
|
.img-shape-rounded-tectangle:before {
|
|
143
153
|
border-radius: 6px;
|
|
144
154
|
}
|
|
@@ -14,12 +14,12 @@ const uploadPath = 'weda-uploader';
|
|
|
14
14
|
/**
|
|
15
15
|
* H5端
|
|
16
16
|
*/
|
|
17
|
-
export function ImageUploaderH5({ title: label, maxUploadCount, maxSize = 10, acceptTypes = IMAGE_TYPES, className, id, events = emptyObject, layout, defaultValue, single = false, disabled = false, requiredFlag = false, labelVisible = true, onChange, style, imgTypeCls, $node, }) {
|
|
17
|
+
export function ImageUploaderH5({ title: label, maxUploadCount, maxSize = 10, acceptTypes = IMAGE_TYPES, className, id, events = emptyObject, layout: _layout, defaultValue, single = false, disabled = false, requiredFlag = false, labelVisible = true, onChange, style, imgTypeCls, $node, }) {
|
|
18
18
|
var _a;
|
|
19
|
+
const layout = _layout !== 'vertical' ? 'horizontal' : 'vertical';
|
|
20
|
+
const layoutCls = layout === 'horizontal' ? 'weda-formcells weui-flex' : '';
|
|
19
21
|
const cls = classNames({
|
|
20
22
|
'weda-ui': true,
|
|
21
|
-
'weui-cells': true,
|
|
22
|
-
'weui-cells_form': true,
|
|
23
23
|
[className]: className,
|
|
24
24
|
});
|
|
25
25
|
// 上传中
|
|
@@ -148,7 +148,7 @@ export function ImageUploaderH5({ title: label, maxUploadCount, maxSize = 10, ac
|
|
|
148
148
|
const ids = [].concat(fileIdList, result);
|
|
149
149
|
handleChange(ids);
|
|
150
150
|
};
|
|
151
|
-
return (_jsx("div", { className: cls, id: id, style: style, children:
|
|
151
|
+
return (_jsx("div", { className: cls, id: id, style: style, children: _jsxs("div", { className: classNames('weui-uploader weui-cells weui-cells_form weda-formcells', layout, layoutCls), children: [_jsx("div", { className: classNames('weui-uploader__hd', layout), children: _jsx(UploaderLabel, { layout: layout, label: label, labelVisible: labelVisible, currentCount: fileIdList.length, maxCount: finalMaxImgCount, requiredFlag: requiredFlag }) }), _jsxs("div", { className: "weui-uploader__bd", children: [_jsxs("ul", { className: "weui-uploader__files", id: "uploaderFiles", children: [(fileIdList !== null && fileIdList !== void 0 ? fileIdList : []).map((f) => (_jsx(SingleImage, { src: f, deleteBySrc: deleteFile, disabled: disabled, imgTypeCls: imgTypeCls }, f))), fileIdList.length < 1 && formType === 'read' && _jsx(_Fragment, { children: "\u2014" }), uploading && (_jsx("li", { className: `weui-uploader__file weui-uploader__file_status ${imgTypeCls}`, children: _jsxs("div", { className: "weui-uploader__file-content", children: [progress, "%"] }) }))] }), showAdd && formType !== 'read' && (_jsx("div", { className: `weui-uploader__input-box ${imgTypeCls}`, children: !disabled && (_jsx("input", { "data-testid": "uploaderh5_input", id: "uploaderInput", className: "weui-uploader__input", type: "file", accept: accepts.join(','), multiple: !single && !(browserEnv().android && browserEnv().weixin), onChange: uploadChange })) }))] })] }) }));
|
|
152
152
|
}
|
|
153
153
|
function SingleImage({ src, deleteBySrc, disabled, imgTypeCls, }) {
|
|
154
154
|
const cls = classNames({
|
|
@@ -174,7 +174,7 @@ function SingleImage({ src, deleteBySrc, disabled, imgTypeCls, }) {
|
|
|
174
174
|
}
|
|
175
175
|
const UploaderLabel = ({ layout, label, currentCount, maxCount, requiredFlag, labelVisible, }) => {
|
|
176
176
|
if (layout === 'horizontal') {
|
|
177
|
-
return (_jsx(React.Fragment, { children: _jsx(_Fragment, { children: labelVisible && (
|
|
177
|
+
return (_jsx(React.Fragment, { children: _jsx(_Fragment, { children: labelVisible && (_jsx("div", { className: "weda-formcells__label weui-cell", children: _jsxs("div", { children: [requiredFlag && (_jsx("label", { className: "weda-formcells__flag", children: "*" })), _jsx("p", { className: "weui-uploader__title", children: label }), _jsxs("div", { className: "weui-uploader__info", children: [_jsx("span", { id: "uploadCount", children: currentCount }), "/", maxCount] })] }) })) }) }));
|
|
178
178
|
}
|
|
179
|
-
return (_jsx(React.Fragment, { children: _jsx(_Fragment, { children: labelVisible && (_jsxs("div", { className: "weda-formcells__label weui-cell", children: [_jsxs("div", { className: "weui-uploader__label", children: [_jsx("
|
|
179
|
+
return (_jsx(React.Fragment, { children: _jsx(_Fragment, { children: labelVisible && (_jsxs("div", { className: "weda-formcells__label weui-cell", children: [_jsxs("div", { className: "weui-uploader__label", children: [requiredFlag && (_jsx("label", { className: "weda-formcells__flag", children: "*" })), _jsx("p", { className: "weui-uploader__title", children: label })] }), _jsxs("div", { className: "weui-uploader__info", children: [_jsx("span", { id: "uploadCount", children: currentCount }), "/", maxCount] })] })) }) }));
|
|
180
180
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable react/prop-types */
|
|
3
|
+
import * as React from 'react';
|
|
2
4
|
import { usePlatform } from '../../../utils/platform';
|
|
3
5
|
import { UploadFileH5 as UploaderH5 } from './uploadFile.h5';
|
|
4
6
|
import { UploadFilePc } from './uploadFile.pc';
|
|
@@ -80,19 +80,6 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
80
80
|
? ['*']
|
|
81
81
|
: Array.from(new Set(acceptTypes));
|
|
82
82
|
}, [acceptTypes]);
|
|
83
|
-
const islegalType = (files, accepts) => {
|
|
84
|
-
const illegalType = [];
|
|
85
|
-
for (const file of files) {
|
|
86
|
-
if (!accepts.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
87
|
-
illegalType.push(file === null || file === void 0 ? void 0 : file.type);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (illegalType.length > 0) {
|
|
91
|
-
weui.alert('不支持上传' + Array.from(new Set(illegalType)).join(',') + '格式文件');
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
return true;
|
|
95
|
-
};
|
|
96
83
|
// 上传后文件列表 fileIDList 改变事件,'add'|'delete'
|
|
97
84
|
const handleChange = ({ fileID, uuid, type, size }) => {
|
|
98
85
|
// 上传时新增事件
|
|
@@ -129,12 +116,6 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
129
116
|
fileSizeObj,
|
|
130
117
|
}, children: _jsx("div", { "data-testid": "uploadFileH5", className: cls, id: id, style: style, children: _jsxs("div", { className: classNames(`${CLASS_PREFIX}`), children: [isEdit && (_jsx("div", { className: classNames(`${CLASS_PREFIX}__hd`, layout), children: _jsx("div", { children: btnDisabled ? (_jsx(Button, { type: "weak", className: classNames(`${CLASS_PREFIX}__btn--weak`), disabled: btnDisabled, children: btnTitle })) : (_jsxs("div", { children: [_jsx("input", { id: "uploaderInput", type: "file", "data-testid": "button-up", className: "weui-uploader-mobile__input", accept: accepts.join(','), multiple: !single, onChange: (e) => {
|
|
131
118
|
const fileList = [...e.target.files];
|
|
132
|
-
//校验逻辑与图片有出入,文件类型限制为全部时,不设限
|
|
133
|
-
if (!(accepts.includes('*') ||
|
|
134
|
-
accepts.includes('') ||
|
|
135
|
-
accepts.length === 0) &&
|
|
136
|
-
!islegalType(fileList, accepts))
|
|
137
|
-
return;
|
|
138
119
|
if (single && fileList.length > 1) {
|
|
139
120
|
weui.alert(`上传文件总数不能超过1个`);
|
|
140
121
|
return false;
|