@cloudbase/weda-ui 3.1.6 → 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 +14 -7
- package/dist/configs/components/chart/line.json +14 -7
- package/dist/configs/components/chart/pie.json +12 -6
- 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/docs/common/format.js +24 -5
- package/dist/web/actions/showModal/index.css +3 -0
- package/dist/web/actions/showModal/index.d.ts +1 -0
- package/dist/web/actions/showModal/index.js +1 -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 +41 -17
- package/dist/web/components/form/uploader/uploader.pc.js +31 -2
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +36 -14
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +34 -11
- 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 +14 -13
- 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
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { emptyObject } from '../../../../utils/constant';
|
|
3
|
+
import { renderDecorator } from '../../renderDecorator';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { Dropdown, ConfigProvider, Text } from 'tea-component';
|
|
6
|
+
import { getNode, getRelationData, dealOrgData } from '../utils';
|
|
7
|
+
import { getDepartById, defaultRequest, } from '../../../../utils/getUserService';
|
|
8
|
+
import '../userOrgSelect.less';
|
|
9
|
+
import { DimTreeContent } from '../comTool';
|
|
10
|
+
import isObjectEqual from '../../../../utils/isObjectEqual';
|
|
11
|
+
export function DepartTreeSelectPC({ id, className, style, events = emptyObject, label = '人员选择', labelVisible = true, name = 'formUserTreeSelect', defaultValue = '', confirmValue = '', placeholder = '请选择人员', defaultValueType = 'noneDepart', disabled = false, layout = 'horizontal', requiredFlag = false, size = 'l', multiple = false, onChange = null, decorator, relation, request = defaultRequest, getDepartByIdRequest = getDepartById, }) {
|
|
12
|
+
// 两次默认值不同, 需要刷新
|
|
13
|
+
const prevDefaultRef = React.useRef(null);
|
|
14
|
+
const prevConfirmRef = React.useRef(null);
|
|
15
|
+
const [selectIds, setSelectIds] = useState([]);
|
|
16
|
+
// 用户单选
|
|
17
|
+
const [curSelectItem, setCurSelectItem] = useState({
|
|
18
|
+
orgId: null,
|
|
19
|
+
content: '',
|
|
20
|
+
});
|
|
21
|
+
const [treeData, setTreeData] = useState([]);
|
|
22
|
+
// 节点高亮
|
|
23
|
+
const [activeIds, setActiveIds] = useState([]);
|
|
24
|
+
//鼠标移入移除输入框
|
|
25
|
+
const [moveIn, setMoveIn] = useState(false);
|
|
26
|
+
const [open, setOpen] = useState(false);
|
|
27
|
+
const [originalTreeData, setOriginalTreeData] = useState([]);
|
|
28
|
+
const [errorInfo, setErrorInfo] = useState({
|
|
29
|
+
errorStatus: false,
|
|
30
|
+
errorMessage: null,
|
|
31
|
+
});
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
initOrgsData();
|
|
34
|
+
if ((defaultValue &&
|
|
35
|
+
!isObjectEqual(prevDefaultRef.current !== defaultValue)) ||
|
|
36
|
+
(confirmValue && !isObjectEqual(prevConfirmRef.current !== confirmValue))) {
|
|
37
|
+
getdefaultUser();
|
|
38
|
+
prevDefaultRef.current = defaultValue;
|
|
39
|
+
prevConfirmRef.current = confirmValue;
|
|
40
|
+
}
|
|
41
|
+
}, [defaultValueType, confirmValue, defaultValue]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (open) {
|
|
44
|
+
setErrorInfo({ errorStatus: false, errorMessage: null });
|
|
45
|
+
const orgId = (curSelectItem === null || curSelectItem === void 0 ? void 0 : curSelectItem.orgId) || null;
|
|
46
|
+
const node = getNode(treeData, orgId, 'orgId');
|
|
47
|
+
setActiveIds(node ? [node.id] : []);
|
|
48
|
+
setSelectIds(node ? [node.id] : []);
|
|
49
|
+
}
|
|
50
|
+
}, [open, treeData]);
|
|
51
|
+
// 初始化数据
|
|
52
|
+
const initOrgsData = async () => {
|
|
53
|
+
try {
|
|
54
|
+
setErrorInfo({ errorStatus: false, errorMessage: null });
|
|
55
|
+
const resData = (await request('InitRootOrgs', {})) || [];
|
|
56
|
+
const data = dealOrgData(resData);
|
|
57
|
+
setTreeData(data);
|
|
58
|
+
setOriginalTreeData([...data]);
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
setErrorInfo({ errorStatus: true, errorMessage: e });
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const getdefaultUser = async () => {
|
|
65
|
+
var _a;
|
|
66
|
+
try {
|
|
67
|
+
if ((defaultValueType === 'confirmDepart' && confirmValue.length !== 0) ||
|
|
68
|
+
defaultValue.length !== 0) {
|
|
69
|
+
const orgId = confirmValue.length !== 0 ? confirmValue : defaultValue;
|
|
70
|
+
const defaultUser = await getDepartByIdRequest({
|
|
71
|
+
_id: orgId,
|
|
72
|
+
});
|
|
73
|
+
setCurSelectItem({ orgId: orgId, content: defaultUser });
|
|
74
|
+
(_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value: orgId, data: { content: defaultUser } });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
setErrorInfo({ errorStatus: true, errorMessage: e });
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const reset = (close) => {
|
|
82
|
+
setSelectIds([]);
|
|
83
|
+
setCurSelectItem({ orgId: null, content: '' });
|
|
84
|
+
setErrorInfo({ errorStatus: false, errorMessage: null });
|
|
85
|
+
setActiveIds([]);
|
|
86
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
87
|
+
close && setOpen(false);
|
|
88
|
+
};
|
|
89
|
+
// 外层组件类
|
|
90
|
+
const cls = classNames({
|
|
91
|
+
'weda-ui': true,
|
|
92
|
+
'weda-user-tree-select': true,
|
|
93
|
+
[className]: className,
|
|
94
|
+
});
|
|
95
|
+
return renderDecorator(React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
96
|
+
React.createElement("div", { onMouseEnter: () => {
|
|
97
|
+
setMoveIn(true);
|
|
98
|
+
}, onMouseLeave: () => {
|
|
99
|
+
setMoveIn(false);
|
|
100
|
+
} },
|
|
101
|
+
React.createElement(Dropdown, { className: classNames(`department-tree-select`, `size-${size}`), destroyOnClose: false, open: open, onOpenChange: (open) => {
|
|
102
|
+
setOpen(open);
|
|
103
|
+
setErrorInfo({ errorStatus: false, errorMessage: null });
|
|
104
|
+
}, button: React.createElement(SelectViewContainer, { curSelectItem: curSelectItem, multiple: multiple, placeholder: "\u8BF7\u9009\u62E9\u90E8\u95E8", moveIn: moveIn, onChange: () => reset(true) }), style: { width: '100%' }, appearance: multiple ? 'pure' : 'button', clickClose: false, disabled: disabled }, () => (React.createElement("div", { className: "dim-tree-select" },
|
|
105
|
+
React.createElement(DimTreeContent, { data: treeData, setTreeData: setTreeData, selectedIds: selectIds, activeIds: activeIds, needUser: false, request: request, errorInfo: errorInfo, searchType: "SearchByOrg", onActive: (ids) => {
|
|
106
|
+
setActiveIds(ids);
|
|
107
|
+
setSelectIds(ids);
|
|
108
|
+
}, onReset: () => setTreeData(originalTreeData), onCancel: () => {
|
|
109
|
+
setOpen(false);
|
|
110
|
+
setErrorInfo({ errorStatus: false, errorMessage: null });
|
|
111
|
+
}, onClear: () => reset(false), onConfirm: () => {
|
|
112
|
+
var _a;
|
|
113
|
+
const selectId = selectIds === null || selectIds === void 0 ? void 0 : selectIds[0];
|
|
114
|
+
if (selectId) {
|
|
115
|
+
const node = getNode(treeData, selectId, 'id');
|
|
116
|
+
if (node) {
|
|
117
|
+
setCurSelectItem(node);
|
|
118
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(node.orgId);
|
|
119
|
+
setOpen(false);
|
|
120
|
+
(_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value: node.orgId, data: node });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
} })))))))({
|
|
124
|
+
id,
|
|
125
|
+
className: cls,
|
|
126
|
+
style,
|
|
127
|
+
label: labelVisible ? label : null,
|
|
128
|
+
layout,
|
|
129
|
+
multiCell: false,
|
|
130
|
+
requiredFlag,
|
|
131
|
+
size,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
const SelectViewContainer = (props) => {
|
|
135
|
+
const { curSelectItem, placeholder, onChange, moveIn } = props;
|
|
136
|
+
if (!(curSelectItem === null || curSelectItem === void 0 ? void 0 : curSelectItem.orgId))
|
|
137
|
+
return React.createElement(Text, { className: "placeholder" }, placeholder);
|
|
138
|
+
return (React.createElement(React.Fragment, null,
|
|
139
|
+
React.createElement(ViewCell, { data: curSelectItem, showType: "tree", relation: undefined }),
|
|
140
|
+
moveIn && (React.createElement(React.Fragment, null,
|
|
141
|
+
React.createElement("div", { className: "weda-select-user-dept__dialog-input-clear", onClick: (e) => {
|
|
142
|
+
e.stopPropagation();
|
|
143
|
+
onChange === null || onChange === void 0 ? void 0 : onChange();
|
|
144
|
+
} },
|
|
145
|
+
React.createElement("p", { className: "weda-select-user-dept__dialog-input-clear-close" }))))));
|
|
146
|
+
};
|
|
147
|
+
const ViewCell = ({ data, showType, relation }) => {
|
|
148
|
+
if (showType === 'tree') {
|
|
149
|
+
return React.createElement(Text, { verticalAlign: "middle" }, (data === null || data === void 0 ? void 0 : data.content) || '-');
|
|
150
|
+
}
|
|
151
|
+
const defaultValue = getRelationData(relation);
|
|
152
|
+
return (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.id) ? (React.createElement(Text, { verticalAlign: "middle" }, defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.content)) : (React.createElement(Text, null, "-"));
|
|
153
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConfigProvider } from 'tea-component';
|
|
3
|
+
// import './index.less';
|
|
4
|
+
import { usePlatform } from '../../../../utils/platform';
|
|
5
|
+
import { DepartTreeSelectH5 as DepartSelectH5 } from './departTreeSelect.h5';
|
|
6
|
+
import { DepartTreeSelectPC as DepartSelectPC } from './departTreeSelect.pc';
|
|
7
|
+
export default function DepartTreeSelect(props) {
|
|
8
|
+
const platform = usePlatform();
|
|
9
|
+
if ((props === null || props === void 0 ? void 0 : props.showType) === 'pc') {
|
|
10
|
+
return React.createElement(DepartSelectPC, { ...props });
|
|
11
|
+
}
|
|
12
|
+
if ((props === null || props === void 0 ? void 0 : props.showType) === 'h5') {
|
|
13
|
+
return React.createElement(DepartSelectH5, { ...props });
|
|
14
|
+
}
|
|
15
|
+
return platform === 'h5' ? (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
16
|
+
React.createElement(DepartSelectH5, { ...props }))) : (React.createElement(DepartSelectPC, { ...props }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConfigProvider } from 'tea-component';
|
|
3
|
+
// import './index.less';
|
|
4
|
+
import { usePlatform } from '../../../utils/platform';
|
|
5
|
+
import { UserTreeSelectH5 as UserSelectH5 } from './userTreeSelect.h5';
|
|
6
|
+
import { UserTreeSelectPC as UserSelectPC } from './userTreeSelect.pc';
|
|
7
|
+
export default function UserTreeSelect(props) {
|
|
8
|
+
const platform = usePlatform();
|
|
9
|
+
if ((props === null || props === void 0 ? void 0 : props.showType) === 'pc') {
|
|
10
|
+
return React.createElement(UserSelectPC, { ...props });
|
|
11
|
+
}
|
|
12
|
+
if ((props === null || props === void 0 ? void 0 : props.showType) === 'h5') {
|
|
13
|
+
return React.createElement(UserSelectH5, { ...props });
|
|
14
|
+
}
|
|
15
|
+
return platform === 'h5' ? (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
16
|
+
React.createElement(UserSelectH5, { ...props }))) : (React.createElement(UserSelectPC, { ...props }));
|
|
17
|
+
}
|