ztxkui 1.7.5 → 1.7.9
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 +9 -2
- package/dist/TreeSelectDemo.js +1 -1
- package/dist/components/EnhanceSelect/index.d.ts +9 -1
- package/dist/components/EnhanceSelect/index.js +18 -4
- package/dist/components/EnhanceTreeSelect/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/Demo.js
CHANGED
|
@@ -23,14 +23,21 @@ function Demo() {
|
|
|
23
23
|
{
|
|
24
24
|
id: '1',
|
|
25
25
|
name: '你好',
|
|
26
|
+
test1: 'JS',
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
29
|
id: '2',
|
|
29
30
|
name: '张三',
|
|
31
|
+
test1: 'Node',
|
|
30
32
|
},
|
|
31
33
|
{
|
|
32
34
|
id: '3',
|
|
33
35
|
name: '李四',
|
|
36
|
+
test1: 'Webpack',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: '4',
|
|
40
|
+
name: '王五',
|
|
34
41
|
},
|
|
35
42
|
]);
|
|
36
43
|
setDefaultList([
|
|
@@ -50,12 +57,12 @@ function Demo() {
|
|
|
50
57
|
React.createElement(Link, { to: "/test" }, "test"),
|
|
51
58
|
React.createElement("h1", null, "\u4F5C\u4E3A\u6F14\u793A\u4F7F\u7528"),
|
|
52
59
|
React.createElement("h2", null, "\u5982\u679C\u6570\u636E\u662F\u901A\u8FC7\u5916\u90E8\u83B7\u53D6\u7684\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4F20\u9012list\u5C5E\u6027"),
|
|
53
|
-
React.createElement(EnhanceSelect, { style: selectStyle, list: list, showAll: true }),
|
|
60
|
+
React.createElement(EnhanceSelect, { style: selectStyle, list: list, showAll: true, joinKey: "test1" }),
|
|
54
61
|
React.createElement("h2", null, "\u5F02\u6B65\u83B7\u53D6\u6570\u636E"),
|
|
55
62
|
React.createElement(EnhanceSelect, { style: selectStyle, url: "http://192.168.0.83:8000/api/zmdms-user/list", params: JSON.stringify({
|
|
56
63
|
status: 50,
|
|
57
64
|
companyId: '1397074605412696066',
|
|
58
|
-
}), request: request }),
|
|
65
|
+
}), request: request, joinKey: "depName" }),
|
|
59
66
|
React.createElement("h2", null, "\u5F02\u6B65\u83B7\u53D6\u6570\u636E\uFF0C\u5E76\u7F13\u5B58\u6570\u636E"),
|
|
60
67
|
React.createElement(EnhanceSelect, { style: selectStyle, url: "http://192.168.0.83:8000/api/zmdms-user/list", params: JSON.stringify({
|
|
61
68
|
status: 50,
|
package/dist/TreeSelectDemo.js
CHANGED
|
@@ -63,7 +63,7 @@ function TreeSelectDemo() {
|
|
|
63
63
|
React.createElement(Link, { to: "/test" }, "test"),
|
|
64
64
|
React.createElement("h1", null, "\u4F5C\u4E3A\u6F14\u793A\u4F7F\u7528"),
|
|
65
65
|
React.createElement("h2", null, "\u5982\u679C\u6570\u636E\u662F\u901A\u8FC7\u5916\u90E8\u83B7\u53D6\u7684\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4F20\u9012list\u5C5E\u6027"),
|
|
66
|
-
React.createElement(EnhanceTreeSelect, { style: selectStyle, treeData: treeData }),
|
|
66
|
+
React.createElement(EnhanceTreeSelect, { style: selectStyle, treeData: treeData, treeNodeLabelProp: "key" }),
|
|
67
67
|
React.createElement("h2", null, "\u5F02\u6B65\u83B7\u53D6\u6570\u636E\uFF0C\u4E00\u6B21\u6027\u83B7\u53D6\u6570\u636E"),
|
|
68
68
|
React.createElement(EnhanceTreeSelect, { style: selectStyle, url: "http://192.168.0.83:8000/api/zmdms-system/dept/lazy-tree", params: JSON.stringify({
|
|
69
69
|
status: 50,
|
|
@@ -37,6 +37,14 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
|
|
|
37
37
|
* 下拉框显示值对应的KEY
|
|
38
38
|
*/
|
|
39
39
|
titleKey?: string;
|
|
40
|
+
/**
|
|
41
|
+
* 拼接字段对应的key
|
|
42
|
+
*/
|
|
43
|
+
joinKey?: string | string[];
|
|
44
|
+
/**
|
|
45
|
+
* 拼接形式
|
|
46
|
+
*/
|
|
47
|
+
joinStr?: string;
|
|
40
48
|
/**
|
|
41
49
|
* 是否显示全部,全部的value为空字符串
|
|
42
50
|
*/
|
|
@@ -87,6 +95,6 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
|
|
|
87
95
|
* { code: 200, data: { records: [] } } || { status: 200, data: { code: 200, data: { records: [] } } }
|
|
88
96
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
89
97
|
*/
|
|
90
|
-
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, request, remoteSearch, remoteSearchKey, transformData, ...restProps }: IProps<VT>): JSX.Element;
|
|
98
|
+
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, request, remoteSearch, remoteSearchKey, transformData, joinKey, joinStr, ...restProps }: IProps<VT>): JSX.Element;
|
|
91
99
|
declare const _default: React.MemoExoticComponent<typeof EnhanceSelect>;
|
|
92
100
|
export default _default;
|
|
@@ -71,9 +71,9 @@ function getData(request, options) {
|
|
|
71
71
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
72
72
|
*/
|
|
73
73
|
function EnhanceSelect(_a) {
|
|
74
|
-
var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.dataKey, dataKey = _c === void 0 ? 'id' : _c, componentKey = _a.componentKey, _d = _a.titleKey, titleKey = _d === void 0 ? 'name' : _d, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, transformData = _a.transformData, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "request", "remoteSearch", "remoteSearchKey", "transformData"]);
|
|
74
|
+
var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.dataKey, dataKey = _c === void 0 ? 'id' : _c, componentKey = _a.componentKey, _d = _a.titleKey, titleKey = _d === void 0 ? 'name' : _d, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, transformData = _a.transformData, joinKey = _a.joinKey, _e = _a.joinStr, joinStr = _e === void 0 ? '-' : _e, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "request", "remoteSearch", "remoteSearchKey", "transformData", "joinKey", "joinStr"]);
|
|
75
75
|
// 下拉数据源
|
|
76
|
-
var
|
|
76
|
+
var _f = useFetchState([]), selectList = _f[0], setSelectList = _f[1];
|
|
77
77
|
// 如果selectList 发生改变,那么触发onCompleted事件
|
|
78
78
|
useEffect(function () {
|
|
79
79
|
if (Array.isArray(selectList) && onCompleted) {
|
|
@@ -220,7 +220,21 @@ function EnhanceSelect(_a) {
|
|
|
220
220
|
var key = componentKey ? item[componentKey] : item[dataKey];
|
|
221
221
|
var value = item[dataKey];
|
|
222
222
|
var title = item[titleKey];
|
|
223
|
-
|
|
223
|
+
var joinTitle = [];
|
|
224
|
+
if (joinKey) {
|
|
225
|
+
joinTitle = Array.isArray(joinKey)
|
|
226
|
+
? joinKey.map(function (joinItem) { return item[joinItem]; })
|
|
227
|
+
: item[joinKey]
|
|
228
|
+
? [item[joinKey]]
|
|
229
|
+
: [];
|
|
230
|
+
}
|
|
231
|
+
if (Array.isArray(joinTitle)) {
|
|
232
|
+
joinTitle.unshift(title);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
joinTitle = [title];
|
|
236
|
+
}
|
|
237
|
+
return (React.createElement(Select.Option, { key: key, value: value, title: title, disabled: item === null || item === void 0 ? void 0 : item.disabled }, Array.isArray(joinTitle) ? joinTitle === null || joinTitle === void 0 ? void 0 : joinTitle.join(joinStr) : ''));
|
|
224
238
|
})));
|
|
225
239
|
}
|
|
226
240
|
// 本地搜索
|
|
@@ -248,6 +262,6 @@ function EnhanceSelect(_a) {
|
|
|
248
262
|
onChange && onChange(value, option);
|
|
249
263
|
}
|
|
250
264
|
};
|
|
251
|
-
return (React.createElement(Select, __assign({ allowClear: true, showSearch: true, filterOption: remoteSearch ? false : filterOptionHandle, onSearch: remoteSearch ? onSearchHandle : undefined, onChange: onChangeHandle }, restProps), renderSelectOption()));
|
|
265
|
+
return (React.createElement(Select, __assign({ allowClear: true, showSearch: true, filterOption: remoteSearch ? false : filterOptionHandle, onSearch: remoteSearch ? onSearchHandle : undefined, onChange: onChangeHandle, optionLabelProp: "title" }, restProps), renderSelectOption()));
|
|
252
266
|
}
|
|
253
267
|
export default memo(EnhanceSelect);
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,6 @@ export { default as EnhanceTreeSelect } from './components/EnhanceTreeSelect';
|
|
|
34
34
|
export { default as Collapse } from './components/Collapse';
|
|
35
35
|
export { default as GridList } from './components/business/GridList';
|
|
36
36
|
export { default as Timeline } from './components/Timeline';
|
|
37
|
-
export { ConfigProvider, Drawer, message, Space, Grid, Divider, Dropdown, Badge, List, Result, Spin, Popconfirm, TreeSelect, Tree, Progress, Cascader, Tag, Empty, Tooltip, Descriptions, Image, } from 'antd';
|
|
37
|
+
export { ConfigProvider, Drawer, message, Space, Grid, Divider, Dropdown, Badge, List, Result, Spin, Popconfirm, TreeSelect, Tree, Progress, Cascader, Tag, Empty, Tooltip, Descriptions, Image, Popover, } from 'antd';
|
|
38
38
|
export { default as zhCN } from 'antd/lib/locale/zh_CN';
|
|
39
39
|
export { default as Icon, createFromIconfontCN } from '@ant-design/icons';
|
package/dist/index.js
CHANGED
|
@@ -97,6 +97,6 @@ export { default as EnhanceTreeSelect } from './components/EnhanceTreeSelect';
|
|
|
97
97
|
export { default as Collapse } from './components/Collapse';
|
|
98
98
|
export { default as GridList } from './components/business/GridList';
|
|
99
99
|
export { default as Timeline } from './components/Timeline';
|
|
100
|
-
export { ConfigProvider, Drawer, message, Space, Grid, Divider, Dropdown, Badge, List, Result, Spin, Popconfirm, TreeSelect, Tree, Progress, Cascader, Tag, Empty, Tooltip, Descriptions, Image, } from 'antd';
|
|
100
|
+
export { ConfigProvider, Drawer, message, Space, Grid, Divider, Dropdown, Badge, List, Result, Spin, Popconfirm, TreeSelect, Tree, Progress, Cascader, Tag, Empty, Tooltip, Descriptions, Image, Popover, } from 'antd';
|
|
101
101
|
export { default as zhCN } from 'antd/lib/locale/zh_CN';
|
|
102
102
|
export { default as Icon, createFromIconfontCN } from '@ant-design/icons';
|