@kmkf-fe-packages/services-components 0.24.0 → 0.24.1-alpha.0

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,5 +1,6 @@
1
- import { ComponentInterface, PickOption, ColumnConfig, Record } from '../../type';
2
- import React from 'react';
1
+ import { ComponentInterface, PickOption, ColumnConfig, Record } from "../../type";
2
+ import React from "react";
3
+ import { BsHeaderGood } from "../BS/common/index";
3
4
  declare class EItemEncode implements ComponentInterface {
4
5
  name: string;
5
6
  id: string;
@@ -12,13 +13,16 @@ declare class EItemEncode implements ComponentInterface {
12
13
  formField: string;
13
14
  canSort: boolean;
14
15
  children: ComponentInterface[];
15
- dataType: ComponentInterface['dataType'];
16
+ goods: BsHeaderGood;
17
+ dataType: ComponentInterface["dataType"];
18
+ showHeader: string[];
19
+ platform?: ComponentInterface["platform"];
16
20
  constructor(options: PickOption);
17
21
  renderClient: (record: any) => React.JSX.Element | null;
18
- renderPc: (value: unknown, record: Record) => React.JSX.Element;
22
+ renderPc: (value: unknown, record: Record) => React.JSX.Element | null;
19
23
  renderLog: (r: Record) => React.JSX.Element | null;
20
24
  getComponentValue: (r: Record) => any;
21
- renderExport: (value: unknown, record: Record) => any;
25
+ renderExport: () => null;
22
26
  editRender: (p: any) => React.JSX.Element;
23
27
  filterConfig: (item: ColumnConfig) => {
24
28
  searchDefaultConditions: "like";
@@ -26,7 +30,6 @@ declare class EItemEncode implements ComponentInterface {
26
30
  id: string;
27
31
  name: string;
28
32
  filterComponentType: "Input";
29
- filterFn: (value: string) => (i: Record) => any;
30
- };
33
+ }[];
31
34
  }
32
35
  export default EItemEncode;
@@ -1,4 +1,6 @@
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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2
4
  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
5
  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); } }
4
6
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -6,16 +8,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
6
8
  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
9
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
10
  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 React from 'react';
11
+ import React from "react";
10
12
  import GetFormItem from "../GetFormItem";
11
13
  import ItemEncode from "./ItemEncode";
12
- import { GoodImage } from "../Common";
14
+ import { GoodImage, TBGoodTable } from "../Common";
15
+ import { BsHeaderGood } from "../BS/common/index";
13
16
  import ItemView from "../../commonComponents/ItemView";
14
- import { isNull, filterFn as _filterFn } from '@kmkf-fe-packages/kmkf-utils';
17
+ import { isNull } from "@kmkf-fe-packages/kmkf-utils";
15
18
  import { SYMBOL } from "../../constant";
16
19
  var EItemEncode = /*#__PURE__*/_createClass(function EItemEncode(options) {
17
20
  var _this = this,
18
- _this$componentConfig;
21
+ _this$componentConfig,
22
+ _this$componentConfig2;
19
23
  _classCallCheck(this, EItemEncode);
20
24
  _defineProperty(this, "name", void 0);
21
25
  _defineProperty(this, "id", void 0);
@@ -28,43 +32,49 @@ var EItemEncode = /*#__PURE__*/_createClass(function EItemEncode(options) {
28
32
  _defineProperty(this, "formField", void 0);
29
33
  _defineProperty(this, "canSort", void 0);
30
34
  _defineProperty(this, "children", void 0);
35
+ _defineProperty(this, "goods", void 0);
31
36
  _defineProperty(this, "dataType", void 0);
37
+ _defineProperty(this, "showHeader", void 0);
38
+ _defineProperty(this, "platform", void 0);
32
39
  _defineProperty(this, "renderClient", function (record) {
33
- return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
40
+ if (isNull(record === null || record === void 0 ? void 0 : record[_this.id])) return null;
41
+ return /*#__PURE__*/React.createElement(ItemView, {
34
42
  id: _this.id,
35
43
  label: _this.name,
36
44
  value: /*#__PURE__*/React.createElement(GoodImage, {
37
45
  list: record === null || record === void 0 ? void 0 : record[_this.id],
46
+ showHeader: _this.showHeader,
38
47
  type: "itemCode"
39
48
  })
40
- }) : null;
49
+ });
41
50
  });
42
51
  _defineProperty(this, "renderPc", function (value, record) {
43
- if ((record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_itemList")]) === undefined) {
44
- return /*#__PURE__*/React.createElement("span", null, "--");
45
- }
46
- //兼容多个商品
47
- return /*#__PURE__*/React.createElement("span", {
48
- onClick: function onClick(e) {
49
- return e.stopPropagation();
50
- }
51
- }, /*#__PURE__*/React.createElement(GoodImage, {
52
- list: record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_itemList")],
53
- type: "itemCode"
54
- }));
52
+ return !isNull(record === null || record === void 0 ? void 0 : record["".concat(_this.id)]) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ItemView, {
53
+ id: _this.id,
54
+ label: _this.name,
55
+ value: /*#__PURE__*/React.createElement(TBGoodTable, {
56
+ list: (record === null || record === void 0 ? void 0 : record["".concat(_this.id)]) || [],
57
+ showHeader: _this.showHeader
58
+ })
59
+ })) : null;
55
60
  });
56
61
  _defineProperty(this, "renderLog", function (r) {
57
62
  if (isNull(r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_itemList")])) return null;
58
- return _this.renderPc(undefined, r);
63
+ return /*#__PURE__*/React.createElement(ItemView, {
64
+ id: _this.id,
65
+ label: _this.name,
66
+ value: /*#__PURE__*/React.createElement(GoodImage, {
67
+ list: r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_itemList")],
68
+ showHeader: _this.showHeader,
69
+ type: "itemCode"
70
+ })
71
+ });
59
72
  });
60
73
  _defineProperty(this, "getComponentValue", function (r) {
61
74
  return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_itemList")];
62
75
  });
63
- _defineProperty(this, "renderExport", function (value, record) {
64
- var _ref;
65
- return (_ref = (record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_itemList")]) || []) === null || _ref === void 0 ? void 0 : _ref.map(function (item) {
66
- return item.outerId;
67
- }).join(' ');
76
+ _defineProperty(this, "renderExport", function () {
77
+ return null;
68
78
  });
69
79
  _defineProperty(this, "editRender", function (p) {
70
80
  var _this$effects, _this$effects2;
@@ -74,7 +84,9 @@ var EItemEncode = /*#__PURE__*/_createClass(function EItemEncode(options) {
74
84
  rules: _this.rules,
75
85
  required: false,
76
86
  hidden: p === null || p === void 0 ? void 0 : p.hidden,
77
- component: /*#__PURE__*/React.createElement(ItemEncode, _extends({}, _this.componentConfig, {
87
+ component: /*#__PURE__*/React.createElement(ItemEncode, _extends({
88
+ isSingleRow: _this.platform === 'pc'
89
+ }, _this.componentConfig, {
78
90
  shopId: (_this$effects = _this.effects) === null || _this$effects === void 0 ? void 0 : _this$effects.shopId,
79
91
  shopList: (_this$effects2 = _this.effects) === null || _this$effects2 === void 0 ? void 0 : _this$effects2.shopList,
80
92
  width: "90%"
@@ -82,50 +94,62 @@ var EItemEncode = /*#__PURE__*/_createClass(function EItemEncode(options) {
82
94
  });
83
95
  });
84
96
  _defineProperty(this, "filterConfig", function (item) {
85
- return {
97
+ return [{
86
98
  searchDefaultConditions: SYMBOL.like,
87
99
  type: item.type,
88
100
  id: "".concat(item.id, "_itemList"),
89
101
  // 过滤组件id
90
102
  name: item.name,
91
103
  // 过滤组件名称
92
- filterComponentType: 'Input',
93
- filterFn: function filterFn(value) {
94
- return function (i) {
95
- var _ref2;
96
- return (_ref2 = _filterFn.filterTableListItemColumnValue(i, item.id, 'itemList') || []) === null || _ref2 === void 0 ? void 0 : _ref2.some(function (item) {
97
- var _String;
98
- return item !== null && item !== void 0 && item.outerId ? (_String = String(item === null || item === void 0 ? void 0 : item.outerId)) === null || _String === void 0 ? void 0 : _String.includes(value) : false;
99
- });
100
- };
101
- }
102
- };
104
+ filterComponentType: "Input"
105
+ }];
103
106
  });
104
107
  this.name = options.name;
105
108
  this.id = options.id;
109
+ this.platform = options.platform;
106
110
  this.sortField = "".concat(options.id, "_itemList");
107
111
  this.formField = "".concat(options.id, "_itemList");
108
112
  this.type = options.type;
109
113
  this.effects = options === null || options === void 0 ? void 0 : options.effects;
110
114
  this.componentConfig = options === null || options === void 0 ? void 0 : options.componentConfig;
111
- this.isCombinationComponent = false;
115
+ this.showHeader = ((_this$componentConfig = this.componentConfig) === null || _this$componentConfig === void 0 ? void 0 : _this$componentConfig.showHeader) || ["title",
116
+ // 商品名称
117
+ "outerId",
118
+ // 商品编码
119
+ "picUrl",
120
+ // 图片
121
+ "numIid",
122
+ // 商品id
123
+ "skuId",
124
+ // skuId
125
+ "outerSkuId",
126
+ // sku编码
127
+ "propertiesName" // sku 信息
128
+ ];
129
+
130
+ this.isCombinationComponent = true;
112
131
  this.canSort = false;
113
- this.children = [];
114
- this.rules = this !== null && this !== void 0 && (_this$componentConfig = this.componentConfig) !== null && _this$componentConfig !== void 0 && _this$componentConfig.required ? [{
132
+ this.goods = new BsHeaderGood(_objectSpread(_objectSpread({}, options), {}, {
133
+ id: "".concat(options.id, "_itemList"),
134
+ name: "商品信息"
135
+ }));
136
+ this.children = [this.goods];
137
+ this.rules = this !== null && this !== void 0 && (_this$componentConfig2 = this.componentConfig) !== null && _this$componentConfig2 !== void 0 && _this$componentConfig2.required ? [{
115
138
  required: true,
116
139
  validator: function validator(_, value) {
117
140
  if (!value || !value.length) {
118
- return Promise.reject(new Error('请选择宝贝'));
141
+ return Promise.reject(new Error("请选择宝贝"));
119
142
  }
120
- var hasNotId = (value || []).some(function (item) {
143
+ // 如果配置了商品编码不可见,则跳过商品编码校验
144
+ var hasNotId = !_this.showHeader.includes("outerId") && (value || []).some(function (item) {
121
145
  return !item.outerId;
122
146
  });
123
147
  if (hasNotId) {
124
- return Promise.reject(new Error('请输入商品编码'));
148
+ return Promise.reject(new Error("请输入商品编码"));
125
149
  }
126
150
  return Promise.resolve();
127
151
  }
128
152
  }] : [];
129
- this.dataType = 'object';
153
+ this.dataType = "object";
130
154
  });
131
155
  export default EItemEncode;
@@ -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, FlowMarkSelect, FlowTag, Payment, TemplateSelect, WorkOrderId, PlatForm, ShopInput, Submitter, PrevSubmitter, FlowCreator, Handler, CompletedUser, LogisticsInterception, LogisticsTrajectory, LogisticsMoreTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsReturn, BsSystemOrder, BsLogistics, StatusSelect, CommonSystemOrder, CommonMultiStatus, Calculation, NodeDeadLine, HandlerDeadLine, NodeStayDuration, WlnGoods, BsPosting, MsgStatus } from "./index";
2
2
  import { PickOption } from "./type";
3
- export declare const factory: (type: string, options: PickOption) => ActualPayment | BasicAddress | AliPay | BsExchange | BsGoods | BsLogistics | BsPosting | BsReissue | BsReturn | BsSystemOrder | BuyerNick | Calculation | BasicCascader | BasicCheckbox | CommonDataTime | CommonMultiStatus | CommonSystemOrder | CompletedUser | BasicDataTime | ItemEnCode | ItemId | ItemSelect | ErpTradeId | BasicFile | FlowCreator | FlowMarkSelect | FlowStatusSelect | FlowTag | FlowWorkOrderId | BasicGrade | Handler | HandlerDeadLine | BasicInput | JstItemSelect | JstLogistics | JstSendGood | JstSupply | Logistics | LogisticsInterception | LogisticsMoreTrajectory | LogisticsTrajectory | MsgStatus | BasicMultSelect | NodeDeadLine | NodeStayDuration | Ordinary | Payment | BasicPicture | PlatForm | BasicPosting | PrevSubmitter | BasicRadio | BasicRate | ReceiverAddress | ReceiverMobile | ReceiverName | ERemark | ReturnLogistics | BasicSelect | ShopInput | ShopName | StatusSelect | Submitter | SystemOrderNo | TemplateSelect | BasicTextArea | ThirdItemSelect | TradeDateTime | TradeId | WlnGoods | WorkOrderId;
3
+ export declare const factory: (type: string, options: PickOption) => BsLogistics | BsReissue | BsSystemOrder | CommonMultiStatus | CommonSystemOrder | ItemEnCode | BasicInput | JstLogistics | JstSendGood | Logistics | LogisticsMoreTrajectory | Payment | BasicPosting | TradeId | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicMultSelect | BasicGrade | BasicRate | BasicFile | CommonDataTime | ErpTradeId | ShopName | BuyerNick | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | SystemOrderNo | Ordinary | ThirdItemSelect | JstItemSelect | JstSupply | BsGoods | BsExchange | BsReturn | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | Calculation | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | MsgStatus;
@@ -52,6 +52,7 @@ export interface ComponentInterface {
52
52
  options?: Array<any>;
53
53
  templateId?: string;
54
54
  workOrderUniqueKey?: string;
55
+ platform?: PlatForm;
55
56
  /**
56
57
  * @description 组件下标
57
58
  * @deprecated 已弃用字段,后续版本不在使用
@@ -233,7 +234,7 @@ export interface ComponentInterface {
233
234
  getComponentValue: (r: Record) => any;
234
235
  formDataTransform?: (r: any) => any;
235
236
  }
236
- export declare type PickOption = Pick<ComponentInterface, "name" | "id" | "type" | "componentConfig" | "effects" | "columnHeader" | "templateId" | "workOrderUniqueKey">;
237
+ export declare type PickOption = Pick<ComponentInterface, "name" | "id" | "type" | "componentConfig" | "effects" | "columnHeader" | "templateId" | "workOrderUniqueKey" | "platform">;
237
238
  export declare type ColumnConfig = {
238
239
  id: string;
239
240
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "0.24.0",
3
+ "version": "0.24.1-alpha.0",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -20,8 +20,8 @@
20
20
  ]
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/basic-components": "^0.24.0",
24
- "@kmkf-fe-packages/kmkf-utils": "^0.24.0"
23
+ "@kmkf-fe-packages/basic-components": "^0.24.1-alpha.0",
24
+ "@kmkf-fe-packages/kmkf-utils": "^0.24.1-alpha.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@typescript-eslint/eslint-plugin": "^5.59.2",
@@ -37,7 +37,7 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "133439d300dbb2cca26ccac67026ec0190d71a84",
40
+ "gitHead": "fb6199d073f8d5c64a35e124c48796d64284bf24",
41
41
  "gitHooks": {
42
42
  "pre-commit": "lint-staged"
43
43
  }