@kmkf-fe-packages/basic-components 0.24.0-alpha.1 → 0.24.0-alpha.6

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/index.esm.js CHANGED
@@ -3,7 +3,7 @@ import { Cascader, DatePicker, InputNumber, Input, Select, Upload, Image, messag
3
3
  import { EyeOutlined, DeleteOutlined } from '@ant-design/icons';
4
4
  import request, { extend as extend$1 } from 'umi-request';
5
5
  import { CopyToClipboard } from 'react-copy-to-clipboard';
6
- import { AddressData, BsAddressData, request as request$1, ExpressData, LogisticsAddressData, uuid } from '@kmkf-fe-packages/kmkf-utils';
6
+ import { AddressData, BsAddressData, toTree, request as request$1, ExpressData, LogisticsAddressData, uuid } from '@kmkf-fe-packages/kmkf-utils';
7
7
  import zhCN from 'antd/lib/locale/zh_CN';
8
8
  import { cloneDeep } from 'lodash';
9
9
  import { useDebounceEffect } from 'ahooks';
@@ -7358,11 +7358,12 @@ function ApaasRate(props) {
7358
7358
  }));
7359
7359
  }
7360
7360
 
7361
- AddressData.getInstance();
7362
- BsAddressData.getInstance();
7361
+ var addressData = AddressData.getInstance();
7362
+ var bsAddressData = BsAddressData.getInstance();
7363
7363
  var Province = function Province(props) {
7364
7364
  var _props$type = props.type,
7365
- type = _props$type === void 0 ? 'workOrder' : _props$type;
7365
+ type = _props$type === void 0 ? 'workOrder' : _props$type,
7366
+ value = props.value;
7366
7367
  var _useState = useState([]),
7367
7368
  _useState2 = _slicedToArray(_useState, 2),
7368
7369
  option = _useState2[0],
@@ -7377,7 +7378,7 @@ var Province = function Province(props) {
7377
7378
  while (1) switch (_context.prev = _context.next) {
7378
7379
  case 0:
7379
7380
  num++;
7380
- options = type !== 'bs' ? AddressData.getInstance().addressOptions || [] : BsAddressData.getInstance().addressOptions || [];
7381
+ options = type !== 'bs' ? addressData.addressOptions || [] : bsAddressData.addressOptions || [];
7381
7382
  if (!(options === null || options === void 0 ? void 0 : options.length) && num < 6) {
7382
7383
  time.current = setTimeout(function () {
7383
7384
  initPageSource();
@@ -7394,6 +7395,19 @@ var Province = function Province(props) {
7394
7395
  return _ref.apply(this, arguments);
7395
7396
  };
7396
7397
  }();
7398
+ var getBsAddress = function getBsAddress() {
7399
+ var data = JSON.parse(localStorage.getItem('bsAddressData') || '[]');
7400
+ if (data.length) {
7401
+ var options = toTree(data, 1);
7402
+ setOptions(options);
7403
+ }
7404
+ };
7405
+ //如果值改变地址不存在则再获取一遍
7406
+ useEffect(function () {
7407
+ if (value && type == 'bs' && !option.length) {
7408
+ getBsAddress();
7409
+ }
7410
+ }, [value, type, option]);
7397
7411
  useEffect(function () {
7398
7412
  if (!isFirst.current) {
7399
7413
  initPageSource();
@@ -7715,10 +7729,7 @@ var ShopNameSelect = function ShopNameSelect(props) {
7715
7729
  function ApaasAddress(props) {
7716
7730
  var value = props.value,
7717
7731
  onChange = props.onChange,
7718
- disabled = props.disabled,
7719
- _props$showIdentify = props.showIdentify,
7720
- showIdentify = _props$showIdentify === void 0 ? true : _props$showIdentify,
7721
- type = props.type;
7732
+ disabled = props.disabled;
7722
7733
  var changeCity = function changeCity(city) {
7723
7734
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
7724
7735
  address: city
@@ -7730,20 +7741,7 @@ function ApaasAddress(props) {
7730
7741
  detail: e.target.value
7731
7742
  });
7732
7743
  };
7733
- var handleParseLogistics = function handleParseLogistics(val) {
7734
- var params = {
7735
- detail: val === null || val === void 0 ? void 0 : val.addressDetail,
7736
- address: []
7737
- };
7738
- var addressData = type === 'bs' ? BsAddressData.getInstance() : AddressData.getInstance();
7739
- if ((val === null || val === void 0 ? void 0 : val.province) && addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.province)) {
7740
- params.address = [addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.province), addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.city), addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.district)];
7741
- }
7742
- onChange === null || onChange === void 0 ? void 0 : onChange(params);
7743
- };
7744
- return /*#__PURE__*/React.createElement(React.Fragment, null, !disabled && showIdentify && /*#__PURE__*/React.createElement(ParseLogistics, {
7745
- onChange: handleParseLogistics
7746
- }), /*#__PURE__*/React.createElement(Province, {
7744
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Province, {
7747
7745
  value: value === null || value === void 0 ? void 0 : value.address,
7748
7746
  onChange: changeCity,
7749
7747
  disabled: disabled
package/dist/index.js CHANGED
@@ -7369,11 +7369,12 @@ function ApaasRate(props) {
7369
7369
  }));
7370
7370
  }
7371
7371
 
7372
- kmkfUtils.AddressData.getInstance();
7373
- kmkfUtils.BsAddressData.getInstance();
7372
+ var addressData = kmkfUtils.AddressData.getInstance();
7373
+ var bsAddressData = kmkfUtils.BsAddressData.getInstance();
7374
7374
  var Province = function Province(props) {
7375
7375
  var _props$type = props.type,
7376
- type = _props$type === void 0 ? 'workOrder' : _props$type;
7376
+ type = _props$type === void 0 ? 'workOrder' : _props$type,
7377
+ value = props.value;
7377
7378
  var _useState = React.useState([]),
7378
7379
  _useState2 = _slicedToArray(_useState, 2),
7379
7380
  option = _useState2[0],
@@ -7388,7 +7389,7 @@ var Province = function Province(props) {
7388
7389
  while (1) switch (_context.prev = _context.next) {
7389
7390
  case 0:
7390
7391
  num++;
7391
- options = type !== 'bs' ? kmkfUtils.AddressData.getInstance().addressOptions || [] : kmkfUtils.BsAddressData.getInstance().addressOptions || [];
7392
+ options = type !== 'bs' ? addressData.addressOptions || [] : bsAddressData.addressOptions || [];
7392
7393
  if (!(options === null || options === void 0 ? void 0 : options.length) && num < 6) {
7393
7394
  time.current = setTimeout(function () {
7394
7395
  initPageSource();
@@ -7405,6 +7406,19 @@ var Province = function Province(props) {
7405
7406
  return _ref.apply(this, arguments);
7406
7407
  };
7407
7408
  }();
7409
+ var getBsAddress = function getBsAddress() {
7410
+ var data = JSON.parse(localStorage.getItem('bsAddressData') || '[]');
7411
+ if (data.length) {
7412
+ var options = kmkfUtils.toTree(data, 1);
7413
+ setOptions(options);
7414
+ }
7415
+ };
7416
+ //如果值改变地址不存在则再获取一遍
7417
+ React.useEffect(function () {
7418
+ if (value && type == 'bs' && !option.length) {
7419
+ getBsAddress();
7420
+ }
7421
+ }, [value, type, option]);
7408
7422
  React.useEffect(function () {
7409
7423
  if (!isFirst.current) {
7410
7424
  initPageSource();
@@ -7726,10 +7740,7 @@ var ShopNameSelect = function ShopNameSelect(props) {
7726
7740
  function ApaasAddress(props) {
7727
7741
  var value = props.value,
7728
7742
  onChange = props.onChange,
7729
- disabled = props.disabled,
7730
- _props$showIdentify = props.showIdentify,
7731
- showIdentify = _props$showIdentify === void 0 ? true : _props$showIdentify,
7732
- type = props.type;
7743
+ disabled = props.disabled;
7733
7744
  var changeCity = function changeCity(city) {
7734
7745
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
7735
7746
  address: city
@@ -7741,20 +7752,7 @@ function ApaasAddress(props) {
7741
7752
  detail: e.target.value
7742
7753
  });
7743
7754
  };
7744
- var handleParseLogistics = function handleParseLogistics(val) {
7745
- var params = {
7746
- detail: val === null || val === void 0 ? void 0 : val.addressDetail,
7747
- address: []
7748
- };
7749
- var addressData = type === 'bs' ? kmkfUtils.BsAddressData.getInstance() : kmkfUtils.AddressData.getInstance();
7750
- if ((val === null || val === void 0 ? void 0 : val.province) && addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.province)) {
7751
- params.address = [addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.province), addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.city), addressData.getProCodeByName(val === null || val === void 0 ? void 0 : val.district)];
7752
- }
7753
- onChange === null || onChange === void 0 ? void 0 : onChange(params);
7754
- };
7755
- return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, !disabled && showIdentify && /*#__PURE__*/React__default['default'].createElement(ParseLogistics, {
7756
- onChange: handleParseLogistics
7757
- }), /*#__PURE__*/React__default['default'].createElement(Province, {
7755
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(Province, {
7758
7756
  value: value === null || value === void 0 ? void 0 : value.address,
7759
7757
  onChange: changeCity,
7760
7758
  disabled: disabled
@@ -6,8 +6,6 @@ interface valueType {
6
6
  export interface AddressType {
7
7
  value: valueType;
8
8
  disabled: boolean;
9
- showIdentify?: boolean;
10
- type?: string;
11
9
  onChange: (value: valueType) => void;
12
10
  [key: string]: any;
13
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.24.0-alpha.1",
3
+ "version": "0.24.0-alpha.6",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -20,7 +20,7 @@
20
20
  "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "^0.24.0-alpha.0",
23
+ "@kmkf-fe-packages/kmkf-utils": "^0.24.0-alpha.6",
24
24
  "ahooks": "^3.7.4",
25
25
  "lodash": "^4.17.21",
26
26
  "pubsub-js": "^1.9.4",
@@ -62,5 +62,5 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "265ad70e00afb81994f410ebe9bd77fb57b520b6"
65
+ "gitHead": "6e3d1a99ef237be68f0bb97ca9b597a594a02a68"
66
66
  }