@kmkf-fe-packages/services-components 0.24.0-alpha.1 → 0.24.0-alpha.2
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/common/BsHeaderChild.js +2 -1
- package/dist/esm/components/BS/common/BsHeaderGood.js +60 -2
- package/dist/esm/components/BS/common/BsHeaderGoodPic.d.ts +27 -0
- package/dist/esm/components/BS/common/BsHeaderGoodPic.js +114 -0
- package/dist/esm/components/BS/common/index.d.ts +1 -0
- package/dist/esm/components/BS/common/index.js +1 -0
- package/dist/esm/components/Common/index.d.ts +12 -4
- package/dist/esm/components/Common/index.js +325 -228
- package/dist/esm/components/EItemEnCode/index.d.ts +10 -7
- package/dist/esm/components/EItemEnCode/index.js +68 -44
- package/dist/esm/type.d.ts +2 -1
- package/package.json +4 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ComponentInterface, PickOption, ColumnConfig, Record } from
|
|
2
|
-
import React from
|
|
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
|
-
|
|
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: (
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
})
|
|
49
|
+
});
|
|
41
50
|
});
|
|
42
51
|
_defineProperty(this, "renderPc", function (value, record) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
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 (
|
|
64
|
-
|
|
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({
|
|
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:
|
|
93
|
-
|
|
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.
|
|
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.
|
|
114
|
-
|
|
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
|
-
|
|
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 =
|
|
153
|
+
this.dataType = "object";
|
|
130
154
|
});
|
|
131
155
|
export default EItemEncode;
|
package/dist/esm/type.d.ts
CHANGED
|
@@ -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-alpha.
|
|
3
|
+
"version": "0.24.0-alpha.2",
|
|
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-alpha.
|
|
24
|
-
"@kmkf-fe-packages/kmkf-utils": "^0.24.0-alpha.
|
|
23
|
+
"@kmkf-fe-packages/basic-components": "^0.24.0-alpha.2",
|
|
24
|
+
"@kmkf-fe-packages/kmkf-utils": "^0.24.0-alpha.2"
|
|
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": "
|
|
40
|
+
"gitHead": "489b5efdbb763263102c24650e010df9d72eb75c",
|
|
41
41
|
"gitHooks": {
|
|
42
42
|
"pre-commit": "lint-staged"
|
|
43
43
|
}
|