@chaoswise/business 0.0.2 → 0.0.4

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 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
- .wrapper {
1
+ .ciWrapper {
2
2
  // width: 150px;
3
3
  height: 28px;
4
4
  font-size: 12px;
@@ -1,4 +1,4 @@
1
- import _Tooltip from "@chaoswise/ui/lib/Tooltip";
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(_Tooltip, {
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
- }, item.value) : /*#__PURE__*/React.createElement("span", null, item.value));
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;
@@ -13,7 +13,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
13
13
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
14
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
15
15
  import React from 'react';
16
- import style from '../assets/doSelect.less';
16
+ import '../assets/doSelect.less';
17
17
  import { isLightColorFunc } from '../config/utils';
18
18
  var DoSelect = function DoSelect(_ref) {
19
19
  var data = _ref.data;
@@ -42,7 +42,7 @@ var DoSelect = function DoSelect(_ref) {
42
42
  width: 'auto'
43
43
  }
44
44
  }, /*#__PURE__*/React.createElement("div", {
45
- className: style[_className],
45
+ className: _className,
46
46
  style: _objectSpread(_objectSpread({}, _style), getColorStyle(item))
47
47
  }, item.value || item.id || ''));
48
48
  });
@@ -57,7 +57,7 @@ var DoSelect = function DoSelect(_ref) {
57
57
  var frontArray = list.slice(0, tagCount);
58
58
  var afterArray = list.slice(tagCount, tagsLength);
59
59
  var _data = /*#__PURE__*/React.createElement("div", {
60
- className: style['inner']
60
+ className: 'inner'
61
61
  }, generateItem(afterArray, 'ant-popover-inner-content'));
62
62
  var frontTags = generateItem(frontArray);
63
63
  var fixedTags = [/*#__PURE__*/React.createElement(_Popover, {
@@ -68,13 +68,13 @@ var DoSelect = function DoSelect(_ref) {
68
68
  },
69
69
  overlayClassName: 'tag-wrapper-inner'
70
70
  }, /*#__PURE__*/React.createElement("div", {
71
- className: style['wrapper-inner-fixed']
71
+ className: 'wrapper-inner-fixed'
72
72
  }, "+ ", afterArray.length))];
73
73
  return [].concat(_toConsumableArray(frontTags), fixedTags);
74
74
  }
75
75
  };
76
76
  return /*#__PURE__*/React.createElement("div", {
77
- className: style['wrapper']
77
+ className: 'ciWrapper'
78
78
  }, renderItem());
79
79
  };
80
80
  export default DoSelect;
@@ -14,7 +14,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
14
14
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
15
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
16
  import React from 'react';
17
- import style from './index.less';
17
+ import './index.less';
18
18
  import classnames from 'classnames';
19
19
  import DoAppIcon from '../DoAppIcon';
20
20
  import { isLightColorFunc } from '../../config/utils';
@@ -64,19 +64,19 @@ var TagShowMoreList = function TagShowMoreList(props) {
64
64
  },
65
65
  placement: "topLeft"
66
66
  }, /*#__PURE__*/React.createElement("div", {
67
- className: style[classNameDiv],
67
+ className: classNameDiv,
68
68
  style: _objectSpread(_objectSpread({}, _style), getColorStyle(item)),
69
69
  onClick: tagClickFuc ? function () {
70
70
  return tagClickFuc(item);
71
71
  } : function () {}
72
72
  }, /*#__PURE__*/React.createElement("div", {
73
- className: style['ellipsis-box'],
73
+ className: 'ellipsis-box',
74
74
  style: {
75
75
  maxWidth: text.length === 1 && option === 'view' || _className ? '100%' : option === 'view' ? 84 : 64
76
76
  }
77
77
  }, flag === "user" ? /*#__PURE__*/React.createElement(_Avatar, {
78
78
  size: 20,
79
- className: style["tag-ci-detail-avatar"]
79
+ className: "tag-ci-detail-avatar"
80
80
  }, (_String = String(_name)) === null || _String === void 0 ? void 0 : _String.substring(0, 1)) : /*#__PURE__*/React.createElement(_Avatar, {
81
81
  size: 20,
82
82
  style: {
@@ -103,7 +103,7 @@ var TagShowMoreList = function TagShowMoreList(props) {
103
103
  var frontTags = generateItem(text.slice(0, tagCount));
104
104
  var afterArray = text.slice(tagCount, tagsLength);
105
105
  var contentData = /*#__PURE__*/React.createElement("div", {
106
- className: style['inner']
106
+ className: 'inner'
107
107
  }, generateItem(afterArray, _style, 'ant-popover-inner-content'));
108
108
  var fixedTags = [/*#__PURE__*/React.createElement(_Popover, {
109
109
  content: contentData,
@@ -114,14 +114,14 @@ var TagShowMoreList = function TagShowMoreList(props) {
114
114
  width: 'auto'
115
115
  }
116
116
  }, /*#__PURE__*/React.createElement("div", {
117
- className: style['wrapper-inner-fixed'],
117
+ className: 'wrapper-inner-fixed',
118
118
  style: _style
119
119
  }, "+ ", afterArray.length))];
120
120
  return [].concat(_toConsumableArray(frontTags), fixedTags);
121
121
  }
122
122
  };
123
123
  return /*#__PURE__*/React.createElement("div", {
124
- className: classnames(style['wrapper'])
124
+ className: classnames('wrapper')
125
125
  }, renderItem());
126
126
  };
127
127
  export default TagShowMoreList;
@@ -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
  // 判断是否浅色
@@ -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: [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaoswise/business",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
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": "7a0ef5b8507244bbace8456a0d658cb8070d933c"
105
+ "gitHead": "3e451b2fffa2333b17f7242c4044f5fc87535cca"
106
106
  }