@cloudbase/weda-ui 3.4.0 → 3.4.1
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/actions/showMessage.json +45 -0
- package/dist/configs/components/carousel.json +75 -65
- package/dist/configs/components/chart/bar.json +37 -1
- package/dist/configs/components/chart/line.json +3 -0
- package/dist/configs/components/chart/pie.json +3 -0
- package/dist/configs/components/container.json +15 -1
- package/dist/configs/components/dataView.json +45 -2
- package/dist/configs/components/form/location.json +1 -1
- package/dist/configs/components/form/richText.json +1 -1
- package/dist/configs/components/form/uploaderFile.json +3 -2
- package/dist/configs/components/formdetail.json +5 -0
- package/dist/configs/components/image.json +5 -2
- package/dist/configs/components/link.json +4 -1
- package/dist/configs/components/listView.json +109 -34
- package/dist/configs/components/richtextview.json +4 -1
- package/dist/configs/components/scrollVeiw.json +16 -1
- package/dist/configs/components/swiper.json +46 -37
- package/dist/configs/components/text.json +11 -5
- package/dist/configs/components/wxOpenApi/phone.json +1 -1
- package/dist/configs/components/wxOpenApi/phoneCode.json +1 -1
- package/dist/configs/components/wxOpenApi/userInfo.json +13 -1
- package/dist/configs/index.d.ts +2 -0
- package/dist/configs/index.js +2 -0
- package/dist/web/actions/index.d.ts +1 -0
- package/dist/web/actions/index.js +1 -0
- package/dist/web/actions/showMessage/index.css +6 -0
- package/dist/web/actions/showMessage/index.d.ts +17 -0
- package/dist/web/actions/showMessage/index.js +39 -0
- package/dist/web/components/button/index.d.ts +3 -2
- package/dist/web/components/button/index.js +14 -3
- package/dist/web/components/common/use-loop-render-detect.js +7 -6
- package/dist/web/components/form/form/index.js +13 -53
- package/dist/web/components/form/uploader/uploader.h5.js +1 -1
- package/dist/web/components/form/uploader/uploader.pc.js +2 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +12 -10
- package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +11 -0
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +10 -8
- package/dist/web/components/form/userOrgSelect/comTool.js +6 -3
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +4 -4
- package/dist/web/components/form/userOrgSelect/getUserService.js +2 -1
- package/dist/web/components/form/userOrgSelect/userOrgSelect.css +10 -12
- package/dist/web/components/form/userOrgSelect/userTreeSelect.pc.js +36 -17
- package/dist/web/components/form/userOrgSelect/utils.d.ts +1 -0
- package/dist/web/components/form/userOrgSelect/utils.js +15 -0
- package/dist/web/components/formdetail/index.css +40 -27
- package/dist/web/components/formdetail/index.js +22 -19
- package/dist/web/components/link/index.js +2 -1
- package/dist/web/components/listView/index.css +5 -1
- package/dist/web/components/listView/index.js +22 -2
- package/dist/web/components/navigationBar/index.js +8 -3
- package/dist/web/components/phone/index.js +4 -1
- package/dist/web/components/phoneCode/index.js +4 -1
- package/dist/web/components/richText/index.d.ts +1 -1
- package/dist/web/components/richText/index.js +6 -6
- package/dist/web/components/share/index.js +4 -1
- package/dist/web/components/text/index.js +2 -1
- package/dist/web/components/userInfo/index.js +4 -1
- package/dist/web/utils/console.js +1 -1
- package/dist/web/utils/platform.d.ts +11 -1
- package/dist/web/utils/platform.js +61 -12
- package/package.json +2 -1
|
@@ -246,7 +246,22 @@
|
|
|
246
246
|
"icon": "//imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/ScrollView.svg"
|
|
247
247
|
},
|
|
248
248
|
"configMeta": {
|
|
249
|
-
"docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/grid/ScrollView"
|
|
249
|
+
"docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/grid/ScrollView",
|
|
250
|
+
"shortcut": {
|
|
251
|
+
"props": ["scrollX", "scrollY"],
|
|
252
|
+
"extra": {
|
|
253
|
+
"container": {
|
|
254
|
+
"x-component": "container",
|
|
255
|
+
"x-component-props": [
|
|
256
|
+
"gsd-h5-react:Text",
|
|
257
|
+
"CLOUDBASE_STANDARD:Button",
|
|
258
|
+
"gsd-h5-react:Image",
|
|
259
|
+
"CLOUDBASE_STANDARD:FormInput"
|
|
260
|
+
],
|
|
261
|
+
"x-index": 1
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
250
265
|
},
|
|
251
266
|
"isContainer": true,
|
|
252
267
|
"mpOrigin": "scroll-view"
|
|
@@ -2,70 +2,79 @@
|
|
|
2
2
|
"$schema": "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/lcds_component.json",
|
|
3
3
|
"data": {
|
|
4
4
|
"properties": {
|
|
5
|
+
"interval": {
|
|
6
|
+
"title": "自动切换时间间隔",
|
|
7
|
+
"default": 5000,
|
|
8
|
+
"type": "number",
|
|
9
|
+
"x-index": 1,
|
|
10
|
+
"x-category": "基础属性",
|
|
11
|
+
"remarks": "配置轮播图滚动的时间间隔,时间单位为ms"
|
|
12
|
+
},
|
|
13
|
+
"vertical": {
|
|
14
|
+
"title": "纵向轮播",
|
|
15
|
+
"default": false,
|
|
16
|
+
"x-index": 2,
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"x-category": "基础属性",
|
|
19
|
+
"remarks": "开启后,轮播的滚动方式将会由横向滚动变更为纵向滚动"
|
|
20
|
+
},
|
|
5
21
|
"autoplay": {
|
|
6
22
|
"title": "自动切换",
|
|
7
23
|
"default": true,
|
|
24
|
+
"x-index": 3,
|
|
8
25
|
"type": "boolean",
|
|
9
26
|
"x-category": "基础属性",
|
|
10
27
|
"remarks": "开启后,轮播图将会自动根据配置的时间间隔进行自动滚动,关闭后则轮播图仅支持通过点击锚点的方式进行切换"
|
|
11
28
|
},
|
|
12
|
-
"
|
|
13
|
-
"title": "
|
|
14
|
-
"
|
|
15
|
-
"type": "
|
|
29
|
+
"indicatorActiveColor": {
|
|
30
|
+
"title": "锚点激活色",
|
|
31
|
+
"x-index": 4,
|
|
32
|
+
"type": "string",
|
|
33
|
+
"x-component": "color",
|
|
34
|
+
"default": "rgba(0, 0, 0, 0.9)",
|
|
16
35
|
"x-category": "高级属性",
|
|
17
|
-
"remarks": "
|
|
36
|
+
"remarks": "更改锚点选中时的颜色"
|
|
18
37
|
},
|
|
19
|
-
"
|
|
20
|
-
"title": "
|
|
21
|
-
"
|
|
22
|
-
"
|
|
38
|
+
"indicatorColor": {
|
|
39
|
+
"title": "锚点颜色",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"x-index": 5,
|
|
42
|
+
"x-component": "color",
|
|
43
|
+
"default": "rgba(200, 200, 200, 0.9)",
|
|
23
44
|
"x-category": "高级属性",
|
|
24
|
-
"remarks": "
|
|
25
|
-
},
|
|
26
|
-
"interval": {
|
|
27
|
-
"title": "自动切换时间间隔",
|
|
28
|
-
"default": 5000,
|
|
29
|
-
"type": "number",
|
|
30
|
-
"x-category": "基础属性",
|
|
31
|
-
"remarks": "配置轮播图滚动的时间间隔,时间单位为ms"
|
|
45
|
+
"remarks": "更改锚点普通状态下的颜色"
|
|
32
46
|
},
|
|
33
47
|
"duration": {
|
|
34
48
|
"title": "滑动动画时长",
|
|
35
49
|
"default": 500,
|
|
50
|
+
"x-index": 6,
|
|
36
51
|
"type": "number",
|
|
37
52
|
"x-category": "高级属性",
|
|
38
53
|
"remarks": "更改轮播图切换时的滑动动画时长"
|
|
39
54
|
},
|
|
55
|
+
"current": {
|
|
56
|
+
"title": "当前所在滑块的 index",
|
|
57
|
+
"default": 0,
|
|
58
|
+
"x-index": 7,
|
|
59
|
+
"type": "number",
|
|
60
|
+
"x-category": "高级属性",
|
|
61
|
+
"remarks": "更改轮播图的默认展示位置,0为默认展示第一张轮播图,以此类推"
|
|
62
|
+
},
|
|
40
63
|
"circular": {
|
|
41
64
|
"title": "衔接滑动",
|
|
42
65
|
"default": true,
|
|
43
66
|
"type": "boolean",
|
|
67
|
+
"x-index": 8,
|
|
44
68
|
"x-category": "高级属性",
|
|
45
69
|
"remarks": "更改轮播图切换时动画的滑动方式"
|
|
46
70
|
},
|
|
47
|
-
"
|
|
48
|
-
"title": "
|
|
49
|
-
"default":
|
|
71
|
+
"indicatorDots": {
|
|
72
|
+
"title": "导航锚点",
|
|
73
|
+
"default": true,
|
|
50
74
|
"type": "boolean",
|
|
51
|
-
"x-
|
|
52
|
-
"remarks": "开启后,轮播的滚动方式将会由横向滚动变更为纵向滚动"
|
|
53
|
-
},
|
|
54
|
-
"indicatorColor": {
|
|
55
|
-
"title": "锚点颜色",
|
|
56
|
-
"type": "string",
|
|
57
|
-
"x-component": "color",
|
|
58
|
-
"default": "rgba(200, 200, 200, 0.9)",
|
|
59
|
-
"x-category": "高级属性",
|
|
60
|
-
"remarks": "更改锚点普通状态下的颜色"
|
|
61
|
-
},
|
|
62
|
-
"indicatorActiveColor": {
|
|
63
|
-
"title": "锚点激活色",
|
|
64
|
-
"type": "string",
|
|
65
|
-
"x-component": "color",
|
|
66
|
-
"default": "rgba(0, 0, 0, 0.9)",
|
|
75
|
+
"x-index": 9,
|
|
67
76
|
"x-category": "高级属性",
|
|
68
|
-
"remarks": "
|
|
77
|
+
"remarks": "开启/关闭轮播图锚点"
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
80
|
},
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"data": {
|
|
4
4
|
"properties": {
|
|
5
5
|
"text": {
|
|
6
|
-
"title": "文本内容",
|
|
7
6
|
"type": "string",
|
|
7
|
+
"title": "内容",
|
|
8
8
|
"x-component": "textarea",
|
|
9
9
|
"default": "文本内容",
|
|
10
10
|
"x-category": "基础属性",
|
|
@@ -43,10 +43,13 @@
|
|
|
43
43
|
}
|
|
44
44
|
],
|
|
45
45
|
"type": "string",
|
|
46
|
-
"title": "
|
|
46
|
+
"title": "格式",
|
|
47
47
|
"default": "0",
|
|
48
48
|
"x-index": 2,
|
|
49
49
|
"description": "标题级别,H1 - H6",
|
|
50
|
+
"x-props": {
|
|
51
|
+
"data-hidebind": true
|
|
52
|
+
},
|
|
50
53
|
"remarks": "更改文本的展示级别"
|
|
51
54
|
},
|
|
52
55
|
"maxLines": {
|
|
@@ -81,9 +84,9 @@
|
|
|
81
84
|
"type": "boolean",
|
|
82
85
|
"description": "是否可选中文本",
|
|
83
86
|
"default": true,
|
|
87
|
+
"x-index": 115,
|
|
84
88
|
"x-category": "高级属性",
|
|
85
|
-
"remarks": "关闭后文本将不支持进行选中,无法进行复制等常见文本操作"
|
|
86
|
-
"x-index": 115
|
|
89
|
+
"remarks": "关闭后文本将不支持进行选中,无法进行复制等常见文本操作"
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
},
|
|
@@ -101,6 +104,9 @@
|
|
|
101
104
|
"icon": "//imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/Text.svg"
|
|
102
105
|
},
|
|
103
106
|
"configMeta": {
|
|
104
|
-
"docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/text/Text"
|
|
107
|
+
"docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/text/Text",
|
|
108
|
+
"shortcut": {
|
|
109
|
+
"props": ["text", "level"]
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
}
|
|
@@ -148,7 +148,19 @@
|
|
|
148
148
|
"categoryOrder": 100,
|
|
149
149
|
"componentOrder": 1,
|
|
150
150
|
"platform": ["MP"],
|
|
151
|
-
"visible": ["APP"]
|
|
151
|
+
"visible": ["APP"],
|
|
152
|
+
"validate": [
|
|
153
|
+
{
|
|
154
|
+
"rule": "checkIsUsedPreAvartNickComp",
|
|
155
|
+
"options": {
|
|
156
|
+
"allowFailure": false,
|
|
157
|
+
"title": "页面使用了「获取用户信息」组件,因小程序官方规则调整,使用该组件的应用无法再发布上线,请点击右侧的「了解详情」按钮获取相关能力的适配策略,对应用进行改造调整",
|
|
158
|
+
"description": "",
|
|
159
|
+
"type": "component",
|
|
160
|
+
"version": ""
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
]
|
|
152
164
|
},
|
|
153
165
|
"configMeta": {
|
|
154
166
|
"docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/wxOpen/UserInfo"
|
package/dist/configs/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export namespace components {
|
|
|
48
48
|
export namespace actions {
|
|
49
49
|
export { showToast };
|
|
50
50
|
export { showModal };
|
|
51
|
+
export { showMessage };
|
|
51
52
|
}
|
|
52
53
|
declare namespace _default {
|
|
53
54
|
export { components };
|
|
@@ -101,3 +102,4 @@ import UserTreeSelect from "./components/form/userTreeSelect.json";
|
|
|
101
102
|
import DepartTreeSelect from "./components/form/departTreeSelect.json";
|
|
102
103
|
import showToast from "./actions/showToast.json";
|
|
103
104
|
import showModal from "./actions/showModal.json";
|
|
105
|
+
import showMessage from "./actions/showMessage.json";
|
package/dist/configs/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import NavLayout from './components/navLayout.json';
|
|
|
33
33
|
import WedaVideo from './components/wedaVideo.json';
|
|
34
34
|
import showToast from './actions/showToast.json';
|
|
35
35
|
import showModal from './actions/showModal.json';
|
|
36
|
+
import showMessage from './actions/showMessage.json';
|
|
36
37
|
import ListView from './components/listView.json';
|
|
37
38
|
import NavigationBar from './components/navigationBar.json';
|
|
38
39
|
import Line from './components/chart/line.json';
|
|
@@ -104,6 +105,7 @@ export const components = {
|
|
|
104
105
|
export const actions = {
|
|
105
106
|
showToast,
|
|
106
107
|
showModal,
|
|
108
|
+
showMessage,
|
|
107
109
|
};
|
|
108
110
|
export default {
|
|
109
111
|
components,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
.weda-showmessage__none > .wedatea2td-icon {
|
|
2
|
+
display: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/*# sourceURL=webpack://./src/web/actions/showMessage/index.css */
|
|
6
|
+
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8uL3NyYy93ZWIvYWN0aW9ucy9zaG93TWVzc2FnZS9pbmRleC5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7RUFDRSxhQUFhO0FBQ2YiLCJzb3VyY2VzQ29udGVudCI6WyIud2VkYS1zaG93bWVzc2FnZV9fbm9uZSA+IC53ZWRhdGVhMnRkLWljb24ge1xuICBkaXNwbGF5OiBub25lO1xufVxuIl0sInNvdXJjZVJvb3QiOiIifQ== */
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { unknownFunction } from '../../types';
|
|
2
|
+
import './index.css';
|
|
3
|
+
interface messageProps {
|
|
4
|
+
data: {
|
|
5
|
+
title?: string;
|
|
6
|
+
icon?: 'success' | 'error' | 'warning' | 'loading' | 'none';
|
|
7
|
+
duration?: number;
|
|
8
|
+
};
|
|
9
|
+
_origin?: (params: {
|
|
10
|
+
title?: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
duration?: number;
|
|
13
|
+
}) => void;
|
|
14
|
+
event: Record<string, unknownFunction>;
|
|
15
|
+
}
|
|
16
|
+
export default function showMessage(props: messageProps): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isH5Platform } from '../../utils/platform';
|
|
2
|
+
import { message } from 'tea-component';
|
|
3
|
+
import './index.css';
|
|
4
|
+
const iconType = {
|
|
5
|
+
success: 'success',
|
|
6
|
+
error: 'error',
|
|
7
|
+
warning: 'warning',
|
|
8
|
+
loading: 'loading',
|
|
9
|
+
none: 'none',
|
|
10
|
+
};
|
|
11
|
+
export default function showMessage(props) {
|
|
12
|
+
var _a, _b, _c, _d;
|
|
13
|
+
try {
|
|
14
|
+
const { data: { title, icon = 'none', duration = 1500 }, _origin, } = props;
|
|
15
|
+
const smallScreen = (_b = (_a = window === null || window === void 0 ? void 0 : window.matchMedia('(max-width: 1024px)')) === null || _a === void 0 ? void 0 : _a.matches) !== null && _b !== void 0 ? _b : isH5Platform();
|
|
16
|
+
const touchDevice = (_d = (_c = window === null || window === void 0 ? void 0 : window.matchMedia('(pointer:coarse)')) === null || _c === void 0 ? void 0 : _c.matches) !== null && _d !== void 0 ? _d : smallScreen;
|
|
17
|
+
const platform = touchDevice || smallScreen ? 'h5' : 'pc';
|
|
18
|
+
if (platform === 'h5') {
|
|
19
|
+
_origin &&
|
|
20
|
+
_origin({
|
|
21
|
+
title: title,
|
|
22
|
+
icon,
|
|
23
|
+
duration: duration || 1500,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const realIcon = iconType[icon];
|
|
28
|
+
const isNotShowIcon = realIcon === 'none' || !realIcon;
|
|
29
|
+
message[isNotShowIcon ? 'success' : icon]({
|
|
30
|
+
className: `weda-showmessage__${icon}`,
|
|
31
|
+
content: title,
|
|
32
|
+
duration: duration || 1500,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error('showMessage error', error);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { CommonPropsType } from '../../types';
|
|
2
|
+
import type { CommonPropsType, unknownFunction } from '../../types';
|
|
3
3
|
import './index.css';
|
|
4
|
-
declare const Button: ({ text, size, type, contentSlot, formType, loading, disabled, events, className, style, id, }: PropsType) => JSX.Element;
|
|
4
|
+
declare const Button: ({ text, size, type, contentSlot, formType, loading, disabled, events, className, style, id, ...props }: PropsType) => JSX.Element;
|
|
5
5
|
export interface PropsType extends CommonPropsType {
|
|
6
6
|
/**
|
|
7
7
|
* 内容
|
|
@@ -28,5 +28,6 @@ export interface PropsType extends CommonPropsType {
|
|
|
28
28
|
*/
|
|
29
29
|
formType?: 'button' | 'submit' | 'reset';
|
|
30
30
|
contentSlot?: string;
|
|
31
|
+
[handlers: `on${string}`]: unknownFunction;
|
|
31
32
|
}
|
|
32
33
|
export default Button;
|
|
@@ -5,7 +5,7 @@ import { usePlatform } from '../../utils/platform';
|
|
|
5
5
|
import './index.css';
|
|
6
6
|
import { emptyObject } from '../../utils/constant';
|
|
7
7
|
// 不用 react-weui 而直接用底层实现的原因是 react-weui 不能支持表单类型
|
|
8
|
-
const Button = ({ text, size, type, contentSlot, formType, loading, disabled, events = emptyObject, className, style, id, }) => {
|
|
8
|
+
const Button = ({ text, size, type, contentSlot, formType, loading, disabled, events = emptyObject, className, style, id, ...props }) => {
|
|
9
9
|
const platform = usePlatform();
|
|
10
10
|
const isH5 = platform === 'h5';
|
|
11
11
|
const cls = classNames({
|
|
@@ -23,18 +23,29 @@ const Button = ({ text, size, type, contentSlot, formType, loading, disabled, ev
|
|
|
23
23
|
[className]: className,
|
|
24
24
|
});
|
|
25
25
|
const onClick = (e) => {
|
|
26
|
+
var _a;
|
|
26
27
|
if (events.tap) {
|
|
27
28
|
events.tap({}, { originEvent: e });
|
|
28
29
|
}
|
|
30
|
+
(_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
29
31
|
};
|
|
32
|
+
const propsStartWithOn = React.useMemo(() => {
|
|
33
|
+
return Object.keys(props).reduce((acc, cur) => {
|
|
34
|
+
if (cur.startsWith('on')) {
|
|
35
|
+
acc[cur] = props[cur];
|
|
36
|
+
}
|
|
37
|
+
return acc;
|
|
38
|
+
}, {});
|
|
39
|
+
}, [props]);
|
|
40
|
+
const teaBtnType = React.useMemo(() => toTeaButtonType(type), [type]);
|
|
30
41
|
if (platform === 'h5') {
|
|
31
|
-
return (React.createElement("button", { className: cls, disabled: disabled, type: formType, style: style, id: id, onClick: onClick },
|
|
42
|
+
return (React.createElement("button", { className: cls, disabled: disabled, type: formType, style: style, id: id, ...propsStartWithOn, onClick: onClick },
|
|
32
43
|
loading && (React.createElement("span", { className: "weui-btn_loading" },
|
|
33
44
|
React.createElement("i", { className: "weui-loading" }))),
|
|
34
45
|
text ? text : contentSlot));
|
|
35
46
|
}
|
|
36
47
|
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
37
|
-
React.createElement(TeaButton, { loading: loading,
|
|
48
|
+
React.createElement(TeaButton, { loading: loading, disabled: disabled, htmlType: formType, type: teaBtnType, style: style, className: cls, id: id, ...propsStartWithOn, onClick: onClick }, text ? text : contentSlot)));
|
|
38
49
|
};
|
|
39
50
|
function toTeaButtonType(type) {
|
|
40
51
|
if (type === 'primary')
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useSyncedRef } from '@react-hookz/web';
|
|
2
2
|
import { useCallback, useEffect, useRef } from 'react';
|
|
3
|
+
import { debug } from '../../utils/console';
|
|
3
4
|
export const useRenderCount = () => {
|
|
4
5
|
const countRef = useRef(0);
|
|
5
6
|
const syncedRef = useSyncedRef(++countRef.current);
|
|
@@ -104,12 +105,12 @@ export const useLoopRenderDetect = (inputOptions = defaultOptions) => {
|
|
|
104
105
|
};
|
|
105
106
|
}, []);
|
|
106
107
|
const fps = useFps();
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
debug('loop:detect').log({
|
|
109
|
+
timeWindow: options.timeWindowMs,
|
|
110
|
+
fps,
|
|
111
|
+
renderCount,
|
|
112
|
+
limit: options.limit,
|
|
113
|
+
});
|
|
113
114
|
if ((renderCount > options.limit && fps < 1) ||
|
|
114
115
|
renderCount > options.limit * 3) {
|
|
115
116
|
reset();
|
|
@@ -5,6 +5,8 @@ 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
|
+
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
9
|
+
import { usePrevious, useThrottledEffect } from '@react-hookz/web';
|
|
8
10
|
const formTypeWithInitValue = ['edit', 'read'];
|
|
9
11
|
/**
|
|
10
12
|
* 表单容器组件
|
|
@@ -20,8 +22,9 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
|
|
|
20
22
|
'gsd-h5-react-form-pc': platform === 'pc',
|
|
21
23
|
[className]: className,
|
|
22
24
|
});
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
+
const preParamGetItem = usePrevious(paramGetItem);
|
|
26
|
+
const preDataId = usePrevious(_id);
|
|
27
|
+
useThrottledEffect(() => {
|
|
25
28
|
const getData = async () => {
|
|
26
29
|
var _a, _b;
|
|
27
30
|
try {
|
|
@@ -64,12 +67,13 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
|
|
|
64
67
|
}
|
|
65
68
|
};
|
|
66
69
|
if (dataSourceName && formTypeWithInitValue.includes(formType)) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
// https://git.woa.com/QBase/lcap/weda-ui/merge_requests/542 对象要小心死循环
|
|
71
|
+
if ((isDataModel && _id && !isObjectEqual(preDataId, _id, true)) ||
|
|
72
|
+
(!isDataModel &&
|
|
73
|
+
paramGetItem &&
|
|
74
|
+
methodGetItem &&
|
|
75
|
+
!isObjectEqual(preParamGetItem, paramGetItem))) {
|
|
76
|
+
getData();
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
79
|
}, [
|
|
@@ -80,51 +84,7 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
|
|
|
80
84
|
platform,
|
|
81
85
|
methodGetItem,
|
|
82
86
|
paramGetItem,
|
|
83
|
-
]);
|
|
84
|
-
React.useEffect(() => {
|
|
85
|
-
// 因编辑器render时序问题暂不上线
|
|
86
|
-
// 获取字段权限
|
|
87
|
-
// const authValue = {
|
|
88
|
-
// isDataModel,
|
|
89
|
-
// dataSourceFields: [],
|
|
90
|
-
// dataSourceFieldsWidthAuthList: [],
|
|
91
|
-
// };
|
|
92
|
-
// const getDataSourceFieldsWithAuth = async () => {
|
|
93
|
-
// try {
|
|
94
|
-
// const datasource = await getDataSourceByName(dataSourceName);
|
|
95
|
-
// if (!isInIde()) {
|
|
96
|
-
// // 判断是否是预览区,编辑器编辑区 dataSourceName 查询的返回一致,编辑区用的本地的数据源数据返回固定
|
|
97
|
-
// authValue.dataSourceFieldsWidthAuthList =
|
|
98
|
-
// datasource?.resourceCheckInfos?.map((item) => item.ReadWrite);
|
|
99
|
-
// authValue.dataSourceFields = Object.keys(
|
|
100
|
-
// datasource?.schema?.properties || {}
|
|
101
|
-
// );
|
|
102
|
-
// }
|
|
103
|
-
// events?.onInitDataSourceFieldsWithAuth?.(authValue);
|
|
104
|
-
// } catch (err) {
|
|
105
|
-
// events?.onInitDataSourceFieldsWithAuth?.(authValue);
|
|
106
|
-
// alertError(
|
|
107
|
-
// platform,
|
|
108
|
-
// `获取数据源字段权限信息失败,字段权限可能无法正确展示,错误信息:${err}`
|
|
109
|
-
// );
|
|
110
|
-
// console.error('getDataSourceFieldsWithAuth err', err);
|
|
111
|
-
// }
|
|
112
|
-
// };
|
|
113
|
-
// // 兼容私有环境,新接口不存在的情况,产品策略完善后移除
|
|
114
|
-
// if (
|
|
115
|
-
// window?.['_isPrivate'] &&
|
|
116
|
-
// !window?.app?.cloud?.getDataSourceProfileAsync
|
|
117
|
-
// ) {
|
|
118
|
-
// events?.onInitDataSourceFieldsWithAuth?.({ isDataModel });
|
|
119
|
-
// return;
|
|
120
|
-
// }
|
|
121
|
-
// if (isDataModel && dataSourceName) {
|
|
122
|
-
// getDataSourceFieldsWithAuth();
|
|
123
|
-
// } else {
|
|
124
|
-
// // 在表单容器里面的表单元素 if 默认是 false,需要通过onInitDataSourceFieldsWithAuth设置为true
|
|
125
|
-
// events?.onInitDataSourceFieldsWithAuth?.({ isDataModel });
|
|
126
|
-
// }
|
|
127
|
-
}, [formType, isDataModel, platform, dataSourceName, events]);
|
|
87
|
+
], 100);
|
|
128
88
|
// pc 渲染
|
|
129
89
|
const renderPc = () => {
|
|
130
90
|
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
@@ -138,7 +138,7 @@ export function ImageUploaderH5({ title: label, maxUploadCount, maxSize = 10, ac
|
|
|
138
138
|
React.createElement("div", { className: "weui-uploader__file-content" },
|
|
139
139
|
progress,
|
|
140
140
|
"%")))),
|
|
141
|
-
showAdd && (React.createElement("div", { className: "weui-uploader__input-box" }, !disabled && (React.createElement("input", { id: "uploaderInput", className: "weui-uploader__input", type: "file", accept: accepts.join(','), multiple:
|
|
141
|
+
showAdd && (React.createElement("div", { className: "weui-uploader__input-box" }, !disabled && (React.createElement("input", { id: "uploaderInput", className: "weui-uploader__input", type: "file", accept: accepts.join(','), multiple: !single, onChange: (e) => {
|
|
142
142
|
const files = [...e.target.files];
|
|
143
143
|
if (!islegalType(files, accepts))
|
|
144
144
|
return;
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import weui from '../../../utils/weui';
|
|
3
3
|
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
4
4
|
import { ConfigProvider, Button, Icon, Text, List, Progress, Tooltip, message, } from 'tea-component';
|
|
5
|
-
import { filterStrList, isCloudFileID, isHttpFileID, transSize, downloadFile, transFileCloudidToName, randomStr, } from '../../../utils/platform';
|
|
5
|
+
import { filterStrList, isCloudFileID, isHttpFileID, transSize, downloadFile, transFileCloudidToName, randomStr, isInIde, } from '../../../utils/platform';
|
|
6
6
|
import { getCloudInstance } from '../../../utils/tcb';
|
|
7
7
|
import classNames from '../../../utils/classnames';
|
|
8
8
|
import { renderDecorator } from '../renderDecorator';
|
|
@@ -37,15 +37,17 @@ layout, id = '', style = defaultStyle, labelVisible = true, label = '上传文
|
|
|
37
37
|
// 组件属性
|
|
38
38
|
tips = '', btnTitle = '点击上传', maxUploadCount = 9, maxSize = 10, deleteVisible = true, downloadVisible = true, value = emptyArray, // 需要兼容 cloud:和https: 协议,需要兼容字符串和字符串数组
|
|
39
39
|
events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true, onChange = null, isEdit = true, }) {
|
|
40
|
-
const [fileIDList, setfileIDList] = React.useState(filterStrList([].concat(defaultValue, value))); // 上传成功文件ID列表,fileID[]
|
|
40
|
+
const [fileIDList, setfileIDList] = React.useState(isInIde() ? [] : filterStrList([].concat(defaultValue, value))); // 上传成功文件ID列表,fileID[]
|
|
41
41
|
const [fileList, setFileList] = React.useState([]); // 上传中的文件列表,file[],file为原始文件 + uuid属性
|
|
42
42
|
const [fileSizeObj, setFileSizeObj] = React.useState({}); // 管理上传文件大小 {uuid:size}
|
|
43
43
|
// 两次默认值不同, 需要刷新
|
|
44
44
|
const prevDefaultRef = React.useRef([]);
|
|
45
45
|
const fileRef = React.useRef(fileIDList);
|
|
46
|
+
const maxSizeLimit = maxSize > 500 ? 500 : maxSize;
|
|
46
47
|
React.useMemo(() => {
|
|
47
48
|
//有有效默认值时不刷新,解决初次渲染默认值不显示问题
|
|
48
|
-
if (
|
|
49
|
+
if (!isInIde() &&
|
|
50
|
+
defaultValue &&
|
|
49
51
|
!isObjectEqual(prevDefaultRef.current, defaultValue) &&
|
|
50
52
|
(JSON.stringify(prevDefaultRef.current) == '[]' ||
|
|
51
53
|
!prevDefaultRef.current)) {
|
|
@@ -115,7 +117,7 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
115
117
|
multiple: !single,
|
|
116
118
|
};
|
|
117
119
|
tips && (uploadProps['label'] = tips);
|
|
118
|
-
|
|
120
|
+
maxSizeLimit && (uploadProps['maxSize'] = maxSizeLimit * 1024 * 1024);
|
|
119
121
|
const btnDisabled = fileIDList.length >= maxUploadCount ||
|
|
120
122
|
(single && fileIDList.length > 0) ||
|
|
121
123
|
disabled;
|
|
@@ -150,9 +152,9 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
150
152
|
weui.alert(`上传文件总数不能超过${maxUploadCount}个`);
|
|
151
153
|
return false;
|
|
152
154
|
}
|
|
153
|
-
if (
|
|
154
|
-
fileList.some((f) => f.size >
|
|
155
|
-
weui.alert(`请上传不超过${
|
|
155
|
+
if (maxSizeLimit &&
|
|
156
|
+
fileList.some((f) => f.size > maxSizeLimit * 1024 * 1024)) {
|
|
157
|
+
weui.alert(`请上传不超过${maxSizeLimit}M的文件`);
|
|
156
158
|
return false;
|
|
157
159
|
}
|
|
158
160
|
if (fileList.some((f) => f.size > 1024 * 1024 * 1024)) {
|
|
@@ -203,7 +205,7 @@ const TcbFileEcho = ({ fileID, disabled }) => {
|
|
|
203
205
|
React.createElement("div", { className: `${CLASS_PREFIX}__item-left` },
|
|
204
206
|
React.createElement(UploadFileStatus, { title: label, size: fileSizeObj[fileID] || '--' })),
|
|
205
207
|
React.createElement("div", { className: `${CLASS_PREFIX}__btn-group` },
|
|
206
|
-
React.createElement(UploadFileAction, { disabled: disabled, status: "UPLOAD_STATUS_SUCCESS", fileID: fileID, src: src }))));
|
|
208
|
+
React.createElement(UploadFileAction, { title: label, disabled: disabled, status: "UPLOAD_STATUS_SUCCESS", fileID: fileID, src: src }))));
|
|
207
209
|
};
|
|
208
210
|
/**
|
|
209
211
|
* 基于 File 上传文件过程组件
|
|
@@ -296,7 +298,7 @@ const UploadFileStatus = ({ status = 'UPLOAD_STATUS_SUCCESS', percent = 0, size,
|
|
|
296
298
|
* 操作列组件, onChange 从最外层 UploadFilePc 传进来
|
|
297
299
|
* props: { status, fileID, uuid, src, onChange }
|
|
298
300
|
*/
|
|
299
|
-
const UploadFileAction = ({ status = 'UPLOAD_STATUS_PENDING', fileID = '', uuid = '', src = '', file = null, onReLoad = null, onCancel = null, disabled, }) => {
|
|
301
|
+
const UploadFileAction = ({ status = 'UPLOAD_STATUS_PENDING', fileID = '', uuid = '', src = '', file = null, onReLoad = null, onCancel = null, disabled, title = 'downfile', }) => {
|
|
300
302
|
const { onChange, downloadVisible, deleteVisible, isEdit } = React.useContext(FileContext) || {};
|
|
301
303
|
// 操作列按钮-删除
|
|
302
304
|
const renderDelete = () => isEdit && (React.createElement(Button, { icon: "delete", onClick: () => onChange === null || onChange === void 0 ? void 0 : onChange({ fileID, uuid, type: 'delete' }), disabled: disabled }));
|
|
@@ -307,7 +309,7 @@ const UploadFileAction = ({ status = 'UPLOAD_STATUS_PENDING', fileID = '', uuid
|
|
|
307
309
|
onReLoad === null || onReLoad === void 0 ? void 0 : onReLoad(file);
|
|
308
310
|
} }));
|
|
309
311
|
// 操作列按钮-下载
|
|
310
|
-
const renderDownLoad = () => (React.createElement(Button, { icon: "download", onClick: () => downloadFile(src) }));
|
|
312
|
+
const renderDownLoad = () => (React.createElement(Button, { icon: "download", onClick: () => downloadFile(src, title) }));
|
|
311
313
|
switch (status) {
|
|
312
314
|
case 'UPLOAD_STATUS_PENDING':
|
|
313
315
|
return renderCancel();
|
|
@@ -22,3 +22,14 @@ export interface IUploaderFilePc extends CommonFormPropsType {
|
|
|
22
22
|
isEdit?: boolean;
|
|
23
23
|
onChange?: unknownFunction;
|
|
24
24
|
}
|
|
25
|
+
export interface IUploadFileAction {
|
|
26
|
+
status?: string;
|
|
27
|
+
fileID?: string;
|
|
28
|
+
uuid?: string;
|
|
29
|
+
src?: string;
|
|
30
|
+
file?: any;
|
|
31
|
+
onReLoad?: any;
|
|
32
|
+
onCancel?: any;
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
title?: string;
|
|
35
|
+
}
|