ztxkui 1.7.9 → 1.8.3

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
@@ -57,7 +57,9 @@ function Demo() {
57
57
  React.createElement(Link, { to: "/test" }, "test"),
58
58
  React.createElement("h1", null, "\u4F5C\u4E3A\u6F14\u793A\u4F7F\u7528"),
59
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"),
60
- React.createElement(EnhanceSelect, { style: selectStyle, list: list, showAll: true, joinKey: "test1" }),
60
+ React.createElement(EnhanceSelect, { style: selectStyle, list: list, showAll: true, joinKey: "test1", onChange: function (value, option, fullData) {
61
+ console.log(value, option, fullData);
62
+ } }),
61
63
  React.createElement("h2", null, "\u5F02\u6B65\u83B7\u53D6\u6570\u636E"),
62
64
  React.createElement(EnhanceSelect, { style: selectStyle, url: "http://192.168.0.83:8000/api/zmdms-user/list", params: JSON.stringify({
63
65
  status: 50,
@@ -74,6 +74,7 @@ function EnhanceSelect(_a) {
74
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
76
  var _f = useFetchState([]), selectList = _f[0], setSelectList = _f[1];
77
+ var _g = useFetchState(false), loading = _g[0], setLoading = _g[1];
77
78
  // 如果selectList 发生改变,那么触发onCompleted事件
78
79
  useEffect(function () {
79
80
  if (Array.isArray(selectList) && onCompleted) {
@@ -112,6 +113,7 @@ function EnhanceSelect(_a) {
112
113
  outParams = JSON.parse(params);
113
114
  }
114
115
  catch (err) { }
116
+ setLoading(true);
115
117
  getData(request, {
116
118
  url: url,
117
119
  method: method,
@@ -119,6 +121,7 @@ function EnhanceSelect(_a) {
119
121
  })
120
122
  .then(function (resData) {
121
123
  var _a, _b, _c;
124
+ setLoading(false);
122
125
  var res = transformData ? transformData(resData) : resData;
123
126
  var result;
124
127
  if (Array.isArray(res.data)) {
@@ -135,6 +138,7 @@ function EnhanceSelect(_a) {
135
138
  setSelectList(result);
136
139
  })
137
140
  .catch(function (err) {
141
+ setLoading(false);
138
142
  console.log(err);
139
143
  });
140
144
  }, [
@@ -146,6 +150,7 @@ function EnhanceSelect(_a) {
146
150
  titleKey,
147
151
  setSelectList,
148
152
  transformData,
153
+ setLoading,
149
154
  ]);
150
155
  var searchHandle = function (value) {
151
156
  // 当value有值时才进行搜索
@@ -214,7 +219,7 @@ function EnhanceSelect(_a) {
214
219
  function renderSelectOption() {
215
220
  var _defaultList = Array.isArray(defaultList) ? defaultList : [];
216
221
  return (React.createElement(React.Fragment, null,
217
- showAll && React.createElement(Select.Option, { value: "" }, "\u5168\u90E8"),
222
+ showAll && (React.createElement(Select.Option, { title: "\u5168\u90E8", value: "" }, "\u5168\u90E8")),
218
223
  Array.isArray(selectList) &&
219
224
  selectList.concat(_defaultList).map(function (item) {
220
225
  var key = componentKey ? item[componentKey] : item[dataKey];
@@ -262,6 +267,6 @@ function EnhanceSelect(_a) {
262
267
  onChange && onChange(value, option);
263
268
  }
264
269
  };
265
- return (React.createElement(Select, __assign({ allowClear: true, showSearch: true, filterOption: remoteSearch ? false : filterOptionHandle, onSearch: remoteSearch ? onSearchHandle : undefined, onChange: onChangeHandle, optionLabelProp: "title" }, restProps), renderSelectOption()));
270
+ return (React.createElement(Select, __assign({ defaultValue: showAll ? '' : undefined, allowClear: true, showSearch: true, filterOption: remoteSearch ? false : filterOptionHandle, onSearch: remoteSearch ? onSearchHandle : undefined, onChange: onChangeHandle, optionLabelProp: "title", loading: loading }, restProps), renderSelectOption()));
266
271
  }
267
272
  export default memo(EnhanceSelect);
@@ -48,4 +48,7 @@ export interface IProps<T> extends Omit<TreeSelectProps<T>, 'onChange'> {
48
48
  * 添加远程搜索
49
49
  */
50
50
  declare function EnhanceTreeSelect<VT extends SelectValue = SelectValue>({ treeData: outTreeData, defaultTreeData, params, url, method, request, asyncLoadChildren, asyncLoadChildrenKey, transformData, treeDataSimpleMode, onCompleted, ...restProps }: IProps<VT>): JSX.Element;
51
+ declare namespace EnhanceTreeSelect {
52
+ var SHOW_PARENT: "SHOW_PARENT";
53
+ }
51
54
  export default EnhanceTreeSelect;
@@ -125,4 +125,5 @@ function EnhanceTreeSelect(_a) {
125
125
  ? defaultTreeData.concat(treeData)
126
126
  : treeData, treeDataSimpleMode: asyncLoadChildren, loadData: asyncLoadChildren ? onLoadDataHandle : undefined }, restProps)));
127
127
  }
128
+ EnhanceTreeSelect.SHOW_PARENT = TreeSelect.SHOW_PARENT;
128
129
  export default EnhanceTreeSelect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "1.7.9",
3
+ "version": "1.8.3",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",