ztxkui 2.7.1 → 2.7.4
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import InputNumber from 'components/InputNumber';
|
|
2
2
|
import Tag from 'components/Tag';
|
|
3
|
+
import Input from 'components/Input';
|
|
3
4
|
import { useState } from 'react';
|
|
5
|
+
import './style.scss';
|
|
4
6
|
function BasicDemo() {
|
|
5
7
|
var _a = useState(10), value = _a[0], setValue = _a[1];
|
|
6
8
|
return (React.createElement(React.Fragment, null,
|
|
@@ -13,7 +15,8 @@ function BasicDemo() {
|
|
|
13
15
|
React.createElement(Tag, { type: "normal" }, "\u4F60\u597D"),
|
|
14
16
|
React.createElement(Tag, { type: "processing" }, "\u4F60\u597D"),
|
|
15
17
|
React.createElement(Tag, { type: "warning" }, "\u4F60\u597D")),
|
|
16
|
-
React.createElement("div",
|
|
17
|
-
React.createElement("button", { onClick: function () { return console.log(value); } }, "\u83B7\u53D6\u6570\u636E"))
|
|
18
|
+
React.createElement("div", { className: "placeholder" },
|
|
19
|
+
React.createElement("button", { onClick: function () { return console.log(value); } }, "\u83B7\u53D6\u6570\u636E")),
|
|
20
|
+
React.createElement(Input.TextArea, { className: "placeholder" })));
|
|
18
21
|
}
|
|
19
22
|
export default BasicDemo;
|
|
@@ -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 ?
|
|
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, 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", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "mustHasParams", "disabledValues"]);
|
|
80
80
|
var currentClick = useRef(true);
|
|
81
81
|
// 下拉数据源
|
|
82
82
|
var _h = useFetchState([]), selectList = _h[0], setSelectList = _h[1];
|
|
@@ -181,7 +181,7 @@ function EnhanceSelect(_a) {
|
|
|
181
181
|
: 30, page: 1 }, outParams), searchParams),
|
|
182
182
|
})
|
|
183
183
|
.then(function (resData) {
|
|
184
|
-
var _a, _b, _c;
|
|
184
|
+
var _a, _b, _c, _d;
|
|
185
185
|
if (fetchIdClosure < fetchId.current) {
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
@@ -195,8 +195,11 @@ function EnhanceSelect(_a) {
|
|
|
195
195
|
if ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.records) {
|
|
196
196
|
result = res.data.records || [];
|
|
197
197
|
}
|
|
198
|
+
else if (Array.isArray((_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.data)) {
|
|
199
|
+
result = res.data.data || [];
|
|
200
|
+
}
|
|
198
201
|
else {
|
|
199
|
-
result = ((
|
|
202
|
+
result = ((_d = (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.records) || [];
|
|
200
203
|
}
|
|
201
204
|
}
|
|
202
205
|
// 如果根据id查过了,那么需要把这些数据添加到自定义合并数组中
|
|
@@ -234,7 +237,7 @@ function EnhanceSelect(_a) {
|
|
|
234
237
|
getRemoteDataHandle(value, '');
|
|
235
238
|
// }
|
|
236
239
|
};
|
|
237
|
-
var onSearchHandle = debounce(searchHandle,
|
|
240
|
+
var onSearchHandle = debounce(searchHandle, 800);
|
|
238
241
|
// 1、如果传入list的话,那么直接使用list数据
|
|
239
242
|
useEffect(function () {
|
|
240
243
|
if (Array.isArray(list)) {
|
package/dist/index.css
CHANGED