@kmkf-fe-packages/services-components 0.8.9-alpha.14 → 0.8.9-alpha.15
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.
|
@@ -8,9 +8,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
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; }
|
|
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
|
-
import { Form, Button, Modal, Tooltip, Space, Image, Popover, Table } from "antd";
|
|
11
|
+
import { Form, Button, Modal, Tooltip, Space, Image, Popover, Table, message } from "antd";
|
|
12
12
|
import React, { useState, useMemo } from "react";
|
|
13
13
|
import { ExpressData } from "@kmkf-fe-packages/kmkf-utils";
|
|
14
|
+
import { CopyToClipboard } from "react-copy-to-clipboard";
|
|
14
15
|
import styles from "./index.module.less";
|
|
15
16
|
import defaultImg from "./img/default-img.png";
|
|
16
17
|
export var getFormItem = function getFormItem(_ref) {
|
|
@@ -319,7 +320,7 @@ export var BsGoodsTable = function BsGoodsTable(_ref9) {
|
|
|
319
320
|
title: "".concat(text, "\u540D\u79F0"),
|
|
320
321
|
align: "center",
|
|
321
322
|
ellipsis: true,
|
|
322
|
-
width:
|
|
323
|
+
width: 200
|
|
323
324
|
}, {
|
|
324
325
|
dataIndex: "code",
|
|
325
326
|
title: "".concat(text, "\u7F16\u7801"),
|
|
@@ -386,4 +387,84 @@ export var BsGoodsTable = function BsGoodsTable(_ref9) {
|
|
|
386
387
|
emptyText: "暂无数据"
|
|
387
388
|
}
|
|
388
389
|
});
|
|
390
|
+
};
|
|
391
|
+
export var FileRender = function FileRender(_ref10) {
|
|
392
|
+
var _ref10$fileList = _ref10.fileList,
|
|
393
|
+
fileList = _ref10$fileList === void 0 ? [] : _ref10$fileList;
|
|
394
|
+
var _useState3 = useState(false),
|
|
395
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
396
|
+
visible = _useState4[0],
|
|
397
|
+
setVisible = _useState4[1];
|
|
398
|
+
var _useState5 = useState(""),
|
|
399
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
400
|
+
fileUrl = _useState6[0],
|
|
401
|
+
setFileUrl = _useState6[1];
|
|
402
|
+
var _useState7 = useState(""),
|
|
403
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
404
|
+
fileType = _useState8[0],
|
|
405
|
+
setFileType = _useState8[1];
|
|
406
|
+
var _useState9 = useState(""),
|
|
407
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
408
|
+
fileName = _useState10[0],
|
|
409
|
+
setFileName = _useState10[1];
|
|
410
|
+
var handleCancel = function handleCancel() {
|
|
411
|
+
setFileUrl("");
|
|
412
|
+
setFileName("");
|
|
413
|
+
setVisible(false);
|
|
414
|
+
};
|
|
415
|
+
var onPreview = function onPreview(file) {
|
|
416
|
+
var _file$url;
|
|
417
|
+
var fileArr = file === null || file === void 0 ? void 0 : (_file$url = file.url) === null || _file$url === void 0 ? void 0 : _file$url.split(".");
|
|
418
|
+
var fileType = fileArr[fileArr.length - 1];
|
|
419
|
+
if (["png", "jpg", "jpeg", "gif", "bmp", "svg"].includes(fileType.toLowerCase())) {
|
|
420
|
+
setFileUrl(file === null || file === void 0 ? void 0 : file.url);
|
|
421
|
+
setFileName(file === null || file === void 0 ? void 0 : file.name);
|
|
422
|
+
setFileType("pic");
|
|
423
|
+
setVisible(true);
|
|
424
|
+
} else if (["mp4", "avi", "mpeg", "asf", "mov", "3gp", "wmv", "rmvb"].includes(fileType.toLowerCase())) {
|
|
425
|
+
setFileUrl(file === null || file === void 0 ? void 0 : file.url);
|
|
426
|
+
setFileName(file === null || file === void 0 ? void 0 : file.name);
|
|
427
|
+
setFileType("video");
|
|
428
|
+
setVisible(true);
|
|
429
|
+
} else {
|
|
430
|
+
window.open(file === null || file === void 0 ? void 0 : file.url);
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, fileList.map(function (item) {
|
|
434
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
435
|
+
style: {
|
|
436
|
+
color: "#1890ff",
|
|
437
|
+
cursor: "pointer"
|
|
438
|
+
},
|
|
439
|
+
onClick: function onClick() {
|
|
440
|
+
return onPreview(item);
|
|
441
|
+
}
|
|
442
|
+
}, item.name);
|
|
443
|
+
}), /*#__PURE__*/React.createElement(Modal, {
|
|
444
|
+
visible: visible,
|
|
445
|
+
title: fileName,
|
|
446
|
+
footer: null,
|
|
447
|
+
onCancel: handleCancel
|
|
448
|
+
}, /*#__PURE__*/React.createElement(CopyToClipboard, {
|
|
449
|
+
text: fileUrl,
|
|
450
|
+
onCopy: function onCopy() {
|
|
451
|
+
message.success("复制成功");
|
|
452
|
+
}
|
|
453
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
454
|
+
type: "link"
|
|
455
|
+
}, "\u4E0B\u8F7D\u5730\u5740")), fileType === "pic" ? /*#__PURE__*/React.createElement("img", {
|
|
456
|
+
alt: "example",
|
|
457
|
+
style: {
|
|
458
|
+
width: "100%"
|
|
459
|
+
},
|
|
460
|
+
src: fileUrl
|
|
461
|
+
}) : /*#__PURE__*/React.createElement("video", {
|
|
462
|
+
style: {
|
|
463
|
+
width: "100%",
|
|
464
|
+
height: "100%"
|
|
465
|
+
},
|
|
466
|
+
autoPlay: true,
|
|
467
|
+
controls: true,
|
|
468
|
+
src: fileUrl
|
|
469
|
+
})));
|
|
389
470
|
};
|
|
@@ -17,6 +17,7 @@ import { ApaasUploadFile } from "@kmkf-fe-packages/basic-components";
|
|
|
17
17
|
import GetFormItem from "../GetFormItem";
|
|
18
18
|
import ItemView from "../../commonComponents/ItemView";
|
|
19
19
|
import { isNull } from "@kmkf-fe-packages/kmkf-utils";
|
|
20
|
+
import { FileRender } from "../Common";
|
|
20
21
|
var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
|
|
21
22
|
var _this = this;
|
|
22
23
|
_classCallCheck(this, BasicFile);
|
|
@@ -54,21 +55,14 @@ var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
|
|
|
54
55
|
return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_file")];
|
|
55
56
|
});
|
|
56
57
|
_defineProperty(this, "renderClient", function (record) {
|
|
57
|
-
var _record$id;
|
|
58
58
|
var _this$id$split = _this.id.split("_"),
|
|
59
59
|
_this$id$split2 = _slicedToArray(_this$id$split, 1),
|
|
60
60
|
id = _this$id$split2[0];
|
|
61
61
|
return !isNull(record === null || record === void 0 ? void 0 : record[id]) ? /*#__PURE__*/React.createElement(ItemView, {
|
|
62
62
|
id: _this.id,
|
|
63
63
|
label: _this.name,
|
|
64
|
-
value:
|
|
65
|
-
|
|
66
|
-
href: file.url,
|
|
67
|
-
target: "_blank",
|
|
68
|
-
style: {
|
|
69
|
-
display: "block"
|
|
70
|
-
}
|
|
71
|
-
}, file.name);
|
|
64
|
+
value: /*#__PURE__*/React.createElement(FileRender, {
|
|
65
|
+
fileList: record === null || record === void 0 ? void 0 : record[id]
|
|
72
66
|
})
|
|
73
67
|
}) : null;
|
|
74
68
|
});
|
package/dist/esm/factory.d.ts
CHANGED
|
@@ -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, CommonDataTime, TradeId, ShopName, ErpTradeId, BuyerNick, ReceiverName, ReceiverMobile, ReceiverAddress, TradeDateTime, Logistics, ReturnLogistics, ActualPayment, ERemark, AliPay, ItemSelect, ItemId, ItemEnCode, SystemOrderNo, Ordinary, ThirdItemSelect, FlowStatusSelect, Payment, TemplateSelect, WorkOrderId, PlatForm, ShopInput, Submitter, Handler, CompletedUser, LogisticsInterception, LogisticsTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue } from "./index";
|
|
2
2
|
import { PickOption } from "./type";
|
|
3
|
-
export declare const factory: (type: string, options: PickOption) =>
|
|
3
|
+
export declare const factory: (type: string, options: PickOption) => JstLogistics | JstSendGood | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | CommonDataTime | TradeId | ErpTradeId | ShopName | BuyerNick | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | JstItemSelect | JstSupply | BsGoods | BsExchange | BsReissue | FlowStatusSelect | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsTrajectory | PlatForm | ShopInput | Submitter | Handler | CompletedUser | FlowWorkOrderId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/services-components",
|
|
3
|
-
"version": "0.8.9-alpha.
|
|
3
|
+
"version": "0.8.9-alpha.15",
|
|
4
4
|
"module": "dist/esm/index.js",
|
|
5
5
|
"typings": "dist/esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"father": "^4.1.7"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@kmkf-fe-packages/basic-components": "^0.8.9-alpha.
|
|
29
|
+
"@kmkf-fe-packages/basic-components": "^0.8.9-alpha.15",
|
|
30
30
|
"@kmkf-fe-packages/kmkf-utils": "^0.8.9-alpha.9"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"gitHooks": {
|
|
41
41
|
"pre-commit": "lint-staged"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "cf889c49a3699f46e3a6092e42de8212d85242b1"
|
|
44
44
|
}
|