xmirror-components 1.0.16 → 1.0.18

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.
@@ -22,6 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import React from 'react';
24
24
  import { App, message as AntdMessage, notification as AntdNotification, Modal as AntdModal } from 'antd';
25
+ import GlobalLoading from './../GlobalLoading';
25
26
  var message = AntdMessage;
26
27
  var notification = AntdNotification;
27
28
  var modal = AntdModal;
@@ -36,6 +37,7 @@ function InitApp(_a) {
36
37
  function Index(_a) {
37
38
  var children = _a.children, props = __rest(_a, ["children"]);
38
39
  return (React.createElement(App, __assign({}, props),
40
+ React.createElement(GlobalLoading, null),
39
41
  React.createElement(InitApp, null, children)));
40
42
  }
41
43
  export { message, notification, modal };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare let setGlobalLoading: (_value: boolean) => void;
4
+ declare function GlobalLoading(): React.JSX.Element;
5
+ export { setGlobalLoading };
6
+ export default GlobalLoading;
@@ -0,0 +1,35 @@
1
+ import React, { useState, useEffect, useRef } from 'react';
2
+ import { CSSTransition } from 'react-transition-group';
3
+ import './index.less';
4
+ var setGlobalLoading = function (_value) {
5
+ console.warn('GlobalLoading 未被引入,你可以直接使用 App 组件,或直接引用 GlobalLoading 组件到项目中!');
6
+ };
7
+ function GlobalLoading() {
8
+ var ref = useRef(null);
9
+ var _a = useState(false), loading = _a[0], setLoading = _a[1];
10
+ useEffect(function () {
11
+ setGlobalLoading = function (value) {
12
+ setLoading(value);
13
+ };
14
+ }, []);
15
+ return (React.createElement(CSSTransition, { in: loading, nodeRef: ref, timeout: 500, classNames: "global-loading-transition", unmountOnExit: true }, function () {
16
+ return (React.createElement("div", { ref: ref, className: "global-loading" },
17
+ React.createElement("div", { className: "global-loading-container" },
18
+ React.createElement("div", { className: "dot dot-1" }),
19
+ React.createElement("div", { className: "dot dot-2" }),
20
+ React.createElement("div", { className: "dot dot-3" }),
21
+ React.createElement("div", { className: "dot dot-4" }),
22
+ React.createElement("div", { className: "dot dot-5" })),
23
+ React.createElement("svg", { style: {
24
+ visibility: 'hidden',
25
+ position: 'absolute'
26
+ } },
27
+ React.createElement("defs", null,
28
+ React.createElement("filter", { id: "goo" },
29
+ React.createElement("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "3", result: "blur" }),
30
+ React.createElement("feColorMatrix", { in: "blur", type: "matrix", values: "\n 1 0 0 0 0\n 0 1 0 0 0\n 0 0 1 0 0\n 0 0 0 18 -2" }),
31
+ React.createElement("feComposite", { in: "SourceGraphic", in2: "goo", operator: "atop" }))))));
32
+ }));
33
+ }
34
+ export { setGlobalLoading };
35
+ export default GlobalLoading;
@@ -17,5 +17,5 @@ declare const IconFont: React.ForwardRefExoticComponent<((IconFontCommonProps &
17
17
  symbol?: false;
18
18
  }) | Omit<IconFontCommonProps & React.SVGProps<SVGSVGElement> & {
19
19
  symbol: true;
20
- }, "ref">) & React.RefAttributes<SVGSVGElement | HTMLElement>>;
20
+ }, "ref">) & React.RefAttributes<HTMLElement | SVGSVGElement>>;
21
21
  export default IconFont;
@@ -3,4 +3,5 @@ export { default as IconFont } from './components/IconFont';
3
3
  export { default as CheckboxValue } from './components/CheckboxValue';
4
4
  export { default as SwitchValue } from './components/SwitchValue';
5
5
  export { default as IconButton } from './components/IconButton';
6
+ export { default as GlobalLoading, setGlobalLoading } from './components/GlobalLoading';
6
7
  export { default as useRequest } from './hooks/useRequest';
package/build/es/index.js CHANGED
@@ -3,4 +3,5 @@ export { default as IconFont } from './components/IconFont';
3
3
  export { default as CheckboxValue } from './components/CheckboxValue';
4
4
  export { default as SwitchValue } from './components/SwitchValue';
5
5
  export { default as IconButton } from './components/IconButton';
6
+ export { default as GlobalLoading, setGlobalLoading } from './components/GlobalLoading';
6
7
  export { default as useRequest } from './hooks/useRequest';
@@ -28,6 +28,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.modal = exports.notification = exports.message = void 0;
29
29
  var react_1 = __importDefault(require("react"));
30
30
  var antd_1 = require("antd");
31
+ var GlobalLoading_1 = __importDefault(require("./../GlobalLoading"));
31
32
  var message = antd_1.message;
32
33
  exports.message = message;
33
34
  var notification = antd_1.notification;
@@ -45,6 +46,7 @@ function InitApp(_a) {
45
46
  function Index(_a) {
46
47
  var children = _a.children, props = __rest(_a, ["children"]);
47
48
  return (react_1.default.createElement(antd_1.App, __assign({}, props),
49
+ react_1.default.createElement(GlobalLoading_1.default, null),
48
50
  react_1.default.createElement(InitApp, null, children)));
49
51
  }
50
52
  exports.default = Index;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare let setGlobalLoading: (_value: boolean) => void;
4
+ declare function GlobalLoading(): React.JSX.Element;
5
+ export { setGlobalLoading };
6
+ export default GlobalLoading;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.setGlobalLoading = void 0;
37
+ var react_1 = __importStar(require("react"));
38
+ var react_transition_group_1 = require("react-transition-group");
39
+ require("./index.less");
40
+ var setGlobalLoading = function (_value) {
41
+ console.warn('GlobalLoading 未被引入,你可以直接使用 App 组件,或直接引用 GlobalLoading 组件到项目中!');
42
+ };
43
+ exports.setGlobalLoading = setGlobalLoading;
44
+ function GlobalLoading() {
45
+ var ref = (0, react_1.useRef)(null);
46
+ var _a = (0, react_1.useState)(false), loading = _a[0], setLoading = _a[1];
47
+ (0, react_1.useEffect)(function () {
48
+ exports.setGlobalLoading = setGlobalLoading = function (value) {
49
+ setLoading(value);
50
+ };
51
+ }, []);
52
+ return (react_1.default.createElement(react_transition_group_1.CSSTransition, { in: loading, nodeRef: ref, timeout: 500, classNames: "global-loading-transition", unmountOnExit: true }, function () {
53
+ return (react_1.default.createElement("div", { ref: ref, className: "global-loading" },
54
+ react_1.default.createElement("div", { className: "global-loading-container" },
55
+ react_1.default.createElement("div", { className: "dot dot-1" }),
56
+ react_1.default.createElement("div", { className: "dot dot-2" }),
57
+ react_1.default.createElement("div", { className: "dot dot-3" }),
58
+ react_1.default.createElement("div", { className: "dot dot-4" }),
59
+ react_1.default.createElement("div", { className: "dot dot-5" })),
60
+ react_1.default.createElement("svg", { style: {
61
+ visibility: 'hidden',
62
+ position: 'absolute'
63
+ } },
64
+ react_1.default.createElement("defs", null,
65
+ react_1.default.createElement("filter", { id: "goo" },
66
+ react_1.default.createElement("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "3", result: "blur" }),
67
+ react_1.default.createElement("feColorMatrix", { in: "blur", type: "matrix", values: "\n 1 0 0 0 0\n 0 1 0 0 0\n 0 0 1 0 0\n 0 0 0 18 -2" }),
68
+ react_1.default.createElement("feComposite", { in: "SourceGraphic", in2: "goo", operator: "atop" }))))));
69
+ }));
70
+ }
71
+ exports.default = GlobalLoading;
@@ -17,5 +17,5 @@ declare const IconFont: React.ForwardRefExoticComponent<((IconFontCommonProps &
17
17
  symbol?: false;
18
18
  }) | Omit<IconFontCommonProps & React.SVGProps<SVGSVGElement> & {
19
19
  symbol: true;
20
- }, "ref">) & React.RefAttributes<SVGSVGElement | HTMLElement>>;
20
+ }, "ref">) & React.RefAttributes<HTMLElement | SVGSVGElement>>;
21
21
  export default IconFont;
@@ -51,6 +51,8 @@ declare interface CheckboxValueProps<T = any, F = any> extends Omit<React_2.Comp
51
51
  children?: React_2.ReactNode;
52
52
  }
53
53
 
54
+ export declare function GlobalLoading(): React_2.JSX.Element;
55
+
54
56
  export declare const IconButton: React_2.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React_2.RefAttributes<any>>;
55
57
 
56
58
  declare interface IconButtonProps {
@@ -96,7 +98,7 @@ export declare const IconFont: React_2.ForwardRefExoticComponent<((IconFontCommo
96
98
  symbol?: false;
97
99
  }) | Omit<IconFontCommonProps & React_2.SVGProps<SVGSVGElement> & {
98
100
  symbol: true;
99
- }, "ref">) & React_2.RefAttributes<SVGSVGElement | HTMLElement>>;
101
+ }, "ref">) & React_2.RefAttributes<HTMLElement | SVGSVGElement>>;
100
102
 
101
103
  declare interface IconFontCommonProps {
102
104
  /**
@@ -127,6 +129,8 @@ declare interface Options<TData, TParams extends unknown[]> extends Options_2<TD
127
129
  errorMessage?: boolean;
128
130
  }
129
131
 
132
+ export declare let setGlobalLoading: (_value: boolean) => void;
133
+
130
134
  /**
131
135
  * Switch 可自定义 value
132
136
  */
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useRequest = exports.IconButton = exports.SwitchValue = exports.CheckboxValue = exports.IconFont = exports.modal = exports.notification = exports.message = exports.App = void 0;
6
+ exports.useRequest = exports.setGlobalLoading = exports.GlobalLoading = exports.IconButton = exports.SwitchValue = exports.CheckboxValue = exports.IconFont = exports.modal = exports.notification = exports.message = exports.App = void 0;
7
7
  var AntdApp_1 = require("./components/AntdApp");
8
8
  Object.defineProperty(exports, "App", { enumerable: true, get: function () { return __importDefault(AntdApp_1).default; } });
9
9
  Object.defineProperty(exports, "message", { enumerable: true, get: function () { return AntdApp_1.message; } });
@@ -17,5 +17,8 @@ var SwitchValue_1 = require("./components/SwitchValue");
17
17
  Object.defineProperty(exports, "SwitchValue", { enumerable: true, get: function () { return __importDefault(SwitchValue_1).default; } });
18
18
  var IconButton_1 = require("./components/IconButton");
19
19
  Object.defineProperty(exports, "IconButton", { enumerable: true, get: function () { return __importDefault(IconButton_1).default; } });
20
+ var GlobalLoading_1 = require("./components/GlobalLoading");
21
+ Object.defineProperty(exports, "GlobalLoading", { enumerable: true, get: function () { return __importDefault(GlobalLoading_1).default; } });
22
+ Object.defineProperty(exports, "setGlobalLoading", { enumerable: true, get: function () { return GlobalLoading_1.setGlobalLoading; } });
20
23
  var useRequest_1 = require("./hooks/useRequest");
21
24
  Object.defineProperty(exports, "useRequest", { enumerable: true, get: function () { return __importDefault(useRequest_1).default; } });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmirror-components",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "type": "module",
5
5
  "main": "build/lib/index.js",
6
6
  "module": "build/es/index.js",
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare let setGlobalLoading: (_value: boolean) => void;
4
+ declare function GlobalLoading(): React.JSX.Element;
5
+ export { setGlobalLoading };
6
+ export default GlobalLoading;
@@ -17,5 +17,5 @@ declare const IconFont: React.ForwardRefExoticComponent<((IconFontCommonProps &
17
17
  symbol?: false;
18
18
  }) | Omit<IconFontCommonProps & React.SVGProps<SVGSVGElement> & {
19
19
  symbol: true;
20
- }, "ref">) & React.RefAttributes<SVGSVGElement | HTMLElement>>;
20
+ }, "ref">) & React.RefAttributes<HTMLElement | SVGSVGElement>>;
21
21
  export default IconFont;
@@ -3,4 +3,5 @@ export { default as IconFont } from './components/IconFont';
3
3
  export { default as CheckboxValue } from './components/CheckboxValue';
4
4
  export { default as SwitchValue } from './components/SwitchValue';
5
5
  export { default as IconButton } from './components/IconButton';
6
+ export { default as GlobalLoading, setGlobalLoading } from './components/GlobalLoading';
6
7
  export { default as useRequest } from './hooks/useRequest';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmirror-components",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "type": "module",
5
5
  "main": "build/lib/index.js",
6
6
  "module": "build/es/index.js",