ztxkui 3.8.9 → 3.8.10
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
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.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJyZXN1bWVfZGF0ZSI6bnVsbCwidXNlcl9uYW1lIjoiY2hlbnl4IiwiZW1wX25hbWUiOm51bGwsImVtcF9udW1iZXIiOm51bGwsImltdF9pZCI6bnVsbCwicmVhbF9uYW1lIjoi6ZmI5Lqa6ZuEIiwiY2xpZW50X3R5cGUiOiJ3ZWIiLCJkYXRhX3JvbGVfaWQiOiIxMzQ1OTc4NTA1MzAyMDU2OTYyLDE0NjgwMzUzNTE2MjUyODU2MzQsMTU0MjA3NjMwODU3ODAyNTQ3NCIsImNsaWVudF9pZCI6InN3b3JkIiwidXNlcl90eXBlIjoid2ViIiwicm9sZV9pZCI6IjExMjM1OTg4MTY3Mzg2NzUyMDEsMTQ2NzAxNTk3NTQ4NDc2MDA2NiwxNDY4MDM0NDM3MTU3OTYxNzI5LDE0ODA4MjkzMzc5MzkxMzI0MTciLCJwb3N0X25hbWUiOm51bGwsInNjb3BlIjpbImFsbCJdLCJpbnRlcnZpZXdfaWQiOm51bGwsImV4cCI6MTY2NTAzMzgwMywib3JnX25hbWUiOm51bGwsImp0aSI6Ijk1MDJkZjkxLWEwZDAtNDU5Ni1hZGEwLWU1YmEzM2RiYjkzOCIsIm1lbWJlcl9pZCI6MSwiY29tcGFueV9pZCI6bnVsbCwic3lzdGVtX2lkIjpudWxsLCJkZXB0X25hbWUiOm51bGwsImF2YXRhciI6IiIsImRhdGFfcm9sZV9uYW1lIjoiYWRtaW4sYWRtaW4sYWRtaW4iLCJhdXRob3JpdGllcyI6WyJhZG1pbiIsInVzZXIiLCJhZG1pbmlzdHJhdG9yIl0sInJvbGVfbmFtZSI6ImFkbWluaXN0cmF0b3IsdXNlcixhZG1pbixhZG1pbiIsInJlc3VtZV90ZW1wbGF0ZSI6bnVsbCwibGljZW5zZSI6InBvd2VyZWQgYnkgem1kbXMiLCJwb3N0X2lkIjoiIiwidXNlcl9pZCI6IjE0MTI5NTM4MDQzMzM1NTU3MTQiLCJvcmdfaWQiOm51bGwsIm5pY2tfbmFtZSI6IumZiOS6mumbhCIsImNvbXBhbnlfbmFtZSI6bnVsbCwiZGVwdF9pZCI6IiIsImhhbmRsZV9ocl9uYW1lIjpudWxsLCJhY2NvdW50IjoiY2hlbnl4IiwicmVzdW1lX2lkIjpudWxsfQ.YhEz7JGYIXKXVinlyHEqgmxltIEPCySypAvfOqbxQWY',
|
|
10
10
|
},
|
|
11
11
|
method: options.method,
|
|
12
12
|
}).then(function (response) { return response.json(); });
|
|
@@ -116,6 +116,12 @@ function Demo() {
|
|
|
116
116
|
companyId: '1414851965111283713',
|
|
117
117
|
}));
|
|
118
118
|
} }, "\u4FEE\u6539"),
|
|
119
|
-
React.createElement(EnhanceSelect, { style: selectStyle, placeholder: "\u5F02\u6B65\u83B7\u53D6\u6570\u636E", url: "http://192.168.0.83:8000/api/zmdms-user/page", params: params1, request: request, joinKey: "depName", dataKey: "id", titleKey: "name", remoteSearch: true, isRemoteSearchDataKey: false, isClickRequest: true
|
|
119
|
+
React.createElement(EnhanceSelect, { style: selectStyle, placeholder: "\u5F02\u6B65\u83B7\u53D6\u6570\u636E", url: "http://192.168.0.83:8000/api/zmdms-user/page", params: params1, request: request, joinKey: "depName", dataKey: "id", titleKey: "name", remoteSearch: true, isRemoteSearchDataKey: false, isClickRequest: true, defaultList: [
|
|
120
|
+
{
|
|
121
|
+
id: '11',
|
|
122
|
+
name: '22',
|
|
123
|
+
},
|
|
124
|
+
{},
|
|
125
|
+
] })));
|
|
120
126
|
}
|
|
121
127
|
export default Demo;
|
|
@@ -87,6 +87,26 @@ function textContent(children) {
|
|
|
87
87
|
}
|
|
88
88
|
return textContent(children);
|
|
89
89
|
}
|
|
90
|
+
function isFalsy(data) {
|
|
91
|
+
return data == null || data === '';
|
|
92
|
+
}
|
|
93
|
+
function clearNullData(arr, dataKey, titleKey) {
|
|
94
|
+
try {
|
|
95
|
+
var newArr = [];
|
|
96
|
+
if (Array.isArray(arr)) {
|
|
97
|
+
newArr = arr.filter(function (item) {
|
|
98
|
+
if (isFalsy(item[dataKey]) || isFalsy(item[titleKey])) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return newArr;
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
return arr;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
90
110
|
/**
|
|
91
111
|
* 增强下拉框功能组件
|
|
92
112
|
* 添加远程搜索
|
|
@@ -733,7 +753,8 @@ function EnhanceSelect(_a) {
|
|
|
733
753
|
}
|
|
734
754
|
// 渲染数据
|
|
735
755
|
function renderSelectOption() {
|
|
736
|
-
|
|
756
|
+
// const _defaultList = Array.isArray(defaultList) ? defaultList : [];
|
|
757
|
+
var _defaultList = clearNullData(Array.isArray(defaultList) ? defaultList : [], dataKey, titleKey);
|
|
737
758
|
return (React.createElement(React.Fragment, null,
|
|
738
759
|
showAll && (React.createElement(Select.Option, { title: "\u5168\u90E8", value: "" }, "\u5168\u90E8")),
|
|
739
760
|
Array.isArray(selectList) &&
|
|
@@ -807,7 +828,8 @@ function EnhanceSelect(_a) {
|
|
|
807
828
|
setFirstClearData(true);
|
|
808
829
|
getRemoteDataHandle('', '');
|
|
809
830
|
}
|
|
810
|
-
|
|
831
|
+
// const _defaultList = Array.isArray(defaultList) ? defaultList : [];
|
|
832
|
+
var _defaultList = clearNullData(Array.isArray(defaultList) ? defaultList : [], dataKey, titleKey);
|
|
811
833
|
var currentList = concatData(concatData(selectList || [], _defaultList), multipleList || []);
|
|
812
834
|
if (currentList && Array.isArray(currentList)) {
|
|
813
835
|
var key_1 = dataKey;
|