@kmkf-fe-packages/kmkf-utils 0.27.1-test.7 → 0.27.1-test.8

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.
@@ -8,12 +8,16 @@ interface OptionsItem {
8
8
  logisticsStatusList?: any[];
9
9
  }
10
10
  export default class ExpressData {
11
- private static instance;
12
- expressData: OptionsItem[];
11
+ private static instanceMap;
12
+ expressDataMap: Record<string, OptionsItem[]>;
13
+ type: string;
14
+ constructor(type: string);
15
+ get expressData(): OptionsItem[];
16
+ set expressData(value: OptionsItem[]);
13
17
  getExpressData: () => OptionsItem[];
14
- setExpressData: (val: OptionsItem[]) => OptionsItem[];
18
+ setExpressData: (val: OptionsItem[], type: string) => OptionsItem[];
15
19
  getExpressNameByCode: (code: string | number, returnCurrentValue?: boolean) => string | number;
16
20
  getExpressCodeByName: (name: string | number, returnCurrentValue?: boolean) => string | number;
17
- static getInstance(): ExpressData;
21
+ static getInstance(type?: string): ExpressData;
18
22
  }
19
23
  export {};
@@ -6,15 +6,20 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
6
6
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
7
  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
8
  var ExpressData = /*#__PURE__*/function () {
9
- function ExpressData() {
9
+ // private static instance: ExpressData;
10
+
11
+ // expressData: OptionsItem[] = [];
12
+
13
+ function ExpressData(_type) {
10
14
  var _this = this;
11
15
  _classCallCheck(this, ExpressData);
12
- _defineProperty(this, "expressData", []);
16
+ _defineProperty(this, "expressDataMap", {});
17
+ _defineProperty(this, "type", void 0);
13
18
  _defineProperty(this, "getExpressData", function () {
14
19
  return _this.expressData;
15
20
  });
16
- _defineProperty(this, "setExpressData", function (val) {
17
- return _this.expressData = val;
21
+ _defineProperty(this, "setExpressData", function (val, type) {
22
+ return _this.expressDataMap[type] = val;
18
23
  });
19
24
  _defineProperty(this, "getExpressNameByCode", function (code) {
20
25
  var returnCurrentValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
@@ -30,17 +35,27 @@ var ExpressData = /*#__PURE__*/function () {
30
35
  });
31
36
  return item.length ? item[0].value : returnCurrentValue ? name : "";
32
37
  });
38
+ this.type = _type;
33
39
  }
34
- _createClass(ExpressData, null, [{
40
+ _createClass(ExpressData, [{
41
+ key: "expressData",
42
+ get: function get() {
43
+ return this.expressDataMap[this.type] || [];
44
+ },
45
+ set: function set(value) {
46
+ this.expressDataMap[this.type] = value;
47
+ }
48
+ }], [{
35
49
  key: "getInstance",
36
50
  value: function getInstance() {
37
- if (!ExpressData.instance) {
38
- ExpressData.instance = new ExpressData();
51
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
52
+ if (!ExpressData.instanceMap[type]) {
53
+ ExpressData.instanceMap[type] = new ExpressData(type);
39
54
  }
40
- return ExpressData.instance;
55
+ return ExpressData.instanceMap[type];
41
56
  }
42
57
  }]);
43
58
  return ExpressData;
44
59
  }();
45
- _defineProperty(ExpressData, "instance", void 0);
60
+ _defineProperty(ExpressData, "instanceMap", {});
46
61
  export { ExpressData as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "0.27.1-test.7",
3
+ "version": "0.27.1-test.8",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -40,7 +40,7 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "8d75e5eeca6c2b783dd065d893e62731da836488",
43
+ "gitHead": "79152b18e9f8e50a947afa54628538a09b70b900",
44
44
  "gitHooks": {
45
45
  "pre-commit": "lint-staged"
46
46
  }