@done-coding/forge-core 0.0.0-placeholder.0 → 0.100.0-alpha.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/LICENSE +21 -0
- package/README.md +49 -0
- package/es/_virtual/_plugin-vue_export-helper.mjs +10 -0
- package/es/bridge/badge.mjs +37 -0
- package/es/bridge/config-hook.mjs +58 -0
- package/es/bridge/contracts/event.mjs +102 -0
- package/es/bridge/contracts/index.mjs +5 -0
- package/es/bridge/event.mjs +87 -0
- package/es/bridge/index.mjs +331 -0
- package/es/bridge/layout.mjs +100 -0
- package/es/bridge/permission.mjs +91 -0
- package/es/bridge/plugin.mjs +39 -0
- package/es/bridge/route.mjs +78 -0
- package/es/bridge/state.mjs +61 -0
- package/es/bridge/storage.mjs +26 -0
- package/es/bridge/theme/index.mjs +233 -0
- package/es/bridge/theme/persist.mjs +18 -0
- package/es/bridge/theme/system-dark.mjs +18 -0
- package/es/components/basic/AppCollapseToggle.vue.mjs +7 -0
- package/es/components/basic/AppCollapseToggle.vue2.mjs +63 -0
- package/es/components/basic/action-btn/ActionBtn.vue.mjs +200 -0
- package/es/components/basic/action-btn/ActionBtn.vue2.mjs +4 -0
- package/es/components/basic/action-btn/index.mjs +4 -0
- package/es/components/basic/action-btn/use-action-btn-report.mjs +54 -0
- package/es/components/basic/action-btn-group/ActionBtnGroup.vue.mjs +69 -0
- package/es/components/basic/action-btn-group/ActionBtnGroup.vue2.mjs +4 -0
- package/es/components/basic/action-btn-group/index.mjs +4 -0
- package/es/components/basic/action-btn-group/use-action-btn-group-report.mjs +30 -0
- package/es/components/basic/display-contracts/index.mjs +1 -0
- package/es/components/basic/drag-float/DragFloat.vue.mjs +7 -0
- package/es/components/basic/drag-float/DragFloat.vue2.mjs +109 -0
- package/es/components/basic/drag-float/index.mjs +4 -0
- package/es/components/basic/height-provider/HeightProvider.vue.mjs +62 -0
- package/es/components/basic/height-provider/HeightProvider.vue2.mjs +4 -0
- package/es/components/basic/height-provider/index.mjs +4 -0
- package/es/components/basic/index.mjs +4 -0
- package/es/components/basic/shadow-clone/ShadowClone.vue.mjs +32 -0
- package/es/components/basic/shadow-clone/ShadowClone.vue2.mjs +4 -0
- package/es/components/basic/shadow-clone/index.mjs +4 -0
- package/es/components/basic/shadow-clone/use-shadow-target.mjs +76 -0
- package/es/components/basic/slot-layout-flow-aside/SlotLayoutFlowAside.vue.mjs +7 -0
- package/es/components/basic/slot-layout-flow-aside/SlotLayoutFlowAside.vue2.mjs +68 -0
- package/es/components/basic/slot-layout-flow-aside/index.mjs +4 -0
- package/es/components/basic/slot-layout-template/SlotLayoutTemplate.vue.mjs +30 -0
- package/es/components/basic/slot-layout-template/SlotLayoutTemplate.vue2.mjs +4 -0
- package/es/components/basic/slot-layout-template/index.mjs +4 -0
- package/es/components/basic/watch-size/WatchSize.vue.mjs +73 -0
- package/es/components/basic/watch-size/WatchSize.vue2.mjs +4 -0
- package/es/components/basic/watch-size/index.mjs +4 -0
- package/es/components/config/app-theme/AppTheme.vue.mjs +7 -0
- package/es/components/config/app-theme/AppTheme.vue2.mjs +82 -0
- package/es/components/config/app-theme/index.mjs +4 -0
- package/es/components/data/badge-mark/BadgeMark.vue.mjs +7 -0
- package/es/components/data/badge-mark/BadgeMark.vue2.mjs +80 -0
- package/es/components/data/badge-mark/index.mjs +4 -0
- package/es/components/data/badge-mark/use-badge-mask.mjs +82 -0
- package/es/components/data/badge-mark/use-badge.mjs +106 -0
- package/es/components/data/boolean-tag/BooleanTag.vue.mjs +36 -0
- package/es/components/data/boolean-tag/BooleanTag.vue2.mjs +4 -0
- package/es/components/data/boolean-tag/index.mjs +4 -0
- package/es/components/data/image-preview-trigger/ImagePreviewTrigger.vue.mjs +38 -0
- package/es/components/data/image-preview-trigger/ImagePreviewTrigger.vue2.mjs +4 -0
- package/es/components/data/image-preview-trigger/index.mjs +4 -0
- package/es/components/data/modal-image-preview/ModalImagePreview.vue.mjs +52 -0
- package/es/components/data/modal-image-preview/ModalImagePreview.vue2.mjs +4 -0
- package/es/components/data/modal-image-preview/index.mjs +4 -0
- package/es/components/feedback/action-confirm/ActionConfirm.vue.mjs +7 -0
- package/es/components/feedback/action-confirm/ActionConfirm.vue2.mjs +143 -0
- package/es/components/feedback/action-confirm/index.mjs +4 -0
- package/es/components/feedback/modal-confirm/ModalConfirm.vue.mjs +8 -0
- package/es/components/feedback/modal-confirm/ModalConfirm.vue2.mjs +243 -0
- package/es/components/feedback/modal-confirm/index.mjs +4 -0
- package/es/components/feedback/modal-video-preview/ModalVideoPreview.vue.mjs +8 -0
- package/es/components/feedback/modal-video-preview/ModalVideoPreview.vue2.mjs +93 -0
- package/es/components/feedback/modal-video-preview/index.mjs +4 -0
- package/es/components/feedback/preview-keys/index.mjs +7 -0
- package/es/components/feedback/preview-keys/keys.mjs +7 -0
- package/es/components/feedback/shelf-contracts/index.mjs +1 -0
- package/es/components/feedback/video-preview-trigger/VideoPreviewTrigger.vue.mjs +7 -0
- package/es/components/feedback/video-preview-trigger/VideoPreviewTrigger.vue2.mjs +133 -0
- package/es/components/feedback/video-preview-trigger/index.mjs +4 -0
- package/es/components/other/TriggerAutoImport.vue.mjs +12 -0
- package/es/components/other/TriggerAutoImport.vue2.mjs +4 -0
- package/es/components/other/auto-refresh/AutoRefresh.vue.mjs +7 -0
- package/es/components/other/auto-refresh/AutoRefresh.vue2.mjs +96 -0
- package/es/components/other/auto-refresh/index.mjs +4 -0
- package/es/components/other/auto-refresh/use-auto-refresh-report.mjs +31 -0
- package/es/components/other/auto-refresh-contracts/index.mjs +1 -0
- package/es/components/other/auto-refresh-group/AutoRefreshGroup.vue.mjs +7 -0
- package/es/components/other/auto-refresh-group/AutoRefreshGroup.vue2.mjs +69 -0
- package/es/components/other/auto-refresh-group/index.mjs +4 -0
- package/es/components/other/auto-refresh-group/use-auto-refresh-group-report.mjs +12 -0
- package/es/components/other/index.mjs +4 -0
- package/es/config/badge-attr.mjs +6 -0
- package/es/config/index.mjs +19 -0
- package/es/config/list-model.mjs +13 -0
- package/es/config/modal-keys.mjs +6 -0
- package/es/config/route.mjs +6 -0
- package/es/config/slot-region.mjs +45 -0
- package/es/helpers/form.mjs +25 -0
- package/es/helpers/index.mjs +10 -0
- package/es/helpers/list-helper.mjs +77 -0
- package/es/hooks/activated.mjs +64 -0
- package/es/hooks/feel-size.mjs +46 -0
- package/es/hooks/index.mjs +31 -0
- package/es/hooks/menus-dispatch.mjs +85 -0
- package/es/hooks/timeout.mjs +36 -0
- package/es/hooks/use-active-record.mjs +104 -0
- package/es/hooks/use-breakpoint.mjs +48 -0
- package/es/hooks/use-bridge-report.mjs +12 -0
- package/es/hooks/use-channel-viewport-height.mjs +43 -0
- package/es/hooks/use-context-defaults.mjs +44 -0
- package/es/hooks/use-custom-breakpoint.mjs +69 -0
- package/es/hooks/use-is-dev.mjs +16 -0
- package/es/hooks/use-observe-size.mjs +43 -0
- package/es/hooks/use-permission.mjs +12 -0
- package/es/hooks/use-surface.mjs +35 -0
- package/es/hooks/use-theme-apply.mjs +496 -0
- package/es/hooks/use-viewport-apply.mjs +52 -0
- package/es/index.mjs +179 -0
- package/es/inject/index.mjs +19 -0
- package/es/inject/key.mjs +70 -0
- package/es/injection-namespace.mjs +4 -0
- package/es/internals/index.mjs +16 -0
- package/es/router/group-redirect.mjs +26 -0
- package/es/router/guard/index.mjs +36 -0
- package/es/router/guard/login.mjs +6 -0
- package/es/router/guard/permission.mjs +6 -0
- package/es/router/index.mjs +10 -0
- package/es/store/app.mjs +306 -0
- package/es/store/index.mjs +8 -0
- package/es/store/router-permission.mjs +94 -0
- package/es/store/user.mjs +128 -0
- package/es/style.css +339 -0
- package/es/types/index.mjs +1 -0
- package/es/utils/dom.mjs +42 -0
- package/es/utils/export.mjs +39 -0
- package/es/utils/gap-scale.mjs +25 -0
- package/es/utils/id.mjs +7 -0
- package/es/utils/index.mjs +37 -0
- package/es/utils/permission.mjs +31 -0
- package/es/utils/router.mjs +42 -0
- package/es/utils/theme-scale.mjs +86 -0
- package/es/utils/time.mjs +24 -0
- package/package.json +232 -1
- package/types/bridge/badge.d.ts +215 -0
- package/types/bridge/config-hook.d.ts +12 -0
- package/types/bridge/contracts/bridge.d.ts +339 -0
- package/types/bridge/contracts/config.d.ts +519 -0
- package/types/bridge/contracts/event.d.ts +546 -0
- package/types/bridge/contracts/index.d.ts +3 -0
- package/types/bridge/event.d.ts +3 -0
- package/types/bridge/index.d.ts +28 -0
- package/types/bridge/layout.d.ts +102 -0
- package/types/bridge/permission.d.ts +31 -0
- package/types/bridge/plugin.d.ts +11 -0
- package/types/bridge/route.d.ts +36 -0
- package/types/bridge/state.d.ts +26 -0
- package/types/bridge/storage.d.ts +10 -0
- package/types/bridge/theme/index.d.ts +10 -0
- package/types/bridge/theme/persist.d.ts +23 -0
- package/types/bridge/theme/system-dark.d.ts +14 -0
- package/types/bridge/theme/types.d.ts +346 -0
- package/types/components/basic/AppCollapseToggle.vue.d.ts +14 -0
- package/types/components/basic/action-btn/ActionBtn.vue.d.ts +19 -0
- package/types/components/basic/action-btn/index.d.ts +1 -0
- package/types/components/basic/action-btn/use-action-btn-report.d.ts +12 -0
- package/types/components/basic/action-btn-group/ActionBtnGroup.vue.d.ts +18 -0
- package/types/components/basic/action-btn-group/index.d.ts +1 -0
- package/types/components/basic/action-btn-group/use-action-btn-group-report.d.ts +6 -0
- package/types/components/basic/display-contracts/index.d.ts +1 -0
- package/types/components/basic/display-contracts/types.d.ts +280 -0
- package/types/components/basic/drag-float/DragFloat.vue.d.ts +35 -0
- package/types/components/basic/drag-float/index.d.ts +1 -0
- package/types/components/basic/height-provider/HeightProvider.vue.d.ts +28 -0
- package/types/components/basic/height-provider/index.d.ts +1 -0
- package/types/components/basic/index.d.ts +1 -0
- package/types/components/basic/shadow-clone/ShadowClone.vue.d.ts +20 -0
- package/types/components/basic/shadow-clone/index.d.ts +1 -0
- package/types/components/basic/shadow-clone/use-shadow-target.d.ts +9 -0
- package/types/components/basic/slot-layout-flow-aside/SlotLayoutFlowAside.vue.d.ts +32 -0
- package/types/components/basic/slot-layout-flow-aside/index.d.ts +2 -0
- package/types/components/basic/slot-layout-flow-aside/types.d.ts +10 -0
- package/types/components/basic/slot-layout-template/SlotLayoutTemplate.vue.d.ts +48 -0
- package/types/components/basic/slot-layout-template/index.d.ts +1 -0
- package/types/components/basic/watch-size/WatchSize.vue.d.ts +45 -0
- package/types/components/basic/watch-size/index.d.ts +1 -0
- package/types/components/config/app-theme/AppTheme.vue.d.ts +2 -0
- package/types/components/config/app-theme/index.d.ts +1 -0
- package/types/components/data/badge-mark/BadgeMark.vue.d.ts +212 -0
- package/types/components/data/badge-mark/index.d.ts +1 -0
- package/types/components/data/badge-mark/use-badge-mask.d.ts +8 -0
- package/types/components/data/badge-mark/use-badge.d.ts +78 -0
- package/types/components/data/boolean-tag/BooleanTag.vue.d.ts +8 -0
- package/types/components/data/boolean-tag/index.d.ts +1 -0
- package/types/components/data/image-preview-trigger/ImagePreviewTrigger.vue.d.ts +41 -0
- package/types/components/data/image-preview-trigger/index.d.ts +1 -0
- package/types/components/data/modal-image-preview/ModalImagePreview.vue.d.ts +31 -0
- package/types/components/data/modal-image-preview/index.d.ts +1 -0
- package/types/components/feedback/action-confirm/ActionConfirm.vue.d.ts +33 -0
- package/types/components/feedback/action-confirm/index.d.ts +1 -0
- package/types/components/feedback/modal-confirm/ModalConfirm.vue.d.ts +120 -0
- package/types/components/feedback/modal-confirm/index.d.ts +2 -0
- package/types/components/feedback/modal-confirm/types.d.ts +4 -0
- package/types/components/feedback/modal-video-preview/ModalVideoPreview.vue.d.ts +40 -0
- package/types/components/feedback/modal-video-preview/index.d.ts +1 -0
- package/types/components/feedback/preview-keys/index.d.ts +2 -0
- package/types/components/feedback/preview-keys/keys.d.ts +14 -0
- package/types/components/feedback/shelf-contracts/index.d.ts +1 -0
- package/types/components/feedback/shelf-contracts/types.d.ts +1 -0
- package/types/components/feedback/video-preview-trigger/VideoPreviewTrigger.vue.d.ts +46 -0
- package/types/components/feedback/video-preview-trigger/index.d.ts +1 -0
- package/types/components/other/TriggerAutoImport.vue.d.ts +17 -0
- package/types/components/other/auto-refresh/AutoRefresh.vue.d.ts +14 -0
- package/types/components/other/auto-refresh/index.d.ts +1 -0
- package/types/components/other/auto-refresh/use-auto-refresh-report.d.ts +1 -0
- package/types/components/other/auto-refresh-contracts/index.d.ts +1 -0
- package/types/components/other/auto-refresh-contracts/types.d.ts +17 -0
- package/types/components/other/auto-refresh-group/AutoRefreshGroup.vue.d.ts +18 -0
- package/types/components/other/auto-refresh-group/index.d.ts +1 -0
- package/types/components/other/auto-refresh-group/use-auto-refresh-group-report.d.ts +3 -0
- package/types/components/other/index.d.ts +1 -0
- package/types/config/badge-attr.d.ts +26 -0
- package/types/config/index.d.ts +5 -0
- package/types/config/list-model.d.ts +49 -0
- package/types/config/modal-keys.d.ts +12 -0
- package/types/config/route.d.ts +4 -0
- package/types/config/slot-region.d.ts +72 -0
- package/types/helpers/form.d.ts +8 -0
- package/types/helpers/index.d.ts +3 -0
- package/types/helpers/list-helper.d.ts +35 -0
- package/types/helpers/types.d.ts +15 -0
- package/types/hooks/activated.d.ts +36 -0
- package/types/hooks/feel-size.d.ts +10 -0
- package/types/hooks/index.d.ts +12 -0
- package/types/hooks/menus-dispatch.d.ts +35 -0
- package/types/hooks/timeout.d.ts +7 -0
- package/types/hooks/use-active-record.d.ts +64 -0
- package/types/hooks/use-breakpoint.d.ts +4 -0
- package/types/hooks/use-bridge-report.d.ts +3 -0
- package/types/hooks/use-channel-viewport-height.d.ts +22 -0
- package/types/hooks/use-context-defaults.d.ts +39 -0
- package/types/hooks/use-custom-breakpoint.d.ts +17 -0
- package/types/hooks/use-is-dev.d.ts +24 -0
- package/types/hooks/use-observe-size.d.ts +36 -0
- package/types/hooks/use-permission.d.ts +14 -0
- package/types/hooks/use-surface.d.ts +45 -0
- package/types/hooks/use-theme-apply.d.ts +34 -0
- package/types/hooks/use-viewport-apply.d.ts +20 -0
- package/types/index.d.ts +33 -0
- package/types/inject/index.d.ts +1 -0
- package/types/inject/key.d.ts +247 -0
- package/types/injection-namespace.d.ts +4 -0
- package/types/internals/index.d.ts +6 -0
- package/types/router/group-redirect.d.ts +14 -0
- package/types/router/guard/index.d.ts +20 -0
- package/types/router/guard/login.d.ts +4 -0
- package/types/router/guard/permission.d.ts +4 -0
- package/types/router/guard/types.d.ts +14 -0
- package/types/router/index.d.ts +2 -0
- package/types/store/app.d.ts +219 -0
- package/types/store/index.d.ts +3 -0
- package/types/store/router-permission.d.ts +79 -0
- package/types/store/user.d.ts +64 -0
- package/types/types/app-layout.d.ts +42 -0
- package/types/types/dc-path.d.ts +2 -0
- package/types/types/dot-path.d.ts +13 -0
- package/types/types/index.d.ts +9 -0
- package/types/types/list-api.d.ts +17 -0
- package/types/types/modal-shelf.d.ts +123 -0
- package/types/types/nest-form.d.ts +8 -0
- package/types/types/permission.d.ts +31 -0
- package/types/types/route.d.ts +141 -0
- package/types/types/utility-types.d.ts +25 -0
- package/types/utils/dom.d.ts +61 -0
- package/types/utils/export.d.ts +35 -0
- package/types/utils/gap-scale.d.ts +46 -0
- package/types/utils/id.d.ts +2 -0
- package/types/utils/index.d.ts +8 -0
- package/types/utils/permission.d.ts +16 -0
- package/types/utils/router.d.ts +18 -0
- package/types/utils/theme-scale.d.ts +78 -0
- package/types/utils/time.d.ts +2 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { defineComponent, useModel, ref, computed, h, openBlock, createBlock, unref, withCtx, createElementVNode, createElementBlock, resolveDynamicComponent, createCommentVNode, createVNode, createTextVNode, toDisplayString, renderSlot, Fragment, mergeModels } from "vue";
|
|
2
|
+
import { ElPopover, ElButton } from "element-plus";
|
|
3
|
+
import ModalConfirm from "../modal-confirm/ModalConfirm.vue.mjs";
|
|
4
|
+
const _hoisted_1 = { class: "action-confirm" };
|
|
5
|
+
const _hoisted_2 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "action-confirm__title"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_3 = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "action-confirm__content"
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_4 = { class: "action-confirm__actions" };
|
|
14
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
15
|
+
__name: "ActionConfirm",
|
|
16
|
+
props: /* @__PURE__ */ mergeModels({
|
|
17
|
+
mode: {},
|
|
18
|
+
title: {},
|
|
19
|
+
content: {},
|
|
20
|
+
confirmText: { default: "确定" },
|
|
21
|
+
cancelText: { default: "取消" },
|
|
22
|
+
type: {},
|
|
23
|
+
submitFn: {}
|
|
24
|
+
}, {
|
|
25
|
+
"show": { type: Boolean, ...{ default: false } },
|
|
26
|
+
"showModifiers": {}
|
|
27
|
+
}),
|
|
28
|
+
emits: /* @__PURE__ */ mergeModels(["close"], ["update:show"]),
|
|
29
|
+
setup(__props, { emit: __emit }) {
|
|
30
|
+
const props = __props;
|
|
31
|
+
const emits = __emit;
|
|
32
|
+
const show = useModel(__props, "show");
|
|
33
|
+
const loading = ref(false);
|
|
34
|
+
const resolveText = (resolver) => {
|
|
35
|
+
if (resolver === void 0 || resolver === null) return void 0;
|
|
36
|
+
return typeof resolver === "function" ? resolver() : resolver;
|
|
37
|
+
};
|
|
38
|
+
const toNode = (resolved) => {
|
|
39
|
+
if (resolved === void 0 || resolved === null || resolved === "")
|
|
40
|
+
return void 0;
|
|
41
|
+
if (typeof resolved === "string") return () => h("span", resolved);
|
|
42
|
+
return () => resolved;
|
|
43
|
+
};
|
|
44
|
+
const titleNode = computed(() => toNode(resolveText(props.title)));
|
|
45
|
+
const contentNode = computed(() => toNode(resolveText(props.content)));
|
|
46
|
+
const onConfirm = async () => {
|
|
47
|
+
loading.value = true;
|
|
48
|
+
try {
|
|
49
|
+
await Promise.resolve(props.submitFn());
|
|
50
|
+
emits("close", true);
|
|
51
|
+
show.value = false;
|
|
52
|
+
} catch {
|
|
53
|
+
} finally {
|
|
54
|
+
loading.value = false;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const onCancel = () => {
|
|
58
|
+
emits("close", false);
|
|
59
|
+
show.value = false;
|
|
60
|
+
};
|
|
61
|
+
const messageTitle = computed(() => {
|
|
62
|
+
const raw = resolveText(props.title);
|
|
63
|
+
if (raw === void 0 || raw === "") return void 0;
|
|
64
|
+
return typeof raw === "string" ? raw : () => h("span", raw);
|
|
65
|
+
});
|
|
66
|
+
const messageContent = computed(() => {
|
|
67
|
+
const raw = resolveText(props.content);
|
|
68
|
+
if (raw === void 0 || raw === "") return void 0;
|
|
69
|
+
return typeof raw === "string" ? raw : () => h("div", raw);
|
|
70
|
+
});
|
|
71
|
+
const onMessageConfirm = async () => {
|
|
72
|
+
try {
|
|
73
|
+
await Promise.resolve(props.submitFn());
|
|
74
|
+
emits("close", true);
|
|
75
|
+
} catch {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return (_ctx, _cache) => {
|
|
80
|
+
return props.mode === "popconfirm" ? (openBlock(), createBlock(unref(ElPopover), {
|
|
81
|
+
key: 0,
|
|
82
|
+
visible: show.value,
|
|
83
|
+
width: 240,
|
|
84
|
+
persistent: false
|
|
85
|
+
}, {
|
|
86
|
+
reference: withCtx(() => [
|
|
87
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
88
|
+
]),
|
|
89
|
+
default: withCtx(() => [
|
|
90
|
+
createElementVNode("div", _hoisted_1, [
|
|
91
|
+
titleNode.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
92
|
+
(openBlock(), createBlock(resolveDynamicComponent(titleNode.value)))
|
|
93
|
+
])) : createCommentVNode("", true),
|
|
94
|
+
contentNode.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
95
|
+
(openBlock(), createBlock(resolveDynamicComponent(contentNode.value)))
|
|
96
|
+
])) : createCommentVNode("", true),
|
|
97
|
+
createElementVNode("div", _hoisted_4, [
|
|
98
|
+
createVNode(unref(ElButton), {
|
|
99
|
+
size: "small",
|
|
100
|
+
disabled: loading.value,
|
|
101
|
+
onClick: onCancel
|
|
102
|
+
}, {
|
|
103
|
+
default: withCtx(() => [
|
|
104
|
+
createTextVNode(toDisplayString(__props.cancelText), 1)
|
|
105
|
+
]),
|
|
106
|
+
_: 1
|
|
107
|
+
}, 8, ["disabled"]),
|
|
108
|
+
createVNode(unref(ElButton), {
|
|
109
|
+
size: "small",
|
|
110
|
+
type: __props.type,
|
|
111
|
+
loading: loading.value,
|
|
112
|
+
onClick: onConfirm
|
|
113
|
+
}, {
|
|
114
|
+
default: withCtx(() => [
|
|
115
|
+
createTextVNode(toDisplayString(__props.confirmText), 1)
|
|
116
|
+
]),
|
|
117
|
+
_: 1
|
|
118
|
+
}, 8, ["type", "loading"])
|
|
119
|
+
])
|
|
120
|
+
])
|
|
121
|
+
]),
|
|
122
|
+
_: 3
|
|
123
|
+
}, 8, ["visible"])) : props.mode === "messageConfirm" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
124
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true),
|
|
125
|
+
createVNode(unref(ModalConfirm), {
|
|
126
|
+
show: show.value,
|
|
127
|
+
"onUpdate:show": _cache[0] || (_cache[0] = ($event) => show.value = $event),
|
|
128
|
+
title: messageTitle.value,
|
|
129
|
+
content: messageContent.value,
|
|
130
|
+
"confirm-text": __props.confirmText,
|
|
131
|
+
"cancel-text": __props.cancelText,
|
|
132
|
+
type: __props.type,
|
|
133
|
+
"on-confirm": onMessageConfirm,
|
|
134
|
+
"on-cancel": onCancel,
|
|
135
|
+
"use-loading": ""
|
|
136
|
+
}, null, 8, ["show", "title", "content", "confirm-text", "cancel-text", "type"])
|
|
137
|
+
], 64)) : renderSlot(_ctx.$slots, "default", { key: 2 }, void 0, true);
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
export {
|
|
142
|
+
_sfc_main as default
|
|
143
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _sfc_main from "./ModalConfirm.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
/* empty css */
|
|
4
|
+
import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
5
|
+
const ModalConfirm = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5833c7fa"]]);
|
|
6
|
+
export {
|
|
7
|
+
ModalConfirm as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { defineComponent, computed, shallowRef, ref, inject, provide, openBlock, createBlock, resolveDynamicComponent, mergeProps, createSlots, withCtx, createElementVNode, normalizeClass, renderSlot, createElementBlock, Fragment, createTextVNode, toDisplayString, unref, createCommentVNode, createVNode } from "vue";
|
|
2
|
+
import { ElDrawer, ElDialog, ElButton } from "element-plus";
|
|
3
|
+
import { APP_LAYOUT_BRIDGE_KEY, BODY_CONTENT_VIEWPORT_HEIGHT, SCOPE_VIEWPORT_MAX_HEIGHT } from "../../../inject/key.mjs";
|
|
4
|
+
import { useActivated } from "../../../hooks/activated.mjs";
|
|
5
|
+
import { useObserveSize } from "../../../hooks/use-observe-size.mjs";
|
|
6
|
+
import { SlotRegion } from "../../../config/slot-region.mjs";
|
|
7
|
+
import { gapScaleValue } from "../../../utils/gap-scale.mjs";
|
|
8
|
+
const _hoisted_1 = { class: "confirm-modal__title" };
|
|
9
|
+
const _hoisted_2 = ["data-dc-slot"];
|
|
10
|
+
const _hoisted_3 = ["reverse"];
|
|
11
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
+
...{
|
|
13
|
+
inheritAttrs: false
|
|
14
|
+
},
|
|
15
|
+
__name: "ModalConfirm",
|
|
16
|
+
props: {
|
|
17
|
+
show: { type: Boolean },
|
|
18
|
+
showClose: { type: Boolean, default: true },
|
|
19
|
+
onClose: {},
|
|
20
|
+
onCancel: {},
|
|
21
|
+
onConfirm: {},
|
|
22
|
+
title: {},
|
|
23
|
+
content: {},
|
|
24
|
+
cancelText: { type: [String, Function], default: "取消" },
|
|
25
|
+
confirmText: { type: [String, Function], default: "确定" },
|
|
26
|
+
hiddenCancel: { type: Boolean, default: false },
|
|
27
|
+
hiddenHeader: { type: Boolean, default: false },
|
|
28
|
+
hiddenFooter: { type: Boolean, default: false },
|
|
29
|
+
width: { default: 420 },
|
|
30
|
+
reverse: { type: Boolean, default: false },
|
|
31
|
+
closeOnPressEscape: { type: Boolean, default: true },
|
|
32
|
+
closeOnClickModal: { type: Boolean, default: true },
|
|
33
|
+
useLoading: { type: Boolean },
|
|
34
|
+
type: { default: "primary" },
|
|
35
|
+
layerType: { default: "modal" },
|
|
36
|
+
direction: { default: "rtl" },
|
|
37
|
+
headerDivider: { type: Boolean, default: void 0 },
|
|
38
|
+
footerDivider: { type: Boolean, default: void 0 },
|
|
39
|
+
modalReserve: { default: 200 }
|
|
40
|
+
},
|
|
41
|
+
emits: ["update:show"],
|
|
42
|
+
setup(__props, { emit: __emit }) {
|
|
43
|
+
const props = __props;
|
|
44
|
+
const emits = __emit;
|
|
45
|
+
const isDrawer = computed(() => props.layerType === "drawer");
|
|
46
|
+
const showHeaderDivider = computed(() => props.headerDivider ?? isDrawer.value);
|
|
47
|
+
const showFooterDivider = computed(() => props.footerDivider ?? isDrawer.value);
|
|
48
|
+
const contentRef = shallowRef();
|
|
49
|
+
const drawerBodyHeight = ref(0);
|
|
50
|
+
const bodySlotRegion = computed(
|
|
51
|
+
() => isDrawer.value ? SlotRegion.ModalConfirm_DrawerBody : SlotRegion.ModalConfirm_Body
|
|
52
|
+
);
|
|
53
|
+
const layoutBridge = inject(APP_LAYOUT_BRIDGE_KEY, void 0);
|
|
54
|
+
const layerPadVars = computed(() => {
|
|
55
|
+
const base = (layoutBridge == null ? void 0 : layoutBridge.APP_LAYOUT_GAP_CONFIG.size) ?? 8;
|
|
56
|
+
const density = layoutBridge == null ? void 0 : layoutBridge.themeDensity.value;
|
|
57
|
+
return {
|
|
58
|
+
"--dc-confirm-modal-pad-x": `${gapScaleValue(base, "outer", density)}px`,
|
|
59
|
+
"--dc-confirm-modal-pad-body-y": `${gapScaleValue(
|
|
60
|
+
base,
|
|
61
|
+
"outer",
|
|
62
|
+
density
|
|
63
|
+
)}px`,
|
|
64
|
+
"--dc-confirm-modal-pad-chrome-y": `${gapScaleValue(
|
|
65
|
+
base,
|
|
66
|
+
"breath",
|
|
67
|
+
density
|
|
68
|
+
)}px`
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
const outerViewportHeight = inject(BODY_CONTENT_VIEWPORT_HEIGHT, void 0);
|
|
72
|
+
const providedViewportHeight = computed(
|
|
73
|
+
() => isDrawer.value ? drawerBodyHeight.value : (outerViewportHeight == null ? void 0 : outerViewportHeight.value) ?? 0
|
|
74
|
+
);
|
|
75
|
+
provide(BODY_CONTENT_VIEWPORT_HEIGHT, providedViewportHeight);
|
|
76
|
+
const windowInnerHeight = ref(
|
|
77
|
+
typeof window === "undefined" ? 0 : window.innerHeight
|
|
78
|
+
);
|
|
79
|
+
const measureWindowHeight = () => {
|
|
80
|
+
windowInnerHeight.value = window.innerHeight;
|
|
81
|
+
};
|
|
82
|
+
useActivated((info) => {
|
|
83
|
+
if (info.isActivated) {
|
|
84
|
+
measureWindowHeight();
|
|
85
|
+
window.addEventListener("resize", measureWindowHeight);
|
|
86
|
+
} else {
|
|
87
|
+
window.removeEventListener("resize", measureWindowHeight);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
provide(SCOPE_VIEWPORT_MAX_HEIGHT, {
|
|
91
|
+
scope: void 0,
|
|
92
|
+
viewportMaxHeight: computed(
|
|
93
|
+
() => isDrawer.value ? drawerBodyHeight.value : Math.max(0, windowInnerHeight.value - props.modalReserve)
|
|
94
|
+
),
|
|
95
|
+
parent: void 0
|
|
96
|
+
});
|
|
97
|
+
useObserveSize({
|
|
98
|
+
getTarget: () => {
|
|
99
|
+
var _a;
|
|
100
|
+
return (_a = contentRef.value) == null ? void 0 : _a.parentElement;
|
|
101
|
+
},
|
|
102
|
+
onResize: (entry) => {
|
|
103
|
+
drawerBodyHeight.value = Math.max(0, Math.round(entry.contentRect.height));
|
|
104
|
+
},
|
|
105
|
+
enabled: () => isDrawer.value
|
|
106
|
+
// 用 hook 默认 100ms 防抖:抽屉开合动画 / 视口变化时 RO 每帧回调写 drawerBodyHeight →
|
|
107
|
+
// provide computed 链 + 插槽内列表重算,防抖合并高频帧(leading 首帧即时给出可用高、不闪)。
|
|
108
|
+
});
|
|
109
|
+
const layerComponent = computed(() => isDrawer.value ? ElDrawer : ElDialog);
|
|
110
|
+
const layerBind = computed(
|
|
111
|
+
() => isDrawer.value ? {
|
|
112
|
+
size: props.width,
|
|
113
|
+
direction: props.direction,
|
|
114
|
+
// drawer 有 EP 原生开关,隐藏时节点真不渲染(优于 CSS 兜)
|
|
115
|
+
withHeader: !props.hiddenHeader
|
|
116
|
+
} : { width: props.width, alignCenter: true }
|
|
117
|
+
);
|
|
118
|
+
const showLoading = ref(false);
|
|
119
|
+
const loading = computed(() => {
|
|
120
|
+
return props.useLoading && showLoading.value;
|
|
121
|
+
});
|
|
122
|
+
const close = (status) => {
|
|
123
|
+
var _a;
|
|
124
|
+
emits("update:show", false);
|
|
125
|
+
(_a = props.onClose) == null ? void 0 : _a.call(props, status);
|
|
126
|
+
};
|
|
127
|
+
const cancelHandler = async () => {
|
|
128
|
+
var _a;
|
|
129
|
+
const res = await ((_a = props.onCancel) == null ? void 0 : _a.call(props));
|
|
130
|
+
if (res === false) return;
|
|
131
|
+
close(false);
|
|
132
|
+
};
|
|
133
|
+
const confirmHandler = async () => {
|
|
134
|
+
var _a;
|
|
135
|
+
showLoading.value = true;
|
|
136
|
+
try {
|
|
137
|
+
const res = await ((_a = props.onConfirm) == null ? void 0 : _a.call(props));
|
|
138
|
+
showLoading.value = false;
|
|
139
|
+
if (res === false) return;
|
|
140
|
+
close(true);
|
|
141
|
+
} catch {
|
|
142
|
+
showLoading.value = false;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const closeHandler = () => {
|
|
146
|
+
close(false);
|
|
147
|
+
};
|
|
148
|
+
return (_ctx, _cache) => {
|
|
149
|
+
return openBlock(), createBlock(resolveDynamicComponent(layerComponent.value), mergeProps({ ..._ctx.$attrs, ...layerBind.value }, {
|
|
150
|
+
"model-value": __props.show,
|
|
151
|
+
class: [
|
|
152
|
+
"dc-confirm-modal",
|
|
153
|
+
"confirm-modal",
|
|
154
|
+
{
|
|
155
|
+
"confirm-modal_header-divider": showHeaderDivider.value,
|
|
156
|
+
"confirm-modal_footer-divider": showFooterDivider.value,
|
|
157
|
+
// modal 形态用它兜 header 隐藏(EP 的 el-dialog__header 无条件渲染,见下方样式块)
|
|
158
|
+
"confirm-modal_hidden-header": __props.hiddenHeader
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
style: layerPadVars.value,
|
|
162
|
+
"show-close": __props.showClose,
|
|
163
|
+
"append-to-body": "",
|
|
164
|
+
"close-on-click-modal": __props.closeOnClickModal,
|
|
165
|
+
"close-on-press-escape": __props.closeOnPressEscape,
|
|
166
|
+
onClose: closeHandler
|
|
167
|
+
}), createSlots({
|
|
168
|
+
default: withCtx(() => [
|
|
169
|
+
createElementVNode("div", {
|
|
170
|
+
ref_key: "contentRef",
|
|
171
|
+
ref: contentRef,
|
|
172
|
+
class: normalizeClass(["confirm-modal__content", { "confirm-modal__content_drawer": isDrawer.value }]),
|
|
173
|
+
"data-dc-slot": bodySlotRegion.value
|
|
174
|
+
}, [
|
|
175
|
+
renderSlot(_ctx.$slots, "main-header", {}, void 0, true),
|
|
176
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
177
|
+
typeof __props.content === "function" ? (openBlock(), createBlock(resolveDynamicComponent(__props.content), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
178
|
+
createTextVNode(toDisplayString(__props.content), 1)
|
|
179
|
+
], 64))
|
|
180
|
+
], true),
|
|
181
|
+
renderSlot(_ctx.$slots, "main-footer", {}, void 0, true)
|
|
182
|
+
], 10, _hoisted_2)
|
|
183
|
+
]),
|
|
184
|
+
_: 2
|
|
185
|
+
}, [
|
|
186
|
+
!__props.hiddenHeader ? {
|
|
187
|
+
name: "header",
|
|
188
|
+
fn: withCtx(() => [
|
|
189
|
+
createElementVNode("div", _hoisted_1, [
|
|
190
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
191
|
+
typeof __props.title === "function" ? (openBlock(), createBlock(resolveDynamicComponent(__props.title), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
192
|
+
createTextVNode(toDisplayString(__props.title), 1)
|
|
193
|
+
], 64))
|
|
194
|
+
], true)
|
|
195
|
+
])
|
|
196
|
+
]),
|
|
197
|
+
key: "0"
|
|
198
|
+
} : void 0,
|
|
199
|
+
!__props.hiddenFooter ? {
|
|
200
|
+
name: "footer",
|
|
201
|
+
fn: withCtx(() => [
|
|
202
|
+
createElementVNode("div", {
|
|
203
|
+
class: "confirm-modal__footer",
|
|
204
|
+
reverse: __props.reverse
|
|
205
|
+
}, [
|
|
206
|
+
renderSlot(_ctx.$slots, "footer", {
|
|
207
|
+
cancelHandler,
|
|
208
|
+
confirmHandler,
|
|
209
|
+
loading: loading.value
|
|
210
|
+
}, () => [
|
|
211
|
+
!__props.hiddenCancel ? (openBlock(), createBlock(unref(ElButton), {
|
|
212
|
+
key: 0,
|
|
213
|
+
class: "confirm-modal__cancel",
|
|
214
|
+
onClick: cancelHandler
|
|
215
|
+
}, {
|
|
216
|
+
default: withCtx(() => [
|
|
217
|
+
createTextVNode(toDisplayString(typeof __props.cancelText === "function" ? __props.cancelText() : __props.cancelText), 1)
|
|
218
|
+
]),
|
|
219
|
+
_: 1
|
|
220
|
+
})) : createCommentVNode("", true),
|
|
221
|
+
createVNode(unref(ElButton), {
|
|
222
|
+
class: "confirm-modal__confirm",
|
|
223
|
+
type: __props.type,
|
|
224
|
+
loading: loading.value,
|
|
225
|
+
onClick: confirmHandler
|
|
226
|
+
}, {
|
|
227
|
+
default: withCtx(() => [
|
|
228
|
+
createTextVNode(toDisplayString(typeof __props.confirmText === "function" ? __props.confirmText() : __props.confirmText), 1)
|
|
229
|
+
]),
|
|
230
|
+
_: 1
|
|
231
|
+
}, 8, ["type", "loading"])
|
|
232
|
+
], true)
|
|
233
|
+
], 8, _hoisted_3)
|
|
234
|
+
]),
|
|
235
|
+
key: "1"
|
|
236
|
+
} : void 0
|
|
237
|
+
]), 1040, ["model-value", "class", "style", "show-close", "close-on-click-modal", "close-on-press-escape"]);
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
export {
|
|
242
|
+
_sfc_main as default
|
|
243
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _sfc_main from "./ModalVideoPreview.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
/* empty css */
|
|
4
|
+
import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
5
|
+
const ModalVideoPreview = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-285cb9d9"]]);
|
|
6
|
+
export {
|
|
7
|
+
ModalVideoPreview as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { defineComponent, useModel, computed, useAttrs, ref, openBlock, createBlock, unref, withCtx, createElementVNode, mergeProps, mergeModels } from "vue";
|
|
2
|
+
import { ElDialog } from "element-plus";
|
|
3
|
+
const _hoisted_1 = { class: "modal-video-preview__stage" };
|
|
4
|
+
const _hoisted_2 = { class: "modal-video-preview__shim" };
|
|
5
|
+
const _hoisted_3 = ["src", "poster"];
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
...{ inheritAttrs: false },
|
|
8
|
+
__name: "ModalVideoPreview",
|
|
9
|
+
props: /* @__PURE__ */ mergeModels({
|
|
10
|
+
url: {},
|
|
11
|
+
coverUrl: {},
|
|
12
|
+
autoPlay: { type: Boolean, default: true },
|
|
13
|
+
payload: {},
|
|
14
|
+
closeFn: {},
|
|
15
|
+
removeFn: {},
|
|
16
|
+
onClose: {}
|
|
17
|
+
}, {
|
|
18
|
+
"show": { type: Boolean, ...{ required: true } },
|
|
19
|
+
"showModifiers": {}
|
|
20
|
+
}),
|
|
21
|
+
emits: ["update:show"],
|
|
22
|
+
setup(__props) {
|
|
23
|
+
const props = __props;
|
|
24
|
+
const show = useModel(__props, "show");
|
|
25
|
+
const videoUrl = computed(() => {
|
|
26
|
+
var _a;
|
|
27
|
+
return props.url ?? ((_a = props.payload) == null ? void 0 : _a.url) ?? "";
|
|
28
|
+
});
|
|
29
|
+
const coverUrlValue = computed(
|
|
30
|
+
() => {
|
|
31
|
+
var _a;
|
|
32
|
+
return props.coverUrl ?? ((_a = props.payload) == null ? void 0 : _a.coverUrl) ?? "";
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
const hasCover = computed(() => !!coverUrlValue.value);
|
|
36
|
+
const videoSrc = computed(
|
|
37
|
+
() => hasCover.value ? videoUrl.value : `${videoUrl.value}#t=0.01`
|
|
38
|
+
);
|
|
39
|
+
const attrs = useAttrs();
|
|
40
|
+
const videoAttrs = computed(
|
|
41
|
+
() => hasCover.value ? attrs : { ...attrs, preload: "metadata" }
|
|
42
|
+
);
|
|
43
|
+
const videoEl = ref();
|
|
44
|
+
const onOpened = () => {
|
|
45
|
+
var _a;
|
|
46
|
+
if (!props.autoPlay) return;
|
|
47
|
+
(_a = videoEl.value) == null ? void 0 : _a.play().catch(() => {
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
const onClosed = () => {
|
|
51
|
+
var _a;
|
|
52
|
+
(_a = videoEl.value) == null ? void 0 : _a.pause();
|
|
53
|
+
};
|
|
54
|
+
const onDialogClose = () => {
|
|
55
|
+
var _a;
|
|
56
|
+
(_a = props.onClose) == null ? void 0 : _a.call(props, false);
|
|
57
|
+
};
|
|
58
|
+
return (_ctx, _cache) => {
|
|
59
|
+
return openBlock(), createBlock(unref(ElDialog), {
|
|
60
|
+
modelValue: show.value,
|
|
61
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => show.value = $event),
|
|
62
|
+
class: "dc-modal-video-preview modal-video-preview",
|
|
63
|
+
"modal-class": "dc-modal-video-preview__overlay",
|
|
64
|
+
width: "100vw",
|
|
65
|
+
"align-center": "",
|
|
66
|
+
"append-to-body": "",
|
|
67
|
+
onOpened,
|
|
68
|
+
onClosed,
|
|
69
|
+
onClose: onDialogClose
|
|
70
|
+
}, {
|
|
71
|
+
default: withCtx(() => [
|
|
72
|
+
createElementVNode("div", _hoisted_1, [
|
|
73
|
+
createElementVNode("div", _hoisted_2, [
|
|
74
|
+
createElementVNode("video", mergeProps({
|
|
75
|
+
ref_key: "videoEl",
|
|
76
|
+
ref: videoEl
|
|
77
|
+
}, videoAttrs.value, {
|
|
78
|
+
src: videoSrc.value,
|
|
79
|
+
poster: coverUrlValue.value || void 0,
|
|
80
|
+
controls: "",
|
|
81
|
+
class: "modal-video-preview__video"
|
|
82
|
+
}), null, 16, _hoisted_3)
|
|
83
|
+
])
|
|
84
|
+
])
|
|
85
|
+
]),
|
|
86
|
+
_: 1
|
|
87
|
+
}, 8, ["modelValue"]);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
export {
|
|
92
|
+
_sfc_main as default
|
|
93
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GLOBAL_MODAL_REMOTE_KEY } from "./keys.mjs";
|
|
2
|
+
import { APP_GLOBAL_IMAGE_PREVIEW_KEY, APP_GLOBAL_VIDEO_PREVIEW_KEY } from "../../../config/modal-keys.mjs";
|
|
3
|
+
export {
|
|
4
|
+
APP_GLOBAL_IMAGE_PREVIEW_KEY,
|
|
5
|
+
APP_GLOBAL_VIDEO_PREVIEW_KEY,
|
|
6
|
+
GLOBAL_MODAL_REMOTE_KEY
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./VideoPreviewTrigger.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const VideoPreviewTrigger = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0ea80546"]]);
|
|
5
|
+
export {
|
|
6
|
+
VideoPreviewTrigger as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { defineComponent, inject, ref, computed, openBlock, createElementBlock, Fragment, renderSlot, createVNode, unref, mergeProps, withCtx, createElementVNode, withKeys, createBlock, createCommentVNode } from "vue";
|
|
2
|
+
import { ElImage, ElIcon } from "element-plus";
|
|
3
|
+
import { VideoPlay } from "@element-plus/icons-vue";
|
|
4
|
+
import { GLOBAL_MODAL_REMOTE_KEY } from "../preview-keys/keys.mjs";
|
|
5
|
+
import ModalVideoPreview from "../modal-video-preview/ModalVideoPreview.vue.mjs";
|
|
6
|
+
import { APP_GLOBAL_VIDEO_PREVIEW_KEY } from "../../../config/modal-keys.mjs";
|
|
7
|
+
const _hoisted_1 = {
|
|
8
|
+
class: "video-preview-trigger__play-badge",
|
|
9
|
+
"aria-hidden": "true"
|
|
10
|
+
};
|
|
11
|
+
const _hoisted_2 = ["aria-label"];
|
|
12
|
+
const _hoisted_3 = ["src"];
|
|
13
|
+
const _hoisted_4 = {
|
|
14
|
+
class: "video-preview-trigger__play-badge",
|
|
15
|
+
"aria-hidden": "true"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_5 = ["aria-label"];
|
|
18
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
19
|
+
...{ inheritAttrs: false },
|
|
20
|
+
__name: "VideoPreviewTrigger",
|
|
21
|
+
props: {
|
|
22
|
+
url: {},
|
|
23
|
+
coverUrl: {},
|
|
24
|
+
frameCover: { type: Boolean, default: true },
|
|
25
|
+
lazy: { type: Boolean, default: true },
|
|
26
|
+
preview: { type: Boolean, default: true }
|
|
27
|
+
},
|
|
28
|
+
setup(__props) {
|
|
29
|
+
const props = __props;
|
|
30
|
+
const remote = inject(GLOBAL_MODAL_REMOTE_KEY);
|
|
31
|
+
const localShow = ref(false);
|
|
32
|
+
const frameCoverSrc = computed(() => `${props.url}#t=0.01`);
|
|
33
|
+
const openPreview = (event) => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
if (!props.preview) return;
|
|
36
|
+
event == null ? void 0 : event.stopPropagation();
|
|
37
|
+
if ((_b = (_a = remote == null ? void 0 : remote.value) == null ? void 0 : _a.modalKey) == null ? void 0 : _b.includes(APP_GLOBAL_VIDEO_PREVIEW_KEY)) {
|
|
38
|
+
remote.value[APP_GLOBAL_VIDEO_PREVIEW_KEY].evoke({
|
|
39
|
+
url: props.url,
|
|
40
|
+
coverUrl: props.coverUrl
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
localShow.value = true;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return (_ctx, _cache) => {
|
|
47
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
48
|
+
renderSlot(_ctx.$slots, "default", { open: openPreview }, () => [
|
|
49
|
+
__props.coverUrl ? (openBlock(), createElementBlock("div", {
|
|
50
|
+
key: 0,
|
|
51
|
+
class: "dc-video-preview-trigger video-preview-trigger video-preview-trigger_cover",
|
|
52
|
+
onClick: openPreview
|
|
53
|
+
}, [
|
|
54
|
+
createVNode(unref(ElImage), mergeProps({
|
|
55
|
+
class: "video-preview-trigger__cover",
|
|
56
|
+
src: __props.coverUrl,
|
|
57
|
+
lazy: __props.lazy,
|
|
58
|
+
alt: String(_ctx.$attrs.alt ?? "")
|
|
59
|
+
}, _ctx.$attrs), {
|
|
60
|
+
placeholder: withCtx(() => [
|
|
61
|
+
renderSlot(_ctx.$slots, "placeholder", {}, void 0, true)
|
|
62
|
+
]),
|
|
63
|
+
error: withCtx(() => [
|
|
64
|
+
renderSlot(_ctx.$slots, "error", {}, void 0, true)
|
|
65
|
+
]),
|
|
66
|
+
_: 3
|
|
67
|
+
}, 16, ["src", "lazy", "alt"]),
|
|
68
|
+
createElementVNode("span", _hoisted_1, [
|
|
69
|
+
createVNode(unref(ElIcon), { size: 20 }, {
|
|
70
|
+
default: withCtx(() => [
|
|
71
|
+
createVNode(unref(VideoPlay))
|
|
72
|
+
]),
|
|
73
|
+
_: 1
|
|
74
|
+
})
|
|
75
|
+
])
|
|
76
|
+
])) : __props.frameCover ? (openBlock(), createElementBlock("div", {
|
|
77
|
+
key: 1,
|
|
78
|
+
class: "dc-video-preview-trigger video-preview-trigger video-preview-trigger_frame",
|
|
79
|
+
role: "button",
|
|
80
|
+
"aria-label": String(_ctx.$attrs["aria-label"] ?? "播放视频"),
|
|
81
|
+
tabindex: "0",
|
|
82
|
+
onClick: openPreview,
|
|
83
|
+
onKeydown: withKeys(openPreview, ["enter"])
|
|
84
|
+
}, [
|
|
85
|
+
createElementVNode("video", {
|
|
86
|
+
class: "video-preview-trigger__frame",
|
|
87
|
+
src: frameCoverSrc.value,
|
|
88
|
+
preload: "metadata",
|
|
89
|
+
muted: "",
|
|
90
|
+
playsinline: ""
|
|
91
|
+
}, null, 8, _hoisted_3),
|
|
92
|
+
createElementVNode("span", _hoisted_4, [
|
|
93
|
+
createVNode(unref(ElIcon), { size: 20 }, {
|
|
94
|
+
default: withCtx(() => [
|
|
95
|
+
createVNode(unref(VideoPlay))
|
|
96
|
+
]),
|
|
97
|
+
_: 1
|
|
98
|
+
})
|
|
99
|
+
])
|
|
100
|
+
], 40, _hoisted_2)) : (openBlock(), createElementBlock("div", {
|
|
101
|
+
key: 2,
|
|
102
|
+
class: "dc-video-preview-trigger video-preview-trigger video-preview-trigger_placeholder",
|
|
103
|
+
role: "button",
|
|
104
|
+
"aria-label": String(_ctx.$attrs["aria-label"] ?? "播放视频"),
|
|
105
|
+
tabindex: "0",
|
|
106
|
+
onClick: openPreview,
|
|
107
|
+
onKeydown: withKeys(openPreview, ["enter"])
|
|
108
|
+
}, [
|
|
109
|
+
createVNode(unref(ElIcon), {
|
|
110
|
+
class: "video-preview-trigger__play-icon",
|
|
111
|
+
size: 32
|
|
112
|
+
}, {
|
|
113
|
+
default: withCtx(() => [
|
|
114
|
+
createVNode(unref(VideoPlay))
|
|
115
|
+
]),
|
|
116
|
+
_: 1
|
|
117
|
+
})
|
|
118
|
+
], 40, _hoisted_5))
|
|
119
|
+
], true),
|
|
120
|
+
localShow.value ? (openBlock(), createBlock(unref(ModalVideoPreview), {
|
|
121
|
+
key: 0,
|
|
122
|
+
show: localShow.value,
|
|
123
|
+
"onUpdate:show": _cache[0] || (_cache[0] = ($event) => localShow.value = $event),
|
|
124
|
+
url: __props.url,
|
|
125
|
+
coverUrl: __props.coverUrl
|
|
126
|
+
}, null, 8, ["show", "url", "coverUrl"])) : createCommentVNode("", true)
|
|
127
|
+
], 64);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
export {
|
|
132
|
+
_sfc_main as default
|
|
133
|
+
};
|