@kmkf-fe-packages/services-components 2.0.51 → 2.0.52

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.
Files changed (32) hide show
  1. package/dist/esm/commonComponents/GlobalContext/hook/dist/useGetHasErpData.js +52 -0
  2. package/dist/esm/commonComponents/GlobalContext/orderQuery/dist/useGetErpAddressData.js +180 -0
  3. package/dist/esm/commonComponents/GlobalContext/orderQuery/dist/useGetErpLogisticsCompany.js +186 -0
  4. package/dist/esm/commonComponents/OperationLog/index.d.ts +2 -1
  5. package/dist/esm/commonComponents/OperationLog/index.js +6 -2
  6. package/dist/esm/components/BS/BsGoods/dist/index.js +113 -0
  7. package/dist/esm/components/BS/common/BsHeaderChild.d.ts +4 -4
  8. package/dist/esm/components/BS/common/BsHeaderChild.js +8 -10
  9. package/dist/esm/components/BS/common/BsHeaderPic.d.ts +6 -6
  10. package/dist/esm/components/BS/common/BsHeaderPic.js +7 -16
  11. package/dist/esm/components/Common/dist/index.js +1019 -0
  12. package/dist/esm/components/Common/index.d.ts +3 -2
  13. package/dist/esm/components/Common/index.js +187 -143
  14. package/dist/esm/components/Common/index.module.less +1 -0
  15. package/dist/esm/components/Picture/index.d.ts +5 -5
  16. package/dist/esm/components/Picture/index.js +19 -19
  17. package/dist/esm/components/PicturePro/PictureName.d.ts +30 -0
  18. package/dist/esm/components/PicturePro/PictureName.js +132 -0
  19. package/dist/esm/components/PicturePro/PictureUrl.d.ts +26 -0
  20. package/dist/esm/components/PicturePro/PictureUrl.js +93 -0
  21. package/dist/esm/components/PicturePro/index.d.ts +40 -0
  22. package/dist/esm/components/PicturePro/index.js +180 -0
  23. package/dist/esm/components/PicturePro/index.less +63 -0
  24. package/dist/esm/components/StatusSelect/index.js +4 -0
  25. package/dist/esm/constant.d.ts +1 -0
  26. package/dist/esm/constant.js +14 -13
  27. package/dist/esm/factory.d.ts +2 -2
  28. package/dist/esm/factory.js +4 -1
  29. package/dist/esm/index.d.ts +1 -0
  30. package/dist/esm/index.js +1 -0
  31. package/dist/esm/type.d.ts +14 -14
  32. package/package.json +4 -4
@@ -19,3 +19,4 @@
19
19
  display: flex;
20
20
  }
21
21
  }
22
+
@@ -1,5 +1,5 @@
1
- import { ComponentInterface, PickOption, Record } from "../../type";
2
- import React from "react";
1
+ import { ComponentInterface, PickOption, Record } from '../../type';
2
+ import React from 'react';
3
3
  declare type Value = string[] | undefined;
4
4
  declare class BasicPicture implements ComponentInterface {
5
5
  name: string;
@@ -7,13 +7,13 @@ declare class BasicPicture implements ComponentInterface {
7
7
  sortField: string;
8
8
  type: string;
9
9
  rules: any[];
10
- componentConfig: ComponentInterface["componentConfig"];
10
+ componentConfig: ComponentInterface['componentConfig'];
11
11
  isCombinationComponent: boolean;
12
12
  formField: string;
13
13
  canSort: boolean;
14
14
  children: ComponentInterface[];
15
- dataType: ComponentInterface["dataType"];
16
- currenEnv: ComponentInterface["platform"];
15
+ dataType: ComponentInterface['dataType'];
16
+ currenEnv: ComponentInterface['platform'];
17
17
  constructor(options: PickOption);
18
18
  formatPictures: (pictures: string) => string[];
19
19
  render: (value: Value) => React.JSX.Element | null;
@@ -6,14 +6,14 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
6
6
  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; }
7
7
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
8
  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); }
9
- import React from "react";
10
- import { Image } from "antd";
11
- import { ApaasUploadAsync, ApaasUpload } from "@kmkf-fe-packages/basic-components";
12
- import { imgResize } from "@kmkf-fe-packages/kmkf-utils";
9
+ import React from 'react';
10
+ import { Image } from 'antd';
11
+ import { ApaasUploadAsync, ApaasUpload } from '@kmkf-fe-packages/basic-components';
12
+ import { imgResize } from '@kmkf-fe-packages/kmkf-utils';
13
13
  import GetFormItem from "../GetFormItem";
14
14
  import ItemView from "../../commonComponents/ItemView";
15
- import { isNull } from "@kmkf-fe-packages/kmkf-utils";
16
- var hostUrl = "https://kefu.kuaimai.com";
15
+ import { isNull } from '@kmkf-fe-packages/kmkf-utils';
16
+ import { hostUrl } from "../../constant";
17
17
  var BasicPicture = /*#__PURE__*/_createClass(function BasicPicture(options) {
18
18
  var _this = this,
19
19
  _options$effects;
@@ -31,9 +31,9 @@ var BasicPicture = /*#__PURE__*/_createClass(function BasicPicture(options) {
31
31
  _defineProperty(this, "dataType", void 0);
32
32
  _defineProperty(this, "currenEnv", void 0);
33
33
  _defineProperty(this, "formatPictures", function (pictures) {
34
- pictures = pictures.replace(/[\[\]]/g, "");
35
- pictures = pictures.replace(/\s/g, "");
36
- return pictures ? pictures.split(",") : [];
34
+ pictures = pictures.replace(/[\[\]]/g, '');
35
+ pictures = pictures.replace(/\s/g, '');
36
+ return pictures ? pictures.split(',') : [];
37
37
  });
38
38
  _defineProperty(this, "render", function (value) {
39
39
  var _document;
@@ -41,20 +41,20 @@ var BasicPicture = /*#__PURE__*/_createClass(function BasicPicture(options) {
41
41
  return null;
42
42
  }
43
43
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Image.PreviewGroup, {
44
- preview: _this.currenEnv === "ks" ? {
45
- getContainer: (_document = document) === null || _document === void 0 ? void 0 : _document.getElementById("root")
44
+ preview: _this.currenEnv === 'ks' ? {
45
+ getContainer: (_document = document) === null || _document === void 0 ? void 0 : _document.getElementById('root')
46
46
  } : true
47
47
  }, value === null || value === void 0 ? void 0 : value.map(function (pic) {
48
48
  return /*#__PURE__*/React.createElement("div", {
49
49
  style: {
50
- marginRight: "5px",
51
- display: "inline-block"
50
+ marginRight: '5px',
51
+ display: 'inline-block'
52
52
  }
53
53
  }, /*#__PURE__*/React.createElement(Image, {
54
54
  width: 32,
55
- src: imgResize(pic || ""),
55
+ src: imgResize(pic || ''),
56
56
  preview: {
57
- src: imgResize(pic || "", 0, 0)
57
+ src: imgResize(pic || '', 0, 0)
58
58
  }
59
59
  }));
60
60
  })));
@@ -69,8 +69,8 @@ var BasicPicture = /*#__PURE__*/_createClass(function BasicPicture(options) {
69
69
  return /*#__PURE__*/React.createElement(Image.PreviewGroup, null, finalPictures === null || finalPictures === void 0 ? void 0 : finalPictures.map(function (pic) {
70
70
  return /*#__PURE__*/React.createElement("div", {
71
71
  style: {
72
- marginRight: "5px",
73
- display: "inline-block"
72
+ marginRight: '5px',
73
+ display: 'inline-block'
74
74
  },
75
75
  onClick: function onClick(e) {
76
76
  return e.stopPropagation();
@@ -107,7 +107,7 @@ var BasicPicture = /*#__PURE__*/_createClass(function BasicPicture(options) {
107
107
  hidden: p === null || p === void 0 ? void 0 : p.hidden,
108
108
  display: p === null || p === void 0 ? void 0 : p.display,
109
109
  required: (_this$componentConfig = (_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.required) !== null && _this$componentConfig !== void 0 ? _this$componentConfig : false,
110
- tooltip: (_this$componentConfig3 = _this.componentConfig) !== null && _this$componentConfig3 !== void 0 && _this$componentConfig3.showTooltip ? (_this$componentConfig4 = _this.componentConfig) === null || _this$componentConfig4 === void 0 ? void 0 : _this$componentConfig4.tooltip : "",
110
+ tooltip: (_this$componentConfig3 = _this.componentConfig) !== null && _this$componentConfig3 !== void 0 && _this$componentConfig3.showTooltip ? (_this$componentConfig4 = _this.componentConfig) === null || _this$componentConfig4 === void 0 ? void 0 : _this$componentConfig4.tooltip : '',
111
111
  component: (_this$componentConfig5 = _this.componentConfig) !== null && _this$componentConfig5 !== void 0 && _this$componentConfig5.isSingleShop ? /*#__PURE__*/React.createElement(ApaasUpload, _this.componentConfig) : /*#__PURE__*/React.createElement(ApaasUploadAsync, _extends({}, _this.componentConfig, {
112
112
  uniqueKey: _this.id,
113
113
  hostUrl: hostUrl,
@@ -131,7 +131,7 @@ var BasicPicture = /*#__PURE__*/_createClass(function BasicPicture(options) {
131
131
  this.isCombinationComponent = false;
132
132
  this.canSort = true;
133
133
  this.children = [];
134
- this.dataType = "string";
134
+ this.dataType = 'string';
135
135
  this.currenEnv = options === null || options === void 0 ? void 0 : (_options$effects = options.effects) === null || _options$effects === void 0 ? void 0 : _options$effects.env;
136
136
  });
137
137
  export default BasicPicture;
@@ -0,0 +1,30 @@
1
+ import { ComponentInterface, PickOption, ALignType, Record } from '../../type';
2
+ import React from 'react';
3
+ declare class PictureName implements ComponentInterface {
4
+ name: string;
5
+ id: string;
6
+ sortField: string;
7
+ type: string;
8
+ componentConfig: ComponentInterface['componentConfig'];
9
+ align: ALignType;
10
+ width: number;
11
+ isCombinationComponent: boolean;
12
+ formField: string;
13
+ canSort: boolean;
14
+ children: ComponentInterface[];
15
+ dataType: ComponentInterface['dataType'];
16
+ parentName?: string;
17
+ transformValue: (val: any, record?: any, parentName?: string) => any;
18
+ export: (val: any, record?: any, parentName?: string) => any;
19
+ constructor(options: PickOption);
20
+ getParentId: () => string;
21
+ renderClient: (record: any) => React.JSX.Element | null;
22
+ renderPc: (value: unknown, record: Record) => React.JSX.Element;
23
+ renderLog: (r: Record) => React.JSX.Element | null;
24
+ getComponentValue: (r: Record) => any;
25
+ getComponentExport: (r: Record) => any;
26
+ renderExport: (value: string, record: Record) => any;
27
+ editRender: () => null;
28
+ filterConfig: () => never[];
29
+ }
30
+ export default PictureName;
@@ -0,0 +1,132 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
+ 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); }
14
+ import React from 'react';
15
+ import { Space } from 'antd';
16
+ import ItemView from "../../commonComponents/ItemView";
17
+ import { isNull } from '@kmkf-fe-packages/kmkf-utils';
18
+ import { DownloadOutlined } from '@ant-design/icons';
19
+ import { hostUrl } from "../../constant";
20
+ var PictureName = /*#__PURE__*/_createClass(function PictureName(options) {
21
+ var _this = this;
22
+ _classCallCheck(this, PictureName);
23
+ _defineProperty(this, "name", void 0);
24
+ _defineProperty(this, "id", void 0);
25
+ _defineProperty(this, "sortField", void 0);
26
+ _defineProperty(this, "type", void 0);
27
+ _defineProperty(this, "componentConfig", void 0);
28
+ _defineProperty(this, "align", void 0);
29
+ _defineProperty(this, "width", void 0);
30
+ _defineProperty(this, "isCombinationComponent", void 0);
31
+ _defineProperty(this, "formField", void 0);
32
+ _defineProperty(this, "canSort", void 0);
33
+ _defineProperty(this, "children", void 0);
34
+ _defineProperty(this, "dataType", void 0);
35
+ _defineProperty(this, "parentName", void 0);
36
+ _defineProperty(this, "transformValue", function (val) {
37
+ return val;
38
+ });
39
+ _defineProperty(this, "export", function (val) {
40
+ return val;
41
+ });
42
+ _defineProperty(this, "getParentId", function () {
43
+ var _this$id$split = _this.id.split('_'),
44
+ _this$id$split2 = _slicedToArray(_this$id$split, 3),
45
+ key = _this$id$split2[0],
46
+ name = _this$id$split2[1],
47
+ code = _this$id$split2[2];
48
+ return "".concat(key, "_").concat(name);
49
+ });
50
+ _defineProperty(this, "renderClient", function (record) {
51
+ return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
52
+ id: _this.id,
53
+ label: _this.name,
54
+ value: _this.getComponentValue(record)
55
+ }) : null;
56
+ });
57
+ _defineProperty(this, "renderPc", function (value, record) {
58
+ var fileName = _this.getComponentValue(record);
59
+ var parentId = _this.getParentId();
60
+ var picUrl = "".concat(hostUrl, "/").concat(record === null || record === void 0 ? void 0 : record["".concat(parentId, "_url")]);
61
+ var downloadHandle = function downloadHandle(e) {
62
+ e.stopPropagation();
63
+ try {
64
+ fetch(picUrl).then(function (res) {
65
+ return res.blob();
66
+ }).then(function (blob) {
67
+ var a = document.createElement('a');
68
+ document.body.appendChild(a);
69
+ a.style.display = 'none';
70
+ var url = window.URL.createObjectURL(blob);
71
+ a.href = url;
72
+ a.download = fileName;
73
+ a.click();
74
+ document.body.removeChild(a);
75
+ window.URL.revokeObjectURL(url);
76
+ });
77
+ } catch (error) {
78
+ console.error(error);
79
+ }
80
+ };
81
+ return /*#__PURE__*/React.createElement(Space, {
82
+ className: "pictruePc"
83
+ }, (record === null || record === void 0 ? void 0 : record["".concat(parentId, "_url")]) && /*#__PURE__*/React.createElement(DownloadOutlined, {
84
+ onClick: downloadHandle,
85
+ className: "downloadIcon"
86
+ }), /*#__PURE__*/React.createElement("div", null, fileName ? fileName : '--'));
87
+ });
88
+ _defineProperty(this, "renderLog", function (r) {
89
+ var id = _this.getParentId();
90
+ if (isNull(r === null || r === void 0 ? void 0 : r[id])) return null;
91
+ return _this.renderPc(undefined, r);
92
+ });
93
+ _defineProperty(this, "getComponentValue", function (r) {
94
+ return _this.transformValue(r === null || r === void 0 ? void 0 : r[_this.id], r, _this.parentName);
95
+ });
96
+ _defineProperty(this, "getComponentExport", function (r) {
97
+ return _this.export(r === null || r === void 0 ? void 0 : r[_this.id], r, _this.parentName);
98
+ });
99
+ _defineProperty(this, "renderExport", function (value, record) {
100
+ var _this$getComponentExp;
101
+ var val = (_this$getComponentExp = _this.getComponentExport(record)) !== null && _this$getComponentExp !== void 0 ? _this$getComponentExp : '--';
102
+ return typeof val === 'number' ? val + '' : val;
103
+ });
104
+ _defineProperty(this, "editRender", function () {
105
+ return null;
106
+ });
107
+ _defineProperty(this, "filterConfig", function () {
108
+ return [];
109
+ });
110
+ this.name = options.name;
111
+ this.id = options.id;
112
+ this.sortField = options.id;
113
+ this.formField = options.id;
114
+ this.type = options.type;
115
+ if (options.parentName) {
116
+ this.parentName = options.parentName;
117
+ }
118
+ this.componentConfig = options.componentConfig;
119
+ this.align = 'left';
120
+ this.width = (options === null || options === void 0 ? void 0 : options.width) || 100;
121
+ this.isCombinationComponent = false;
122
+ this.canSort = false;
123
+ this.dataType = 'string';
124
+ this.children = [];
125
+ if (options.transformValue) {
126
+ this.transformValue = options.transformValue;
127
+ }
128
+ if (options.renderExport) {
129
+ this.export = options.renderExport;
130
+ }
131
+ });
132
+ export default PictureName;
@@ -0,0 +1,26 @@
1
+ import { ComponentInterface, PickOption, ALignType, Record } from '../../type';
2
+ import React from 'react';
3
+ declare class PictureUrl implements ComponentInterface {
4
+ name: string;
5
+ id: string;
6
+ sortField: string;
7
+ type: string;
8
+ componentConfig: ComponentInterface['componentConfig'];
9
+ align: ALignType;
10
+ width: number;
11
+ isCombinationComponent: boolean;
12
+ formField: string;
13
+ canSort: boolean;
14
+ children: ComponentInterface[];
15
+ dataType: ComponentInterface['dataType'];
16
+ constructor(options: PickOption);
17
+ getParentId: () => string;
18
+ renderClient: (record: any) => React.JSX.Element | null;
19
+ renderPc: (value: unknown, record: Record) => React.JSX.Element;
20
+ renderLog: () => null;
21
+ getComponentValue: (r: Record) => any;
22
+ renderExport: () => null;
23
+ editRender: () => null;
24
+ filterConfig: () => never[];
25
+ }
26
+ export default PictureUrl;
@@ -0,0 +1,93 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
+ 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); }
14
+ import { Image } from 'antd';
15
+ import React from 'react';
16
+ import ItemView from "../../commonComponents/ItemView";
17
+ import { isNull } from '@kmkf-fe-packages/kmkf-utils';
18
+ import { hostUrl } from "../../constant";
19
+ var PictureUrl = /*#__PURE__*/_createClass(function PictureUrl(options) {
20
+ var _this = this;
21
+ _classCallCheck(this, PictureUrl);
22
+ _defineProperty(this, "name", void 0);
23
+ _defineProperty(this, "id", void 0);
24
+ _defineProperty(this, "sortField", void 0);
25
+ _defineProperty(this, "type", void 0);
26
+ _defineProperty(this, "componentConfig", void 0);
27
+ _defineProperty(this, "align", void 0);
28
+ _defineProperty(this, "width", void 0);
29
+ _defineProperty(this, "isCombinationComponent", void 0);
30
+ _defineProperty(this, "formField", void 0);
31
+ _defineProperty(this, "canSort", void 0);
32
+ _defineProperty(this, "children", void 0);
33
+ _defineProperty(this, "dataType", void 0);
34
+ _defineProperty(this, "getParentId", function () {
35
+ var _this$id$split = _this.id.split('_'),
36
+ _this$id$split2 = _slicedToArray(_this$id$split, 3),
37
+ key = _this$id$split2[0],
38
+ name = _this$id$split2[1],
39
+ code = _this$id$split2[2];
40
+ return "".concat(key, "_").concat(name);
41
+ });
42
+ _defineProperty(this, "renderClient", function (record) {
43
+ return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
44
+ id: _this.id,
45
+ label: _this.name,
46
+ value: _this.getComponentValue(record)
47
+ }) : null;
48
+ });
49
+ _defineProperty(this, "renderPc", function (value, record) {
50
+ var patchUrl = _this.getComponentValue(record);
51
+ if (!patchUrl) return /*#__PURE__*/React.createElement("span", null, "--");
52
+ var finalImage = "".concat(hostUrl, "/").concat(patchUrl);
53
+ return /*#__PURE__*/React.createElement("span", {
54
+ onClick: function onClick(e) {
55
+ return e.stopPropagation();
56
+ }
57
+ }, /*#__PURE__*/React.createElement(Image, {
58
+ width: 40,
59
+ src: "".concat(finalImage, "?x-oss-process=image/resize,m_pad,h_40,w_40"),
60
+ preview: {
61
+ src: finalImage
62
+ }
63
+ }));
64
+ });
65
+ _defineProperty(this, "renderLog", function () {
66
+ return null;
67
+ });
68
+ _defineProperty(this, "getComponentValue", function (r) {
69
+ return r === null || r === void 0 ? void 0 : r[_this.id];
70
+ });
71
+ _defineProperty(this, "renderExport", function () {
72
+ return null;
73
+ });
74
+ _defineProperty(this, "editRender", function () {
75
+ return null;
76
+ });
77
+ _defineProperty(this, "filterConfig", function () {
78
+ return [];
79
+ });
80
+ this.name = options.name;
81
+ this.id = options.id;
82
+ this.sortField = options.id;
83
+ this.formField = options.id;
84
+ this.type = options.type;
85
+ this.componentConfig = options.componentConfig;
86
+ this.align = 'left';
87
+ this.width = 100;
88
+ this.isCombinationComponent = false;
89
+ this.canSort = false;
90
+ this.dataType = 'string';
91
+ this.children = [];
92
+ });
93
+ export default PictureUrl;
@@ -0,0 +1,40 @@
1
+ import { ComponentInterface, PickOption, Record } from "../../type";
2
+ import React from "react";
3
+ import "./index.less";
4
+ declare type Value = {
5
+ url: string;
6
+ name: string;
7
+ }[];
8
+ declare class BasicPicturePro implements ComponentInterface {
9
+ name: string;
10
+ id: string;
11
+ sortField: string;
12
+ type: string;
13
+ rules: any[];
14
+ componentConfig: ComponentInterface["componentConfig"];
15
+ isCombinationComponent: boolean;
16
+ formField: string;
17
+ canSort: boolean;
18
+ children: ComponentInterface[];
19
+ dataType: ComponentInterface["dataType"];
20
+ currenEnv: ComponentInterface["platform"];
21
+ constructor(options: PickOption);
22
+ formatPictures: (pictures: string) => string[];
23
+ render: (value: Value) => React.JSX.Element | null;
24
+ renderPc: () => null;
25
+ renderLog: (r: Record) => React.JSX.Element | null;
26
+ getComponentValue: (r: Record) => any;
27
+ renderClient: (record: any) => React.JSX.Element | null;
28
+ editRender: (p: any) => React.JSX.Element;
29
+ /**
30
+ *
31
+ * @returns 图片类型的导出需要在导出时单独处理
32
+ */
33
+ renderExport: () => null;
34
+ /**
35
+ *
36
+ * @returns 图片不支持过滤
37
+ */
38
+ filterConfig: () => never[];
39
+ }
40
+ export default BasicPicturePro;
@@ -0,0 +1,180 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ 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); }
5
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ 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; }
9
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
+ 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); }
11
+ import React from "react";
12
+ import { ApaasUploadProAsync } from "@kmkf-fe-packages/basic-components";
13
+ import GetFormItem from "../GetFormItem";
14
+ import ItemView from "../../commonComponents/ItemView";
15
+ import PictureName from "./PictureName";
16
+ import PictureUrl from "./PictureUrl";
17
+ import { isNull } from "@kmkf-fe-packages/kmkf-utils";
18
+ import "./index.less";
19
+ import { Image, Tooltip, message } from "antd";
20
+ import { DownloadOutlined, CopyOutlined } from "@ant-design/icons";
21
+ import copy from "copy-to-clipboard";
22
+ import { hostUrl } from "../../constant";
23
+ var BasicPicturePro = /*#__PURE__*/_createClass(function BasicPicturePro(options) {
24
+ var _this = this,
25
+ _options$effects;
26
+ _classCallCheck(this, BasicPicturePro);
27
+ _defineProperty(this, "name", void 0);
28
+ _defineProperty(this, "id", void 0);
29
+ _defineProperty(this, "sortField", void 0);
30
+ _defineProperty(this, "type", void 0);
31
+ _defineProperty(this, "rules", void 0);
32
+ _defineProperty(this, "componentConfig", void 0);
33
+ _defineProperty(this, "isCombinationComponent", void 0);
34
+ _defineProperty(this, "formField", void 0);
35
+ _defineProperty(this, "canSort", void 0);
36
+ _defineProperty(this, "children", void 0);
37
+ _defineProperty(this, "dataType", void 0);
38
+ _defineProperty(this, "currenEnv", void 0);
39
+ _defineProperty(this, "formatPictures", function (pictures) {
40
+ pictures = pictures.replace(/[\[\]]/g, "");
41
+ pictures = pictures.replace(/\s/g, "");
42
+ return pictures ? pictures.split(",") : [];
43
+ });
44
+ _defineProperty(this, "render", function (value) {
45
+ var _document;
46
+ if (!(value !== null && value !== void 0 && value.length)) {
47
+ return null;
48
+ }
49
+ var copyText = value.map(function (item) {
50
+ return item.name;
51
+ }).join(",");
52
+ var onCopy = function onCopy() {
53
+ copy(copyText);
54
+ message.success("图片名称复制成功");
55
+ };
56
+ return /*#__PURE__*/React.createElement("div", {
57
+ className: "pictureProClient"
58
+ }, /*#__PURE__*/React.createElement(Image.PreviewGroup, {
59
+ preview: _this.currenEnv === "ks" ? {
60
+ getContainer: (_document = document) === null || _document === void 0 ? void 0 : _document.getElementById("root")
61
+ } : true
62
+ }, value.map(function (item) {
63
+ var finalImage = "".concat(/^pic\/[\s\S]*$/.test(item.url) ? "".concat(hostUrl, "/").concat(item.url) : item.url, "?x-oss-process=image/resize,h_60,w_60");
64
+ var showImage = /^pic\/[\s\S]*$/.test(item.url) ? "".concat(hostUrl, "/").concat(item.url) : item.url;
65
+ var downloadHandle = function downloadHandle() {
66
+ if (_this.currenEnv === "pc") {
67
+ try {
68
+ fetch("".concat(hostUrl, "/").concat(item.url)).then(function (res) {
69
+ return res.blob();
70
+ }).then(function (blob) {
71
+ var a = document.createElement("a");
72
+ document.body.appendChild(a);
73
+ a.style.display = "none";
74
+ var url = window.URL.createObjectURL(blob);
75
+ a.href = url;
76
+ a.download = item.name;
77
+ a.click();
78
+ document.body.removeChild(a);
79
+ window.URL.revokeObjectURL(url);
80
+ });
81
+ } catch (error) {
82
+ console.error(error);
83
+ }
84
+ } else {
85
+ copy("".concat(hostUrl, "/").concat(item.url));
86
+ message.success("图片链接复制成功");
87
+ }
88
+ };
89
+ return /*#__PURE__*/React.createElement("div", {
90
+ key: item.url,
91
+ className: "pictureProBox"
92
+ }, /*#__PURE__*/React.createElement("div", {
93
+ className: "pictureProLeft"
94
+ }, /*#__PURE__*/React.createElement(Image, {
95
+ src: finalImage,
96
+ preview: {
97
+ src: showImage
98
+ },
99
+ width: "100%",
100
+ height: "100%"
101
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tooltip, {
102
+ title: item.name
103
+ }, /*#__PURE__*/React.createElement("div", {
104
+ className: "pictureProText"
105
+ }, item.name)), /*#__PURE__*/React.createElement("div", {
106
+ className: "pictureProOperate"
107
+ }, _this.currenEnv === "pc" ? /*#__PURE__*/React.createElement(DownloadOutlined, {
108
+ className: "downloadIcon",
109
+ onClick: downloadHandle
110
+ }) : /*#__PURE__*/React.createElement(CopyOutlined, {
111
+ className: "downloadIcon",
112
+ onClick: downloadHandle
113
+ }))));
114
+ })), /*#__PURE__*/React.createElement("span", {
115
+ className: "copyText",
116
+ onClick: onCopy
117
+ }, "\u590D\u5236"));
118
+ });
119
+ _defineProperty(this, "renderPc", function () {
120
+ return null;
121
+ });
122
+ _defineProperty(this, "renderLog", function (r) {
123
+ if (isNull(r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_pictureProList")])) return null;
124
+ return _this.render(r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_pictureProList")]);
125
+ });
126
+ _defineProperty(this, "getComponentValue", function (r) {
127
+ return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_pictureProList")];
128
+ });
129
+ _defineProperty(this, "renderClient", function (record) {
130
+ return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
131
+ id: _this.id,
132
+ label: _this.name,
133
+ value: _this.render(record === null || record === void 0 ? void 0 : record["".concat(_this.id)])
134
+ }) : null;
135
+ });
136
+ _defineProperty(this, "editRender", function (p) {
137
+ var _this$componentConfig, _this$componentConfig2, _this$componentConfig3, _this$componentConfig4;
138
+ return /*#__PURE__*/React.createElement(GetFormItem, {
139
+ title: _this.name,
140
+ name: _this.id,
141
+ rules: _this.rules,
142
+ hidden: p === null || p === void 0 ? void 0 : p.hidden,
143
+ display: p === null || p === void 0 ? void 0 : p.display,
144
+ required: (_this$componentConfig = (_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.required) !== null && _this$componentConfig !== void 0 ? _this$componentConfig : false,
145
+ tooltip: (_this$componentConfig3 = _this.componentConfig) !== null && _this$componentConfig3 !== void 0 && _this$componentConfig3.showTooltip ? (_this$componentConfig4 = _this.componentConfig) === null || _this$componentConfig4 === void 0 ? void 0 : _this$componentConfig4.tooltip : "",
146
+ component: /*#__PURE__*/React.createElement(ApaasUploadProAsync, _extends({}, _this.componentConfig, {
147
+ uniqueKey: _this.id,
148
+ hostUrl: hostUrl,
149
+ platform: _this.currenEnv
150
+ }))
151
+ });
152
+ });
153
+ _defineProperty(this, "renderExport", function () {
154
+ return null;
155
+ });
156
+ _defineProperty(this, "filterConfig", function () {
157
+ return [];
158
+ });
159
+ this.name = options.name;
160
+ this.id = options.id;
161
+ this.sortField = "".concat(options.id, "_pictureProList");
162
+ this.formField = "".concat(options.id, "_pictureProList");
163
+ this.type = options.type;
164
+ this.componentConfig = options.componentConfig;
165
+ this.rules = [];
166
+ this.isCombinationComponent = true;
167
+ this.canSort = true;
168
+ this.children = [new PictureName(_objectSpread(_objectSpread({}, options), {}, {
169
+ name: "图片名称",
170
+ id: "".concat(options.id, "_pictureProList_name"),
171
+ width: 250
172
+ })), new PictureUrl(_objectSpread(_objectSpread({}, options), {}, {
173
+ name: "图片详情",
174
+ id: "".concat(options.id, "_pictureProList_url"),
175
+ width: 200
176
+ }))];
177
+ this.dataType = "object";
178
+ this.currenEnv = options === null || options === void 0 ? void 0 : (_options$effects = options.effects) === null || _options$effects === void 0 ? void 0 : _options$effects.env;
179
+ });
180
+ export default BasicPicturePro;