@chaoswise/business 0.0.4 → 0.0.6

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.
@@ -1,31 +1,52 @@
1
1
  import _Tooltip from "@chaoswise/ui/lib/Tooltip";
2
2
  import _Avatar from "@chaoswise/ui/lib/Antd/Avatar";
3
+ import _ConfigProvider from "@chaoswise/ui/lib/ConfigProvider";
3
4
  import React, { Fragment } from 'react';
4
5
  import '../assets/index.less';
5
6
  import TagShowMoreList from './TagShowMoreList';
7
+ import { getLocale } from "../../locale";
6
8
  var DoUser = function DoUser(_ref) {
7
9
  var data = _ref.data;
8
10
  var belongComponentType = data.belongComponentType,
9
11
  fieldWidth = data.fieldWidth,
10
12
  tooltipContent = data.tooltipContent,
11
- list = data.list;
13
+ list = data.list,
14
+ componentType = data.componentType;
15
+ var _ConfigProvider$useLo = _ConfigProvider.useLocale(),
16
+ _ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
17
+ locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
18
+ var localeObj = getLocale(locale);
19
+ var userTooltip = {
20
+ userName: localeObj.name + ":",
21
+ userAlias: localeObj.userName + ":",
22
+ department: localeObj.department + ":",
23
+ email: localeObj.emil + ":",
24
+ mobile: localeObj.mobile + ":"
25
+ };
26
+ var userGroupTooltip = {
27
+ groupName: localeObj.groupName + ":",
28
+ groupDetails: localeObj.groupDetails + ":"
29
+ };
30
+ tooltipContent = componentType === "USER_GROUP" ? userGroupTooltip : userTooltip;
12
31
  var gridShare = belongComponentType === "TABLE" ? '100%' : fieldWidth == 'WHOLE_LINE' ? '25%' : '50%';
13
32
  var tooltipContentFuc = function tooltipContentFuc(item) {
14
33
  return Object.keys(tooltipContent).map(function (key) {
15
34
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, tooltipContent[key], " ", item[key] || "", " "), /*#__PURE__*/React.createElement("br", null));
16
35
  });
17
36
  };
37
+ var nameKey = componentType === "USER_GROUP" ? 'groupName' : 'userName';
18
38
  return /*#__PURE__*/React.createElement(Fragment, null, belongComponentType === "TABLE" ? /*#__PURE__*/React.createElement(TagShowMoreList, {
19
39
  text: list,
20
40
  tagCount: 1,
21
41
  flag: "user",
22
- nameKey: "userName",
42
+ nameKey: nameKey,
23
43
  tooltipContentFuc: tooltipContentFuc
24
44
  }) : /*#__PURE__*/React.createElement("div", {
25
45
  className: 'ci-detail-user'
26
46
  }, (list || []).map(function (item) {
27
47
  var _item$name;
28
48
  return /*#__PURE__*/React.createElement(_Tooltip, {
49
+ placement: "topLeft",
29
50
  title: tooltipContentFuc(item),
30
51
  key: item.id
31
52
  }, /*#__PURE__*/React.createElement("div", {
@@ -133,8 +133,10 @@ export var judgmentTypeFunc = function judgmentTypeFunc(type, value) {
133
133
  break;
134
134
  case "UNIT_BITMAP":
135
135
  judgmentType = Object.prototype.toString.call(value) === "[object Object]";
136
+ break;
136
137
  default:
137
138
  judgmentType = true;
139
+ break;
138
140
  }
139
141
  return judgmentType;
140
142
  };
@@ -173,7 +175,7 @@ export var getDataFunc = function getDataFunc(value, item, rest) {
173
175
  case "AUTO_CALCULATE":
174
176
  data = {
175
177
  list: [{
176
- value: value ? unit ? value + " " + unit : value : '--'
178
+ value: !(value === undefined || value === null || value === '') ? unit ? value + " " + unit : value : '--'
177
179
  }]
178
180
  };
179
181
  break;
@@ -257,11 +259,11 @@ export var getDataFunc = function getDataFunc(value, item, rest) {
257
259
  email: "邮箱:",
258
260
  mobile: "手机:"
259
261
  };
260
- console.log(value, 'value]]]]]]');
261
262
  data = {
262
263
  fieldWidth: fieldWidth,
263
264
  tooltipContent: userTooltipContent || userTooltip,
264
265
  belongComponentType: belongComponentType,
266
+ componentType: componentType,
265
267
  list: (value ? Array.isArray(value) ? value : [value] : []).map(function (i) {
266
268
  console.log(i, 'oooo');
267
269
  i.id = i === null || i === void 0 ? void 0 : i.userId;
@@ -279,6 +281,7 @@ export var getDataFunc = function getDataFunc(value, item, rest) {
279
281
  fieldWidth: fieldWidth,
280
282
  tooltipContent: userGroupTooltipContent || userGroupTooltip,
281
283
  belongComponentType: belongComponentType,
284
+ componentType: componentType,
282
285
  list: (value ? Array.isArray(value) ? value : [value] : []).map(function (i) {
283
286
  i.id = i === null || i === void 0 ? void 0 : i.groupId;
284
287
  i.name = i === null || i === void 0 ? void 0 : i.groupName;
@@ -322,7 +325,8 @@ export var getDataFunc = function getDataFunc(value, item, rest) {
322
325
  break;
323
326
  case "UNIT_BITMAP":
324
327
  data = {
325
- list: (value === null || value === void 0 ? void 0 : value.units) || []
328
+ list: (value === null || value === void 0 ? void 0 : value.units) || [],
329
+ handleClickChange: handleClickChange
326
330
  };
327
331
  break;
328
332
  case "TABLE":
@@ -0,0 +1,9 @@
1
+ export default {
2
+ name: 'Name',
3
+ userName: 'Username',
4
+ department: 'Department',
5
+ emil: 'Email',
6
+ mobile: "Phone",
7
+ groupName: 'User group',
8
+ groupDetails: 'Description'
9
+ };
@@ -0,0 +1,12 @@
1
+ import zhCN from './zh_CN.js';
2
+ import enUS from './en_US.js';
3
+ export var getLocale = function getLocale(locale) {
4
+ switch (locale) {
5
+ case 'zh':
6
+ return zhCN;
7
+ case 'en':
8
+ return enUS;
9
+ default:
10
+ return zhCN;
11
+ }
12
+ };
@@ -0,0 +1,9 @@
1
+ export default {
2
+ name: '姓名',
3
+ userName: '用户名',
4
+ department: '部门',
5
+ emil: '邮箱',
6
+ mobile: "手机",
7
+ groupName: '用户组',
8
+ groupDetails: '描述'
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaoswise/business",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
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": "3e451b2fffa2333b17f7242c4044f5fc87535cca"
105
+ "gitHead": "e5466e86469163cd6a3964a7e03684ab71c5c20f"
106
106
  }