@kmkf-fe-packages/basic-components 2.0.54-beta.71 → 2.0.54-beta.72
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 +18 -8
- package/dist/index.js +18 -8
- package/dist/src/common/AsyncSelect/index.d.ts +5 -3
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -20583,12 +20583,14 @@ 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 = ["mode", "showOnly", "getOptionsAsync"];
|
|
20586
|
+
var _excluded$n = ["mode", "maxSelectCount", "showOnly", "getOptionsAsync", "onChange"];
|
|
20587
20587
|
var AsyncSelect = function AsyncSelect(props) {
|
|
20588
20588
|
var mode = props.mode,
|
|
20589
|
+
maxSelectCount = props.maxSelectCount,
|
|
20589
20590
|
_props$showOnly = props.showOnly,
|
|
20590
20591
|
showOnly = _props$showOnly === void 0 ? false : _props$showOnly,
|
|
20591
20592
|
getOptionsAsync = props.getOptionsAsync,
|
|
20593
|
+
_onChange = props.onChange,
|
|
20592
20594
|
otherProps = _objectWithoutProperties(props, _excluded$n);
|
|
20593
20595
|
var _React$useState = React.useState([]),
|
|
20594
20596
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -20602,24 +20604,25 @@ var AsyncSelect = function AsyncSelect(props) {
|
|
|
20602
20604
|
var options = [].concat(_toConsumableArray(props.options || []), _toConsumableArray(data || []));
|
|
20603
20605
|
var getValueString = function getValueString(value) {
|
|
20604
20606
|
var list = options;
|
|
20605
|
-
if (
|
|
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)) {
|
|
20607
|
+
if (mode === 'multiple' && Array.isArray(value)) {
|
|
20611
20608
|
var _list$filter$map$join;
|
|
20612
20609
|
return (_list$filter$map$join = list.filter(function (item) {
|
|
20613
20610
|
return value.includes(item.value);
|
|
20614
20611
|
}).map(function (item) {
|
|
20615
20612
|
return item.label;
|
|
20616
20613
|
}).join(',')) !== null && _list$filter$map$join !== void 0 ? _list$filter$map$join : '--';
|
|
20614
|
+
} else {
|
|
20615
|
+
var selectedItem = list.find(function (item) {
|
|
20616
|
+
return item.value === value;
|
|
20617
|
+
});
|
|
20618
|
+
return selectedItem ? selectedItem.label : value !== null && value !== void 0 ? value : '--';
|
|
20617
20619
|
}
|
|
20618
20620
|
};
|
|
20619
20621
|
if (showOnly) {
|
|
20620
20622
|
return getValueString(props.value);
|
|
20621
20623
|
}
|
|
20622
20624
|
return /*#__PURE__*/React.createElement(Select, _objectSpread2(_objectSpread2({
|
|
20625
|
+
showArrow: true,
|
|
20623
20626
|
showSearch: true,
|
|
20624
20627
|
filterOption: function filterOption(input, option) {
|
|
20625
20628
|
return option.label.includes(input);
|
|
@@ -20627,7 +20630,14 @@ var AsyncSelect = function AsyncSelect(props) {
|
|
|
20627
20630
|
notFoundContent: null
|
|
20628
20631
|
}, otherProps), {}, {
|
|
20629
20632
|
options: options,
|
|
20630
|
-
mode: mode
|
|
20633
|
+
mode: mode,
|
|
20634
|
+
onChange: function onChange(value, option) {
|
|
20635
|
+
if (mode === 'multiple' && maxSelectCount && maxSelectCount < value.length) {
|
|
20636
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(value.slice(-maxSelectCount), option);
|
|
20637
|
+
} else {
|
|
20638
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(value, option);
|
|
20639
|
+
}
|
|
20640
|
+
}
|
|
20631
20641
|
}));
|
|
20632
20642
|
};
|
|
20633
20643
|
|
package/dist/index.js
CHANGED
|
@@ -20595,12 +20595,14 @@ 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 = ["mode", "showOnly", "getOptionsAsync"];
|
|
20598
|
+
var _excluded$n = ["mode", "maxSelectCount", "showOnly", "getOptionsAsync", "onChange"];
|
|
20599
20599
|
var AsyncSelect = function AsyncSelect(props) {
|
|
20600
20600
|
var mode = props.mode,
|
|
20601
|
+
maxSelectCount = props.maxSelectCount,
|
|
20601
20602
|
_props$showOnly = props.showOnly,
|
|
20602
20603
|
showOnly = _props$showOnly === void 0 ? false : _props$showOnly,
|
|
20603
20604
|
getOptionsAsync = props.getOptionsAsync,
|
|
20605
|
+
_onChange = props.onChange,
|
|
20604
20606
|
otherProps = _objectWithoutProperties(props, _excluded$n);
|
|
20605
20607
|
var _React$useState = React__default['default'].useState([]),
|
|
20606
20608
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -20614,24 +20616,25 @@ var AsyncSelect = function AsyncSelect(props) {
|
|
|
20614
20616
|
var options = [].concat(_toConsumableArray(props.options || []), _toConsumableArray(data || []));
|
|
20615
20617
|
var getValueString = function getValueString(value) {
|
|
20616
20618
|
var list = options;
|
|
20617
|
-
if (
|
|
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)) {
|
|
20619
|
+
if (mode === 'multiple' && Array.isArray(value)) {
|
|
20623
20620
|
var _list$filter$map$join;
|
|
20624
20621
|
return (_list$filter$map$join = list.filter(function (item) {
|
|
20625
20622
|
return value.includes(item.value);
|
|
20626
20623
|
}).map(function (item) {
|
|
20627
20624
|
return item.label;
|
|
20628
20625
|
}).join(',')) !== null && _list$filter$map$join !== void 0 ? _list$filter$map$join : '--';
|
|
20626
|
+
} else {
|
|
20627
|
+
var selectedItem = list.find(function (item) {
|
|
20628
|
+
return item.value === value;
|
|
20629
|
+
});
|
|
20630
|
+
return selectedItem ? selectedItem.label : value !== null && value !== void 0 ? value : '--';
|
|
20629
20631
|
}
|
|
20630
20632
|
};
|
|
20631
20633
|
if (showOnly) {
|
|
20632
20634
|
return getValueString(props.value);
|
|
20633
20635
|
}
|
|
20634
20636
|
return /*#__PURE__*/React__default['default'].createElement(antd.Select, _objectSpread2(_objectSpread2({
|
|
20637
|
+
showArrow: true,
|
|
20635
20638
|
showSearch: true,
|
|
20636
20639
|
filterOption: function filterOption(input, option) {
|
|
20637
20640
|
return option.label.includes(input);
|
|
@@ -20639,7 +20642,14 @@ var AsyncSelect = function AsyncSelect(props) {
|
|
|
20639
20642
|
notFoundContent: null
|
|
20640
20643
|
}, otherProps), {}, {
|
|
20641
20644
|
options: options,
|
|
20642
|
-
mode: mode
|
|
20645
|
+
mode: mode,
|
|
20646
|
+
onChange: function onChange(value, option) {
|
|
20647
|
+
if (mode === 'multiple' && maxSelectCount && maxSelectCount < value.length) {
|
|
20648
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(value.slice(-maxSelectCount), option);
|
|
20649
|
+
} else {
|
|
20650
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(value, option);
|
|
20651
|
+
}
|
|
20652
|
+
}
|
|
20643
20653
|
}));
|
|
20644
20654
|
};
|
|
20645
20655
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { SelectProps } from 'antd';
|
|
2
|
-
declare const AsyncSelect: (props: SelectProps & {
|
|
2
|
+
declare const AsyncSelect: (props: SelectProps<any, import("rc-select/lib/Select").DefaultOptionType> & {
|
|
3
3
|
mode: string;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
maxSelectCount?: number | undefined;
|
|
5
|
+
showOnly?: boolean | undefined;
|
|
6
|
+
onChange: (value: string | string[], data: any) => void;
|
|
7
|
+
getOptionsAsync?: (() => Promise<Required<SelectProps>['options']>) | undefined;
|
|
6
8
|
}) => any;
|
|
7
9
|
export default AsyncSelect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/basic-components",
|
|
3
|
-
"version": "2.0.54-beta.
|
|
3
|
+
"version": "2.0.54-beta.72",
|
|
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.
|
|
23
|
+
"@kmkf-fe-packages/kmkf-utils": "2.0.54-beta.72",
|
|
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": "
|
|
68
|
+
"gitHead": "57029c6ab776b45df269aeb6bf44382d32dafe35"
|
|
69
69
|
}
|