@kmkf-fe-packages/services-components 1.8.2-beta.1 → 1.8.2-beta.4

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,6 +1,7 @@
1
1
  import React from "react";
2
2
  declare type OperatePreviewProps = {
3
3
  id: string;
4
+ showPdf: boolean;
4
5
  };
5
- declare const OperatePreview: ({ id }: OperatePreviewProps) => React.JSX.Element;
6
+ declare const OperatePreview: ({ id, showPdf }: OperatePreviewProps) => React.JSX.Element;
6
7
  export default OperatePreview;
@@ -9,9 +9,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
9
9
  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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import React, { useEffect, useState, useRef } from "react";
12
- import { Button } from 'antd';
13
- import { LoadingOutlined } from '@ant-design/icons';
12
+ import { Button, message } from "antd";
13
+ import { LoadingOutlined } from "@ant-design/icons";
14
14
  import PDF from "react-pdf-js";
15
+ import copy from "copy-to-clipboard";
15
16
  import { getAlipayBillReceipt } from "../../service/api";
16
17
  var Preview = function Preview(_ref) {
17
18
  var url = _ref.url;
@@ -25,15 +26,30 @@ var Preview = function Preview(_ref) {
25
26
  scale: 1
26
27
  }));
27
28
  };
28
- var OperatePreview = function OperatePreview(_ref2) {
29
- var id = _ref2.id;
29
+ var CopyUrl = function CopyUrl(_ref2) {
30
+ var url = _ref2.url,
31
+ id = _ref2.id;
32
+ var handleCopy = function handleCopy() {
33
+ copy(url);
34
+ message.success("链接复制成功,请在浏览器中打开预览");
35
+ };
36
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
37
+ type: "link"
38
+ }, " ", id, " "), /*#__PURE__*/React.createElement(Button, {
39
+ type: "link",
40
+ onClick: handleCopy
41
+ }, " ", "\u590D\u5236\u5730\u5740", " "));
42
+ };
43
+ var OperatePreview = function OperatePreview(_ref3) {
44
+ var id = _ref3.id,
45
+ showPdf = _ref3.showPdf;
30
46
  var _useState = useState(""),
31
47
  _useState2 = _slicedToArray(_useState, 2),
32
48
  url = _useState2[0],
33
49
  setUrl = _useState2[1];
34
50
  var intervalRef = useRef();
35
51
  var queryUrl = /*#__PURE__*/function () {
36
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {
52
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {
37
53
  var res, data;
38
54
  return _regeneratorRuntime().wrap(function _callee$(_context) {
39
55
  while (1) switch (_context.prev = _context.next) {
@@ -62,7 +78,7 @@ var OperatePreview = function OperatePreview(_ref2) {
62
78
  }, _callee);
63
79
  }));
64
80
  return function queryUrl(_x2) {
65
- return _ref3.apply(this, arguments);
81
+ return _ref4.apply(this, arguments);
66
82
  };
67
83
  }();
68
84
  useEffect(function () {
@@ -72,13 +88,21 @@ var OperatePreview = function OperatePreview(_ref2) {
72
88
  }, 5 * 1000);
73
89
  intervalRef.current = timer;
74
90
  }, [id]);
91
+ useEffect(function () {
92
+ return function () {
93
+ return clearInterval(intervalRef.current);
94
+ };
95
+ }, []);
75
96
  return /*#__PURE__*/React.createElement("div", {
76
97
  style: {
77
- maxHeight: '420px',
78
- overflowY: 'hidden'
98
+ maxHeight: "420px",
99
+ overflowY: "hidden"
79
100
  }
80
- }, url ? /*#__PURE__*/React.createElement(Preview, {
101
+ }, url ? showPdf ? /*#__PURE__*/React.createElement(Preview, {
81
102
  url: url
103
+ }) : /*#__PURE__*/React.createElement(CopyUrl, {
104
+ url: url,
105
+ id: id
82
106
  }) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
83
107
  type: "link"
84
108
  }, " ", id, " "), /*#__PURE__*/React.createElement(LoadingOutlined, null)));
@@ -15,6 +15,7 @@ declare class PaymentVoucherCode implements ComponentInterface {
15
15
  templateId?: string;
16
16
  workOrderUniqueKey?: string;
17
17
  effects: ComponentInterface["effects"];
18
+ platform: ComponentInterface["platform"];
18
19
  constructor(options: PickOption);
19
20
  renderPc: (value: any, record: Record) => React.JSX.Element | "--";
20
21
  renderLog: (r: Record) => React.JSX.Element | "--" | null;
@@ -6,6 +6,7 @@ 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 { PlatForm } from "../../type";
9
10
  import React from "react";
10
11
  import { ApaasInput } from "@kmkf-fe-packages/basic-components";
11
12
  import GetFormItem from "../GetFormItem";
@@ -31,6 +32,7 @@ var PaymentVoucherCode = /*#__PURE__*/_createClass(function PaymentVoucherCode(o
31
32
  _defineProperty(this, "templateId", void 0);
32
33
  _defineProperty(this, "workOrderUniqueKey", void 0);
33
34
  _defineProperty(this, "effects", void 0);
35
+ _defineProperty(this, "platform", void 0);
34
36
  _defineProperty(this, "renderPc", function (value, record) {
35
37
  var _this$effects;
36
38
  if (isNull(record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_paymentVoucherCode")])) return "--";
@@ -59,7 +61,8 @@ var PaymentVoucherCode = /*#__PURE__*/_createClass(function PaymentVoucherCode(o
59
61
  id: _this.id,
60
62
  label: _this.name,
61
63
  value: /*#__PURE__*/React.createElement(OperatePreview, {
62
- id: record === null || record === void 0 ? void 0 : record[_this.id]
64
+ id: record === null || record === void 0 ? void 0 : record[_this.id],
65
+ showPdf: _this.platform !== PlatForm.FXG
63
66
  })
64
67
  }) : null;
65
68
  });
@@ -104,5 +107,6 @@ var PaymentVoucherCode = /*#__PURE__*/_createClass(function PaymentVoucherCode(o
104
107
  this.children = [];
105
108
  this.dataType = "string";
106
109
  this.effects = options.effects;
110
+ this.platform = options.platform;
107
111
  });
108
112
  export default PaymentVoucherCode;
@@ -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) => PaymentVoucherCode | StatusSelect | 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 | 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 | Label | KmErpSendGood | AfterSalesOrderId;
3
+ export declare const factory: (type: string, options: PickOption) => PaymentVoucherCode | StatusSelect | SubForm | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | 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 | Label | KmErpSendGood | AfterSalesOrderId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "1.8.2-beta.1",
3
+ "version": "1.8.2-beta.4",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -34,12 +34,13 @@
34
34
  "peerDependencies": {
35
35
  "@ant-design/icons": "^4.7.0",
36
36
  "antd": "^4.21.4",
37
+ "copy-to-clipboard": "^3.3.3",
37
38
  "react": "^16.8.0"
38
39
  },
39
40
  "publishConfig": {
40
41
  "access": "public"
41
42
  },
42
- "gitHead": "88c00198925594655124a6017367985ea284e66b",
43
+ "gitHead": "76cb906f2cfa9255cf5704a1f9ca035b95ec555c",
43
44
  "gitHooks": {
44
45
  "pre-commit": "lint-staged"
45
46
  }