@kmkf-fe-packages/kmkf-utils 1.26.0 → 1.27.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.
Files changed (46) hide show
  1. package/dist/esm/baseAddressData/baseAddressData.d.ts +9 -0
  2. package/dist/esm/{addressData/index.js → baseAddressData/baseAddressData.js} +26 -60
  3. package/dist/esm/baseAddressData/constants/addressData.d.ts +10 -0
  4. package/dist/esm/baseAddressData/constants/addressData.js +43 -0
  5. package/dist/esm/baseAddressData/constants/bsAddressData.d.ts +10 -0
  6. package/dist/esm/baseAddressData/constants/bsAddressData.js +43 -0
  7. package/dist/esm/baseAddressData/constants/gyAddressData.d.ts +12 -0
  8. package/dist/esm/baseAddressData/constants/gyAddressData.js +70 -0
  9. package/dist/esm/baseAddressData/constants/wdtAddressData.d.ts +13 -0
  10. package/dist/esm/{wdtAddressData/index.js → baseAddressData/constants/wdtAddressData.js} +23 -75
  11. package/dist/esm/baseAddressData/index.d.ts +4 -0
  12. package/dist/esm/baseAddressData/index.js +4 -0
  13. package/dist/esm/baseAddressData/type.d.ts +5 -0
  14. package/dist/esm/baseAddressData/type.js +1 -0
  15. package/dist/esm/index.d.ts +1 -3
  16. package/dist/esm/index.js +1 -3
  17. package/dist/esm/servers/GY/index.d.ts +1 -0
  18. package/dist/esm/servers/GY/index.js +1 -0
  19. package/dist/esm/servers/GY/warehouseData.d.ts +7 -0
  20. package/dist/esm/servers/GY/warehouseData.js +33 -0
  21. package/dist/esm/servers/index.d.ts +8 -8
  22. package/dist/esm/servers/index.js +28 -11
  23. package/dist/esm/utils/FetchAll.d.ts +2 -1
  24. package/dist/esm/utils/FetchAll.js +5 -1
  25. package/dist/esm/utils/SendData.d.ts +1 -1
  26. package/dist/esm/utils/SendData.js +6 -3
  27. package/dist/esm/utils/bsE3OrderBackFormValues.d.ts +20 -0
  28. package/dist/esm/utils/bsE3OrderBackFormValues.js +96 -3
  29. package/dist/esm/utils/bsOrderBackFormValues.d.ts +10 -0
  30. package/dist/esm/utils/bsOrderBackFormValues.js +33 -0
  31. package/dist/esm/utils/dist/gyOrderBackFormValues.js +285 -0
  32. package/dist/esm/utils/gyOrderBackFormValues.d.ts +35 -0
  33. package/dist/esm/utils/gyOrderBackFormValues.js +298 -0
  34. package/dist/esm/utils/index.d.ts +5 -4
  35. package/dist/esm/utils/index.js +5 -4
  36. package/dist/esm/utils/orderBackFormValues.js +5 -2
  37. package/dist/esm/utils/unTransField.js +1 -1
  38. package/dist/esm/utils/wdtOrderBackFormValues.d.ts +10 -0
  39. package/dist/esm/utils/wdtOrderBackFormValues.js +38 -20
  40. package/dist/esm/utils/wlnOrderBackFormValues.d.ts +10 -0
  41. package/dist/esm/utils/wlnOrderBackFormValues.js +18 -0
  42. package/package.json +2 -2
  43. package/dist/esm/addressData/index.d.ts +0 -33
  44. package/dist/esm/bsAddressData/index.d.ts +0 -33
  45. package/dist/esm/bsAddressData/index.js +0 -95
  46. package/dist/esm/wdtAddressData/index.d.ts +0 -36
@@ -0,0 +1,9 @@
1
+ import type { TreeOption } from "./type";
2
+ export default abstract class BaseAddressData {
3
+ protected abstract addrData: Record<string, [string, string | number]>;
4
+ protected abstract addrNameMap: Record<string, string>;
5
+ protected abstract addressOptions: TreeOption[];
6
+ getProCodeByName(proName: string): number | undefined;
7
+ getNameByCode(code: string | number): string;
8
+ getCodesByNames(names: Array<string>): (string | undefined)[];
9
+ }
@@ -5,53 +5,33 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
6
  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); } }
7
7
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
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; }
9
8
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
9
  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); }
11
- import { isEmpty } from 'lodash';
12
- var AddressData = /*#__PURE__*/function () {
13
- function AddressData() {
14
- var _this = this;
15
- _classCallCheck(this, AddressData);
16
- _defineProperty(this, "addrData", {});
17
- _defineProperty(this, "addrNameMap", {});
18
- _defineProperty(this, "addressOptions", []);
19
- _defineProperty(this, "parseData", function (addrCode) {
20
- var nameCode = {},
21
- arr = [];
22
- for (var key in _this.addrData) {
23
- if (Object.prototype.hasOwnProperty.call(_this.addrData, key)) {
24
- var valueArray = _this.addrData[key];
25
- if (valueArray[1] === Number(addrCode)) {
26
- nameCode[valueArray[0]] = key;
27
- arr.push({
28
- label: valueArray[0],
29
- value: key
30
- });
31
- }
32
- }
33
- }
34
- return arr;
35
- });
36
- _defineProperty(this, "getProvinceByCode", function (countryIndex) {
37
- return _this.parseData(countryIndex);
38
- });
39
- _defineProperty(this, "getCityByProCode", function (countryIndex) {
40
- return _this.parseData(countryIndex);
41
- });
42
- _defineProperty(this, "getAreaByCityCode", function (countryIndex) {
43
- return _this.parseData(countryIndex);
44
- });
45
- _defineProperty(this, "getProCodeByName", function (proName) {
46
- for (var key in _this.addrData) {
47
- if (_this.addrData[key][0] === proName) {
10
+ import { isEmpty } from "lodash";
11
+ var BaseAddressData = /*#__PURE__*/function () {
12
+ function BaseAddressData() {
13
+ _classCallCheck(this, BaseAddressData);
14
+ }
15
+ _createClass(BaseAddressData, [{
16
+ key: "getProCodeByName",
17
+ value: function getProCodeByName(proName) {
18
+ for (var key in this.addrData) {
19
+ if (this.addrData[key][0] === proName) {
48
20
  return Number(key);
49
21
  }
50
22
  }
51
- });
52
- _defineProperty(this, "getCodesByNames", function (names) {
23
+ }
24
+ }, {
25
+ key: "getNameByCode",
26
+ value: function getNameByCode(code) {
27
+ var _ref;
28
+ return (_ref = (this.addrData || {})[code] || []) === null || _ref === void 0 ? void 0 : _ref[0];
29
+ }
30
+ }, {
31
+ key: "getCodesByNames",
32
+ value: function getCodesByNames(names) {
53
33
  var codes = [];
54
- var currentData = _this.addressOptions;
34
+ var currentData = this.addressOptions;
55
35
  var _iterator = _createForOfIteratorHelper(names),
56
36
  _step;
57
37
  try {
@@ -60,9 +40,9 @@ var AddressData = /*#__PURE__*/function () {
60
40
  var foundChild = currentData.find(function (item) {
61
41
  return item.label === name;
62
42
  });
63
- codes.push(foundChild === null || foundChild === void 0 ? void 0 : foundChild.value); // 添加找到的 code
43
+ codes.push(foundChild === null || foundChild === void 0 ? void 0 : foundChild.value);
64
44
  if (!isEmpty(foundChild === null || foundChild === void 0 ? void 0 : foundChild.children)) {
65
- currentData = (foundChild === null || foundChild === void 0 ? void 0 : foundChild.children) || []; // 更新当前数据为找到的子节点
45
+ currentData = (foundChild === null || foundChild === void 0 ? void 0 : foundChild.children) || [];
66
46
  }
67
47
  };
68
48
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -73,23 +53,9 @@ var AddressData = /*#__PURE__*/function () {
73
53
  } finally {
74
54
  _iterator.f();
75
55
  }
76
- return codes; // 返回所有找到的 codes
77
- });
78
- _defineProperty(this, "getNameByCode", function (code) {
79
- var _ref;
80
- return (_ref = (_this.addrData || {})[code] || []) === null || _ref === void 0 ? void 0 : _ref[0];
81
- });
82
- }
83
- _createClass(AddressData, null, [{
84
- key: "getInstance",
85
- value: function getInstance() {
86
- if (!AddressData.instance) {
87
- AddressData.instance = new AddressData();
88
- }
89
- return AddressData.instance;
56
+ return codes;
90
57
  }
91
58
  }]);
92
- return AddressData;
59
+ return BaseAddressData;
93
60
  }();
94
- _defineProperty(AddressData, "instance", void 0);
95
- export { AddressData as default };
61
+ export { BaseAddressData as default };
@@ -0,0 +1,10 @@
1
+ import BaseAddressData from "../baseAddressData";
2
+ import type { TreeOption } from "../type";
3
+ export default class AddressData extends BaseAddressData {
4
+ private static instance;
5
+ addrData: Record<string, [string, string | number]>;
6
+ addrNameMap: Record<string, string>;
7
+ addressOptions: TreeOption[];
8
+ static getInstance(): AddressData;
9
+ }
10
+ export declare type AddressDataClass = AddressData;
@@ -0,0 +1,43 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ 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
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
6
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
7
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
9
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
10
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
12
+ 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; }
13
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
+ 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); }
15
+ import BaseAddressData from "../baseAddressData";
16
+ var AddressData = /*#__PURE__*/function (_BaseAddressData) {
17
+ _inherits(AddressData, _BaseAddressData);
18
+ var _super = _createSuper(AddressData);
19
+ function AddressData() {
20
+ var _this;
21
+ _classCallCheck(this, AddressData);
22
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
23
+ args[_key] = arguments[_key];
24
+ }
25
+ _this = _super.call.apply(_super, [this].concat(args));
26
+ _defineProperty(_assertThisInitialized(_this), "addrData", {});
27
+ _defineProperty(_assertThisInitialized(_this), "addrNameMap", {});
28
+ _defineProperty(_assertThisInitialized(_this), "addressOptions", []);
29
+ return _this;
30
+ }
31
+ _createClass(AddressData, null, [{
32
+ key: "getInstance",
33
+ value: function getInstance() {
34
+ if (!AddressData.instance) {
35
+ AddressData.instance = new AddressData();
36
+ }
37
+ return AddressData.instance;
38
+ }
39
+ }]);
40
+ return AddressData;
41
+ }(BaseAddressData);
42
+ _defineProperty(AddressData, "instance", void 0);
43
+ export { AddressData as default };
@@ -0,0 +1,10 @@
1
+ import BaseAddressData from "../baseAddressData";
2
+ import type { TreeOption } from "../type";
3
+ export default class BsAddressData extends BaseAddressData {
4
+ private static instance;
5
+ addrData: Record<string, [string, string | number]>;
6
+ addrNameMap: Record<string, string>;
7
+ addressOptions: TreeOption[];
8
+ static getInstance(): BsAddressData;
9
+ }
10
+ export declare type BsAddressDataClass = BsAddressData;
@@ -0,0 +1,43 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ 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
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
6
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
7
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
9
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
10
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
12
+ 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; }
13
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
+ 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); }
15
+ import BaseAddressData from "../baseAddressData";
16
+ var BsAddressData = /*#__PURE__*/function (_BaseAddressData) {
17
+ _inherits(BsAddressData, _BaseAddressData);
18
+ var _super = _createSuper(BsAddressData);
19
+ function BsAddressData() {
20
+ var _this;
21
+ _classCallCheck(this, BsAddressData);
22
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
23
+ args[_key] = arguments[_key];
24
+ }
25
+ _this = _super.call.apply(_super, [this].concat(args));
26
+ _defineProperty(_assertThisInitialized(_this), "addrData", {});
27
+ _defineProperty(_assertThisInitialized(_this), "addrNameMap", {});
28
+ _defineProperty(_assertThisInitialized(_this), "addressOptions", []);
29
+ return _this;
30
+ }
31
+ _createClass(BsAddressData, null, [{
32
+ key: "getInstance",
33
+ value: function getInstance() {
34
+ if (!BsAddressData.instance) {
35
+ BsAddressData.instance = new BsAddressData();
36
+ }
37
+ return BsAddressData.instance;
38
+ }
39
+ }]);
40
+ return BsAddressData;
41
+ }(BaseAddressData);
42
+ _defineProperty(BsAddressData, "instance", void 0);
43
+ export { BsAddressData as default };
@@ -0,0 +1,12 @@
1
+ import BaseAddressData from "../baseAddressData";
2
+ import type { TreeOption } from "../type";
3
+ export default class GyAddressData extends BaseAddressData {
4
+ private static instance;
5
+ private static initSingleton;
6
+ addrData: Record<string, [string, string | number]>;
7
+ addrNameMap: Record<string, string>;
8
+ addressOptions: TreeOption[];
9
+ static initData: () => Promise<GyAddressData>;
10
+ static getInstance(): GyAddressData;
11
+ }
12
+ export declare type GyAddressDataClass = GyAddressData;
@@ -0,0 +1,70 @@
1
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
2
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
3
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
+ 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); }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ 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); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
12
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
13
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
+ 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; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
+ 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); }
18
+ import BaseAddressData from "../baseAddressData";
19
+ import { queryGyAddressData } from "../../servers";
20
+ var GyAddressData = /*#__PURE__*/function (_BaseAddressData) {
21
+ _inherits(GyAddressData, _BaseAddressData);
22
+ var _super = _createSuper(GyAddressData);
23
+ function GyAddressData() {
24
+ var _this;
25
+ _classCallCheck(this, GyAddressData);
26
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
+ args[_key] = arguments[_key];
28
+ }
29
+ _this = _super.call.apply(_super, [this].concat(args));
30
+ _defineProperty(_assertThisInitialized(_this), "addrData", {});
31
+ _defineProperty(_assertThisInitialized(_this), "addrNameMap", {});
32
+ _defineProperty(_assertThisInitialized(_this), "addressOptions", []);
33
+ return _this;
34
+ }
35
+ _createClass(GyAddressData, null, [{
36
+ key: "getInstance",
37
+ value: function getInstance() {
38
+ if (!GyAddressData.instance) {
39
+ GyAddressData.instance = new GyAddressData();
40
+ }
41
+ return GyAddressData.instance;
42
+ }
43
+ }]);
44
+ return GyAddressData;
45
+ }(BaseAddressData);
46
+ _defineProperty(GyAddressData, "instance", void 0);
47
+ _defineProperty(GyAddressData, "initSingleton", void 0);
48
+ _defineProperty(GyAddressData, "initData", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
49
+ var instance;
50
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
51
+ while (1) switch (_context.prev = _context.next) {
52
+ case 0:
53
+ instance = GyAddressData.getInstance();
54
+ if (!GyAddressData.initSingleton) {
55
+ GyAddressData.initSingleton = queryGyAddressData().catch(function (e) {
56
+ console.warn("init gy data e", e);
57
+ GyAddressData.initSingleton = null;
58
+ });
59
+ }
60
+ _context.next = 4;
61
+ return GyAddressData.initSingleton;
62
+ case 4:
63
+ return _context.abrupt("return", instance);
64
+ case 5:
65
+ case "end":
66
+ return _context.stop();
67
+ }
68
+ }, _callee);
69
+ })));
70
+ export { GyAddressData as default };
@@ -0,0 +1,13 @@
1
+ import BaseAddressData from "../baseAddressData";
2
+ import type { TreeOption } from "../type";
3
+ export default class WdtAddressData extends BaseAddressData {
4
+ private static instance;
5
+ private static initSingleton;
6
+ addrData: Record<string, [string, string | number]>;
7
+ addrNameMap: Record<string, string>;
8
+ addressOptions: TreeOption[];
9
+ static initData: () => Promise<WdtAddressData>;
10
+ static getAddressOptions: () => Promise<TreeOption[]>;
11
+ static getInstance(): WdtAddressData;
12
+ }
13
+ export declare type WdtAddressDataClass = WdtAddressData;
@@ -2,87 +2,35 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
2
2
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
3
3
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
4
  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); }
5
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6
- 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); }
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; }
8
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
6
  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); } }
10
7
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
12
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
13
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
11
15
  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; }
12
16
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
17
  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); }
14
- import { isEmpty } from 'lodash';
15
- import { queryWdtAddressData } from "../servers";
16
- var WdtAddressData = /*#__PURE__*/function () {
18
+ import BaseAddressData from "../baseAddressData";
19
+ import { queryWdtAddressData } from "../../servers";
20
+ var WdtAddressData = /*#__PURE__*/function (_BaseAddressData) {
21
+ _inherits(WdtAddressData, _BaseAddressData);
22
+ var _super = _createSuper(WdtAddressData);
17
23
  function WdtAddressData() {
18
- var _this = this;
24
+ var _this;
19
25
  _classCallCheck(this, WdtAddressData);
20
- _defineProperty(this, "addrData", {});
21
- _defineProperty(this, "addrNameMap", {});
22
- _defineProperty(this, "addressOptions", []);
23
- _defineProperty(this, "parseData", function (addrCode) {
24
- var nameCode = {},
25
- arr = [];
26
- for (var key in _this.addrData) {
27
- if (Object.prototype.hasOwnProperty.call(_this.addrData, key)) {
28
- var valueArray = _this.addrData[key];
29
- if (valueArray[1] === Number(addrCode)) {
30
- nameCode[valueArray[0]] = key;
31
- arr.push({
32
- label: valueArray[0],
33
- value: key
34
- });
35
- }
36
- }
37
- }
38
- return arr;
39
- });
40
- _defineProperty(this, "getProvinceByCode", function (countryIndex) {
41
- return _this.parseData(countryIndex);
42
- });
43
- _defineProperty(this, "getCityByProCode", function (countryIndex) {
44
- return _this.parseData(countryIndex);
45
- });
46
- _defineProperty(this, "getAreaByCityCode", function (countryIndex) {
47
- return _this.parseData(countryIndex);
48
- });
49
- _defineProperty(this, "getProCodeByName", function (proName) {
50
- for (var key in _this.addrData) {
51
- if (_this.addrData[key][0] === proName) {
52
- return Number(key);
53
- }
54
- }
55
- });
56
- _defineProperty(this, "getCodesByNames", function (names) {
57
- var codes = [];
58
- var currentData = _this.addressOptions;
59
- var _iterator = _createForOfIteratorHelper(names),
60
- _step;
61
- try {
62
- var _loop = function _loop() {
63
- var name = _step.value;
64
- var foundChild = currentData.find(function (item) {
65
- return item.label === name;
66
- });
67
- codes.push(foundChild === null || foundChild === void 0 ? void 0 : foundChild.value); // 添加找到的 code
68
- if (!isEmpty(foundChild === null || foundChild === void 0 ? void 0 : foundChild.children)) {
69
- currentData = (foundChild === null || foundChild === void 0 ? void 0 : foundChild.children) || []; // 更新当前数据为找到的子节点
70
- }
71
- };
72
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
73
- _loop();
74
- }
75
- } catch (err) {
76
- _iterator.e(err);
77
- } finally {
78
- _iterator.f();
79
- }
80
- return codes; // 返回所有找到的 codes
81
- });
82
- _defineProperty(this, "getNameByCode", function (code) {
83
- var _ref;
84
- return (_ref = (_this.addrData || {})[code] || []) === null || _ref === void 0 ? void 0 : _ref[0];
85
- });
26
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
+ args[_key] = arguments[_key];
28
+ }
29
+ _this = _super.call.apply(_super, [this].concat(args));
30
+ _defineProperty(_assertThisInitialized(_this), "addrData", {});
31
+ _defineProperty(_assertThisInitialized(_this), "addrNameMap", {});
32
+ _defineProperty(_assertThisInitialized(_this), "addressOptions", []);
33
+ return _this;
86
34
  }
87
35
  _createClass(WdtAddressData, null, [{
88
36
  key: "getInstance",
@@ -94,7 +42,7 @@ var WdtAddressData = /*#__PURE__*/function () {
94
42
  }
95
43
  }]);
96
44
  return WdtAddressData;
97
- }();
45
+ }(BaseAddressData);
98
46
  _defineProperty(WdtAddressData, "instance", void 0);
99
47
  _defineProperty(WdtAddressData, "initSingleton", void 0);
100
48
  _defineProperty(WdtAddressData, "initData", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -105,7 +53,7 @@ _defineProperty(WdtAddressData, "initData", /*#__PURE__*/_asyncToGenerator( /*#_
105
53
  instance = WdtAddressData.getInstance();
106
54
  if (!WdtAddressData.initSingleton) {
107
55
  WdtAddressData.initSingleton = queryWdtAddressData().catch(function (e) {
108
- console.warn('init wdt data e', e);
56
+ console.warn("init wdt data e", e);
109
57
  WdtAddressData.initSingleton = null;
110
58
  });
111
59
  }
@@ -0,0 +1,4 @@
1
+ export { default as AddressData } from "./constants/addressData";
2
+ export { default as BsAddressData } from "./constants/bsAddressData";
3
+ export { default as WdtAddressData } from "./constants/wdtAddressData";
4
+ export { default as GyAddressData } from "./constants/gyAddressData";
@@ -0,0 +1,4 @@
1
+ export { default as AddressData } from "./constants/addressData";
2
+ export { default as BsAddressData } from "./constants/bsAddressData";
3
+ export { default as WdtAddressData } from "./constants/wdtAddressData";
4
+ export { default as GyAddressData } from "./constants/gyAddressData";
@@ -0,0 +1,5 @@
1
+ export interface TreeOption {
2
+ label: string;
3
+ value: string;
4
+ children?: TreeOption[];
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,13 +1,11 @@
1
1
  export { default as ExpressData } from "./expressData";
2
2
  export { default as ExpressInterceptData } from "./expressInterceptData";
3
- export { default as AddressData } from "./addressData";
4
- export { default as BsAddressData } from "./bsAddressData";
5
- export { default as WdtAddressData } from "./wdtAddressData";
6
3
  export { default as PlatData } from "./platData";
7
4
  export { default as LogisticsAddressData } from "./logisticsAddressData";
8
5
  export { default as LabelData } from "./labelData";
9
6
  export { default as request } from "./request";
10
7
  export * as servers from "./servers";
8
+ export * from "./baseAddressData";
11
9
  export * from "./utils";
12
10
  export * from "./constants";
13
11
  export { SendDataCenter } from "./utils/SendData";
package/dist/esm/index.js CHANGED
@@ -1,14 +1,12 @@
1
1
  export { default as ExpressData } from "./expressData";
2
2
  export { default as ExpressInterceptData } from "./expressInterceptData";
3
- export { default as AddressData } from "./addressData";
4
- export { default as BsAddressData } from "./bsAddressData";
5
- export { default as WdtAddressData } from "./wdtAddressData";
6
3
  export { default as PlatData } from "./platData";
7
4
  export { default as LogisticsAddressData } from "./logisticsAddressData";
8
5
  export { default as LabelData } from "./labelData";
9
6
  export { default as request } from "./request";
10
7
  import * as _servers from "./servers";
11
8
  export { _servers as servers };
9
+ export * from "./baseAddressData";
12
10
  export * from "./utils";
13
11
  export * from "./constants";
14
12
  export { SendDataCenter } from "./utils/SendData";
@@ -0,0 +1 @@
1
+ export * from './warehouseData';
@@ -0,0 +1 @@
1
+ export * from "./warehouseData";
@@ -0,0 +1,7 @@
1
+ declare type WarehouseType = {
2
+ disabled: boolean;
3
+ label: string;
4
+ value: string;
5
+ };
6
+ export declare const getWarehouseDataAsync: () => Promise<WarehouseType[]>;
7
+ export default getWarehouseDataAsync;
@@ -0,0 +1,33 @@
1
+ import { fetchAll } from "../../utils";
2
+ import request from "../../request";
3
+ var queryWarehouseList = function queryWarehouseList(_ref) {
4
+ var pageNo = _ref.pageNo,
5
+ pageSize = _ref.pageSize;
6
+ return request({
7
+ url: "/qy/gdfw/gy/erp/getWarehouseList",
8
+ method: "post",
9
+ data: {
10
+ pageNo: pageNo,
11
+ pageSize: pageSize,
12
+ hasDeletedData: true
13
+ }
14
+ });
15
+ };
16
+ export var getWarehouseDataAsync = function getWarehouseDataAsync() {
17
+ return fetchAll("GY_WAREHOUSE_DATA", queryWarehouseList, function (data) {
18
+ var list = [];
19
+ var warehouses = data || [];
20
+ warehouses.map(function (_ref2) {
21
+ var code = _ref2.code,
22
+ name = _ref2.name,
23
+ isDeleted = _ref2.isDeleted;
24
+ list.push({
25
+ label: name,
26
+ value: code,
27
+ disabled: isDeleted
28
+ });
29
+ });
30
+ return list;
31
+ });
32
+ };
33
+ export default getWarehouseDataAsync;