@zat-design/sisyphus-react 3.12.0-beta.2 → 3.12.0-beta.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.
@@ -41,8 +41,8 @@ var ProAction = function ProAction(props) {
41
41
  var length = config.length;
42
42
  var _onActionRun = /*#__PURE__*/function () {
43
43
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(currentIndex, array) {
44
- var _actionProps$useReque, _options$onSuccess, _newServicesArray$cur, _newServicesArray$cur2, _newServicesArray$cur3, _actionProps$onAction, _actionProps$continue;
45
- var actionProps, newServicesArray, _ref2, service, options, transformResponse, res, data, open, _newServicesArray$cur4, _newServicesArray$cur5, _newServicesArray$cur6, list, errorTitle, isContinue;
44
+ var _actionProps$useReque, _options$defaultParam, _options$onSuccess, _newServicesArray$cur, _newServicesArray$cur2, _newServicesArray$cur3, _actionProps$onAction, _actionProps$continue;
45
+ var actionProps, newServicesArray, _ref2, service, options, transformResponse, params, res, data, open, _newServicesArray$cur4, _newServicesArray$cur5, _newServicesArray$cur6, list, errorTitle, isContinue;
46
46
  return _regeneratorRuntime().wrap(function _callee$(_context) {
47
47
  while (1) switch (_context.prev = _context.next) {
48
48
  case 0:
@@ -67,34 +67,35 @@ var ProAction = function ProAction(props) {
67
67
  service = _ref2.service;
68
68
  options = _ref2.options;
69
69
  transformResponse = _ref2.transformResponse;
70
- _context.next = 14;
71
- return service === null || service === void 0 ? void 0 : service(options === null || options === void 0 ? void 0 : options.defaultParams);
72
- case 14:
70
+ params = Array.isArray(options === null || options === void 0 ? void 0 : options.defaultParams) ? options === null || options === void 0 ? void 0 : (_options$defaultParam = options.defaultParams) === null || _options$defaultParam === void 0 ? void 0 : _options$defaultParam[0] : (options === null || options === void 0 ? void 0 : options.defaultParams) || {};
71
+ _context.next = 15;
72
+ return service === null || service === void 0 ? void 0 : service(params);
73
+ case 15:
73
74
  _context.t1 = _context.sent;
74
75
  if (_context.t1) {
75
- _context.next = 17;
76
+ _context.next = 18;
76
77
  break;
77
78
  }
78
79
  _context.t1 = {};
79
- case 17:
80
+ case 18:
80
81
  res = _context.t1;
81
82
  if (!(transformResponse && isFunction(transformResponse))) {
82
- _context.next = 25;
83
+ _context.next = 26;
83
84
  break;
84
85
  }
85
- _context.next = 21;
86
+ _context.next = 22;
86
87
  return transformResponse(res);
87
- case 21:
88
+ case 22:
88
89
  data = _context.sent;
89
90
  newServicesArray[currentIndex] = data;
90
- _context.next = 26;
91
+ _context.next = 27;
91
92
  break;
92
- case 25:
93
+ case 26:
93
94
  if (res.status === 200) {
94
95
  newServicesArray[currentIndex] = res.data;
95
96
  }
96
- case 26:
97
- options === null || options === void 0 ? void 0 : (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 ? void 0 : _options$onSuccess.call(options, newServicesArray[currentIndex], options === null || options === void 0 ? void 0 : options.defaultParams);
97
+ case 27:
98
+ options === null || options === void 0 ? void 0 : (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 ? void 0 : _options$onSuccess.call(options, newServicesArray[currentIndex], params);
98
99
  if (!service) {
99
100
  newServicesArray[currentIndex] = null;
100
101
  }
@@ -105,7 +106,7 @@ var ProAction = function ProAction(props) {
105
106
  open: open
106
107
  });
107
108
  if (!open) {
108
- _context.next = 36;
109
+ _context.next = 37;
109
110
  break;
110
111
  }
111
112
  list = ((_newServicesArray$cur4 = newServicesArray[currentIndex]) === null || _newServicesArray$cur4 === void 0 ? void 0 : (_newServicesArray$cur5 = _newServicesArray$cur4.list) === null || _newServicesArray$cur5 === void 0 ? void 0 : _newServicesArray$cur5.join('\n')) || [];
@@ -118,23 +119,23 @@ var ProAction = function ProAction(props) {
118
119
  loading: false
119
120
  });
120
121
  return _context.abrupt("return");
121
- case 36:
122
- _context.next = 38;
122
+ case 37:
123
+ _context.next = 39;
123
124
  return actionProps === null || actionProps === void 0 ? void 0 : (_actionProps$onAction = actionProps.onAction) === null || _actionProps$onAction === void 0 ? void 0 : _actionProps$onAction.call(actionProps, newServicesArray[currentIndex - 1], newServicesArray, currentIndex);
124
- case 38:
125
- _context.next = 40;
125
+ case 39:
126
+ _context.next = 41;
126
127
  return actionProps === null || actionProps === void 0 ? void 0 : (_actionProps$continue = actionProps.continue) === null || _actionProps$continue === void 0 ? void 0 : _actionProps$continue.call(actionProps, newServicesArray[currentIndex - 1], newServicesArray);
127
- case 40:
128
+ case 41:
128
129
  isContinue = _context.sent;
129
130
  if (!(isContinue === false)) {
130
- _context.next = 44;
131
+ _context.next = 45;
131
132
  break;
132
133
  }
133
134
  setState({
134
135
  loading: false
135
136
  });
136
137
  return _context.abrupt("return", false);
137
- case 44:
138
+ case 45:
138
139
  if (currentIndex + 1 < length) {
139
140
  _onActionRun(currentIndex + 1, newServicesArray);
140
141
  } else {
@@ -142,7 +143,7 @@ var ProAction = function ProAction(props) {
142
143
  loading: false
143
144
  });
144
145
  }
145
- case 45:
146
+ case 46:
146
147
  case "end":
147
148
  return _context.stop();
148
149
  }
@@ -23,7 +23,7 @@ import { getSelectList } from './utils';
23
23
  import './index.less';
24
24
  var Option = _Select.Option;
25
25
  export var ProSelect = function ProSelect(props, ref) {
26
- var _selectProps$showCode, _useRequest$options, _locale$ProSelect;
26
+ var _selectProps$showCode, _useRequest$options3, _locale$ProSelect;
27
27
  var _ref = useProConfig('ProSelect') || {},
28
28
  _ref$fieldNames = _ref.fieldNames,
29
29
  proSelectFieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames,
@@ -102,9 +102,12 @@ export var ProSelect = function ProSelect(props, ref) {
102
102
  }
103
103
  return data;
104
104
  }, []);
105
- var fetchFunction = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread({
105
+ var fetchFunction = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({
106
106
  manual: true,
107
+ debounceWait: 300
108
+ }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
107
109
  onSuccess: function onSuccess(data) {
110
+ var _useRequest$options, _useRequest$options$o, _useRequest$options2;
108
111
  if (transformResponse && typeof transformResponse === 'function') {
109
112
  var responseData = transformResponse(data);
110
113
  setSelectList(responseData);
@@ -112,10 +115,11 @@ export var ProSelect = function ProSelect(props, ref) {
112
115
  // 接口写死了,无法复用
113
116
  updateDataSource ? updateDataSource(data, setSelectList) : defaultOnSuccessFun(data);
114
117
  }
115
- },
116
- debounceWait: 300
117
- }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
118
- var cacheList = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.cacheKey) ? successTransformDataHandle(fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data) : [];
118
+ // 执行传入onSuccess
119
+ useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : (_useRequest$options$o = _useRequest$options.onSuccess) === null || _useRequest$options$o === void 0 ? void 0 : _useRequest$options$o.call(_useRequest$options, data, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.defaultParams);
120
+ }
121
+ }));
122
+ var cacheList = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options3 = useRequest.options) === null || _useRequest$options3 === void 0 ? void 0 : _useRequest$options3.cacheKey) ? successTransformDataHandle(fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data) : [];
119
123
  var getValueObject = function getValueObject(input) {
120
124
  if (Array.isArray(input) && input.length) {
121
125
  var resArr = [];
@@ -141,9 +145,9 @@ export var ProSelect = function ProSelect(props, ref) {
141
145
  setSelectList(dataSource);
142
146
  }, [dataSource]);
143
147
  useDeepCompareEffect(function () {
144
- var _useRequest$options2;
148
+ var _useRequest$options4;
145
149
  // 设置cacheKey后使用缓存的数据
146
- if (!(selectList === null || selectList === void 0 ? void 0 : selectList.length) && (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.cacheKey)) {
150
+ if (!(selectList === null || selectList === void 0 ? void 0 : selectList.length) && (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.cacheKey)) {
147
151
  if (cacheList === null || cacheList === void 0 ? void 0 : cacheList.length) {
148
152
  setSelectList(cacheList);
149
153
  }
@@ -45,8 +45,8 @@ var ProAction = function ProAction(props) {
45
45
  var length = config.length;
46
46
  var _onActionRun = /*#__PURE__*/function () {
47
47
  var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(currentIndex, array) {
48
- var _actionProps$useReque, _options$onSuccess, _newServicesArray$cur, _newServicesArray$cur2, _newServicesArray$cur3, _actionProps$onAction, _actionProps$continue;
49
- var actionProps, newServicesArray, _ref2, service, options, transformResponse, res, data, open, _newServicesArray$cur4, _newServicesArray$cur5, _newServicesArray$cur6, list, errorTitle, isContinue;
48
+ var _actionProps$useReque, _options$defaultParam, _options$onSuccess, _newServicesArray$cur, _newServicesArray$cur2, _newServicesArray$cur3, _actionProps$onAction, _actionProps$continue;
49
+ var actionProps, newServicesArray, _ref2, service, options, transformResponse, params, res, data, open, _newServicesArray$cur4, _newServicesArray$cur5, _newServicesArray$cur6, list, errorTitle, isContinue;
50
50
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
51
51
  while (1) switch (_context.prev = _context.next) {
52
52
  case 0:
@@ -71,34 +71,35 @@ var ProAction = function ProAction(props) {
71
71
  service = _ref2.service;
72
72
  options = _ref2.options;
73
73
  transformResponse = _ref2.transformResponse;
74
- _context.next = 14;
75
- return service === null || service === void 0 ? void 0 : service(options === null || options === void 0 ? void 0 : options.defaultParams);
76
- case 14:
74
+ params = Array.isArray(options === null || options === void 0 ? void 0 : options.defaultParams) ? options === null || options === void 0 ? void 0 : (_options$defaultParam = options.defaultParams) === null || _options$defaultParam === void 0 ? void 0 : _options$defaultParam[0] : (options === null || options === void 0 ? void 0 : options.defaultParams) || {};
75
+ _context.next = 15;
76
+ return service === null || service === void 0 ? void 0 : service(params);
77
+ case 15:
77
78
  _context.t1 = _context.sent;
78
79
  if (_context.t1) {
79
- _context.next = 17;
80
+ _context.next = 18;
80
81
  break;
81
82
  }
82
83
  _context.t1 = {};
83
- case 17:
84
+ case 18:
84
85
  res = _context.t1;
85
86
  if (!(transformResponse && (0, _lodash.isFunction)(transformResponse))) {
86
- _context.next = 25;
87
+ _context.next = 26;
87
88
  break;
88
89
  }
89
- _context.next = 21;
90
+ _context.next = 22;
90
91
  return transformResponse(res);
91
- case 21:
92
+ case 22:
92
93
  data = _context.sent;
93
94
  newServicesArray[currentIndex] = data;
94
- _context.next = 26;
95
+ _context.next = 27;
95
96
  break;
96
- case 25:
97
+ case 26:
97
98
  if (res.status === 200) {
98
99
  newServicesArray[currentIndex] = res.data;
99
100
  }
100
- case 26:
101
- options === null || options === void 0 ? void 0 : (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 ? void 0 : _options$onSuccess.call(options, newServicesArray[currentIndex], options === null || options === void 0 ? void 0 : options.defaultParams);
101
+ case 27:
102
+ options === null || options === void 0 ? void 0 : (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 ? void 0 : _options$onSuccess.call(options, newServicesArray[currentIndex], params);
102
103
  if (!service) {
103
104
  newServicesArray[currentIndex] = null;
104
105
  }
@@ -109,7 +110,7 @@ var ProAction = function ProAction(props) {
109
110
  open: open
110
111
  });
111
112
  if (!open) {
112
- _context.next = 36;
113
+ _context.next = 37;
113
114
  break;
114
115
  }
115
116
  list = ((_newServicesArray$cur4 = newServicesArray[currentIndex]) === null || _newServicesArray$cur4 === void 0 ? void 0 : (_newServicesArray$cur5 = _newServicesArray$cur4.list) === null || _newServicesArray$cur5 === void 0 ? void 0 : _newServicesArray$cur5.join('\n')) || [];
@@ -122,23 +123,23 @@ var ProAction = function ProAction(props) {
122
123
  loading: false
123
124
  });
124
125
  return _context.abrupt("return");
125
- case 36:
126
- _context.next = 38;
126
+ case 37:
127
+ _context.next = 39;
127
128
  return actionProps === null || actionProps === void 0 ? void 0 : (_actionProps$onAction = actionProps.onAction) === null || _actionProps$onAction === void 0 ? void 0 : _actionProps$onAction.call(actionProps, newServicesArray[currentIndex - 1], newServicesArray, currentIndex);
128
- case 38:
129
- _context.next = 40;
129
+ case 39:
130
+ _context.next = 41;
130
131
  return actionProps === null || actionProps === void 0 ? void 0 : (_actionProps$continue = actionProps.continue) === null || _actionProps$continue === void 0 ? void 0 : _actionProps$continue.call(actionProps, newServicesArray[currentIndex - 1], newServicesArray);
131
- case 40:
132
+ case 41:
132
133
  isContinue = _context.sent;
133
134
  if (!(isContinue === false)) {
134
- _context.next = 44;
135
+ _context.next = 45;
135
136
  break;
136
137
  }
137
138
  setState({
138
139
  loading: false
139
140
  });
140
141
  return _context.abrupt("return", false);
141
- case 44:
142
+ case 45:
142
143
  if (currentIndex + 1 < length) {
143
144
  _onActionRun(currentIndex + 1, newServicesArray);
144
145
  } else {
@@ -146,7 +147,7 @@ var ProAction = function ProAction(props) {
146
147
  loading: false
147
148
  });
148
149
  }
149
- case 45:
150
+ case 46:
150
151
  case "end":
151
152
  return _context.stop();
152
153
  }
@@ -24,7 +24,7 @@ require("./index.less");
24
24
  var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames", "tooltip", "otherProps", "labelInValue", "filterInList", "scrollFollowParent", "defaultOne", "onSearch", "optionRender", "onChange", "updateDataSource", "transformResponse", "getValueProps", "isView"];
25
25
  var Option = _antd.Select.Option;
26
26
  var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
27
- var _selectProps$showCode, _useRequest$options, _locale$ProSelect;
27
+ var _selectProps$showCode, _useRequest$options3, _locale$ProSelect;
28
28
  var _ref = (0, _ProConfigProvider.useProConfig)('ProSelect') || {},
29
29
  _ref$fieldNames = _ref.fieldNames,
30
30
  proSelectFieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames,
@@ -103,9 +103,12 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
103
103
  }
104
104
  return data;
105
105
  }, []);
106
- var fetchFunction = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)({
106
+ var fetchFunction = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)((0, _objectSpread2.default)({
107
107
  manual: true,
108
+ debounceWait: 300
109
+ }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
108
110
  onSuccess: function onSuccess(data) {
111
+ var _useRequest$options, _useRequest$options$o, _useRequest$options2;
109
112
  if (transformResponse && typeof transformResponse === 'function') {
110
113
  var responseData = transformResponse(data);
111
114
  setSelectList(responseData);
@@ -113,10 +116,11 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
113
116
  // 接口写死了,无法复用
114
117
  updateDataSource ? updateDataSource(data, setSelectList) : defaultOnSuccessFun(data);
115
118
  }
116
- },
117
- debounceWait: 300
118
- }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
119
- var cacheList = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.cacheKey) ? successTransformDataHandle(fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data) : [];
119
+ // 执行传入onSuccess
120
+ useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : (_useRequest$options$o = _useRequest$options.onSuccess) === null || _useRequest$options$o === void 0 ? void 0 : _useRequest$options$o.call(_useRequest$options, data, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.defaultParams);
121
+ }
122
+ }));
123
+ var cacheList = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options3 = useRequest.options) === null || _useRequest$options3 === void 0 ? void 0 : _useRequest$options3.cacheKey) ? successTransformDataHandle(fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data) : [];
120
124
  var getValueObject = function getValueObject(input) {
121
125
  if (Array.isArray(input) && input.length) {
122
126
  var resArr = [];
@@ -142,9 +146,9 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
142
146
  setSelectList(dataSource);
143
147
  }, [dataSource]);
144
148
  (0, _ahooks.useDeepCompareEffect)(function () {
145
- var _useRequest$options2;
149
+ var _useRequest$options4;
146
150
  // 设置cacheKey后使用缓存的数据
147
- if (!(selectList === null || selectList === void 0 ? void 0 : selectList.length) && (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.cacheKey)) {
151
+ if (!(selectList === null || selectList === void 0 ? void 0 : selectList.length) && (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.cacheKey)) {
148
152
  if (cacheList === null || cacheList === void 0 ? void 0 : cacheList.length) {
149
153
  setSelectList(cacheList);
150
154
  }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.12.0-beta.2",
3
+ "version": "3.12.0-beta.4",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
7
7
  "typings": "lib/index.d.ts",
8
+ "homepage": "https://procomponents.zhongan.io/",
8
9
  "scripts": {
9
10
  "analyze": "ANALYZE=1 dumi build",
10
11
  "build": "npm run build-lib && npm run build-es && npm run build-dist",