@zat-design/sisyphus-react 3.7.3-beta.6 → 3.7.3-beta.7

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.
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare const _default: ({ children, delayTime, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>;
2
+ declare const _default: ({ children, delayTime, excludes, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>;
3
3
  export default _default;
@@ -2,13 +2,14 @@ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["children", "delayTime"];
5
+ var _excluded = ["children", "delayTime", "excludes"];
6
6
  import { throttle } from 'lodash';
7
7
  import React from 'react';
8
8
  import { useStep } from '../../index';
9
9
  export default (function (_ref) {
10
10
  var children = _ref.children,
11
11
  delayTime = _ref.delayTime,
12
+ excludes = _ref.excludes,
12
13
  props = _objectWithoutProperties(_ref, _excluded);
13
14
  var _useStep = useStep(),
14
15
  notify = _useStep.notify;
@@ -20,7 +21,9 @@ export default (function (_ref) {
20
21
  case 0:
21
22
  localStorage.setItem('cache-pro-step', '');
22
23
  _context.next = 3;
23
- return notify === null || notify === void 0 ? void 0 : notify();
24
+ return notify === null || notify === void 0 ? void 0 : notify({
25
+ excludes: excludes
26
+ });
24
27
  case 3:
25
28
  values = _context.sent;
26
29
  setTimeout(function () {
@@ -7,6 +7,6 @@ declare const ProStep: {
7
7
  ({ children, ...resetProps }: ProStepPropsType): import("react/jsx-runtime").JSX.Element;
8
8
  useStep: () => any;
9
9
  Item: ({ id, title, collapse: collapseItem, children, ...restProps }: import("./propsType").ProStepItem) => import("react/jsx-runtime").JSX.Element;
10
- Listener: ({ children, delayTime, ...props }: any) => import("react").DetailedReactHTMLElement<any, HTMLElement>;
10
+ Listener: ({ children, delayTime, excludes, ...props }: any) => import("react").DetailedReactHTMLElement<any, HTMLElement>;
11
11
  };
12
12
  export default ProStep;
@@ -128,47 +128,54 @@ var ProStep = function ProStep(_ref) {
128
128
  registerMap.current[id] = record;
129
129
  };
130
130
  var notify = /*#__PURE__*/function () {
131
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
132
- var events, res, nextErrorCollection;
131
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
132
+ var _ref7, excludes, triggerIds, events, res, nextErrorCollection;
133
133
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
134
134
  while (1) switch (_context2.prev = _context2.next) {
135
135
  case 0:
136
- events = Object.values(registerMap.current).map(function (item) {
137
- var _item$subEvent;
138
- return item === null || item === void 0 ? void 0 : (_item$subEvent = item.subEvent) === null || _item$subEvent === void 0 ? void 0 : _item$subEvent.call(item);
136
+ _ref7 = params || {}, excludes = _ref7.excludes;
137
+ triggerIds = Object.keys(registerMap.current); // 排除指定模块不触发校验
138
+ if (excludes === null || excludes === void 0 ? void 0 : excludes.length) {
139
+ triggerIds = triggerIds.filter(function (id) {
140
+ return !excludes.includes(id);
141
+ });
142
+ }
143
+ events = triggerIds.map(function (id) {
144
+ var _registerMap$current$, _registerMap$current$2;
145
+ return (_registerMap$current$ = registerMap.current[id]) === null || _registerMap$current$ === void 0 ? void 0 : (_registerMap$current$2 = _registerMap$current$.subEvent) === null || _registerMap$current$2 === void 0 ? void 0 : _registerMap$current$2.call(_registerMap$current$);
139
146
  });
140
- _context2.next = 3;
147
+ _context2.next = 6;
141
148
  return Promise.all(events);
142
- case 3:
149
+ case 6:
143
150
  res = _context2.sent;
144
151
  nextErrorCollection = {};
145
- Object.keys(registerMap.current).forEach(function (id, index) {
146
- var _ref7 = (res === null || res === void 0 ? void 0 : res[index]) || {},
147
- errorFields = _ref7.errorFields;
152
+ triggerIds.forEach(function (id, index) {
153
+ var _ref8 = (res === null || res === void 0 ? void 0 : res[index]) || {},
154
+ errorFields = _ref8.errorFields;
148
155
  nextErrorCollection[id] = (errorFields === null || errorFields === void 0 ? void 0 : errorFields.length) || 0;
149
156
  });
150
157
  setErrorCollection(nextErrorCollection);
151
158
  return _context2.abrupt("return", res);
152
- case 8:
159
+ case 11:
153
160
  case "end":
154
161
  return _context2.stop();
155
162
  }
156
163
  }, _callee2);
157
164
  }));
158
- return function notify() {
165
+ return function notify(_x) {
159
166
  return _ref6.apply(this, arguments);
160
167
  };
161
168
  }();
162
169
  var triggerTo = /*#__PURE__*/function () {
163
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(keys) {
170
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(keys) {
164
171
  var events, result, nextErrorCollection;
165
172
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
166
173
  while (1) switch (_context3.prev = _context3.next) {
167
174
  case 0:
168
175
  events = [];
169
176
  keys === null || keys === void 0 ? void 0 : keys.forEach(function (key) {
170
- var _registerMap$current, _registerMap$current$, _registerMap$current$2;
171
- events.push(registerMap === null || registerMap === void 0 ? void 0 : (_registerMap$current = registerMap.current) === null || _registerMap$current === void 0 ? void 0 : (_registerMap$current$ = _registerMap$current[key]) === null || _registerMap$current$ === void 0 ? void 0 : (_registerMap$current$2 = _registerMap$current$.subEvent) === null || _registerMap$current$2 === void 0 ? void 0 : _registerMap$current$2.call(_registerMap$current$));
177
+ var _registerMap$current, _registerMap$current$3, _registerMap$current$4;
178
+ events.push(registerMap === null || registerMap === void 0 ? void 0 : (_registerMap$current = registerMap.current) === null || _registerMap$current === void 0 ? void 0 : (_registerMap$current$3 = _registerMap$current[key]) === null || _registerMap$current$3 === void 0 ? void 0 : (_registerMap$current$4 = _registerMap$current$3.subEvent) === null || _registerMap$current$4 === void 0 ? void 0 : _registerMap$current$4.call(_registerMap$current$3));
172
179
  });
173
180
  _context3.next = 4;
174
181
  return Promise.all(events);
@@ -190,8 +197,8 @@ var ProStep = function ProStep(_ref) {
190
197
  }
191
198
  }, _callee3);
192
199
  }));
193
- return function triggerTo(_x) {
194
- return _ref8.apply(this, arguments);
200
+ return function triggerTo(_x2) {
201
+ return _ref9.apply(this, arguments);
195
202
  };
196
203
  }();
197
204
  useDeepCompareEffect(function () {
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare const _default: ({ children, delayTime, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>;
2
+ declare const _default: ({ children, delayTime, excludes, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>;
3
3
  export default _default;
@@ -12,10 +12,11 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
12
12
  var _lodash = require("lodash");
13
13
  var _react = _interopRequireDefault(require("react"));
14
14
  var _index = require("../../index");
15
- var _excluded = ["children", "delayTime"];
15
+ var _excluded = ["children", "delayTime", "excludes"];
16
16
  var _default = exports.default = function _default(_ref) {
17
17
  var children = _ref.children,
18
18
  delayTime = _ref.delayTime,
19
+ excludes = _ref.excludes,
19
20
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
20
21
  var _useStep = (0, _index.useStep)(),
21
22
  notify = _useStep.notify;
@@ -27,7 +28,9 @@ var _default = exports.default = function _default(_ref) {
27
28
  case 0:
28
29
  localStorage.setItem('cache-pro-step', '');
29
30
  _context.next = 3;
30
- return notify === null || notify === void 0 ? void 0 : notify();
31
+ return notify === null || notify === void 0 ? void 0 : notify({
32
+ excludes: excludes
33
+ });
31
34
  case 3:
32
35
  values = _context.sent;
33
36
  setTimeout(function () {
@@ -7,6 +7,6 @@ declare const ProStep: {
7
7
  ({ children, ...resetProps }: ProStepPropsType): import("react/jsx-runtime").JSX.Element;
8
8
  useStep: () => any;
9
9
  Item: ({ id, title, collapse: collapseItem, children, ...restProps }: import("./propsType").ProStepItem) => import("react/jsx-runtime").JSX.Element;
10
- Listener: ({ children, delayTime, ...props }: any) => import("react").DetailedReactHTMLElement<any, HTMLElement>;
10
+ Listener: ({ children, delayTime, excludes, ...props }: any) => import("react").DetailedReactHTMLElement<any, HTMLElement>;
11
11
  };
12
12
  export default ProStep;
@@ -135,47 +135,54 @@ var ProStep = function ProStep(_ref) {
135
135
  registerMap.current[id] = record;
136
136
  };
137
137
  var notify = /*#__PURE__*/function () {
138
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
139
- var events, res, nextErrorCollection;
138
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(params) {
139
+ var _ref7, excludes, triggerIds, events, res, nextErrorCollection;
140
140
  return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
141
141
  while (1) switch (_context2.prev = _context2.next) {
142
142
  case 0:
143
- events = Object.values(registerMap.current).map(function (item) {
144
- var _item$subEvent;
145
- return item === null || item === void 0 ? void 0 : (_item$subEvent = item.subEvent) === null || _item$subEvent === void 0 ? void 0 : _item$subEvent.call(item);
143
+ _ref7 = params || {}, excludes = _ref7.excludes;
144
+ triggerIds = Object.keys(registerMap.current); // 排除指定模块不触发校验
145
+ if (excludes === null || excludes === void 0 ? void 0 : excludes.length) {
146
+ triggerIds = triggerIds.filter(function (id) {
147
+ return !excludes.includes(id);
148
+ });
149
+ }
150
+ events = triggerIds.map(function (id) {
151
+ var _registerMap$current$, _registerMap$current$2;
152
+ return (_registerMap$current$ = registerMap.current[id]) === null || _registerMap$current$ === void 0 ? void 0 : (_registerMap$current$2 = _registerMap$current$.subEvent) === null || _registerMap$current$2 === void 0 ? void 0 : _registerMap$current$2.call(_registerMap$current$);
146
153
  });
147
- _context2.next = 3;
154
+ _context2.next = 6;
148
155
  return Promise.all(events);
149
- case 3:
156
+ case 6:
150
157
  res = _context2.sent;
151
158
  nextErrorCollection = {};
152
- Object.keys(registerMap.current).forEach(function (id, index) {
153
- var _ref7 = (res === null || res === void 0 ? void 0 : res[index]) || {},
154
- errorFields = _ref7.errorFields;
159
+ triggerIds.forEach(function (id, index) {
160
+ var _ref8 = (res === null || res === void 0 ? void 0 : res[index]) || {},
161
+ errorFields = _ref8.errorFields;
155
162
  nextErrorCollection[id] = (errorFields === null || errorFields === void 0 ? void 0 : errorFields.length) || 0;
156
163
  });
157
164
  setErrorCollection(nextErrorCollection);
158
165
  return _context2.abrupt("return", res);
159
- case 8:
166
+ case 11:
160
167
  case "end":
161
168
  return _context2.stop();
162
169
  }
163
170
  }, _callee2);
164
171
  }));
165
- return function notify() {
172
+ return function notify(_x) {
166
173
  return _ref6.apply(this, arguments);
167
174
  };
168
175
  }();
169
176
  var triggerTo = /*#__PURE__*/function () {
170
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3(keys) {
177
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3(keys) {
171
178
  var events, result, nextErrorCollection;
172
179
  return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
173
180
  while (1) switch (_context3.prev = _context3.next) {
174
181
  case 0:
175
182
  events = [];
176
183
  keys === null || keys === void 0 ? void 0 : keys.forEach(function (key) {
177
- var _registerMap$current, _registerMap$current$, _registerMap$current$2;
178
- events.push(registerMap === null || registerMap === void 0 ? void 0 : (_registerMap$current = registerMap.current) === null || _registerMap$current === void 0 ? void 0 : (_registerMap$current$ = _registerMap$current[key]) === null || _registerMap$current$ === void 0 ? void 0 : (_registerMap$current$2 = _registerMap$current$.subEvent) === null || _registerMap$current$2 === void 0 ? void 0 : _registerMap$current$2.call(_registerMap$current$));
184
+ var _registerMap$current, _registerMap$current$3, _registerMap$current$4;
185
+ events.push(registerMap === null || registerMap === void 0 ? void 0 : (_registerMap$current = registerMap.current) === null || _registerMap$current === void 0 ? void 0 : (_registerMap$current$3 = _registerMap$current[key]) === null || _registerMap$current$3 === void 0 ? void 0 : (_registerMap$current$4 = _registerMap$current$3.subEvent) === null || _registerMap$current$4 === void 0 ? void 0 : _registerMap$current$4.call(_registerMap$current$3));
179
186
  });
180
187
  _context3.next = 4;
181
188
  return Promise.all(events);
@@ -197,8 +204,8 @@ var ProStep = function ProStep(_ref) {
197
204
  }
198
205
  }, _callee3);
199
206
  }));
200
- return function triggerTo(_x) {
201
- return _ref8.apply(this, arguments);
207
+ return function triggerTo(_x2) {
208
+ return _ref9.apply(this, arguments);
202
209
  };
203
210
  }();
204
211
  (0, _ahooks.useDeepCompareEffect)(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.7.3-beta.6",
3
+ "version": "3.7.3-beta.7",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",