ztxkui 2.7.5 → 2.7.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.
|
@@ -99,6 +99,10 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
|
|
|
99
99
|
* 增加需要禁用的选项
|
|
100
100
|
*/
|
|
101
101
|
disabledValues?: any[];
|
|
102
|
+
/**
|
|
103
|
+
* 搜索时需要删除的key
|
|
104
|
+
*/
|
|
105
|
+
searchDeleteKeys?: string[];
|
|
102
106
|
}
|
|
103
107
|
/**
|
|
104
108
|
* 增强下拉框功能组件
|
|
@@ -115,6 +119,6 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
|
|
|
115
119
|
* { code: 200, data: { records: [] } } || { status: 200, data: { code: 200, data: { records: [] } } }
|
|
116
120
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
117
121
|
*/
|
|
118
|
-
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, mustHasParams, disabledValues, ...restProps }: IProps<VT>): JSX.Element;
|
|
122
|
+
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, mustHasParams, disabledValues, searchDeleteKeys, ...restProps }: IProps<VT>): JSX.Element;
|
|
119
123
|
declare const _default: React.MemoExoticComponent<typeof EnhanceSelect>;
|
|
120
124
|
export default _default;
|
|
@@ -76,7 +76,7 @@ function getData(request, options) {
|
|
|
76
76
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
77
77
|
*/
|
|
78
78
|
function EnhanceSelect(_a) {
|
|
79
|
-
var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.timeout, timeout = _c === void 0 ? 30000 : _c, _d = _a.dataKey, dataKey = _d === void 0 ? 'id' : _d, componentKey = _a.componentKey, _e = _a.titleKey, titleKey = _e === void 0 ? 'name' : _e, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, onSearch = _a.onSearch, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _f = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _f === void 0 ? true : _f, transformData = _a.transformData, joinKey = _a.joinKey, _g = _a.joinStr, joinStr = _g === void 0 ? '-' : _g, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "mustHasParams", "disabledValues"]);
|
|
79
|
+
var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.timeout, timeout = _c === void 0 ? 30000 : _c, _d = _a.dataKey, dataKey = _d === void 0 ? 'id' : _d, componentKey = _a.componentKey, _e = _a.titleKey, titleKey = _e === void 0 ? 'name' : _e, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, onSearch = _a.onSearch, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _f = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _f === void 0 ? true : _f, transformData = _a.transformData, joinKey = _a.joinKey, _g = _a.joinStr, joinStr = _g === void 0 ? '-' : _g, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, searchDeleteKeys = _a.searchDeleteKeys, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "mustHasParams", "disabledValues", "searchDeleteKeys"]);
|
|
80
80
|
var currentClick = useRef(true);
|
|
81
81
|
// 下拉数据源
|
|
82
82
|
var _h = useFetchState([]), selectList = _h[0], setSelectList = _h[1];
|
|
@@ -169,6 +169,10 @@ function EnhanceSelect(_a) {
|
|
|
169
169
|
var searchParams = {};
|
|
170
170
|
if (value) {
|
|
171
171
|
searchParams[searchKey] = value;
|
|
172
|
+
Array.isArray(searchDeleteKeys) &&
|
|
173
|
+
searchDeleteKeys.forEach(function (key) {
|
|
174
|
+
Reflect.deleteProperty(outParams, key);
|
|
175
|
+
});
|
|
172
176
|
}
|
|
173
177
|
if (dataKeyValue) {
|
|
174
178
|
searchParams[searchDataKey] = dataKeyValue + '';
|
|
@@ -230,6 +234,7 @@ function EnhanceSelect(_a) {
|
|
|
230
234
|
transformData,
|
|
231
235
|
setLoading,
|
|
232
236
|
setMultipleList,
|
|
237
|
+
searchDeleteKeys,
|
|
233
238
|
]);
|
|
234
239
|
var searchHandle = function (value) {
|
|
235
240
|
// 当value有值时才进行搜索
|