@chaoswise/business 1.0.0 → 1.0.2

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.
@@ -30,8 +30,8 @@ var DoUser = function DoUser(_ref) {
30
30
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, tooltipContent[key], " ", item[key] || '', ' '), /*#__PURE__*/React.createElement("br", null));
31
31
  });
32
32
  };
33
- var nameKey = componentType === 'USER_GROUP' ? 'groupName' : 'userAlias';
34
- return /*#__PURE__*/React.createElement(Fragment, null, belongComponentType === 'TABLE' ? /*#__PURE__*/React.createElement(TagShowMoreList, {
33
+ var nameKey = componentType === "USER_GROUP" ? 'groupName' : 'userAlias';
34
+ return /*#__PURE__*/React.createElement(Fragment, null, belongComponentType === "TABLE" ? /*#__PURE__*/React.createElement(TagShowMoreList, {
35
35
  text: list,
36
36
  tagCount: 1,
37
37
  flag: "user",
@@ -53,9 +53,9 @@ var DoUser = function DoUser(_ref) {
53
53
  }, /*#__PURE__*/React.createElement(_Avatar, {
54
54
  className: 'ci-detail-avatar',
55
55
  size: "small"
56
- }, (_ref2 = item.userAlias || item.name) === null || _ref2 === void 0 ? void 0 : _ref2.substring(0, 1)), /*#__PURE__*/React.createElement("div", {
56
+ }, (_ref2 = item.userAlias ? "".concat(item.userName, "(").concat(item.userAlias, ")") : item.name) === null || _ref2 === void 0 ? void 0 : _ref2.substring(0, 1)), /*#__PURE__*/React.createElement("div", {
57
57
  className: 'ci-detail-user-name'
58
- }, item.userAlias || item.name)));
58
+ }, item.userAlias ? "".concat(item.userName, "(").concat(item.userAlias, ")") : item.name)));
59
59
  })));
60
60
  };
61
61
  export default DoUser;
@@ -55,7 +55,12 @@ var TagShowMoreList = function TagShowMoreList(props) {
55
55
  var classNameDiv = _className || 'wrapper-inner';
56
56
  return tags.map(function (item, index) {
57
57
  var _String;
58
- var _name = item[nameKey] || (item === null || item === void 0 ? void 0 : item.ciName) || (item === null || item === void 0 ? void 0 : item.id);
58
+ var _name = '';
59
+ if (nameKey == 'userAlias') {
60
+ _name = item.userAlias ? "".concat(item === null || item === void 0 ? void 0 : item.userName, "(").concat(item === null || item === void 0 ? void 0 : item.userAlias, ")") : item === null || item === void 0 ? void 0 : item.id;
61
+ } else {
62
+ _name = item[nameKey] || (item === null || item === void 0 ? void 0 : item.ciName) || (item === null || item === void 0 ? void 0 : item.id);
63
+ }
59
64
  return /*#__PURE__*/React.createElement(_Tooltip, {
60
65
  title: tooltipContentFuc ? tooltipContentFuc(item) : _name,
61
66
  key: index,
@@ -1,15 +1,23 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1
2
  import _Tooltip from "@chaoswise/ui/lib/Tooltip";
2
3
  import _Form from "@chaoswise/ui/lib/Form";
3
4
  import _Collapse from "@chaoswise/ui/lib/Collapse";
4
- var _excluded = ["schemaData", "detailContent"],
5
- _excluded2 = ["item", "detailContent"];
5
+ var _excluded = ["schemaData", "detailContent", "filterAttrs"],
6
+ _excluded2 = ["properties", "attrID"],
7
+ _excluded3 = ["item", "detailContent"];
6
8
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
9
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
14
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
15
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
9
16
  import React, { useState, useEffect, useMemo, memo } from 'react';
10
17
  import { getDescriptionComp, getDataFunc, judgmentTypeFunc } from './config/utils';
11
18
  import { useIntl } from '../locales';
12
19
  import './index.less';
20
+ import PropTypes from "prop-types";
13
21
  var Panel = _Collapse.Panel;
14
22
  var compositeAttr = {
15
23
  UNIT_RANGE: 1,
@@ -21,11 +29,33 @@ var setWidthClassName = {
21
29
  var PropertyControlViewer = function PropertyControlViewer(_ref) {
22
30
  var schemaData = _ref.schemaData,
23
31
  detailContent = _ref.detailContent,
32
+ filterAttrs = _ref.filterAttrs,
24
33
  rest = _objectWithoutProperties(_ref, _excluded);
25
34
  var intl = useIntl();
35
+ var _schemaData = useMemo(function () {
36
+ if (!filterAttrs || filterAttrs.length == 0) {
37
+ return schemaData;
38
+ }
39
+ var filteredData = schemaData.map(function (_ref2) {
40
+ var properties = _ref2.properties,
41
+ attrID = _ref2.attrID,
42
+ rest = _objectWithoutProperties(_ref2, _excluded2);
43
+ return _objectSpread(_objectSpread({}, rest), {}, {
44
+ attrID: attrID,
45
+ properties: properties.filter(function (property) {
46
+ return !filterAttrs.some(function (_ref3) {
47
+ var attrGroupId = _ref3.attrGroupId,
48
+ conditionAttrID = _ref3.attrID;
49
+ return attrID === attrGroupId && property.attrID === conditionAttrID;
50
+ });
51
+ })
52
+ });
53
+ });
54
+ return filteredData;
55
+ }, [schemaData]);
26
56
  var comList = useMemo(function () {
27
- if (schemaData && schemaData.length > 0) {
28
- return schemaData.map(function (i, index) {
57
+ if (_schemaData && _schemaData.length > 0) {
58
+ return _schemaData.map(function (i, index) {
29
59
  if (i.componentType === 'ATTRIBUTE_GROUP') {
30
60
  return /*#__PURE__*/React.createElement(_Collapse, {
31
61
  key: i.attrID,
@@ -71,7 +101,7 @@ var PropertyControlViewer = function PropertyControlViewer(_ref) {
71
101
  } else {
72
102
  return null;
73
103
  }
74
- }, [schemaData]);
104
+ }, [_schemaData]);
75
105
  return /*#__PURE__*/React.createElement(_Form, {
76
106
  style: {
77
107
  minHeight: '100%'
@@ -81,11 +111,11 @@ var PropertyControlViewer = function PropertyControlViewer(_ref) {
81
111
  className: "form-properties-box form-properties-view-box"
82
112
  }, comList));
83
113
  };
84
- var AttrFormItem = /*#__PURE__*/memo(function (_ref2) {
114
+ var AttrFormItem = /*#__PURE__*/memo(function (_ref4) {
85
115
  var _detailContent$conten;
86
- var item = _ref2.item,
87
- detailContent = _ref2.detailContent,
88
- rest = _objectWithoutProperties(_ref2, _excluded2);
116
+ var item = _ref4.item,
117
+ detailContent = _ref4.detailContent,
118
+ rest = _objectWithoutProperties(_ref4, _excluded3);
89
119
  var attrID = item.attrID,
90
120
  attrName = item.attrName,
91
121
  componentType = item.componentType,
@@ -125,4 +155,41 @@ var AttrFormItem = /*#__PURE__*/memo(function (_ref2) {
125
155
  data: data
126
156
  })))));
127
157
  });
158
+ PropertyControlViewer.propTypes = {
159
+ /**
160
+ * 模型属性数据
161
+ */
162
+ schemaData: PropTypes.array.isRequired,
163
+ /**
164
+ * 配置项数据
165
+ */
166
+ detailContent: PropTypes.object.isRequired,
167
+ /**
168
+ * 需要过滤隐藏的属性
169
+ */
170
+ filterAttrs: PropTypes.arrayOf(PropTypes.shape({
171
+ "attrGroupId": PropTypes.string,
172
+ "attrID": PropTypes.string
173
+ })),
174
+ /**
175
+ * 属性类型为input和textarea自动溢出省略,为对象时可设置省略行数与是否可展开等
176
+ */
177
+ paragraphEllipsis: PropTypes.oneOf([PropTypes["boolean"], PropTypes.object]),
178
+ /**
179
+ * 属性类型为select和checkbox, 可设置显示的数量
180
+ */
181
+ tagCount: PropTypes.number,
182
+ /**
183
+ * 属性类型为quote的点击事件
184
+ */
185
+ handleClickChange: PropTypes.func,
186
+ /**
187
+ * 属性类型为user,鼠标悬浮显示的tooltip字段
188
+ */
189
+ userTooltipContent: PropTypes.object,
190
+ /**
191
+ * 属性类型为userGroup, 鼠标悬浮显示的tooltip字段
192
+ */
193
+ userGroupTooltipContent: PropTypes.object
194
+ };
128
195
  export default PropertyControlViewer;
@@ -23,6 +23,7 @@
23
23
  }
24
24
 
25
25
  .view_table {
26
+ margin-bottom: 24px;
26
27
  .@{ant-prefix}-form-item-control-wrapper {
27
28
  width: calc(100% - 110px);
28
29
  }
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default as PropertyControlViewer } from "./PropertyControlViewer";
2
2
  export { default as AggregateSearch } from "./AggregateSearch";
3
- export { default as Watermark } from "./Watermark";
3
+ export { default as Watermark } from "./Watermark";
4
+ export { default as ContentEditableSearch } from "./ContentEditableSearch";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chaoswise/business",
3
3
  "packageName": "chaoswiseBusiness",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "description": "业务组件库",
6
6
  "keywords": [
7
7
  "ui",
@@ -111,5 +111,6 @@
111
111
  "publishConfig": {
112
112
  "access": "public"
113
113
  },
114
- "license": "MIT"
114
+ "license": "MIT",
115
+ "gitHead": "3afd9f5a5ef3366719650108213fc011128ce303"
115
116
  }