@sdata/web-vue 3.1.0 → 3.2.0
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/sd.css +166 -0
- package/dist/sd.min.css +1 -1
- package/es/components.d.ts +1 -0
- package/es/file-previewer/file-previewer.js +5 -0
- package/es/file-previewer/file-previewer.vue.d.ts +126 -0
- package/es/file-previewer/file-previewer.vue_vue_type_script_setup_true_lang.js +356 -0
- package/es/file-previewer/index.d.ts +220 -0
- package/es/file-previewer/index.js +10 -0
- package/es/file-previewer/style/css.js +2 -0
- package/es/file-previewer/style/index.css +164 -0
- package/es/file-previewer/style/index.d.ts +2 -0
- package/es/file-previewer/style/index.js +2 -0
- package/es/file-previewer/style/index.scss +186 -0
- package/es/file-previewer/style/token.scss +31 -0
- package/es/file-previewer/types.d.ts +29 -0
- package/es/image/preview.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/index.css +166 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -1
- package/es/index.scss +1 -0
- package/es/menu/style/css.js +0 -1
- package/es/menu/style/index.js +0 -1
- package/es/sd-vue.js +2 -0
- package/es/tree/base-node.vue.d.ts +8 -4
- package/es/tree/base-node.vue_vue_type_script_setup_true_lang.js +23 -3
- package/es/tree/interface.d.ts +2 -0
- package/es/tree/style/index.css +18 -0
- package/es/tree/style/index.d.ts +1 -0
- package/es/tree/style/index.scss +21 -0
- package/es/tree/tree.vue.d.ts +10 -1
- package/es/tree/tree.vue_vue_type_script_setup_true_lang.js +8 -0
- package/json/vetur-attributes.json +51 -0
- package/json/vetur-tags.json +18 -0
- package/json/web-types.json +113 -1
- package/package.json +2 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import type { SDOptions } from '../_utils/types';
|
|
3
|
+
import _FilePreviewer from './file-previewer.vue';
|
|
4
|
+
declare const FilePreviewer: {
|
|
5
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
6
|
+
src: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
};
|
|
9
|
+
type: {
|
|
10
|
+
type: import("vue").PropType<import("./types").FilePreviewerType>;
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
visible: {
|
|
14
|
+
type: BooleanConstructor;
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
defaultVisible: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
21
|
+
fullscreen: {
|
|
22
|
+
type: BooleanConstructor;
|
|
23
|
+
default: boolean;
|
|
24
|
+
};
|
|
25
|
+
title: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
};
|
|
28
|
+
maskClosable: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
closable: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
escToClose: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
popupContainer: {
|
|
41
|
+
type: import("vue").PropType<HTMLElement | string>;
|
|
42
|
+
};
|
|
43
|
+
renderToBody: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
default: boolean;
|
|
46
|
+
};
|
|
47
|
+
}>> & Readonly<{
|
|
48
|
+
onClose?: (() => any) | undefined;
|
|
49
|
+
"onUpdate:visible"?: ((_visible: boolean) => any) | undefined;
|
|
50
|
+
"onVisible-change"?: ((_visible: boolean) => any) | undefined;
|
|
51
|
+
}>, {
|
|
52
|
+
close: () => void;
|
|
53
|
+
onLoad: () => void;
|
|
54
|
+
onError: () => void;
|
|
55
|
+
onImageLoad: () => void;
|
|
56
|
+
onPdfLoad: () => void;
|
|
57
|
+
onLoadError: () => void;
|
|
58
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
59
|
+
close: () => any;
|
|
60
|
+
"update:visible": (_visible: boolean) => any;
|
|
61
|
+
"visible-change": (_visible: boolean) => any;
|
|
62
|
+
}, import("vue").PublicProps, {
|
|
63
|
+
type: import("./types").FilePreviewerType;
|
|
64
|
+
visible: boolean;
|
|
65
|
+
renderToBody: boolean;
|
|
66
|
+
defaultVisible: boolean;
|
|
67
|
+
closable: boolean;
|
|
68
|
+
maskClosable: boolean;
|
|
69
|
+
escToClose: boolean;
|
|
70
|
+
fullscreen: boolean;
|
|
71
|
+
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
72
|
+
P: {};
|
|
73
|
+
B: {};
|
|
74
|
+
D: {};
|
|
75
|
+
C: {};
|
|
76
|
+
M: {};
|
|
77
|
+
Defaults: {};
|
|
78
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
79
|
+
src: {
|
|
80
|
+
type: StringConstructor;
|
|
81
|
+
};
|
|
82
|
+
type: {
|
|
83
|
+
type: import("vue").PropType<import("./types").FilePreviewerType>;
|
|
84
|
+
default: string;
|
|
85
|
+
};
|
|
86
|
+
visible: {
|
|
87
|
+
type: BooleanConstructor;
|
|
88
|
+
default: undefined;
|
|
89
|
+
};
|
|
90
|
+
defaultVisible: {
|
|
91
|
+
type: BooleanConstructor;
|
|
92
|
+
default: boolean;
|
|
93
|
+
};
|
|
94
|
+
fullscreen: {
|
|
95
|
+
type: BooleanConstructor;
|
|
96
|
+
default: boolean;
|
|
97
|
+
};
|
|
98
|
+
title: {
|
|
99
|
+
type: StringConstructor;
|
|
100
|
+
};
|
|
101
|
+
maskClosable: {
|
|
102
|
+
type: BooleanConstructor;
|
|
103
|
+
default: boolean;
|
|
104
|
+
};
|
|
105
|
+
closable: {
|
|
106
|
+
type: BooleanConstructor;
|
|
107
|
+
default: boolean;
|
|
108
|
+
};
|
|
109
|
+
escToClose: {
|
|
110
|
+
type: BooleanConstructor;
|
|
111
|
+
default: boolean;
|
|
112
|
+
};
|
|
113
|
+
popupContainer: {
|
|
114
|
+
type: import("vue").PropType<HTMLElement | string>;
|
|
115
|
+
};
|
|
116
|
+
renderToBody: {
|
|
117
|
+
type: BooleanConstructor;
|
|
118
|
+
default: boolean;
|
|
119
|
+
};
|
|
120
|
+
}>> & Readonly<{
|
|
121
|
+
onClose?: (() => any) | undefined;
|
|
122
|
+
"onUpdate:visible"?: ((_visible: boolean) => any) | undefined;
|
|
123
|
+
"onVisible-change"?: ((_visible: boolean) => any) | undefined;
|
|
124
|
+
}>, {
|
|
125
|
+
close: () => void;
|
|
126
|
+
onLoad: () => void;
|
|
127
|
+
onError: () => void;
|
|
128
|
+
onImageLoad: () => void;
|
|
129
|
+
onPdfLoad: () => void;
|
|
130
|
+
onLoadError: () => void;
|
|
131
|
+
}, {}, {}, {}, {
|
|
132
|
+
type: import("./types").FilePreviewerType;
|
|
133
|
+
visible: boolean;
|
|
134
|
+
renderToBody: boolean;
|
|
135
|
+
defaultVisible: boolean;
|
|
136
|
+
closable: boolean;
|
|
137
|
+
maskClosable: boolean;
|
|
138
|
+
escToClose: boolean;
|
|
139
|
+
fullscreen: boolean;
|
|
140
|
+
}>;
|
|
141
|
+
__isFragment?: never;
|
|
142
|
+
__isTeleport?: never;
|
|
143
|
+
__isSuspense?: never;
|
|
144
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
145
|
+
src: {
|
|
146
|
+
type: StringConstructor;
|
|
147
|
+
};
|
|
148
|
+
type: {
|
|
149
|
+
type: import("vue").PropType<import("./types").FilePreviewerType>;
|
|
150
|
+
default: string;
|
|
151
|
+
};
|
|
152
|
+
visible: {
|
|
153
|
+
type: BooleanConstructor;
|
|
154
|
+
default: undefined;
|
|
155
|
+
};
|
|
156
|
+
defaultVisible: {
|
|
157
|
+
type: BooleanConstructor;
|
|
158
|
+
default: boolean;
|
|
159
|
+
};
|
|
160
|
+
fullscreen: {
|
|
161
|
+
type: BooleanConstructor;
|
|
162
|
+
default: boolean;
|
|
163
|
+
};
|
|
164
|
+
title: {
|
|
165
|
+
type: StringConstructor;
|
|
166
|
+
};
|
|
167
|
+
maskClosable: {
|
|
168
|
+
type: BooleanConstructor;
|
|
169
|
+
default: boolean;
|
|
170
|
+
};
|
|
171
|
+
closable: {
|
|
172
|
+
type: BooleanConstructor;
|
|
173
|
+
default: boolean;
|
|
174
|
+
};
|
|
175
|
+
escToClose: {
|
|
176
|
+
type: BooleanConstructor;
|
|
177
|
+
default: boolean;
|
|
178
|
+
};
|
|
179
|
+
popupContainer: {
|
|
180
|
+
type: import("vue").PropType<HTMLElement | string>;
|
|
181
|
+
};
|
|
182
|
+
renderToBody: {
|
|
183
|
+
type: BooleanConstructor;
|
|
184
|
+
default: boolean;
|
|
185
|
+
};
|
|
186
|
+
}>> & Readonly<{
|
|
187
|
+
onClose?: (() => any) | undefined;
|
|
188
|
+
"onUpdate:visible"?: ((_visible: boolean) => any) | undefined;
|
|
189
|
+
"onVisible-change"?: ((_visible: boolean) => any) | undefined;
|
|
190
|
+
}>, {
|
|
191
|
+
close: () => void;
|
|
192
|
+
onLoad: () => void;
|
|
193
|
+
onError: () => void;
|
|
194
|
+
onImageLoad: () => void;
|
|
195
|
+
onPdfLoad: () => void;
|
|
196
|
+
onLoadError: () => void;
|
|
197
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
198
|
+
close: () => any;
|
|
199
|
+
"update:visible": (_visible: boolean) => any;
|
|
200
|
+
"visible-change": (_visible: boolean) => any;
|
|
201
|
+
}, string, {
|
|
202
|
+
type: import("./types").FilePreviewerType;
|
|
203
|
+
visible: boolean;
|
|
204
|
+
renderToBody: boolean;
|
|
205
|
+
defaultVisible: boolean;
|
|
206
|
+
closable: boolean;
|
|
207
|
+
maskClosable: boolean;
|
|
208
|
+
escToClose: boolean;
|
|
209
|
+
fullscreen: boolean;
|
|
210
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
211
|
+
$slots: {
|
|
212
|
+
title?: () => unknown;
|
|
213
|
+
content?: (_props: import("./types").FilePreviewerContentSlotProps) => unknown;
|
|
214
|
+
};
|
|
215
|
+
}) & {
|
|
216
|
+
install: (app: App, options?: SDOptions) => void;
|
|
217
|
+
};
|
|
218
|
+
export type FilePreviewerInstance = InstanceType<typeof _FilePreviewer>;
|
|
219
|
+
export type { FilePreviewerContentSlotProps, FilePreviewerProps, FilePreviewerStatus, FilePreviewerType, } from './types';
|
|
220
|
+
export default FilePreviewer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getComponentPrefix, setGlobalConfig } from "../_utils/global-config.js";
|
|
2
|
+
import file_previewer_default from "./file-previewer.js";
|
|
3
|
+
//#region components/file-previewer/index.ts
|
|
4
|
+
var FilePreviewer = Object.assign(file_previewer_default, { install: (app, options) => {
|
|
5
|
+
setGlobalConfig(app, options);
|
|
6
|
+
const componentPrefix = getComponentPrefix(options);
|
|
7
|
+
app.component(componentPrefix + file_previewer_default.name, file_previewer_default);
|
|
8
|
+
} });
|
|
9
|
+
//#endregion
|
|
10
|
+
export { FilePreviewer as default };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/******** borderSize *******/
|
|
2
|
+
/******** borderStyle *******/
|
|
3
|
+
/******** radius *******/
|
|
4
|
+
/******** shadow distance *******/
|
|
5
|
+
/******** size *******/
|
|
6
|
+
/******** spacing *******/
|
|
7
|
+
/******** shadow *******/
|
|
8
|
+
/******** opacity *******/
|
|
9
|
+
/******** fontSize *******/
|
|
10
|
+
/******** fontWeight ********/
|
|
11
|
+
/******** Primary *******/
|
|
12
|
+
/******** success *******/
|
|
13
|
+
/******** warning *******/
|
|
14
|
+
/******** danger *******/
|
|
15
|
+
/******** link *******/
|
|
16
|
+
/******** radius *******/
|
|
17
|
+
/********* icon hover *********/
|
|
18
|
+
.sd-file-previewer {
|
|
19
|
+
position: relative;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
min-height: 240px;
|
|
23
|
+
}
|
|
24
|
+
.sd-file-previewer-fullscreen {
|
|
25
|
+
inset: 0;
|
|
26
|
+
min-height: 0;
|
|
27
|
+
}
|
|
28
|
+
.sd-file-previewer-inline {
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
color: var(--sd-color-text-1);
|
|
31
|
+
background: var(--sd-color-fill-1);
|
|
32
|
+
border: 1px solid var(--sd-color-border-2);
|
|
33
|
+
border-radius: var(--sd-border-radius-medium);
|
|
34
|
+
}
|
|
35
|
+
.sd-file-previewer-mask {
|
|
36
|
+
position: absolute;
|
|
37
|
+
inset: 0;
|
|
38
|
+
background-color: var(--sd-color-mask-bg);
|
|
39
|
+
}
|
|
40
|
+
.sd-file-previewer-content {
|
|
41
|
+
z-index: 1;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
min-width: 0;
|
|
45
|
+
min-height: 0;
|
|
46
|
+
}
|
|
47
|
+
.sd-file-previewer-content-fullscreen {
|
|
48
|
+
position: absolute;
|
|
49
|
+
inset: 40px;
|
|
50
|
+
}
|
|
51
|
+
.sd-file-previewer-content-inline {
|
|
52
|
+
position: relative;
|
|
53
|
+
width: 100%;
|
|
54
|
+
height: 100%;
|
|
55
|
+
min-height: 240px;
|
|
56
|
+
}
|
|
57
|
+
.sd-file-previewer-fullscreen .sd-file-previewer-content-audio {
|
|
58
|
+
inset: 50% auto auto 50%;
|
|
59
|
+
width: min(560px, 100% - 40px * 2);
|
|
60
|
+
max-height: 78vh;
|
|
61
|
+
background: var(--sd-color-bg-2);
|
|
62
|
+
border-radius: var(--sd-border-radius-medium);
|
|
63
|
+
transform: translate(-50%, -50%);
|
|
64
|
+
}
|
|
65
|
+
.sd-file-previewer-header {
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
padding: 12px 20px;
|
|
68
|
+
color: var(--sd-color-text-1);
|
|
69
|
+
font-size: 16px;
|
|
70
|
+
}
|
|
71
|
+
.sd-file-previewer-title {
|
|
72
|
+
display: block;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
text-overflow: ellipsis;
|
|
76
|
+
}
|
|
77
|
+
.sd-file-previewer-body {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex: 1;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
min-width: 0;
|
|
83
|
+
min-height: 0;
|
|
84
|
+
}
|
|
85
|
+
.sd-file-previewer-image, .sd-file-previewer-video-player, .sd-file-previewer-video, .sd-file-previewer-pdf {
|
|
86
|
+
display: block;
|
|
87
|
+
width: 100%;
|
|
88
|
+
height: 100%;
|
|
89
|
+
}
|
|
90
|
+
.sd-file-previewer-image {
|
|
91
|
+
object-fit: contain;
|
|
92
|
+
}
|
|
93
|
+
.sd-file-previewer-video-player {
|
|
94
|
+
max-width: 1180px;
|
|
95
|
+
max-height: 78vh;
|
|
96
|
+
}
|
|
97
|
+
.sd-file-previewer-inline .sd-file-previewer-video-player {
|
|
98
|
+
max-width: 100%;
|
|
99
|
+
max-height: none;
|
|
100
|
+
}
|
|
101
|
+
.sd-file-previewer-video {
|
|
102
|
+
background: #000;
|
|
103
|
+
}
|
|
104
|
+
.sd-file-previewer-audio-panel {
|
|
105
|
+
box-sizing: border-box;
|
|
106
|
+
width: 100%;
|
|
107
|
+
padding: 20px;
|
|
108
|
+
}
|
|
109
|
+
.sd-file-previewer-audio {
|
|
110
|
+
display: block;
|
|
111
|
+
width: 100%;
|
|
112
|
+
}
|
|
113
|
+
.sd-file-previewer-pdf {
|
|
114
|
+
background: var(--sd-color-bg-2);
|
|
115
|
+
border: 0;
|
|
116
|
+
border-radius: var(--sd-border-radius-medium);
|
|
117
|
+
}
|
|
118
|
+
.sd-file-previewer-inline .sd-file-previewer-pdf {
|
|
119
|
+
border-radius: 0;
|
|
120
|
+
}
|
|
121
|
+
.sd-file-previewer-close-btn {
|
|
122
|
+
position: absolute;
|
|
123
|
+
top: 36px;
|
|
124
|
+
right: 36px;
|
|
125
|
+
z-index: 2;
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
width: 32px;
|
|
130
|
+
height: 32px;
|
|
131
|
+
color: var(--sd-color-white);
|
|
132
|
+
font-size: 14px;
|
|
133
|
+
background: rgba(0, 0, 0, 0.5);
|
|
134
|
+
border: 0;
|
|
135
|
+
border-radius: 50%;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
}
|
|
138
|
+
.sd-file-previewer-loading {
|
|
139
|
+
z-index: 2;
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
justify-content: center;
|
|
143
|
+
box-sizing: border-box;
|
|
144
|
+
width: 48px;
|
|
145
|
+
height: 48px;
|
|
146
|
+
color: rgb(var(--sd-primary-6));
|
|
147
|
+
background-color: #232324;
|
|
148
|
+
border-radius: var(--sd-border-radius-medium);
|
|
149
|
+
position: absolute;
|
|
150
|
+
top: 50%;
|
|
151
|
+
left: 50%;
|
|
152
|
+
transform: translate(-50%, -50%);
|
|
153
|
+
}
|
|
154
|
+
.sd-file-previewer-error {
|
|
155
|
+
z-index: 2;
|
|
156
|
+
color: var(--sd-color-white);
|
|
157
|
+
position: absolute;
|
|
158
|
+
top: 50%;
|
|
159
|
+
left: 50%;
|
|
160
|
+
transform: translate(-50%, -50%);
|
|
161
|
+
}
|
|
162
|
+
.sd-file-previewer-inline .sd-file-previewer-error {
|
|
163
|
+
color: var(--sd-color-danger-6);
|
|
164
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
@use '@style/theme/index.scss' as theme;
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
@use './token.scss' as *;
|
|
4
|
+
|
|
5
|
+
$file-previewer-prefix-cls: string.unquote('#{theme.$prefix}-file-previewer');
|
|
6
|
+
|
|
7
|
+
@mixin center() {
|
|
8
|
+
position: absolute;
|
|
9
|
+
top: 50%;
|
|
10
|
+
left: 50%;
|
|
11
|
+
transform: translate(-50%, -50%);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.#{$file-previewer-prefix-cls} {
|
|
15
|
+
position: relative;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
min-height: $file-previewer-size-inline-min-height;
|
|
19
|
+
|
|
20
|
+
&-fullscreen {
|
|
21
|
+
inset: 0;
|
|
22
|
+
min-height: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&-inline {
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
color: $file-previewer-color-content-text;
|
|
28
|
+
background: $file-previewer-color-inline-bg;
|
|
29
|
+
border: 1px solid $file-previewer-color-inline-border;
|
|
30
|
+
border-radius: $file-previewer-radius-panel;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&-mask {
|
|
34
|
+
position: absolute;
|
|
35
|
+
inset: 0;
|
|
36
|
+
background-color: $file-previewer-color-mask-bg;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&-content {
|
|
40
|
+
z-index: 1;
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
min-height: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&-content-fullscreen {
|
|
48
|
+
position: absolute;
|
|
49
|
+
inset: $file-previewer-spacing-viewport-padding;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&-content-inline {
|
|
53
|
+
position: relative;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
min-height: $file-previewer-size-inline-min-height;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&-fullscreen &-content-audio {
|
|
60
|
+
inset: 50% auto auto 50%;
|
|
61
|
+
width: min(
|
|
62
|
+
$file-previewer-size-audio-width,
|
|
63
|
+
calc(100% - #{$file-previewer-spacing-viewport-padding} * 2)
|
|
64
|
+
);
|
|
65
|
+
max-height: $file-previewer-size-media-height;
|
|
66
|
+
background: $file-previewer-color-content-bg;
|
|
67
|
+
border-radius: $file-previewer-radius-panel;
|
|
68
|
+
transform: translate(-50%, -50%);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&-header {
|
|
72
|
+
box-sizing: border-box;
|
|
73
|
+
padding: $file-previewer-spacing-header-padding-vertical
|
|
74
|
+
$file-previewer-spacing-header-padding-horizontal;
|
|
75
|
+
color: $file-previewer-color-content-text;
|
|
76
|
+
font-size: $file-previewer-font-size-title;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&-title {
|
|
80
|
+
display: block;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
white-space: nowrap;
|
|
83
|
+
text-overflow: ellipsis;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&-body {
|
|
87
|
+
display: flex;
|
|
88
|
+
flex: 1;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
min-width: 0;
|
|
92
|
+
min-height: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&-image,
|
|
96
|
+
&-video-player,
|
|
97
|
+
&-video,
|
|
98
|
+
&-pdf {
|
|
99
|
+
display: block;
|
|
100
|
+
width: 100%;
|
|
101
|
+
height: 100%;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&-image {
|
|
105
|
+
object-fit: contain;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&-video-player {
|
|
109
|
+
max-width: $file-previewer-size-media-width;
|
|
110
|
+
max-height: $file-previewer-size-media-height;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&-inline &-video-player {
|
|
114
|
+
max-width: 100%;
|
|
115
|
+
max-height: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&-video {
|
|
119
|
+
background: #000;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&-audio-panel {
|
|
123
|
+
box-sizing: border-box;
|
|
124
|
+
width: 100%;
|
|
125
|
+
padding: $file-previewer-spacing-panel-padding;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&-audio {
|
|
129
|
+
display: block;
|
|
130
|
+
width: 100%;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&-pdf {
|
|
134
|
+
background: $file-previewer-color-content-bg;
|
|
135
|
+
border: 0;
|
|
136
|
+
border-radius: $file-previewer-radius-panel;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&-inline &-pdf {
|
|
140
|
+
border-radius: 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&-close-btn {
|
|
144
|
+
position: absolute;
|
|
145
|
+
top: $file-previewer-position-close-top;
|
|
146
|
+
right: $file-previewer-position-close-right;
|
|
147
|
+
z-index: 2;
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
justify-content: center;
|
|
151
|
+
width: $file-previewer-size-close;
|
|
152
|
+
height: $file-previewer-size-close;
|
|
153
|
+
color: $file-previewer-color-close-text;
|
|
154
|
+
font-size: $file-previewer-size-close-icon;
|
|
155
|
+
background: $file-previewer-color-close-bg;
|
|
156
|
+
border: 0;
|
|
157
|
+
border-radius: 50%;
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&-loading {
|
|
162
|
+
z-index: 2;
|
|
163
|
+
display: flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
box-sizing: border-box;
|
|
167
|
+
width: $file-previewer-size-loading;
|
|
168
|
+
height: $file-previewer-size-loading;
|
|
169
|
+
color: $file-previewer-color-loading-text;
|
|
170
|
+
background-color: $file-previewer-color-loading-bg;
|
|
171
|
+
border-radius: $file-previewer-radius-panel;
|
|
172
|
+
|
|
173
|
+
@include center();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&-error {
|
|
177
|
+
z-index: 2;
|
|
178
|
+
color: $file-previewer-color-error-text;
|
|
179
|
+
|
|
180
|
+
@include center();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&-inline &-error {
|
|
184
|
+
color: $file-previewer-color-inline-error-text;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@use '@style/theme/index.scss' as *;
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
|
|
4
|
+
$file-previewer-color-mask-bg: var(string.unquote('#{$sd-cssvars-prefix}-color-mask-bg'));
|
|
5
|
+
$file-previewer-color-content-bg: var(string.unquote('#{$sd-cssvars-prefix}-color-bg-2'));
|
|
6
|
+
$file-previewer-color-content-text: var(string.unquote('#{$sd-cssvars-prefix}-color-text-1'));
|
|
7
|
+
$file-previewer-color-inline-border: var(string.unquote('#{$sd-cssvars-prefix}-color-border-2'));
|
|
8
|
+
$file-previewer-color-inline-bg: var(string.unquote('#{$sd-cssvars-prefix}-color-fill-1'));
|
|
9
|
+
$file-previewer-color-close-bg: rgb(0 0 0 / 50%);
|
|
10
|
+
$file-previewer-color-close-text: var(string.unquote('#{$sd-cssvars-prefix}-color-white'));
|
|
11
|
+
$file-previewer-color-loading-bg: #232324;
|
|
12
|
+
$file-previewer-color-loading-text: $color-primary-6;
|
|
13
|
+
$file-previewer-color-error-text: var(string.unquote('#{$sd-cssvars-prefix}-color-white'));
|
|
14
|
+
$file-previewer-color-inline-error-text: var(
|
|
15
|
+
string.unquote('#{$sd-cssvars-prefix}-color-danger-6')
|
|
16
|
+
);
|
|
17
|
+
$file-previewer-spacing-viewport-padding: $spacing-12;
|
|
18
|
+
$file-previewer-spacing-panel-padding: $spacing-8;
|
|
19
|
+
$file-previewer-spacing-header-padding-vertical: $spacing-6;
|
|
20
|
+
$file-previewer-spacing-header-padding-horizontal: $spacing-8;
|
|
21
|
+
$file-previewer-radius-panel: $radius-medium;
|
|
22
|
+
$file-previewer-size-close: 32px;
|
|
23
|
+
$file-previewer-size-close-icon: 14px;
|
|
24
|
+
$file-previewer-size-loading: 48px;
|
|
25
|
+
$file-previewer-size-inline-min-height: 240px;
|
|
26
|
+
$file-previewer-position-close-top: 36px;
|
|
27
|
+
$file-previewer-position-close-right: 36px;
|
|
28
|
+
$file-previewer-font-size-title: $font-size-title-1;
|
|
29
|
+
$file-previewer-size-audio-width: 560px;
|
|
30
|
+
$file-previewer-size-media-width: 1180px;
|
|
31
|
+
$file-previewer-size-media-height: 78vh;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type FilePreviewerType = 'image' | 'video' | 'audio' | 'pdf';
|
|
2
|
+
export type FilePreviewerStatus = 'beforeLoad' | 'loading' | 'loaded' | 'error';
|
|
3
|
+
export interface FilePreviewerContentSlotProps {
|
|
4
|
+
src: string;
|
|
5
|
+
type: FilePreviewerType;
|
|
6
|
+
title?: string;
|
|
7
|
+
visible: boolean;
|
|
8
|
+
fullscreen: boolean;
|
|
9
|
+
status: FilePreviewerStatus;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
loaded: boolean;
|
|
12
|
+
error: boolean;
|
|
13
|
+
close: () => void;
|
|
14
|
+
onLoad: () => void;
|
|
15
|
+
onError: () => void;
|
|
16
|
+
}
|
|
17
|
+
export interface FilePreviewerProps {
|
|
18
|
+
src?: string;
|
|
19
|
+
type?: FilePreviewerType;
|
|
20
|
+
visible?: boolean;
|
|
21
|
+
defaultVisible?: boolean;
|
|
22
|
+
fullscreen?: boolean;
|
|
23
|
+
title?: string;
|
|
24
|
+
maskClosable?: boolean;
|
|
25
|
+
closable?: boolean;
|
|
26
|
+
escToClose?: boolean;
|
|
27
|
+
popupContainer?: HTMLElement | string;
|
|
28
|
+
renderToBody?: boolean;
|
|
29
|
+
}
|
|
@@ -8,9 +8,9 @@ import useMergeState from "../_hooks/use-merge-state.js";
|
|
|
8
8
|
import { KEYBOARD_KEY } from "../_utils/keyboard.js";
|
|
9
9
|
import usePopupManager from "../_hooks/use-popup-manager.js";
|
|
10
10
|
import { useI18n } from "../locale/index.js";
|
|
11
|
-
import useImageLoadStatus from "./hooks/use-image-load-status.js";
|
|
12
11
|
import usePopupContainer from "../_hooks/use-popup-container.js";
|
|
13
12
|
import usePopupOverflowHidden from "../_hooks/use-popup-overflow-hidden.js";
|
|
13
|
+
import useImageLoadStatus from "./hooks/use-image-load-status.js";
|
|
14
14
|
import IconFullscreen from "../icon/icon-fullscreen/index.js";
|
|
15
15
|
import IconOriginalSize from "../icon/icon-original-size/index.js";
|
|
16
16
|
import IconRotateLeft from "../icon/icon-rotate-left/index.js";
|