react-alp-loading-bar 3.1.3 → 4.0.3
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.
- package/.eslintrc.json +1 -1
- package/CHANGELOG.md +48 -0
- package/dist/index-browser.es.js +17 -31
- package/dist/index-browser.es.js.map +1 -1
- package/dist/index-browsermodern.es.js +23 -40
- package/dist/index-browsermodern.es.js.map +1 -1
- package/dist/{index-node12.mjs → index-node14.mjs} +24 -41
- package/dist/index-node14.mjs.map +1 -0
- package/dist/index.d.ts +6 -8
- package/dist/index.d.ts.map +1 -1
- package/package.json +28 -50
- package/rollup.config.mjs +5 -0
- package/src/.eslintrc.json +19 -2
- package/src/index.tsx +13 -15
- package/tsconfig.eslint.json +7 -0
- package/dist/index-browser-dev.cjs.js +0 -181
- package/dist/index-browser-dev.cjs.js.map +0 -1
- package/dist/index-browser-dev.es.js +0 -171
- package/dist/index-browser-dev.es.js.map +0 -1
- package/dist/index-browser.cjs.js +0 -181
- package/dist/index-browser.cjs.js.map +0 -1
- package/dist/index-browsermodern-dev.es.js +0 -147
- package/dist/index-browsermodern-dev.es.js.map +0 -1
- package/dist/index-node12-dev.cjs.js +0 -156
- package/dist/index-node12-dev.cjs.js.map +0 -1
- package/dist/index-node12-dev.mjs +0 -147
- package/dist/index-node12-dev.mjs.map +0 -1
- package/dist/index-node12.cjs.js +0 -156
- package/dist/index-node12.cjs.js.map +0 -1
- package/dist/index-node12.mjs.map +0 -1
- package/index.js +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-alp-loading-bar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "loading bar",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",
|
|
@@ -11,65 +11,46 @@
|
|
|
11
11
|
"directory": "packages/react-alp-loading-bar"
|
|
12
12
|
},
|
|
13
13
|
"homepage": "https://github.com/christophehurpeau/alp",
|
|
14
|
+
"type": "module",
|
|
14
15
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
16
|
+
"node": "^14.13.1 || >=16.0.0"
|
|
16
17
|
},
|
|
17
18
|
"browserslist": [
|
|
19
|
+
"defaults",
|
|
18
20
|
"> 0.2%",
|
|
19
|
-
"Firefox ESR",
|
|
20
|
-
"last 2 Chrome versions",
|
|
21
|
-
"last 2 iOS versions",
|
|
22
|
-
"last 2 Edge versions",
|
|
23
|
-
"last 2 Safari versions",
|
|
24
21
|
"not ie < 12",
|
|
25
|
-
"not
|
|
26
|
-
"not
|
|
27
|
-
"not op_mini all"
|
|
22
|
+
"not safari < 10",
|
|
23
|
+
"not ios_saf < 10"
|
|
28
24
|
],
|
|
29
|
-
"main": "./index.
|
|
25
|
+
"main": "./dist/index-node14.mjs",
|
|
30
26
|
"types": "./dist/index.d.ts",
|
|
31
27
|
"module": "./dist/index-browser.es.js",
|
|
32
28
|
"browser": "./dist/index-browser.es.js",
|
|
33
29
|
"exports": {
|
|
30
|
+
"./package.json": "./package.json",
|
|
34
31
|
".": {
|
|
35
32
|
"node": {
|
|
36
|
-
"
|
|
37
|
-
"import": "./dist/index-node12-dev.mjs",
|
|
38
|
-
"require": "./dist/index-node12-dev.cjs.js"
|
|
39
|
-
},
|
|
40
|
-
"import": "./dist/index-node12.mjs",
|
|
41
|
-
"require": "./dist/index-node12.cjs.js"
|
|
33
|
+
"import": "./dist/index-node14.mjs"
|
|
42
34
|
},
|
|
43
35
|
"browser": {
|
|
44
36
|
"browser:modern": {
|
|
45
|
-
"development": {
|
|
46
|
-
"import": "./dist/index-browsermodern-dev.es.js"
|
|
47
|
-
},
|
|
48
37
|
"import": "./dist/index-browsermodern.es.js"
|
|
49
38
|
},
|
|
50
|
-
"
|
|
51
|
-
"import": "./dist/index-browser-dev.es.js",
|
|
52
|
-
"require": "./dist/index-browser-dev.cjs.js"
|
|
53
|
-
},
|
|
54
|
-
"import": "./dist/index-browser.es.js",
|
|
55
|
-
"require": "./dist/index-browser.cjs.js"
|
|
39
|
+
"import": "./dist/index-browser.es.js"
|
|
56
40
|
}
|
|
57
41
|
}
|
|
58
42
|
},
|
|
59
|
-
"module:node": "./dist/index-
|
|
60
|
-
"module:node-dev": "./dist/index-node12-dev.mjs",
|
|
61
|
-
"module:browser": "./dist/index-browser.es.js",
|
|
62
|
-
"module:browser-dev": "./dist/index-browser-dev.es.js",
|
|
43
|
+
"module:node": "./dist/index-node14.mjs",
|
|
63
44
|
"module:modern-browsers": "./dist/index-browsermodern.es.js",
|
|
64
|
-
"module:modern-browsers-dev": "./dist/index-browsermodern-dev.es.js",
|
|
65
45
|
"sideEffects": false,
|
|
66
46
|
"scripts": {
|
|
67
|
-
"build": "
|
|
47
|
+
"build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
|
|
68
48
|
"build:definitions": "tsc -p tsconfig.build.json",
|
|
69
|
-
"clean": "
|
|
49
|
+
"clean": "yarn clean:build",
|
|
50
|
+
"clean:build": "rm -Rf dist",
|
|
70
51
|
"lint": "yarn run lint:eslint",
|
|
71
|
-
"lint:eslint": "
|
|
72
|
-
"watch": "
|
|
52
|
+
"lint:eslint": "cd ../.. && yarn run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/react-alp-loading-bar",
|
|
53
|
+
"watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
|
|
73
54
|
},
|
|
74
55
|
"prettier": {
|
|
75
56
|
"trailingComma": "all",
|
|
@@ -80,9 +61,8 @@
|
|
|
80
61
|
"babelEnvs": [
|
|
81
62
|
{
|
|
82
63
|
"target": "node",
|
|
83
|
-
"version": "
|
|
64
|
+
"version": "14",
|
|
84
65
|
"formats": [
|
|
85
|
-
"cjs",
|
|
86
66
|
"es"
|
|
87
67
|
]
|
|
88
68
|
},
|
|
@@ -96,7 +76,6 @@
|
|
|
96
76
|
{
|
|
97
77
|
"target": "browser",
|
|
98
78
|
"formats": [
|
|
99
|
-
"cjs",
|
|
100
79
|
"es"
|
|
101
80
|
]
|
|
102
81
|
}
|
|
@@ -107,22 +86,21 @@
|
|
|
107
86
|
"jsx": true
|
|
108
87
|
},
|
|
109
88
|
"peerDependencies": {
|
|
110
|
-
"react": "^
|
|
89
|
+
"react": "^17.0.2"
|
|
111
90
|
},
|
|
112
91
|
"dependencies": {
|
|
113
|
-
"@babel/runtime": "^7.
|
|
114
|
-
"alp-types": "
|
|
115
|
-
"react-alp-context": "
|
|
92
|
+
"@babel/runtime": "^7.17.2",
|
|
93
|
+
"alp-types": "3.1.0",
|
|
94
|
+
"react-alp-context": "4.0.3"
|
|
116
95
|
},
|
|
117
96
|
"devDependencies": {
|
|
118
|
-
"@babel/core": "7.
|
|
119
|
-
"@babel/preset-env": "7.
|
|
120
|
-
"@babel/preset-react": "7.
|
|
121
|
-
"babel-preset-latest-node": "5.5.1",
|
|
97
|
+
"@babel/core": "7.17.2",
|
|
98
|
+
"@babel/preset-env": "7.16.11",
|
|
99
|
+
"@babel/preset-react": "7.16.7",
|
|
122
100
|
"babel-preset-modern-browsers": "15.0.2",
|
|
123
|
-
"pob-babel": "
|
|
124
|
-
"react": "
|
|
125
|
-
"
|
|
101
|
+
"pob-babel": "32.0.1",
|
|
102
|
+
"react": "17.0.2",
|
|
103
|
+
"typescript": "4.5.5"
|
|
126
104
|
},
|
|
127
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "1617223e61c2b76e0613a49012792fbf6d3b872b"
|
|
128
106
|
}
|
package/src/.eslintrc.json
CHANGED
|
@@ -2,12 +2,29 @@
|
|
|
2
2
|
"root": true,
|
|
3
3
|
"parser": "@typescript-eslint/parser",
|
|
4
4
|
"parserOptions": {
|
|
5
|
-
"project": "packages/react-alp-loading-bar/tsconfig.json"
|
|
5
|
+
"project": "packages/react-alp-loading-bar/tsconfig.eslint.json"
|
|
6
6
|
},
|
|
7
7
|
"plugins": ["@typescript-eslint"],
|
|
8
8
|
"extends": [
|
|
9
9
|
"@pob/eslint-config-typescript",
|
|
10
10
|
"@pob/eslint-config-typescript-react"
|
|
11
11
|
],
|
|
12
|
-
"ignorePatterns": ["*.d.ts"]
|
|
12
|
+
"ignorePatterns": ["*.d.ts"],
|
|
13
|
+
"overrides": [
|
|
14
|
+
{
|
|
15
|
+
"files": ["**/*.test.{ts,tsx}", "__tests__/**/*.{ts,tsx}"],
|
|
16
|
+
"extends": ["@pob/eslint-config-typescript/test"],
|
|
17
|
+
"env": {
|
|
18
|
+
"jest": true
|
|
19
|
+
},
|
|
20
|
+
"rules": {
|
|
21
|
+
"import/no-extraneous-dependencies": [
|
|
22
|
+
"error",
|
|
23
|
+
{
|
|
24
|
+
"devDependencies": true
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
]
|
|
13
30
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { PureComponent } from 'react';
|
|
3
3
|
import ReactAlpContext from 'react-alp-context';
|
|
4
4
|
|
|
5
5
|
/*
|
|
@@ -56,21 +56,19 @@ export default class LoadingBar extends PureComponent<
|
|
|
56
56
|
> {
|
|
57
57
|
static contextType = ReactAlpContext;
|
|
58
58
|
|
|
59
|
-
context!: React.ContextType<typeof ReactAlpContext>;
|
|
60
|
-
|
|
61
59
|
state = {
|
|
62
60
|
loading: true,
|
|
63
61
|
hidden: true,
|
|
64
62
|
progress: 1,
|
|
65
63
|
};
|
|
66
64
|
|
|
67
|
-
fadeOffTimeout?:
|
|
65
|
+
fadeOffTimeout?: ReturnType<typeof setTimeout>;
|
|
68
66
|
|
|
69
|
-
resetTimeout?:
|
|
67
|
+
resetTimeout?: ReturnType<typeof setTimeout>;
|
|
70
68
|
|
|
71
|
-
first20Timeout?:
|
|
69
|
+
first20Timeout?: ReturnType<typeof setTimeout>;
|
|
72
70
|
|
|
73
|
-
progressTimer?:
|
|
71
|
+
progressTimer?: ReturnType<typeof setTimeout>;
|
|
74
72
|
|
|
75
73
|
componentDidMount(): void {
|
|
76
74
|
const websocket = this.getWebsocket();
|
|
@@ -103,10 +101,10 @@ export default class LoadingBar extends PureComponent<
|
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
componentWillUnmount(): void {
|
|
106
|
-
clearTimeout(this.fadeOffTimeout);
|
|
107
|
-
clearTimeout(this.resetTimeout);
|
|
108
|
-
clearTimeout(this.first20Timeout);
|
|
109
|
-
clearInterval(this.progressTimer);
|
|
104
|
+
if (this.fadeOffTimeout) clearTimeout(this.fadeOffTimeout);
|
|
105
|
+
if (this.resetTimeout) clearTimeout(this.resetTimeout);
|
|
106
|
+
if (this.first20Timeout) clearTimeout(this.first20Timeout);
|
|
107
|
+
if (this.progressTimer) clearInterval(this.progressTimer);
|
|
110
108
|
}
|
|
111
109
|
|
|
112
110
|
getWebsocket(): WebsocketInterface {
|
|
@@ -115,8 +113,8 @@ export default class LoadingBar extends PureComponent<
|
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
private showBar(): void {
|
|
118
|
-
clearTimeout(this.fadeOffTimeout);
|
|
119
|
-
clearTimeout(this.resetTimeout);
|
|
116
|
+
if (this.fadeOffTimeout) clearTimeout(this.fadeOffTimeout);
|
|
117
|
+
if (this.resetTimeout) clearTimeout(this.resetTimeout);
|
|
120
118
|
|
|
121
119
|
this.first20Timeout = setTimeout(() => {
|
|
122
120
|
this.setState({ progress: 20 });
|
|
@@ -131,8 +129,8 @@ export default class LoadingBar extends PureComponent<
|
|
|
131
129
|
}
|
|
132
130
|
|
|
133
131
|
private hideBar(): void {
|
|
134
|
-
clearTimeout(this.first20Timeout);
|
|
135
|
-
clearInterval(this.progressTimer);
|
|
132
|
+
if (this.first20Timeout) clearTimeout(this.first20Timeout);
|
|
133
|
+
if (this.progressTimer) clearInterval(this.progressTimer);
|
|
136
134
|
|
|
137
135
|
this.fadeOffTimeout = setTimeout(() => {
|
|
138
136
|
this.setState({
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _inheritsLoose = require('@babel/runtime/helpers/esm/inheritsLoose');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var ReactAlpContext = require('react-alp-context');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
|
10
|
-
|
|
11
|
-
var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
|
|
12
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
-
var ReactAlpContext__default = /*#__PURE__*/_interopDefaultLegacy(ReactAlpContext);
|
|
14
|
-
|
|
15
|
-
/*
|
|
16
|
-
Example with antd:
|
|
17
|
-
import { Progress } from 'antd';
|
|
18
|
-
|
|
19
|
-
const LoadingBarComponent = ({ progress }) => (
|
|
20
|
-
<Progress
|
|
21
|
-
type="line"
|
|
22
|
-
status="active"
|
|
23
|
-
percent={progress}
|
|
24
|
-
showInfo={false}
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/* number between 0 and 1 */
|
|
30
|
-
|
|
31
|
-
var random = function random() {
|
|
32
|
-
return Math.ceil(Math.random() * 100) / 100;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* around:
|
|
36
|
-
* at 100ms 20%
|
|
37
|
-
* at 1s 40%
|
|
38
|
-
* at 2s 60%
|
|
39
|
-
* at 3s 80%
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var calculatePercent = function calculatePercent(percent) {
|
|
44
|
-
if (percent < 60) return percent + random() * 10 + 5;
|
|
45
|
-
if (percent < 70) return percent + random() * 10 + 3;else if (percent < 80) return percent + random() + 5;else if (percent < 90) return percent + random() + 1;else if (percent < 95) return percent + 0.1;else return percent;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
var LoadingBar = /*#__PURE__*/function (_PureComponent) {
|
|
49
|
-
_inheritsLoose__default(LoadingBar, _PureComponent);
|
|
50
|
-
|
|
51
|
-
function LoadingBar() {
|
|
52
|
-
var _this, _len, args, _key;
|
|
53
|
-
|
|
54
|
-
for (_len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
55
|
-
args[_key] = arguments[_key];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
_this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
|
|
59
|
-
_this.state = {
|
|
60
|
-
loading: true,
|
|
61
|
-
hidden: true,
|
|
62
|
-
progress: 1
|
|
63
|
-
};
|
|
64
|
-
return _this;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
var _proto = LoadingBar.prototype;
|
|
68
|
-
|
|
69
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
70
|
-
var _this2 = this;
|
|
71
|
-
|
|
72
|
-
var websocket = this.getWebsocket();
|
|
73
|
-
|
|
74
|
-
if (websocket.isConnected()) {
|
|
75
|
-
this.setState(function (prevState) {
|
|
76
|
-
return {
|
|
77
|
-
loading: false,
|
|
78
|
-
progress: 100,
|
|
79
|
-
hidden: prevState.hidden || prevState.progress === 100
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
websocket.on('connect', function () {
|
|
85
|
-
_this2.setState({
|
|
86
|
-
loading: false
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
websocket.on('disconnect', function () {
|
|
90
|
-
_this2.setState({
|
|
91
|
-
loading: true,
|
|
92
|
-
progress: 1,
|
|
93
|
-
hidden: false
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
|
99
|
-
if (this.state.loading !== prevState.loading) {
|
|
100
|
-
if (this.state.loading) {
|
|
101
|
-
this.showBar();
|
|
102
|
-
} else {
|
|
103
|
-
this.hideBar();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
109
|
-
clearTimeout(this.fadeOffTimeout);
|
|
110
|
-
clearTimeout(this.resetTimeout);
|
|
111
|
-
clearTimeout(this.first20Timeout);
|
|
112
|
-
clearInterval(this.progressTimer);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
_proto.getWebsocket = function getWebsocket() {
|
|
116
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
117
|
-
return this.context.app.websocket;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
_proto.showBar = function showBar() {
|
|
121
|
-
var _this3 = this;
|
|
122
|
-
|
|
123
|
-
clearTimeout(this.fadeOffTimeout);
|
|
124
|
-
clearTimeout(this.resetTimeout);
|
|
125
|
-
this.first20Timeout = setTimeout(function () {
|
|
126
|
-
_this3.setState({
|
|
127
|
-
progress: 20
|
|
128
|
-
});
|
|
129
|
-
}, 100);
|
|
130
|
-
this.progressTimer = setInterval(function () {
|
|
131
|
-
_this3.setState(function (prevState) {
|
|
132
|
-
var newValue = calculatePercent(prevState.progress);
|
|
133
|
-
return {
|
|
134
|
-
progress: newValue
|
|
135
|
-
};
|
|
136
|
-
});
|
|
137
|
-
}, 500);
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
_proto.hideBar = function hideBar() {
|
|
141
|
-
var _this4 = this;
|
|
142
|
-
|
|
143
|
-
clearTimeout(this.first20Timeout);
|
|
144
|
-
clearInterval(this.progressTimer);
|
|
145
|
-
this.fadeOffTimeout = setTimeout(function () {
|
|
146
|
-
_this4.setState({
|
|
147
|
-
progress: 100
|
|
148
|
-
});
|
|
149
|
-
}, 500);
|
|
150
|
-
this.resetTimeout = setTimeout(function () {
|
|
151
|
-
_this4.setState({
|
|
152
|
-
hidden: true,
|
|
153
|
-
progress: 1
|
|
154
|
-
});
|
|
155
|
-
}, 1000);
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
_proto.render = function render() {
|
|
159
|
-
var LoadingBarComponent = this.props.LoadingBarComponent;
|
|
160
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
161
|
-
hidden: this.state.hidden,
|
|
162
|
-
style: {
|
|
163
|
-
position: 'fixed',
|
|
164
|
-
top: 0,
|
|
165
|
-
left: 0,
|
|
166
|
-
right: 0,
|
|
167
|
-
zIndex: 4,
|
|
168
|
-
pointerEvents: 'none'
|
|
169
|
-
}
|
|
170
|
-
}, /*#__PURE__*/React__default.createElement(LoadingBarComponent, {
|
|
171
|
-
progress: this.state.progress
|
|
172
|
-
}));
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
return LoadingBar;
|
|
176
|
-
}(React.PureComponent);
|
|
177
|
-
|
|
178
|
-
LoadingBar.contextType = ReactAlpContext__default;
|
|
179
|
-
|
|
180
|
-
exports.default = LoadingBar;
|
|
181
|
-
//# sourceMappingURL=index-browser-dev.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-browser-dev.cjs.js","sources":["../src/index.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React, { PureComponent } from 'react';\nimport ReactAlpContext from 'react-alp-context';\n\n/*\nExample with antd:\nimport { Progress } from 'antd';\n\nconst LoadingBarComponent = ({ progress }) => (\n <Progress\n type=\"line\"\n status=\"active\"\n percent={progress}\n showInfo={false}\n />\n);\n*/\n\n/* number between 0 and 1 */\nconst random = (): number => Math.ceil(Math.random() * 100) / 100;\n\n/**\n * around:\n * at 100ms 20%\n * at 1s 40%\n * at 2s 60%\n * at 3s 80%\n */\nconst calculatePercent = (percent: number): number => {\n if (percent < 60) return percent + random() * 10 + 5;\n if (percent < 70) return percent + random() * 10 + 3;\n else if (percent < 80) return percent + random() + 5;\n else if (percent < 90) return percent + random() + 1;\n else if (percent < 95) return percent + 0.1;\n else return percent;\n};\n\ninterface LoadingBarProps {\n LoadingBarComponent: React.ComponentType<{ progress: number }>;\n}\n\ninterface LoadingBarState {\n loading: boolean;\n hidden: boolean;\n progress: number;\n}\n\ninterface WebsocketInterface {\n isConnected: () => boolean;\n on: (event: 'connect' | 'disconnect', callback: () => unknown) => void;\n}\n\nexport default class LoadingBar extends PureComponent<\n LoadingBarProps,\n LoadingBarState\n> {\n static contextType = ReactAlpContext;\n\n context!: React.ContextType<typeof ReactAlpContext>;\n\n state = {\n loading: true,\n hidden: true,\n progress: 1,\n };\n\n fadeOffTimeout?: any;\n\n resetTimeout?: any;\n\n first20Timeout?: any;\n\n progressTimer?: any;\n\n componentDidMount(): void {\n const websocket = this.getWebsocket();\n if (websocket.isConnected()) {\n this.setState((prevState) => ({\n loading: false,\n progress: 100,\n hidden: prevState.hidden || prevState.progress === 100,\n }));\n }\n websocket.on('connect', () => {\n this.setState({ loading: false });\n });\n websocket.on('disconnect', () => {\n this.setState({ loading: true, progress: 1, hidden: false });\n });\n }\n\n componentDidUpdate(\n prevProps: LoadingBarProps,\n prevState: LoadingBarState,\n ): void {\n if (this.state.loading !== prevState.loading) {\n if (this.state.loading) {\n this.showBar();\n } else {\n this.hideBar();\n }\n }\n }\n\n componentWillUnmount(): void {\n clearTimeout(this.fadeOffTimeout);\n clearTimeout(this.resetTimeout);\n clearTimeout(this.first20Timeout);\n clearInterval(this.progressTimer);\n }\n\n getWebsocket(): WebsocketInterface {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return this.context.app.websocket;\n }\n\n private showBar(): void {\n clearTimeout(this.fadeOffTimeout);\n clearTimeout(this.resetTimeout);\n\n this.first20Timeout = setTimeout(() => {\n this.setState({ progress: 20 });\n }, 100);\n\n this.progressTimer = setInterval(() => {\n this.setState((prevState) => {\n const newValue = calculatePercent(prevState.progress);\n return { progress: newValue };\n });\n }, 500);\n }\n\n private hideBar(): void {\n clearTimeout(this.first20Timeout);\n clearInterval(this.progressTimer);\n\n this.fadeOffTimeout = setTimeout(() => {\n this.setState({\n progress: 100,\n });\n }, 500);\n\n this.resetTimeout = setTimeout(() => {\n this.setState({\n hidden: true,\n progress: 1,\n });\n }, 1000);\n }\n\n render(): ReactElement {\n const LoadingBarComponent = this.props.LoadingBarComponent;\n\n return (\n <div\n hidden={this.state.hidden}\n style={{\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 4,\n pointerEvents: 'none',\n }}\n >\n <LoadingBarComponent progress={this.state.progress} />\n </div>\n );\n }\n}\n"],"names":["random","Math","ceil","calculatePercent","percent","LoadingBar","state","loading","hidden","progress","componentDidMount","websocket","getWebsocket","isConnected","setState","prevState","on","componentDidUpdate","prevProps","showBar","hideBar","componentWillUnmount","clearTimeout","fadeOffTimeout","resetTimeout","first20Timeout","clearInterval","progressTimer","context","app","setTimeout","setInterval","newValue","render","LoadingBarComponent","props","React","position","top","left","right","zIndex","pointerEvents","PureComponent","contextType","ReactAlpContext"],"mappings":";;;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA,IAAMA,MAAM,GAAG,SAATA,MAAS;AAAA,SAAcC,IAAI,CAACC,IAAL,CAAUD,IAAI,CAACD,MAAL,KAAgB,GAA1B,IAAiC,GAA/C;AAAA,CAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAMG,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,OAAD,EAA6B;AACpD,MAAIA,OAAO,GAAG,EAAd,EAAkB,OAAOA,OAAO,GAAGJ,MAAM,KAAK,EAArB,GAA0B,CAAjC;AAClB,MAAII,OAAO,GAAG,EAAd,EAAkB,OAAOA,OAAO,GAAGJ,MAAM,KAAK,EAArB,GAA0B,CAAjC,CAAlB,KACK,IAAII,OAAO,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OAAd;AAGD,KAJ+B,EAI7B,GAJ6B,CAAhC;AAMA,SAAKe,YAAL,GAAoBM,UAAU,CAAC,YAAM;AACnC,MAAA,MAAI,CAAChB,QAAL,CAAc;AACZN,QAAAA,MAAM,EAAE,IADI;AAEZC,QAAAA,QAAQ,EAAE;AAFE,OAAd;AAID,KAL6B,EAK3B,IAL2B,CAA9B;AAMD;;SAEDwB,SAAA,kBAAuB;AACrB,QAAMC,mBAAmB,GAAG,KAAKC,KAAL,CAAWD,mBAAvC;AAEA,wBACEE;AACE,MAAA,MAAM,EAAE,KAAK9B,KAAL,CAAWE,MADrB;AAEE,MAAA,KAAK,EAAE;AACL6B,QAAAA,QAAQ,EAAE,OADL;AAELC,QAAAA,GAAG,EAAE,CAFA;AAGLC,QAAAA,IAAI,EAAE,CAHD;AAILC,QAAAA,KAAK,EAAE,CAJF;AAKLC,QAAAA,MAAM,EAAE,CALH;AAMLC,QAAAA,aAAa,EAAE;AANV;AAFT,oBAWEN,6BAAC,mBAAD;AAAqB,MAAA,QAAQ,EAAE,KAAK9B,KAAL,CAAWG;AAA1C,MAXF,CADF;AAeD;;;EApHqCkC;;AAAnBtC,WAIZuC,cAAcC;;;;"}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
3
|
-
import ReactAlpContext from 'react-alp-context';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
Example with antd:
|
|
7
|
-
import { Progress } from 'antd';
|
|
8
|
-
|
|
9
|
-
const LoadingBarComponent = ({ progress }) => (
|
|
10
|
-
<Progress
|
|
11
|
-
type="line"
|
|
12
|
-
status="active"
|
|
13
|
-
percent={progress}
|
|
14
|
-
showInfo={false}
|
|
15
|
-
/>
|
|
16
|
-
);
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/* number between 0 and 1 */
|
|
20
|
-
|
|
21
|
-
var random = function random() {
|
|
22
|
-
return Math.ceil(Math.random() * 100) / 100;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* around:
|
|
26
|
-
* at 100ms 20%
|
|
27
|
-
* at 1s 40%
|
|
28
|
-
* at 2s 60%
|
|
29
|
-
* at 3s 80%
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var calculatePercent = function calculatePercent(percent) {
|
|
34
|
-
if (percent < 60) return percent + random() * 10 + 5;
|
|
35
|
-
if (percent < 70) return percent + random() * 10 + 3;else if (percent < 80) return percent + random() + 5;else if (percent < 90) return percent + random() + 1;else if (percent < 95) return percent + 0.1;else return percent;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
var LoadingBar = /*#__PURE__*/function (_PureComponent) {
|
|
39
|
-
_inheritsLoose(LoadingBar, _PureComponent);
|
|
40
|
-
|
|
41
|
-
function LoadingBar() {
|
|
42
|
-
var _this, _len, args, _key;
|
|
43
|
-
|
|
44
|
-
for (_len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
45
|
-
args[_key] = arguments[_key];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
_this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
|
|
49
|
-
_this.state = {
|
|
50
|
-
loading: true,
|
|
51
|
-
hidden: true,
|
|
52
|
-
progress: 1
|
|
53
|
-
};
|
|
54
|
-
return _this;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var _proto = LoadingBar.prototype;
|
|
58
|
-
|
|
59
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
60
|
-
var _this2 = this;
|
|
61
|
-
|
|
62
|
-
var websocket = this.getWebsocket();
|
|
63
|
-
|
|
64
|
-
if (websocket.isConnected()) {
|
|
65
|
-
this.setState(function (prevState) {
|
|
66
|
-
return {
|
|
67
|
-
loading: false,
|
|
68
|
-
progress: 100,
|
|
69
|
-
hidden: prevState.hidden || prevState.progress === 100
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
websocket.on('connect', function () {
|
|
75
|
-
_this2.setState({
|
|
76
|
-
loading: false
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
websocket.on('disconnect', function () {
|
|
80
|
-
_this2.setState({
|
|
81
|
-
loading: true,
|
|
82
|
-
progress: 1,
|
|
83
|
-
hidden: false
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
|
89
|
-
if (this.state.loading !== prevState.loading) {
|
|
90
|
-
if (this.state.loading) {
|
|
91
|
-
this.showBar();
|
|
92
|
-
} else {
|
|
93
|
-
this.hideBar();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
99
|
-
clearTimeout(this.fadeOffTimeout);
|
|
100
|
-
clearTimeout(this.resetTimeout);
|
|
101
|
-
clearTimeout(this.first20Timeout);
|
|
102
|
-
clearInterval(this.progressTimer);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
_proto.getWebsocket = function getWebsocket() {
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
107
|
-
return this.context.app.websocket;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
_proto.showBar = function showBar() {
|
|
111
|
-
var _this3 = this;
|
|
112
|
-
|
|
113
|
-
clearTimeout(this.fadeOffTimeout);
|
|
114
|
-
clearTimeout(this.resetTimeout);
|
|
115
|
-
this.first20Timeout = setTimeout(function () {
|
|
116
|
-
_this3.setState({
|
|
117
|
-
progress: 20
|
|
118
|
-
});
|
|
119
|
-
}, 100);
|
|
120
|
-
this.progressTimer = setInterval(function () {
|
|
121
|
-
_this3.setState(function (prevState) {
|
|
122
|
-
var newValue = calculatePercent(prevState.progress);
|
|
123
|
-
return {
|
|
124
|
-
progress: newValue
|
|
125
|
-
};
|
|
126
|
-
});
|
|
127
|
-
}, 500);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
_proto.hideBar = function hideBar() {
|
|
131
|
-
var _this4 = this;
|
|
132
|
-
|
|
133
|
-
clearTimeout(this.first20Timeout);
|
|
134
|
-
clearInterval(this.progressTimer);
|
|
135
|
-
this.fadeOffTimeout = setTimeout(function () {
|
|
136
|
-
_this4.setState({
|
|
137
|
-
progress: 100
|
|
138
|
-
});
|
|
139
|
-
}, 500);
|
|
140
|
-
this.resetTimeout = setTimeout(function () {
|
|
141
|
-
_this4.setState({
|
|
142
|
-
hidden: true,
|
|
143
|
-
progress: 1
|
|
144
|
-
});
|
|
145
|
-
}, 1000);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
_proto.render = function render() {
|
|
149
|
-
var LoadingBarComponent = this.props.LoadingBarComponent;
|
|
150
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
151
|
-
hidden: this.state.hidden,
|
|
152
|
-
style: {
|
|
153
|
-
position: 'fixed',
|
|
154
|
-
top: 0,
|
|
155
|
-
left: 0,
|
|
156
|
-
right: 0,
|
|
157
|
-
zIndex: 4,
|
|
158
|
-
pointerEvents: 'none'
|
|
159
|
-
}
|
|
160
|
-
}, /*#__PURE__*/React.createElement(LoadingBarComponent, {
|
|
161
|
-
progress: this.state.progress
|
|
162
|
-
}));
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return LoadingBar;
|
|
166
|
-
}(PureComponent);
|
|
167
|
-
|
|
168
|
-
LoadingBar.contextType = ReactAlpContext;
|
|
169
|
-
|
|
170
|
-
export default LoadingBar;
|
|
171
|
-
//# sourceMappingURL=index-browser-dev.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-browser-dev.es.js","sources":["../src/index.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React, { PureComponent } from 'react';\nimport ReactAlpContext from 'react-alp-context';\n\n/*\nExample with antd:\nimport { Progress } from 'antd';\n\nconst LoadingBarComponent = ({ progress }) => (\n <Progress\n type=\"line\"\n status=\"active\"\n percent={progress}\n showInfo={false}\n />\n);\n*/\n\n/* number between 0 and 1 */\nconst random = (): number => Math.ceil(Math.random() * 100) / 100;\n\n/**\n * around:\n * at 100ms 20%\n * at 1s 40%\n * at 2s 60%\n * at 3s 80%\n */\nconst calculatePercent = (percent: number): number => {\n if (percent < 60) return percent + random() * 10 + 5;\n if (percent < 70) return percent + random() * 10 + 3;\n else if (percent < 80) return percent + random() + 5;\n else if (percent < 90) return percent + random() + 1;\n else if (percent < 95) return percent + 0.1;\n else return percent;\n};\n\ninterface LoadingBarProps {\n LoadingBarComponent: React.ComponentType<{ progress: number }>;\n}\n\ninterface LoadingBarState {\n loading: boolean;\n hidden: boolean;\n progress: number;\n}\n\ninterface WebsocketInterface {\n isConnected: () => boolean;\n on: (event: 'connect' | 'disconnect', callback: () => unknown) => void;\n}\n\nexport default class LoadingBar extends PureComponent<\n LoadingBarProps,\n LoadingBarState\n> {\n static contextType = ReactAlpContext;\n\n context!: React.ContextType<typeof ReactAlpContext>;\n\n state = {\n loading: true,\n hidden: true,\n progress: 1,\n };\n\n fadeOffTimeout?: any;\n\n resetTimeout?: any;\n\n first20Timeout?: any;\n\n progressTimer?: any;\n\n componentDidMount(): void {\n const websocket = this.getWebsocket();\n if (websocket.isConnected()) {\n this.setState((prevState) => ({\n loading: false,\n progress: 100,\n hidden: prevState.hidden || prevState.progress === 100,\n }));\n }\n websocket.on('connect', () => {\n this.setState({ loading: false });\n });\n websocket.on('disconnect', () => {\n this.setState({ loading: true, progress: 1, hidden: false });\n });\n }\n\n componentDidUpdate(\n prevProps: LoadingBarProps,\n prevState: LoadingBarState,\n ): void {\n if (this.state.loading !== prevState.loading) {\n if (this.state.loading) {\n this.showBar();\n } else {\n this.hideBar();\n }\n }\n }\n\n componentWillUnmount(): void {\n clearTimeout(this.fadeOffTimeout);\n clearTimeout(this.resetTimeout);\n clearTimeout(this.first20Timeout);\n clearInterval(this.progressTimer);\n }\n\n getWebsocket(): WebsocketInterface {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return this.context.app.websocket;\n }\n\n private showBar(): void {\n clearTimeout(this.fadeOffTimeout);\n clearTimeout(this.resetTimeout);\n\n this.first20Timeout = setTimeout(() => {\n this.setState({ progress: 20 });\n }, 100);\n\n this.progressTimer = setInterval(() => {\n this.setState((prevState) => {\n const newValue = calculatePercent(prevState.progress);\n return { progress: newValue };\n });\n }, 500);\n }\n\n private hideBar(): void {\n clearTimeout(this.first20Timeout);\n clearInterval(this.progressTimer);\n\n this.fadeOffTimeout = setTimeout(() => {\n this.setState({\n progress: 100,\n });\n }, 500);\n\n this.resetTimeout = setTimeout(() => {\n this.setState({\n hidden: true,\n progress: 1,\n });\n }, 1000);\n }\n\n render(): ReactElement {\n const LoadingBarComponent = this.props.LoadingBarComponent;\n\n return (\n <div\n hidden={this.state.hidden}\n style={{\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 4,\n pointerEvents: 'none',\n }}\n >\n <LoadingBarComponent progress={this.state.progress} />\n </div>\n );\n }\n}\n"],"names":["random","Math","ceil","calculatePercent","percent","LoadingBar","state","loading","hidden","progress","componentDidMount","websocket","getWebsocket","isConnected","setState","prevState","on","componentDidUpdate","prevProps","showBar","hideBar","componentWillUnmount","clearTimeout","fadeOffTimeout","resetTimeout","first20Timeout","clearInterval","progressTimer","context","app","setTimeout","setInterval","newValue","render","LoadingBarComponent","props","position","top","left","right","zIndex","pointerEvents","PureComponent","contextType","ReactAlpContext"],"mappings":";;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA,IAAMA,MAAM,GAAG,SAATA,MAAS;AAAA,SAAcC,IAAI,CAACC,IAAL,CAAUD,IAAI,CAACD,MAAL,KAAgB,GAA1B,IAAi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