@kmkf-fe-packages/basic-components 0.26.1-beta.1 → 0.26.1-beta.11

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, CloseCircleOutlined, CaretUpOutlined } 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, WdtAddressData, toTree, request as request$1, ExpressData, uuid, LogisticsAddressData, WDT_ORDER_TYPE_MAP } from '@kmkf-fe-packages/kmkf-utils';
6
+ import { AddressData, BsAddressData, WdtAddressData, request as request$1, ExpressData, uuid, LogisticsAddressData, WDT_ORDER_TYPE_MAP } from '@kmkf-fe-packages/kmkf-utils';
7
7
  import zhCN from 'antd/lib/locale/zh_CN';
8
8
  import { cloneDeep, difference, differenceWith } from 'lodash';
9
9
  import { useDebounceEffect } from 'ahooks';
@@ -7377,75 +7377,17 @@ function ApaasRate(props) {
7377
7377
  }));
7378
7378
  }
7379
7379
 
7380
- var addressData = AddressData.getInstance();
7381
- var bsAddressData = BsAddressData.getInstance();
7382
- var wdtAddressData = WdtAddressData.getInstance();
7383
7380
  var Province = function Province(props) {
7381
+ var _mapping$type;
7384
7382
  var _props$type = props.type,
7385
- type = _props$type === void 0 ? 'workOrder' : _props$type,
7386
- value = props.value;
7387
- var _useState = useState([]),
7388
- _useState2 = _slicedToArray(_useState, 2),
7389
- option = _useState2[0],
7390
- setOptions = _useState2[1];
7391
- var num = 0;
7392
- var isFirst = useRef(false);
7393
- var time = useRef();
7394
- var initPageSource = /*#__PURE__*/function () {
7395
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7396
- var options;
7397
- return _regeneratorRuntime().wrap(function _callee$(_context) {
7398
- while (1) switch (_context.prev = _context.next) {
7399
- case 0:
7400
- num++;
7401
- options = ({
7402
- bs: bsAddressData,
7403
- wdt: wdtAddressData,
7404
- workOrder: addressData
7405
- }[type] || addressData).addressOptions || [];
7406
- if (!(options === null || options === void 0 ? void 0 : options.length) && num < 6) {
7407
- getBsAddress();
7408
- time.current = setTimeout(function () {
7409
- initPageSource();
7410
- }, 1000);
7411
- }
7412
- if (options.length) {
7413
- setOptions(options);
7414
- }
7415
- case 4:
7416
- case "end":
7417
- return _context.stop();
7418
- }
7419
- }, _callee);
7420
- }));
7421
- return function initPageSource() {
7422
- return _ref.apply(this, arguments);
7423
- };
7424
- }();
7425
- var getBsAddress = function getBsAddress() {
7426
- var data = JSON.parse(localStorage.getItem('bsAddressData') || '[]');
7427
- if (data.length) {
7428
- var options = toTree(data, 1);
7429
- setOptions(options);
7430
- }
7383
+ type = _props$type === void 0 ? 'workOrder' : _props$type;
7384
+ var mapping = {
7385
+ workOrder: AddressData.getInstance(),
7386
+ bs: BsAddressData.getInstance(),
7387
+ wdt: WdtAddressData.getInstance()
7431
7388
  };
7432
- //如果值改变地址不存在则再获取一遍
7433
- useEffect(function () {
7434
- if (value && type == 'bs' && !option.length) {
7435
- getBsAddress();
7436
- }
7437
- }, [value, type, option]);
7438
- useEffect(function () {
7439
- if (!isFirst.current) {
7440
- initPageSource();
7441
- isFirst.current = true;
7442
- }
7443
- return function () {
7444
- clearTimeout(time.current);
7445
- };
7446
- }, []);
7447
7389
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Cascader, _objectSpread2(_objectSpread2({}, props), {}, {
7448
- options: option,
7390
+ options: ((_mapping$type = mapping[type]) === null || _mapping$type === void 0 ? void 0 : _mapping$type.addressOptions) || [],
7449
7391
  style: {
7450
7392
  minWidth: '100px'
7451
7393
  },
@@ -7622,7 +7564,6 @@ function ApaasPosting(props) {
7622
7564
  }
7623
7565
 
7624
7566
  var _excluded$a = ["value", "onChange"];
7625
- var express = ExpressData.getInstance();
7626
7567
  function ApaasLogistics(props) {
7627
7568
  var value = props.value,
7628
7569
  onChange = props.onChange,
@@ -7634,11 +7575,13 @@ function ApaasLogistics(props) {
7634
7575
  var isFirst = useRef(false);
7635
7576
  var initPageSource = /*#__PURE__*/function () {
7636
7577
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7578
+ var express;
7637
7579
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7638
7580
  while (1) switch (_context.prev = _context.next) {
7639
7581
  case 0:
7582
+ express = ExpressData.getInstance();
7640
7583
  setOptions(express.expressData || []);
7641
- case 1:
7584
+ case 2:
7642
7585
  case "end":
7643
7586
  return _context.stop();
7644
7587
  }
@@ -10075,16 +10018,11 @@ var LogisticsMoreInterception = function LogisticsMoreInterception(props) {
10075
10018
  return setChangeIndex(index);
10076
10019
  }
10077
10020
  }, "\u5305\u88F9".concat(index + 1), !disabled ? /*#__PURE__*/React.createElement(CloseCircleOutlined, {
10078
- style: {
10079
- position: 'absolute',
10080
- right: '-7px',
10081
- top: '-10px'
10082
- },
10083
10021
  onClick: function onClick(e) {
10084
10022
  return handleDelete(e, index);
10085
10023
  }
10086
10024
  }) : null));
10087
- }) : null), value.length > 1 ? (value || []).map(function (item, index) {
10025
+ }) : null), value.length ? (value || []).map(function (item, index) {
10088
10026
  return changeIndex === index ? /*#__PURE__*/React.createElement(LogisticsInterception, {
10089
10027
  key: "logistics-".concat(index),
10090
10028
  required: required,
package/dist/index.js CHANGED
@@ -7388,75 +7388,17 @@ function ApaasRate(props) {
7388
7388
  }));
7389
7389
  }
7390
7390
 
7391
- var addressData = kmkfUtils.AddressData.getInstance();
7392
- var bsAddressData = kmkfUtils.BsAddressData.getInstance();
7393
- var wdtAddressData = kmkfUtils.WdtAddressData.getInstance();
7394
7391
  var Province = function Province(props) {
7392
+ var _mapping$type;
7395
7393
  var _props$type = props.type,
7396
- type = _props$type === void 0 ? 'workOrder' : _props$type,
7397
- value = props.value;
7398
- var _useState = React.useState([]),
7399
- _useState2 = _slicedToArray(_useState, 2),
7400
- option = _useState2[0],
7401
- setOptions = _useState2[1];
7402
- var num = 0;
7403
- var isFirst = React.useRef(false);
7404
- var time = React.useRef();
7405
- var initPageSource = /*#__PURE__*/function () {
7406
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7407
- var options;
7408
- return _regeneratorRuntime().wrap(function _callee$(_context) {
7409
- while (1) switch (_context.prev = _context.next) {
7410
- case 0:
7411
- num++;
7412
- options = ({
7413
- bs: bsAddressData,
7414
- wdt: wdtAddressData,
7415
- workOrder: addressData
7416
- }[type] || addressData).addressOptions || [];
7417
- if (!(options === null || options === void 0 ? void 0 : options.length) && num < 6) {
7418
- getBsAddress();
7419
- time.current = setTimeout(function () {
7420
- initPageSource();
7421
- }, 1000);
7422
- }
7423
- if (options.length) {
7424
- setOptions(options);
7425
- }
7426
- case 4:
7427
- case "end":
7428
- return _context.stop();
7429
- }
7430
- }, _callee);
7431
- }));
7432
- return function initPageSource() {
7433
- return _ref.apply(this, arguments);
7434
- };
7435
- }();
7436
- var getBsAddress = function getBsAddress() {
7437
- var data = JSON.parse(localStorage.getItem('bsAddressData') || '[]');
7438
- if (data.length) {
7439
- var options = kmkfUtils.toTree(data, 1);
7440
- setOptions(options);
7441
- }
7394
+ type = _props$type === void 0 ? 'workOrder' : _props$type;
7395
+ var mapping = {
7396
+ workOrder: kmkfUtils.AddressData.getInstance(),
7397
+ bs: kmkfUtils.BsAddressData.getInstance(),
7398
+ wdt: kmkfUtils.WdtAddressData.getInstance()
7442
7399
  };
7443
- //如果值改变地址不存在则再获取一遍
7444
- React.useEffect(function () {
7445
- if (value && type == 'bs' && !option.length) {
7446
- getBsAddress();
7447
- }
7448
- }, [value, type, option]);
7449
- React.useEffect(function () {
7450
- if (!isFirst.current) {
7451
- initPageSource();
7452
- isFirst.current = true;
7453
- }
7454
- return function () {
7455
- clearTimeout(time.current);
7456
- };
7457
- }, []);
7458
7400
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Cascader, _objectSpread2(_objectSpread2({}, props), {}, {
7459
- options: option,
7401
+ options: ((_mapping$type = mapping[type]) === null || _mapping$type === void 0 ? void 0 : _mapping$type.addressOptions) || [],
7460
7402
  style: {
7461
7403
  minWidth: '100px'
7462
7404
  },
@@ -7633,7 +7575,6 @@ function ApaasPosting(props) {
7633
7575
  }
7634
7576
 
7635
7577
  var _excluded$a = ["value", "onChange"];
7636
- var express = kmkfUtils.ExpressData.getInstance();
7637
7578
  function ApaasLogistics(props) {
7638
7579
  var value = props.value,
7639
7580
  onChange = props.onChange,
@@ -7645,11 +7586,13 @@ function ApaasLogistics(props) {
7645
7586
  var isFirst = React.useRef(false);
7646
7587
  var initPageSource = /*#__PURE__*/function () {
7647
7588
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7589
+ var express;
7648
7590
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7649
7591
  while (1) switch (_context.prev = _context.next) {
7650
7592
  case 0:
7593
+ express = kmkfUtils.ExpressData.getInstance();
7651
7594
  setOptions(express.expressData || []);
7652
- case 1:
7595
+ case 2:
7653
7596
  case "end":
7654
7597
  return _context.stop();
7655
7598
  }
@@ -10086,16 +10029,11 @@ var LogisticsMoreInterception = function LogisticsMoreInterception(props) {
10086
10029
  return setChangeIndex(index);
10087
10030
  }
10088
10031
  }, "\u5305\u88F9".concat(index + 1), !disabled ? /*#__PURE__*/React__default['default'].createElement(icons.CloseCircleOutlined, {
10089
- style: {
10090
- position: 'absolute',
10091
- right: '-7px',
10092
- top: '-10px'
10093
- },
10094
10032
  onClick: function onClick(e) {
10095
10033
  return handleDelete(e, index);
10096
10034
  }
10097
10035
  }) : null));
10098
- }) : null), value.length > 1 ? (value || []).map(function (item, index) {
10036
+ }) : null), value.length ? (value || []).map(function (item, index) {
10099
10037
  return changeIndex === index ? /*#__PURE__*/React__default['default'].createElement(LogisticsInterception, {
10100
10038
  key: "logistics-".concat(index),
10101
10039
  required: required,
@@ -3,7 +3,7 @@ interface ProvinceType {
3
3
  value: string[];
4
4
  disabled: boolean;
5
5
  onChange: (value: any, selectedOptions: any) => void;
6
- type?: string;
6
+ type?: 'workOrder' | 'bs' | 'wdt';
7
7
  }
8
8
  declare const Province: (props: Partial<ProvinceType>) => React.JSX.Element;
9
9
  export default Province;
@@ -9,7 +9,7 @@ interface ApaasPostingProps {
9
9
  value: Partial<PostingValueType>;
10
10
  disabled: boolean;
11
11
  onChange: (val: any) => void;
12
- type?: string;
12
+ type?: 'workOrder' | 'bs' | 'wdt';
13
13
  }
14
14
  declare function ApaasPosting(props: Partial<ApaasPostingProps>): React.JSX.Element;
15
15
  export default ApaasPosting;
@@ -9,7 +9,7 @@ interface IdentifyAddressProps {
9
9
  onChange: (value: any) => void;
10
10
  disabled?: boolean;
11
11
  showIdentify?: boolean;
12
- type?: string;
12
+ type?: 'workOrder' | 'bs' | 'wdt';
13
13
  }
14
14
  declare const IdentifyAddress: (props: IdentifyAddressProps) => React.JSX.Element;
15
15
  export default IdentifyAddress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.26.1-beta.1",
3
+ "version": "0.26.1-beta.11",
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.26.1-beta.1",
23
+ "@kmkf-fe-packages/kmkf-utils": "^0.26.1-beta.11",
24
24
  "ahooks": "^3.7.4",
25
25
  "kmkf-monitor": "^0.8.8",
26
26
  "lodash": "^4.17.21",
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "1c8d441453e71ad13b9f3d52f25bcd6d6b2a3635"
67
+ "gitHead": "16d58155a74ffcd52ad2e65535cf1f63e4ff789c"
68
68
  }