this.node = node}
className={cn.join(' ')}
>
-
- {canCancel ?
: ''}
-
-
+
+
+
+
+
+ {list.map(item => )}
@@ -50,39 +73,22 @@ const Progress = observer(class Progress extends React.Component {
componentDidMount () {
this._isMounted = true;
+ this.resize();
};
componentDidUpdate () {
- const { progress } = S.Common;
- if (!progress) {
- return;
- };
-
- const { current, total } = progress;
const win = $(window);
- const node = $(this.node);
- node.removeClass('hide');
this.resize();
-
win.off('resize.progress').on('resize.progress', () => this.resize());
-
- if (total && (current >= total)) {
- node.addClass('hide');
- win.off('resize.progress');
-
- window.setTimeout(() => S.Common.progressClear(), 200);
- };
};
componentWillUnmount () {
this._isMounted = false;
+ $(window).off('resize.progress');
};
- onCancel (e: any) {
- const { progress } = S.Common;
- const { id } = progress;
-
+ onCancel (id: string) {
C.ProcessCancel(id);
};
@@ -107,6 +113,7 @@ const Progress = observer(class Progress extends React.Component {
const y = e.pageY - this.dy - win.scrollTop();
this.setStyle(x, y);
+ Storage.set('progress', { x, y }, true);
};
onDragEnd (e: any) {
@@ -119,6 +126,9 @@ const Progress = observer(class Progress extends React.Component {
checkCoords (x: number, y: number): { x: number, y: number } {
const { ww, wh } = U.Common.getWindowDimensions();
+ this.width = Number(this.width) || 0;
+ this.height = Number(this.height) || 0;
+
x = Number(x) || 0;
x = Math.max(0, x);
x = Math.min(ww - this.width, x);
@@ -139,6 +149,10 @@ const Progress = observer(class Progress extends React.Component {
const coords = Storage.get('progress');
this.obj = node.find('#inner');
+ if (!this.obj.length) {
+ return;
+ };
+
this.height = this.obj.outerHeight();
this.width = this.obj.outerWidth();
@@ -150,10 +164,7 @@ const Progress = observer(class Progress extends React.Component {
setStyle (x: number, y: number) {
const coords = this.checkCoords(x, y);
- if ((coords.x !== null) && (coords.y !== null)) {
- this.obj.css({ margin: 0, left: coords.x, top: coords.y });
- Storage.set('progress', coords, true);
- };
+ this.obj.css({ margin: 0, left: coords.x, top: coords.y, bottom: 'auto' });
};
});
diff --git a/src/ts/component/util/toast.tsx b/src/ts/component/util/toast.tsx
index 677cf80394..83ef432ec8 100644
--- a/src/ts/component/util/toast.tsx
+++ b/src/ts/component/util/toast.tsx
@@ -52,11 +52,7 @@ const Toast = observer(class Toast extends React.Component