@zuzjs/ui 0.8.6 → 0.8.8
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/dist/cjs/comps/AutoComplete/index.d.ts +1 -0
- package/dist/cjs/comps/Drawer/index.d.ts +2 -1
- package/dist/cjs/comps/Drawer/index.js +2 -2
- package/dist/cjs/comps/Drawer/types.d.ts +2 -1
- package/dist/cjs/comps/Input/index.d.ts +8 -0
- package/dist/cjs/comps/Input/index.js +6 -2
- package/dist/cjs/comps/PinInput/index.d.ts +1 -0
- package/dist/cjs/comps/Search/index.d.ts +2 -0
- package/dist/cjs/comps/Search/index.js +4 -2
- package/dist/cjs/comps/Search/types.d.ts +1 -0
- package/dist/cjs/comps/Sheet/index.js +1 -1
- package/dist/cjs/funs/css.js +2 -0
- package/dist/cjs/hooks/index.d.ts +1 -1
- package/dist/cjs/hooks/index.js +1 -1
- package/dist/cjs/hooks/useSlider.d.ts +1 -1
- package/dist/cjs/hooks/useUploader.d.ts +5 -1
- package/dist/cjs/hooks/useUploader.js +35 -24
- package/dist/cjs/types/enums.d.ts +1 -0
- package/dist/cjs/types/enums.js +1 -0
- package/dist/css/styles.css +1 -1
- package/dist/css/transitions.css +1 -1
- package/dist/esm/comps/AutoComplete/index.d.ts +1 -0
- package/dist/esm/comps/Drawer/index.d.ts +2 -1
- package/dist/esm/comps/Drawer/index.js +2 -2
- package/dist/esm/comps/Drawer/types.d.ts +2 -1
- package/dist/esm/comps/Input/index.d.ts +8 -0
- package/dist/esm/comps/Input/index.js +6 -2
- package/dist/esm/comps/PinInput/index.d.ts +1 -0
- package/dist/esm/comps/Search/index.d.ts +2 -0
- package/dist/esm/comps/Search/index.js +4 -2
- package/dist/esm/comps/Search/types.d.ts +1 -0
- package/dist/esm/comps/Sheet/index.js +1 -1
- package/dist/esm/funs/css.js +2 -0
- package/dist/esm/hooks/index.d.ts +1 -1
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/useSlider.d.ts +1 -1
- package/dist/esm/hooks/useUploader.d.ts +5 -1
- package/dist/esm/hooks/useUploader.js +35 -24
- package/dist/esm/types/enums.d.ts +1 -0
- package/dist/esm/types/enums.js +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -4,6 +4,7 @@ declare const AutoComplete: import("react").ForwardRefExoticComponent<import("..
|
|
|
4
4
|
size?: Size;
|
|
5
5
|
variant?: import("../..").Variant;
|
|
6
6
|
with?: import("../..").FORMVALIDATION | `${import("../..").FORMVALIDATION}${string}`;
|
|
7
|
+
onConfirm?: (value: string) => void;
|
|
7
8
|
} & {
|
|
8
9
|
action?: string;
|
|
9
10
|
data?: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { DRAWER_SIDE } from "../../types/enums";
|
|
2
|
+
import { DRAWER_SIDE, TRANSITION_CURVES } from "../../types/enums";
|
|
3
3
|
import { BoxProps } from "../Box";
|
|
4
4
|
import { DrawerHandler } from "./types";
|
|
5
5
|
declare const Drawer: import("react").ForwardRefExoticComponent<BoxProps & {
|
|
@@ -9,6 +9,7 @@ declare const Drawer: import("react").ForwardRefExoticComponent<BoxProps & {
|
|
|
9
9
|
children?: string | ReactNode | ReactNode[];
|
|
10
10
|
prerender?: boolean;
|
|
11
11
|
margin?: number;
|
|
12
|
+
animation?: TRANSITION_CURVES;
|
|
12
13
|
onClose?: () => void;
|
|
13
14
|
} & import("react").RefAttributes<DrawerHandler>>;
|
|
14
15
|
export default Drawer;
|
|
@@ -6,7 +6,7 @@ import { DRAWER_SIDE, KeyCode, TRANSITION_CURVES } from "../../types/enums";
|
|
|
6
6
|
import Box from "../Box";
|
|
7
7
|
import Overlay from "../Overlay";
|
|
8
8
|
const Drawer = forwardRef((props, ref) => {
|
|
9
|
-
const { from, speed, children, margin, prerender, onClose, ...pops } = props;
|
|
9
|
+
const { from, speed, children, margin, animation, prerender, onClose, ...pops } = props;
|
|
10
10
|
const [render, setRender] = useState(undefined == prerender ? true : prerender);
|
|
11
11
|
const [visible, setVisible] = useState(false);
|
|
12
12
|
const divRef = useRef(null);
|
|
@@ -60,7 +60,7 @@ const Drawer = forwardRef((props, ref) => {
|
|
|
60
60
|
from: { ..._style.from, opacity: 0 },
|
|
61
61
|
to: { ..._style.to, opacity: 1 },
|
|
62
62
|
when: visible,
|
|
63
|
-
curve: TRANSITION_CURVES.EaseInOut,
|
|
63
|
+
curve: animation || TRANSITION_CURVES.EaseInOut,
|
|
64
64
|
duration: speed || .5,
|
|
65
65
|
}, ...rest, children: [from == DRAWER_SIDE.Top || from == DRAWER_SIDE.Bottom ? _jsx(Box, { className: `--handle` }) : null, render ? content : visible ? content : null] })] });
|
|
66
66
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { DRAWER_SIDE } from "../../types/enums";
|
|
2
|
+
import { DRAWER_SIDE, TRANSITION_CURVES } from "../../types/enums";
|
|
3
3
|
import { BoxProps } from "../Box";
|
|
4
4
|
export type DrawerProps = BoxProps & {
|
|
5
5
|
as?: string;
|
|
@@ -8,6 +8,7 @@ export type DrawerProps = BoxProps & {
|
|
|
8
8
|
children?: string | ReactNode | ReactNode[];
|
|
9
9
|
prerender?: boolean;
|
|
10
10
|
margin?: number;
|
|
11
|
+
animation?: TRANSITION_CURVES;
|
|
11
12
|
onClose?: () => void;
|
|
12
13
|
};
|
|
13
14
|
export interface DrawerHandler {
|
|
@@ -5,11 +5,19 @@ export type InputProps = Props<`input`> & {
|
|
|
5
5
|
size?: Size;
|
|
6
6
|
variant?: Variant;
|
|
7
7
|
with?: FORMVALIDATION | `${FORMVALIDATION}${string}`;
|
|
8
|
+
/**
|
|
9
|
+
* Triggers when Enter / Return is Pressed
|
|
10
|
+
*/
|
|
11
|
+
onConfirm?: (value: string) => void;
|
|
8
12
|
};
|
|
9
13
|
declare const Input: import("react").ForwardRefExoticComponent<import("../..").ZuzProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, keyof import("../..").ZuzProps> & {
|
|
10
14
|
numeric?: boolean;
|
|
11
15
|
size?: Size;
|
|
12
16
|
variant?: Variant;
|
|
13
17
|
with?: FORMVALIDATION | `${FORMVALIDATION}${string}`;
|
|
18
|
+
/**
|
|
19
|
+
* Triggers when Enter / Return is Pressed
|
|
20
|
+
*/
|
|
21
|
+
onConfirm?: (value: string) => void;
|
|
14
22
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
15
23
|
export default Input;
|
|
@@ -3,14 +3,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { useBase } from '../../hooks';
|
|
5
5
|
const Input = forwardRef((props, ref) => {
|
|
6
|
-
const { size, variant, numeric, ...pops } = props;
|
|
6
|
+
const { size, variant, numeric, onConfirm, ...pops } = props;
|
|
7
7
|
const { style, className, rest } = useBase(pops);
|
|
8
8
|
const handleInput = (event) => {
|
|
9
9
|
if (numeric) {
|
|
10
10
|
event.currentTarget.value = event.currentTarget.value.replace(/[^0-9.]/g, '').replace(/(\..*?)\..*/g, '$1');
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
return _jsx("input", { className: `--input ${size || variant ? `--${size || variant}` : ``} flex ${className}`.trim(), style: style, onInput: handleInput,
|
|
13
|
+
return _jsx("input", { className: `--input ${size || variant ? `--${size || variant}` : ``} flex ${className}`.trim(), style: style, onInput: handleInput, onKeyDown: (e) => {
|
|
14
|
+
if (e.key == `Enter`) {
|
|
15
|
+
onConfirm?.(e.currentTarget.value);
|
|
16
|
+
}
|
|
17
|
+
}, ref: ref, ...rest });
|
|
14
18
|
});
|
|
15
19
|
Input.displayName = `Zuz.Input`;
|
|
16
20
|
export default Input;
|
|
@@ -9,6 +9,7 @@ declare const PinInput: import("react").ForwardRefExoticComponent<import("../.."
|
|
|
9
9
|
size?: import("../..").Size;
|
|
10
10
|
variant?: import("../..").Variant;
|
|
11
11
|
with?: import("../..").FORMVALIDATION | `${import("../..").FORMVALIDATION}${string}`;
|
|
12
|
+
onConfirm?: (value: string) => void;
|
|
12
13
|
} & {
|
|
13
14
|
mask?: boolean;
|
|
14
15
|
size?: number;
|
|
@@ -5,9 +5,11 @@ declare const Search: import("react").ForwardRefExoticComponent<import("../..").
|
|
|
5
5
|
size?: import("../..").Size;
|
|
6
6
|
variant?: Variant;
|
|
7
7
|
with?: import("../..").FORMVALIDATION | `${import("../..").FORMVALIDATION}${string}`;
|
|
8
|
+
onConfirm?: (value: string) => void;
|
|
8
9
|
} & {
|
|
9
10
|
onSubmit?: (value: string) => void;
|
|
10
11
|
onChange?: (value: string) => void;
|
|
12
|
+
onClear?: () => void;
|
|
11
13
|
withStyle?: string;
|
|
12
14
|
shortcut?: import("..").KeyCombination;
|
|
13
15
|
reverse?: boolean;
|
|
@@ -9,7 +9,7 @@ import Input from '../Input';
|
|
|
9
9
|
import KeyBoardKeys from '../KeyboardKeys';
|
|
10
10
|
import SVGIcons from '../svgicons';
|
|
11
11
|
const Search = forwardRef((props, ref) => {
|
|
12
|
-
const { fx, animate, withStyle, as, reverse, onChange, ...pops } = props;
|
|
12
|
+
const { fx, animate, withStyle, as, reverse, onChange, onClear, ...pops } = props;
|
|
13
13
|
const { style, className } = useBase({ as: props.as });
|
|
14
14
|
// const { className : searchStyle } = useBase({ as: withStyle || `` } as Props<`div`>)
|
|
15
15
|
const [query, setQuery] = useState(``);
|
|
@@ -28,12 +28,14 @@ const Search = forwardRef((props, ref) => {
|
|
|
28
28
|
onChange?.(``);
|
|
29
29
|
if (innerRef.current) {
|
|
30
30
|
innerRef.current.value = ``;
|
|
31
|
+
props.onConfirm?.(``);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
// onSubmit?.(query)
|
|
34
35
|
};
|
|
35
36
|
useImperativeHandle(ref, () => ({
|
|
36
|
-
focus: () => innerRef.current?.focus()
|
|
37
|
+
focus: () => innerRef.current?.focus(),
|
|
38
|
+
value: () => innerRef.current?.value
|
|
37
39
|
}));
|
|
38
40
|
useEffect(() => { }, []);
|
|
39
41
|
return _jsxs(Box, { style: style, className: `--search ${reverse ? `--search-rev` : ``} --${props.variant || Variant.Small} flex aic ${props.as?.includes(`abs`) ? `` : `rel`} ${className}`.trim(), children: [reverse && _jsx(Button, { tabIndex: -1, onClick: e => handleSubmit(), className: `--send flex aic jcc`, variant: props.variant || Variant.Small, children: query !== `` ? SVGIcons.close : SVGIcons.search }), _jsx(Input, { ref: innerRef, onChange: handleChange, className: `--${props.variant || Variant.Small}`, ...pops }), props.shortcut && _jsx(KeyBoardKeys, { keys: props.shortcut, as: `abs` }), !reverse && _jsx(Button, { tabIndex: -1, onClick: e => handleSubmit(), className: `--send flex aic jcc`, variant: props.variant || Variant.Small, children: query !== `` ? SVGIcons.close : SVGIcons.search })] });
|
|
@@ -178,7 +178,7 @@ const Sheet = forwardRef((props, ref) => {
|
|
|
178
178
|
}
|
|
179
179
|
}, [visible]);
|
|
180
180
|
if (sheetType == SHEET.Dialog) {
|
|
181
|
-
return _jsxs(_Fragment, { children: [_jsx(Overlay, { when: visible }), _jsxs(Box, { className: `--sheet --sheet-${sheetType.toLowerCase()} ${className} fixed`.trim(), style: style, fx: buildAnimation, ...rest, ref: innerRef, children: [_jsx(Cover, { when: loading, spinner: spinner, message: loadingMessage }), _jsxs(Box, { className: `--head flex aic rel`, children: [_jsx(Box, { className: `--${title ? `title` : `dot`} flex aic rel`, children: title || `` }), _jsx(Button, { onClick: (e) => setVisible(false), className: `--closer abs`, children: "\u00D7" })] }), _jsx(Box, { className: `--body flex aic rel ${action ? `` : `--no-action`}`.trim(), children: render ? renderMessage : null }), action && _jsx(Box, { className: `--footer flex aic rel ${actionPosition ? actionPosition == SHEET_ACTION_POSITION.Center ? `jcc` : `` : `jce`}`.trim(), children: action.map((a, i) => _jsx(Button, { onClick: (e) => a.handler ? a.handler() : a.onClick ? a.onClick() : console.log(`onClick Handler missing`), className: `--action`, children: a.label }, `sheet-${sheetID}-action-${a.key}`)) })] })] });
|
|
181
|
+
return _jsxs(_Fragment, { children: [_jsx(Overlay, { when: visible }), _jsxs(Box, { className: `--sheet --sheet-${sheetType.toLowerCase()} ${visible ? `is-visible` : ``} ${className} fixed`.trim(), style: style, fx: buildAnimation, ...rest, ref: innerRef, children: [_jsx(Cover, { when: loading, spinner: spinner, message: loadingMessage }), _jsxs(Box, { className: `--head flex aic rel`, children: [_jsx(Box, { className: `--${title ? `title` : `dot`} flex aic rel`, children: title || `` }), _jsx(Button, { onClick: (e) => setVisible(false), className: `--closer abs`, children: "\u00D7" })] }), _jsx(Box, { className: `--body flex aic rel ${action ? `` : `--no-action`}`.trim(), children: render ? renderMessage : null }), action && _jsx(Box, { className: `--footer flex aic rel ${actionPosition ? actionPosition == SHEET_ACTION_POSITION.Center ? `jcc` : `` : `jce`}`.trim(), children: action.map((a, i) => _jsx(Button, { onClick: (e) => a.handler ? a.handler() : a.onClick ? a.onClick() : console.log(`onClick Handler missing`), className: `--action`, children: a.label }, `sheet-${sheetID}-action-${a.key}`)) })] })] });
|
|
182
182
|
}
|
|
183
183
|
return _jsx(Box, { className: `--sheet --sheet-${sheetType.toLowerCase()} ${className} abs`.trim(), style: style, ...rest, fx: buildAnimation, ref: innerRef, children: visible ? msg : null });
|
|
184
184
|
});
|
package/dist/cjs/funs/css.js
CHANGED
|
@@ -935,6 +935,8 @@ export const getAnimationCurve = (curve) => {
|
|
|
935
935
|
switch (curve.toUpperCase()) {
|
|
936
936
|
case TRANSITION_CURVES.Bounce:
|
|
937
937
|
return `var(--bounce)`;
|
|
938
|
+
case TRANSITION_CURVES.Liquid:
|
|
939
|
+
return `var(--liquid)`;
|
|
938
940
|
case TRANSITION_CURVES.Spring:
|
|
939
941
|
// return `cubic-bezier(0.2, -0.36, 0, 1.46)`
|
|
940
942
|
return `var(--spring)`;
|
|
@@ -29,6 +29,6 @@ export { default as useResizeObserver } from './useResizeObserver';
|
|
|
29
29
|
export { default as useSlider } from './useSlider';
|
|
30
30
|
export { default as useToast } from './useToast';
|
|
31
31
|
export { default as useTruncateText } from './useTruncateText';
|
|
32
|
-
export { default as useUploader } from './useUploader';
|
|
32
|
+
export { QueItem as UploadQueItem, Status as UploadStatus, default as useUploader, type Uploadify } from './useUploader';
|
|
33
33
|
export { default as useViewTransition } from './useViewTransition';
|
|
34
34
|
export { default as useWebSocket, type WebSocketOptions } from './useWebSocket';
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -30,6 +30,6 @@ export { default as useResizeObserver } from './useResizeObserver';
|
|
|
30
30
|
export { default as useSlider } from './useSlider';
|
|
31
31
|
export { default as useToast } from './useToast';
|
|
32
32
|
export { default as useTruncateText } from './useTruncateText';
|
|
33
|
-
export { default as useUploader } from './useUploader';
|
|
33
|
+
export { Status as UploadStatus, default as useUploader } from './useUploader';
|
|
34
34
|
export { default as useViewTransition } from './useViewTransition';
|
|
35
35
|
export { default as useWebSocket } from './useWebSocket';
|
|
@@ -5,7 +5,8 @@ export declare enum Status {
|
|
|
5
5
|
Idle = 0,
|
|
6
6
|
FetchingServer = 1,
|
|
7
7
|
Uploading = 2,
|
|
8
|
-
Saving = 3
|
|
8
|
+
Saving = 3,
|
|
9
|
+
Saved = 4
|
|
9
10
|
}
|
|
10
11
|
export interface QueItem {
|
|
11
12
|
ID: string;
|
|
@@ -37,9 +38,12 @@ export type Uploadify = {
|
|
|
37
38
|
export interface Uploader {
|
|
38
39
|
apiUrl: string;
|
|
39
40
|
onChange?: (file: QueItem | null) => void;
|
|
41
|
+
onComplete?: (index: number, que: QueItem[], currentFile: QueItem | null) => void;
|
|
42
|
+
onError?: (index: number, que: QueItem[], currentFile: QueItem | null) => void;
|
|
40
43
|
onQueFinished?: () => void;
|
|
41
44
|
}
|
|
42
45
|
declare const useUploader: (conf: Uploader) => {
|
|
46
|
+
get: () => import("react").RefObject<Uploadify>;
|
|
43
47
|
getQue: () => QueItem[];
|
|
44
48
|
addToQue: (f: dynamic) => void;
|
|
45
49
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { getCancelToken, withPost } from "@zuzjs/core";
|
|
3
|
+
import { useRef } from "react";
|
|
2
4
|
import { uuid } from "..";
|
|
3
5
|
export var Status;
|
|
4
6
|
(function (Status) {
|
|
@@ -7,21 +9,22 @@ export var Status;
|
|
|
7
9
|
Status[Status["FetchingServer"] = 1] = "FetchingServer";
|
|
8
10
|
Status[Status["Uploading"] = 2] = "Uploading";
|
|
9
11
|
Status[Status["Saving"] = 3] = "Saving";
|
|
12
|
+
Status[Status["Saved"] = 4] = "Saved";
|
|
10
13
|
})(Status || (Status = {}));
|
|
11
14
|
const useUploader = (conf) => {
|
|
12
15
|
const { apiUrl, onChange, onQueFinished } = conf;
|
|
13
|
-
const self = {
|
|
16
|
+
const self = useRef({
|
|
14
17
|
que: [],
|
|
15
18
|
index: -1,
|
|
16
19
|
speed: 0,
|
|
17
20
|
stamp: null,
|
|
18
21
|
token: null,
|
|
19
22
|
status: Status.Idle
|
|
20
|
-
};
|
|
23
|
+
});
|
|
21
24
|
const sync = () => onChange?.(currentFile());
|
|
22
25
|
const importFile = () => { };
|
|
23
26
|
const uploadFile = () => {
|
|
24
|
-
self.stamp = Date.now();
|
|
27
|
+
self.current.stamp = Date.now();
|
|
25
28
|
const file = currentFile();
|
|
26
29
|
const formData = new FormData();
|
|
27
30
|
formData.append("ID", file.ID);
|
|
@@ -30,47 +33,54 @@ const useUploader = (conf) => {
|
|
|
30
33
|
formData.append("token", file.server.token);
|
|
31
34
|
formData.append('file', file.file);
|
|
32
35
|
formData.append('fs', file.file.size.toString());
|
|
33
|
-
self.cancelToken = getCancelToken();
|
|
34
|
-
withPost(`${self.que[self.index].server.uri}/receive`, formData, 86400, true, (ev) => {
|
|
35
|
-
|
|
36
|
+
self.current.cancelToken = getCancelToken();
|
|
37
|
+
withPost(`${self.current.que[self.current.index].server.uri}/receive`, formData, 86400, true, undefined, (ev) => {
|
|
38
|
+
self.current.que[self.current.index].status = Status.Uploading;
|
|
39
|
+
onChange?.({ ...currentFile(), progress: (ev.progress || 0) });
|
|
36
40
|
})
|
|
37
|
-
.
|
|
38
|
-
console.log(`Uploaded`, resp)
|
|
41
|
+
.then(resp => {
|
|
42
|
+
// console.log(`Uploaded`, resp)
|
|
43
|
+
self.current.que[self.current.index].progress = 1;
|
|
44
|
+
self.current.que[self.current.index].status = Status.Saved;
|
|
45
|
+
self.current.status = Status.Idle;
|
|
46
|
+
sync();
|
|
47
|
+
Que();
|
|
39
48
|
})
|
|
40
49
|
.catch(err => {
|
|
41
|
-
|
|
42
|
-
self.status = Status.
|
|
50
|
+
// console.error(`UploadFailed`, err)
|
|
51
|
+
self.current.que[self.current.index].status = Status.Error;
|
|
52
|
+
self.current.status = Status.Idle;
|
|
43
53
|
sync();
|
|
44
54
|
Que();
|
|
45
55
|
});
|
|
46
56
|
};
|
|
47
57
|
const getServer = (force) => {
|
|
48
|
-
self.que[self.index].status = Status.FetchingServer;
|
|
58
|
+
self.current.que[self.current.index].status = Status.FetchingServer;
|
|
49
59
|
sync();
|
|
50
60
|
withPost(`${apiUrl}get_server`, { size: currentFile().file.size })
|
|
51
61
|
.then((resp) => {
|
|
52
|
-
self.que[self.index].server = resp.server;
|
|
53
|
-
self.que[self.index].status = Status.Uploading;
|
|
62
|
+
self.current.que[self.current.index].server = resp.server;
|
|
63
|
+
self.current.que[self.current.index].status = Status.Uploading;
|
|
54
64
|
sync();
|
|
55
65
|
uploadFile();
|
|
56
66
|
})
|
|
57
67
|
.catch((err) => {
|
|
58
|
-
self.que[self.index].status = Status.Error;
|
|
59
|
-
self.status = Status.Idle;
|
|
68
|
+
self.current.que[self.current.index].status = Status.Error;
|
|
69
|
+
self.current.status = Status.Idle;
|
|
60
70
|
sync();
|
|
61
71
|
Que();
|
|
62
72
|
});
|
|
63
73
|
};
|
|
64
|
-
const currentFile = () => self.que[self.index];
|
|
65
|
-
const getQue = () => self.que;
|
|
74
|
+
const currentFile = () => self.current.que[self.current.index];
|
|
75
|
+
const getQue = () => self.current.que;
|
|
66
76
|
const Que = () => {
|
|
67
|
-
if (self.status == Status.Idle &&
|
|
68
|
-
(self.que.length - 1) > self.index) {
|
|
69
|
-
self.status = Status.Uploading;
|
|
70
|
-
self.index++;
|
|
71
|
-
self.que[self.index].status = Status.Uploading;
|
|
77
|
+
if (self.current.status == Status.Idle &&
|
|
78
|
+
(self.current.que.length - 1) > self.current.index) {
|
|
79
|
+
self.current.status = Status.Uploading;
|
|
80
|
+
self.current.index++;
|
|
81
|
+
self.current.que[self.current.index].status = Status.Uploading;
|
|
72
82
|
sync();
|
|
73
|
-
if (self.que[self.index].remote)
|
|
83
|
+
if (self.current.que[self.current.index].remote)
|
|
74
84
|
importFile();
|
|
75
85
|
else
|
|
76
86
|
getServer(true);
|
|
@@ -79,7 +89,7 @@ const useUploader = (conf) => {
|
|
|
79
89
|
onQueFinished?.();
|
|
80
90
|
};
|
|
81
91
|
const addToQue = (f) => {
|
|
82
|
-
self.que.push({
|
|
92
|
+
self.current.que.push({
|
|
83
93
|
ID: uuid(),
|
|
84
94
|
file: f.file,
|
|
85
95
|
dir: f.dir,
|
|
@@ -94,6 +104,7 @@ const useUploader = (conf) => {
|
|
|
94
104
|
Que();
|
|
95
105
|
};
|
|
96
106
|
return {
|
|
107
|
+
get: () => self,
|
|
97
108
|
getQue,
|
|
98
109
|
addToQue,
|
|
99
110
|
};
|
package/dist/cjs/types/enums.js
CHANGED
|
@@ -45,6 +45,7 @@ export var TRANSITION_CURVES;
|
|
|
45
45
|
// Ease = "EASE",
|
|
46
46
|
// EaseIn = "EASEIN",
|
|
47
47
|
// EaseOut = "EASEOUT",
|
|
48
|
+
TRANSITION_CURVES["Liquid"] = "LIQUID";
|
|
48
49
|
TRANSITION_CURVES["EaseInOut"] = "EASEINOUT";
|
|
49
50
|
TRANSITION_CURVES["Bounce"] = "BOUNCE";
|
|
50
51
|
// Linear = "LINEAR",
|