@kmkf-fe-packages/kmkf-utils 0.6.2 → 0.6.3-alpha.0

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.
@@ -11,6 +11,10 @@ export default class ExpressData {
11
11
  setExpressData: (val: OptionsItem[]) => OptionsItem[];
12
12
  getExpressNameByCode: (code: string | number) => string | number;
13
13
  getExpressNameByName: (name: string | number) => string | number;
14
+ getInterceptionTypeName: (company: string, type: string) => any;
15
+ getInterceptionStatusName: (company: string, status: string) => any;
16
+ isInterfaceCompany: (company: string) => any;
17
+ isShowNewAddress: (company: string, type: string) => any;
14
18
  static getInstance(): ExpressData;
15
19
  }
16
20
  export {};
@@ -48,6 +48,41 @@ var ExpressData = /*#__PURE__*/function () {
48
48
  });
49
49
  return item.length ? item[0].value : name;
50
50
  });
51
+ _defineProperty(this, "getInterceptionTypeName", function (company, type) {
52
+ var _find;
53
+ var item = (_this.expressData || []).find(function (item) {
54
+ return item.value === company;
55
+ });
56
+ var label = (_find = ((item === null || item === void 0 ? void 0 : item.interceptionTypeList) || []).find(function (t) {
57
+ return t.value === type;
58
+ })) === null || _find === void 0 ? void 0 : _find.label;
59
+ return label;
60
+ });
61
+ _defineProperty(this, "getInterceptionStatusName", function (company, status) {
62
+ var _find2;
63
+ var item = (_this.expressData || []).find(function (item) {
64
+ return item.value === company;
65
+ });
66
+ var label = (_find2 = ((item === null || item === void 0 ? void 0 : item.interceptionStatusList) || []).find(function (t) {
67
+ return t.value === status;
68
+ })) === null || _find2 === void 0 ? void 0 : _find2.label;
69
+ return label;
70
+ });
71
+ _defineProperty(this, "isInterfaceCompany", function (company) {
72
+ var item = (_this.expressData || []).find(function (item) {
73
+ return item.value === company;
74
+ });
75
+ return item === null || item === void 0 ? void 0 : item.isInterface;
76
+ });
77
+ _defineProperty(this, "isShowNewAddress", function (company, type) {
78
+ var _find3, _find3$config;
79
+ var item = (_this.expressData || []).find(function (item) {
80
+ return item.value === company;
81
+ });
82
+ return (_find3 = ((item === null || item === void 0 ? void 0 : item.interceptionTypeList) || []).find(function (t) {
83
+ return t.value === type;
84
+ })) === null || _find3 === void 0 ? void 0 : (_find3$config = _find3.config) === null || _find3$config === void 0 ? void 0 : _find3$config.showAddress;
85
+ });
51
86
  this.initData();
52
87
  }
53
88
  _createClass(ExpressData, null, [{
@@ -23,9 +23,30 @@ 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
+ };
29
+ platSelectList: {
30
+ label: string;
31
+ value: string;
32
+ }[];
26
33
  constructor();
27
34
  initData: () => void;
28
35
  getPlatData: () => PlatInterface[];
36
+ /**
37
+ * 获取平台类型和平台名称映射关系
38
+ */
39
+ getPlatMap: () => {
40
+ [x: string]: string;
41
+ };
42
+ /**
43
+ * 获取平台选择列表
44
+ * @returns
45
+ */
46
+ getPlatSelectList: () => {
47
+ label: string;
48
+ value: string;
49
+ }[];
29
50
  static getInstance(): PlatData;
30
51
  }
31
52
  export declare type PlatDataClass = PlatData;
@@ -17,6 +17,8 @@ var PlatData = /*#__PURE__*/function () {
17
17
  var _this = this;
18
18
  _classCallCheck(this, PlatData);
19
19
  _defineProperty(this, "platTypeList", void 0);
20
+ _defineProperty(this, "platMap", void 0);
21
+ _defineProperty(this, "platSelectList", void 0);
20
22
  _defineProperty(this, "initData", function () {
21
23
  var _this$platTypeList;
22
24
  if (((_this$platTypeList = _this.platTypeList) === null || _this$platTypeList === void 0 ? void 0 : _this$platTypeList.length) > 0) return;
@@ -31,13 +33,33 @@ var PlatData = /*#__PURE__*/function () {
31
33
  platType.notJoinList = platType.notJoinList || [];
32
34
  var list = [].concat(_toConsumableArray(platType.alreadyJoinedList), _toConsumableArray(platType.notJoinList));
33
35
  _this.platTypeList = list;
36
+ var platMap = list === null || list === void 0 ? void 0 : list.reduce(function (cur, nxt) {
37
+ cur[nxt.platformType] = nxt.platformName;
38
+ return cur;
39
+ }, {});
40
+ _this.platMap = platMap;
41
+ var platSelectList = list.map(function (p) {
42
+ return {
43
+ label: p.platformName,
44
+ value: p.platformType
45
+ };
46
+ });
47
+ _this.platSelectList = platSelectList;
34
48
  }
35
49
  });
36
50
  });
37
51
  _defineProperty(this, "getPlatData", function () {
38
52
  return _this.platTypeList;
39
53
  });
54
+ _defineProperty(this, "getPlatMap", function () {
55
+ return _this.platMap;
56
+ });
57
+ _defineProperty(this, "getPlatSelectList", function () {
58
+ return _this.platSelectList;
59
+ });
40
60
  this.platTypeList = [];
61
+ this.platMap = {};
62
+ this.platSelectList = [];
41
63
  this.initData();
42
64
  }
43
65
  _createClass(PlatData, null, [{
@@ -0,0 +1,4 @@
1
+ declare const filterTableListItemColumnValue: (item: any, id: string, key?: string) => any;
2
+ declare const filterDateFn: (value: string[], recordDateTime: string | string[]) => boolean;
3
+ declare const filterSplitComma: (item: string, input: string) => boolean;
4
+ export { filterDateFn, filterTableListItemColumnValue, filterSplitComma };
@@ -0,0 +1,18 @@
1
+ import get from 'lodash/get';
2
+ import moment from 'moment';
3
+ var filterTableListItemColumnValue = function filterTableListItemColumnValue(item, id, key) {
4
+ return key ? get(item, "".concat(id, "_").concat(key), '') : get(item, "".concat(id), '');
5
+ };
6
+ var filterDateFn = function filterDateFn(value, recordDateTime) {
7
+ if (!recordDateTime) return false;
8
+ return Array.isArray(recordDateTime) ? moment(recordDateTime[0]).isSameOrAfter(value[0], 'seconds') && moment(recordDateTime[1]).isSameOrBefore(value[1], 'seconds') : moment(recordDateTime).isSameOrAfter(value[0], 'seconds') && moment(recordDateTime).isSameOrBefore(value[1], 'seconds');
9
+ };
10
+
11
+ // 针对物流过滤 + 订单号组件
12
+ var filterSplitComma = function filterSplitComma(item, input) {
13
+ var inputChunks = input.split(/[,|,]/);
14
+ return inputChunks.some(function (i) {
15
+ return item === null || item === void 0 ? void 0 : item.includes(i);
16
+ });
17
+ };
18
+ export { filterDateFn, filterTableListItemColumnValue, filterSplitComma };
@@ -5,7 +5,7 @@ import find from 'lodash/find';
5
5
  export default (function (vales, options) {
6
6
  if (isEmpty(vales)) return [];
7
7
  var newKV = [];
8
- vales.map(function (value, index) {
8
+ vales === null || vales === void 0 ? void 0 : vales.map(function (value, index) {
9
9
  var list = options[index]['list'];
10
10
  var flatt = keys(list).reduce(function (next, cur) {
11
11
  return next.concat(list[cur]);
@@ -3,3 +3,4 @@ export { default as findLabelBySelectValue } from './findLabelBySelectValue';
3
3
  export { default as transMultSelectOptions } from './transMultSelectOptions';
4
4
  export { default as imgResize } from './imgResize';
5
5
  export { default as isNull } from './isNull';
6
+ export * as filterFn from './filterFn';
@@ -2,4 +2,6 @@ export { default as toTree } from "./toTree";
2
2
  export { default as findLabelBySelectValue } from "./findLabelBySelectValue";
3
3
  export { default as transMultSelectOptions } from "./transMultSelectOptions";
4
4
  export { default as imgResize } from "./imgResize";
5
- export { default as isNull } from "./isNull";
5
+ export { default as isNull } from "./isNull";
6
+ import * as _filterFn from "./filterFn";
7
+ export { _filterFn as filterFn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "0.6.2",
3
+ "version": "0.6.3-alpha.0",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -30,5 +30,5 @@
30
30
  "gitHooks": {
31
31
  "pre-commit": "lint-staged"
32
32
  },
33
- "gitHead": "07780bea9eb1cf7ac7764c78fc754668c96deb29"
33
+ "gitHead": "f2de883a1a57e0ead13d3ee345acaf3dd1b3467d"
34
34
  }