@kmkf-fe-packages/services-components 2.10.9-beta.25 → 2.10.9-beta.27

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.
@@ -31,7 +31,7 @@ declare class BasicPosting implements ComponentInterface {
31
31
  sortColumns: SortColumnsField;
32
32
  headerProvince: boolean;
33
33
  constructor(options: PickOption);
34
- getChildren: () => (City | Detail | District | Province | ReceiverMobile | ReceiverName | undefined)[];
34
+ getChildren: () => (Province | City | District | Detail | ReceiverName | ReceiverMobile | undefined)[];
35
35
  getSortColumns: (sortColumns: string | undefined) => SortColumnsField;
36
36
  renderPc: (value: any, record: Record) => React.JSX.Element | null;
37
37
  renderLog: (r: Record) => React.JSX.Element | null;
@@ -17,9 +17,12 @@ declare class ERemark implements ComponentInterface {
17
17
  formField: string;
18
18
  canSort: boolean;
19
19
  children: ComponentInterface[];
20
+ effects: ComponentInterface['effects'];
20
21
  dataType: ComponentInterface['dataType'];
21
22
  constructor(options: PickOption);
22
- render: (value: Value) => React.JSX.Element;
23
+ getShop: (record?: Record) => any;
24
+ isYouzan: (record?: Record) => boolean;
25
+ render: (value: Value, isYouzan?: boolean) => React.JSX.Element;
23
26
  renderClient: (record: Record) => React.JSX.Element | null;
24
27
  renderPc: (value: unknown, record: Record) => React.JSX.Element;
25
28
  renderLog: (r: Record) => React.JSX.Element | null;
@@ -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"); } }
@@ -6,7 +7,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
6
7
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
8
  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); }
8
9
  import React from 'react';
9
- import { Remark } from '@kmkf-fe-packages/basic-components';
10
+ import { Remark, YouzanStar } from '@kmkf-fe-packages/basic-components';
10
11
  import GetFormItem from "../GetFormItem";
11
12
  import trade0 from "./flag/trade-icon-flag-0.png";
12
13
  import trade1 from "./flag/trade-icon-flag-1.png";
@@ -16,7 +17,7 @@ import trade4 from "./flag/trade-icon-flag-4.png";
16
17
  import trade5 from "./flag/trade-icon-flag-5.png";
17
18
  import get from 'lodash/get';
18
19
  import ItemView from "../../commonComponents/ItemView";
19
- import { isNull, filterFn as _filterFn } from '@kmkf-fe-packages/kmkf-utils';
20
+ import { isNull, filterFn as _filterFn, isYouzanShop, normalizeYouzanStar } from '@kmkf-fe-packages/kmkf-utils';
20
21
  import { SYMBOL, batchInput, SEARCH_OPTIONS } from "../../constant";
21
22
  var ERemark = /*#__PURE__*/_createClass(function ERemark(options) {
22
23
  var _this = this,
@@ -34,14 +35,30 @@ var ERemark = /*#__PURE__*/_createClass(function ERemark(options) {
34
35
  _defineProperty(this, "formField", void 0);
35
36
  _defineProperty(this, "canSort", void 0);
36
37
  _defineProperty(this, "children", void 0);
38
+ _defineProperty(this, "effects", void 0);
37
39
  _defineProperty(this, "dataType", void 0);
40
+ _defineProperty(this, "getShop", function (record) {
41
+ var _this$effects, _this$effects2, _this$effects2$form, _this$effects3, _this$effects3$shopLi;
42
+ var shopId = (record === null || record === void 0 ? void 0 : record.shopId) || ((_this$effects = _this.effects) === null || _this$effects === void 0 ? void 0 : _this$effects.shopId) || ((_this$effects2 = _this.effects) === null || _this$effects2 === void 0 ? void 0 : (_this$effects2$form = _this$effects2.form) === null || _this$effects2$form === void 0 ? void 0 : _this$effects2$form.getFieldValue('shopId'));
43
+ return (_this$effects3 = _this.effects) === null || _this$effects3 === void 0 ? void 0 : (_this$effects3$shopLi = _this$effects3.shopList) === null || _this$effects3$shopLi === void 0 ? void 0 : _this$effects3$shopLi.find(function (shop) {
44
+ return shop.shopId === shopId;
45
+ });
46
+ });
47
+ _defineProperty(this, "isYouzan", function (record) {
48
+ return isYouzanShop(_this.getShop(record));
49
+ });
38
50
  _defineProperty(this, "render", function (value) {
51
+ var isYouzan = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
39
52
  var index = get(value, 'flag');
40
53
  return /*#__PURE__*/React.createElement("div", {
41
54
  style: {
42
55
  display: 'inline-block'
43
56
  }
44
- }, index !== undefined && /*#__PURE__*/React.createElement("img", {
57
+ }, isYouzan ? normalizeYouzanStar(index) ? /*#__PURE__*/React.createElement(YouzanStar, {
58
+ compact: true,
59
+ disabled: true,
60
+ value: index
61
+ }) : null : index !== undefined && /*#__PURE__*/React.createElement("img", {
45
62
  src: _this.imgList[Number(index)]
46
63
  }), /*#__PURE__*/React.createElement("span", null, get(value, 'remark')));
47
64
  });
@@ -49,7 +66,7 @@ var ERemark = /*#__PURE__*/_createClass(function ERemark(options) {
49
66
  return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
50
67
  id: _this.id,
51
68
  label: _this.name,
52
- value: _this.render(record === null || record === void 0 ? void 0 : record[_this.id])
69
+ value: _this.render(record === null || record === void 0 ? void 0 : record[_this.id], _this.isYouzan(record))
53
70
  }) : null;
54
71
  });
55
72
  _defineProperty(this, "renderPc", function (value, record) {
@@ -57,11 +74,16 @@ var ERemark = /*#__PURE__*/_createClass(function ERemark(options) {
57
74
  return /*#__PURE__*/React.createElement("span", null, "--");
58
75
  }
59
76
  var index = get(record, "".concat(_this.id, "_flag"));
77
+ var isYouzan = _this.isYouzan(record);
60
78
  return /*#__PURE__*/React.createElement("div", {
61
79
  style: {
62
80
  display: 'inline-block'
63
81
  }
64
- }, !isNull(get(record, "".concat(_this.id, "_flag"))) ? index !== undefined && /*#__PURE__*/React.createElement("img", {
82
+ }, !isNull(get(record, "".concat(_this.id, "_flag"))) ? isYouzan ? normalizeYouzanStar(index) && /*#__PURE__*/React.createElement(YouzanStar, {
83
+ compact: true,
84
+ disabled: true,
85
+ value: index
86
+ }) : index !== undefined && /*#__PURE__*/React.createElement("img", {
65
87
  src: _this.imgList[Number(index)]
66
88
  }) :
67
89
  // <i
@@ -94,7 +116,9 @@ var ERemark = /*#__PURE__*/_createClass(function ERemark(options) {
94
116
  display: p === null || p === void 0 ? void 0 : p.display,
95
117
  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,
96
118
  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 : '',
97
- component: /*#__PURE__*/React.createElement(Remark, _this.componentConfig)
119
+ component: /*#__PURE__*/React.createElement(Remark, _extends({}, _this.componentConfig, {
120
+ isYouzan: _this.isYouzan()
121
+ }))
98
122
  });
99
123
  });
100
124
  _defineProperty(this, "filterConfig", function (item) {
@@ -170,6 +194,7 @@ var ERemark = /*#__PURE__*/_createClass(function ERemark(options) {
170
194
  this.formField = "".concat(options.id, "_remark");
171
195
  this.type = options.type;
172
196
  this.componentConfig = options.componentConfig;
197
+ this.effects = options.effects;
173
198
  this.dataType = 'object';
174
199
  this.rules = (_this$componentConfig5 = this.componentConfig) !== null && _this$componentConfig5 !== void 0 && _this$componentConfig5.required ? [{
175
200
  validator: function validator(_, value) {
@@ -177,8 +202,11 @@ var ERemark = /*#__PURE__*/_createClass(function ERemark(options) {
177
202
  if (!(value !== null && value !== void 0 && value.remark)) {
178
203
  return Promise.reject(new Error('请输入备注'));
179
204
  }
180
- if ((_this$componentConfig6 = _this.componentConfig) !== null && _this$componentConfig6 !== void 0 && _this$componentConfig6.isShowFlag && !(value !== null && value !== void 0 && value.flag) && (value === null || value === void 0 ? void 0 : value.flag) !== 0) {
181
- return Promise.reject(new Error('请选择旗帜'));
205
+ if ((_this$componentConfig6 = _this.componentConfig) !== null && _this$componentConfig6 !== void 0 && _this$componentConfig6.isShowFlag) {
206
+ var flag = _this.isYouzan() ? normalizeYouzanStar(value === null || value === void 0 ? void 0 : value.flag) : value === null || value === void 0 ? void 0 : value.flag;
207
+ if (!flag && flag !== 0) {
208
+ return Promise.reject(new Error(_this.isYouzan() ? '请选择星标' : '请选择旗帜'));
209
+ }
182
210
  }
183
211
  return Promise.resolve();
184
212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "2.10.9-beta.25",
3
+ "version": "2.10.9-beta.27",
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.9-beta.25",
25
- "@kmkf-fe-packages/kmkf-utils": "2.10.9-beta.25",
24
+ "@kmkf-fe-packages/basic-components": "2.10.9-beta.27",
25
+ "@kmkf-fe-packages/kmkf-utils": "2.10.9-beta.27",
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": "94fca8997d4d3587ba91d4e9683ff2b1ab39bb3d",
44
+ "gitHead": "abb6f5b377be64bb78d0fc7a65cc0b75db6347fc",
45
45
  "gitHooks": {
46
46
  "pre-commit": "lint-staged"
47
47
  }