hy-dispatch-ui-v3 0.1.5 → 0.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/README.md +47 -0
- package/dist/tailwind.css +408 -4
- package/es/components/appAudioPlayer/appAudioPlayer.vue.mjs +462 -0
- package/es/components/appAudioPlayer/index.mjs +6 -0
- package/es/components/appAudioPlayer/js/index.mjs +327 -0
- package/es/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
- package/es/components/appButton/style/appButton.scss +0 -1
- package/es/components/appConfigProvider/appConfigProvider.vue.mjs +25 -4
- package/es/components/appConfirmDialog/appConfirmDialog.vue.mjs +3 -3
- package/es/components/appConfirmDialog/appConfirmMethod.mjs +13 -13
- package/es/components/appCutter/appCutter.vue.mjs +358 -0
- package/es/components/appCutter/index.mjs +6 -0
- package/es/components/appCutter/style/appCutter.scss +51 -0
- package/es/components/appDatePicker/appDatePicker.vue.mjs +1 -1
- package/es/components/appDialog/appDialog.vue.mjs +205 -0
- package/es/components/appDialog/index.mjs +6 -0
- package/es/components/appDialog/style/appDialog.scss +0 -0
- package/es/components/appForm/appForm.vue.mjs +132 -209
- package/es/components/appForm/cpns/appFormItem.vue.mjs +312 -0
- package/es/components/appForm/cpns/arrayItem.vue.mjs +305 -0
- package/es/components/appForm/cpns/extraItem.vue.mjs +140 -0
- package/es/components/appForm/js/index.mjs +46 -24
- package/es/components/appForm/js/useAppForm.mjs +30 -6
- package/es/components/appForm/style/appForm.scss +53 -0
- package/es/components/appIcon/appIcon.vue.mjs +2 -1
- package/es/components/appIconBox/style/appIconBox.scss +0 -1
- package/es/components/appInput/appInput.vue.mjs +99 -0
- package/es/components/appInput/index.mjs +6 -0
- package/es/components/appMenu/appMenu.vue.mjs +129 -0
- package/es/components/appMenu/index.mjs +6 -0
- package/es/components/appMenu/style/appMenu.scss +145 -0
- package/es/components/appOrgCascader/appOrgCascader.vue.mjs +14 -10
- package/es/components/appSearch/appSearch.vue.mjs +55 -211
- package/es/components/appSearch/cpns/appSearchItem.vue.mjs +238 -0
- package/es/components/appSearch/js/index.mjs +20 -8
- package/es/components/appSearch/js/useAppSearch.mjs +10 -5
- package/es/components/appSearch/style/appSearch.scss +10 -0
- package/es/components/appTable/appTable.vue.mjs +313 -159
- package/es/components/appTable/cpns/columnSelect.vue.mjs +151 -156
- package/es/components/appTable/cpns/columnSelectItem.vue2.mjs +104 -110
- package/es/components/appTable/cpns/headerItem.vue.mjs +98 -0
- package/es/components/appTable/cpns/virtualTable.vue.mjs +560 -0
- package/es/components/appTable/js/index.mjs +46 -20
- package/es/components/appTable/js/search.mjs +1 -2
- package/es/components/appTable/js/useAppTable.mjs +58 -14
- package/es/components/appTable/style/appTable.scss +16 -0
- package/es/components/appTooltip/appTooltip.vue.mjs +24 -13
- package/es/components/appTree/appTree.vue.mjs +304 -0
- package/es/components/appTree/index.mjs +6 -0
- package/es/components/appTree/js/index.mjs +531 -0
- package/es/components/appUserAvatar/appUserAvatar.vue.mjs +9 -8
- package/es/components/appUserAvatar/style/appUserAvatar.scss +0 -1
- package/es/components/appVideoPlayer/appVideoPlayer.vue.mjs +647 -0
- package/es/components/appVideoPlayer/cpns/mediaLoading.vue.mjs +35 -0
- package/es/components/appVideoPlayer/index.mjs +6 -0
- package/es/components/appVideoPlayer/js/index.mjs +426 -0
- package/es/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
- package/es/components/appVideoPlayer/style/mediaLoading.scss +62 -0
- package/es/components/index.mjs +7 -0
- package/es/hooks/index.mjs +3 -0
- package/es/hooks/useApi.mjs +7 -3
- package/es/hooks/useAudioPlayerConfig.mjs +12 -0
- package/es/hooks/useGlobalConfig.mjs +20 -9
- package/es/hooks/useLocale.mjs +10 -8
- package/es/hooks/useMixins.mjs +1 -1
- package/es/hooks/usePermissionMap.mjs +12 -0
- package/es/hooks/useUserAvatarMap.mjs +6 -3
- package/es/hooks/useVideoPlayerConfig.mjs +12 -0
- package/es/index.mjs +16 -3
- package/es/locale/en.mjs +58 -4
- package/es/locale/zh_CN.mjs +56 -6
- package/es/make-installer.mjs +2 -0
- package/es/static/hy-svg-icons.js +462 -0
- package/es/static/protocolcheck.js +247 -0
- package/es/style/element/element.scss +9 -0
- package/es/style/element/index.scss +6 -3
- package/es/style/index.scss +11 -0
- package/es/style/theme.scss +73 -0
- package/es/utils/date.mjs +25 -1
- package/es/utils/file.mjs +69 -0
- package/es/utils/form.mjs +52 -0
- package/es/utils/handler.mjs +22 -2
- package/es/utils/index.mjs +6 -3
- package/es/utils/is.mjs +26 -2
- package/es/utils/loadScript.mjs +33 -0
- package/es/version.mjs +1 -1
- package/lib/components/appAudioPlayer/appAudioPlayer.vue.js +466 -0
- package/lib/components/appAudioPlayer/index.js +11 -0
- package/lib/components/appAudioPlayer/js/index.js +329 -0
- package/lib/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
- package/lib/components/appButton/style/appButton.scss +0 -1
- package/lib/components/appConfigProvider/appConfigProvider.vue.js +23 -2
- package/lib/components/appConfirmDialog/appConfirmDialog.vue.js +3 -3
- package/lib/components/appConfirmDialog/appConfirmMethod.js +13 -13
- package/lib/components/appCutter/appCutter.vue.js +362 -0
- package/lib/components/appCutter/index.js +11 -0
- package/lib/components/appCutter/style/appCutter.scss +51 -0
- package/lib/components/appDatePicker/appDatePicker.vue.js +1 -1
- package/lib/components/appDialog/appDialog.vue.js +209 -0
- package/lib/components/appDialog/index.js +11 -0
- package/lib/components/appDialog/style/appDialog.scss +0 -0
- package/lib/components/appForm/appForm.vue.js +129 -206
- package/lib/components/appForm/cpns/appFormItem.vue.js +316 -0
- package/lib/components/appForm/cpns/arrayItem.vue.js +309 -0
- package/lib/components/appForm/cpns/extraItem.vue.js +144 -0
- package/lib/components/appForm/js/index.js +48 -23
- package/lib/components/appForm/js/useAppForm.js +30 -6
- package/lib/components/appForm/style/appForm.scss +53 -0
- package/lib/components/appIcon/appIcon.vue.js +2 -1
- package/lib/components/appIconBox/style/appIconBox.scss +0 -1
- package/lib/components/appInput/appInput.vue.js +103 -0
- package/lib/components/appInput/index.js +11 -0
- package/lib/components/appMenu/appMenu.vue.js +133 -0
- package/lib/components/appMenu/index.js +11 -0
- package/lib/components/appMenu/style/appMenu.scss +145 -0
- package/lib/components/appOrgCascader/appOrgCascader.vue.js +14 -10
- package/lib/components/appSearch/appSearch.vue.js +51 -207
- package/lib/components/appSearch/cpns/appSearchItem.vue.js +242 -0
- package/lib/components/appSearch/js/index.js +20 -7
- package/lib/components/appSearch/js/useAppSearch.js +10 -5
- package/lib/components/appSearch/style/appSearch.scss +10 -0
- package/lib/components/appTable/appTable.vue.js +320 -166
- package/lib/components/appTable/cpns/columnSelect.vue.js +151 -156
- package/lib/components/appTable/cpns/columnSelectItem.vue2.js +105 -111
- package/lib/components/appTable/cpns/headerItem.vue.js +102 -0
- package/lib/components/appTable/cpns/virtualTable.vue.js +564 -0
- package/lib/components/appTable/js/index.js +47 -19
- package/lib/components/appTable/js/search.js +1 -2
- package/lib/components/appTable/js/useAppTable.js +57 -13
- package/lib/components/appTable/style/appTable.scss +16 -0
- package/lib/components/appTooltip/appTooltip.vue.js +23 -12
- package/lib/components/appTree/appTree.vue.js +308 -0
- package/lib/components/appTree/index.js +11 -0
- package/lib/components/appTree/js/index.js +533 -0
- package/lib/components/appUserAvatar/appUserAvatar.vue.js +9 -8
- package/lib/components/appUserAvatar/style/appUserAvatar.scss +0 -1
- package/lib/components/appVideoPlayer/appVideoPlayer.vue.js +651 -0
- package/lib/components/appVideoPlayer/cpns/mediaLoading.vue.js +39 -0
- package/lib/components/appVideoPlayer/index.js +11 -0
- package/lib/components/appVideoPlayer/js/index.js +429 -0
- package/lib/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
- package/lib/components/appVideoPlayer/style/mediaLoading.scss +62 -0
- package/lib/components/index.js +42 -28
- package/lib/hooks/index.js +9 -0
- package/lib/hooks/useApi.js +7 -3
- package/lib/hooks/useAudioPlayerConfig.js +15 -0
- package/lib/hooks/useGlobalConfig.js +18 -7
- package/lib/hooks/useLocale.js +9 -7
- package/lib/hooks/useMixins.js +1 -1
- package/lib/hooks/usePermissionMap.js +15 -0
- package/lib/hooks/useUserAvatarMap.js +5 -2
- package/lib/hooks/useVideoPlayerConfig.js +15 -0
- package/lib/index.js +70 -28
- package/lib/locale/en.js +58 -4
- package/lib/locale/zh_CN.js +56 -6
- package/lib/make-installer.js +2 -0
- package/lib/static/hy-svg-icons.js +459 -8
- package/lib/static/protocolcheck.js +249 -0
- package/lib/style/element/element.scss +9 -0
- package/lib/style/element/index.scss +6 -3
- package/lib/style/index.scss +11 -0
- package/lib/style/theme.scss +73 -0
- package/lib/utils/date.js +25 -0
- package/lib/utils/file.js +76 -0
- package/lib/utils/form.js +57 -0
- package/lib/utils/handler.js +22 -1
- package/lib/utils/index.js +19 -0
- package/lib/utils/is.js +27 -1
- package/lib/utils/loadScript.js +37 -0
- package/lib/version.js +1 -1
- package/package.json +13 -12
- package/es/config/index.mjs +0 -1
- package/es/static/hy-svg-icons.mjs +0 -11
- package/lib/config/index.js +0 -2
|
@@ -145,7 +145,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
145
145
|
createElementVNode(
|
|
146
146
|
"span",
|
|
147
147
|
{ class: "text-sm text-main font-bold" },
|
|
148
|
-
toDisplayString(__props.dialogTitle || unref(t)("
|
|
148
|
+
toDisplayString(__props.dialogTitle || unref(t)("dialog.prompt")),
|
|
149
149
|
1
|
|
150
150
|
/* TEXT */
|
|
151
151
|
),
|
|
@@ -212,7 +212,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
212
212
|
}, {
|
|
213
213
|
default: withCtx(() => [
|
|
214
214
|
createTextVNode(
|
|
215
|
-
toDisplayString(__props.cancelText || unref(t)("
|
|
215
|
+
toDisplayString(__props.cancelText || unref(t)("dialog.cancel")),
|
|
216
216
|
1
|
|
217
217
|
/* TEXT */
|
|
218
218
|
)
|
|
@@ -228,7 +228,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
228
228
|
}, {
|
|
229
229
|
default: withCtx(() => [
|
|
230
230
|
createTextVNode(
|
|
231
|
-
toDisplayString(__props.submitText || unref(t)("
|
|
231
|
+
toDisplayString(__props.submitText || unref(t)("dialog.confirm")),
|
|
232
232
|
1
|
|
233
233
|
/* TEXT */
|
|
234
234
|
)
|
|
@@ -2,8 +2,8 @@ import { unref, createVNode, render } from 'vue';
|
|
|
2
2
|
import { defaultAxios } from '../../hooks/useApi.mjs';
|
|
3
3
|
import { AppConfigProvider } from '../appConfigProvider/index.mjs';
|
|
4
4
|
import _sfc_main from './appConfirmDialog.vue.mjs';
|
|
5
|
-
import { useGlobalConfig } from '../../hooks/useGlobalConfig.mjs';
|
|
6
5
|
import { useLocale } from '../../hooks/useLocale.mjs';
|
|
6
|
+
import { useGlobalConfig } from '../../hooks/useGlobalConfig.mjs';
|
|
7
7
|
|
|
8
8
|
function appConfirmMethod(config) {
|
|
9
9
|
let container = document.createDocumentFragment();
|
|
@@ -52,9 +52,9 @@ function appConfirmMethod(config) {
|
|
|
52
52
|
_sfc_main.tip = (props) => {
|
|
53
53
|
const { t } = useLocale();
|
|
54
54
|
return appConfirmMethod({
|
|
55
|
-
dialogTitle: t("
|
|
56
|
-
title: t("
|
|
57
|
-
content: t("
|
|
55
|
+
dialogTitle: t("dialog.prompt"),
|
|
56
|
+
title: t("dialog.prompt"),
|
|
57
|
+
content: t("dialog.content"),
|
|
58
58
|
showCancel: false,
|
|
59
59
|
...props
|
|
60
60
|
});
|
|
@@ -62,19 +62,19 @@ _sfc_main.tip = (props) => {
|
|
|
62
62
|
_sfc_main.confirm = (props) => {
|
|
63
63
|
const { t } = useLocale();
|
|
64
64
|
return appConfirmMethod({
|
|
65
|
-
dialogTitle: t("
|
|
66
|
-
title: t("
|
|
67
|
-
content: t("
|
|
65
|
+
dialogTitle: t("dialog.prompt"),
|
|
66
|
+
title: t("dialog.prompt"),
|
|
67
|
+
content: t("dialog.content"),
|
|
68
68
|
...props
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
71
|
_sfc_main.warning = (props) => {
|
|
72
72
|
const { t } = useLocale();
|
|
73
73
|
return appConfirmMethod({
|
|
74
|
-
dialogTitle: t("
|
|
75
|
-
title: t("
|
|
74
|
+
dialogTitle: t("dialog.riskWarning"),
|
|
75
|
+
title: t("dialog.prompt"),
|
|
76
76
|
titleClass: "text-warning",
|
|
77
|
-
content: t("
|
|
77
|
+
content: t("dialog.content"),
|
|
78
78
|
iconColor: "rgb(var(--hy-warning))",
|
|
79
79
|
...props
|
|
80
80
|
});
|
|
@@ -82,10 +82,10 @@ _sfc_main.warning = (props) => {
|
|
|
82
82
|
_sfc_main.danger = (props) => {
|
|
83
83
|
const { t } = useLocale();
|
|
84
84
|
return appConfirmMethod({
|
|
85
|
-
dialogTitle: t("
|
|
85
|
+
dialogTitle: t("dialog.dangerousOperation"),
|
|
86
86
|
titleClass: "text-danger",
|
|
87
|
-
title: t("
|
|
88
|
-
content: t("
|
|
87
|
+
title: t("dialog.prompt"),
|
|
88
|
+
content: t("dialog.content"),
|
|
89
89
|
submitType: "danger",
|
|
90
90
|
iconColor: "rgb(var(--hy-danger))",
|
|
91
91
|
...props
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { defineComponent, useModel, useTemplateRef, ref, computed, openBlock, createElementBlock, withDirectives, createVNode, unref, withCtx, createElementVNode, renderSlot, normalizeStyle, createBlock, Fragment, createCommentVNode, toDisplayString, withModifiers, vShow, mergeProps, mergeModels } from 'vue';
|
|
2
|
+
import { VueCropper } from 'vue-cropper';
|
|
3
|
+
import { ElUpload, ElImage, ElIcon, ElMessage } from 'element-plus';
|
|
4
|
+
import { User, Delete } from '@element-plus/icons-vue';
|
|
5
|
+
import { blobToDataURL, sizeToTextHandler, fileUpload } from '../../utils/file.mjs';
|
|
6
|
+
import { AppDialog } from '../appDialog/index.mjs';
|
|
7
|
+
import { useLocale } from '../../hooks/useLocale.mjs';
|
|
8
|
+
|
|
9
|
+
import "vue-cropper/dist/index.css";
|
|
10
|
+
|
|
11
|
+
import "./style/appCutter.scss";
|
|
12
|
+
|
|
13
|
+
const __default__ = defineComponent({
|
|
14
|
+
name: "AppCutter"
|
|
15
|
+
});
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
17
|
+
props: /* @__PURE__ */ mergeModels({
|
|
18
|
+
defaultImg: { type: String },
|
|
19
|
+
// 默认展示图片
|
|
20
|
+
uploadText: {
|
|
21
|
+
// 上传文本
|
|
22
|
+
type: String,
|
|
23
|
+
default: () => {
|
|
24
|
+
const { t } = useLocale();
|
|
25
|
+
return t("cutter.uploadPicture");
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
showUpload: { type: Boolean, default: true },
|
|
29
|
+
// 是否显示上传模块
|
|
30
|
+
showText: { type: Boolean, default: true },
|
|
31
|
+
// 是否显示上传提示文本
|
|
32
|
+
showDelete: { type: Boolean, default: true },
|
|
33
|
+
// 是否显示删除按钮
|
|
34
|
+
maxSize: { type: Number, default: 1024 * 1024 * 2 },
|
|
35
|
+
// 限制上传文件大小
|
|
36
|
+
accept: { type: String, default: "image/png,image/jpg,image/jpeg,image/gif" },
|
|
37
|
+
// 限制上传文件类型
|
|
38
|
+
info: { type: Boolean, default: true },
|
|
39
|
+
// 裁剪框的大小信息
|
|
40
|
+
outputSize: { type: Number, default: 1 },
|
|
41
|
+
// 裁剪生成图片的质量
|
|
42
|
+
outputType: { type: String, default: "jpeg" },
|
|
43
|
+
// 裁剪生成图片的格式
|
|
44
|
+
autoCrop: { type: Boolean, default: true },
|
|
45
|
+
// 是否默认生成截图框
|
|
46
|
+
autoCropWidth: { type: Number, default: 100 },
|
|
47
|
+
// 默认生成截图框宽度
|
|
48
|
+
autoCropHeight: { type: Number, default: 100 },
|
|
49
|
+
// 默认生成截图框高度
|
|
50
|
+
fixedBox: { type: Boolean, default: false },
|
|
51
|
+
// 固定截图框大小 不允许改变
|
|
52
|
+
fixed: { type: Boolean, default: true },
|
|
53
|
+
// 是否开启截图框宽高固定比例
|
|
54
|
+
fixedNumber: { type: Array },
|
|
55
|
+
// 截图框的宽高比例
|
|
56
|
+
full: { type: Boolean, default: true },
|
|
57
|
+
// 是否输出原图比例的截图
|
|
58
|
+
canMoveBox: { type: Boolean, default: false },
|
|
59
|
+
// 截图框能否拖动
|
|
60
|
+
original: { type: Boolean, default: false },
|
|
61
|
+
// 上传图片按照原始比例渲染
|
|
62
|
+
centerBox: { type: Boolean, default: true },
|
|
63
|
+
// 截图框是否被限制在图片里面
|
|
64
|
+
infoTrue: { type: Boolean, default: false },
|
|
65
|
+
// true 为展示真实输出图片宽高 false 展示看到的截图框宽高
|
|
66
|
+
readonly: { type: Boolean, default: false },
|
|
67
|
+
// 是否只读
|
|
68
|
+
directTransmission: { type: Boolean, default: true },
|
|
69
|
+
// 是否使用直传接口
|
|
70
|
+
onClose: Function,
|
|
71
|
+
onCancel: Function
|
|
72
|
+
}, {
|
|
73
|
+
"modelValue": { type: String },
|
|
74
|
+
"modelModifiers": {}
|
|
75
|
+
}),
|
|
76
|
+
emits: /* @__PURE__ */ mergeModels(["confirm"], ["update:modelValue"]),
|
|
77
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
78
|
+
const props = __props;
|
|
79
|
+
const emits = __emit;
|
|
80
|
+
const { t } = useLocale();
|
|
81
|
+
const modelValue = useModel(__props, "modelValue");
|
|
82
|
+
const cropperRef = useTemplateRef("cropperRef");
|
|
83
|
+
const uploadRef = useTemplateRef("uploadRef");
|
|
84
|
+
const visible = ref(false);
|
|
85
|
+
const imgSrc = ref();
|
|
86
|
+
const fileInfo = ref({
|
|
87
|
+
name: "",
|
|
88
|
+
src: ""
|
|
89
|
+
});
|
|
90
|
+
const imageSrc = computed(() => imgSrc.value || props.defaultImg);
|
|
91
|
+
const options = computed(() => ({
|
|
92
|
+
info: props.info,
|
|
93
|
+
// 裁剪框的大小信息
|
|
94
|
+
outputSize: props.outputSize,
|
|
95
|
+
// 裁剪生成图片的质量
|
|
96
|
+
outputType: props.outputType,
|
|
97
|
+
// 裁剪生成图片的格式
|
|
98
|
+
canScale: props.canScale,
|
|
99
|
+
// 图片是否允许滚轮缩放
|
|
100
|
+
autoCrop: props.autoCrop,
|
|
101
|
+
// 是否默认生成截图框
|
|
102
|
+
autoCropWidth: props.autoCropWidth,
|
|
103
|
+
// 默认生成截图框宽度
|
|
104
|
+
autoCropHeight: props.autoCropHeight,
|
|
105
|
+
// 默认生成截图框高度
|
|
106
|
+
fixedBox: props.fixedBox,
|
|
107
|
+
// 固定截图框大小 不允许改变
|
|
108
|
+
fixed: props.fixed,
|
|
109
|
+
// 是否开启截图框宽高固定比例
|
|
110
|
+
fixedNumber: props.fixedNumber,
|
|
111
|
+
// 截图框的宽高比例
|
|
112
|
+
full: props.full,
|
|
113
|
+
// 是否输出原图比例的截图
|
|
114
|
+
canMoveBox: props.canMoveBox,
|
|
115
|
+
// 截图框能否拖动
|
|
116
|
+
original: props.original,
|
|
117
|
+
// 上传图片按照原始比例渲染
|
|
118
|
+
centerBox: props.centerBox,
|
|
119
|
+
// 截图框是否被限制在图片里面
|
|
120
|
+
infoTrue: props.infoTrue,
|
|
121
|
+
// true 为展示真实输出图片宽高 false 展示看到的截图框宽高
|
|
122
|
+
...customOptions.value
|
|
123
|
+
}));
|
|
124
|
+
const customOptions = ref({});
|
|
125
|
+
let customSubmit = null;
|
|
126
|
+
let customCancel = null;
|
|
127
|
+
let customClose = null;
|
|
128
|
+
async function beforeAvatarUpload(file) {
|
|
129
|
+
const limit = file.size < props.maxSize;
|
|
130
|
+
if (!limit) {
|
|
131
|
+
ElMessage.error(
|
|
132
|
+
t("cutter.uploadPictureLimit", [sizeToTextHandler(props.maxSize)])
|
|
133
|
+
);
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
const result = await blobToDataURL(file);
|
|
137
|
+
openCutter(result, file.name);
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
function openCutter(src, name) {
|
|
141
|
+
visible.value = true;
|
|
142
|
+
fileInfo.value.src = src;
|
|
143
|
+
fileInfo.value.name = name;
|
|
144
|
+
}
|
|
145
|
+
function onClearHandler() {
|
|
146
|
+
imgSrc.value = "";
|
|
147
|
+
modelValue.value = null;
|
|
148
|
+
fileInfo.value = {
|
|
149
|
+
name: "",
|
|
150
|
+
src: ""
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
async function onSubmitHandler() {
|
|
154
|
+
return new Promise((resolve, reject) => {
|
|
155
|
+
cropperRef.value.getCropBlob(async (data) => {
|
|
156
|
+
data.name = fileInfo.value.name;
|
|
157
|
+
const res = await fileUpload(data, props.directTransmission).catch(
|
|
158
|
+
(res2) => {
|
|
159
|
+
ElMessage.error(res2.msg || res2);
|
|
160
|
+
reject();
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
if (res.code === 200) {
|
|
164
|
+
const url = await blobToDataURL(data);
|
|
165
|
+
const key = res.data?.key || res.data?.url || res.data;
|
|
166
|
+
imgSrc.value = url;
|
|
167
|
+
modelValue.value = key;
|
|
168
|
+
if (customSubmit) {
|
|
169
|
+
await customSubmit({ url, key });
|
|
170
|
+
}
|
|
171
|
+
emits("confirm", { url, key });
|
|
172
|
+
resolve();
|
|
173
|
+
} else {
|
|
174
|
+
ElMessage.error(res.msg || res);
|
|
175
|
+
reject();
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
async function onCancelHandler() {
|
|
181
|
+
if (customCancel) {
|
|
182
|
+
return await customCancel();
|
|
183
|
+
}
|
|
184
|
+
if (props.onCancel) {
|
|
185
|
+
return await props.onCancel();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async function onCloseHandler() {
|
|
189
|
+
if (customCancel) {
|
|
190
|
+
return await customClose();
|
|
191
|
+
}
|
|
192
|
+
if (props.onClose) {
|
|
193
|
+
return await props.onClose();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
__expose({
|
|
197
|
+
open: async (params) => {
|
|
198
|
+
const {
|
|
199
|
+
url,
|
|
200
|
+
fileName = "img.png",
|
|
201
|
+
options: options2,
|
|
202
|
+
file,
|
|
203
|
+
onSubmit,
|
|
204
|
+
onCancel,
|
|
205
|
+
onClose
|
|
206
|
+
} = params || {};
|
|
207
|
+
if (file) {
|
|
208
|
+
const result = await blobToDataURL(file);
|
|
209
|
+
openCutter(result, file.name);
|
|
210
|
+
} else if (url) {
|
|
211
|
+
openCutter(url, fileName);
|
|
212
|
+
} else {
|
|
213
|
+
uploadRef.value.click();
|
|
214
|
+
}
|
|
215
|
+
customOptions.value = options2 || {};
|
|
216
|
+
customClose = async () => {
|
|
217
|
+
if (onClose) {
|
|
218
|
+
await onClose();
|
|
219
|
+
}
|
|
220
|
+
customOptions.value = {};
|
|
221
|
+
};
|
|
222
|
+
customCancel = async () => {
|
|
223
|
+
if (onCancel) {
|
|
224
|
+
await onCancel();
|
|
225
|
+
}
|
|
226
|
+
customOptions.value = {};
|
|
227
|
+
};
|
|
228
|
+
customSubmit = async (value) => {
|
|
229
|
+
await onSubmit(value);
|
|
230
|
+
customOptions.value = {};
|
|
231
|
+
};
|
|
232
|
+
},
|
|
233
|
+
clear: onClearHandler
|
|
234
|
+
});
|
|
235
|
+
return (_ctx, _cache) => {
|
|
236
|
+
return openBlock(), createElementBlock("div", { class: "inline-block" }, [
|
|
237
|
+
withDirectives(createVNode(unref(ElUpload), {
|
|
238
|
+
accept: ".png,.jpg,.gif,.jpeg",
|
|
239
|
+
"before-upload": beforeAvatarUpload,
|
|
240
|
+
action: "",
|
|
241
|
+
class: "upload_box",
|
|
242
|
+
"show-file-list": false,
|
|
243
|
+
disabled: __props.readonly
|
|
244
|
+
}, {
|
|
245
|
+
default: withCtx(() => [
|
|
246
|
+
createElementVNode(
|
|
247
|
+
"div",
|
|
248
|
+
{
|
|
249
|
+
ref_key: "uploadRef",
|
|
250
|
+
ref: uploadRef,
|
|
251
|
+
class: "app-cutter-upload-box"
|
|
252
|
+
},
|
|
253
|
+
[
|
|
254
|
+
renderSlot(_ctx.$slots, "default", { src: imgSrc.value }, () => [
|
|
255
|
+
createElementVNode(
|
|
256
|
+
"div",
|
|
257
|
+
{
|
|
258
|
+
class: "app-cutter-upload-card",
|
|
259
|
+
style: normalizeStyle({
|
|
260
|
+
width: `${__props.autoCropWidth}px`,
|
|
261
|
+
height: `${__props.autoCropHeight}px`
|
|
262
|
+
})
|
|
263
|
+
},
|
|
264
|
+
[
|
|
265
|
+
modelValue.value && imageSrc.value ? (openBlock(), createBlock(unref(ElImage), {
|
|
266
|
+
key: 0,
|
|
267
|
+
src: imageSrc.value,
|
|
268
|
+
style: normalizeStyle({
|
|
269
|
+
width: `${__props.autoCropWidth}px`,
|
|
270
|
+
height: `${__props.autoCropHeight}px`
|
|
271
|
+
})
|
|
272
|
+
}, null, 8, ["src", "style"])) : (openBlock(), createElementBlock(
|
|
273
|
+
Fragment,
|
|
274
|
+
{ key: 1 },
|
|
275
|
+
[
|
|
276
|
+
createCommentVNode(' <AppIcon\n v-else\n svg-name="emptyHead"\n style="width: 70px; height: 70px"\n /> '),
|
|
277
|
+
createVNode(unref(ElIcon), {
|
|
278
|
+
color: "rgb(var(--hy-auxiliary))",
|
|
279
|
+
size: "64"
|
|
280
|
+
}, {
|
|
281
|
+
default: withCtx(() => [
|
|
282
|
+
createVNode(unref(User))
|
|
283
|
+
]),
|
|
284
|
+
_: 1
|
|
285
|
+
/* STABLE */
|
|
286
|
+
})
|
|
287
|
+
],
|
|
288
|
+
2112
|
|
289
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
290
|
+
))
|
|
291
|
+
],
|
|
292
|
+
4
|
|
293
|
+
/* STYLE */
|
|
294
|
+
)
|
|
295
|
+
]),
|
|
296
|
+
__props.uploadText && __props.showText ? (openBlock(), createElementBlock(
|
|
297
|
+
"div",
|
|
298
|
+
{
|
|
299
|
+
key: 0,
|
|
300
|
+
class: "app-cutter-tip"
|
|
301
|
+
},
|
|
302
|
+
toDisplayString(__props.uploadText),
|
|
303
|
+
1
|
|
304
|
+
/* TEXT */
|
|
305
|
+
)) : createCommentVNode("v-if", true),
|
|
306
|
+
__props.showDelete ? withDirectives((openBlock(), createElementBlock("div", {
|
|
307
|
+
key: 1,
|
|
308
|
+
class: "app-cutter-delete",
|
|
309
|
+
onClick: withModifiers(($event) => onClearHandler(), ["stop"])
|
|
310
|
+
}, [
|
|
311
|
+
createCommentVNode(' <AppIcon svg-name="delete" /> '),
|
|
312
|
+
createVNode(unref(ElIcon), { color: "rgb(var(--hy-danger-2))" }, {
|
|
313
|
+
default: withCtx(() => [
|
|
314
|
+
createVNode(unref(Delete))
|
|
315
|
+
]),
|
|
316
|
+
_: 1
|
|
317
|
+
/* STABLE */
|
|
318
|
+
})
|
|
319
|
+
], 8, ["onClick"])), [
|
|
320
|
+
[vShow, modelValue.value]
|
|
321
|
+
]) : createCommentVNode("v-if", true)
|
|
322
|
+
],
|
|
323
|
+
512
|
|
324
|
+
/* NEED_PATCH */
|
|
325
|
+
)
|
|
326
|
+
]),
|
|
327
|
+
_: 3
|
|
328
|
+
/* FORWARDED */
|
|
329
|
+
}, 8, ["disabled"]), [
|
|
330
|
+
[vShow, __props.showUpload]
|
|
331
|
+
]),
|
|
332
|
+
createVNode(unref(AppDialog), mergeProps({
|
|
333
|
+
modelValue: visible.value,
|
|
334
|
+
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
335
|
+
title: unref(t)("cutter.imageSegmentation")
|
|
336
|
+
}, _ctx.$attrs, {
|
|
337
|
+
onClose: onCloseHandler,
|
|
338
|
+
onCancel: onCancelHandler,
|
|
339
|
+
onSubmit: onSubmitHandler
|
|
340
|
+
}), {
|
|
341
|
+
default: withCtx(() => [
|
|
342
|
+
createElementVNode("div", { class: "h-[500px]" }, [
|
|
343
|
+
createVNode(unref(VueCropper), mergeProps({
|
|
344
|
+
ref_key: "cropperRef",
|
|
345
|
+
ref: cropperRef,
|
|
346
|
+
img: fileInfo.value.src
|
|
347
|
+
}, options.value), null, 16, ["img"])
|
|
348
|
+
])
|
|
349
|
+
]),
|
|
350
|
+
_: 1
|
|
351
|
+
/* STABLE */
|
|
352
|
+
}, 16, ["modelValue", "onUpdate:modelValue", "title"])
|
|
353
|
+
]);
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.app-cutter-upload-box {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
position: relative;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
.app-cutter-delete {
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 23px;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
position: absolute;
|
|
13
|
+
bottom: -23px;
|
|
14
|
+
z-index: 3;
|
|
15
|
+
transition: all 0.3s;
|
|
16
|
+
background: rgba(0, 0, 0, 0.6);
|
|
17
|
+
}
|
|
18
|
+
.app-cutter-tip {
|
|
19
|
+
width: 100%;
|
|
20
|
+
position: absolute;
|
|
21
|
+
left: 50%;
|
|
22
|
+
top: 50%;
|
|
23
|
+
transform: translate(-50%, -50%);
|
|
24
|
+
z-index: 3;
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
color: rgb(var(--hy-theme));
|
|
27
|
+
text-align: center;
|
|
28
|
+
user-select: none;
|
|
29
|
+
opacity: 0;
|
|
30
|
+
transition: all 0.3s;
|
|
31
|
+
}
|
|
32
|
+
&:hover {
|
|
33
|
+
.app-cutter-delete {
|
|
34
|
+
bottom: 0;
|
|
35
|
+
}
|
|
36
|
+
.app-cutter-tip {
|
|
37
|
+
opacity: 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
.app-cutter-upload-card {
|
|
41
|
+
width: 70px;
|
|
42
|
+
height: 70px;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
border: 1px solid rgb(var(--hy-border));
|
|
47
|
+
border-radius: 4px;
|
|
48
|
+
background-color: rgb(var(--hy-background-2));
|
|
49
|
+
position: relative;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -61,7 +61,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
61
61
|
startValue.value = value[0] ? `${value[0]}${isFill ? " 00:00:00" : ""}` : null;
|
|
62
62
|
endValue.value = value[1] ? `${value[1]}${isFill ? " 23:59:59" : ""}` : null;
|
|
63
63
|
} else {
|
|
64
|
-
dateValue.value = isFill &&
|
|
64
|
+
dateValue.value = isFill && value?.length ? [`${value[0]} 00:00:00`, `${value[1]} 23:59:59`] : value;
|
|
65
65
|
}
|
|
66
66
|
emits("change", dateValue.value);
|
|
67
67
|
}
|