@kmkf-fe-packages/services-components 1.0.3-alpha.1 → 1.0.3-alpha.10

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.
@@ -19,9 +19,10 @@ declare class Label implements ComponentInterface {
19
19
  getComponentValue: (r: Record) => any;
20
20
  editRender: (p: any) => React.JSX.Element;
21
21
  renderClient: (record: any) => React.JSX.Element | null;
22
+ showDetail: (value: Array<string>) => React.JSX.Element;
22
23
  renderPc: (value: any, record: Record) => React.JSX.Element;
23
- renderLog: (r: Record) => null;
24
- renderExport: (value: any, record: Record) => string;
24
+ renderLog: (r: Record) => React.JSX.Element;
25
+ renderExport: (value: any, record: Record) => any;
25
26
  filterConfig: (item: ColumnConfig) => never[];
26
27
  }
27
28
  export default Label;
@@ -7,30 +7,34 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
7
7
  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); }
8
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
9
  import React from "react";
10
- import { Tag, Select } from 'antd';
10
+ import { Tag, Select, Space } from 'antd';
11
11
  import { LabelData, isNull } from "@kmkf-fe-packages/kmkf-utils";
12
12
  import GetFormItem from "../GetFormItem";
13
13
  import ItemView from "../../commonComponents/ItemView";
14
- var tagRender = function tagRender(props) {
15
- var label = props.label,
16
- closable = props.closable,
17
- onClose = props.onClose,
18
- color = props.color;
19
- var onPreventMouseDown = function onPreventMouseDown(event) {
20
- event.preventDefault();
21
- event.stopPropagation();
22
- };
23
- return /*#__PURE__*/React.createElement(Tag, {
24
- color: color,
25
- onMouseDown: onPreventMouseDown,
26
- closable: closable,
27
- onClose: onClose,
28
- style: {
29
- marginRight: 3
30
- }
31
- }, label);
32
- };
33
14
  var EditRenderItem = function EditRenderItem(props) {
15
+ var tagRender = function tagRender(prop) {
16
+ var _props$options, _props$options$find;
17
+ var label = prop.label,
18
+ closable = prop.closable,
19
+ onClose = prop.onClose,
20
+ value = prop.value;
21
+ var color = props === null || props === void 0 ? void 0 : (_props$options = props.options) === null || _props$options === void 0 ? void 0 : (_props$options$find = _props$options.find(function (item) {
22
+ return item.value === value;
23
+ })) === null || _props$options$find === void 0 ? void 0 : _props$options$find.color;
24
+ var onPreventMouseDown = function onPreventMouseDown(event) {
25
+ event.preventDefault();
26
+ event.stopPropagation();
27
+ };
28
+ return /*#__PURE__*/React.createElement(Tag, {
29
+ color: color,
30
+ onMouseDown: onPreventMouseDown,
31
+ closable: closable,
32
+ onClose: onClose,
33
+ style: {
34
+ marginRight: 3
35
+ }
36
+ }, label);
37
+ };
34
38
  return /*#__PURE__*/React.createElement(Select, _extends({}, props, {
35
39
  mode: "multiple",
36
40
  showArrow: true,
@@ -55,7 +59,7 @@ var Label = /*#__PURE__*/_createClass(function Label(options) {
55
59
  _defineProperty(this, "options", void 0);
56
60
  _defineProperty(this, "labelDateInstance", void 0);
57
61
  _defineProperty(this, "getComponentValue", function (r) {
58
- return r === null || r === void 0 ? void 0 : r["".concat(_this.id)];
62
+ return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_label")];
59
63
  });
60
64
  _defineProperty(this, "editRender", function (p) {
61
65
  var _this$componentConfig, _this$componentConfig2;
@@ -76,25 +80,40 @@ var Label = /*#__PURE__*/_createClass(function Label(options) {
76
80
  });
77
81
  });
78
82
  _defineProperty(this, "renderClient", function (record) {
83
+ console.debug('renderClient', record);
79
84
  return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
80
85
  id: _this.id,
81
86
  label: _this.name,
82
- value: _this.renderPc(undefined, record)
87
+ value: _this.showDetail(record === null || record === void 0 ? void 0 : record["".concat(_this.id)])
83
88
  }) : null;
84
89
  });
85
- _defineProperty(this, "renderPc", function (value, record) {
86
- var _record;
87
- return /*#__PURE__*/React.createElement("span", null, Array.isArray(record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_label")]) ? record === null || record === void 0 ? void 0 : (_record = record["".concat(_this.id, "_label")]) === null || _record === void 0 ? void 0 : _record.map(function (item) {
88
- return /*#__PURE__*/React.createElement(Tag, {
89
- color: item.color
90
- }, item.label);
90
+ _defineProperty(this, "showDetail", function (value) {
91
+ return /*#__PURE__*/React.createElement(Space, {
92
+ style: {
93
+ flexWrap: 'wrap'
94
+ }
95
+ }, Array.isArray(value) ? value === null || value === void 0 ? void 0 : value.map(function (v) {
96
+ var _this$labelDateInstan;
97
+ var label = ((_this$labelDateInstan = _this.labelDateInstance.labelData) === null || _this$labelDateInstan === void 0 ? void 0 : _this$labelDateInstan.find(function (item) {
98
+ return item.value === v;
99
+ })) || {};
100
+ if (!isNull(label)) return /*#__PURE__*/React.createElement(Tag, {
101
+ color: label === null || label === void 0 ? void 0 : label.color
102
+ }, label === null || label === void 0 ? void 0 : label.label);
103
+ return null;
91
104
  }) : "--");
92
105
  });
106
+ _defineProperty(this, "renderPc", function (value, record) {
107
+ return _this.showDetail(record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_label")]);
108
+ });
93
109
  _defineProperty(this, "renderLog", function (r) {
94
- return null;
110
+ console.debug('renderLog', r);
111
+ return _this.renderPc(undefined, r);
95
112
  });
96
113
  _defineProperty(this, "renderExport", function (value, record) {
97
- return '--';
114
+ var _record;
115
+ console.debug('renderExport', record);
116
+ return record === null || record === void 0 ? void 0 : (_record = record["".concat(_this.id, "_label")]) === null || _record === void 0 ? void 0 : _record.join('、');
98
117
  });
99
118
  _defineProperty(this, "filterConfig", function (item) {
100
119
  return [];
@@ -111,6 +130,6 @@ var Label = /*#__PURE__*/_createClass(function Label(options) {
111
130
  this.children = [];
112
131
  this.dataType = "array";
113
132
  this.options = ((_this$componentConfig3 = this.componentConfig) === null || _this$componentConfig3 === void 0 ? void 0 : _this$componentConfig3.options) || [];
114
- this.labelDateInstance = new LabelData();
133
+ this.labelDateInstance = LabelData.getInstance();
115
134
  });
116
135
  export default Label;
@@ -266,6 +266,12 @@ export var queryLabel = function queryLabel() {
266
266
  }).then(function (res) {
267
267
  var data = res.data;
268
268
  var instance = LabelData.getInstance();
269
- instance.labelData = data;
269
+ try {
270
+ var finalData = JSON.parse(data);
271
+ instance.labelData = finalData;
272
+ } catch (e) {
273
+ console.error('转换标签数据数据异常');
274
+ instance.labelData = [];
275
+ }
270
276
  });
271
277
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "1.0.3-alpha.1",
3
+ "version": "1.0.3-alpha.10",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -20,8 +20,8 @@
20
20
  ]
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/basic-components": "^1.0.3-alpha.0",
24
- "@kmkf-fe-packages/kmkf-utils": "^1.0.3-alpha.0"
23
+ "@kmkf-fe-packages/basic-components": "^1.0.3-alpha.10",
24
+ "@kmkf-fe-packages/kmkf-utils": "^1.0.3-alpha.10"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@typescript-eslint/eslint-plugin": "^5.59.2",
@@ -37,7 +37,7 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "3714facd974aedc0ffc02d9af96b9662dd410ab4",
40
+ "gitHead": "6537c714bd1ebb87ce25990714fbd52800c9e5a1",
41
41
  "gitHooks": {
42
42
  "pre-commit": "lint-staged"
43
43
  }