@kmkf-fe-packages/services-components 1.22.5 → 1.23.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,9 +1,10 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  declare type Shop = {
3
3
  auditStatus: number;
4
4
  shopId: string;
5
5
  shopName: string;
6
6
  shopSource: string | number;
7
+ useStatus: number;
7
8
  };
8
9
  declare type ShopListProps = {
9
10
  disabledList?: string[];
@@ -2,10 +2,10 @@ var _excluded = ["disabledList", "shopList", "valueMapping", "onChange", "setSho
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; }
5
- import React from 'react';
6
- import { Select } from 'antd';
5
+ import React from "react";
6
+ import { Select } from "antd";
7
7
  import PlatformAvatar from "../PlatformAvatar";
8
- import { PlatData } from '@kmkf-fe-packages/kmkf-utils';
8
+ import { PlatData } from "@kmkf-fe-packages/kmkf-utils";
9
9
  var ShopList = function ShopList(_ref) {
10
10
  var _shopList$filter;
11
11
  var _ref$disabledList = _ref.disabledList,
@@ -24,7 +24,7 @@ var ShopList = function ShopList(_ref) {
24
24
  return /*#__PURE__*/React.createElement(Select, _extends({
25
25
  onChange: handleChange
26
26
  }, prop), shopList === null || shopList === void 0 ? void 0 : (_shopList$filter = shopList.filter(function (item) {
27
- return (item === null || item === void 0 ? void 0 : item.auditStatus) === 1;
27
+ return (item === null || item === void 0 ? void 0 : item.auditStatus) === 1 && (item === null || item === void 0 ? void 0 : item.useStatus) === 1;
28
28
  })) === null || _shopList$filter === void 0 ? void 0 : _shopList$filter.map(function (item) {
29
29
  var _platDatInstance$getP;
30
30
  var plat = (_platDatInstance$getP = platDatInstance.getPlatData()) === null || _platDatInstance$getP === void 0 ? void 0 : _platDatInstance$getP.find(function (plat) {
@@ -34,7 +34,7 @@ var ShopList = function ShopList(_ref) {
34
34
  disabled: item.disabled || disabledList.includes(item === null || item === void 0 ? void 0 : item[valueMapping]),
35
35
  value: item === null || item === void 0 ? void 0 : item[valueMapping],
36
36
  key: item === null || item === void 0 ? void 0 : item[valueMapping],
37
- label: "".concat((plat === null || plat === void 0 ? void 0 : plat.platformName) || '').concat(item.shopName)
37
+ label: "".concat((plat === null || plat === void 0 ? void 0 : plat.platformName) || "").concat(item.shopName)
38
38
  }, /*#__PURE__*/React.createElement(PlatformAvatar, {
39
39
  styles: {
40
40
  marginRight: 5
@@ -72,7 +72,7 @@ var BsGoods = /*#__PURE__*/_createClass(function BsGoods(options) {
72
72
  required: false,
73
73
  hidden: p === null || p === void 0 ? void 0 : p.hidden,
74
74
  display: p === null || p === void 0 ? void 0 : p.display,
75
- tooltip: (_this$componentConfig3 = _this.componentConfig) !== null && _this$componentConfig3 !== void 0 && _this$componentConfig3.showTooltip ? (_this$componentConfig4 = _this.componentConfig) === null || _this$componentConfig4 === void 0 ? void 0 : _this$componentConfig4.tooltip : '',
75
+ tooltip: (_this$componentConfig3 = _this.componentConfig) !== null && _this$componentConfig3 !== void 0 && _this$componentConfig3.showTooltip ? (_this$componentConfig4 = _this.componentConfig) === null || _this$componentConfig4 === void 0 ? void 0 : _this$componentConfig4.tooltip : "",
76
76
  component: /*#__PURE__*/React.createElement(Goods, _extends({
77
77
  type: _this.type
78
78
  }, _this.componentConfig, {
@@ -1,17 +1,17 @@
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
3
  declare class BsSystemOrder implements ComponentInterface {
4
4
  name: string;
5
5
  id: string;
6
6
  sortField: string;
7
7
  type: string;
8
8
  rules: any[];
9
- componentConfig: ComponentInterface['componentConfig'];
10
- effects: ComponentInterface['effects'];
9
+ componentConfig: ComponentInterface["componentConfig"];
10
+ effects: ComponentInterface["effects"];
11
11
  isCombinationComponent: boolean;
12
12
  formField: string;
13
13
  canSort: boolean;
14
- dataType: ComponentInterface['dataType'];
14
+ dataType: ComponentInterface["dataType"];
15
15
  children: ComponentInterface[];
16
16
  constructor(options: PickOption);
17
17
  renderClient: (record: any) => React.JSX.Element | null;
@@ -8,19 +8,19 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
8
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; }
9
9
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
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); }
11
- import React from 'react';
11
+ import React from "react";
12
12
  import GetFormItem from "../../GetFormItem";
13
13
  import ItemView from "../../../commonComponents/ItemView";
14
14
  import { isNull, BS_E3_BOOLEAN_STATUS_MAP, BS_E3_ORDER_STATUS_MAP, KM_SYSTEM_ORDER_CONFIG } from "@kmkf-fe-packages/kmkf-utils";
15
- import { BsSystemOrder as SystemOrder } from '@kmkf-fe-packages/basic-components';
15
+ import { BsSystemOrder as SystemOrder } from "@kmkf-fe-packages/basic-components";
16
16
  import { BsSystemOrderTable } from "../../Common";
17
17
  import { BsHeaderChild } from "../common/index";
18
18
  import { SYMBOL, batchInput } from "../../../constant";
19
19
  var typeMap = {
20
20
  BS_SYSTEM_ORDER: {
21
- key: 'bsSystemShowOrder',
22
- name: '百胜',
23
- selectId: 'bsSystemSelectIds',
21
+ key: "bsSystemShowOrder",
22
+ name: "百胜",
23
+ selectId: "bsSystemSelectIds",
24
24
  columns: [{
25
25
  title: "单据类型",
26
26
  dataIndex: "billType",
@@ -34,12 +34,12 @@ var typeMap = {
34
34
  dataIndex: "billTag",
35
35
  width: 150
36
36
  }, {
37
- title: '主播名称',
38
- dataIndex: 'authorName',
37
+ title: "主播名称",
38
+ dataIndex: "authorName",
39
39
  width: 150
40
40
  }, {
41
- title: '主播ID',
42
- dataIndex: 'authorId',
41
+ title: "主播ID",
42
+ dataIndex: "authorId",
43
43
  width: 150
44
44
  }
45
45
  // {
@@ -52,9 +52,9 @@ var typeMap = {
52
52
 
53
53
  KM_SYSTEM_ORDER: KM_SYSTEM_ORDER_CONFIG,
54
54
  WLN_SYSTEM_ORDER: {
55
- key: 'wlnSystemShowOrder',
56
- name: '万里牛',
57
- selectId: 'wlnSystemSelectIds',
55
+ key: "wlnSystemShowOrder",
56
+ name: "万里牛",
57
+ selectId: "wlnSystemSelectIds",
58
58
  columns: [{
59
59
  title: "订单类型",
60
60
  dataIndex: "billType",
@@ -103,6 +103,9 @@ var typeMap = {
103
103
  ellipsis: true,
104
104
  render: function render(val) {
105
105
  return /*#__PURE__*/React.createElement("span", null, BS_E3_ORDER_STATUS_MAP[val] || val);
106
+ },
107
+ renderExport: function renderExport(val) {
108
+ return BS_E3_ORDER_STATUS_MAP[val] || val;
106
109
  }
107
110
  }, {
108
111
  title: "是否被拆分",
@@ -111,6 +114,9 @@ var typeMap = {
111
114
  ellipsis: true,
112
115
  render: function render(val) {
113
116
  return /*#__PURE__*/React.createElement("span", null, BS_E3_BOOLEAN_STATUS_MAP[val] || val);
117
+ },
118
+ renderExport: function renderExport(val) {
119
+ return BS_E3_BOOLEAN_STATUS_MAP[val] || val;
114
120
  }
115
121
  }, {
116
122
  title: "是否拆分子单",
@@ -119,6 +125,9 @@ var typeMap = {
119
125
  ellipsis: true,
120
126
  render: function render(val) {
121
127
  return /*#__PURE__*/React.createElement("span", null, BS_E3_BOOLEAN_STATUS_MAP[val] || val);
128
+ },
129
+ renderExport: function renderExport(val) {
130
+ return BS_E3_BOOLEAN_STATUS_MAP[val] || val;
122
131
  }
123
132
  }, {
124
133
  title: "是否被合并",
@@ -127,6 +136,9 @@ var typeMap = {
127
136
  ellipsis: true,
128
137
  render: function render(val) {
129
138
  return /*#__PURE__*/React.createElement("span", null, BS_E3_BOOLEAN_STATUS_MAP[val] || val);
139
+ },
140
+ renderExport: function renderExport(val) {
141
+ return BS_E3_BOOLEAN_STATUS_MAP[val] || val;
130
142
  }
131
143
  }, {
132
144
  title: "是否合并新单",
@@ -135,6 +147,9 @@ var typeMap = {
135
147
  ellipsis: true,
136
148
  render: function render(val) {
137
149
  return /*#__PURE__*/React.createElement("span", null, BS_E3_BOOLEAN_STATUS_MAP[val] || val);
150
+ },
151
+ renderExport: function renderExport(val) {
152
+ return BS_E3_BOOLEAN_STATUS_MAP[val] || val;
138
153
  }
139
154
  }, {
140
155
  title: "是否复制单",
@@ -143,6 +158,9 @@ var typeMap = {
143
158
  ellipsis: true,
144
159
  render: function render(val) {
145
160
  return /*#__PURE__*/React.createElement("span", null, BS_E3_BOOLEAN_STATUS_MAP[val] || val);
161
+ },
162
+ renderExport: function renderExport(val) {
163
+ return BS_E3_BOOLEAN_STATUS_MAP[val] || val;
146
164
  }
147
165
  }, {
148
166
  title: "是否换货单",
@@ -151,6 +169,9 @@ var typeMap = {
151
169
  ellipsis: true,
152
170
  render: function render(val) {
153
171
  return /*#__PURE__*/React.createElement("span", null, BS_E3_BOOLEAN_STATUS_MAP[val] || val);
172
+ },
173
+ renderExport: function renderExport(val) {
174
+ return BS_E3_BOOLEAN_STATUS_MAP[val] || val;
154
175
  }
155
176
  }, {
156
177
  title: "订单备注",
@@ -216,7 +237,7 @@ var BsSystemOrder = /*#__PURE__*/_createClass(function BsSystemOrder(options) {
216
237
  required: false,
217
238
  hidden: p === null || p === void 0 ? void 0 : p.hidden,
218
239
  display: p === null || p === void 0 ? void 0 : p.display,
219
- tooltip: (_this$componentConfig = _this.componentConfig) !== null && _this$componentConfig !== void 0 && _this$componentConfig.showTooltip ? (_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.tooltip : '',
240
+ tooltip: (_this$componentConfig = _this.componentConfig) !== null && _this$componentConfig !== void 0 && _this$componentConfig.showTooltip ? (_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.tooltip : "",
220
241
  component: /*#__PURE__*/React.createElement(SystemOrder, _extends({}, _this.componentConfig, {
221
242
  onChange: p === null || p === void 0 ? void 0 : p.onChange,
222
243
  type: _this.type
@@ -231,7 +252,7 @@ var BsSystemOrder = /*#__PURE__*/_createClass(function BsSystemOrder(options) {
231
252
  // 过滤组件id
232
253
  name: item.name,
233
254
  // 过滤组件名称
234
- filterComponentType: 'Input',
255
+ filterComponentType: "Input",
235
256
  formatFilterValue: function formatFilterValue(input) {
236
257
  return batchInput(input);
237
258
  }
@@ -248,6 +269,7 @@ var BsSystemOrder = /*#__PURE__*/_createClass(function BsSystemOrder(options) {
248
269
  this.children = ((_typeMap$options$type = typeMap[options.type]) === null || _typeMap$options$type === void 0 ? void 0 : (_typeMap$options$type2 = _typeMap$options$type.columns) === null || _typeMap$options$type2 === void 0 ? void 0 : _typeMap$options$type2.map(function (column) {
249
270
  return new BsHeaderChild(_objectSpread(_objectSpread({}, options), {}, {
250
271
  transformValue: column.render,
272
+ renderExport: column.renderExport,
251
273
  name: column.title,
252
274
  id: "".concat(options.id, "_").concat(typeMap[options.type].key, "_").concat(column.dataIndex),
253
275
  width: column.width || 150
@@ -264,6 +286,6 @@ var BsSystemOrder = /*#__PURE__*/_createClass(function BsSystemOrder(options) {
264
286
  return Promise.resolve();
265
287
  }
266
288
  }] : [];
267
- this.dataType = 'object';
289
+ this.dataType = "object";
268
290
  });
269
291
  export default BsSystemOrder;
@@ -1,25 +1,27 @@
1
- import { ComponentInterface, PickOption, ALignType, Record } from '../../../type';
2
- import React from 'react';
1
+ import { ComponentInterface, PickOption, ALignType, Record } from "../../../type";
2
+ import React from "react";
3
3
  declare class BsHeaderChild implements ComponentInterface {
4
4
  name: string;
5
5
  id: string;
6
6
  sortField: string;
7
7
  type: string;
8
- componentConfig: ComponentInterface['componentConfig'];
8
+ componentConfig: ComponentInterface["componentConfig"];
9
9
  align: ALignType;
10
10
  width: number;
11
11
  isCombinationComponent: boolean;
12
12
  formField: string;
13
13
  canSort: boolean;
14
14
  children: ComponentInterface[];
15
- dataType: ComponentInterface['dataType'];
15
+ dataType: ComponentInterface["dataType"];
16
16
  transformValue: (val: any) => any;
17
+ export: (val: any) => any;
17
18
  constructor(options: PickOption);
18
19
  getParentId: () => string;
19
20
  renderClient: (record: any) => React.JSX.Element | null;
20
21
  renderPc: (value: unknown, record: Record) => React.JSX.Element;
21
22
  renderLog: (r: Record) => React.JSX.Element | null;
22
23
  getComponentValue: (r: Record) => any;
24
+ getComponentExport: (r: Record) => any;
23
25
  renderExport: (value: string, record: Record) => any;
24
26
  editRender: () => null;
25
27
  filterConfig: () => never[];
@@ -11,9 +11,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
11
11
  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; }
12
12
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
13
  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); }
14
- import React from 'react';
14
+ import React from "react";
15
15
  import ItemView from "../../../commonComponents/ItemView";
16
- import { isNull } from '@kmkf-fe-packages/kmkf-utils';
16
+ import { isNull } from "@kmkf-fe-packages/kmkf-utils";
17
17
  var BsHeaderChild = /*#__PURE__*/_createClass(function BsHeaderChild(options) {
18
18
  var _this = this;
19
19
  _classCallCheck(this, BsHeaderChild);
@@ -32,8 +32,11 @@ var BsHeaderChild = /*#__PURE__*/_createClass(function BsHeaderChild(options) {
32
32
  _defineProperty(this, "transformValue", function (val) {
33
33
  return val;
34
34
  });
35
+ _defineProperty(this, "export", function (val) {
36
+ return val;
37
+ });
35
38
  _defineProperty(this, "getParentId", function () {
36
- var _this$id$split = _this.id.split('_'),
39
+ var _this$id$split = _this.id.split("_"),
37
40
  _this$id$split2 = _slicedToArray(_this$id$split, 3),
38
41
  key = _this$id$split2[0],
39
42
  name = _this$id$split2[1],
@@ -49,7 +52,7 @@ var BsHeaderChild = /*#__PURE__*/_createClass(function BsHeaderChild(options) {
49
52
  });
50
53
  _defineProperty(this, "renderPc", function (value, record) {
51
54
  var _this$getComponentVal;
52
- return /*#__PURE__*/React.createElement("span", null, (_this$getComponentVal = _this.getComponentValue(record)) !== null && _this$getComponentVal !== void 0 ? _this$getComponentVal : '--');
55
+ return /*#__PURE__*/React.createElement("span", null, (_this$getComponentVal = _this.getComponentValue(record)) !== null && _this$getComponentVal !== void 0 ? _this$getComponentVal : "--");
53
56
  });
54
57
  _defineProperty(this, "renderLog", function (r) {
55
58
  var id = _this.getParentId();
@@ -59,10 +62,13 @@ var BsHeaderChild = /*#__PURE__*/_createClass(function BsHeaderChild(options) {
59
62
  _defineProperty(this, "getComponentValue", function (r) {
60
63
  return _this.transformValue(r === null || r === void 0 ? void 0 : r[_this.id]);
61
64
  });
65
+ _defineProperty(this, "getComponentExport", function (r) {
66
+ return _this.export(r === null || r === void 0 ? void 0 : r[_this.id]);
67
+ });
62
68
  _defineProperty(this, "renderExport", function (value, record) {
63
- var _this$getComponentVal2;
64
- var val = (_this$getComponentVal2 = _this.getComponentValue(record)) !== null && _this$getComponentVal2 !== void 0 ? _this$getComponentVal2 : '--';
65
- return typeof val === 'number' ? val + '' : val;
69
+ var _this$getComponentExp;
70
+ var val = (_this$getComponentExp = _this.getComponentExport(record)) !== null && _this$getComponentExp !== void 0 ? _this$getComponentExp : "--";
71
+ return typeof val === "number" ? val + "" : val;
66
72
  });
67
73
  _defineProperty(this, "editRender", function () {
68
74
  return null;
@@ -76,14 +82,19 @@ var BsHeaderChild = /*#__PURE__*/_createClass(function BsHeaderChild(options) {
76
82
  this.formField = options.id;
77
83
  this.type = options.type;
78
84
  this.componentConfig = options.componentConfig;
79
- this.align = 'left';
85
+ this.align = "left";
80
86
  this.width = (options === null || options === void 0 ? void 0 : options.width) || 100;
81
87
  this.isCombinationComponent = false;
82
88
  this.canSort = false;
83
- this.dataType = 'string';
89
+ this.dataType = "string";
84
90
  this.children = [];
85
91
  if (options.transformValue) {
86
92
  this.transformValue = options.transformValue;
87
93
  }
94
+ if (options.renderExport) {
95
+ this.export = options.renderExport;
96
+ }
97
+ // this.export = (options as any).renderExport;
88
98
  });
99
+
89
100
  export default BsHeaderChild;
@@ -15,6 +15,7 @@ declare class BsHeaderGods implements ComponentInterface {
15
15
  dataType: ComponentInterface["dataType"];
16
16
  itemKey: any;
17
17
  constructor(options: PickOption);
18
+ getChildren(options: PickOption): any[];
18
19
  getParentId: () => string;
19
20
  renderClient: (record: any) => React.JSX.Element | null;
20
21
  renderPc: (value: unknown, record: Record) => React.JSX.Element;
@@ -11,9 +11,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
11
11
  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; }
12
12
  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; } }
13
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
15
  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); } }
15
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
17
  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; }
18
18
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
19
19
  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); }
@@ -145,107 +145,170 @@ var HeaderMap = {
145
145
  // outerSkuId: 'SKU 编码',
146
146
  // propertiesName: 'SKU 信息',
147
147
  };
148
- var BsHeaderGods = /*#__PURE__*/_createClass(function BsHeaderGods(options) {
149
- var _this = this;
150
- _classCallCheck(this, BsHeaderGods);
151
- _defineProperty(this, "name", void 0);
152
- _defineProperty(this, "id", void 0);
153
- _defineProperty(this, "sortField", void 0);
154
- _defineProperty(this, "type", void 0);
155
- _defineProperty(this, "componentConfig", void 0);
156
- _defineProperty(this, "align", void 0);
157
- _defineProperty(this, "width", void 0);
158
- _defineProperty(this, "isCombinationComponent", void 0);
159
- _defineProperty(this, "formField", void 0);
160
- _defineProperty(this, "canSort", void 0);
161
- _defineProperty(this, "children", void 0);
162
- _defineProperty(this, "dataType", void 0);
163
- _defineProperty(this, "itemKey", void 0);
164
- _defineProperty(this, "getParentId", function () {
165
- var _this$id$split = _this.id.split("_"),
166
- _this$id$split2 = _slicedToArray(_this$id$split, 3),
167
- key = _this$id$split2[0],
168
- name = _this$id$split2[1],
169
- code = _this$id$split2[2];
170
- return "".concat(key, "_").concat(name);
171
- });
172
- _defineProperty(this, "renderClient", function (record) {
173
- return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
174
- id: _this.id,
175
- label: _this.name,
176
- value: _this.getComponentValue(record)
177
- }) : null;
178
- });
179
- _defineProperty(this, "renderPc", function (value, record) {
180
- var _this$getComponentVal;
181
- return /*#__PURE__*/React.createElement("span", null, (_this$getComponentVal = _this.getComponentValue(record)) !== null && _this$getComponentVal !== void 0 ? _this$getComponentVal : "--");
182
- });
183
- _defineProperty(this, "renderLog", function (r) {
184
- var id = _this.getParentId();
185
- if (isNull(r === null || r === void 0 ? void 0 : r[id])) return null;
186
- return _this.renderPc(undefined, r);
187
- });
188
- _defineProperty(this, "getComponentValue", function (r) {
189
- var id = _this.getParentId();
190
- var list = ((r === null || r === void 0 ? void 0 : r[id]) || []).reduce(function (prv, next) {
191
- next["money"] && prv.push(next["money"]);
192
- return prv;
193
- }, []);
194
- return list.join(",");
195
- });
196
- _defineProperty(this, "renderExport", function (value, record) {
197
- var _this$getComponentVal2;
198
- return (_this$getComponentVal2 = _this.getComponentValue(record)) !== null && _this$getComponentVal2 !== void 0 ? _this$getComponentVal2 : "--";
199
- });
200
- _defineProperty(this, "editRender", function () {
201
- return null;
202
- });
203
- _defineProperty(this, "filterConfig", function () {
204
- return [];
205
- });
206
- this.name = options.name;
207
- this.id = options.id;
208
- this.sortField = options.id;
209
- this.formField = options.id;
210
- this.type = options.type;
211
- this.componentConfig = options.componentConfig;
212
- this.align = "left";
213
- this.width = 200;
214
- this.isCombinationComponent = true;
215
- this.canSort = false;
216
- this.dataType = "string";
217
- this.itemKey = options.type === 'ITEM_ENCODE' ? {
218
- title: '商品名称',
219
- outerId: '商品编码',
220
- picUrl: '图片',
221
- numIid: '商品id',
222
- skuId: 'SKU ID',
223
- outerSkuId: 'SKU 编码',
224
- propertiesName: 'SKU 信息'
225
- } : {
226
- mark: "商品标记",
227
- pic: "图片",
228
- name: "名称",
229
- code: "编码",
230
- sku: "sku编码",
231
- skuName: "sku名称",
232
- money: "实付金额",
233
- number: "数量",
234
- share: "分摊价",
235
- type: "赠品类型",
236
- batch: "批次号",
237
- expireDate: "有效期"
238
- };
239
- this.children = _toConsumableArray(Object.keys(HeaderMap).reduce(function (prv, key) {
240
- var _options$componentCon, _options$componentCon2;
241
- if (options !== null && options !== void 0 && (_options$componentCon = options.componentConfig) !== null && _options$componentCon !== void 0 && (_options$componentCon2 = _options$componentCon.showHeader) !== null && _options$componentCon2 !== void 0 && _options$componentCon2.includes(key)) {
242
- prv.push(new HeaderMap[key].component(_objectSpread(_objectSpread({}, options), {}, {
243
- name: _this.itemKey[key],
244
- id: "".concat(options.id, "_").concat(HeaderMap[key].key),
245
- width: HeaderMap[key].width
246
- })));
148
+ var BsHeaderGods = /*#__PURE__*/function () {
149
+ function BsHeaderGods(options) {
150
+ var _this = this;
151
+ _classCallCheck(this, BsHeaderGods);
152
+ _defineProperty(this, "name", void 0);
153
+ _defineProperty(this, "id", void 0);
154
+ _defineProperty(this, "sortField", void 0);
155
+ _defineProperty(this, "type", void 0);
156
+ _defineProperty(this, "componentConfig", void 0);
157
+ _defineProperty(this, "align", void 0);
158
+ _defineProperty(this, "width", void 0);
159
+ _defineProperty(this, "isCombinationComponent", void 0);
160
+ _defineProperty(this, "formField", void 0);
161
+ _defineProperty(this, "canSort", void 0);
162
+ _defineProperty(this, "children", void 0);
163
+ _defineProperty(this, "dataType", void 0);
164
+ _defineProperty(this, "itemKey", void 0);
165
+ _defineProperty(this, "getParentId", function () {
166
+ var _this$id$split = _this.id.split("_"),
167
+ _this$id$split2 = _slicedToArray(_this$id$split, 3),
168
+ key = _this$id$split2[0],
169
+ name = _this$id$split2[1],
170
+ code = _this$id$split2[2];
171
+ return "".concat(key, "_").concat(name);
172
+ });
173
+ _defineProperty(this, "renderClient", function (record) {
174
+ return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
175
+ id: _this.id,
176
+ label: _this.name,
177
+ value: _this.getComponentValue(record)
178
+ }) : null;
179
+ });
180
+ _defineProperty(this, "renderPc", function (value, record) {
181
+ var _this$getComponentVal;
182
+ return /*#__PURE__*/React.createElement("span", null, (_this$getComponentVal = _this.getComponentValue(record)) !== null && _this$getComponentVal !== void 0 ? _this$getComponentVal : "--");
183
+ });
184
+ _defineProperty(this, "renderLog", function (r) {
185
+ var id = _this.getParentId();
186
+ if (isNull(r === null || r === void 0 ? void 0 : r[id])) return null;
187
+ return _this.renderPc(undefined, r);
188
+ });
189
+ _defineProperty(this, "getComponentValue", function (r) {
190
+ var id = _this.getParentId();
191
+ var list = ((r === null || r === void 0 ? void 0 : r[id]) || []).reduce(function (prv, next) {
192
+ next["money"] && prv.push(next["money"]);
193
+ return prv;
194
+ }, []);
195
+ return list.join(",");
196
+ });
197
+ _defineProperty(this, "renderExport", function (value, record) {
198
+ var _this$getComponentVal2;
199
+ return (_this$getComponentVal2 = _this.getComponentValue(record)) !== null && _this$getComponentVal2 !== void 0 ? _this$getComponentVal2 : "--";
200
+ });
201
+ _defineProperty(this, "editRender", function () {
202
+ return null;
203
+ });
204
+ _defineProperty(this, "filterConfig", function () {
205
+ return [];
206
+ });
207
+ this.name = options.name;
208
+ this.id = options.id;
209
+ this.sortField = options.id;
210
+ this.formField = options.id;
211
+ this.type = options.type;
212
+ this.componentConfig = options.componentConfig;
213
+ this.align = "left";
214
+ this.width = 200;
215
+ this.isCombinationComponent = true;
216
+ this.canSort = false;
217
+ this.dataType = "string";
218
+ this.itemKey = options.type === "ITEM_ENCODE" ? {
219
+ title: "商品名称",
220
+ outerId: "商品编码",
221
+ picUrl: "图片",
222
+ numIid: "商品id",
223
+ skuId: "SKU ID",
224
+ outerSkuId: "SKU 编码",
225
+ propertiesName: "SKU 信息"
226
+ } : {
227
+ mark: "商品标记",
228
+ pic: "图片",
229
+ name: "名称",
230
+ code: "编码",
231
+ sku: "sku编码",
232
+ skuName: "sku名称",
233
+ money: "实付金额",
234
+ number: "数量",
235
+ share: "分摊价",
236
+ type: "赠品类型",
237
+ batch: "批次号",
238
+ expireDate: "有效期"
239
+ };
240
+ this.children = this.getChildren(options);
241
+ // [
242
+ // ...Object.keys(HeaderMap).reduce((prv: any, key: string) => {
243
+ // if (options?.componentConfig?.showHeader?.includes(key)) {
244
+ // prv.push(
245
+ // new HeaderMap[key].component({
246
+ // ...options,
247
+ // name: this.itemKey[key],
248
+ // id: `${options.id}_${HeaderMap[key].key}`,
249
+ // width: HeaderMap[key].width,
250
+ // })
251
+ // );
252
+ // }
253
+ // return prv;
254
+ // }, []),
255
+ // ...(options?.componentConfig?.showHeader || []).reduce(
256
+ // (prv: any, next: string) => {
257
+ // if (HeaderMap[next]) {
258
+ // prv.push(
259
+ // new HeaderMap[next].component({
260
+ // ...options,
261
+ // name: this.itemKey[next],
262
+ // id: `${options.id}_${HeaderMap[next].key}`,
263
+ // })
264
+ // );
265
+ // }
266
+ // return prv;
267
+ // },
268
+ // []
269
+ // ),
270
+ // ];
271
+ }
272
+ _createClass(BsHeaderGods, [{
273
+ key: "getChildren",
274
+ value: function getChildren(options) {
275
+ var _options$componentCon,
276
+ _this2 = this;
277
+ var showHeader = options === null || options === void 0 ? void 0 : (_options$componentCon = options.componentConfig) === null || _options$componentCon === void 0 ? void 0 : _options$componentCon.showHeader;
278
+ var isStringArray = Array.isArray(showHeader) && typeof showHeader[0] === "string";
279
+ var isObjectArray = Array.isArray(showHeader) && Object.prototype.toString.call(showHeader[0]) === "[object Object]";
280
+ var dataIndexList = [];
281
+ if (isStringArray) {
282
+ dataIndexList = showHeader;
283
+ } else if (isObjectArray) {
284
+ dataIndexList = showHeader.map(function (item) {
285
+ return item.dataIndex;
286
+ });
287
+ }
288
+ var getKeyIndex = function getKeyIndex(id) {
289
+ return dataIndexList.indexOf(id.split("_").pop() || "");
290
+ };
291
+ var list = _toConsumableArray(Object.keys(HeaderMap).reduce(function (prv, key) {
292
+ if (Array.isArray(showHeader) && (isStringArray && showHeader.includes(key) || isObjectArray && showHeader.filter(function (item) {
293
+ return item.show !== false;
294
+ }).map(function (item) {
295
+ return item.dataIndex;
296
+ }).includes(key))) {
297
+ prv.push(new HeaderMap[key].component(_objectSpread(_objectSpread({}, options), {}, {
298
+ name: _this2.itemKey[key],
299
+ id: "".concat(options.id, "_").concat(HeaderMap[key].key),
300
+ width: HeaderMap[key].width
301
+ })));
302
+ }
303
+ return prv;
304
+ }, []).sort(function (a, b) {
305
+ if (Array.isArray(showHeader)) {
306
+ return getKeyIndex(a.id) - getKeyIndex(b.id);
307
+ }
308
+ }));
309
+ return list;
247
310
  }
248
- return prv;
249
- }, []));
250
- });
311
+ }]);
312
+ return BsHeaderGods;
313
+ }();
251
314
  export default BsHeaderGods;