@kmkf-fe-packages/kmkf-utils 0.6.3-alpha.15 → 0.6.3-alpha.21
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/addressData/index.d.ts +2 -8
- package/dist/esm/addressData/index.js +1 -1
- package/dist/esm/expressInterceptData/index.d.ts +16 -0
- package/dist/esm/expressInterceptData/index.js +49 -5
- package/dist/esm/platData/index.d.ts +2 -6
- package/dist/esm/utils/findLabelBySelectValue.js +1 -15
- package/package.json +8 -3
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
declare type AddressMapT = {
|
|
2
|
-
[p in string]: string;
|
|
3
|
-
};
|
|
4
|
-
declare type AddressTuples = {
|
|
5
|
-
[p in string]: [string, string | number];
|
|
6
|
-
};
|
|
7
1
|
interface TreeOption {
|
|
8
2
|
label: string;
|
|
9
3
|
value: string;
|
|
@@ -11,8 +5,8 @@ interface TreeOption {
|
|
|
11
5
|
}
|
|
12
6
|
export default class AddressData {
|
|
13
7
|
private static instance;
|
|
14
|
-
addrData:
|
|
15
|
-
addrNameMap:
|
|
8
|
+
addrData: Record<string, [string, string | number]>;
|
|
9
|
+
addrNameMap: Record<string, string>;
|
|
16
10
|
treeData: TreeOption[];
|
|
17
11
|
constructor();
|
|
18
12
|
initData: () => void;
|
|
@@ -38,7 +38,7 @@ var AddressData = /*#__PURE__*/function () {
|
|
|
38
38
|
var nameCode = {},
|
|
39
39
|
arr = [];
|
|
40
40
|
for (var key in _this.addrData) {
|
|
41
|
-
if (
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(_this.addrData, key)) {
|
|
42
42
|
var valueArray = _this.addrData[key];
|
|
43
43
|
if (valueArray[1] === Number(addrCode)) {
|
|
44
44
|
nameCode[valueArray[0]] = key;
|
|
@@ -14,6 +14,14 @@ export default class ExpressInterceptData {
|
|
|
14
14
|
showNewAddressMap: any;
|
|
15
15
|
typeNameMap: any;
|
|
16
16
|
statusNameMap: any;
|
|
17
|
+
typeOptions: {
|
|
18
|
+
label: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}[];
|
|
21
|
+
statusOptions: {
|
|
22
|
+
label: string;
|
|
23
|
+
value: string;
|
|
24
|
+
}[];
|
|
17
25
|
constructor();
|
|
18
26
|
initData: () => OptionsItem[] | undefined;
|
|
19
27
|
getExpressData: () => OptionsItem[] | undefined;
|
|
@@ -21,6 +29,14 @@ export default class ExpressInterceptData {
|
|
|
21
29
|
getTypeNameMap(): any;
|
|
22
30
|
getStatusNameMap(): any;
|
|
23
31
|
getShowNewAddressMap(): any;
|
|
32
|
+
getTypeOptions(): {
|
|
33
|
+
label: string;
|
|
34
|
+
value: string;
|
|
35
|
+
}[];
|
|
36
|
+
getStatusOptions(): {
|
|
37
|
+
label: string;
|
|
38
|
+
value: string;
|
|
39
|
+
}[];
|
|
24
40
|
setExpressData: (val: OptionsItem[]) => OptionsItem[];
|
|
25
41
|
getExpressNameByCode: (code: string | number) => string | number;
|
|
26
42
|
getExpressNameByName: (name: string | number) => string | number;
|
|
@@ -1,4 +1,10 @@
|
|
|
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
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; }
|
|
2
8
|
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
9
|
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; }
|
|
4
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -13,6 +19,8 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
13
19
|
//展示新收货地映射
|
|
14
20
|
//拦截类型映射
|
|
15
21
|
//拦截状态映射
|
|
22
|
+
//拦截类型筛选options
|
|
23
|
+
//拦截状态筛选options
|
|
16
24
|
function ExpressInterceptData() {
|
|
17
25
|
var _this = this;
|
|
18
26
|
_classCallCheck(this, ExpressInterceptData);
|
|
@@ -21,6 +29,8 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
21
29
|
_defineProperty(this, "showNewAddressMap", {});
|
|
22
30
|
_defineProperty(this, "typeNameMap", null);
|
|
23
31
|
_defineProperty(this, "statusNameMap", null);
|
|
32
|
+
_defineProperty(this, "typeOptions", []);
|
|
33
|
+
_defineProperty(this, "statusOptions", []);
|
|
24
34
|
_defineProperty(this, "initData", function () {
|
|
25
35
|
if (_this.expressData.length > 0) return _this.expressData;
|
|
26
36
|
request({
|
|
@@ -41,23 +51,35 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
41
51
|
var showBtn = {},
|
|
42
52
|
showAddress = {},
|
|
43
53
|
typeMap = {},
|
|
44
|
-
statusMap = {}
|
|
54
|
+
statusMap = {},
|
|
55
|
+
typeObj = {},
|
|
56
|
+
statusObj = {};
|
|
45
57
|
expressList.forEach(function (item) {
|
|
46
58
|
var _item$interceptionSta, _item$interceptionTyp;
|
|
47
59
|
if (item !== null && item !== void 0 && (_item$interceptionSta = item.interceptionStatusList) !== null && _item$interceptionSta !== void 0 && _item$interceptionSta.length) {
|
|
48
60
|
item.interceptionStatusList.forEach(function (t) {
|
|
49
|
-
statusMap["".concat(
|
|
61
|
+
statusMap["".concat(t.value)] = t.label;
|
|
62
|
+
if (statusObj[t.label]) {
|
|
63
|
+
statusObj[t.label] = statusObj[t.label].add(t.value);
|
|
64
|
+
} else {
|
|
65
|
+
statusObj[t.label] = new Set([t.value]);
|
|
66
|
+
}
|
|
50
67
|
if (t !== null && t !== void 0 && t.showInterceptionBtn) {
|
|
51
|
-
showBtn["".concat(
|
|
68
|
+
showBtn["".concat(t.value)] = true;
|
|
52
69
|
}
|
|
53
70
|
});
|
|
54
71
|
}
|
|
55
72
|
if (item !== null && item !== void 0 && (_item$interceptionTyp = item.interceptionTypeList) !== null && _item$interceptionTyp !== void 0 && _item$interceptionTyp.length) {
|
|
56
73
|
item.interceptionTypeList.forEach(function (t) {
|
|
57
74
|
var _t$config;
|
|
58
|
-
typeMap["".concat(
|
|
75
|
+
typeMap["".concat(t.value)] = t.label;
|
|
76
|
+
if (typeObj[t.label]) {
|
|
77
|
+
typeObj[t.label] = typeObj[t.label].add(t.value);
|
|
78
|
+
} else {
|
|
79
|
+
typeObj[t.label] = new Set([t.value]);
|
|
80
|
+
}
|
|
59
81
|
if (t !== null && t !== void 0 && (_t$config = t.config) !== null && _t$config !== void 0 && _t$config.showAddress) {
|
|
60
|
-
showAddress["".concat(
|
|
82
|
+
showAddress["".concat(t.value)] = true;
|
|
61
83
|
}
|
|
62
84
|
});
|
|
63
85
|
}
|
|
@@ -66,6 +88,18 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
66
88
|
_this.typeNameMap = typeMap;
|
|
67
89
|
_this.statusNameMap = statusMap;
|
|
68
90
|
_this.showNewAddressMap = showAddress;
|
|
91
|
+
_this.typeOptions = Object.keys(statusObj).map(function (key) {
|
|
92
|
+
return {
|
|
93
|
+
label: key,
|
|
94
|
+
value: _toConsumableArray(statusObj[key]).join(",")
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
_this.statusOptions = Object.keys(typeObj).map(function (key) {
|
|
98
|
+
return {
|
|
99
|
+
label: key,
|
|
100
|
+
value: _toConsumableArray(typeObj[key]).join(",")
|
|
101
|
+
};
|
|
102
|
+
});
|
|
69
103
|
});
|
|
70
104
|
});
|
|
71
105
|
_defineProperty(this, "getExpressData", function () {
|
|
@@ -121,6 +155,16 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
121
155
|
value: function getShowNewAddressMap() {
|
|
122
156
|
return this.showNewAddressMap;
|
|
123
157
|
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "getTypeOptions",
|
|
160
|
+
value: function getTypeOptions() {
|
|
161
|
+
return this.typeOptions;
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "getStatusOptions",
|
|
165
|
+
value: function getStatusOptions() {
|
|
166
|
+
return this.statusOptions;
|
|
167
|
+
}
|
|
124
168
|
}], [{
|
|
125
169
|
key: "getInstance",
|
|
126
170
|
value: function getInstance() {
|
|
@@ -23,9 +23,7 @@ interface PlatInterface {
|
|
|
23
23
|
export default class PlatData {
|
|
24
24
|
private static instance;
|
|
25
25
|
platTypeList: PlatInterface[];
|
|
26
|
-
platMap:
|
|
27
|
-
[prop in string]: string;
|
|
28
|
-
};
|
|
26
|
+
platMap: Record<string, string>;
|
|
29
27
|
platSelectList: {
|
|
30
28
|
label: string;
|
|
31
29
|
value: string;
|
|
@@ -36,9 +34,7 @@ export default class PlatData {
|
|
|
36
34
|
/**
|
|
37
35
|
* 获取平台类型和平台名称映射关系
|
|
38
36
|
*/
|
|
39
|
-
getPlatMap: () =>
|
|
40
|
-
[x: string]: string;
|
|
41
|
-
};
|
|
37
|
+
getPlatMap: () => Record<string, string>;
|
|
42
38
|
/**
|
|
43
39
|
* 获取平台选择列表
|
|
44
40
|
* @returns
|
|
@@ -19,18 +19,4 @@ export default (function (vales, options) {
|
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
return newKV;
|
|
22
|
-
});
|
|
23
|
-
var findNodeById = function findNodeById(tree) {
|
|
24
|
-
var actived = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
25
|
-
for (var i = 0; i < tree.length; i++) {
|
|
26
|
-
if (tree[i].actived == actived) {
|
|
27
|
-
return tree[i];
|
|
28
|
-
}
|
|
29
|
-
if (tree[i].children) {
|
|
30
|
-
var result = findNodeById(tree[i].children, actived);
|
|
31
|
-
if (result) {
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
22
|
+
});
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/kmkf-utils",
|
|
3
|
-
"version": "0.6.3-alpha.
|
|
3
|
+
"version": "0.6.3-alpha.21",
|
|
4
4
|
"module": "dist/esm/index.js",
|
|
5
5
|
"typings": "dist/esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "father build"
|
|
10
|
+
"build": "yarn run lint && father build",
|
|
11
|
+
"lint": "eslint . --ext .ts",
|
|
12
|
+
"lint:fix": "npx eslint . --ext .ts --fix"
|
|
11
13
|
},
|
|
12
14
|
"lint-staged": {
|
|
13
15
|
"*.{js,jsx,less,md,json}": [
|
|
@@ -22,6 +24,9 @@
|
|
|
22
24
|
"umi-request": "^1.4.0"
|
|
23
25
|
},
|
|
24
26
|
"devDependencies": {
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^5.59.2",
|
|
28
|
+
"@typescript-eslint/parser": "^5.59.2",
|
|
29
|
+
"eslint": "^8.40.0",
|
|
25
30
|
"father": "^4.1.7"
|
|
26
31
|
},
|
|
27
32
|
"publishConfig": {
|
|
@@ -30,5 +35,5 @@
|
|
|
30
35
|
"gitHooks": {
|
|
31
36
|
"pre-commit": "lint-staged"
|
|
32
37
|
},
|
|
33
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "79d6a0773ee444beb4c8d2c646b9adfcf1c628a5"
|
|
34
39
|
}
|