@kmkf-fe-packages/services-components 0.8.9-alpha.2 → 0.8.9-alpha.20

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.
@@ -6,8 +6,9 @@ declare type Shop = {
6
6
  shopSource: string | number;
7
7
  };
8
8
  declare type ShopListProps = {
9
+ disabledList?: string[];
9
10
  shopList: Shop[];
10
11
  [prop: string]: any;
11
12
  };
12
- declare const ShopList: ({ shopList, valueMapping, onChange, setShopId, ...prop }: ShopListProps) => React.JSX.Element;
13
+ declare const ShopList: ({ disabledList, shopList, valueMapping, onChange, setShopId, ...prop }: ShopListProps) => React.JSX.Element;
13
14
  export default ShopList;
@@ -1,4 +1,4 @@
1
- var _excluded = ["shopList", "valueMapping", "onChange", "setShopId"];
1
+ var _excluded = ["disabledList", "shopList", "valueMapping", "onChange", "setShopId"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -8,7 +8,9 @@ import PlatformAvatar from "../PlatformAvatar";
8
8
  import { PlatData } from '@kmkf-fe-packages/kmkf-utils';
9
9
  var ShopList = function ShopList(_ref) {
10
10
  var _shopList$filter;
11
- var shopList = _ref.shopList,
11
+ var _ref$disabledList = _ref.disabledList,
12
+ disabledList = _ref$disabledList === void 0 ? [] : _ref$disabledList,
13
+ shopList = _ref.shopList,
12
14
  _ref$valueMapping = _ref.valueMapping,
13
15
  valueMapping = _ref$valueMapping === void 0 ? "shopId" : _ref$valueMapping,
14
16
  onChange = _ref.onChange,
@@ -29,6 +31,7 @@ var ShopList = function ShopList(_ref) {
29
31
  return plat.platformType === item.shopSource;
30
32
  });
31
33
  return /*#__PURE__*/React.createElement(Select.Option, {
34
+ disabled: item.disabled || disabledList.includes(item === null || item === void 0 ? void 0 : item[valueMapping]),
32
35
  value: item === null || item === void 0 ? void 0 : item[valueMapping],
33
36
  label: item.shopName
34
37
  }, /*#__PURE__*/React.createElement(PlatformAvatar, {
@@ -26,4 +26,5 @@ export declare const BsGoodsTable: ({ list, showHeader, text, }: {
26
26
  showHeader: string[];
27
27
  text?: string | undefined;
28
28
  }) => React.JSX.Element;
29
+ export declare const FileRender: ({ fileList }: any) => React.JSX.Element;
29
30
  export {};
@@ -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: 100
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
  };
@@ -13,13 +13,13 @@ declare class ExpressCode implements ComponentInterface {
13
13
  formField: string;
14
14
  canSort: boolean;
15
15
  children: ComponentInterface[];
16
- dataType: ComponentInterface['dataType'];
16
+ dataType: ComponentInterface["dataType"];
17
17
  constructor(options: PickOption);
18
18
  renderClient: (record: any) => React.JSX.Element | null;
19
19
  renderPc: (value: unknown, record: Record) => React.JSX.Element;
20
20
  renderLog: (r: Record) => React.JSX.Element | null;
21
21
  getComponentValue: (r: Record) => any;
22
- renderExport: (value: string, record: Record) => string;
22
+ renderExport: (value: string, record: Record) => any;
23
23
  editRender: (p: any) => React.JSX.Element;
24
24
  filterConfig: (item: ColumnConfig) => {
25
25
  searchDefaultConditions: "like";
@@ -47,8 +47,8 @@ var ExpressCode = /*#__PURE__*/_createClass(function ExpressCode(options) {
47
47
  return r === null || r === void 0 ? void 0 : r[_this.id];
48
48
  });
49
49
  _defineProperty(this, "renderExport", function (value, record) {
50
- var _ref;
51
- return (_ref = "".concat(record === null || record === void 0 ? void 0 : record[_this.id])) !== null && _ref !== void 0 ? _ref : "--";
50
+ var _record$_this$id2;
51
+ return (_record$_this$id2 = record === null || record === void 0 ? void 0 : record[_this.id]) !== null && _record$_this$id2 !== void 0 ? _record$_this$id2 : "--";
52
52
  });
53
53
  _defineProperty(this, "editRender", function (p) {
54
54
  var _this$componentConfig, _this$componentConfig2, _this$componentConfig3, _this$componentConfig4;
@@ -94,7 +94,7 @@ var ExpressCode = /*#__PURE__*/_createClass(function ExpressCode(options) {
94
94
  this.width = 200;
95
95
  this.isCombinationComponent = false;
96
96
  this.canSort = true;
97
- this.dataType = 'string';
97
+ this.dataType = "string";
98
98
  this.children = [];
99
99
  });
100
100
  export default ExpressCode;
@@ -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: record === null || record === void 0 ? void 0 : (_record$id = record[id]) === null || _record$id === void 0 ? void 0 : _record$id.map(function (file) {
65
- return /*#__PURE__*/React.createElement("a", {
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
  });
@@ -1,4 +1,5 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
3
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
3
4
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -70,7 +71,9 @@ var BasicRadio = /*#__PURE__*/_createClass(function BasicRadio(options) {
70
71
  rules: _this.rules,
71
72
  hidden: p === null || p === void 0 ? void 0 : p.hidden,
72
73
  required: (_this$componentConfig = (_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.required) !== null && _this$componentConfig !== void 0 ? _this$componentConfig : false,
73
- component: /*#__PURE__*/React.createElement(ApaasRadio, _this.componentConfig)
74
+ component: /*#__PURE__*/React.createElement(ApaasRadio, _extends({}, _this.componentConfig, {
75
+ onChange: p === null || p === void 0 ? void 0 : p.onChange
76
+ }))
74
77
  });
75
78
  });
76
79
  _defineProperty(this, "filterConfig", function (item) {
@@ -38,7 +38,8 @@ var BasicSelect = /*#__PURE__*/_createClass(function BasicSelect(options) {
38
38
  required: (_this$componentConfig = (_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.required) !== null && _this$componentConfig !== void 0 ? _this$componentConfig : false,
39
39
  component: /*#__PURE__*/React.createElement(ApaasSelect, _extends({}, _this.componentConfig, {
40
40
  placeholder: "\u8BF7\u8F93\u5165".concat(_this.name),
41
- showSearch: true
41
+ showSearch: true,
42
+ onChange: p === null || p === void 0 ? void 0 : p.onChange
42
43
  }))
43
44
  });
44
45
  });
@@ -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) => ActualPayment | BasicAddress | AliPay | BsExchange | BsGoods | BsReissue | BuyerNick | BasicCascader | BasicCheckbox | CommonDataTime | CompletedUser | BasicDataTime | ItemEnCode | ItemId | ItemSelect | ErpTradeId | BasicFile | FlowStatusSelect | FlowWorkOrderId | BasicGrade | Handler | BasicInput | JstItemSelect | JstLogistics | JstSendGood | JstSupply | Logistics | LogisticsInterception | LogisticsTrajectory | BasicMultSelect | Ordinary | Payment | BasicPicture | PlatForm | BasicPosting | BasicRadio | BasicRate | ReceiverAddress | ReceiverMobile | ReceiverName | ERemark | ReturnLogistics | BasicSelect | ShopInput | ShopName | Submitter | SystemOrderNo | TemplateSelect | BasicTextArea | ThirdItemSelect | TradeDateTime | TradeId | WorkOrderId;
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.2",
3
+ "version": "0.8.9-alpha.20",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -26,8 +26,8 @@
26
26
  "father": "^4.1.7"
27
27
  },
28
28
  "dependencies": {
29
- "@kmkf-fe-packages/basic-components": "^0.8.9-alpha.2",
30
- "@kmkf-fe-packages/kmkf-utils": "^0.8.9-alpha.2"
29
+ "@kmkf-fe-packages/basic-components": "^0.8.9-alpha.20",
30
+ "@kmkf-fe-packages/kmkf-utils": "^0.8.9-alpha.9"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@ant-design/icons": "^4.7.0",
@@ -40,5 +40,5 @@
40
40
  "gitHooks": {
41
41
  "pre-commit": "lint-staged"
42
42
  },
43
- "gitHead": "2326638457272e646e3fb9f5f20f5ce92e8a8347"
43
+ "gitHead": "229f72526a0b46b2db48fee3ada308087ea4c79c"
44
44
  }