@kmkf-fe-packages/basic-components 2.0.54-beta.66 → 2.0.54-beta.67

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
@@ -20583,9 +20583,10 @@ var MsgStatus = function MsgStatus(props) {
20583
20583
  }, "\u5931\u8D25\u539F\u56E0\uFF1A", (_value$changeIndex3 = value[changeIndex]) === null || _value$changeIndex3 === void 0 ? void 0 : _value$changeIndex3.reason) : null) : null);
20584
20584
  };
20585
20585
 
20586
- var _excluded$n = ["showOnly", "getOptionsAsync"];
20586
+ var _excluded$n = ["mode", "showOnly", "getOptionsAsync"];
20587
20587
  var AsyncSelect = function AsyncSelect(props) {
20588
- var _props$showOnly = props.showOnly,
20588
+ var mode = props.mode,
20589
+ _props$showOnly = props.showOnly,
20589
20590
  showOnly = _props$showOnly === void 0 ? false : _props$showOnly,
20590
20591
  getOptionsAsync = props.getOptionsAsync,
20591
20592
  otherProps = _objectWithoutProperties(props, _excluded$n);
@@ -20599,11 +20600,24 @@ var AsyncSelect = function AsyncSelect(props) {
20599
20600
  });
20600
20601
  }, []);
20601
20602
  var options = [].concat(_toConsumableArray(props.options || []), _toConsumableArray(data || []));
20603
+ var getValueString = function getValueString(value) {
20604
+ var list = options;
20605
+ if (!mode) {
20606
+ var selectedItem = list.find(function (item) {
20607
+ return item.value === value;
20608
+ });
20609
+ return selectedItem ? selectedItem.label : value !== null && value !== void 0 ? value : '--';
20610
+ } else if (mode === 'multiple' && Array.isArray(value)) {
20611
+ var _list$filter$map$join;
20612
+ return (_list$filter$map$join = list.filter(function (item) {
20613
+ return value.includes(item.value);
20614
+ }).map(function (item) {
20615
+ return item.label;
20616
+ }).join(',')) !== null && _list$filter$map$join !== void 0 ? _list$filter$map$join : '--';
20617
+ }
20618
+ };
20602
20619
  if (showOnly) {
20603
- var selectedItem = options.find(function (option) {
20604
- return option.value === props.value;
20605
- });
20606
- return selectedItem ? selectedItem.label : props.value;
20620
+ return getValueString(props.value);
20607
20621
  }
20608
20622
  return /*#__PURE__*/React.createElement(Select, _objectSpread2(_objectSpread2({
20609
20623
  showSearch: true,
@@ -20612,7 +20626,8 @@ var AsyncSelect = function AsyncSelect(props) {
20612
20626
  },
20613
20627
  notFoundContent: null
20614
20628
  }, otherProps), {}, {
20615
- options: options
20629
+ options: options,
20630
+ mode: mode
20616
20631
  }));
20617
20632
  };
20618
20633
 
package/dist/index.js CHANGED
@@ -20595,9 +20595,10 @@ var MsgStatus = function MsgStatus(props) {
20595
20595
  }, "\u5931\u8D25\u539F\u56E0\uFF1A", (_value$changeIndex3 = value[changeIndex]) === null || _value$changeIndex3 === void 0 ? void 0 : _value$changeIndex3.reason) : null) : null);
20596
20596
  };
20597
20597
 
20598
- var _excluded$n = ["showOnly", "getOptionsAsync"];
20598
+ var _excluded$n = ["mode", "showOnly", "getOptionsAsync"];
20599
20599
  var AsyncSelect = function AsyncSelect(props) {
20600
- var _props$showOnly = props.showOnly,
20600
+ var mode = props.mode,
20601
+ _props$showOnly = props.showOnly,
20601
20602
  showOnly = _props$showOnly === void 0 ? false : _props$showOnly,
20602
20603
  getOptionsAsync = props.getOptionsAsync,
20603
20604
  otherProps = _objectWithoutProperties(props, _excluded$n);
@@ -20611,11 +20612,24 @@ var AsyncSelect = function AsyncSelect(props) {
20611
20612
  });
20612
20613
  }, []);
20613
20614
  var options = [].concat(_toConsumableArray(props.options || []), _toConsumableArray(data || []));
20615
+ var getValueString = function getValueString(value) {
20616
+ var list = options;
20617
+ if (!mode) {
20618
+ var selectedItem = list.find(function (item) {
20619
+ return item.value === value;
20620
+ });
20621
+ return selectedItem ? selectedItem.label : value !== null && value !== void 0 ? value : '--';
20622
+ } else if (mode === 'multiple' && Array.isArray(value)) {
20623
+ var _list$filter$map$join;
20624
+ return (_list$filter$map$join = list.filter(function (item) {
20625
+ return value.includes(item.value);
20626
+ }).map(function (item) {
20627
+ return item.label;
20628
+ }).join(',')) !== null && _list$filter$map$join !== void 0 ? _list$filter$map$join : '--';
20629
+ }
20630
+ };
20614
20631
  if (showOnly) {
20615
- var selectedItem = options.find(function (option) {
20616
- return option.value === props.value;
20617
- });
20618
- return selectedItem ? selectedItem.label : props.value;
20632
+ return getValueString(props.value);
20619
20633
  }
20620
20634
  return /*#__PURE__*/React__default['default'].createElement(antd.Select, _objectSpread2(_objectSpread2({
20621
20635
  showSearch: true,
@@ -20624,7 +20638,8 @@ var AsyncSelect = function AsyncSelect(props) {
20624
20638
  },
20625
20639
  notFoundContent: null
20626
20640
  }, otherProps), {}, {
20627
- options: options
20641
+ options: options,
20642
+ mode: mode
20628
20643
  }));
20629
20644
  };
20630
20645
 
@@ -1,5 +1,6 @@
1
1
  import { SelectProps } from 'antd';
2
2
  declare const AsyncSelect: (props: SelectProps & {
3
+ mode: string;
3
4
  showOnly?: boolean;
4
5
  getOptionsAsync?: () => Promise<Required<SelectProps>['options']>;
5
6
  }) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "2.0.54-beta.66",
3
+ "version": "2.0.54-beta.67",
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": "2.0.54-beta.66",
23
+ "@kmkf-fe-packages/kmkf-utils": "2.0.54-beta.67",
24
24
  "ahooks": "^3.7.4",
25
25
  "bignumber.js": "^9.1.2",
26
26
  "kmkf-monitor": "^0.8.9",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "e4bfdc5da169d200052e3c17d406c6b1c863f312"
68
+ "gitHead": "f1dfe723fbe0b192aca04dcad94323cc87bfaa57"
69
69
  }