@sdata/web-vue 3.1.0 → 3.2.1
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/hooks/use-image-drag.js +1 -1
- 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/es/trigger/interface.d.ts +7 -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
package/es/components.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ declare module 'vue' {
|
|
|
53
53
|
SdEllipsis: SDVue['Ellipsis'];
|
|
54
54
|
SdPerformantEllipsis: SDVue['PerformantEllipsis'];
|
|
55
55
|
SdEmpty: SDVue['Empty'];
|
|
56
|
+
SdFilePreviewer: SDVue['FilePreviewer'];
|
|
56
57
|
SdForm: SDVue['Form'];
|
|
57
58
|
SdFormItem: SDVue['FormItem'];
|
|
58
59
|
SdJsonForm: SDVue['JsonForm'];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import file_previewer_vue_vue_type_script_setup_true_lang_default from "./file-previewer.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
//#region components/file-previewer/file-previewer.vue
|
|
3
|
+
var file_previewer_default = file_previewer_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { file_previewer_default as default };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import type { FilePreviewerContentSlotProps, FilePreviewerType } from './types';
|
|
3
|
+
type __VLS_Slots = {
|
|
4
|
+
title?: () => unknown;
|
|
5
|
+
content?: (_props: FilePreviewerContentSlotProps) => unknown;
|
|
6
|
+
};
|
|
7
|
+
declare function close(): void;
|
|
8
|
+
declare function onPreviewLoad(): void;
|
|
9
|
+
declare function onLoadError(): void;
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
11
|
+
src: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
};
|
|
14
|
+
type: {
|
|
15
|
+
type: PropType<FilePreviewerType>;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
visible: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: undefined;
|
|
21
|
+
};
|
|
22
|
+
defaultVisible: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
26
|
+
fullscreen: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
title: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
};
|
|
33
|
+
maskClosable: {
|
|
34
|
+
type: BooleanConstructor;
|
|
35
|
+
default: boolean;
|
|
36
|
+
};
|
|
37
|
+
closable: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
default: boolean;
|
|
40
|
+
};
|
|
41
|
+
escToClose: {
|
|
42
|
+
type: BooleanConstructor;
|
|
43
|
+
default: boolean;
|
|
44
|
+
};
|
|
45
|
+
popupContainer: {
|
|
46
|
+
type: PropType<HTMLElement | string>;
|
|
47
|
+
};
|
|
48
|
+
renderToBody: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
}>, {
|
|
53
|
+
close: typeof close;
|
|
54
|
+
onLoad: typeof onPreviewLoad;
|
|
55
|
+
onError: typeof onLoadError;
|
|
56
|
+
onImageLoad: typeof onPreviewLoad;
|
|
57
|
+
onPdfLoad: typeof onPreviewLoad;
|
|
58
|
+
onLoadError: typeof onLoadError;
|
|
59
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
60
|
+
close: () => any;
|
|
61
|
+
"update:visible": (_visible: boolean) => any;
|
|
62
|
+
"visible-change": (_visible: boolean) => any;
|
|
63
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
64
|
+
src: {
|
|
65
|
+
type: StringConstructor;
|
|
66
|
+
};
|
|
67
|
+
type: {
|
|
68
|
+
type: PropType<FilePreviewerType>;
|
|
69
|
+
default: string;
|
|
70
|
+
};
|
|
71
|
+
visible: {
|
|
72
|
+
type: BooleanConstructor;
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
defaultVisible: {
|
|
76
|
+
type: BooleanConstructor;
|
|
77
|
+
default: boolean;
|
|
78
|
+
};
|
|
79
|
+
fullscreen: {
|
|
80
|
+
type: BooleanConstructor;
|
|
81
|
+
default: boolean;
|
|
82
|
+
};
|
|
83
|
+
title: {
|
|
84
|
+
type: StringConstructor;
|
|
85
|
+
};
|
|
86
|
+
maskClosable: {
|
|
87
|
+
type: BooleanConstructor;
|
|
88
|
+
default: boolean;
|
|
89
|
+
};
|
|
90
|
+
closable: {
|
|
91
|
+
type: BooleanConstructor;
|
|
92
|
+
default: boolean;
|
|
93
|
+
};
|
|
94
|
+
escToClose: {
|
|
95
|
+
type: BooleanConstructor;
|
|
96
|
+
default: boolean;
|
|
97
|
+
};
|
|
98
|
+
popupContainer: {
|
|
99
|
+
type: PropType<HTMLElement | string>;
|
|
100
|
+
};
|
|
101
|
+
renderToBody: {
|
|
102
|
+
type: BooleanConstructor;
|
|
103
|
+
default: boolean;
|
|
104
|
+
};
|
|
105
|
+
}>> & Readonly<{
|
|
106
|
+
onClose?: (() => any) | undefined;
|
|
107
|
+
"onUpdate:visible"?: ((_visible: boolean) => any) | undefined;
|
|
108
|
+
"onVisible-change"?: ((_visible: boolean) => any) | undefined;
|
|
109
|
+
}>, {
|
|
110
|
+
type: FilePreviewerType;
|
|
111
|
+
visible: boolean;
|
|
112
|
+
renderToBody: boolean;
|
|
113
|
+
defaultVisible: boolean;
|
|
114
|
+
closable: boolean;
|
|
115
|
+
maskClosable: boolean;
|
|
116
|
+
escToClose: boolean;
|
|
117
|
+
fullscreen: boolean;
|
|
118
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
119
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
120
|
+
declare const _default: typeof __VLS_export;
|
|
121
|
+
export default _default;
|
|
122
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
123
|
+
new (): {
|
|
124
|
+
$slots: S;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import { getPrefixCls } from "../_utils/global-config.js";
|
|
3
|
+
import { isServerRendering } from "../_utils/dom.js";
|
|
4
|
+
import IconClose from "../icon/icon-close/index.js";
|
|
5
|
+
import { _asyncToGenerator } from "../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/asyncToGenerator.js";
|
|
6
|
+
import IconLoading from "../icon/icon-loading/index.js";
|
|
7
|
+
import { KEYBOARD_KEY } from "../_utils/keyboard.js";
|
|
8
|
+
import usePopupManager from "../_hooks/use-popup-manager.js";
|
|
9
|
+
import usePopupContainer from "../_hooks/use-popup-container.js";
|
|
10
|
+
import usePopupOverflowHidden from "../_hooks/use-popup-overflow-hidden.js";
|
|
11
|
+
import { Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, openBlock, reactive, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRefs, unref, useSlots, watch, withCtx } from "vue";
|
|
12
|
+
//#region components/file-previewer/file-previewer.vue?vue&type=script&setup=true&lang.ts
|
|
13
|
+
var _hoisted_1 = ["tabindex"];
|
|
14
|
+
var _hoisted_2 = [
|
|
15
|
+
"role",
|
|
16
|
+
"aria-modal",
|
|
17
|
+
"aria-label"
|
|
18
|
+
];
|
|
19
|
+
var _hoisted_3 = ["src", "alt"];
|
|
20
|
+
var _hoisted_4 = ["src"];
|
|
21
|
+
var _hoisted_5 = ["src"];
|
|
22
|
+
var _hoisted_6 = ["src"];
|
|
23
|
+
var file_previewer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent(_objectSpread2(_objectSpread2({}, { name: "FilePreviewer" }), {}, {
|
|
24
|
+
__name: "file-previewer",
|
|
25
|
+
props: {
|
|
26
|
+
/**
|
|
27
|
+
* @zh 文件地址
|
|
28
|
+
* @en File source url
|
|
29
|
+
*/
|
|
30
|
+
src: { type: String },
|
|
31
|
+
/**
|
|
32
|
+
* @zh 预览类型,由参数决定使用哪个预览器
|
|
33
|
+
* @en Preview type, decides which previewer to use
|
|
34
|
+
*/
|
|
35
|
+
type: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "image"
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* @zh 是否可见
|
|
41
|
+
* @en Whether the previewer is visible
|
|
42
|
+
* @vModel
|
|
43
|
+
*/
|
|
44
|
+
visible: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: void 0
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* @zh 默认是否可见,非受控
|
|
50
|
+
* @en Default visibility
|
|
51
|
+
*/
|
|
52
|
+
defaultVisible: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* @zh 是否使用全屏弹层展示
|
|
58
|
+
* @en Whether to show the previewer in fullscreen overlay
|
|
59
|
+
*/
|
|
60
|
+
fullscreen: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: true
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* @zh 标题
|
|
66
|
+
* @en Title
|
|
67
|
+
*/
|
|
68
|
+
title: { type: String },
|
|
69
|
+
/**
|
|
70
|
+
* @zh 点击遮罩是否关闭
|
|
71
|
+
* @en Whether to close when mask is clicked
|
|
72
|
+
*/
|
|
73
|
+
maskClosable: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: true
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* @zh 是否显示关闭按钮
|
|
79
|
+
* @en Whether to show close button
|
|
80
|
+
*/
|
|
81
|
+
closable: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: true
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* @zh 是否支持 ESC 键关闭
|
|
87
|
+
* @en Whether to support closing with ESC
|
|
88
|
+
*/
|
|
89
|
+
escToClose: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: true
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* @zh 设置弹出框挂载点,同 teleport 的 to
|
|
95
|
+
* @en Set the mount point, same as teleport to
|
|
96
|
+
*/
|
|
97
|
+
popupContainer: { type: [Object, String] },
|
|
98
|
+
/**
|
|
99
|
+
* @zh 是否渲染到 body
|
|
100
|
+
* @en Whether to render to body
|
|
101
|
+
*/
|
|
102
|
+
renderToBody: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: true
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
emits: [
|
|
108
|
+
"close",
|
|
109
|
+
"visible-change",
|
|
110
|
+
"update:visible"
|
|
111
|
+
],
|
|
112
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
113
|
+
const slots = useSlots();
|
|
114
|
+
const props = __props;
|
|
115
|
+
const emit = __emit;
|
|
116
|
+
const { src, type, visible, defaultVisible, fullscreen, popupContainer, renderToBody, maskClosable, closable, escToClose, title } = toRefs(props);
|
|
117
|
+
const prefixCls = getPrefixCls("file-previewer");
|
|
118
|
+
const wrapperRef = shallowRef();
|
|
119
|
+
const status = shallowRef("beforeLoad");
|
|
120
|
+
const requestId = shallowRef(0);
|
|
121
|
+
let videoJsHtmlPromise;
|
|
122
|
+
const localVisible = shallowRef(defaultVisible.value);
|
|
123
|
+
const mergedVisible = computed(() => {
|
|
124
|
+
var _visible$value;
|
|
125
|
+
return (_visible$value = visible === null || visible === void 0 ? void 0 : visible.value) !== null && _visible$value !== void 0 ? _visible$value : localVisible.value;
|
|
126
|
+
});
|
|
127
|
+
const shouldRender = computed(() => !fullscreen.value || mergedVisible.value);
|
|
128
|
+
const container = usePopupContainer(document.body, reactive({ popupContainer }));
|
|
129
|
+
const popupVisible = computed(() => fullscreen.value && mergedVisible.value);
|
|
130
|
+
const { zIndex } = usePopupManager("dialog", { visible: popupVisible });
|
|
131
|
+
const isFixed = computed(() => container.value === document.body);
|
|
132
|
+
const currentSrc = computed(() => {
|
|
133
|
+
var _src$value;
|
|
134
|
+
return (_src$value = src === null || src === void 0 ? void 0 : src.value) !== null && _src$value !== void 0 ? _src$value : "";
|
|
135
|
+
});
|
|
136
|
+
const isLoading = computed(() => status.value === "loading");
|
|
137
|
+
const isLoaded = computed(() => status.value === "loaded");
|
|
138
|
+
const isError = computed(() => status.value === "error");
|
|
139
|
+
const classNames = computed(() => [
|
|
140
|
+
prefixCls,
|
|
141
|
+
`${prefixCls}-${type.value}`,
|
|
142
|
+
fullscreen.value ? `${prefixCls}-fullscreen` : `${prefixCls}-inline`
|
|
143
|
+
]);
|
|
144
|
+
const contentClassNames = computed(() => [
|
|
145
|
+
`${prefixCls}-content`,
|
|
146
|
+
`${prefixCls}-content-${type.value}`,
|
|
147
|
+
fullscreen.value ? `${prefixCls}-content-fullscreen` : `${prefixCls}-content-inline`
|
|
148
|
+
]);
|
|
149
|
+
const wrapperStyles = computed(() => {
|
|
150
|
+
if (!fullscreen.value) return void 0;
|
|
151
|
+
return isFixed.value ? {
|
|
152
|
+
zIndex: zIndex.value,
|
|
153
|
+
position: "fixed"
|
|
154
|
+
} : {
|
|
155
|
+
zIndex: "inherit",
|
|
156
|
+
position: "absolute"
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
const contentSlotProps = computed(() => ({
|
|
160
|
+
src: currentSrc.value,
|
|
161
|
+
type: type.value,
|
|
162
|
+
title: title === null || title === void 0 ? void 0 : title.value,
|
|
163
|
+
visible: shouldRender.value,
|
|
164
|
+
fullscreen: fullscreen.value,
|
|
165
|
+
status: status.value,
|
|
166
|
+
loading: isLoading.value,
|
|
167
|
+
loaded: isLoaded.value,
|
|
168
|
+
error: isError.value,
|
|
169
|
+
close,
|
|
170
|
+
onLoad: onPreviewLoad,
|
|
171
|
+
onError: onLoadError
|
|
172
|
+
}));
|
|
173
|
+
usePopupOverflowHidden(reactive({
|
|
174
|
+
container,
|
|
175
|
+
hidden: popupVisible
|
|
176
|
+
}));
|
|
177
|
+
function resetPreviewState() {
|
|
178
|
+
status.value = "beforeLoad";
|
|
179
|
+
}
|
|
180
|
+
function setVisible(nextVisible) {
|
|
181
|
+
if (nextVisible !== mergedVisible.value) {
|
|
182
|
+
emit("visible-change", nextVisible);
|
|
183
|
+
emit("update:visible", nextVisible);
|
|
184
|
+
localVisible.value = nextVisible;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function close() {
|
|
188
|
+
if (fullscreen.value && !mergedVisible.value) return;
|
|
189
|
+
emit("close");
|
|
190
|
+
setVisible(false);
|
|
191
|
+
}
|
|
192
|
+
function onMaskClick() {
|
|
193
|
+
if (maskClosable.value) close();
|
|
194
|
+
}
|
|
195
|
+
function onKeyDown(event) {
|
|
196
|
+
if (fullscreen.value && escToClose.value && event.key === KEYBOARD_KEY.ESC) {
|
|
197
|
+
event.stopPropagation();
|
|
198
|
+
close();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function onPreviewLoad() {
|
|
202
|
+
status.value = "loaded";
|
|
203
|
+
}
|
|
204
|
+
function onLoadError() {
|
|
205
|
+
status.value = "error";
|
|
206
|
+
}
|
|
207
|
+
function ensureVideoJsHtml() {
|
|
208
|
+
return _ensureVideoJsHtml.apply(this, arguments);
|
|
209
|
+
}
|
|
210
|
+
function _ensureVideoJsHtml() {
|
|
211
|
+
_ensureVideoJsHtml = _asyncToGenerator(function* () {
|
|
212
|
+
if (typeof Element === "undefined" && typeof window !== "undefined" && window.Element) Object.defineProperty(globalThis, "Element", {
|
|
213
|
+
configurable: true,
|
|
214
|
+
value: window.Element
|
|
215
|
+
});
|
|
216
|
+
if (!videoJsHtmlPromise) videoJsHtmlPromise = import("@videojs/html");
|
|
217
|
+
yield videoJsHtmlPromise;
|
|
218
|
+
});
|
|
219
|
+
return _ensureVideoJsHtml.apply(this, arguments);
|
|
220
|
+
}
|
|
221
|
+
function prepareVideo(_x) {
|
|
222
|
+
return _prepareVideo.apply(this, arguments);
|
|
223
|
+
}
|
|
224
|
+
function _prepareVideo() {
|
|
225
|
+
_prepareVideo = _asyncToGenerator(function* (currentRequestId) {
|
|
226
|
+
status.value = "loading";
|
|
227
|
+
try {
|
|
228
|
+
if (!isServerRendering) yield ensureVideoJsHtml();
|
|
229
|
+
if (currentRequestId !== requestId.value) return;
|
|
230
|
+
status.value = "loaded";
|
|
231
|
+
} catch (_unused) {
|
|
232
|
+
if (currentRequestId !== requestId.value) return;
|
|
233
|
+
status.value = "error";
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
return _prepareVideo.apply(this, arguments);
|
|
237
|
+
}
|
|
238
|
+
watch([
|
|
239
|
+
src,
|
|
240
|
+
type,
|
|
241
|
+
shouldRender
|
|
242
|
+
], () => {
|
|
243
|
+
requestId.value += 1;
|
|
244
|
+
if (!shouldRender.value) return;
|
|
245
|
+
resetPreviewState();
|
|
246
|
+
if (fullscreen.value) nextTick(() => {
|
|
247
|
+
var _wrapperRef$value;
|
|
248
|
+
return (_wrapperRef$value = wrapperRef.value) === null || _wrapperRef$value === void 0 ? void 0 : _wrapperRef$value.focus();
|
|
249
|
+
});
|
|
250
|
+
if (slots.content) {
|
|
251
|
+
status.value = "loaded";
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const currentRequestId = requestId.value;
|
|
255
|
+
if (type.value === "video") {
|
|
256
|
+
prepareVideo(currentRequestId);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
if (type.value === "audio" || type.value === "pdf") {
|
|
260
|
+
status.value = "loaded";
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
status.value = "loading";
|
|
264
|
+
}, { immediate: true });
|
|
265
|
+
__expose({
|
|
266
|
+
close,
|
|
267
|
+
onLoad: onPreviewLoad,
|
|
268
|
+
onError: onLoadError,
|
|
269
|
+
onImageLoad: onPreviewLoad,
|
|
270
|
+
onPdfLoad: onPreviewLoad,
|
|
271
|
+
onLoadError
|
|
272
|
+
});
|
|
273
|
+
return (_ctx, _cache) => {
|
|
274
|
+
return openBlock(), createBlock(Teleport, {
|
|
275
|
+
to: unref(container),
|
|
276
|
+
disabled: !unref(fullscreen) || !unref(renderToBody)
|
|
277
|
+
}, [shouldRender.value ? (openBlock(), createElementBlock("div", {
|
|
278
|
+
key: 0,
|
|
279
|
+
ref_key: "wrapperRef",
|
|
280
|
+
ref: wrapperRef,
|
|
281
|
+
class: normalizeClass(classNames.value),
|
|
282
|
+
style: normalizeStyle(wrapperStyles.value),
|
|
283
|
+
tabindex: unref(fullscreen) ? -1 : void 0,
|
|
284
|
+
onKeydown: onKeyDown
|
|
285
|
+
}, [
|
|
286
|
+
unref(fullscreen) ? (openBlock(), createElementBlock("div", {
|
|
287
|
+
key: 0,
|
|
288
|
+
class: normalizeClass(`${unref(prefixCls)}-mask`),
|
|
289
|
+
onClick: onMaskClick
|
|
290
|
+
}, null, 2)) : createCommentVNode("", true),
|
|
291
|
+
createElementVNode("section", {
|
|
292
|
+
class: normalizeClass(contentClassNames.value),
|
|
293
|
+
role: unref(fullscreen) ? "dialog" : "region",
|
|
294
|
+
"aria-modal": unref(fullscreen) ? "true" : void 0,
|
|
295
|
+
"aria-label": unref(title) || "File preview"
|
|
296
|
+
}, [unref(title) || _ctx.$slots.title ? (openBlock(), createElementBlock("header", {
|
|
297
|
+
key: 0,
|
|
298
|
+
class: normalizeClass(`${unref(prefixCls)}-header`)
|
|
299
|
+
}, [renderSlot(_ctx.$slots, "title", {}, () => [createElementVNode("span", { class: normalizeClass(`${unref(prefixCls)}-title`) }, toDisplayString(unref(title)), 3)])], 2)) : createCommentVNode("", true), createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-body`) }, [renderSlot(_ctx.$slots, "content", normalizeProps(guardReactiveProps(contentSlotProps.value)), () => [unref(type) === "image" ? (openBlock(), createElementBlock("img", {
|
|
300
|
+
key: currentSrc.value,
|
|
301
|
+
class: normalizeClass(`${unref(prefixCls)}-image`),
|
|
302
|
+
src: currentSrc.value,
|
|
303
|
+
alt: unref(title) || "",
|
|
304
|
+
onLoad: onPreviewLoad,
|
|
305
|
+
onError: onLoadError
|
|
306
|
+
}, null, 42, _hoisted_3)) : unref(type) === "video" ? (openBlock(), createBlock(resolveDynamicComponent("video-player"), {
|
|
307
|
+
key: 1,
|
|
308
|
+
class: normalizeClass(`${unref(prefixCls)}-video-player`)
|
|
309
|
+
}, {
|
|
310
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent("video-skin"), null, {
|
|
311
|
+
default: withCtx(() => [(openBlock(), createElementBlock("video", {
|
|
312
|
+
key: currentSrc.value,
|
|
313
|
+
class: normalizeClass(`${unref(prefixCls)}-video`),
|
|
314
|
+
src: currentSrc.value,
|
|
315
|
+
controls: "",
|
|
316
|
+
playsinline: ""
|
|
317
|
+
}, null, 10, _hoisted_4))]),
|
|
318
|
+
_: 1
|
|
319
|
+
}))]),
|
|
320
|
+
_: 1
|
|
321
|
+
}, 8, ["class"])) : unref(type) === "audio" ? (openBlock(), createElementBlock("div", {
|
|
322
|
+
key: 2,
|
|
323
|
+
class: normalizeClass(`${unref(prefixCls)}-audio-panel`)
|
|
324
|
+
}, [(openBlock(), createElementBlock("audio", {
|
|
325
|
+
key: currentSrc.value,
|
|
326
|
+
class: normalizeClass(`${unref(prefixCls)}-audio`),
|
|
327
|
+
src: currentSrc.value,
|
|
328
|
+
controls: ""
|
|
329
|
+
}, null, 10, _hoisted_5))], 2)) : unref(type) === "pdf" ? (openBlock(), createElementBlock("iframe", {
|
|
330
|
+
key: currentSrc.value,
|
|
331
|
+
class: normalizeClass(`${unref(prefixCls)}-pdf`),
|
|
332
|
+
src: currentSrc.value,
|
|
333
|
+
title: "PDF preview",
|
|
334
|
+
onLoad: onPreviewLoad,
|
|
335
|
+
onError: onLoadError
|
|
336
|
+
}, null, 42, _hoisted_6)) : createCommentVNode("", true)])], 2)], 10, _hoisted_2),
|
|
337
|
+
unref(fullscreen) && unref(closable) ? (openBlock(), createElementBlock("button", {
|
|
338
|
+
key: 1,
|
|
339
|
+
type: "button",
|
|
340
|
+
class: normalizeClass(`${unref(prefixCls)}-close-btn`),
|
|
341
|
+
onClick: close
|
|
342
|
+
}, [createVNode(unref(IconClose))], 2)) : createCommentVNode("", true),
|
|
343
|
+
isLoading.value ? (openBlock(), createElementBlock("div", {
|
|
344
|
+
key: 2,
|
|
345
|
+
class: normalizeClass(`${unref(prefixCls)}-loading`)
|
|
346
|
+
}, [createVNode(unref(IconLoading))], 2)) : createCommentVNode("", true),
|
|
347
|
+
isError.value ? (openBlock(), createElementBlock("div", {
|
|
348
|
+
key: 3,
|
|
349
|
+
class: normalizeClass(`${unref(prefixCls)}-error`)
|
|
350
|
+
}, "文件预览加载失败", 2)) : createCommentVNode("", true)
|
|
351
|
+
], 46, _hoisted_1)) : createCommentVNode("", true)], 8, ["to", "disabled"]);
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}));
|
|
355
|
+
//#endregion
|
|
356
|
+
export { file_previewer_vue_vue_type_script_setup_true_lang_default as default };
|