@zat-design/sisyphus-react 3.4.9-beta.16 → 3.4.9-beta.17

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.
@@ -6,6 +6,8 @@ import _Popconfirm from "antd/es/popconfirm";
6
6
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
7
  import "antd/es/space/style";
8
8
  import _Space from "antd/es/space";
9
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
10
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
9
11
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
10
12
  var _excluded = ["label", "onClick", "onHandle", "actionType", "needConfirm", "confirmProps", "title"],
11
13
  _excluded2 = ["onClick", "label"];
@@ -128,17 +130,55 @@ var ActionButton = function ActionButton(props) {
128
130
  }
129
131
  return props.actionProps;
130
132
  }, [props.actionProps]);
131
- var handleClick = function handleClick(callback, index, item) {
133
+ var handleClick = /*#__PURE__*/function () {
134
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(defaultCallback, callback, index, item) {
135
+ var value, data;
136
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
137
+ while (1) switch (_context.prev = _context.next) {
138
+ case 0:
139
+ value = form.getFieldValue(namePath);
140
+ _context.next = 3;
141
+ return callback === null || callback === void 0 ? void 0 : callback(value, {
142
+ namePath: namePath,
143
+ index: index,
144
+ operation: operation,
145
+ form: form
146
+ });
147
+ case 3:
148
+ data = _context.sent;
149
+ if (!(data === true)) {
150
+ _context.next = 7;
151
+ break;
152
+ }
153
+ defaultCallback === null || defaultCallback === void 0 ? void 0 : defaultCallback(value, {
154
+ namePath: namePath,
155
+ index: index,
156
+ operation: operation,
157
+ form: form
158
+ });
159
+ return _context.abrupt("return");
160
+ case 7:
161
+ if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add') {
162
+ operation.add(data, index !== undefined ? index + 1 : undefined);
163
+ }
164
+ case 8:
165
+ case "end":
166
+ return _context.stop();
167
+ }
168
+ }, _callee);
169
+ }));
170
+ return function handleClick(_x, _x2, _x3, _x4) {
171
+ return _ref6.apply(this, arguments);
172
+ };
173
+ }();
174
+ var customClick = function customClick(callback, index) {
132
175
  var value = form.getFieldValue(namePath);
133
- var data = callback === null || callback === void 0 ? void 0 : callback(value, {
176
+ callback === null || callback === void 0 ? void 0 : callback(value, {
134
177
  namePath: namePath,
135
178
  index: index,
136
179
  operation: operation,
137
180
  form: form
138
181
  });
139
- if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add') {
140
- operation.add(data, index !== undefined ? index + 1 : undefined);
141
- }
142
182
  };
143
183
  var defaultActions = useMemo(function () {
144
184
  return getDefaultActions(mode);
@@ -195,7 +235,7 @@ var ActionButton = function ActionButton(props) {
195
235
  return e.stopPropagation();
196
236
  },
197
237
  onConfirm: function onConfirm(e) {
198
- handleClick(_onClick || internalOnClick, index, item);
238
+ handleClick(internalOnClick, _onClick, index, item);
199
239
  }
200
240
  }, _confirmProps), {}, {
201
241
  children: _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, defaultRest), rest), {}, {
@@ -207,7 +247,7 @@ var ActionButton = function ActionButton(props) {
207
247
  }), "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index)) : _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, defaultRest), rest), {}, {
208
248
  onClick: function onClick(e) {
209
249
  e.stopPropagation();
210
- handleClick(_onClick || internalOnClick, index, item);
250
+ handleClick(internalOnClick, _onClick, index, item);
211
251
  },
212
252
  children: label || defaultLabel
213
253
  }), "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
@@ -218,7 +258,7 @@ var ActionButton = function ActionButton(props) {
218
258
  return e.stopPropagation();
219
259
  },
220
260
  onConfirm: function onConfirm() {
221
- return handleClick(_onClick, index);
261
+ return customClick(_onClick, index);
222
262
  }
223
263
  }, _confirmProps), {}, {
224
264
  children: _jsx(_Button, _objectSpread(_objectSpread({}, rest), {}, {
@@ -231,7 +271,7 @@ var ActionButton = function ActionButton(props) {
231
271
  key: "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index),
232
272
  onClick: function onClick(e) {
233
273
  e.stopPropagation();
234
- handleClick(_onClick, index);
274
+ customClick(_onClick, index);
235
275
  }
236
276
  }), label));
237
277
  })
@@ -4,6 +4,8 @@ import _Button from "antd/es/button";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
5
  import "antd/es/space/style";
6
6
  import _Space from "antd/es/space";
7
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
8
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
7
9
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
8
10
  var _excluded = ["label", "onClick", "onHandle", "actionType"],
9
11
  _excluded2 = ["onClick", "label"];
@@ -48,16 +50,52 @@ var ToolbarButton = function ToolbarButton(props) {
48
50
  }
49
51
  return props.toolbarProps;
50
52
  }, [props.toolbarProps]);
51
- var handleClick = function handleClick(callback, item) {
53
+ var handleClick = /*#__PURE__*/function () {
54
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(defaultCallback, callback, item) {
55
+ var value, data;
56
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
57
+ while (1) switch (_context.prev = _context.next) {
58
+ case 0:
59
+ value = form.getFieldValue(namePath);
60
+ _context.next = 3;
61
+ return callback === null || callback === void 0 ? void 0 : callback(value, {
62
+ operation: operation,
63
+ form: form,
64
+ namePath: namePath
65
+ });
66
+ case 3:
67
+ data = _context.sent;
68
+ if (!(data === true)) {
69
+ _context.next = 7;
70
+ break;
71
+ }
72
+ defaultCallback === null || defaultCallback === void 0 ? void 0 : defaultCallback(value, {
73
+ operation: operation,
74
+ form: form,
75
+ namePath: namePath
76
+ });
77
+ return _context.abrupt("return");
78
+ case 7:
79
+ if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add' && data) {
80
+ operation.add(data);
81
+ }
82
+ case 8:
83
+ case "end":
84
+ return _context.stop();
85
+ }
86
+ }, _callee);
87
+ }));
88
+ return function handleClick(_x, _x2, _x3) {
89
+ return _ref2.apply(this, arguments);
90
+ };
91
+ }();
92
+ var customClick = function customClick(callback, item) {
52
93
  var value = form.getFieldValue(namePath);
53
- var data = callback === null || callback === void 0 ? void 0 : callback(value, {
94
+ callback === null || callback === void 0 ? void 0 : callback(value, {
54
95
  operation: operation,
55
96
  form: form,
56
97
  namePath: namePath
57
98
  });
58
- if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add' && data) {
59
- operation.add(data);
60
- }
61
99
  };
62
100
  return _jsx(_Space, {
63
101
  align: "start",
@@ -88,14 +126,14 @@ var ToolbarButton = function ToolbarButton(props) {
88
126
  }
89
127
  return _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, actions[actionType]), rest), {}, {
90
128
  onClick: function onClick() {
91
- return handleClick(_onClick || internalOnClick, item);
129
+ return handleClick(internalOnClick, _onClick, item);
92
130
  },
93
131
  children: label || defaultLabel
94
132
  }), actionType);
95
133
  }
96
134
  return _jsx(_Button, _objectSpread(_objectSpread({}, rest), {}, {
97
135
  onClick: function onClick() {
98
- return handleClick(_onClick2, item);
136
+ return customClick(_onClick2, item);
99
137
  },
100
138
  children: label
101
139
  }), actionType);
@@ -65,6 +65,11 @@ export interface ProTreeProps extends PropTreeSelectProps {
65
65
  onSelect?: (values: string[] | AllValueType, info?: any) => any;
66
66
  /** 复选情况下点击checkbox触发,参照antd */
67
67
  onCheck?: (values: string[] | AllValueType, info?: any) => any;
68
+ onExpand?: (newExpandedKeys: React.Key[], nextPara: {
69
+ expanded: boolean;
70
+ node: DataOption;
71
+ nativeEvent: PointerEvent;
72
+ }) => void;
68
73
  /** 自定义展示 */
69
74
  optionRender?: (item: any, searchStr: string) => string | ReactNode;
70
75
  /** 对后台返回数据进行格式化 */
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
13
  var _react = require("react");
12
14
  var _jsxRuntime = require("react/jsx-runtime");
@@ -129,17 +131,55 @@ var ActionButton = function ActionButton(props) {
129
131
  }
130
132
  return props.actionProps;
131
133
  }, [props.actionProps]);
132
- var handleClick = function handleClick(callback, index, item) {
134
+ var handleClick = /*#__PURE__*/function () {
135
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(defaultCallback, callback, index, item) {
136
+ var value, data;
137
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
138
+ while (1) switch (_context.prev = _context.next) {
139
+ case 0:
140
+ value = form.getFieldValue(namePath);
141
+ _context.next = 3;
142
+ return callback === null || callback === void 0 ? void 0 : callback(value, {
143
+ namePath: namePath,
144
+ index: index,
145
+ operation: operation,
146
+ form: form
147
+ });
148
+ case 3:
149
+ data = _context.sent;
150
+ if (!(data === true)) {
151
+ _context.next = 7;
152
+ break;
153
+ }
154
+ defaultCallback === null || defaultCallback === void 0 ? void 0 : defaultCallback(value, {
155
+ namePath: namePath,
156
+ index: index,
157
+ operation: operation,
158
+ form: form
159
+ });
160
+ return _context.abrupt("return");
161
+ case 7:
162
+ if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add') {
163
+ operation.add(data, index !== undefined ? index + 1 : undefined);
164
+ }
165
+ case 8:
166
+ case "end":
167
+ return _context.stop();
168
+ }
169
+ }, _callee);
170
+ }));
171
+ return function handleClick(_x, _x2, _x3, _x4) {
172
+ return _ref6.apply(this, arguments);
173
+ };
174
+ }();
175
+ var customClick = function customClick(callback, index) {
133
176
  var value = form.getFieldValue(namePath);
134
- var data = callback === null || callback === void 0 ? void 0 : callback(value, {
177
+ callback === null || callback === void 0 ? void 0 : callback(value, {
135
178
  namePath: namePath,
136
179
  index: index,
137
180
  operation: operation,
138
181
  form: form
139
182
  });
140
- if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add') {
141
- operation.add(data, index !== undefined ? index + 1 : undefined);
142
- }
143
183
  };
144
184
  var defaultActions = (0, _react.useMemo)(function () {
145
185
  return getDefaultActions(mode);
@@ -196,7 +236,7 @@ var ActionButton = function ActionButton(props) {
196
236
  return e.stopPropagation();
197
237
  },
198
238
  onConfirm: function onConfirm(e) {
199
- handleClick(_onClick || internalOnClick, index, item);
239
+ handleClick(internalOnClick, _onClick, index, item);
200
240
  }
201
241
  }, _confirmProps), {}, {
202
242
  children: (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultRest), rest), {}, {
@@ -208,7 +248,7 @@ var ActionButton = function ActionButton(props) {
208
248
  }), "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index)) : (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultRest), rest), {}, {
209
249
  onClick: function onClick(e) {
210
250
  e.stopPropagation();
211
- handleClick(_onClick || internalOnClick, index, item);
251
+ handleClick(internalOnClick, _onClick, index, item);
212
252
  },
213
253
  children: label || defaultLabel
214
254
  }), "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
@@ -219,7 +259,7 @@ var ActionButton = function ActionButton(props) {
219
259
  return e.stopPropagation();
220
260
  },
221
261
  onConfirm: function onConfirm() {
222
- return handleClick(_onClick, index);
262
+ return customClick(_onClick, index);
223
263
  }
224
264
  }, _confirmProps), {}, {
225
265
  children: (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rest), {}, {
@@ -232,7 +272,7 @@ var ActionButton = function ActionButton(props) {
232
272
  key: "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index),
233
273
  onClick: function onClick(e) {
234
274
  e.stopPropagation();
235
- handleClick(_onClick, index);
275
+ customClick(_onClick, index);
236
276
  }
237
277
  }), label));
238
278
  })
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
13
  var _jsxRuntime = require("react/jsx-runtime");
12
14
  var _antd = require("antd");
@@ -52,16 +54,52 @@ var ToolbarButton = function ToolbarButton(props) {
52
54
  }
53
55
  return props.toolbarProps;
54
56
  }, [props.toolbarProps]);
55
- var handleClick = function handleClick(callback, item) {
57
+ var handleClick = /*#__PURE__*/function () {
58
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(defaultCallback, callback, item) {
59
+ var value, data;
60
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
61
+ while (1) switch (_context.prev = _context.next) {
62
+ case 0:
63
+ value = form.getFieldValue(namePath);
64
+ _context.next = 3;
65
+ return callback === null || callback === void 0 ? void 0 : callback(value, {
66
+ operation: operation,
67
+ form: form,
68
+ namePath: namePath
69
+ });
70
+ case 3:
71
+ data = _context.sent;
72
+ if (!(data === true)) {
73
+ _context.next = 7;
74
+ break;
75
+ }
76
+ defaultCallback === null || defaultCallback === void 0 ? void 0 : defaultCallback(value, {
77
+ operation: operation,
78
+ form: form,
79
+ namePath: namePath
80
+ });
81
+ return _context.abrupt("return");
82
+ case 7:
83
+ if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add' && data) {
84
+ operation.add(data);
85
+ }
86
+ case 8:
87
+ case "end":
88
+ return _context.stop();
89
+ }
90
+ }, _callee);
91
+ }));
92
+ return function handleClick(_x, _x2, _x3) {
93
+ return _ref2.apply(this, arguments);
94
+ };
95
+ }();
96
+ var customClick = function customClick(callback, item) {
56
97
  var value = form.getFieldValue(namePath);
57
- var data = callback === null || callback === void 0 ? void 0 : callback(value, {
98
+ callback === null || callback === void 0 ? void 0 : callback(value, {
58
99
  operation: operation,
59
100
  form: form,
60
101
  namePath: namePath
61
102
  });
62
- if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add' && data) {
63
- operation.add(data);
64
- }
65
103
  };
66
104
  return (0, _jsxRuntime.jsx)(_antd.Space, {
67
105
  align: "start",
@@ -92,14 +130,14 @@ var ToolbarButton = function ToolbarButton(props) {
92
130
  }
93
131
  return (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, actions[actionType]), rest), {}, {
94
132
  onClick: function onClick() {
95
- return handleClick(_onClick || internalOnClick, item);
133
+ return handleClick(internalOnClick, _onClick, item);
96
134
  },
97
135
  children: label || defaultLabel
98
136
  }), actionType);
99
137
  }
100
138
  return (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rest), {}, {
101
139
  onClick: function onClick() {
102
- return handleClick(_onClick2, item);
140
+ return customClick(_onClick2, item);
103
141
  },
104
142
  children: label
105
143
  }), actionType);
@@ -65,6 +65,11 @@ export interface ProTreeProps extends PropTreeSelectProps {
65
65
  onSelect?: (values: string[] | AllValueType, info?: any) => any;
66
66
  /** 复选情况下点击checkbox触发,参照antd */
67
67
  onCheck?: (values: string[] | AllValueType, info?: any) => any;
68
+ onExpand?: (newExpandedKeys: React.Key[], nextPara: {
69
+ expanded: boolean;
70
+ node: DataOption;
71
+ nativeEvent: PointerEvent;
72
+ }) => void;
68
73
  /** 自定义展示 */
69
74
  optionRender?: (item: any, searchStr: string) => string | ReactNode;
70
75
  /** 对后台返回数据进行格式化 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.4.9-beta.16",
3
+ "version": "3.4.9-beta.17",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",