@kmkf-fe-packages/services-components 1.22.1-beta.39 → 1.22.1-beta.40
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.
- package/dist/esm/components/BS/BsGoods/dist/index.js +113 -0
- package/dist/esm/components/BS/common/BsHeaderGood.js +13 -40
- package/dist/esm/components/Common/dist/index.js +1525 -0
- package/dist/esm/components/EItemEnCode/index.d.ts +2 -1
- package/dist/esm/components/EItemEnCode/index.js +28 -29
- package/dist/esm/factory.d.ts +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __assign = this && this.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
exports.__esModule = true;
|
|
14
|
+
var react_1 = require("react");
|
|
15
|
+
var GetFormItem_1 = require("../../GetFormItem");
|
|
16
|
+
var Common_1 = require("../../Common");
|
|
17
|
+
var index_1 = require("../common/index");
|
|
18
|
+
var ItemView_1 = require("../../../commonComponents/ItemView");
|
|
19
|
+
var kmkf_utils_1 = require("@kmkf-fe-packages/kmkf-utils");
|
|
20
|
+
var basic_components_1 = require("@kmkf-fe-packages/basic-components");
|
|
21
|
+
var constant_1 = require("../../../constant");
|
|
22
|
+
var BsGoods = /** @class */function () {
|
|
23
|
+
function BsGoods(options) {
|
|
24
|
+
var _this = this;
|
|
25
|
+
var _a;
|
|
26
|
+
this.renderClient = function (record) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
console.log("in renderclient");
|
|
29
|
+
return !kmkf_utils_1.isNull(record === null || record === void 0 ? void 0 : record["" + _this.id]) ? react_1["default"].createElement(react_1["default"].Fragment, null, react_1["default"].createElement(ItemView_1["default"], {
|
|
30
|
+
id: _this.id,
|
|
31
|
+
label: _this.name,
|
|
32
|
+
value: react_1["default"].createElement(Common_1.BsGoodsTable, {
|
|
33
|
+
list: ((_a = record === null || record === void 0 ? void 0 : record["" + _this.id]) === null || _a === void 0 ? void 0 : _a.bsGoods) || [],
|
|
34
|
+
showHeader: ((_b = _this.componentConfig) === null || _b === void 0 ? void 0 : _b.showHeader) || []
|
|
35
|
+
})
|
|
36
|
+
})) : null;
|
|
37
|
+
};
|
|
38
|
+
this.renderPc = function () {
|
|
39
|
+
return null;
|
|
40
|
+
};
|
|
41
|
+
this.renderLog = function (r) {
|
|
42
|
+
var _a;
|
|
43
|
+
console.log("in renderclient");
|
|
44
|
+
if (kmkf_utils_1.isNull(r === null || r === void 0 ? void 0 : r[_this.id + "_bsGoods"])) return null;
|
|
45
|
+
return react_1["default"].createElement(Common_1.BsGoodsTable, {
|
|
46
|
+
list: (r === null || r === void 0 ? void 0 : r[_this.id + "_bsGoods"]) || [],
|
|
47
|
+
showHeader: ((_a = _this.componentConfig) === null || _a === void 0 ? void 0 : _a.showHeader) || []
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
this.getComponentValue = function (r) {
|
|
51
|
+
return r === null || r === void 0 ? void 0 : r[_this.id + "_bsGoods"];
|
|
52
|
+
};
|
|
53
|
+
this.renderExport = function () {
|
|
54
|
+
return null;
|
|
55
|
+
};
|
|
56
|
+
this.editRender = function (p) {
|
|
57
|
+
var _a, _b, _c, _d, _e, _f;
|
|
58
|
+
console.log("in renderclient");
|
|
59
|
+
return react_1["default"].createElement(GetFormItem_1["default"], {
|
|
60
|
+
title: _this.name,
|
|
61
|
+
name: _this.id,
|
|
62
|
+
rules: _this.rules,
|
|
63
|
+
required: false,
|
|
64
|
+
hidden: p === null || p === void 0 ? void 0 : p.hidden,
|
|
65
|
+
display: p === null || p === void 0 ? void 0 : p.display,
|
|
66
|
+
tooltip: ((_a = _this.componentConfig) === null || _a === void 0 ? void 0 : _a.showTooltip) ? (_b = _this.componentConfig) === null || _b === void 0 ? void 0 : _b.tooltip : "",
|
|
67
|
+
component: react_1["default"].createElement(basic_components_1.BsGoods, __assign({}, _this.componentConfig, {
|
|
68
|
+
maxLength: ((_c = _this.componentConfig) === null || _c === void 0 ? void 0 : _c.maxLength) || 20,
|
|
69
|
+
shopId: (_d = _this.effects) === null || _d === void 0 ? void 0 : _d.shopId,
|
|
70
|
+
shopList: ((_e = _this.effects) === null || _e === void 0 ? void 0 : _e.shopList) || [],
|
|
71
|
+
companyKey: (_f = _this.effects) === null || _f === void 0 ? void 0 : _f.companyKey,
|
|
72
|
+
width: "90%"
|
|
73
|
+
}))
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
this.filterConfig = function (item) {
|
|
77
|
+
return [{
|
|
78
|
+
searchDefaultConditions: constant_1.SYMBOL.like,
|
|
79
|
+
type: item.type,
|
|
80
|
+
id: item.id + "_bsGoods",
|
|
81
|
+
name: item.name,
|
|
82
|
+
filterComponentType: "Input"
|
|
83
|
+
}];
|
|
84
|
+
};
|
|
85
|
+
this.name = options.name;
|
|
86
|
+
this.id = options.id;
|
|
87
|
+
this.sortField = options.id + "_bsGoods";
|
|
88
|
+
this.formField = options.id + "_bsGoods";
|
|
89
|
+
this.type = options.type;
|
|
90
|
+
this.effects = options === null || options === void 0 ? void 0 : options.effects;
|
|
91
|
+
this.isCombinationComponent = true;
|
|
92
|
+
this.canSort = false;
|
|
93
|
+
this.bsGoods = new index_1.BsHeaderGood(__assign(__assign({}, options), {
|
|
94
|
+
id: options.id + "_bsGoods",
|
|
95
|
+
name: "商品信息"
|
|
96
|
+
}));
|
|
97
|
+
this.children = [this.bsGoods];
|
|
98
|
+
this.componentConfig = options === null || options === void 0 ? void 0 : options.componentConfig;
|
|
99
|
+
this.rules = ((_a = this === null || this === void 0 ? void 0 : this.componentConfig) === null || _a === void 0 ? void 0 : _a.required) ? [{
|
|
100
|
+
required: true,
|
|
101
|
+
validator: function validator(_, value) {
|
|
102
|
+
var _a;
|
|
103
|
+
if (!value || !((_a = value === null || value === void 0 ? void 0 : value.bsGoods) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
104
|
+
return Promise.reject(new Error("请选择bs商品"));
|
|
105
|
+
}
|
|
106
|
+
return Promise.resolve();
|
|
107
|
+
}
|
|
108
|
+
}] : [];
|
|
109
|
+
this.dataType = "object";
|
|
110
|
+
}
|
|
111
|
+
return BsGoods;
|
|
112
|
+
}();
|
|
113
|
+
exports["default"] = BsGoods;
|
|
@@ -21,6 +21,7 @@ import React from "react";
|
|
|
21
21
|
import ItemView from "../../../commonComponents/ItemView";
|
|
22
22
|
import { isNull } from "@kmkf-fe-packages/kmkf-utils";
|
|
23
23
|
import { BsHeaderPic, BsHeaderChild, BsHeaderGoodPic } from "./index";
|
|
24
|
+
import { getMapping, columnsGoodsList } from "@kmkf-fe-packages/kmkf-utils";
|
|
24
25
|
var HeaderMap = {
|
|
25
26
|
mark: {
|
|
26
27
|
component: BsHeaderChild,
|
|
@@ -46,6 +47,12 @@ var HeaderMap = {
|
|
|
46
47
|
key: "name",
|
|
47
48
|
width: 200
|
|
48
49
|
},
|
|
50
|
+
num: {
|
|
51
|
+
component: BsHeaderChild,
|
|
52
|
+
name: "商品数量",
|
|
53
|
+
key: "num",
|
|
54
|
+
width: 200
|
|
55
|
+
},
|
|
49
56
|
code: {
|
|
50
57
|
component: BsHeaderChild,
|
|
51
58
|
name: "编码",
|
|
@@ -215,15 +222,7 @@ var BsHeaderGods = /*#__PURE__*/function () {
|
|
|
215
222
|
this.isCombinationComponent = true;
|
|
216
223
|
this.canSort = false;
|
|
217
224
|
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
|
-
} : {
|
|
225
|
+
this.itemKey = options.type === "ITEM_ENCODE" ? getMapping(columnsGoodsList) : {
|
|
227
226
|
mark: "商品标记",
|
|
228
227
|
pic: "图片",
|
|
229
228
|
name: "名称",
|
|
@@ -238,36 +237,6 @@ var BsHeaderGods = /*#__PURE__*/function () {
|
|
|
238
237
|
expireDate: "有效期"
|
|
239
238
|
};
|
|
240
239
|
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
240
|
}
|
|
272
241
|
_createClass(BsHeaderGods, [{
|
|
273
242
|
key: "getChildren",
|
|
@@ -275,9 +244,13 @@ var BsHeaderGods = /*#__PURE__*/function () {
|
|
|
275
244
|
var _options$componentCon,
|
|
276
245
|
_this2 = this;
|
|
277
246
|
var showHeader = options === null || options === void 0 ? void 0 : (_options$componentCon = options.componentConfig) === null || _options$componentCon === void 0 ? void 0 : _options$componentCon.showHeader;
|
|
247
|
+
var dataIndexList = [];
|
|
248
|
+
if (!Array.isArray(showHeader)) {
|
|
249
|
+
dataIndexList = Object.keys(this.itemKey);
|
|
250
|
+
showHeader = dataIndexList;
|
|
251
|
+
}
|
|
278
252
|
var isStringArray = Array.isArray(showHeader) && typeof showHeader[0] === "string";
|
|
279
253
|
var isObjectArray = Array.isArray(showHeader) && Object.prototype.toString.call(showHeader[0]) === "[object Object]";
|
|
280
|
-
var dataIndexList = [];
|
|
281
254
|
if (isStringArray) {
|
|
282
255
|
dataIndexList = showHeader;
|
|
283
256
|
} else if (isObjectArray) {
|