@kmkf-fe-packages/basic-components 2.0.54-beta.67 → 2.0.54-beta.68

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.
package/dist/index.esm.js CHANGED
@@ -21497,7 +21497,7 @@ var css_248z$d = ".index-module_imageBox__1f2AI {\n display: flex;\n flex-wrap
21497
21497
  var styles$6 = {"imageBox":"index-module_imageBox__1f2AI","addBtn":"index-module_addBtn__1DY59","tips":"index-module_tips__1XQjf"};
21498
21498
  styleInject(css_248z$d);
21499
21499
 
21500
- var _excluded$r = ["maxCount", "maxSize", "onChange", "value", "disabled", "hostUrl", "actionUrl"];
21500
+ var _excluded$r = ["maxCount", "maxSize", "onChange", "value", "disabled", "hostUrl", "canDownload", "actionUrl"];
21501
21501
  var Dragger$1 = Upload.Dragger;
21502
21502
  var fn$4 = function fn() {
21503
21503
  return void 0;
@@ -21516,6 +21516,8 @@ var KmVideo = function KmVideo(_ref) {
21516
21516
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
21517
21517
  _ref$hostUrl = _ref.hostUrl,
21518
21518
  hostUrl = _ref$hostUrl === void 0 ? '' : _ref$hostUrl,
21519
+ _ref$canDownload = _ref.canDownload,
21520
+ canDownload = _ref$canDownload === void 0 ? false : _ref$canDownload,
21519
21521
  _ref$actionUrl = _ref.actionUrl,
21520
21522
  actionUrl = _ref$actionUrl === void 0 ? '/qy/common/uploadWorkOrderImg' : _ref$actionUrl,
21521
21523
  resetProps = _objectWithoutProperties(_ref, _excluded$r);
@@ -21603,6 +21605,25 @@ var KmVideo = function KmVideo(_ref) {
21603
21605
  return _ref2.apply(this, arguments);
21604
21606
  };
21605
21607
  }();
21608
+ var download = function download(url, name) {
21609
+ if (url === null || url === void 0 ? void 0 : url.startsWith('https://erp-storage-video.oss-cn-beijing.aliyuncs.com')) {
21610
+ window.open(url);
21611
+ return;
21612
+ }
21613
+ fetch(url).then(function (res) {
21614
+ return res.blob();
21615
+ }).then(function (blob) {
21616
+ var a = document.createElement('a');
21617
+ document.body.appendChild(a);
21618
+ a.style.display = 'none';
21619
+ var url = window.URL.createObjectURL(blob);
21620
+ a.href = url;
21621
+ a.download = name;
21622
+ a.click();
21623
+ document.body.removeChild(a);
21624
+ window.URL.revokeObjectURL(url);
21625
+ });
21626
+ };
21606
21627
  var handleChange = function handleChange(list) {
21607
21628
  valueRef.current = list;
21608
21629
  onChange(list);
@@ -21686,7 +21707,12 @@ var KmVideo = function KmVideo(_ref) {
21686
21707
  title: fileName,
21687
21708
  footer: null,
21688
21709
  onCancel: handleCancel
21689
- }, /*#__PURE__*/React.createElement(CopyToClipboard, {
21710
+ }, canDownload ? /*#__PURE__*/React.createElement(Button, {
21711
+ type: "link",
21712
+ onClick: function onClick() {
21713
+ return download(fileUrl, fileName);
21714
+ }
21715
+ }, "\u4E0B\u8F7D") : /*#__PURE__*/React.createElement(CopyToClipboard, {
21690
21716
  text: fileUrl,
21691
21717
  onCopy: function onCopy() {
21692
21718
  message.success('复制成功');
package/dist/index.js CHANGED
@@ -21509,7 +21509,7 @@ var css_248z$d = ".index-module_imageBox__1f2AI {\n display: flex;\n flex-wrap
21509
21509
  var styles$6 = {"imageBox":"index-module_imageBox__1f2AI","addBtn":"index-module_addBtn__1DY59","tips":"index-module_tips__1XQjf"};
21510
21510
  styleInject(css_248z$d);
21511
21511
 
21512
- var _excluded$r = ["maxCount", "maxSize", "onChange", "value", "disabled", "hostUrl", "actionUrl"];
21512
+ var _excluded$r = ["maxCount", "maxSize", "onChange", "value", "disabled", "hostUrl", "canDownload", "actionUrl"];
21513
21513
  var Dragger$1 = antd.Upload.Dragger;
21514
21514
  var fn$4 = function fn() {
21515
21515
  return void 0;
@@ -21528,6 +21528,8 @@ var KmVideo = function KmVideo(_ref) {
21528
21528
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
21529
21529
  _ref$hostUrl = _ref.hostUrl,
21530
21530
  hostUrl = _ref$hostUrl === void 0 ? '' : _ref$hostUrl,
21531
+ _ref$canDownload = _ref.canDownload,
21532
+ canDownload = _ref$canDownload === void 0 ? false : _ref$canDownload,
21531
21533
  _ref$actionUrl = _ref.actionUrl,
21532
21534
  actionUrl = _ref$actionUrl === void 0 ? '/qy/common/uploadWorkOrderImg' : _ref$actionUrl,
21533
21535
  resetProps = _objectWithoutProperties(_ref, _excluded$r);
@@ -21615,6 +21617,25 @@ var KmVideo = function KmVideo(_ref) {
21615
21617
  return _ref2.apply(this, arguments);
21616
21618
  };
21617
21619
  }();
21620
+ var download = function download(url, name) {
21621
+ if (url === null || url === void 0 ? void 0 : url.startsWith('https://erp-storage-video.oss-cn-beijing.aliyuncs.com')) {
21622
+ window.open(url);
21623
+ return;
21624
+ }
21625
+ fetch(url).then(function (res) {
21626
+ return res.blob();
21627
+ }).then(function (blob) {
21628
+ var a = document.createElement('a');
21629
+ document.body.appendChild(a);
21630
+ a.style.display = 'none';
21631
+ var url = window.URL.createObjectURL(blob);
21632
+ a.href = url;
21633
+ a.download = name;
21634
+ a.click();
21635
+ document.body.removeChild(a);
21636
+ window.URL.revokeObjectURL(url);
21637
+ });
21638
+ };
21618
21639
  var handleChange = function handleChange(list) {
21619
21640
  valueRef.current = list;
21620
21641
  onChange(list);
@@ -21698,7 +21719,12 @@ var KmVideo = function KmVideo(_ref) {
21698
21719
  title: fileName,
21699
21720
  footer: null,
21700
21721
  onCancel: handleCancel
21701
- }, /*#__PURE__*/React__default['default'].createElement(reactCopyToClipboard.CopyToClipboard, {
21722
+ }, canDownload ? /*#__PURE__*/React__default['default'].createElement(antd.Button, {
21723
+ type: "link",
21724
+ onClick: function onClick() {
21725
+ return download(fileUrl, fileName);
21726
+ }
21727
+ }, "\u4E0B\u8F7D") : /*#__PURE__*/React__default['default'].createElement(reactCopyToClipboard.CopyToClipboard, {
21702
21728
  text: fileUrl,
21703
21729
  onCopy: function onCopy() {
21704
21730
  antd.message.success('复制成功');
@@ -16,5 +16,5 @@ export interface ApaasUploadProps extends Omit<UploadProps, 'onChange' | 'value'
16
16
  actionUrl?: string;
17
17
  canDownload?: boolean;
18
18
  }
19
- declare const KmVideo: ({ maxCount, maxSize, onChange, value, disabled, hostUrl, actionUrl, ...resetProps }: ApaasUploadProps) => React.JSX.Element;
19
+ declare const KmVideo: ({ maxCount, maxSize, onChange, value, disabled, hostUrl, canDownload, actionUrl, ...resetProps }: ApaasUploadProps) => React.JSX.Element;
20
20
  export default KmVideo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "2.0.54-beta.67",
3
+ "version": "2.0.54-beta.68",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -20,7 +20,7 @@
20
20
  "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "2.0.54-beta.67",
23
+ "@kmkf-fe-packages/kmkf-utils": "2.0.54-beta.68",
24
24
  "ahooks": "^3.7.4",
25
25
  "bignumber.js": "^9.1.2",
26
26
  "kmkf-monitor": "^0.8.9",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "f1dfe723fbe0b192aca04dcad94323cc87bfaa57"
68
+ "gitHead": "4894e019bb46e437693b0355b52233fb74d2f4b6"
69
69
  }