@uzum-tech/ui 2.3.1 → 2.3.2
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/index.js +373 -340
- package/dist/index.mjs +373 -340
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +2 -2
- package/es/components.d.ts +10 -7
- package/es/image/src/ImagePreview.d.ts +1 -0
- package/es/image/src/ImagePreview.mjs +7 -35
- package/es/image/src/public-types.d.ts +4 -4
- package/es/message-bubble/src/MessageBubble.mjs +10 -3
- package/es/upload/index.d.ts +2 -1
- package/es/upload/index.mjs +2 -1
- package/es/upload/src/Upload.d.ts +73 -1007
- package/es/upload/src/Upload.mjs +43 -124
- package/es/upload/src/UploadFile.d.ts +1 -1
- package/es/upload/src/UploadFile.mjs +8 -2
- package/es/upload/src/UploadFileList.mjs +17 -2
- package/es/upload/src/UploadProgress.d.ts +3 -2
- package/es/upload/src/interface.d.ts +1086 -92
- package/es/upload/src/interface.mjs +117 -1
- package/es/upload/src/public-types.d.ts +17 -2
- package/es/upload/src/useUploadActionsRender.d.ts +2 -27
- package/es/upload/src/useUploadActionsRender.mjs +2 -2
- package/es/upload/src/useUploadInternals.d.ts +2 -25
- package/es/upload/src/utils.d.ts +2 -0
- package/es/upload/src/utils.mjs +7 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/components.d.ts +10 -7
- package/lib/image/src/ImagePreview.d.ts +1 -0
- package/lib/image/src/ImagePreview.js +3 -19
- package/lib/image/src/public-types.d.ts +4 -4
- package/lib/message-bubble/src/MessageBubble.js +10 -4
- package/lib/upload/index.d.ts +2 -1
- package/lib/upload/index.js +2 -1
- package/lib/upload/src/Upload.d.ts +73 -1007
- package/lib/upload/src/Upload.js +40 -68
- package/lib/upload/src/UploadFile.d.ts +1 -1
- package/lib/upload/src/UploadFile.js +12 -4
- package/lib/upload/src/UploadFileList.js +8 -1
- package/lib/upload/src/UploadProgress.d.ts +3 -2
- package/lib/upload/src/interface.d.ts +1086 -92
- package/lib/upload/src/interface.js +59 -1
- package/lib/upload/src/public-types.d.ts +17 -2
- package/lib/upload/src/useUploadActionsRender.d.ts +2 -27
- package/lib/upload/src/useUploadActionsRender.js +2 -2
- package/lib/upload/src/useUploadInternals.d.ts +2 -25
- package/lib/upload/src/utils.d.ts +2 -0
- package/lib/upload/src/utils.js +10 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/web-types.json +104 -23
|
@@ -1,2 +1,118 @@
|
|
|
1
|
+
import { useTheme } from "../../_mixins/index.mjs";
|
|
1
2
|
import { createInjectionKey } from "../../_utils/index.mjs";
|
|
2
|
-
|
|
3
|
+
import { environmentSupportFile, isImageFile } from "./utils.mjs";
|
|
4
|
+
export const uploadInjectionKey = createInjectionKey('u-upload');
|
|
5
|
+
export const uploadProps = Object.assign(Object.assign({}, useTheme.props), {
|
|
6
|
+
name: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: 'file'
|
|
9
|
+
},
|
|
10
|
+
accept: String,
|
|
11
|
+
action: String,
|
|
12
|
+
customRequest: Function,
|
|
13
|
+
directory: Boolean,
|
|
14
|
+
directoryDnd: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: undefined
|
|
17
|
+
},
|
|
18
|
+
method: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: 'POST'
|
|
21
|
+
},
|
|
22
|
+
multiple: Boolean,
|
|
23
|
+
showFileList: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: true
|
|
26
|
+
},
|
|
27
|
+
data: [Object, Function],
|
|
28
|
+
headers: [Object, Function],
|
|
29
|
+
withCredentials: Boolean,
|
|
30
|
+
responseType: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: ''
|
|
33
|
+
},
|
|
34
|
+
disabled: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: undefined
|
|
37
|
+
},
|
|
38
|
+
vertical: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
icon: Object,
|
|
43
|
+
onChange: Function,
|
|
44
|
+
onRemove: Function,
|
|
45
|
+
onFinish: Function,
|
|
46
|
+
onError: Function,
|
|
47
|
+
onRetry: Function,
|
|
48
|
+
onBeforeUpload: Function,
|
|
49
|
+
isErrorState: Function,
|
|
50
|
+
onDownload: Function,
|
|
51
|
+
defaultUpload: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true
|
|
54
|
+
},
|
|
55
|
+
fileList: Array,
|
|
56
|
+
'onUpdate:fileList': [Function, Array],
|
|
57
|
+
onUpdateFileList: [Function, Array],
|
|
58
|
+
fileListClass: String,
|
|
59
|
+
fileListStyle: [String, Object],
|
|
60
|
+
defaultFileList: {
|
|
61
|
+
type: Array,
|
|
62
|
+
default: () => []
|
|
63
|
+
},
|
|
64
|
+
showCancelButton: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: true
|
|
67
|
+
},
|
|
68
|
+
showRemoveButton: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: true
|
|
71
|
+
},
|
|
72
|
+
showDownloadButton: Boolean,
|
|
73
|
+
showRetryButton: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: true
|
|
76
|
+
},
|
|
77
|
+
customDownload: Function,
|
|
78
|
+
showPreviewButton: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: true
|
|
81
|
+
},
|
|
82
|
+
listType: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: 'text'
|
|
85
|
+
},
|
|
86
|
+
onPreview: Function,
|
|
87
|
+
shouldUseThumbnailUrl: {
|
|
88
|
+
type: Function,
|
|
89
|
+
default: file => {
|
|
90
|
+
if (!environmentSupportFile) return false;
|
|
91
|
+
return isImageFile(file);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
createThumbnailUrl: Function,
|
|
95
|
+
abstract: Boolean,
|
|
96
|
+
max: Number,
|
|
97
|
+
maxSize: Number,
|
|
98
|
+
showTrigger: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: true
|
|
101
|
+
},
|
|
102
|
+
imageGroupProps: Object,
|
|
103
|
+
inputProps: Object,
|
|
104
|
+
triggerClass: String,
|
|
105
|
+
triggerStyle: [String, Object],
|
|
106
|
+
renderIcon: Function,
|
|
107
|
+
label: String,
|
|
108
|
+
size: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: 'medium'
|
|
111
|
+
},
|
|
112
|
+
title: String,
|
|
113
|
+
subtitle: String,
|
|
114
|
+
noIcon: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: false
|
|
117
|
+
}
|
|
118
|
+
});
|
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
import type { CustomRequestOptions, FileInfo, FuncOrRecordOrUndef, OnChange, OnDownload, OnFinish, OnRemove, OnRetry, SettledFileInfo, UploadInst as UploadInstInner } from './interface';
|
|
2
|
-
export type { UploadProps } from './
|
|
1
|
+
import type { CustomRequestOptions, FileInfo, FuncOrRecordOrUndef, IsErrorState, ListType, OnBeforeUpload, OnBeforeUploadPayload, OnChange, OnChangePayload, OnDownload, OnError, OnErrorPayload, OnFinish, OnFinishPayload, OnPreview, OnRemove, OnRemovePayload, OnRetry, OnRetryPayload, OnUpdateFileList, RenderIcon, SettledFileInfo, ShouldUseThumbnailUrl, SubmitOptions, UploadInst as UploadInstInner } from './interface';
|
|
2
|
+
export type { UploadLocale, UploadProps, UploadSize } from './interface';
|
|
3
3
|
export interface UploadInst extends UploadInstInner {
|
|
4
4
|
}
|
|
5
5
|
export type UploadFileInfo = FileInfo;
|
|
6
6
|
export type UploadCustomRequestOptions = CustomRequestOptions;
|
|
7
7
|
export type UploadSettledFileInfo = SettledFileInfo;
|
|
8
|
+
export type UploadListType = ListType;
|
|
9
|
+
export type UploadIsErrorState = IsErrorState;
|
|
10
|
+
export type UploadRenderIcon = RenderIcon;
|
|
11
|
+
export type UploadShouldUseThumbnailUrl = ShouldUseThumbnailUrl;
|
|
12
|
+
export type UploadSubmitOptions = SubmitOptions;
|
|
8
13
|
export type UploadOnChange = OnChange;
|
|
14
|
+
export type UploadOnChangePayload = OnChangePayload;
|
|
9
15
|
export type UploadOnFinish = OnFinish;
|
|
16
|
+
export type UploadOnFinishPayload = OnFinishPayload;
|
|
17
|
+
export type UploadOnError = OnError;
|
|
18
|
+
export type UploadOnErrorPayload = OnErrorPayload;
|
|
10
19
|
export type UploadOnRemove = OnRemove;
|
|
20
|
+
export type UploadOnRemovePayload = OnRemovePayload;
|
|
11
21
|
export type UploadOnDownload = OnDownload;
|
|
12
22
|
export type UploadOnRetry = OnRetry;
|
|
23
|
+
export type UploadOnRetryPayload = OnRetryPayload;
|
|
24
|
+
export type UploadOnPreview = OnPreview;
|
|
25
|
+
export type UploadOnBeforeUpload = OnBeforeUpload;
|
|
26
|
+
export type UploadOnBeforeUploadPayload = OnBeforeUploadPayload;
|
|
27
|
+
export type UploadOnUpdateFileList = OnUpdateFileList;
|
|
13
28
|
export type { FuncOrRecordOrUndef };
|
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
interface Options {
|
|
4
|
-
clsPrefix: string;
|
|
5
|
-
listType: ListType;
|
|
6
|
-
file: SettledFileInfo;
|
|
7
|
-
renderIcon?: RenderIcon;
|
|
8
|
-
showPreviewButton: string | boolean | null;
|
|
9
|
-
showRemoveButton: boolean;
|
|
10
|
-
showCancelButton: boolean;
|
|
11
|
-
showRetryButton: boolean;
|
|
12
|
-
showDownloadButton: boolean;
|
|
13
|
-
disabled: boolean;
|
|
14
|
-
buttonType: string | undefined;
|
|
15
|
-
mergedTheme: any;
|
|
16
|
-
buttonThemeOverrides: any;
|
|
17
|
-
handlePreviewClick: () => void;
|
|
18
|
-
handleRemoveOrCancelClick: (e: MouseEvent) => void;
|
|
19
|
-
handleRetryClick: () => void;
|
|
20
|
-
handleDownloadClick: (e: MouseEvent) => void;
|
|
21
|
-
capitalizeFirstLetter: (text: string) => string;
|
|
22
|
-
}
|
|
23
|
-
export declare function useUploadActionsRender(opts: Options): {
|
|
24
|
-
actionsNode: VNode;
|
|
25
|
-
icon: VNode;
|
|
26
|
-
};
|
|
27
|
-
export {};
|
|
1
|
+
import type { UploadActionsRenderOptions, UploadActionsRenderReturn } from './interface';
|
|
2
|
+
export declare function useUploadActionsRender(options: UploadActionsRenderOptions): UploadActionsRenderReturn;
|
|
@@ -2,7 +2,7 @@ import { h } from 'vue';
|
|
|
2
2
|
import { UBaseIcon, UIconSwitchTransition } from "../../_internal/index.mjs";
|
|
3
3
|
import { CancelIcon, DownloadIcon, EyeIcon, RetryIcon, TrashIcon } from "../../_internal/icons/index.mjs";
|
|
4
4
|
import { UButton } from "../../button/index.mjs";
|
|
5
|
-
export function useUploadActionsRender(
|
|
5
|
+
export function useUploadActionsRender(options) {
|
|
6
6
|
const {
|
|
7
7
|
clsPrefix,
|
|
8
8
|
listType,
|
|
@@ -22,7 +22,7 @@ export function useUploadActionsRender(opts) {
|
|
|
22
22
|
handleRetryClick,
|
|
23
23
|
handleDownloadClick,
|
|
24
24
|
capitalizeFirstLetter
|
|
25
|
-
} =
|
|
25
|
+
} = options;
|
|
26
26
|
const getExt = name => {
|
|
27
27
|
const i = name.lastIndexOf('.');
|
|
28
28
|
return i === -1 || i === name.length - 1 ? '' : name.slice(i + 1);
|
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
mergedClsPrefix: string;
|
|
4
|
-
accept?: string;
|
|
5
|
-
multiple?: boolean;
|
|
6
|
-
inputProps?: Record<string, any>;
|
|
7
|
-
directory?: boolean;
|
|
8
|
-
onChange?: (e: Event) => void;
|
|
9
|
-
label?: string;
|
|
10
|
-
title?: string;
|
|
11
|
-
subtitle?: string;
|
|
12
|
-
vertical?: boolean;
|
|
13
|
-
noIcon?: boolean;
|
|
14
|
-
icon?: any;
|
|
15
|
-
localeRef: {
|
|
16
|
-
title: string;
|
|
17
|
-
subtitle: string;
|
|
18
|
-
};
|
|
19
|
-
slots: Slots;
|
|
20
|
-
}
|
|
21
|
-
export declare function useUploadInternals(options: UseUploadInternalsOptions): {
|
|
22
|
-
inputNode: VNode;
|
|
23
|
-
renderDefaultTrigger: () => VNode[];
|
|
24
|
-
};
|
|
25
|
-
export {};
|
|
1
|
+
import type { UseUploadInternalsOptions, UseUploadInternalsReturn } from './interface';
|
|
2
|
+
export declare function useUploadInternals(options: UseUploadInternalsOptions): UseUploadInternalsReturn;
|
package/es/upload/src/utils.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export declare const environmentSupportFile: false | {
|
|
|
10
10
|
export declare function isFileSystemDirectoryEntry(item: FileSystemEntry | FileSystemFileEntry | FileSystemDirectoryEntry): item is FileSystemDirectoryEntry;
|
|
11
11
|
export declare function isFileSystemFileEntry(item: FileSystemEntry | FileSystemFileEntry | FileSystemDirectoryEntry): item is FileSystemFileEntry;
|
|
12
12
|
export declare function getFilesFromEntries(entries: readonly FileSystemEntry[] | Array<FileSystemEntry | null>, directory: boolean): Promise<FileAndEntry[]>;
|
|
13
|
+
export declare function getFilePreviewSrc(file: SettledFileInfo): string | null;
|
|
14
|
+
export declare function isFileSizeExceeded(file: File | null | undefined, maxSize: number | undefined): boolean;
|
|
13
15
|
export declare function createSettledFileInfo(fileInfo: FileInfo): SettledFileInfo;
|
|
14
16
|
/**
|
|
15
17
|
* This is a rather simple version. I may fix it later to make it more accurate.
|
package/es/upload/src/utils.mjs
CHANGED
|
@@ -124,6 +124,13 @@ export function getFilesFromEntries(entries, directory) {
|
|
|
124
124
|
return fileAndEntries;
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
+
export function getFilePreviewSrc(file) {
|
|
128
|
+
return file.url || file.thumbnailUrl || null;
|
|
129
|
+
}
|
|
130
|
+
export function isFileSizeExceeded(file, maxSize) {
|
|
131
|
+
if (maxSize === undefined || !file) return false;
|
|
132
|
+
return file.size > maxSize;
|
|
133
|
+
}
|
|
127
134
|
export function createSettledFileInfo(fileInfo) {
|
|
128
135
|
const {
|
|
129
136
|
id,
|
package/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "2.3.
|
|
1
|
+
declare const _default: "2.3.2";
|
|
2
2
|
export default _default;
|
package/es/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '2.3.
|
|
1
|
+
export default '2.3.2';
|
package/lib/components.d.ts
CHANGED
|
@@ -97936,6 +97936,7 @@ export declare const UImagePreview: import("vue").DefineComponent<import("vue").
|
|
|
97936
97936
|
'--u-toolbar-color': string;
|
|
97937
97937
|
'--u-toolbar-border-radius': string;
|
|
97938
97938
|
'--u-toolbar-box-shadow': string;
|
|
97939
|
+
'--u-overlay-color': string;
|
|
97939
97940
|
}> | undefined;
|
|
97940
97941
|
themeClass: import("vue").Ref<string, string> | undefined;
|
|
97941
97942
|
onRender: (() => void) | undefined;
|
|
@@ -146545,7 +146546,7 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
|
|
|
146545
146546
|
readonly onError: import("vue").PropType<import("./upload/src/interface").OnError>;
|
|
146546
146547
|
readonly onRetry: import("vue").PropType<import("./upload/src/interface").OnRetry>;
|
|
146547
146548
|
readonly onBeforeUpload: import("vue").PropType<import("./upload/src/interface").OnBeforeUpload>;
|
|
146548
|
-
readonly isErrorState: import("vue").PropType<(
|
|
146549
|
+
readonly isErrorState: import("vue").PropType<import("./upload/src/interface").IsErrorState>;
|
|
146549
146550
|
readonly onDownload: import("vue").PropType<import("./upload/src/interface").OnDownload>;
|
|
146550
146551
|
readonly defaultUpload: {
|
|
146551
146552
|
readonly type: BooleanConstructor;
|
|
@@ -146590,6 +146591,7 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
|
|
|
146590
146591
|
readonly createThumbnailUrl: import("vue").PropType<import("./upload/src/interface").CreateThumbnailUrl>;
|
|
146591
146592
|
readonly abstract: BooleanConstructor;
|
|
146592
146593
|
readonly max: NumberConstructor;
|
|
146594
|
+
readonly maxSize: NumberConstructor;
|
|
146593
146595
|
readonly showTrigger: {
|
|
146594
146596
|
readonly type: BooleanConstructor;
|
|
146595
146597
|
readonly default: true;
|
|
@@ -146601,7 +146603,7 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
|
|
|
146601
146603
|
readonly renderIcon: import("vue").PropType<import("./upload/src/interface").RenderIcon>;
|
|
146602
146604
|
readonly label: StringConstructor;
|
|
146603
146605
|
readonly size: {
|
|
146604
|
-
readonly type: import("vue").PropType<"
|
|
146606
|
+
readonly type: import("vue").PropType<import("./upload").UploadSize>;
|
|
146605
146607
|
readonly default: "medium";
|
|
146606
146608
|
};
|
|
146607
146609
|
readonly title: StringConstructor;
|
|
@@ -147431,7 +147433,7 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
|
|
|
147431
147433
|
}>>>;
|
|
147432
147434
|
}>, {
|
|
147433
147435
|
openFileDialog: () => void;
|
|
147434
|
-
submit: ()
|
|
147436
|
+
submit: import("./upload/src/interface").Submit;
|
|
147435
147437
|
clear: () => void;
|
|
147436
147438
|
mergedClsPrefix: import("vue").Ref<string, string>;
|
|
147437
147439
|
mergedSizeRef: import("vue").ComputedRef<"small" | "medium" | "large">;
|
|
@@ -147742,7 +147744,7 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
|
|
|
147742
147744
|
cssVars: import("vue").ComputedRef<any> | undefined;
|
|
147743
147745
|
themeClass: import("vue").Ref<string, string> | undefined;
|
|
147744
147746
|
onRender: (() => void) | undefined;
|
|
147745
|
-
handleFileInputChange: (
|
|
147747
|
+
handleFileInputChange: (event: Event) => void;
|
|
147746
147748
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
147747
147749
|
readonly name: {
|
|
147748
147750
|
readonly type: StringConstructor;
|
|
@@ -147787,7 +147789,7 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
|
|
|
147787
147789
|
readonly onError: import("vue").PropType<import("./upload/src/interface").OnError>;
|
|
147788
147790
|
readonly onRetry: import("vue").PropType<import("./upload/src/interface").OnRetry>;
|
|
147789
147791
|
readonly onBeforeUpload: import("vue").PropType<import("./upload/src/interface").OnBeforeUpload>;
|
|
147790
|
-
readonly isErrorState: import("vue").PropType<(
|
|
147792
|
+
readonly isErrorState: import("vue").PropType<import("./upload/src/interface").IsErrorState>;
|
|
147791
147793
|
readonly onDownload: import("vue").PropType<import("./upload/src/interface").OnDownload>;
|
|
147792
147794
|
readonly defaultUpload: {
|
|
147793
147795
|
readonly type: BooleanConstructor;
|
|
@@ -147832,6 +147834,7 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
|
|
|
147832
147834
|
readonly createThumbnailUrl: import("vue").PropType<import("./upload/src/interface").CreateThumbnailUrl>;
|
|
147833
147835
|
readonly abstract: BooleanConstructor;
|
|
147834
147836
|
readonly max: NumberConstructor;
|
|
147837
|
+
readonly maxSize: NumberConstructor;
|
|
147835
147838
|
readonly showTrigger: {
|
|
147836
147839
|
readonly type: BooleanConstructor;
|
|
147837
147840
|
readonly default: true;
|
|
@@ -147843,7 +147846,7 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
|
|
|
147843
147846
|
readonly renderIcon: import("vue").PropType<import("./upload/src/interface").RenderIcon>;
|
|
147844
147847
|
readonly label: StringConstructor;
|
|
147845
147848
|
readonly size: {
|
|
147846
|
-
readonly type: import("vue").PropType<"
|
|
147849
|
+
readonly type: import("vue").PropType<import("./upload").UploadSize>;
|
|
147847
147850
|
readonly default: "medium";
|
|
147848
147851
|
};
|
|
147849
147852
|
readonly title: StringConstructor;
|
|
@@ -148674,7 +148677,7 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
|
|
|
148674
148677
|
}>> & Readonly<{}>, {
|
|
148675
148678
|
readonly disabled: boolean | undefined;
|
|
148676
148679
|
readonly vertical: boolean;
|
|
148677
|
-
readonly size: "
|
|
148680
|
+
readonly size: import("./upload").UploadSize;
|
|
148678
148681
|
readonly name: string;
|
|
148679
148682
|
readonly abstract: boolean;
|
|
148680
148683
|
readonly multiple: boolean;
|
|
@@ -313,6 +313,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
313
313
|
'--u-toolbar-color': string;
|
|
314
314
|
'--u-toolbar-border-radius': string;
|
|
315
315
|
'--u-toolbar-box-shadow': string;
|
|
316
|
+
'--u-overlay-color': string;
|
|
316
317
|
}> | undefined;
|
|
317
318
|
themeClass: import("vue").Ref<string, string> | undefined;
|
|
318
319
|
onRender: (() => void) | undefined;
|
|
@@ -352,13 +352,14 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
355
|
-
const { common: { cubicBezierEaseInOut }, self: { toolbarIconColor, toolbarBorderRadius, toolbarBoxShadow, toolbarColor } } = themeRef.value;
|
|
355
|
+
const { common: { cubicBezierEaseInOut }, self: { toolbarIconColor, toolbarBorderRadius, toolbarBoxShadow, toolbarColor, overlayColor } } = themeRef.value;
|
|
356
356
|
return {
|
|
357
357
|
'--u-bezier': cubicBezierEaseInOut,
|
|
358
358
|
'--u-toolbar-icon-color': toolbarIconColor,
|
|
359
359
|
'--u-toolbar-color': toolbarColor,
|
|
360
360
|
'--u-toolbar-border-radius': toolbarBorderRadius,
|
|
361
|
-
'--u-toolbar-box-shadow': toolbarBoxShadow
|
|
361
|
+
'--u-toolbar-box-shadow': toolbarBoxShadow,
|
|
362
|
+
'--u-overlay-color': overlayColor
|
|
362
363
|
};
|
|
363
364
|
});
|
|
364
365
|
const { inlineThemeDisabled } = (0, _mixins_1.useConfig)();
|
|
@@ -394,21 +395,13 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
394
395
|
render() {
|
|
395
396
|
var _a, _b;
|
|
396
397
|
const { clsPrefix, renderToolbar, withTooltip } = this;
|
|
397
|
-
const prevNode = withTooltip((0, vue_1.h)(_internal_1.UBaseIcon, { clsPrefix: clsPrefix, onClick: this.handleSwitchPrev }, { default: () => icons_2.prevIcon }), 'tipPrevious');
|
|
398
|
-
const nextNode = withTooltip((0, vue_1.h)(_internal_1.UBaseIcon, { clsPrefix: clsPrefix, onClick: this.handleSwitchNext }, { default: () => icons_2.nextIcon }), 'tipNext');
|
|
399
398
|
const rotateCounterclockwiseNode = withTooltip((0, vue_1.h)(_internal_1.UBaseIcon, { clsPrefix: clsPrefix, onClick: this.rotateCounterclockwise }, {
|
|
400
399
|
default: () => (0, vue_1.h)(icons_1.RotateCounterclockwiseIcon, null)
|
|
401
400
|
}), 'tipCounterclockwise');
|
|
402
401
|
const rotateClockwiseNode = withTooltip((0, vue_1.h)(_internal_1.UBaseIcon, { clsPrefix: clsPrefix, onClick: this.rotateClockwise }, {
|
|
403
402
|
default: () => (0, vue_1.h)(icons_1.RotateClockwiseIcon, null)
|
|
404
403
|
}), 'tipClockwise');
|
|
405
|
-
const originalSizeNode = withTooltip((0, vue_1.h)(_internal_1.UBaseIcon, { clsPrefix: clsPrefix, onClick: this.resizeToOrignalImageSize }, {
|
|
406
|
-
default: () => {
|
|
407
|
-
return (0, vue_1.h)(icons_1.ResizeSmallIcon, null);
|
|
408
|
-
}
|
|
409
|
-
}), 'tipOriginalSize');
|
|
410
404
|
const zoomOutNode = withTooltip((0, vue_1.h)(_internal_1.UBaseIcon, { clsPrefix: clsPrefix, onClick: this.zoomOut }, { default: () => (0, vue_1.h)(icons_1.ZoomOutIcon, null) }), 'tipZoomOut');
|
|
411
|
-
const downloadNode = withTooltip((0, vue_1.h)(_internal_1.UBaseIcon, { clsPrefix: clsPrefix, onClick: this.handleDownloadClick }, { default: () => icons_2.downloadIcon }), 'tipDownload');
|
|
412
405
|
const closeNode = withTooltip((0, vue_1.h)(_internal_1.UBaseIcon, { clsPrefix: clsPrefix, onClick: () => this.close() }, { default: () => icons_2.closeIcon }), 'tipClose');
|
|
413
406
|
const zoomInNode = withTooltip((0, vue_1.h)(_internal_1.UBaseIcon, { clsPrefix: clsPrefix, onClick: this.zoomIn }, { default: () => (0, vue_1.h)(icons_1.ZoomInIcon, null) }), 'tipZoomIn');
|
|
414
407
|
return ((0, vue_1.h)(vue_1.Fragment, null, (_b = (_a = this.$slots).default) === null || _b === void 0 ? void 0 :
|
|
@@ -433,26 +426,17 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
433
426
|
return null;
|
|
434
427
|
return ((0, vue_1.h)("div", { class: `${clsPrefix}-image-preview-toolbar` }, renderToolbar ? (renderToolbar({
|
|
435
428
|
nodes: {
|
|
436
|
-
prev: prevNode,
|
|
437
|
-
next: nextNode,
|
|
438
429
|
rotateCounterclockwise: rotateCounterclockwiseNode,
|
|
439
430
|
rotateClockwise: rotateClockwiseNode,
|
|
440
|
-
resizeToOriginalSize: originalSizeNode,
|
|
441
431
|
zoomOut: zoomOutNode,
|
|
442
432
|
zoomIn: zoomInNode,
|
|
443
|
-
download: downloadNode,
|
|
444
433
|
close: closeNode
|
|
445
434
|
}
|
|
446
435
|
})) : ((0, vue_1.h)(vue_1.Fragment, null,
|
|
447
|
-
this.onPrev ? ((0, vue_1.h)(vue_1.Fragment, null,
|
|
448
|
-
prevNode,
|
|
449
|
-
nextNode)) : null,
|
|
450
436
|
rotateCounterclockwiseNode,
|
|
451
437
|
rotateClockwiseNode,
|
|
452
|
-
originalSizeNode,
|
|
453
438
|
zoomOutNode,
|
|
454
439
|
zoomInNode,
|
|
455
|
-
downloadNode,
|
|
456
440
|
closeNode))));
|
|
457
441
|
}
|
|
458
442
|
})) : null,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { VNode, VNodeChild } from 'vue';
|
|
2
2
|
export interface ImageRenderToolbarProps {
|
|
3
3
|
nodes: {
|
|
4
|
-
prev
|
|
5
|
-
next
|
|
4
|
+
prev?: VNode;
|
|
5
|
+
next?: VNode;
|
|
6
6
|
rotateCounterclockwise: VNode;
|
|
7
7
|
rotateClockwise: VNode;
|
|
8
|
-
resizeToOriginalSize
|
|
8
|
+
resizeToOriginalSize?: VNode;
|
|
9
9
|
zoomOut: VNode;
|
|
10
10
|
zoomIn: VNode;
|
|
11
|
-
download
|
|
11
|
+
download?: VNode;
|
|
12
12
|
close: VNode;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -100,6 +100,12 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
100
100
|
const url = [attachment.preview, attachment.thumbnail].find(value => typeof value === 'string');
|
|
101
101
|
return url !== null && url !== void 0 ? url : null;
|
|
102
102
|
};
|
|
103
|
+
const getAttachmentUrl = (attachment) => {
|
|
104
|
+
if (!attachment.url || attachment.url === '#')
|
|
105
|
+
return null;
|
|
106
|
+
return attachment.url;
|
|
107
|
+
};
|
|
108
|
+
const isAttachmentPreviewable = (file) => Boolean(file.thumbnailUrl);
|
|
103
109
|
const handleAttachmentDownload = (file) => __awaiter(this, void 0, void 0, function* () {
|
|
104
110
|
if (props.onAttachmentDownload) {
|
|
105
111
|
const attachment = normalizedAttachmentsRef.value.find(item => item.name === file.name);
|
|
@@ -135,20 +141,20 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
135
141
|
return slots.messageAttachment(messagePayloadRef.value);
|
|
136
142
|
}
|
|
137
143
|
const fileList = normalizedAttachmentsRef.value.map(attachment => {
|
|
138
|
-
var _a, _b
|
|
144
|
+
var _a, _b;
|
|
139
145
|
return ({
|
|
140
146
|
id: String(attachment.id),
|
|
141
147
|
name: attachment.name,
|
|
142
148
|
status: attachment.status || interface_1.MessageBubbleAttachmentStatus.FINISHED,
|
|
143
149
|
percentage: (_a = attachment.percentage) !== null && _a !== void 0 ? _a : null,
|
|
144
|
-
url: (
|
|
150
|
+
url: getAttachmentUrl(attachment),
|
|
145
151
|
thumbnailUrl: getThumbnailUrl(attachment),
|
|
146
|
-
type: (
|
|
152
|
+
type: (_b = attachment.type) !== null && _b !== void 0 ? _b : null,
|
|
147
153
|
file: null,
|
|
148
154
|
batchId: null
|
|
149
155
|
});
|
|
150
156
|
});
|
|
151
|
-
const uploadComponent = ((0, vue_1.h)(upload_1.UUpload, Object.assign({ abstract: true, fileList: fileList, fileListStyle: withPadding
|
|
157
|
+
const uploadComponent = ((0, vue_1.h)(upload_1.UUpload, Object.assign({ abstract: true, listType: "preview-list", shouldUseThumbnailUrl: isAttachmentPreviewable, fileList: fileList, fileListStyle: withPadding
|
|
152
158
|
? {
|
|
153
159
|
display: 'flex',
|
|
154
160
|
flexDirection: 'column',
|
package/lib/upload/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { publicDownload as uploadDownload } from '../_utils/dom/download';
|
|
2
2
|
export type { CustomRequestOptions as UploadCustomRequestOptions, FileInfo as UploadFileInfo, UploadInst, SettledFileInfo as UploadSettledFileInfo } from './src/interface';
|
|
3
|
+
export { uploadProps, type UploadProps } from './src/interface';
|
|
3
4
|
export type * from './src/public-types';
|
|
4
|
-
export {
|
|
5
|
+
export { default as UUpload } from './src/Upload';
|
|
5
6
|
export { default as UUploadDragger } from './src/UploadDragger';
|
|
6
7
|
export { default as UUploadFileList } from './src/UploadFileList';
|
|
7
8
|
export { default as UUploadTrigger } from './src/UploadTrigger';
|
package/lib/upload/index.js
CHANGED
|
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.UUploadTrigger = exports.UUploadFileList = exports.UUploadDragger = exports.UUpload = exports.uploadProps = exports.uploadDownload = void 0;
|
|
7
7
|
var download_1 = require("../_utils/dom/download");
|
|
8
8
|
Object.defineProperty(exports, "uploadDownload", { enumerable: true, get: function () { return download_1.publicDownload; } });
|
|
9
|
+
var interface_1 = require("./src/interface");
|
|
10
|
+
Object.defineProperty(exports, "uploadProps", { enumerable: true, get: function () { return interface_1.uploadProps; } });
|
|
9
11
|
var Upload_1 = require("./src/Upload");
|
|
10
|
-
Object.defineProperty(exports, "uploadProps", { enumerable: true, get: function () { return Upload_1.uploadProps; } });
|
|
11
12
|
Object.defineProperty(exports, "UUpload", { enumerable: true, get: function () { return __importDefault(Upload_1).default; } });
|
|
12
13
|
var UploadDragger_1 = require("./src/UploadDragger");
|
|
13
14
|
Object.defineProperty(exports, "UUploadDragger", { enumerable: true, get: function () { return __importDefault(UploadDragger_1).default; } });
|