@chaoswise/business 0.0.3 → 0.0.5
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/README.md +1 -110
- package/lib/PropertyControlViewer/assets/doSelect.less +1 -1
- package/lib/PropertyControlViewer/components/DoCommon.js +11 -4
- package/lib/PropertyControlViewer/components/DoSelect.js +1 -1
- package/lib/PropertyControlViewer/components/DoUser.js +5 -2
- package/lib/PropertyControlViewer/config/utils.js +13 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,113 +1,4 @@
|
|
|
1
1
|
|
|
2
2
|
# 项目名称
|
|
3
|
-
前端公共组件库
|
|
4
|
-
# 一句话了解我
|
|
5
|
-
基于antd3.x根据公司UIUE规范进行二次封装的前端公共组件库,用于统一公司产品风格,提高研发人员开发效率
|
|
6
|
-
|
|
7
|
-
# Features
|
|
8
|
-
#### 1. 包含符合UIUE的公共组件
|
|
9
|
-
#### 2. 支持antd全部组件,引用和使用方法参考[antd官方文档](https://3x.ant.design/docs/react/introduce-cn)
|
|
10
|
-
#### 3. 支持按需加载
|
|
11
|
-
|
|
12
|
-
# 分支说明
|
|
13
|
-
master: 主分支
|
|
14
|
-
develop: 开发分支
|
|
15
|
-
基于develop分支开发,然后提交MR到仓库中
|
|
16
|
-
|
|
17
|
-
# [组件开发文档](./DEVELOP.md)
|
|
18
|
-
|
|
19
|
-
# 使用方法
|
|
20
|
-
### 安装
|
|
21
|
-
```
|
|
22
|
-
npm i @chaoswise/ui -S
|
|
23
|
-
```
|
|
24
|
-
### 常规组件使用
|
|
25
|
-
```jsx
|
|
26
|
-
// antd组件和自定义组件全部使用按需引入形式
|
|
27
|
-
import { Button } from '@chaoswise/ui';
|
|
28
|
-
|
|
29
|
-
const Demo = () => {
|
|
30
|
-
return (
|
|
31
|
-
<Button type='primary'>Submit</Button>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default Demo;
|
|
36
|
-
```
|
|
37
|
-
### Formily组件使用
|
|
38
|
-
```jsx
|
|
39
|
-
// 目前已经集成以下组件和api
|
|
40
|
-
import { Form, FormItem, MegaLayout, FieldList, FormButtonGroup, FormPath, Reset, Submit, subscribeFields } from '@chaoswise/ui/formily';
|
|
41
|
-
// 如需使用formily相关其它api 从formily引入
|
|
42
|
-
import { formily } from '@chaoswise/ui/formily';
|
|
43
|
-
const { useEffect } = formily;
|
|
44
|
-
```
|
|
45
|
-
### 脱离公共框架使用需要配置按需引用配置
|
|
46
|
-
修改babel-loader下的babel-plugin-import插件配置(脱离公共框架独立使用)
|
|
47
|
-
```jsx
|
|
48
|
-
// 引入配置
|
|
49
|
-
const babelConfig = require("@chaoswise/ui/config/babel");
|
|
50
|
-
const formilyBabel = require("@chaoswise/ui/config/babel/formily");
|
|
51
|
-
|
|
52
|
-
// 方案1
|
|
53
|
-
plugins: [
|
|
54
|
-
[
|
|
55
|
-
"import",
|
|
56
|
-
[
|
|
57
|
-
babelConfig, // @chaoswise/ui 按需引入babel配置
|
|
58
|
-
{
|
|
59
|
-
libraryName: "antd",
|
|
60
|
-
style: true
|
|
61
|
-
},
|
|
62
|
-
formilyBabel, // @chaoswise/ui/formily 按需引入babel配置
|
|
63
|
-
]
|
|
64
|
-
]
|
|
65
|
-
]
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// 方案2
|
|
69
|
-
plugins: [
|
|
70
|
-
[
|
|
71
|
-
"import",
|
|
72
|
-
babelConfig, // @chaoswise/ui 按需引入babel配置
|
|
73
|
-
"chaoswise"
|
|
74
|
-
],
|
|
75
|
-
[
|
|
76
|
-
"import",
|
|
77
|
-
{
|
|
78
|
-
libraryName: "antd",
|
|
79
|
-
style: true
|
|
80
|
-
},
|
|
81
|
-
"antd"
|
|
82
|
-
],
|
|
83
|
-
[
|
|
84
|
-
"import",
|
|
85
|
-
formilyBabel, // @chaoswise/ui/formily 按需引入babel配置
|
|
86
|
-
"formily"
|
|
87
|
-
],
|
|
88
|
-
]
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
```
|
|
93
|
-
# 注意:
|
|
94
|
-
以下组件基于antd进行了二次封装,请查看相关组件文档
|
|
95
|
-
|
|
96
|
-
组件名称 | 备注
|
|
97
|
-
---|---
|
|
98
|
-
Pagination | 统一UE风格,api不变
|
|
99
|
-
Modal | 支持可拖拽
|
|
100
|
-
Upload | 基于antd的Upload封装,增加进度条显示,api有变化,具体见文档
|
|
101
|
-
ConfigProvider | 在原有基础上增加国际化切换方案
|
|
102
|
-
Empty | 统一UE风格,api不变
|
|
103
|
-
---
|
|
104
|
-
如需引用antd原生组件
|
|
105
|
-
```
|
|
106
|
-
import Upload from '@chaoswise/ui/lib/Antd/Upload';
|
|
107
|
-
```
|
|
108
|
-
# 其它相关文档
|
|
109
|
-
1. [组件预览以及文档地址](http://10.0.1.133:8888/#/iframe/businessui)
|
|
110
|
-
2. [更新日志](https://yunzhihui.feishu.cn/docs/doccnKZ3vU8U1I8v1iFX6uUaG1g)
|
|
111
|
-
|
|
112
|
-
#
|
|
113
3
|
|
|
4
|
+
业务组件库
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _TooltipText from "@chaoswise/ui/lib/TooltipText";
|
|
2
2
|
import _Typography from "@chaoswise/ui/lib/Antd/Typography";
|
|
3
3
|
import React, { Fragment } from "react";
|
|
4
4
|
var Paragraph = _Typography.Paragraph;
|
|
@@ -11,12 +11,19 @@ var DoCommon = function DoCommon(_ref) {
|
|
|
11
11
|
wordBreak: "break-all"
|
|
12
12
|
}
|
|
13
13
|
}, (list || []).map(function (item, index) {
|
|
14
|
-
return /*#__PURE__*/React.createElement(
|
|
14
|
+
return /*#__PURE__*/React.createElement(_TooltipText, {
|
|
15
15
|
title: item.value,
|
|
16
16
|
key: index
|
|
17
17
|
}, paragraphEllipsis ? /*#__PURE__*/React.createElement(Paragraph, {
|
|
18
|
-
ellipsis: paragraphEllipsis
|
|
19
|
-
|
|
18
|
+
ellipsis: paragraphEllipsis,
|
|
19
|
+
style: {
|
|
20
|
+
whiteSpace: 'initial'
|
|
21
|
+
}
|
|
22
|
+
}, item.value) : /*#__PURE__*/React.createElement("span", {
|
|
23
|
+
style: {
|
|
24
|
+
whiteSpace: 'initial'
|
|
25
|
+
}
|
|
26
|
+
}, item.value));
|
|
20
27
|
})));
|
|
21
28
|
};
|
|
22
29
|
export default DoCommon;
|
|
@@ -8,24 +8,27 @@ var DoUser = function DoUser(_ref) {
|
|
|
8
8
|
var belongComponentType = data.belongComponentType,
|
|
9
9
|
fieldWidth = data.fieldWidth,
|
|
10
10
|
tooltipContent = data.tooltipContent,
|
|
11
|
-
list = data.list
|
|
11
|
+
list = data.list,
|
|
12
|
+
componentType = data.componentType;
|
|
12
13
|
var gridShare = belongComponentType === "TABLE" ? '100%' : fieldWidth == 'WHOLE_LINE' ? '25%' : '50%';
|
|
13
14
|
var tooltipContentFuc = function tooltipContentFuc(item) {
|
|
14
15
|
return Object.keys(tooltipContent).map(function (key) {
|
|
15
16
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, tooltipContent[key], " ", item[key] || "", " "), /*#__PURE__*/React.createElement("br", null));
|
|
16
17
|
});
|
|
17
18
|
};
|
|
19
|
+
var nameKey = componentType === "USER_GROUP" ? 'groupName' : 'userName';
|
|
18
20
|
return /*#__PURE__*/React.createElement(Fragment, null, belongComponentType === "TABLE" ? /*#__PURE__*/React.createElement(TagShowMoreList, {
|
|
19
21
|
text: list,
|
|
20
22
|
tagCount: 1,
|
|
21
23
|
flag: "user",
|
|
22
|
-
nameKey:
|
|
24
|
+
nameKey: nameKey,
|
|
23
25
|
tooltipContentFuc: tooltipContentFuc
|
|
24
26
|
}) : /*#__PURE__*/React.createElement("div", {
|
|
25
27
|
className: 'ci-detail-user'
|
|
26
28
|
}, (list || []).map(function (item) {
|
|
27
29
|
var _item$name;
|
|
28
30
|
return /*#__PURE__*/React.createElement(_Tooltip, {
|
|
31
|
+
placement: "topLeft",
|
|
29
32
|
title: tooltipContentFuc(item),
|
|
30
33
|
key: item.id
|
|
31
34
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -19,7 +19,7 @@ export var getDescriptionComp = function getDescriptionComp(type) {
|
|
|
19
19
|
// 时间格式化
|
|
20
20
|
export var dateFormatFunc = function dateFormatFunc(timestamp) {
|
|
21
21
|
var fmt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD HH:mm:ss';
|
|
22
|
-
return moment(timestamp).format(fmt);
|
|
22
|
+
return timestamp ? moment(timestamp).format(fmt) : '--';
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
// 判断是否浅色
|
|
@@ -164,7 +164,7 @@ export var getDataFunc = function getDataFunc(value, item, rest) {
|
|
|
164
164
|
expandable: true
|
|
165
165
|
},
|
|
166
166
|
list: [{
|
|
167
|
-
value: unit ? value + " " + unit : value
|
|
167
|
+
value: value ? unit ? value + " " + unit : value : '--'
|
|
168
168
|
}]
|
|
169
169
|
};
|
|
170
170
|
break;
|
|
@@ -173,7 +173,7 @@ export var getDataFunc = function getDataFunc(value, item, rest) {
|
|
|
173
173
|
case "AUTO_CALCULATE":
|
|
174
174
|
data = {
|
|
175
175
|
list: [{
|
|
176
|
-
value: unit ? value + " " + unit : value
|
|
176
|
+
value: value ? unit ? value + " " + unit : value : '--'
|
|
177
177
|
}]
|
|
178
178
|
};
|
|
179
179
|
break;
|
|
@@ -228,6 +228,12 @@ export var getDataFunc = function getDataFunc(value, item, rest) {
|
|
|
228
228
|
};
|
|
229
229
|
break;
|
|
230
230
|
case "NUMBER_RANGE":
|
|
231
|
+
data = {
|
|
232
|
+
list: [{
|
|
233
|
+
value: value ? unit ? (value === null || value === void 0 ? void 0 : value.join(" - ")) + ' ' + unit : value === null || value === void 0 ? void 0 : value.join(" - ") : '--'
|
|
234
|
+
}]
|
|
235
|
+
};
|
|
236
|
+
break;
|
|
231
237
|
case "RACK_UNIT":
|
|
232
238
|
data = {
|
|
233
239
|
list: [{
|
|
@@ -256,6 +262,7 @@ export var getDataFunc = function getDataFunc(value, item, rest) {
|
|
|
256
262
|
fieldWidth: fieldWidth,
|
|
257
263
|
tooltipContent: userTooltipContent || userTooltip,
|
|
258
264
|
belongComponentType: belongComponentType,
|
|
265
|
+
componentType: componentType,
|
|
259
266
|
list: (value ? Array.isArray(value) ? value : [value] : []).map(function (i) {
|
|
260
267
|
console.log(i, 'oooo');
|
|
261
268
|
i.id = i === null || i === void 0 ? void 0 : i.userId;
|
|
@@ -273,6 +280,7 @@ export var getDataFunc = function getDataFunc(value, item, rest) {
|
|
|
273
280
|
fieldWidth: fieldWidth,
|
|
274
281
|
tooltipContent: userGroupTooltipContent || userGroupTooltip,
|
|
275
282
|
belongComponentType: belongComponentType,
|
|
283
|
+
componentType: componentType,
|
|
276
284
|
list: (value ? Array.isArray(value) ? value : [value] : []).map(function (i) {
|
|
277
285
|
i.id = i === null || i === void 0 ? void 0 : i.groupId;
|
|
278
286
|
i.name = i === null || i === void 0 ? void 0 : i.groupName;
|
|
@@ -316,7 +324,8 @@ export var getDataFunc = function getDataFunc(value, item, rest) {
|
|
|
316
324
|
break;
|
|
317
325
|
case "UNIT_BITMAP":
|
|
318
326
|
data = {
|
|
319
|
-
list: (value === null || value === void 0 ? void 0 : value.units) || []
|
|
327
|
+
list: (value === null || value === void 0 ? void 0 : value.units) || [],
|
|
328
|
+
handleClickChange: handleClickChange
|
|
320
329
|
};
|
|
321
330
|
break;
|
|
322
331
|
case "TABLE":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaoswise/business",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "业务组件库",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"access": "public"
|
|
103
103
|
},
|
|
104
104
|
"license": "MIT",
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "780a8854dd697d36c4d9b7d83fd45cf7aabf082e"
|
|
106
106
|
}
|