@kmkf-fe-packages/services-components 2.10.30 → 2.11.1

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.
@@ -205,9 +205,7 @@ var GyReissue = /*#__PURE__*/_createClass(function GyReissue(options) {
205
205
  required: isRequired,
206
206
  validator: function validator(_rule, value) {
207
207
  var _typeMap$options$type7, _typeMap$options$type8;
208
- return ((_typeMap$options$type7 = typeMap[options.type]) === null || _typeMap$options$type7 === void 0 ? void 0 : (_typeMap$options$type8 = _typeMap$options$type7.validator) === null || _typeMap$options$type8 === void 0 ? void 0 : _typeMap$options$type8.call(_typeMap$options$type7, _rule, value, options.type)) || function () {
209
- return Promise.resolve();
210
- };
208
+ return ((_typeMap$options$type7 = typeMap[options.type]) === null || _typeMap$options$type7 === void 0 ? void 0 : (_typeMap$options$type8 = _typeMap$options$type7.validator) === null || _typeMap$options$type8 === void 0 ? void 0 : _typeMap$options$type8.call(_typeMap$options$type7, _rule, value, options.type)) || Promise.resolve();
211
209
  }
212
210
  }];
213
211
  this.dataType = "object";
@@ -197,9 +197,7 @@ var GyReturn = /*#__PURE__*/_createClass(function GyReturn(options) {
197
197
  required: isRequired,
198
198
  validator: function validator(_rule, value) {
199
199
  var _typeMap$options$type6, _typeMap$options$type7;
200
- return ((_typeMap$options$type6 = typeMap[options.type]) === null || _typeMap$options$type6 === void 0 ? void 0 : (_typeMap$options$type7 = _typeMap$options$type6.validator) === null || _typeMap$options$type7 === void 0 ? void 0 : _typeMap$options$type7.call(_typeMap$options$type6, _rule, value, options.type)) || function () {
201
- return Promise.resolve();
202
- };
200
+ return ((_typeMap$options$type6 = typeMap[options.type]) === null || _typeMap$options$type6 === void 0 ? void 0 : (_typeMap$options$type7 = _typeMap$options$type6.validator) === null || _typeMap$options$type7 === void 0 ? void 0 : _typeMap$options$type7.call(_typeMap$options$type6, _rule, value, options.type)) || Promise.resolve();
203
201
  }
204
202
  }];
205
203
  this.dataType = "object";
@@ -21,7 +21,7 @@ declare class MsgStatus implements ComponentInterface {
21
21
  renderPc: (value: any, record: Record) => React.JSX.Element;
22
22
  renderLog: (r: Record) => React.JSX.Element | null;
23
23
  getComponentValue: (r: Record) => any;
24
- renderExport: (value: any, record: any) => any;
24
+ renderExport: (value: any, record: any) => string;
25
25
  editRender: (p: any) => React.JSX.Element;
26
26
  filterConfig: (item: ColumnConfig) => {
27
27
  searchDefaultConditions: "in";
@@ -16,6 +16,7 @@ import { MsgStatus as Status } from "@kmkf-fe-packages/basic-components";
16
16
  import ItemView from "../../commonComponents/ItemView";
17
17
  import { isNull, filterFn as _filterFn, msgTypeCh } from "@kmkf-fe-packages/kmkf-utils";
18
18
  import { SYMBOL } from "../../constant";
19
+ import { isString } from "lodash";
19
20
  var typeMap = {
20
21
  MSG_STATUS: {
21
22
  options: [{
@@ -119,18 +120,24 @@ var MsgStatus = /*#__PURE__*/_createClass(function MsgStatus(options) {
119
120
  return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_").concat((_typeMap$_this$type9 = typeMap[_this.type]) === null || _typeMap$_this$type9 === void 0 ? void 0 : _typeMap$_this$type9.key)];
120
121
  });
121
122
  _defineProperty(this, "renderExport", function (value, record) {
122
- var _typeMap$_this$type10;
123
- var list = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat((_typeMap$_this$type10 = typeMap[_this.type]) === null || _typeMap$_this$type10 === void 0 ? void 0 : _typeMap$_this$type10.key)];
124
- return (list || []).map(function (item) {
125
- var _typeMap$_this$type11, _typeMap$_this$type12, _typeMap$_this$type13, _typeMap$_this$type15;
126
- var currentOption = (_typeMap$_this$type11 = typeMap[_this.type]) === null || _typeMap$_this$type11 === void 0 ? void 0 : (_typeMap$_this$type12 = _typeMap$_this$type11.options) === null || _typeMap$_this$type12 === void 0 ? void 0 : (_typeMap$_this$type13 = _typeMap$_this$type12.find) === null || _typeMap$_this$type13 === void 0 ? void 0 : _typeMap$_this$type13.call(_typeMap$_this$type12, function (option) {
127
- var _typeMap$_this$type14;
128
- return item[(_typeMap$_this$type14 = typeMap[_this.type]) === null || _typeMap$_this$type14 === void 0 ? void 0 : _typeMap$_this$type14.valueKey] === option.value;
129
- });
130
- var key = item.msgType || "ding";
131
- var statusMsg = "".concat(msgTypeCh[key]).concat(item.ruleName ? "-".concat(item.ruleName) : "", ":").concat(currentOption ? (currentOption === null || currentOption === void 0 ? void 0 : currentOption.label) || "" : (item === null || item === void 0 ? void 0 : item[(_typeMap$_this$type15 = typeMap[_this.type]) === null || _typeMap$_this$type15 === void 0 ? void 0 : _typeMap$_this$type15.valueKey]) || "");
132
- return item.failReason ? "".concat(statusMsg, "\uFF0C\u5931\u8D25\u539F\u56E0\uFF1A").concat(item.failReason) : statusMsg;
133
- }).join(",");
123
+ var _record, _typeMap$_this$type10;
124
+ var list = (_record = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat((_typeMap$_this$type10 = typeMap[_this.type]) === null || _typeMap$_this$type10 === void 0 ? void 0 : _typeMap$_this$type10.key)]) !== null && _record !== void 0 ? _record : [];
125
+ if (Array.isArray(list)) {
126
+ return list.map(function (item) {
127
+ var _typeMap$_this$type11, _typeMap$_this$type12, _typeMap$_this$type13, _typeMap$_this$type15;
128
+ var currentOption = (_typeMap$_this$type11 = typeMap[_this.type]) === null || _typeMap$_this$type11 === void 0 ? void 0 : (_typeMap$_this$type12 = _typeMap$_this$type11.options) === null || _typeMap$_this$type12 === void 0 ? void 0 : (_typeMap$_this$type13 = _typeMap$_this$type12.find) === null || _typeMap$_this$type13 === void 0 ? void 0 : _typeMap$_this$type13.call(_typeMap$_this$type12, function (option) {
129
+ var _typeMap$_this$type14;
130
+ return item[(_typeMap$_this$type14 = typeMap[_this.type]) === null || _typeMap$_this$type14 === void 0 ? void 0 : _typeMap$_this$type14.valueKey] === option.value;
131
+ });
132
+ var key = item.msgType || "ding";
133
+ var statusMsg = "".concat(msgTypeCh[key]).concat(item.ruleName ? "-".concat(item.ruleName) : "", ":").concat(currentOption ? (currentOption === null || currentOption === void 0 ? void 0 : currentOption.label) || "" : (item === null || item === void 0 ? void 0 : item[(_typeMap$_this$type15 = typeMap[_this.type]) === null || _typeMap$_this$type15 === void 0 ? void 0 : _typeMap$_this$type15.valueKey]) || "");
134
+ return item.failReason ? "".concat(statusMsg, "\uFF0C\u5931\u8D25\u539F\u56E0\uFF1A").concat(item.failReason) : statusMsg;
135
+ }).join(",");
136
+ }
137
+ if (isString(list)) {
138
+ return list;
139
+ }
140
+ return '';
134
141
  });
135
142
  _defineProperty(this, "editRender", function (p) {
136
143
  var _this$componentConfig, _this$componentConfig2, _this$componentConfig3, _this$componentConfig4, _typeMap$_this$type16;
@@ -1,7 +1,7 @@
1
- import { ComponentInterface, PickOption, ColumnConfig, Record } from '../../../type';
2
- import React from 'react';
3
- import CommonHeaderGoods from '../../CommonHeaderGood';
4
- import type { FormInstance } from 'antd';
1
+ import { ComponentInterface, PickOption, ColumnConfig, Record } from "../../../type";
2
+ import React from "react";
3
+ import CommonHeaderGoods from "../../CommonHeaderGood";
4
+ import type { FormInstance } from "antd";
5
5
  declare type ConfigType = {
6
6
  goodsKey: string;
7
7
  validator: any;
@@ -12,14 +12,14 @@ declare class Exchange implements ComponentInterface {
12
12
  sortField: string;
13
13
  type: string;
14
14
  rules: any[];
15
- componentConfig: ComponentInterface['componentConfig'];
16
- effects: ComponentInterface['effects'];
15
+ componentConfig: ComponentInterface["componentConfig"];
16
+ effects: ComponentInterface["effects"];
17
17
  isCombinationComponent: boolean;
18
18
  formField: string;
19
19
  canSort: boolean;
20
20
  children: ComponentInterface[];
21
- dataType: ComponentInterface['dataType'];
22
- sortChildField: NonNullable<ComponentInterface['sortChildField']>;
21
+ dataType: ComponentInterface["dataType"];
22
+ sortChildField: NonNullable<ComponentInterface["sortChildField"]>;
23
23
  returnGoods: CommonHeaderGoods;
24
24
  config: ConfigType;
25
25
  form?: FormInstance;
@@ -8,29 +8,29 @@ 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 { BsGoodsTable } from "../../Common";
14
14
  import ItemView from "../../../commonComponents/ItemView";
15
- import { isNull } from '@kmkf-fe-packages/kmkf-utils';
15
+ import { isNull } from "@kmkf-fe-packages/kmkf-utils";
16
16
  import { SYMBOL } from "../../../constant";
17
17
  // import { BsType, BsMemo } from "../../Bs/common";
18
- import { CommonExchangeGoods } from '@kmkf-fe-packages/basic-components';
18
+ import { CommonExchangeGoods } from "@kmkf-fe-packages/basic-components";
19
19
  import CommonHeaderGoods from "../../CommonHeaderGood";
20
20
  import { erpFormValidator } from "@kmkf-fe-packages/basic-components";
21
21
  import { getGoodsSortChildFields } from "../../Common/constants/columnsBaseInfoMap";
22
22
  function toNum(value) {
23
- if (typeof value === 'string') {
23
+ if (typeof value === "string") {
24
24
  return value ? +value : void 0;
25
25
  }
26
- if (typeof value === 'number') {
26
+ if (typeof value === "number") {
27
27
  return value;
28
28
  }
29
29
  return void 0;
30
30
  }
31
31
  var CONF_MAP = {
32
32
  JST_EXCHANGE_GOODS: {
33
- goodsKey: 'jstExchangeGoods',
33
+ goodsKey: "jstExchangeGoods",
34
34
  validator: function validator(_rule, value, type) {
35
35
  if (!_rule.required) return Promise.resolve();
36
36
  var validatorFlag = erpFormValidator(_rule, value, type);
@@ -68,7 +68,7 @@ var Exchange = /*#__PURE__*/_createClass(function Exchange(options) {
68
68
  });
69
69
  _defineProperty(this, "renderClient", function (record) {
70
70
  var _this$componentConfig;
71
- var exchangeGoods = JSON.parse((record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(_this.config.goodsKey)]) || '[]');
71
+ var exchangeGoods = JSON.parse((record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(_this.config.goodsKey)]) || "[]");
72
72
  return !isNull(record === null || record === void 0 ? void 0 : record["".concat(_this.id)]) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ItemView, {
73
73
  id: "".concat(_this.id, "-out"),
74
74
  label: "".concat(_this.name, "-\u6362\u51FA"),
@@ -105,7 +105,7 @@ var Exchange = /*#__PURE__*/_createClass(function Exchange(options) {
105
105
  required: false,
106
106
  hidden: p === null || p === void 0 ? void 0 : p.hidden,
107
107
  display: p === null || p === void 0 ? void 0 : p.display,
108
- 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 : '',
108
+ 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 : "",
109
109
  component: /*#__PURE__*/React.createElement(CommonExchangeGoods, _extends({}, _this.componentConfig, {
110
110
  maxLength: ((_this$componentConfig5 = _this.componentConfig) === null || _this$componentConfig5 === void 0 ? void 0 : _this$componentConfig5.maxLength) || 20,
111
111
  shopId: (_this$effects = _this.effects) === null || _this$effects === void 0 ? void 0 : _this$effects.shopId,
@@ -123,7 +123,7 @@ var Exchange = /*#__PURE__*/_createClass(function Exchange(options) {
123
123
  type: item.type,
124
124
  id: "".concat(item.id, "_").concat(_this.config.goodsKey),
125
125
  name: "".concat(_this.name, "-\u6362\u51FA"),
126
- filterComponentType: 'Input'
126
+ filterComponentType: "Input"
127
127
  }];
128
128
  });
129
129
  this.name = options.name;
@@ -138,7 +138,7 @@ var Exchange = /*#__PURE__*/_createClass(function Exchange(options) {
138
138
  this.form = (_options$effects = options.effects) === null || _options$effects === void 0 ? void 0 : _options$effects.form;
139
139
  this.returnGoods = new CommonHeaderGoods(_objectSpread(_objectSpread({}, options), {}, {
140
140
  id: "".concat(options.id, "_").concat(this.config.goodsKey),
141
- name: '商品信息'
141
+ name: "商品信息"
142
142
  }));
143
143
  this.children = [this.returnGoods];
144
144
  this.componentConfig = options === null || options === void 0 ? void 0 : options.componentConfig;
@@ -147,7 +147,7 @@ var Exchange = /*#__PURE__*/_createClass(function Exchange(options) {
147
147
  validator: function validator(_, value) {
148
148
  var _this$componentConfig7, _value$_this$config$g;
149
149
  if ((_this$componentConfig7 = _this.componentConfig) !== null && _this$componentConfig7 !== void 0 && _this$componentConfig7.required && !(value !== null && value !== void 0 && (_value$_this$config$g = value[_this.config.goodsKey]) !== null && _value$_this$config$g !== void 0 && _value$_this$config$g.length)) {
150
- return Promise.reject(new Error('请选择换货商品'));
150
+ return Promise.reject(new Error("请选择换货商品"));
151
151
  }
152
152
  return Promise.resolve();
153
153
  }
@@ -155,12 +155,10 @@ var Exchange = /*#__PURE__*/_createClass(function Exchange(options) {
155
155
  required: (_this$componentConfig8 = this.componentConfig) === null || _this$componentConfig8 === void 0 ? void 0 : _this$componentConfig8.required,
156
156
  validator: function validator(_rule, value) {
157
157
  var _CONF_MAP$options$typ, _CONF_MAP$options$typ2;
158
- return ((_CONF_MAP$options$typ = CONF_MAP[options.type]) === null || _CONF_MAP$options$typ === void 0 ? void 0 : (_CONF_MAP$options$typ2 = _CONF_MAP$options$typ.validator) === null || _CONF_MAP$options$typ2 === void 0 ? void 0 : _CONF_MAP$options$typ2.call(_CONF_MAP$options$typ, _rule, value, options.type, _this.componentConfig)) || function () {
159
- return Promise.resolve();
160
- };
158
+ return ((_CONF_MAP$options$typ = CONF_MAP[options.type]) === null || _CONF_MAP$options$typ === void 0 ? void 0 : (_CONF_MAP$options$typ2 = _CONF_MAP$options$typ.validator) === null || _CONF_MAP$options$typ2 === void 0 ? void 0 : _CONF_MAP$options$typ2.call(_CONF_MAP$options$typ, _rule, value, options.type, _this.componentConfig)) || Promise.resolve();
161
159
  }
162
160
  }];
163
- this.dataType = 'object';
161
+ this.dataType = "object";
164
162
  this.sortChildField = this.getSortChildFields();
165
163
  });
166
164
  export default Exchange;
@@ -163,17 +163,24 @@ var PublicGoods = /*#__PURE__*/_createClass(function PublicGoods(options) {
163
163
  }));
164
164
  this.children = [this.headers];
165
165
  this.componentConfig = options === null || options === void 0 ? void 0 : options.componentConfig;
166
- this.rules = this !== null && this !== void 0 && (_this$componentConfig6 = this.componentConfig) !== null && _this$componentConfig6 !== void 0 && _this$componentConfig6.required ? [{
167
- required: true,
166
+ var isRequired = !!(this !== null && this !== void 0 && (_this$componentConfig6 = this.componentConfig) !== null && _this$componentConfig6 !== void 0 && _this$componentConfig6.required);
167
+ this.rules = [{
168
+ required: isRequired,
168
169
  validator: function validator(_, value) {
169
170
  var _value$key;
170
- if (!value || !(value !== null && value !== void 0 && (_value$key = value[key]) !== null && _value$key !== void 0 && _value$key.length)) {
171
+ if (isRequired && (!value || !(value !== null && value !== void 0 && (_value$key = value[key]) !== null && _value$key !== void 0 && _value$key.length))) {
171
172
  var _CONFIG_MAP$_this$typ6;
172
173
  return Promise.reject(new Error("\u8BF7\u9009\u62E9".concat((_CONFIG_MAP$_this$typ6 = CONFIG_MAP[_this.type]) === null || _CONFIG_MAP$_this$typ6 === void 0 ? void 0 : _CONFIG_MAP$_this$typ6.name, "\u5546\u54C1")));
173
174
  }
174
175
  return Promise.resolve();
175
176
  }
176
- }] : [];
177
+ }, {
178
+ required: isRequired,
179
+ validator: function validator(_rule, value) {
180
+ var _CONFIG_MAP$_this$typ7, _CONFIG_MAP$_this$typ8;
181
+ return ((_CONFIG_MAP$_this$typ7 = CONFIG_MAP[_this.type]) === null || _CONFIG_MAP$_this$typ7 === void 0 ? void 0 : (_CONFIG_MAP$_this$typ8 = _CONFIG_MAP$_this$typ7.validator) === null || _CONFIG_MAP$_this$typ8 === void 0 ? void 0 : _CONFIG_MAP$_this$typ8.call(_CONFIG_MAP$_this$typ7, _rule, value, _this.type, _this.componentConfig)) || Promise.resolve();
182
+ }
183
+ }];
177
184
  this.dataType = "object";
178
185
  this.sortChildField = this.getSortChildFields();
179
186
  this.exampleValue = ((_CONFIG_MAP$this$type2 = CONFIG_MAP[this.type]) === null || _CONFIG_MAP$this$type2 === void 0 ? void 0 : _CONFIG_MAP$this$type2.exampleValue) || "";
@@ -330,9 +330,7 @@ var PublicReissue = /*#__PURE__*/_createClass(function PublicReissue(options) {
330
330
  required: isRequired,
331
331
  validator: function validator(_rule, value) {
332
332
  var _typeMap$options$type14, _typeMap$options$type15;
333
- return ((_typeMap$options$type14 = typeMap[options.type]) === null || _typeMap$options$type14 === void 0 ? void 0 : (_typeMap$options$type15 = _typeMap$options$type14.validator) === null || _typeMap$options$type15 === void 0 ? void 0 : _typeMap$options$type15.call(_typeMap$options$type14, _rule, value, options.type, _this.componentConfig)) || function () {
334
- return Promise.resolve();
335
- };
333
+ return ((_typeMap$options$type14 = typeMap[options.type]) === null || _typeMap$options$type14 === void 0 ? void 0 : (_typeMap$options$type15 = _typeMap$options$type14.validator) === null || _typeMap$options$type15 === void 0 ? void 0 : _typeMap$options$type15.call(_typeMap$options$type14, _rule, value, options.type, _this.componentConfig)) || Promise.resolve();
336
334
  }
337
335
  }];
338
336
  this.dataType = "object";
@@ -207,9 +207,7 @@ var WdtReissue = /*#__PURE__*/_createClass(function WdtReissue(options) {
207
207
  required: isRequired,
208
208
  validator: function validator(_rule, value) {
209
209
  var _typeMap$options$type9, _typeMap$options$type10;
210
- return ((_typeMap$options$type9 = typeMap[options.type]) === null || _typeMap$options$type9 === void 0 ? void 0 : (_typeMap$options$type10 = _typeMap$options$type9.validator) === null || _typeMap$options$type10 === void 0 ? void 0 : _typeMap$options$type10.call(_typeMap$options$type9, _rule, value, options.type)) || function () {
211
- return Promise.resolve();
212
- };
210
+ return ((_typeMap$options$type9 = typeMap[options.type]) === null || _typeMap$options$type9 === void 0 ? void 0 : (_typeMap$options$type10 = _typeMap$options$type9.validator) === null || _typeMap$options$type10 === void 0 ? void 0 : _typeMap$options$type10.call(_typeMap$options$type9, _rule, value, options.type)) || Promise.resolve();
213
211
  }
214
212
  }];
215
213
  this.dataType = "object";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "2.10.30",
3
+ "version": "2.11.1",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -21,8 +21,8 @@
21
21
  ]
22
22
  },
23
23
  "dependencies": {
24
- "@kmkf-fe-packages/basic-components": "2.10.30",
25
- "@kmkf-fe-packages/kmkf-utils": "2.10.30",
24
+ "@kmkf-fe-packages/basic-components": "2.11.1",
25
+ "@kmkf-fe-packages/kmkf-utils": "2.11.1",
26
26
  "b64-to-blob": "^1.2.19",
27
27
  "html2canvas": "^1.4.1",
28
28
  "react-pdf-js": "^5.1.0"
@@ -41,7 +41,7 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "ea173c9a55b9b65711d6605fe5aa28d751b523b8",
44
+ "gitHead": "3f2986bf8a306c1778d357bbbea27f6bb1e7e39e",
45
45
  "gitHooks": {
46
46
  "pre-commit": "lint-staged"
47
47
  }