@kmkf-fe-packages/services-components 2.0.54-beta.67 → 2.0.54-beta.69

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.
@@ -39,7 +39,7 @@ export declare const BsGoodsTable: ({ list, showHeader, text, type, }: {
39
39
  type?: string | undefined;
40
40
  }) => React.JSX.Element;
41
41
  export declare const FileRender: ({ fileList, canDownload }: any) => React.JSX.Element;
42
- export declare const KmVideoRender: ({ fileList }: any) => React.JSX.Element;
42
+ export declare const KmVideoRender: ({ fileList, canDownload }: any) => React.JSX.Element;
43
43
  export declare const BsSystemOrderTable: ({ value, type }: any) => React.JSX.Element;
44
44
  export declare const MsgContent: ({ horizontal, list, valueKey, failValue, options, }: any) => React.JSX.Element;
45
45
  export declare const AlipayBill: (props: any) => React.JSX.Element;
@@ -635,7 +635,9 @@ export var FileRender = function FileRender(_ref12) {
635
635
  };
636
636
  export var KmVideoRender = function KmVideoRender(_ref13) {
637
637
  var _ref13$fileList = _ref13.fileList,
638
- fileList = _ref13$fileList === void 0 ? [] : _ref13$fileList;
638
+ fileList = _ref13$fileList === void 0 ? [] : _ref13$fileList,
639
+ _ref13$canDownload = _ref13.canDownload,
640
+ canDownload = _ref13$canDownload === void 0 ? false : _ref13$canDownload;
639
641
  var _useState13 = useState(false),
640
642
  _useState14 = _slicedToArray(_useState13, 2),
641
643
  visible = _useState14[0],
@@ -652,10 +654,15 @@ export var KmVideoRender = function KmVideoRender(_ref13) {
652
654
  _useState20 = _slicedToArray(_useState19, 2),
653
655
  fileName = _useState20[0],
654
656
  setFileName = _useState20[1];
657
+ var _useState21 = useState(false),
658
+ _useState22 = _slicedToArray(_useState21, 2),
659
+ downloading = _useState22[0],
660
+ setDownloading = _useState22[1];
655
661
  var handleCancel = function handleCancel() {
656
662
  setFileUrl("");
657
663
  setFileName("");
658
664
  setVisible(false);
665
+ setDownloading(false);
659
666
  };
660
667
  var onPreview = function onPreview(file) {
661
668
  var _file$kmVideoUrl;
@@ -670,6 +677,28 @@ export var KmVideoRender = function KmVideoRender(_ref13) {
670
677
  window.open(file === null || file === void 0 ? void 0 : file.kmVideoUrl);
671
678
  }
672
679
  };
680
+ var download = function download(url, name) {
681
+ if (url !== null && url !== void 0 && url.startsWith("https://erp-storage-video.oss-cn-beijing.aliyuncs.com")) {
682
+ window.open(url);
683
+ return;
684
+ }
685
+ setDownloading(true);
686
+ fetch(url).then(function (res) {
687
+ return res.blob();
688
+ }).then(function (blob) {
689
+ var a = document.createElement("a");
690
+ document.body.appendChild(a);
691
+ a.style.display = "none";
692
+ var url = window.URL.createObjectURL(blob);
693
+ a.href = url;
694
+ a.download = name;
695
+ a.click();
696
+ document.body.removeChild(a);
697
+ window.URL.revokeObjectURL(url);
698
+ }).finally(function () {
699
+ setDownloading(false);
700
+ });
701
+ };
673
702
  return /*#__PURE__*/React.createElement(React.Fragment, null, fileList.map(function (item) {
674
703
  return /*#__PURE__*/React.createElement(Space, {
675
704
  align: "center"
@@ -694,7 +723,13 @@ export var KmVideoRender = function KmVideoRender(_ref13) {
694
723
  title: fileName,
695
724
  footer: null,
696
725
  onCancel: handleCancel
697
- }, /*#__PURE__*/React.createElement(CopyToClipboard, {
726
+ }, canDownload ? /*#__PURE__*/React.createElement(Button, {
727
+ type: "link",
728
+ onClick: function onClick() {
729
+ return download(fileUrl, fileName);
730
+ },
731
+ loading: downloading
732
+ }, "\u4E0B\u8F7D") : /*#__PURE__*/React.createElement(CopyToClipboard, {
698
733
  text: fileUrl,
699
734
  onCopy: function onCopy() {
700
735
  message.success("复制成功");
@@ -840,18 +875,18 @@ export var MsgContent = function MsgContent(_ref15) {
840
875
  export var AlipayBill = function AlipayBill(props) {
841
876
  var value = props.value,
842
877
  platform = props.platform;
843
- var _useState21 = useState(false),
844
- _useState22 = _slicedToArray(_useState21, 2),
845
- visible = _useState22[0],
846
- setVisible = _useState22[1];
847
- var _useState23 = useState(""),
878
+ var _useState23 = useState(false),
848
879
  _useState24 = _slicedToArray(_useState23, 2),
849
- msg = _useState24[0],
850
- setMsg = _useState24[1];
851
- var _useState25 = useState(false),
880
+ visible = _useState24[0],
881
+ setVisible = _useState24[1];
882
+ var _useState25 = useState(""),
852
883
  _useState26 = _slicedToArray(_useState25, 2),
853
- hasUrl = _useState26[0],
854
- setHasUrl = _useState26[1];
884
+ msg = _useState26[0],
885
+ setMsg = _useState26[1];
886
+ var _useState27 = useState(false),
887
+ _useState28 = _slicedToArray(_useState27, 2),
888
+ hasUrl = _useState28[0],
889
+ setHasUrl = _useState28[1];
855
890
  var voucherHandle = /*#__PURE__*/function () {
856
891
  var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
857
892
  var params, res, data, msg;
@@ -14,6 +14,7 @@ declare class KmVideo implements ComponentInterface {
14
14
  effects: ComponentInterface["effects"];
15
15
  dataType: ComponentInterface["dataType"];
16
16
  constructor(options: PickOption);
17
+ renderPcTooltip: (value: any, record: Record) => any;
17
18
  renderPc: (value: any, record: Record) => any;
18
19
  renderLog: (r: Record) => any;
19
20
  getComponentValue: (r: Record) => any;
@@ -11,6 +11,7 @@ import GetFormItem from "../../GetFormItem";
11
11
  import ItemView from "../../../commonComponents/ItemView";
12
12
  import { isNull } from "@kmkf-fe-packages/kmkf-utils";
13
13
  import { KmVideoRender } from "../../Common";
14
+ import { PlatForm } from "../../../type";
14
15
  import { KmVideo as KmVideoComponent } from "@kmkf-fe-packages/basic-components";
15
16
  import { VideoCameraTwoTone } from "@ant-design/icons";
16
17
  import { Space } from "antd";
@@ -29,6 +30,32 @@ var KmVideo = /*#__PURE__*/_createClass(function KmVideo(options) {
29
30
  _defineProperty(this, "children", void 0);
30
31
  _defineProperty(this, "effects", void 0);
31
32
  _defineProperty(this, "dataType", void 0);
33
+ _defineProperty(this, "renderPcTooltip", function (value, record) {
34
+ var fileList = (record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_kmVideo")]) || [];
35
+ if (!fileList.length) {
36
+ return /*#__PURE__*/React.createElement("span", null, "--");
37
+ }
38
+ return fileList === null || fileList === void 0 ? void 0 : fileList.map(function (file) {
39
+ return /*#__PURE__*/React.createElement("div", {
40
+ style: {
41
+ maxWidth: 500,
42
+ overflow: "hidden",
43
+ whiteSpace: "nowrap",
44
+ textOverflow: "ellipsis"
45
+ }
46
+ }, /*#__PURE__*/React.createElement(VideoCameraTwoTone, {
47
+ style: {
48
+ fontSize: 16
49
+ }
50
+ }), "\xA0", file.kmVideoType && "".concat(file.kmVideoType, " "), /*#__PURE__*/React.createElement("a", {
51
+ href: file.kmVideoUrl,
52
+ target: "_blank",
53
+ onClick: function onClick(e) {
54
+ e.stopPropagation();
55
+ }
56
+ }, file.kmVideoName || file.kmVideoUrl));
57
+ });
58
+ });
32
59
  _defineProperty(this, "renderPc", function (value, record) {
33
60
  var fileList = (record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_kmVideo")]) || [];
34
61
  if (!fileList.length) {
@@ -61,16 +88,20 @@ var KmVideo = /*#__PURE__*/_createClass(function KmVideo(options) {
61
88
  return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_kmVideo")];
62
89
  });
63
90
  _defineProperty(this, "renderClient", function (record) {
91
+ var _this$effects;
92
+ var canDownload = ![PlatForm.KS, PlatForm.FXG, PlatForm.XIAOZHI].includes((_this$effects = _this.effects) === null || _this$effects === void 0 ? void 0 : _this$effects.env);
64
93
  return !isNull(record === null || record === void 0 ? void 0 : record["".concat(_this.id)]) ? /*#__PURE__*/React.createElement(ItemView, {
65
94
  id: _this.id,
66
95
  label: _this.name,
67
96
  value: /*#__PURE__*/React.createElement(KmVideoRender, {
68
- fileList: record === null || record === void 0 ? void 0 : record["".concat(_this.id)]
97
+ fileList: record === null || record === void 0 ? void 0 : record["".concat(_this.id)],
98
+ canDownload: canDownload
69
99
  })
70
100
  }) : null;
71
101
  });
72
102
  _defineProperty(this, "editRender", function (p) {
73
- var _this$componentConfig, _this$componentConfig2, _this$componentConfig3, _this$componentConfig4;
103
+ var _this$effects2, _this$componentConfig, _this$componentConfig2, _this$componentConfig3, _this$componentConfig4;
104
+ var canDownload = ![PlatForm.KS, PlatForm.FXG, PlatForm.XIAOZHI].includes((_this$effects2 = _this.effects) === null || _this$effects2 === void 0 ? void 0 : _this$effects2.env);
74
105
  return /*#__PURE__*/React.createElement(GetFormItem, {
75
106
  title: _this.name,
76
107
  name: _this.id,
@@ -82,6 +113,7 @@ var KmVideo = /*#__PURE__*/_createClass(function KmVideo(options) {
82
113
  component: /*#__PURE__*/React.createElement(KmVideoComponent, _extends({}, _this.componentConfig, {
83
114
  uniqueKey: _this.id,
84
115
  platform: p === null || p === void 0 ? void 0 : p.platform,
116
+ canDownload: canDownload,
85
117
  hostUrl: "https://kefu.kuaimai.com"
86
118
  }))
87
119
  });
@@ -91,7 +123,7 @@ var KmVideo = /*#__PURE__*/_createClass(function KmVideo(options) {
91
123
  prv.push(next.kmVideoType ? "".concat(next.kmVideoType, "\uFF1A").concat(next.kmVideoUrl) : next.kmVideoUrl);
92
124
  return prv;
93
125
  }, []);
94
- return textArr === null || textArr === void 0 ? void 0 : textArr.join(",");
126
+ return textArr === null || textArr === void 0 ? void 0 : textArr.join("\n");
95
127
  });
96
128
  _defineProperty(this, "filterConfig", function () {
97
129
  return [];
@@ -1,3 +1,3 @@
1
1
  import { ReissueLogistics, JstItemSelect, JstSupply, JstSendGood, BasicInput, BasicAddress, BasicCascader, BasicCheckbox, BasicDataTime, BasicSelect, BasicRadio, BasicTextArea, BasicPicture, BasicPicturePro, 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, GyReissue, AfterSalesOrderId, BsE3Goods, PublicGoods, PublicReissueGoods, PublicExchange, GyGoods, BsE3Reissue, MemberLevel, GyReturn, AsyncSelect, WdtShopSelect, KmVideo } from "./index";
2
2
  import { PickOption } from "./type";
3
- export declare const factory: (type: string, options: PickOption) => BuyerNick | CommonSystemOrder | JstSendGood | KmVideo | MsgStatus | AsyncSelect | PublicReissueGoods | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicPicturePro | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | SubForm | CommonDataTime | TradeId | ShopName | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | ReissueLogistics | JstItemSelect | JstSupply | BsSystemOrder | BsGoods | BsE3Goods | PublicGoods | PublicExchange | BsE3Reissue | BsExchange | BsReissue | BsReturn | BsLogistics | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsMoreInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | Calculation | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | NodeInput | FlowWorkOrderStatus | WdtGoods | WdtReissue | WdtReturn | WdtExchange | WdtShopSelect | CommonInput | PaymentVoucherCode | Label | MemberLevel | AfterSalesOrderId | GyGoods | GyReissue | GyReturn;
3
+ export declare const factory: (type: string, options: PickOption) => BuyerNick | ItemEnCode | JstSendGood | KmVideo | MsgStatus | AsyncSelect | PublicReissueGoods | ThirdItemSelect | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicPicturePro | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | SubForm | CommonDataTime | TradeId | ShopName | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | SystemOrderNo | Ordinary | Payment | ReissueLogistics | JstItemSelect | JstSupply | BsSystemOrder | BsGoods | BsE3Goods | PublicGoods | PublicExchange | BsE3Reissue | 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 | WdtGoods | WdtReissue | WdtReturn | WdtExchange | WdtShopSelect | CommonInput | PaymentVoucherCode | Label | MemberLevel | AfterSalesOrderId | GyGoods | GyReissue | GyReturn;
@@ -253,6 +253,13 @@ export interface ComponentInterface {
253
253
  * @returns
254
254
  */
255
255
  renderPc: (value: unknown, record: Record) => JSX.Element | null | JSX.Element[] | string;
256
+ /**
257
+ * PC端渲染表格浮层,存在则根据renderPcTooltip渲染,不存在则根据renderPc渲染,主要依赖与第二个参数record
258
+ * @param value
259
+ * @param record
260
+ * @returns
261
+ */
262
+ renderPcTooltip?: (value: unknown, record: Record) => JSX.Element | null | JSX.Element[] | string;
256
263
  /**
257
264
  * 导出时渲染
258
265
  * @param p
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "2.0.54-beta.67",
3
+ "version": "2.0.54-beta.69",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -21,8 +21,8 @@
21
21
  ]
22
22
  },
23
23
  "dependencies": {
24
- "@kmkf-fe-packages/basic-components": "2.0.54-beta.67",
25
- "@kmkf-fe-packages/kmkf-utils": "2.0.54-beta.67",
24
+ "@kmkf-fe-packages/basic-components": "2.0.54-beta.68",
25
+ "@kmkf-fe-packages/kmkf-utils": "2.0.54-beta.68",
26
26
  "b64-to-blob": "^1.2.19",
27
27
  "html2canvas": "^1.4.1",
28
28
  "react-pdf-js": "^5.1.0"
@@ -41,7 +41,7 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "f1dfe723fbe0b192aca04dcad94323cc87bfaa57",
44
+ "gitHead": "046a90c91d9cd6eba5b2b1fef26d9d72edcb733e",
45
45
  "gitHooks": {
46
46
  "pre-commit": "lint-staged"
47
47
  }