@cloudbase/weda-ui 3.4.11 → 3.4.13
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/customer-service.js +3 -0
- package/dist/configs/components/dataView.js +20 -10
- package/dist/configs/components/form-checkbox.js +15 -2
- package/dist/configs/components/form-date.js +1 -1
- package/dist/configs/components/form-depart-tree-select.js +1 -1
- package/dist/configs/components/form-email.js +17 -2
- package/dist/configs/components/form-input.js +17 -2
- package/dist/configs/components/form-location.js +1 -1
- package/dist/configs/components/form-multi-region.js +1 -1
- package/dist/configs/components/form-phone.js +17 -2
- package/dist/configs/components/form-radio.js +15 -2
- package/dist/configs/components/form-rich-text.js +1 -1
- package/dist/configs/components/form-select-multiple.js +362 -0
- package/dist/configs/components/form-select.js +1 -1
- package/dist/configs/components/form-switch.js +16 -3
- package/dist/configs/components/form-text-area.js +15 -2
- package/dist/configs/components/form-time.js +1 -1
- package/dist/configs/components/form-url.js +17 -2
- package/dist/configs/components/form-user-tree-select.js +14 -1
- 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-button.js +3 -0
- 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 +11 -59
- package/dist/configs/components/wd-textarea.js +82 -0
- package/dist/configs/components/wd-tree.js +443 -0
- package/dist/configs/components/web-view.js +3 -0
- package/dist/configs/index.js +24 -1
- package/dist/configs/type-utils/type-form.js +681 -0
- package/dist/docs/common/components/json-schema-view.js +1 -1
- 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/actions/showMessage/index.js +4 -1
- package/dist/web/components/carousel/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 +90 -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/select/dropdown-select/index.js +9 -3
- package/dist/web/components/form/select/h5.js +18 -8
- package/dist/web/components/form/select/index.js +9 -10
- 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 +60 -62
- package/dist/web/components/form/uploader/uploader.pc.js +48 -41
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +8 -33
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +8 -37
- package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +76 -50
- package/dist/web/components/form/userOrgSelect/common/utils.js +24 -8
- package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.js +3 -8
- package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +14 -18
- package/dist/web/components/form/userOrgSelect/component/depart-select/org-modal-pc.js +20 -14
- package/dist/web/components/form/userOrgSelect/component/modal-select-h5.js +1 -1
- package/dist/web/components/form/userOrgSelect/component/org-tree.js +21 -9
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +76 -15
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +2 -7
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +6 -4
- package/dist/web/components/form/userOrgSelect/component/userOrgSelect.css +8 -2
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +25 -51
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +10 -6
- package/dist/web/components/form-input-hooks/index.js +41 -15
- package/dist/web/components/form-select-multiple/index.js +26 -0
- package/dist/web/components/form-upload-file/index.js +0 -1
- package/dist/web/components/form-user-tree-select/index.js +2 -2
- package/dist/web/components/formdetail/index.css +31 -1
- package/dist/web/components/formdetail/index.js +33 -1
- package/dist/web/components/index.js +27 -11
- package/dist/web/components/listView/index.js +20 -5
- package/dist/web/components/navigationBar/common.js +1 -1
- package/dist/web/components/navigationBar/horizontalMenu.js +1 -1
- package/dist/web/components/navigationBar/index.css +11 -0
- package/dist/web/components/navigationBar/index.js +8 -1
- package/dist/web/components/phone/index.js +26 -1
- package/dist/web/components/phoneCode/index.js +3 -1
- 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/table/ImportFileModalByApi/uploadCSVFile.js +1 -1
- 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/hooks/use-remote-value.js +9 -2
- package/dist/web/components/wd-form/index.js +69 -34
- 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-icon/wd-icon.js +10 -2
- 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/FieldRender/index.js +5 -4
- package/dist/web/components/wd-table/components/FilterFieldsPanel/FilterFieldItem.js +4 -0
- package/dist/web/components/wd-table/components/Table/index.js +40 -9
- package/dist/web/components/wd-table/hooks/useQueryParams.js +4 -1
- package/dist/web/components/wd-table/hooks/useTableData.js +6 -1
- package/dist/web/components/wd-table/hooks/useViewFields.js +1 -1
- package/dist/web/components/wd-table/utils/index.js +6 -2
- package/dist/web/components/wd-table/wd-table.js +125 -99
- 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/date.js +3 -3
- package/dist/web/utils/hooks/useFormLegacy.js +112 -0
- package/dist/web/utils/tool.js +12 -2
- package/dist/web/weda-ui.css +197 -3
- package/package.json +6 -5
|
@@ -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/AvGc4AUfCDCbsg0rKSI5kxGQjk8JeOPZVRl0AryJzHBdCrkFtVZVxYf8Uprn18JNX7aZxiKZxyF1bur7sjH5IadWIJQJvmmWl4D9wDAXE/JSWhytMX+FrfA0uX7Kg8Q6whBso3IVRjimoabBZ0QRaCAf1k6Ubjm6kcciYAa57outeo+mLmiJnWsl6Y9TV+V0EyeEG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EcYF16dy5BQsWjPieUW++7Hil96ZMRt/IsargS8FJta9C5gOQaINjn/aYtfrY2pUtZ0fz7EOHuFk3Fdsr1s00PnHWZnyxVGIEc59g4ZIW9NC4wVOhSFmAHKTGvmVzVH40zx7T9tlTf8rdaoztFJtEKwuhQwuTXFVbJzZprHEae2YWI/KC88hie02jPtufpsXWluYy9fZSm7aZvgQx25mmTINrgZYrw2VvGgUcChbRhrCFyAGgsCkLm3AW8Kl/4UI16o7emLewn/lz/hYA7GSEDqNN8KgKntbi2KAHJJtpRvaZQv6K83IuY13iOWRC8oFbcBnktV7SQSPskM/CUyMUhRAkxaiwyMHXgEl8RxnjuSmbv6ZFjUorhmTMO7zrP9eyD2D+ARICY0FVw5a77MdKPii5ecwLwTaHFD9NcdbFaFyJMbl4YXET/JNfkXCmVCo73qqs07SsKxjlN6Rur1SyvWMFNy6AInetbj6Y9Qa9UTUARZPmMIOZUGqDVfTYTfjTAmE3Y6QrJ4WbXE0jSEsBlHhFlaYAlChR0wgEPWdgJVSd2er7ivn8qesWqXH1gi7rz0h++Wr3jExz47WW9OLApoAKauvCsaheQ5JFlw82mTFhRExxAA41xu9ai/47VM9WkMNDRcG82KC3Yn5lzjY2565pp+6RYt2kARySl/7OTWk6uBx7sItCZxGThg8BPgBLjAvnjKhxKoWzT4wVe5PdnLjfATsUcGjJe8mcjLZ5zmZ7VsxT5+kyZUL/lEuAlnzfvIR4ISqRZmEzMSHjCQBl5EpQWy8e0lwCEF3zPBxx/uibTafvvFM5miCZtD/GA0H2tYMDbVYnMxOtspU0bdA2CapnswydTCqq5AZmz2gq7j5K/Y+uUSlNy7RMy7R82OR/OGN2MimnUS4AAAAASUVORK5CYII=);
|
|
36
|
+
background-size: contain;
|
|
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
|
}
|