ztxkui 2.0.1 → 2.0.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.
- package/dist/Demo.js +5 -3
- package/dist/components/EnhanceSelect/index.js +18 -10
- package/dist/index.js +49 -67
- package/package.json +1 -1
package/dist/Demo.js
CHANGED
|
@@ -6,7 +6,7 @@ var selectStyle = { width: '200px' };
|
|
|
6
6
|
function request(options) {
|
|
7
7
|
return fetch(options.url + "?" + stringify(options.params), {
|
|
8
8
|
headers: {
|
|
9
|
-
'Zmdms-Auth': 'bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
|
|
9
|
+
'Zmdms-Auth': 'bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJyZXN1bWVfZGF0ZSI6bnVsbCwidXNlcl9uYW1lIjoiY2hlbnl4IiwiaW10X2lkIjpudWxsLCJyZWFsX25hbWUiOiLpmYjkuprpm4QiLCJjbGllbnRfdHlwZSI6IndlYiIsImRhdGFfcm9sZV9pZCI6IjEzNDU5Nzg1MDUzMDIwNTY5NjIsMTQxMjYxNDExMDY0NzM4NjExNCwxNDEyNjE1Njc3MTE5MjY2ODE3LDE0NDgxMjEwODY1MDQzMDA1NDYsMTQ1MjgyMDI5MzgwMjcxMzA5MCwxNDUzOTI1MDAxNTMxNDc4MDE3LDE0NTg3MTIwODIwODIzNTcyNTAsMTQ1ODgyNjIzODE4NTg4OTc5NCwxNDU4ODI3NzAxMDEyMzI0MzUzLDE0NTg4MjgzNjA4MDE1MDkzNzcsMTQ2MDA4OTI2MjAxMjAzMDk3NywxNDYxMTM3Nzg4NjQ1MTI2MTQ2IiwiY2xpZW50X2lkIjoic3dvcmQiLCJ1c2VyX3R5cGUiOiJ3ZWIiLCJyb2xlX2lkIjoiMTQxMjYw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iIxMzk3MDgxOTMwMzI4NDI0NDQ5IiwiaGFuZGxlX2hyX25hbWUiOm51bGwsImFjY291bnQiOiJjaGVueXgiLCJyZXN1bWVfaWQiOm51bGx9.Moo8uYZzd7bNGw_jsydYQvyf5lVoJA8LLUNQdkPxXac',
|
|
10
10
|
},
|
|
11
11
|
method: options.method,
|
|
12
12
|
}).then(function (response) { return response.json(); });
|
|
@@ -47,7 +47,7 @@ function Demo() {
|
|
|
47
47
|
projectName: '项目12',
|
|
48
48
|
},
|
|
49
49
|
]);
|
|
50
|
-
setValue('1462433051208761603');
|
|
50
|
+
// setValue('1462433051208761603');
|
|
51
51
|
}, 2000);
|
|
52
52
|
return function () {
|
|
53
53
|
if (timeoutId) {
|
|
@@ -65,6 +65,8 @@ function Demo() {
|
|
|
65
65
|
React.createElement("h2", null, "\u5F02\u6B65\u83B7\u53D6\u6570\u636E"),
|
|
66
66
|
React.createElement("h2", null, "\u5F02\u6B65\u83B7\u53D6\u6570\u636E\uFF0C\u5E76\u7F13\u5B58\u6570\u636E"),
|
|
67
67
|
React.createElement("h2", null, "\u8FDC\u7A0B\u6A21\u7CCA\u641C\u7D22"),
|
|
68
|
-
React.createElement(EnhanceSelect, { style: selectStyle, placeholder: "\u53EF\u8FDC\u7A0B\u6A21\u7CCA\u641C\u7D22", url: "http://192.168.0.
|
|
68
|
+
React.createElement(EnhanceSelect, { style: selectStyle, placeholder: "\u53EF\u8FDC\u7A0B\u6A21\u7CCA\u641C\u7D22", url: "http://192.168.0.83:8000/api/zmdms-system/employee/page", request: request, remoteSearch: true, dataKey: "id", titleKey: "empName",
|
|
69
|
+
// value={value}
|
|
70
|
+
mode: "multiple" })));
|
|
69
71
|
}
|
|
70
72
|
export default Demo;
|
|
@@ -136,7 +136,7 @@ function EnhanceSelect(_a) {
|
|
|
136
136
|
searchParams[searchKey] = value;
|
|
137
137
|
}
|
|
138
138
|
if (dataKeyValue) {
|
|
139
|
-
searchParams[searchDataKey] = dataKeyValue;
|
|
139
|
+
searchParams[searchDataKey] = dataKeyValue + '';
|
|
140
140
|
}
|
|
141
141
|
getData(request, {
|
|
142
142
|
url: url,
|
|
@@ -183,9 +183,9 @@ function EnhanceSelect(_a) {
|
|
|
183
183
|
]);
|
|
184
184
|
var searchHandle = function (value) {
|
|
185
185
|
// 当value有值时才进行搜索
|
|
186
|
-
if (value) {
|
|
187
|
-
|
|
188
|
-
}
|
|
186
|
+
// if (value) {
|
|
187
|
+
getRemoteDataHandle(value, '');
|
|
188
|
+
// }
|
|
189
189
|
};
|
|
190
190
|
var onSearchHandle = debounce(searchHandle, 300);
|
|
191
191
|
// 1、如果传入list的话,那么直接使用list数据
|
|
@@ -247,7 +247,8 @@ function EnhanceSelect(_a) {
|
|
|
247
247
|
getRemoteDataHandle('', '');
|
|
248
248
|
}
|
|
249
249
|
else {
|
|
250
|
-
if (typeof restProps.value === 'string'
|
|
250
|
+
if (typeof restProps.value === 'string' ||
|
|
251
|
+
Array.isArray(restProps.value)) {
|
|
251
252
|
setFirstLoading(true);
|
|
252
253
|
getRemoteDataHandle('', restProps.value);
|
|
253
254
|
}
|
|
@@ -271,7 +272,9 @@ function EnhanceSelect(_a) {
|
|
|
271
272
|
newData.forEach(function (item) {
|
|
272
273
|
// 如果源数组中找到了该条数据,那么不添加
|
|
273
274
|
// 否则添加
|
|
274
|
-
if (!resultData.find(function (resultItem) {
|
|
275
|
+
if (!resultData.find(function (resultItem) {
|
|
276
|
+
return resultItem && item && resultItem[dataKey] === item[dataKey];
|
|
277
|
+
})) {
|
|
275
278
|
resultData.push(item);
|
|
276
279
|
}
|
|
277
280
|
});
|
|
@@ -312,18 +315,23 @@ function EnhanceSelect(_a) {
|
|
|
312
315
|
};
|
|
313
316
|
// onChange 方法
|
|
314
317
|
var onChangeHandle = function (value, option) {
|
|
315
|
-
|
|
318
|
+
var _defaultList = Array.isArray(defaultList) ? defaultList : [];
|
|
319
|
+
var currentList = concatData(concatData(selectList || [], _defaultList), multipleList || []);
|
|
320
|
+
if (currentList && Array.isArray(currentList)) {
|
|
316
321
|
var key_1 = dataKey;
|
|
317
322
|
// 支持多选模式
|
|
318
323
|
var currentData = void 0;
|
|
319
324
|
if (Array.isArray(value)) {
|
|
320
325
|
currentData = value.map(function (valueItem) {
|
|
321
|
-
return
|
|
326
|
+
return currentList.find(function (item) { return item[key_1] === valueItem; });
|
|
322
327
|
});
|
|
323
|
-
|
|
328
|
+
currentData = currentData === null || currentData === void 0 ? void 0 : currentData.filter(function (item) { return item; });
|
|
329
|
+
if (remoteSearch) {
|
|
330
|
+
setMultipleList(currentData);
|
|
331
|
+
}
|
|
324
332
|
}
|
|
325
333
|
else {
|
|
326
|
-
currentData =
|
|
334
|
+
currentData = currentList.find(function (item) { return item[key_1] === value; });
|
|
327
335
|
}
|
|
328
336
|
onChange && onChange(value, option, currentData);
|
|
329
337
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,70 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
// </h1>
|
|
51
|
-
// <h1>
|
|
52
|
-
// <Link to="/tree-select">tree select</Link>
|
|
53
|
-
// </h1>
|
|
54
|
-
// <h1>
|
|
55
|
-
// <Link to="/tree">tree</Link>
|
|
56
|
-
// </h1>
|
|
57
|
-
// <h1>
|
|
58
|
-
// <Link to="/upload">upload</Link>
|
|
59
|
-
// </h1>
|
|
60
|
-
// </div>
|
|
61
|
-
// </Route>
|
|
62
|
-
// </Switch>
|
|
63
|
-
// </BrowserRouter>
|
|
64
|
-
// </ConfigProvider>,
|
|
65
|
-
// // </React.StrictMode>,
|
|
66
|
-
// document.getElementById('root')
|
|
67
|
-
// );
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import App from './App';
|
|
4
|
+
import { ConfigProvider } from 'antd';
|
|
5
|
+
import zhCN from 'antd/lib/locale/zh_CN';
|
|
6
|
+
import * as dayjs from 'dayjs';
|
|
7
|
+
import zhCn from 'dayjs/locale/zh-cn';
|
|
8
|
+
import { BrowserRouter, Switch, Route, Link } from 'react-router-dom';
|
|
9
|
+
import Demo from './Demo';
|
|
10
|
+
import TreeSelectDemo from './TreeSelectDemo';
|
|
11
|
+
import TreeDemo from './TreeDemo';
|
|
12
|
+
import UploadDemo from './UploadDemo';
|
|
13
|
+
import CollapseDemo from './DemoCom/CollapseDemo';
|
|
14
|
+
import TimelineDemo from './DemoCom/TimelineDemo';
|
|
15
|
+
import WeChatDemo from './DemoCom/WechatDemo';
|
|
16
|
+
dayjs.locale(zhCn);
|
|
17
|
+
ReactDOM.render(
|
|
18
|
+
// <React.StrictMode>
|
|
19
|
+
React.createElement(ConfigProvider, { locale: zhCN },
|
|
20
|
+
React.createElement(BrowserRouter, null,
|
|
21
|
+
React.createElement(Switch, null,
|
|
22
|
+
React.createElement(Route, { exact: true, path: "/" },
|
|
23
|
+
React.createElement(App, null)),
|
|
24
|
+
React.createElement(Route, { exact: true, path: "/select" },
|
|
25
|
+
React.createElement(Demo, null)),
|
|
26
|
+
React.createElement(Route, { exact: true, path: "/tree-select" },
|
|
27
|
+
React.createElement(TreeSelectDemo, null)),
|
|
28
|
+
React.createElement(Route, { exact: true, path: "/tree" },
|
|
29
|
+
React.createElement(TreeDemo, null)),
|
|
30
|
+
React.createElement(Route, { exact: true, path: "/upload" },
|
|
31
|
+
React.createElement(UploadDemo, null)),
|
|
32
|
+
React.createElement(Route, { exact: true, path: "/collapse" },
|
|
33
|
+
React.createElement(CollapseDemo, null)),
|
|
34
|
+
React.createElement(Route, { exact: true, path: "/timeline" },
|
|
35
|
+
React.createElement(TimelineDemo, null)),
|
|
36
|
+
React.createElement(Route, { exact: true, path: "/wechat" },
|
|
37
|
+
React.createElement(WeChatDemo, null)),
|
|
38
|
+
React.createElement(Route, { exact: true, path: "/test" },
|
|
39
|
+
React.createElement("div", null,
|
|
40
|
+
React.createElement("h1", null,
|
|
41
|
+
React.createElement(Link, { to: "/select" }, "select")),
|
|
42
|
+
React.createElement("h1", null,
|
|
43
|
+
React.createElement(Link, { to: "/tree-select" }, "tree select")),
|
|
44
|
+
React.createElement("h1", null,
|
|
45
|
+
React.createElement(Link, { to: "/tree" }, "tree")),
|
|
46
|
+
React.createElement("h1", null,
|
|
47
|
+
React.createElement(Link, { to: "/upload" }, "upload"))))))),
|
|
48
|
+
// </React.StrictMode>,
|
|
49
|
+
document.getElementById('root'));
|
|
68
50
|
export { default as Button } from './components/Button';
|
|
69
51
|
export { default as Calendar } from './components/Calendar';
|
|
70
52
|
export { default as Checkbox } from './components/Checkbox';
|