@kmkf-fe-packages/services-components 1.11.0 → 1.12.0

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,19 +1,19 @@
1
- import { ComponentInterface, PickOption, ColumnConfig, Record } from '../../type';
2
- import React from 'react';
1
+ import { ComponentInterface, PickOption, ColumnConfig, Record } from "../../type";
2
+ import React from "react";
3
3
  declare class BasicCascader implements ComponentInterface {
4
4
  name: string;
5
5
  id: string;
6
6
  sortField: string;
7
7
  type: string;
8
8
  rules: any[];
9
- componentConfig: ComponentInterface['componentConfig'];
9
+ componentConfig: ComponentInterface["componentConfig"];
10
10
  isCombinationComponent: boolean;
11
11
  formField: string;
12
12
  canSort: boolean;
13
13
  children: ComponentInterface[];
14
- dataType: ComponentInterface['dataType'];
15
- format: ComponentInterface['format'];
16
- options: ComponentInterface['options'];
14
+ dataType: ComponentInterface["dataType"];
15
+ format: ComponentInterface["format"];
16
+ options: ComponentInterface["options"];
17
17
  constructor(options: PickOption);
18
18
  /**
19
19
  * 通过值计算展示内容
@@ -6,13 +6,13 @@ 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 { Cascader } from 'antd';
11
- import intersection from 'lodash/intersection';
9
+ import React from "react";
10
+ import { Cascader } from "antd";
11
+ import intersection from "lodash/intersection";
12
12
  import GetFormItem from "../GetFormItem";
13
- import { findLabelBySelectValue, transMultSelectOptions, tree } from '@kmkf-fe-packages/kmkf-utils';
13
+ import { findLabelBySelectValue, transMultSelectOptions, tree } from "@kmkf-fe-packages/kmkf-utils";
14
14
  import ItemView from "../../commonComponents/ItemView";
15
- import { isNull, filterFn as _filterFn } from '@kmkf-fe-packages/kmkf-utils';
15
+ import { isNull, filterFn as _filterFn } from "@kmkf-fe-packages/kmkf-utils";
16
16
  import { SYMBOL } from "../../constant";
17
17
  var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(_options) {
18
18
  var _this = this,
@@ -35,7 +35,7 @@ var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(_options) {
35
35
  var _findLabelBySelectVal, _findLabelBySelectVal2, _this$componentConfig;
36
36
  return (_findLabelBySelectVal = findLabelBySelectValue(value, (_this$componentConfig = _this.componentConfig) === null || _this$componentConfig === void 0 ? void 0 : _this$componentConfig.options)) === null || _findLabelBySelectVal === void 0 ? void 0 : (_findLabelBySelectVal2 = _findLabelBySelectVal.map(function (i) {
37
37
  return i.label;
38
- })) === null || _findLabelBySelectVal2 === void 0 ? void 0 : _findLabelBySelectVal2.join(',');
38
+ })) === null || _findLabelBySelectVal2 === void 0 ? void 0 : _findLabelBySelectVal2.join(",");
39
39
  });
40
40
  _defineProperty(this, "renderClient", function (record) {
41
41
  return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
@@ -53,7 +53,7 @@ var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(_options) {
53
53
  return item.actived;
54
54
  }), ((_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.options) || [])) === null || _findLabelBySelectVal3 === void 0 ? void 0 : (_findLabelBySelectVal4 = _findLabelBySelectVal3.map(function (i) {
55
55
  return i.label;
56
- })) === null || _findLabelBySelectVal4 === void 0 ? void 0 : _findLabelBySelectVal4.join(','));
56
+ })) === null || _findLabelBySelectVal4 === void 0 ? void 0 : _findLabelBySelectVal4.join(","));
57
57
  });
58
58
  _defineProperty(this, "renderLog", function (r) {
59
59
  if (isNull(r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_multSelect")])) return null;
@@ -65,13 +65,13 @@ var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(_options) {
65
65
  _defineProperty(this, "renderExport", function (value, record) {
66
66
  var _findLabelBySelectVal5, _findLabelBySelectVal6, _ref2, _this$componentConfig3;
67
67
  if ((record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_multSelect")]) === undefined) {
68
- return '--';
68
+ return "--";
69
69
  }
70
70
  return (_findLabelBySelectVal5 = findLabelBySelectValue((_ref2 = (record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_multSelect")]) || []) === null || _ref2 === void 0 ? void 0 : _ref2.map(function (item) {
71
71
  return item.actived;
72
72
  }), ((_this$componentConfig3 = _this.componentConfig) === null || _this$componentConfig3 === void 0 ? void 0 : _this$componentConfig3.options) || [])) === null || _findLabelBySelectVal5 === void 0 ? void 0 : (_findLabelBySelectVal6 = _findLabelBySelectVal5.map(function (i) {
73
73
  return i.label;
74
- })) === null || _findLabelBySelectVal6 === void 0 ? void 0 : _findLabelBySelectVal6.join(',');
74
+ })) === null || _findLabelBySelectVal6 === void 0 ? void 0 : _findLabelBySelectVal6.join(",");
75
75
  });
76
76
  _defineProperty(this, "editRender", function (p) {
77
77
  var _this$componentConfig4, _this$componentConfig5, _this$componentConfig6, _this$componentConfig7, _this$componentConfig8;
@@ -82,16 +82,17 @@ var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(_options) {
82
82
  hidden: p === null || p === void 0 ? void 0 : p.hidden,
83
83
  required: (_this$componentConfig4 = (_this$componentConfig5 = _this.componentConfig) === null || _this$componentConfig5 === void 0 ? void 0 : _this$componentConfig5.required) !== null && _this$componentConfig4 !== void 0 ? _this$componentConfig4 : false,
84
84
  display: p === null || p === void 0 ? void 0 : p.display,
85
- tooltip: (_this$componentConfig6 = _this.componentConfig) !== null && _this$componentConfig6 !== void 0 && _this$componentConfig6.showTooltip ? (_this$componentConfig7 = _this.componentConfig) === null || _this$componentConfig7 === void 0 ? void 0 : _this$componentConfig7.tooltip : '',
85
+ tooltip: (_this$componentConfig6 = _this.componentConfig) !== null && _this$componentConfig6 !== void 0 && _this$componentConfig6.showTooltip ? (_this$componentConfig7 = _this.componentConfig) === null || _this$componentConfig7 === void 0 ? void 0 : _this$componentConfig7.tooltip : "",
86
86
  component: /*#__PURE__*/React.createElement(Cascader, _extends({}, _this.componentConfig, {
87
87
  placeholder: "\u8BF7\u8F93\u5165".concat(_this.name),
88
88
  options: transMultSelectOptions(((_this$componentConfig8 = _this.componentConfig) === null || _this$componentConfig8 === void 0 ? void 0 : _this$componentConfig8.options) || []),
89
89
  fieldNames: {
90
- label: 'label',
91
- value: 'actived',
92
- children: 'children'
90
+ label: "label",
91
+ value: "actived",
92
+ children: "children"
93
93
  },
94
- showSearch: true
94
+ showSearch: true,
95
+ onChange: p === null || p === void 0 ? void 0 : p.onChange
95
96
  }))
96
97
  });
97
98
  });
@@ -105,26 +106,26 @@ var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(_options) {
105
106
  // 过滤组件id
106
107
  name: item.name,
107
108
  // 过滤组件名称
108
- filterComponentType: 'Cascader',
109
+ filterComponentType: "Cascader",
109
110
  props: {
110
111
  options: options,
111
112
  multiple: true,
112
- maxTagCount: 'responsive',
113
+ maxTagCount: "responsive",
113
114
  fieldNames: {
114
- label: 'label',
115
- value: 'actived',
116
- children: 'children'
115
+ label: "label",
116
+ value: "actived",
117
+ children: "children"
117
118
  }
118
119
  },
119
120
  filterFn: function filterFn(value) {
120
121
  return function (i) {
121
- return intersection(value, _filterFn.filterTableListItemColumnValue(i, item.id, 'basicMultSelect')).length > 0;
122
+ return intersection(value, _filterFn.filterTableListItemColumnValue(i, item.id, "basicMultSelect")).length > 0;
122
123
  };
123
124
  },
124
125
  formatFilterValue: function formatFilterValue(val) {
125
126
  if ((val === null || val === void 0 ? void 0 : val.length) > 0) {
126
127
  return val.map(function (item) {
127
- var node = tree.findNodeByValue(options, 'actived', item[item.length - 1]);
128
+ var node = tree.findNodeByValue(options, "actived", item[item.length - 1]);
128
129
  if (node) {
129
130
  var label = node.label,
130
131
  actived = node.actived;
@@ -148,8 +149,8 @@ var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(_options) {
148
149
  this.children = [];
149
150
  this.isCombinationComponent = false;
150
151
  this.canSort = true;
151
- this.dataType = 'array';
152
- this.format = 'cascader';
152
+ this.dataType = "array";
153
+ this.format = "cascader";
153
154
  this.options = ((_this$componentConfig9 = this.componentConfig) === null || _this$componentConfig9 === void 0 ? void 0 : _this$componentConfig9.options) || [];
154
155
  }
155
156
 
@@ -11,24 +11,80 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import React, { useEffect, useState, useRef } from "react";
12
12
  import { Button, message } from "antd";
13
13
  import { LoadingOutlined } from "@ant-design/icons";
14
- import PDF from "react-pdf-js";
14
+ import { usePdf } from "react-pdf-js";
15
15
  import copy from "copy-to-clipboard";
16
+ import html2canvas from "html2canvas";
17
+ import b64toBlob from "b64-to-blob";
16
18
  import { getAlipayBillReceipt } from "../../service/api";
17
19
  var Preview = function Preview(_ref) {
18
20
  var url = _ref.url;
19
- var onDocumentComplete = function onDocumentComplete() {
20
- console.log("文件加载完成");
21
- };
22
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(PDF, {
23
- file: url,
24
- onDocumentComplete: onDocumentComplete,
25
- page: 1,
26
- scale: 1
21
+ var canvasEl = useRef(null);
22
+ var _usePdf = usePdf({
23
+ file: url,
24
+ page: 1,
25
+ scale: 1,
26
+ canvasEl: canvasEl
27
+ }),
28
+ _usePdf2 = _slicedToArray(_usePdf, 1),
29
+ loading = _usePdf2[0];
30
+ var copyHandle = /*#__PURE__*/function () {
31
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
32
+ var _yield$navigator$perm, state;
33
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
34
+ while (1) switch (_context.prev = _context.next) {
35
+ case 0:
36
+ _context.prev = 0;
37
+ _context.next = 3;
38
+ return navigator.permissions.query({
39
+ name: "clipboard-write"
40
+ });
41
+ case 3:
42
+ _yield$navigator$perm = _context.sent;
43
+ state = _yield$navigator$perm.state;
44
+ if (state == "granted") {
45
+ html2canvas(canvasEl === null || canvasEl === void 0 ? void 0 : canvasEl.current, {
46
+ useCORS: true
47
+ }).then(function (canvas) {
48
+ var imgUrl = canvas.toDataURL("image/png");
49
+ var str = imgUrl.replace(/data:image\/png;base64,/, "");
50
+ var file = b64toBlob(str, "image/png");
51
+ var clipboardItemInput = new window.ClipboardItem({
52
+ "image/png": file
53
+ });
54
+ window.navigator.clipboard.write([clipboardItemInput]);
55
+ message.success("复制图片成功");
56
+ });
57
+ } else {
58
+ copy(url);
59
+ message.success("复制图片链接成功");
60
+ }
61
+ _context.next = 12;
62
+ break;
63
+ case 8:
64
+ _context.prev = 8;
65
+ _context.t0 = _context["catch"](0);
66
+ copy(url);
67
+ message.success("复制图片链接成功");
68
+ case 12:
69
+ case "end":
70
+ return _context.stop();
71
+ }
72
+ }, _callee, null, [[0, 8]]);
73
+ }));
74
+ return function copyHandle() {
75
+ return _ref2.apply(this, arguments);
76
+ };
77
+ }();
78
+ return /*#__PURE__*/React.createElement("div", null, !loading && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
79
+ type: "link",
80
+ onClick: copyHandle
81
+ }, "\u590D\u5236\u51ED\u8BC1")), /*#__PURE__*/React.createElement("canvas", {
82
+ ref: canvasEl
27
83
  }));
28
84
  };
29
- var CopyUrl = function CopyUrl(_ref2) {
30
- var url = _ref2.url,
31
- id = _ref2.id;
85
+ var CopyUrl = function CopyUrl(_ref3) {
86
+ var url = _ref3.url,
87
+ id = _ref3.id;
32
88
  var handleCopy = function handleCopy() {
33
89
  copy(url);
34
90
  message.success("链接复制成功,请在浏览器中打开预览");
@@ -40,32 +96,32 @@ var CopyUrl = function CopyUrl(_ref2) {
40
96
  onClick: handleCopy
41
97
  }, " ", "\u590D\u5236\u5730\u5740", " "));
42
98
  };
43
- var OperatePreview = function OperatePreview(_ref3) {
44
- var id = _ref3.id,
45
- showPdf = _ref3.showPdf;
99
+ var OperatePreview = function OperatePreview(_ref4) {
100
+ var id = _ref4.id,
101
+ showPdf = _ref4.showPdf;
46
102
  var _useState = useState(""),
47
103
  _useState2 = _slicedToArray(_useState, 2),
48
104
  url = _useState2[0],
49
105
  setUrl = _useState2[1];
50
106
  var intervalRef = useRef();
51
107
  var queryUrl = /*#__PURE__*/function () {
52
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {
108
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(id) {
53
109
  var res, data;
54
- return _regeneratorRuntime().wrap(function _callee$(_context) {
55
- while (1) switch (_context.prev = _context.next) {
110
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
111
+ while (1) switch (_context2.prev = _context2.next) {
56
112
  case 0:
57
113
  if (id) {
58
- _context.next = 2;
114
+ _context2.next = 2;
59
115
  break;
60
116
  }
61
- return _context.abrupt("return");
117
+ return _context2.abrupt("return");
62
118
  case 2:
63
- _context.next = 4;
119
+ _context2.next = 4;
64
120
  return getAlipayBillReceipt({
65
121
  alipayBillReceiptDetailId: id
66
122
  });
67
123
  case 4:
68
- res = _context.sent;
124
+ res = _context2.sent;
69
125
  data = res.data;
70
126
  if (data) {
71
127
  setUrl(data);
@@ -73,12 +129,12 @@ var OperatePreview = function OperatePreview(_ref3) {
73
129
  }
74
130
  case 7:
75
131
  case "end":
76
- return _context.stop();
132
+ return _context2.stop();
77
133
  }
78
- }, _callee);
134
+ }, _callee2);
79
135
  }));
80
136
  return function queryUrl(_x2) {
81
- return _ref4.apply(this, arguments);
137
+ return _ref5.apply(this, arguments);
82
138
  };
83
139
  }();
84
140
  useEffect(function () {
@@ -95,7 +151,7 @@ var OperatePreview = function OperatePreview(_ref3) {
95
151
  }, []);
96
152
  return /*#__PURE__*/React.createElement("div", {
97
153
  style: {
98
- maxHeight: "420px",
154
+ maxHeight: "455px",
99
155
  overflowY: "hidden"
100
156
  }
101
157
  }, url ? showPdf ? /*#__PURE__*/React.createElement(Preview, {
@@ -1,3 +1,3 @@
1
1
  import { JstLogistics, JstItemSelect, JstSupply, JstSendGood, BasicInput, BasicAddress, BasicCascader, BasicCheckbox, BasicDataTime, BasicSelect, BasicRadio, BasicTextArea, BasicPicture, BasicMultSelect, BasicGrade, BasicRate, BasicFile, BasicPosting, SubForm, CommonDataTime, TradeId, ShopName, BuyerNick, ReceiverName, ReceiverMobile, ReceiverAddress, TradeDateTime, Logistics, ReturnLogistics, ActualPayment, ERemark, AliPay, ItemSelect, ItemId, ItemEnCode, SystemOrderNo, Ordinary, ThirdItemSelect, FlowStatusSelect, FlowMarkSelect, FlowTag, Payment, TemplateSelect, WorkOrderId, PlatForm, ShopInput, Submitter, PrevSubmitter, FlowCreator, Handler, CompletedUser, LogisticsInterception, LogisticsMoreInterception, LogisticsTrajectory, LogisticsMoreTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsReturn, BsSystemOrder, BsLogistics, StatusSelect, CommonSystemOrder, CommonMultiStatus, Calculation, NodeDeadLine, HandlerDeadLine, NodeStayDuration, WlnGoods, BsPosting, MsgStatus, NodeInput, FlowWorkOrderStatus, WdtGoods, WdtReturn, WdtExchange, CommonInput, PaymentVoucherCode, Label, WdtReissue, KmErpSendGood, AfterSalesOrderId } from "./index";
2
2
  import { PickOption } from "./type";
3
- export declare const factory: (type: string, options: PickOption) => BasicCascader | StatusSelect | BasicInput | BasicAddress | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | SubForm | CommonDataTime | TradeId | ShopName | BuyerNick | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | JstLogistics | JstItemSelect | JstSendGood | JstSupply | BsSystemOrder | BsGoods | BsExchange | BsReissue | BsReturn | BsLogistics | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsMoreInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | NodeInput | FlowWorkOrderStatus | MsgStatus | WdtGoods | WdtReissue | WdtReturn | WdtExchange | CommonInput | PaymentVoucherCode | Label | KmErpSendGood | AfterSalesOrderId;
3
+ export declare const factory: (type: string, options: PickOption) => BasicCascader | BasicInput | BasicAddress | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | SubForm | CommonDataTime | TradeId | ShopName | BuyerNick | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | JstLogistics | JstItemSelect | JstSendGood | JstSupply | BsSystemOrder | BsGoods | BsExchange | BsReissue | BsReturn | BsLogistics | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsMoreInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | NodeInput | FlowWorkOrderStatus | MsgStatus | WdtGoods | WdtReissue | WdtReturn | WdtExchange | CommonInput | PaymentVoucherCode | Label | KmErpSendGood | AfterSalesOrderId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -21,8 +21,10 @@
21
21
  ]
22
22
  },
23
23
  "dependencies": {
24
- "@kmkf-fe-packages/basic-components": "1.11.0",
25
- "@kmkf-fe-packages/kmkf-utils": "1.11.0",
24
+ "@kmkf-fe-packages/basic-components": "1.10.0",
25
+ "@kmkf-fe-packages/kmkf-utils": "1.10.0",
26
+ "b64-to-blob": "^1.2.19",
27
+ "html2canvas": "^1.4.1",
26
28
  "react-pdf-js": "^5.1.0"
27
29
  },
28
30
  "devDependencies": {
@@ -39,7 +41,7 @@
39
41
  "publishConfig": {
40
42
  "access": "public"
41
43
  },
42
- "gitHead": "9c624c5410069e57085e281dbbc194346ac6bf42",
44
+ "gitHead": "487159f7c26b4c7c4fad564f62c8828931982005",
43
45
  "gitHooks": {
44
46
  "pre-commit": "lint-staged"
45
47
  }