antd-management-fast-framework 1.12.18 → 1.12.21

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.
Files changed (36) hide show
  1. package/es/customComponents/Entrance/EntranceContext.d.ts +2 -0
  2. package/es/customComponents/{Login/loginContext.js → Entrance/EntranceContext.js} +2 -2
  3. package/es/customComponents/Entrance/EntranceItem.d.ts +2 -0
  4. package/es/customComponents/Entrance/EntranceItem.js +241 -0
  5. package/es/customComponents/Entrance/EntranceSubmit.d.ts +5 -0
  6. package/es/customComponents/{Login/LoginSubmit.js → Entrance/EntranceSubmit.js} +2 -2
  7. package/es/customComponents/Entrance/EntranceTab.d.ts +2 -0
  8. package/es/customComponents/Entrance/EntranceTab.js +55 -0
  9. package/es/customComponents/Entrance/index.d.ts +12 -0
  10. package/es/customComponents/Entrance/index.js +144 -0
  11. package/es/customComponents/{Login → Entrance}/index.less +9 -7
  12. package/es/customComponents/{Login → Entrance}/map.d.ts +0 -0
  13. package/es/customComponents/{Login → Entrance}/map.js +6 -3
  14. package/es/customComponents/index.js +0 -49
  15. package/es/framework/Base/index.js +4 -1
  16. package/es/framework/Common/index.js +1 -1
  17. package/es/framework/DataModal/Base/index.less +0 -1
  18. package/es/utils/authority.js +22 -14
  19. package/es/utils/constants.d.ts +3 -3
  20. package/es/utils/constants.js +3 -3
  21. package/es/utils/defaultSettingsSpecial.d.ts +3 -3
  22. package/es/utils/defaultSettingsSpecial.js +15 -15
  23. package/es/utils/request.js +3 -3
  24. package/es/utils/requestAssistor.js +8 -10
  25. package/es/utils/tools.d.ts +4 -3
  26. package/es/utils/tools.js +16 -0
  27. package/es/utils/virtualRequest.js +8 -8
  28. package/package.json +11 -9
  29. package/es/customComponents/Login/LoginItem.d.ts +0 -2
  30. package/es/customComponents/Login/LoginItem.js +0 -237
  31. package/es/customComponents/Login/LoginSubmit.d.ts +0 -5
  32. package/es/customComponents/Login/LoginTab.d.ts +0 -5
  33. package/es/customComponents/Login/LoginTab.js +0 -100
  34. package/es/customComponents/Login/index.d.ts +0 -38
  35. package/es/customComponents/Login/index.js +0 -222
  36. package/es/customComponents/Login/loginContext.d.ts +0 -2
@@ -1,237 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- require("antd/es/row/style");
11
-
12
- var _row = _interopRequireDefault(require("antd/es/row"));
13
-
14
- require("antd/es/button/style");
15
-
16
- var _button = _interopRequireDefault(require("antd/es/button"));
17
-
18
- require("antd/es/col/style");
19
-
20
- var _col = _interopRequireDefault(require("antd/es/col"));
21
-
22
- require("antd/es/input/style");
23
-
24
- var _input = _interopRequireDefault(require("antd/es/input"));
25
-
26
- require("antd/es/form/style");
27
-
28
- var _form = _interopRequireDefault(require("antd/es/form"));
29
-
30
- var _react = _interopRequireWildcard(require("react"));
31
-
32
- var _omit = _interopRequireDefault(require("omit.js"));
33
-
34
- var _index = _interopRequireDefault(require("./index.less"));
35
-
36
- var _map = _interopRequireDefault(require("./map"));
37
-
38
- var _loginContext = _interopRequireDefault(require("./loginContext"));
39
-
40
- var _excluded = ["onChange", "customprops", "defaultValue", "rules", "name", "getCaptchaButtonText", "getCaptchaSecondText", "updateActive", "type"];
41
-
42
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
43
-
44
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
45
-
46
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
-
48
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
49
-
50
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
51
-
52
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
53
-
54
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
55
-
56
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
57
-
58
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
59
-
60
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
61
-
62
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
63
-
64
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
65
-
66
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
67
-
68
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
69
-
70
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
71
-
72
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
73
-
74
- var FormItem = _form.default.Item;
75
-
76
- var WrapFormItem = /*#__PURE__*/function (_Component) {
77
- _inherits(WrapFormItem, _Component);
78
-
79
- var _super = _createSuper(WrapFormItem);
80
-
81
- function WrapFormItem(props) {
82
- var _this;
83
-
84
- _classCallCheck(this, WrapFormItem);
85
-
86
- _this = _super.call(this, props);
87
-
88
- _this.onGetCaptcha = function () {
89
- var onGetCaptcha = _this.props.onGetCaptcha;
90
- var result = onGetCaptcha ? onGetCaptcha() : null;
91
-
92
- if (result === false) {
93
- return;
94
- }
95
-
96
- if (result instanceof Promise) {
97
- result.then(_this.runGetCaptchaCountDown);
98
- } else {
99
- _this.runGetCaptchaCountDown();
100
- }
101
- };
102
-
103
- _this.getFormItemOptions = function (_ref) {
104
- var onChange = _ref.onChange,
105
- defaultValue = _ref.defaultValue,
106
- customprops = _ref.customprops,
107
- rules = _ref.rules;
108
- var options = {
109
- rules: rules || customprops.rules
110
- };
111
-
112
- if (onChange) {
113
- options.onChange = onChange;
114
- }
115
-
116
- if (defaultValue) {
117
- options.initialValue = defaultValue;
118
- }
119
-
120
- return options;
121
- };
122
-
123
- _this.runGetCaptchaCountDown = function () {
124
- var countDown = _this.props.countDown;
125
- var count = countDown || 59;
126
-
127
- _this.setState({
128
- count: count
129
- });
130
-
131
- _this.interval = setInterval(function () {
132
- count -= 1;
133
-
134
- _this.setState({
135
- count: count
136
- });
137
-
138
- if (count === 0) {
139
- clearInterval(_this.interval);
140
- }
141
- }, 1000);
142
- };
143
-
144
- _this.state = {
145
- count: 0
146
- };
147
- return _this;
148
- }
149
-
150
- _createClass(WrapFormItem, [{
151
- key: "componentDidMount",
152
- value: function componentDidMount() {
153
- var _this$props = this.props,
154
- updateActive = _this$props.updateActive,
155
- name = _this$props.name;
156
-
157
- if (updateActive) {
158
- updateActive(name);
159
- }
160
- }
161
- }, {
162
- key: "componentWillUnmount",
163
- value: function componentWillUnmount() {
164
- clearInterval(this.interval);
165
- }
166
- }, {
167
- key: "render",
168
- value: function render() {
169
- var count = this.state.count; // 这么写是为了防止restProps中 带入 onChange, defaultValue, rules props
170
-
171
- var _this$props2 = this.props,
172
- onChange = _this$props2.onChange,
173
- customprops = _this$props2.customprops,
174
- defaultValue = _this$props2.defaultValue,
175
- rules = _this$props2.rules,
176
- name = _this$props2.name,
177
- getCaptchaButtonText = _this$props2.getCaptchaButtonText,
178
- getCaptchaSecondText = _this$props2.getCaptchaSecondText,
179
- updateActive = _this$props2.updateActive,
180
- type = _this$props2.type,
181
- restProps = _objectWithoutProperties(_this$props2, _excluded);
182
-
183
- var options = this.getFormItemOptions(this.props);
184
- var otherProps = restProps || {};
185
-
186
- if (type === 'Captcha') {
187
- var inputProps = (0, _omit.default)(otherProps, ['onGetCaptcha', 'countDown']);
188
- return /*#__PURE__*/_react.default.createElement(FormItem, {
189
- name: name,
190
- options: options
191
- }, /*#__PURE__*/_react.default.createElement(_row.default, {
192
- gutter: 8
193
- }, /*#__PURE__*/_react.default.createElement(_col.default, {
194
- span: 16
195
- }, /*#__PURE__*/_react.default.createElement(_input.default, _extends({}, customprops, inputProps))), /*#__PURE__*/_react.default.createElement(_col.default, {
196
- span: 8
197
- }, /*#__PURE__*/_react.default.createElement(_button.default, {
198
- disabled: count,
199
- className: _index.default.getCaptcha,
200
- size: "large",
201
- onClick: this.onGetCaptcha
202
- }, count ? "".concat(count, " ").concat(getCaptchaSecondText) : getCaptchaButtonText))));
203
- }
204
-
205
- return /*#__PURE__*/_react.default.createElement(FormItem, {
206
- name: name,
207
- options: options
208
- }, /*#__PURE__*/_react.default.createElement(_input.default, _extends({}, customprops, otherProps)));
209
- }
210
- }]);
211
-
212
- return WrapFormItem;
213
- }(_react.Component);
214
-
215
- WrapFormItem.defaultProps = {
216
- getCaptchaButtonText: 'captcha',
217
- getCaptchaSecondText: 'second'
218
- };
219
- var LoginItem = {};
220
- Object.keys(_map.default).forEach(function (key) {
221
- var item = _map.default[key];
222
-
223
- LoginItem[key] = function (props) {
224
- return /*#__PURE__*/_react.default.createElement(_loginContext.default.Consumer, null, function (context) {
225
- return /*#__PURE__*/_react.default.createElement(WrapFormItem, _extends({
226
- customprops: item.props,
227
- rules: item.rules
228
- }, props, {
229
- type: key,
230
- updateActive: context.updateActive,
231
- form: context.form
232
- }));
233
- });
234
- };
235
- });
236
- var _default = LoginItem;
237
- exports.default = _default;
@@ -1,5 +0,0 @@
1
- export default LoginSubmit;
2
- declare function LoginSubmit({ className, ...rest }: {
3
- [x: string]: any;
4
- className: any;
5
- }): JSX.Element;
@@ -1,5 +0,0 @@
1
- export default wrapContext;
2
- declare function wrapContext(props: any): JSX.Element;
3
- declare namespace wrapContext {
4
- export const typeName: string;
5
- }
@@ -1,100 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- require("antd/es/tabs/style");
11
-
12
- var _tabs = _interopRequireDefault(require("antd/es/tabs"));
13
-
14
- var _react = _interopRequireWildcard(require("react"));
15
-
16
- var _loginContext = _interopRequireDefault(require("./loginContext"));
17
-
18
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
-
26
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
-
28
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
29
-
30
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
31
-
32
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
33
-
34
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
35
-
36
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
37
-
38
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
39
-
40
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
-
42
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
43
-
44
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
45
-
46
- var TabPane = _tabs.default.TabPane;
47
-
48
- var generateId = function () {
49
- var i = 0;
50
- return function () {
51
- var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
52
- i += 1;
53
- return "".concat(prefix).concat(i);
54
- };
55
- }();
56
-
57
- var LoginTab = /*#__PURE__*/function (_Component) {
58
- _inherits(LoginTab, _Component);
59
-
60
- var _super = _createSuper(LoginTab);
61
-
62
- function LoginTab(props) {
63
- var _this;
64
-
65
- _classCallCheck(this, LoginTab);
66
-
67
- _this = _super.call(this, props);
68
- _this.uniqueId = generateId('login-tab-');
69
- return _this;
70
- }
71
-
72
- _createClass(LoginTab, [{
73
- key: "componentDidMount",
74
- value: function componentDidMount() {
75
- var tabUtil = this.props.tabUtil;
76
- tabUtil.addTab(this.uniqueId);
77
- }
78
- }, {
79
- key: "render",
80
- value: function render() {
81
- var children = this.props.children;
82
- return /*#__PURE__*/_react.default.createElement(TabPane, this.props, children);
83
- }
84
- }]);
85
-
86
- return LoginTab;
87
- }(_react.Component);
88
-
89
- var wrapContext = function wrapContext(props) {
90
- return /*#__PURE__*/_react.default.createElement(_loginContext.default.Consumer, null, function (value) {
91
- return /*#__PURE__*/_react.default.createElement(LoginTab, _extends({
92
- tabUtil: value.tabUtil
93
- }, props));
94
- });
95
- }; // 标志位 用来判断是不是自定义组件
96
-
97
-
98
- wrapContext.typeName = 'LoginTab';
99
- var _default = wrapContext;
100
- exports.default = _default;
@@ -1,38 +0,0 @@
1
- export default Login;
2
- declare class Login extends React.Component<any, any, any> {
3
- constructor(props: any);
4
- onSwitch: (type: any) => void;
5
- getContext: () => {
6
- tabUtil: {
7
- addTab: (id: any) => void;
8
- removeTab: (id: any) => void;
9
- };
10
- form: any;
11
- updateActive: (activeItem: any) => void;
12
- };
13
- handleSubmit: (e: any) => void;
14
- }
15
- declare namespace Login {
16
- export namespace propTypes {
17
- export const className: PropTypes.Requireable<string>;
18
- export const defaultActiveKey: PropTypes.Requireable<string>;
19
- export const onTabChange: PropTypes.Requireable<(...args: any[]) => any>;
20
- export const onSubmit: PropTypes.Requireable<(...args: any[]) => any>;
21
- }
22
- export namespace defaultProps {
23
- const className_1: string;
24
- export { className_1 as className };
25
- const defaultActiveKey_1: string;
26
- export { defaultActiveKey_1 as defaultActiveKey };
27
- export function onTabChange_1(): void;
28
- export { onTabChange_1 as onTabChange };
29
- export function onSubmit_1(): void;
30
- export { onSubmit_1 as onSubmit };
31
- }
32
- export { LoginTab as Tab };
33
- export { LoginSubmit as Submit };
34
- }
35
- import React from "react";
36
- import PropTypes from "prop-types";
37
- import LoginTab from "./LoginTab";
38
- import LoginSubmit from "./LoginSubmit";
@@ -1,222 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- require("antd/es/form/style");
11
-
12
- var _form = _interopRequireDefault(require("antd/es/form"));
13
-
14
- require("antd/es/tabs/style");
15
-
16
- var _tabs = _interopRequireDefault(require("antd/es/tabs"));
17
-
18
- var _react = _interopRequireWildcard(require("react"));
19
-
20
- var _propTypes = _interopRequireDefault(require("prop-types"));
21
-
22
- var _classnames = _interopRequireDefault(require("classnames"));
23
-
24
- var _LoginItem = _interopRequireDefault(require("./LoginItem"));
25
-
26
- var _LoginTab = _interopRequireDefault(require("./LoginTab"));
27
-
28
- var _LoginSubmit = _interopRequireDefault(require("./LoginSubmit"));
29
-
30
- var _index = _interopRequireDefault(require("./index.less"));
31
-
32
- var _loginContext = _interopRequireDefault(require("./loginContext"));
33
-
34
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
-
36
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
-
38
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
-
40
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
41
-
42
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
43
-
44
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
45
-
46
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
47
-
48
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
49
-
50
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
51
-
52
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
53
-
54
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
55
-
56
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
57
-
58
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
59
-
60
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
61
-
62
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
63
-
64
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
65
-
66
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
67
-
68
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
69
-
70
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
71
-
72
- var Login = /*#__PURE__*/function (_Component) {
73
- _inherits(Login, _Component);
74
-
75
- var _super = _createSuper(Login);
76
-
77
- function Login(props) {
78
- var _this;
79
-
80
- _classCallCheck(this, Login);
81
-
82
- _this = _super.call(this, props);
83
-
84
- _this.onSwitch = function (type) {
85
- _this.setState({
86
- type: type
87
- });
88
-
89
- var onTabChange = _this.props.onTabChange;
90
- onTabChange(type);
91
- };
92
-
93
- _this.getContext = function () {
94
- var tabs = _this.state.tabs;
95
-
96
- var form = _this.getTargetForm();
97
-
98
- return {
99
- tabUtil: {
100
- addTab: function addTab(id) {
101
- _this.setState({
102
- tabs: [].concat(_toConsumableArray(tabs), [id])
103
- });
104
- },
105
- removeTab: function removeTab(id) {
106
- _this.setState({
107
- tabs: tabs.filter(function (currentId) {
108
- return currentId !== id;
109
- })
110
- });
111
- }
112
- },
113
- form: form,
114
- updateActive: function updateActive(activeItem) {
115
- var _this$state = _this.state,
116
- type = _this$state.type,
117
- active = _this$state.active;
118
-
119
- if (active[type]) {
120
- active[type].push(activeItem);
121
- } else {
122
- active[type] = [activeItem];
123
- }
124
-
125
- _this.setState({
126
- active: active
127
- });
128
- }
129
- };
130
- };
131
-
132
- _this.handleSubmit = function (e) {
133
- var currentForm = e.currentForm;
134
- e.preventDefault();
135
- var _this$state2 = _this.state,
136
- active = _this$state2.active,
137
- type = _this$state2.type;
138
- var onSubmit = _this.props.onSubmit;
139
- var activeFileds = active[type];
140
- currentForm.validateFields(activeFileds, {
141
- force: true
142
- }, function (err, values) {
143
- onSubmit(err, values);
144
- });
145
- };
146
-
147
- _this.state = {
148
- type: props.defaultActiveKey,
149
- tabs: [],
150
- active: {}
151
- };
152
- return _this;
153
- }
154
-
155
- _createClass(Login, [{
156
- key: "render",
157
- value: function render() {
158
- var _this2 = this;
159
-
160
- var _this$props = this.props,
161
- className = _this$props.className,
162
- children = _this$props.children;
163
- var _this$state3 = this.state,
164
- type = _this$state3.type,
165
- tabs = _this$state3.tabs;
166
- var TabChildren = [];
167
- var otherChildren = [];
168
-
169
- _react.default.Children.forEach(children, function (item) {
170
- if (!item) {
171
- return;
172
- } // eslint-disable-next-line
173
-
174
-
175
- if (item.type.typeName === 'LoginTab') {
176
- TabChildren.push(item);
177
- } else {
178
- otherChildren.push(item);
179
- }
180
- }); // const currentForm = Form.useForm();
181
-
182
-
183
- return /*#__PURE__*/_react.default.createElement(_loginContext.default.Provider, {
184
- value: this.getContext()
185
- }, /*#__PURE__*/_react.default.createElement("div", {
186
- className: (0, _classnames.default)(className, _index.default.login)
187
- }, /*#__PURE__*/_react.default.createElement(_form.default, {
188
- noValidate: true,
189
- onFinish: function onFinish(values) {
190
- return _this2.handleSubmit(values);
191
- }
192
- }, tabs.length ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_tabs.default, {
193
- animated: false,
194
- className: _index.default.tabs,
195
- activeKey: type,
196
- onChange: this.onSwitch
197
- }, TabChildren), otherChildren) : children)));
198
- }
199
- }]);
200
-
201
- return Login;
202
- }(_react.Component);
203
-
204
- Login.propTypes = {
205
- className: _propTypes.default.string,
206
- defaultActiveKey: _propTypes.default.string,
207
- onTabChange: _propTypes.default.func,
208
- onSubmit: _propTypes.default.func
209
- };
210
- Login.defaultProps = {
211
- className: '',
212
- defaultActiveKey: '',
213
- onTabChange: function onTabChange() {},
214
- onSubmit: function onSubmit() {}
215
- };
216
- Login.Tab = _LoginTab.default;
217
- Login.Submit = _LoginSubmit.default;
218
- Object.keys(_LoginItem.default).forEach(function (item) {
219
- Login[item] = _LoginItem.default[item];
220
- });
221
- var _default = Login;
222
- exports.default = _default;
@@ -1,2 +0,0 @@
1
- export default LoginContext;
2
- declare const LoginContext: import("react").Context<any>;