@fangzhongya/fang-ui 0.0.98 → 0.0.99
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/components/alert/src/index2.cjs +11 -11
- package/dist/components/array/src/index2.cjs +45 -45
- package/dist/components/audios/src/index2.cjs +54 -54
- package/dist/components/autocomplete/src/index2.cjs +11 -11
- package/dist/components/box/src/index2.cjs +21 -21
- package/dist/components/box-adjust/index.css +17 -0
- package/dist/components/box-adjust/index.scss +18 -0
- package/dist/components/box-adjust/src/data.cjs +17 -1
- package/dist/components/box-adjust/src/data.d.ts +16 -0
- package/dist/components/box-adjust/src/data.js +17 -1
- package/dist/components/box-adjust/src/index2.cjs +69 -35
- package/dist/components/box-adjust/src/index2.js +37 -3
- package/dist/components/box-local/src/index2.cjs +20 -20
- package/dist/components/box-mask/src/index2.cjs +5 -5
- package/dist/components/box-teleport/src/index2.cjs +5 -5
- package/dist/components/box-title/src/index2.cjs +15 -15
- package/dist/components/button/src/index2.cjs +11 -11
- package/dist/components/buttons/src/index2.cjs +20 -20
- package/dist/components/card/src/index2.cjs +11 -11
- package/dist/components/cascader/src/index2.cjs +11 -11
- package/dist/components/cascader-panel/src/index2.cjs +11 -11
- package/dist/components/cascaders/src/index2.cjs +17 -17
- package/dist/components/checkbox/src/index2.cjs +11 -11
- package/dist/components/checkbox-button/src/index2.cjs +11 -11
- package/dist/components/checkbox-group/src/index2.cjs +11 -11
- package/dist/components/checks/src/index2.cjs +31 -31
- package/dist/components/choice-select/src/index2.cjs +5 -5
- package/dist/components/collapse/src/index2.cjs +11 -11
- package/dist/components/collapse-item/src/index2.cjs +11 -11
- package/dist/components/color-picker/src/index2.cjs +11 -11
- package/dist/components/common/list.cjs +5 -5
- package/dist/components/common/use.cjs +5 -5
- package/dist/components/company-select/src/index2.cjs +19 -19
- package/dist/components/config-provider/src/index2.cjs +11 -11
- package/dist/components/date-picker/src/index2.cjs +11 -11
- package/dist/components/date-picker/style/element.scss +1 -1
- package/dist/components/date-picker-panel/src/index2.cjs +11 -11
- package/dist/components/dates/src/index2.cjs +12 -12
- package/dist/components/dates-divide/src/index2.cjs +20 -20
- package/dist/components/dates-picker/src/index2.cjs +15 -15
- package/dist/components/dates2/src/index2.cjs +26 -26
- package/dist/components/department-select/src/index2.cjs +10 -10
- package/dist/components/dialog/src/index2.cjs +11 -11
- package/dist/components/dialogs/src/index2.cjs +23 -23
- package/dist/components/divider/src/index2.cjs +11 -11
- package/dist/components/drawer/src/index2.cjs +11 -11
- package/dist/components/dropdown/src/index2.cjs +11 -11
- package/dist/components/dropdown-item/src/index2.cjs +11 -11
- package/dist/components/dropdown-menu/src/index2.cjs +11 -11
- package/dist/components/edit/src/index2.cjs +24 -24
- package/dist/components/edit-float/src/index2.cjs +40 -40
- package/dist/components/form/src/index2.cjs +11 -11
- package/dist/components/form-item/src/index2.cjs +11 -11
- package/dist/components/forms/index.css +22 -0
- package/dist/components/forms/src/index2.cjs +65 -65
- package/dist/components/forms/src/setup.cjs +12 -12
- package/dist/components/forms-div/src/index2.cjs +11 -11
- package/dist/components/forms-drag/src/index2.cjs +73 -73
- package/dist/components/forms-item/src/index2.cjs +45 -45
- package/dist/components/forms-item/src/label.cjs +4 -4
- package/dist/components/forms-items/src/index2.cjs +23 -23
- package/dist/components/full-screen/src/index2.cjs +11 -11
- package/dist/components/global-config/src/index.cjs +5 -5
- package/dist/components/history/src/index2.cjs +26 -26
- package/dist/components/icon/src/index2.cjs +23 -23
- package/dist/components/icon-picker/src/index2.cjs +52 -52
- package/dist/components/iframe/src/data.cjs +1 -1
- package/dist/components/iframe/src/data.js +1 -1
- package/dist/components/iframe/src/index2.cjs +15 -10
- package/dist/components/iframe/src/index2.js +5 -0
- package/dist/components/image/src/index2.cjs +11 -11
- package/dist/components/image-viewer/src/index2.cjs +11 -11
- package/dist/components/images/src/index2.cjs +17 -17
- package/dist/components/input/src/index2.cjs +11 -11
- package/dist/components/input-array/src/index2.cjs +38 -38
- package/dist/components/input-history/src/index2.cjs +47 -47
- package/dist/components/input-history/src/util.cjs +4 -4
- package/dist/components/input-num/src/index2.cjs +17 -17
- package/dist/components/input-number/src/index2.cjs +11 -11
- package/dist/components/input-select/src/index2.cjs +51 -51
- package/dist/components/input-tag/src/index2.cjs +11 -11
- package/dist/components/inputs/src/index2.cjs +17 -17
- package/dist/components/keep-com/src/index2.cjs +16 -16
- package/dist/components/labels/src/index2.cjs +13 -13
- package/dist/components/list/src/index2.cjs +24 -24
- package/dist/components/lists/src/index2.cjs +51 -51
- package/dist/components/listsp/src/index2.cjs +35 -35
- package/dist/components/mention/src/index2.cjs +11 -11
- package/dist/components/menu/src/index2.cjs +11 -11
- package/dist/components/menu-item/src/index2.cjs +11 -11
- package/dist/components/menu-item-group/src/index2.cjs +11 -11
- package/dist/components/menus/src/index2.cjs +16 -16
- package/dist/components/menus/src/menu-ll2.cjs +11 -11
- package/dist/components/no-data/src/index2.cjs +5 -5
- package/dist/components/option/src/index2.cjs +10 -10
- package/dist/components/option-group/src/index2.cjs +11 -11
- package/dist/components/page/index.css +22 -0
- package/dist/components/page/src/index2.cjs +77 -77
- package/dist/components/page/src/set-column2.cjs +54 -54
- package/dist/components/pagination/src/index2.cjs +11 -11
- package/dist/components/paging/src/index2.cjs +13 -13
- package/dist/components/popconfirm/src/index2.cjs +11 -11
- package/dist/components/popover/src/index2.cjs +11 -11
- package/dist/components/popup/src/index2.cjs +29 -29
- package/dist/components/radio/src/index2.cjs +11 -11
- package/dist/components/radio-button/src/index2.cjs +11 -11
- package/dist/components/radio-group/src/index2.cjs +11 -11
- package/dist/components/retract/src/index2.cjs +14 -14
- package/dist/components/right-key/src/index2.cjs +30 -30
- package/dist/components/role-select/src/index2.cjs +38 -38
- package/dist/components/scrollbar/src/index2.cjs +11 -11
- package/dist/components/seamless-scroll/src/index2.cjs +24 -24
- package/dist/components/select/src/index2.cjs +11 -11
- package/dist/components/select-dialog/src/index2.cjs +65 -65
- package/dist/components/select-popover/src/index2.cjs +41 -41
- package/dist/components/select-scroll/src/index2.cjs +30 -30
- package/dist/components/selector/src/index2.cjs +39 -39
- package/dist/components/selects/src/index2.cjs +20 -20
- package/dist/components/slider/src/index2.cjs +11 -11
- package/dist/components/sliders/src/index2.cjs +13 -13
- package/dist/components/stick-div/src/index2.cjs +17 -17
- package/dist/components/stick-edge/src/index2.cjs +10 -10
- package/dist/components/stick-window/src/index2.cjs +22 -22
- package/dist/components/sub-menu/src/index2.cjs +10 -10
- package/dist/components/switch/src/index2.cjs +11 -11
- package/dist/components/switchs/src/index2.cjs +15 -15
- package/dist/components/tab-pane/src/index2.cjs +11 -11
- package/dist/components/table/src/index2.cjs +11 -11
- package/dist/components/table-column/src/index2.cjs +11 -11
- package/dist/components/tables/common/img2.cjs +7 -7
- package/dist/components/tables/common/pagin.cjs +16 -16
- package/dist/components/tables/common/table-but2.cjs +10 -10
- package/dist/components/tables/common/table-color2.cjs +7 -7
- package/dist/components/tables/common/table-list2.cjs +9 -9
- package/dist/components/tables/common/util.cjs +2 -2
- package/dist/components/tables/src/column.cjs +5 -5
- package/dist/components/tables/src/columns2.cjs +2 -2
- package/dist/components/tables/src/columns3.cjs +2 -2
- package/dist/components/tables/src/index2.cjs +29 -29
- package/dist/components/tablesp/src/index2.cjs +36 -36
- package/dist/components/tabless/src/index2.cjs +49 -49
- package/dist/components/tablesv/src/column.cjs +16 -16
- package/dist/components/tablesv/src/columns2.cjs +2 -2
- package/dist/components/tablesv/src/columns3.cjs +2 -2
- package/dist/components/tablesv/src/index2.cjs +30 -30
- package/dist/components/tablesvp/src/index2.cjs +30 -30
- package/dist/components/tabs/src/index2.cjs +11 -11
- package/dist/components/tag/src/index2.cjs +11 -11
- package/dist/components/text/src/index2.cjs +11 -11
- package/dist/components/text/style/element.scss +1 -1
- package/dist/components/texts/src/index2.cjs +8 -8
- package/dist/components/time-picker/src/index2.cjs +11 -11
- package/dist/components/time-select/src/index2.cjs +11 -11
- package/dist/components/tooltip/src/index2.cjs +11 -11
- package/dist/components/transfer/src/index2.cjs +11 -11
- package/dist/components/tree/src/index2.cjs +11 -11
- package/dist/components/tree-select/src/index2.cjs +11 -11
- package/dist/components/tree-select-box/src/index2.cjs +29 -29
- package/dist/components/upload/src/index2.cjs +11 -11
- package/dist/components/uploads/index.css +22 -0
- package/dist/components/uploads/index.scss +23 -0
- package/dist/components/uploads/src/index2.cjs +128 -138
- package/dist/components/uploads/src/index2.js +61 -71
- package/dist/components/uploads/src/util.cjs +80 -0
- package/dist/components/uploads/src/util.d.ts +10 -0
- package/dist/components/uploads/src/util.js +80 -0
- package/dist/components/uploads/src/views.cjs +4 -0
- package/dist/components/uploads/src/views.js +4 -0
- package/dist/components/uploads/src/views2.cjs +77 -0
- package/dist/components/uploads/src/views2.js +77 -0
- package/dist/components/user-select/src/index2.cjs +99 -99
- package/dist/components/videos/src/index2.cjs +97 -97
- package/dist/components/window/src/index2.cjs +61 -61
- package/dist/css/box-adjust.css +17 -0
- package/dist/css/forms.css +22 -0
- package/dist/css/index.css +39 -0
- package/dist/css/page.css +22 -0
- package/dist/css/uploads.css +22 -0
- package/dist/directives/scroll/index.cjs +6 -24
- package/dist/directives/scroll/index.js +1 -3
- package/dist/hooks/event-aliass/index.cjs +2 -2
- package/dist/hooks/full-screen/index.cjs +5 -5
- package/dist/hooks/global-config/index.cjs +8 -8
- package/dist/hooks/inherit/index.cjs +2 -2
- package/dist/hooks/locale/index.cjs +7 -7
- package/dist/icons/iconify.cjs +3 -3
- package/dist/icons/index.css +79 -79
- package/dist/icons/index.json +35 -35
- package/dist/icons/vue/bar.cjs +3 -3
- package/dist/icons/vue/below.cjs +3 -3
- package/dist/icons/vue/bicycle.cjs +3 -3
- package/dist/icons/vue/bottom-left.cjs +4 -4
- package/dist/icons/vue/bottom-right.cjs +4 -4
- package/dist/icons/vue/bottom.cjs +3 -3
- package/dist/icons/vue/catalogue.cjs +5 -5
- package/dist/icons/vue/clear.cjs +5 -5
- package/dist/icons/vue/close.cjs +3 -3
- package/dist/icons/vue/delete.cjs +3 -3
- package/dist/icons/vue/document.cjs +5 -5
- package/dist/icons/vue/down.cjs +3 -3
- package/dist/icons/vue/download.cjs +3 -3
- package/dist/icons/vue/edit.cjs +5 -5
- package/dist/icons/vue/enter.cjs +3 -3
- package/dist/icons/vue/frame.cjs +3 -3
- package/dist/icons/vue/left.cjs +3 -3
- package/dist/icons/vue/mute.cjs +3 -3
- package/dist/icons/vue/pause.cjs +4 -4
- package/dist/icons/vue/play.cjs +3 -3
- package/dist/icons/vue/plus.cjs +3 -3
- package/dist/icons/vue/retreat.cjs +3 -3
- package/dist/icons/vue/right.cjs +3 -3
- package/dist/icons/vue/sound.cjs +4 -4
- package/dist/icons/vue/star.cjs +4 -4
- package/dist/icons/vue/up.cjs +3 -3
- package/dist/icons/vue/views.cjs +5 -5
- package/dist/icons/vue/views.js +2 -2
- package/dist/index.css +39 -0
- package/dist/utils/vues/common.cjs +2 -2
- package/package.json +3 -3
- /package/dist/components/{alert → divider}/index.css +0 -0
- /package/dist/css/{alert.css → divider.css} +0 -0
|
@@ -2,13 +2,12 @@ import { defineComponent, ref, useAttrs, computed, reactive, createElementBlock,
|
|
|
2
2
|
import Document from "../../../icons/vue/document.js";
|
|
3
3
|
import Download from "../../../icons/vue/download.js";
|
|
4
4
|
import Plus from "../../../icons/vue/plus.js";
|
|
5
|
-
import
|
|
5
|
+
import IconViews from "../../../icons/vue/views.js";
|
|
6
6
|
import Delete from "../../../icons/vue/delete.js";
|
|
7
7
|
import { Icon } from "../../icon/index.js";
|
|
8
8
|
import { Upload } from "../../upload/index.js";
|
|
9
9
|
import { Message } from "../../message/index.js";
|
|
10
10
|
import { Image } from "../../image/index.js";
|
|
11
|
-
import { ImageViewer } from "../../image-viewer/index.js";
|
|
12
11
|
import { useInherit } from "../../../hooks/inherit/index.js";
|
|
13
12
|
import { useCssName } from "../../../hooks/cssname/index.js";
|
|
14
13
|
import { useExpose } from "../../../hooks/expose/index.js";
|
|
@@ -17,6 +16,10 @@ import { useLocale } from "../../../hooks/locale/index.js";
|
|
|
17
16
|
import { getUrlCatalogueObj } from "@fangzhongya/utils/urls/getUrlCatalogueObj";
|
|
18
17
|
import { downloadFromURL } from "@fangzhongya/utils/window/download";
|
|
19
18
|
import { getListValue } from "../../players/common/util.js";
|
|
19
|
+
import { getType, getListType } from "./util.js";
|
|
20
|
+
import { useDisabled } from "element-plus/es/components/form/index";
|
|
21
|
+
import "./views.js";
|
|
22
|
+
import _sfc_main$1 from "./views2.js";
|
|
20
23
|
const _hoisted_1 = ["title"];
|
|
21
24
|
const _hoisted_2 = ["onClick", "title"];
|
|
22
25
|
const _hoisted_3 = ["onClick", "title"];
|
|
@@ -38,6 +41,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
38
41
|
const value = listFuObj.value;
|
|
39
42
|
const multiple = listFuObj.multiple;
|
|
40
43
|
const isloading = ref(false);
|
|
44
|
+
const disabled = useDisabled();
|
|
41
45
|
const accept = computed(() => {
|
|
42
46
|
if (props.accept) {
|
|
43
47
|
return props.accept;
|
|
@@ -57,54 +61,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
57
61
|
return "";
|
|
58
62
|
}
|
|
59
63
|
});
|
|
60
|
-
const getExtension = (fileName) => {
|
|
61
|
-
const extension = fileName.toLowerCase();
|
|
62
|
-
if (extension) {
|
|
63
|
-
const ks = Object.keys(types);
|
|
64
|
-
for (let index = 0; index < ks.length; index++) {
|
|
65
|
-
const key = ks[index];
|
|
66
|
-
if (types[key].includes(extension)) {
|
|
67
|
-
return key;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return "";
|
|
72
|
-
};
|
|
73
|
-
const getType = (accept2 = "") => {
|
|
74
|
-
if (accept2) {
|
|
75
|
-
if (accept2.includes("image/")) {
|
|
76
|
-
return "i";
|
|
77
|
-
} else if (accept2.includes("audio/")) {
|
|
78
|
-
return "a";
|
|
79
|
-
} else if (accept2.includes("video/")) {
|
|
80
|
-
return "v";
|
|
81
|
-
} else {
|
|
82
|
-
const extension = accept2.toLowerCase().split(",")[0];
|
|
83
|
-
return getExtension(extension);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return "";
|
|
87
|
-
};
|
|
88
64
|
const type = computed(() => {
|
|
89
65
|
return props.type ?? getType(accept.value);
|
|
90
66
|
});
|
|
91
|
-
const getListType = (obj) => {
|
|
92
|
-
if (props.type) {
|
|
93
|
-
return props.type;
|
|
94
|
-
}
|
|
95
|
-
if (obj) {
|
|
96
|
-
if (obj.type) {
|
|
97
|
-
return obj.type;
|
|
98
|
-
} else {
|
|
99
|
-
let v = getUrlCatalogueObj(obj.url);
|
|
100
|
-
if (v.suffix) {
|
|
101
|
-
return getExtension("." + v.suffix);
|
|
102
|
-
}
|
|
103
|
-
return getType(accept.value);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return "";
|
|
107
|
-
};
|
|
108
67
|
const getFileList = (arr) => {
|
|
109
68
|
if (props.formatter) {
|
|
110
69
|
return arr.map((v) => {
|
|
@@ -125,11 +84,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
125
84
|
}
|
|
126
85
|
});
|
|
127
86
|
const isUp = computed(() => {
|
|
128
|
-
if (
|
|
129
|
-
|
|
87
|
+
if (disabled.value) {
|
|
88
|
+
if (value.value && value.value.length > 0) {
|
|
89
|
+
return false;
|
|
90
|
+
} else {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
130
93
|
}
|
|
131
94
|
if (multiple.value) {
|
|
132
|
-
if (!value.value) {
|
|
95
|
+
if (!value.value || value.value.length == 0) {
|
|
133
96
|
return true;
|
|
134
97
|
}
|
|
135
98
|
if (props.limit) {
|
|
@@ -158,7 +121,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
158
121
|
if (typeof props.isViews === "boolean") {
|
|
159
122
|
return true;
|
|
160
123
|
} else {
|
|
161
|
-
const type2 = getListType(item);
|
|
124
|
+
const type2 = getListType(item, props.type, accept.value);
|
|
162
125
|
if (props.isViews.includes(type2)) {
|
|
163
126
|
return true;
|
|
164
127
|
}
|
|
@@ -293,7 +256,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
293
256
|
class: normalizeClass(unref(cs).z("list-li")),
|
|
294
257
|
key: index
|
|
295
258
|
}, [
|
|
296
|
-
renderSlot(_ctx.$slots, unref(dataSlot).default, {
|
|
259
|
+
renderSlot(_ctx.$slots, unref(dataSlot).default, {
|
|
260
|
+
value: item,
|
|
261
|
+
type: props.type,
|
|
262
|
+
accept: accept.value,
|
|
263
|
+
disabled: unref(disabled)
|
|
264
|
+
}, () => {
|
|
297
265
|
var _a;
|
|
298
266
|
return [
|
|
299
267
|
createElementVNode("div", {
|
|
@@ -312,19 +280,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
312
280
|
_: 1
|
|
313
281
|
})
|
|
314
282
|
], 8, _hoisted_2)) : createCommentVNode("", true),
|
|
315
|
-
|
|
283
|
+
props.isViews ? (openBlock(), createElementBlock("span", {
|
|
316
284
|
key: 1,
|
|
317
285
|
onClick: ($event) => onViews(item, index),
|
|
318
286
|
title: unref(getLocale)("upload.views")
|
|
319
287
|
}, [
|
|
320
288
|
createVNode(unref(Icon), null, {
|
|
321
289
|
default: withCtx(() => [
|
|
322
|
-
createVNode(
|
|
290
|
+
createVNode(IconViews)
|
|
323
291
|
]),
|
|
324
292
|
_: 1
|
|
325
293
|
})
|
|
326
294
|
], 8, _hoisted_3)) : createCommentVNode("", true),
|
|
327
|
-
!(
|
|
295
|
+
!(unref(disabled) || item.disabled) ? (openBlock(), createElementBlock("span", {
|
|
328
296
|
key: 2,
|
|
329
297
|
class: normalizeClass(unref(cs).z("list-li-operation-delete")),
|
|
330
298
|
onClick: ($event) => onDelete(item, index),
|
|
@@ -341,12 +309,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
341
309
|
createElementVNode("div", {
|
|
342
310
|
class: normalizeClass(unref(cs).z("list-li-value"))
|
|
343
311
|
}, [
|
|
344
|
-
getListType
|
|
312
|
+
unref(getListType)(
|
|
313
|
+
item,
|
|
314
|
+
props.type,
|
|
315
|
+
accept.value
|
|
316
|
+
).startsWith("i") ? (openBlock(), createBlock(unref(Image), {
|
|
345
317
|
key: 0,
|
|
346
318
|
class: normalizeClass(unref(cs).z("list-li-value-img")),
|
|
347
319
|
fit: "cover",
|
|
348
320
|
src: item.url
|
|
349
|
-
},
|
|
321
|
+
}, {
|
|
322
|
+
error: withCtx(() => {
|
|
323
|
+
var _a2;
|
|
324
|
+
return [
|
|
325
|
+
createElementVNode("div", {
|
|
326
|
+
class: normalizeClass(unref(cs).z("list-li-value-img-error"))
|
|
327
|
+
}, toDisplayString(((_a2 = unref(getUrlCatalogueObj)(item.url)) == null ? void 0 : _a2.name) || item.url), 3)
|
|
328
|
+
];
|
|
329
|
+
}),
|
|
330
|
+
_: 2
|
|
331
|
+
}, 1032, ["class", "src"])) : (openBlock(), createElementBlock("div", {
|
|
350
332
|
key: 1,
|
|
351
333
|
class: normalizeClass(unref(cs).z("list-li-value-document"))
|
|
352
334
|
}, [
|
|
@@ -364,27 +346,32 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
364
346
|
})
|
|
365
347
|
], 2);
|
|
366
348
|
}), 128)),
|
|
367
|
-
|
|
349
|
+
props.isViews ? (openBlock(), createElementBlock("div", {
|
|
368
350
|
key: 0,
|
|
369
351
|
class: normalizeClass(unref(cs).z("list-views"))
|
|
370
352
|
}, [
|
|
371
|
-
renderSlot(_ctx.$slots, unref(dataSlot).views, {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
353
|
+
renderSlot(_ctx.$slots, unref(dataSlot).views, {
|
|
354
|
+
type: props.type,
|
|
355
|
+
accept: accept.value,
|
|
356
|
+
value: views.value,
|
|
357
|
+
show: views.show,
|
|
358
|
+
onClose: _cache[0] || (_cache[0] = ($event) => views.show = false)
|
|
359
|
+
}, () => [
|
|
360
|
+
createVNode(_sfc_main$1, {
|
|
361
|
+
name: unref(dataSlot).views,
|
|
362
|
+
type: props.type,
|
|
363
|
+
accept: accept.value,
|
|
364
|
+
value: views.value,
|
|
365
|
+
show: views.show,
|
|
366
|
+
onClose: _cache[1] || (_cache[1] = ($event) => views.show = false)
|
|
367
|
+
}, null, 8, ["name", "type", "accept", "value", "show"])
|
|
368
|
+
])
|
|
382
369
|
], 2)) : createCommentVNode("", true)
|
|
383
370
|
], 2),
|
|
384
371
|
isUp.value ? (openBlock(), createBlock(unref(Upload), mergeProps({ key: 0 }, unref(attrs).assem, {
|
|
385
372
|
ref_key: "elRef",
|
|
386
373
|
ref: elRef,
|
|
387
|
-
disabled: isloading.value,
|
|
374
|
+
disabled: unref(disabled) || isloading.value,
|
|
388
375
|
class: unref(cs).z("upload"),
|
|
389
376
|
action: "#",
|
|
390
377
|
multiple: unref(multiple),
|
|
@@ -396,7 +383,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
396
383
|
}), {
|
|
397
384
|
trigger: withCtx(() => [
|
|
398
385
|
createElementVNode("div", {
|
|
399
|
-
class: normalizeClass(
|
|
386
|
+
class: normalizeClass([
|
|
387
|
+
unref(cs).z("upload-trigger"),
|
|
388
|
+
unref(cs).is("disabled", unref(disabled))
|
|
389
|
+
])
|
|
400
390
|
}, [
|
|
401
391
|
createVNode(unref(Icon), null, {
|
|
402
392
|
default: withCtx(() => [
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const getUrlCatalogueObj = require("@fangzhongya/utils/urls/getUrlCatalogueObj");
|
|
4
|
+
const data = require("./data.cjs");
|
|
5
|
+
require("../../players/common/util.cjs");
|
|
6
|
+
const getExtension = (fileName) => {
|
|
7
|
+
const extension = fileName.toLowerCase();
|
|
8
|
+
if (extension) {
|
|
9
|
+
const ks = Object.keys(data.types);
|
|
10
|
+
for (let index = 0; index < ks.length; index++) {
|
|
11
|
+
const key = ks[index];
|
|
12
|
+
if (data.types[key].includes(extension)) {
|
|
13
|
+
return key;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return "";
|
|
18
|
+
};
|
|
19
|
+
const getType = (accept = "") => {
|
|
20
|
+
if (accept) {
|
|
21
|
+
if (accept.includes("image/")) {
|
|
22
|
+
return "i";
|
|
23
|
+
} else if (accept.includes("audio/")) {
|
|
24
|
+
return "a";
|
|
25
|
+
} else if (accept.includes("video/")) {
|
|
26
|
+
return "v";
|
|
27
|
+
} else {
|
|
28
|
+
const extension = accept.toLowerCase().split(",")[0];
|
|
29
|
+
return getExtension(extension);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return "";
|
|
33
|
+
};
|
|
34
|
+
const getListType = (obj, type, accept) => {
|
|
35
|
+
if (type) {
|
|
36
|
+
return type;
|
|
37
|
+
}
|
|
38
|
+
if (obj) {
|
|
39
|
+
if (obj.type) {
|
|
40
|
+
return obj.type;
|
|
41
|
+
} else {
|
|
42
|
+
if (obj.url) {
|
|
43
|
+
let v = getUrlCatalogueObj.getUrlCatalogueObj(obj.url);
|
|
44
|
+
if (v.suffix) {
|
|
45
|
+
return getExtension("." + v.suffix);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return getType(accept);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return "";
|
|
52
|
+
};
|
|
53
|
+
function downloadFromURL(url, filename) {
|
|
54
|
+
const link = document.createElement("a");
|
|
55
|
+
link.href = url;
|
|
56
|
+
if (filename) {
|
|
57
|
+
link.download = filename;
|
|
58
|
+
}
|
|
59
|
+
document.body.appendChild(link);
|
|
60
|
+
link.click();
|
|
61
|
+
document.body.removeChild(link);
|
|
62
|
+
}
|
|
63
|
+
function smartFileHandler(url) {
|
|
64
|
+
const iframe = document.createElement("iframe");
|
|
65
|
+
iframe.style.display = "none";
|
|
66
|
+
iframe.src = url;
|
|
67
|
+
iframe.onload = function() {
|
|
68
|
+
window.open(url, "_blank");
|
|
69
|
+
document.body.removeChild(iframe);
|
|
70
|
+
};
|
|
71
|
+
iframe.onerror = function() {
|
|
72
|
+
downloadFromURL(url);
|
|
73
|
+
document.body.removeChild(iframe);
|
|
74
|
+
};
|
|
75
|
+
document.body.appendChild(iframe);
|
|
76
|
+
}
|
|
77
|
+
exports.downloadFromURL = downloadFromURL;
|
|
78
|
+
exports.getListType = getListType;
|
|
79
|
+
exports.getType = getType;
|
|
80
|
+
exports.smartFileHandler = smartFileHandler;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ListValue } from '../../players/common/util';
|
|
2
|
+
export declare const getType: (accept?: string) => string;
|
|
3
|
+
export declare const getListType: (obj?: ListValue, type?: string, accept?: string) => string;
|
|
4
|
+
/**
|
|
5
|
+
* 从 URL 下载文件
|
|
6
|
+
* @param url 文件 URL
|
|
7
|
+
* @param filename 文件名
|
|
8
|
+
*/
|
|
9
|
+
export declare function downloadFromURL(url: string, filename?: string): void;
|
|
10
|
+
export declare function smartFileHandler(url: string): void;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { getUrlCatalogueObj } from "@fangzhongya/utils/urls/getUrlCatalogueObj";
|
|
2
|
+
import { types } from "./data.js";
|
|
3
|
+
import "../../players/common/util.js";
|
|
4
|
+
const getExtension = (fileName) => {
|
|
5
|
+
const extension = fileName.toLowerCase();
|
|
6
|
+
if (extension) {
|
|
7
|
+
const ks = Object.keys(types);
|
|
8
|
+
for (let index = 0; index < ks.length; index++) {
|
|
9
|
+
const key = ks[index];
|
|
10
|
+
if (types[key].includes(extension)) {
|
|
11
|
+
return key;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return "";
|
|
16
|
+
};
|
|
17
|
+
const getType = (accept = "") => {
|
|
18
|
+
if (accept) {
|
|
19
|
+
if (accept.includes("image/")) {
|
|
20
|
+
return "i";
|
|
21
|
+
} else if (accept.includes("audio/")) {
|
|
22
|
+
return "a";
|
|
23
|
+
} else if (accept.includes("video/")) {
|
|
24
|
+
return "v";
|
|
25
|
+
} else {
|
|
26
|
+
const extension = accept.toLowerCase().split(",")[0];
|
|
27
|
+
return getExtension(extension);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return "";
|
|
31
|
+
};
|
|
32
|
+
const getListType = (obj, type, accept) => {
|
|
33
|
+
if (type) {
|
|
34
|
+
return type;
|
|
35
|
+
}
|
|
36
|
+
if (obj) {
|
|
37
|
+
if (obj.type) {
|
|
38
|
+
return obj.type;
|
|
39
|
+
} else {
|
|
40
|
+
if (obj.url) {
|
|
41
|
+
let v = getUrlCatalogueObj(obj.url);
|
|
42
|
+
if (v.suffix) {
|
|
43
|
+
return getExtension("." + v.suffix);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return getType(accept);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return "";
|
|
50
|
+
};
|
|
51
|
+
function downloadFromURL(url, filename) {
|
|
52
|
+
const link = document.createElement("a");
|
|
53
|
+
link.href = url;
|
|
54
|
+
if (filename) {
|
|
55
|
+
link.download = filename;
|
|
56
|
+
}
|
|
57
|
+
document.body.appendChild(link);
|
|
58
|
+
link.click();
|
|
59
|
+
document.body.removeChild(link);
|
|
60
|
+
}
|
|
61
|
+
function smartFileHandler(url) {
|
|
62
|
+
const iframe = document.createElement("iframe");
|
|
63
|
+
iframe.style.display = "none";
|
|
64
|
+
iframe.src = url;
|
|
65
|
+
iframe.onload = function() {
|
|
66
|
+
window.open(url, "_blank");
|
|
67
|
+
document.body.removeChild(iframe);
|
|
68
|
+
};
|
|
69
|
+
iframe.onerror = function() {
|
|
70
|
+
downloadFromURL(url);
|
|
71
|
+
document.body.removeChild(iframe);
|
|
72
|
+
};
|
|
73
|
+
document.body.appendChild(iframe);
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
downloadFromURL,
|
|
77
|
+
getListType,
|
|
78
|
+
getType,
|
|
79
|
+
smartFileHandler
|
|
80
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const index = require("../../../hooks/cssname/index.cjs");
|
|
5
|
+
const index$2 = require("../../box-adjust/index.cjs");
|
|
6
|
+
const index$3 = require("../../iframe/index.cjs");
|
|
7
|
+
const index$1 = require("../../image-viewer/index.cjs");
|
|
8
|
+
const util = require("./util.cjs");
|
|
9
|
+
require("../../players/common/util.cjs");
|
|
10
|
+
const _hoisted_1 = { key: 1 };
|
|
11
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
12
|
+
__name: "views",
|
|
13
|
+
props: {
|
|
14
|
+
value: {
|
|
15
|
+
type: Object
|
|
16
|
+
},
|
|
17
|
+
show: Boolean,
|
|
18
|
+
type: String,
|
|
19
|
+
accept: String
|
|
20
|
+
},
|
|
21
|
+
emits: ["close"],
|
|
22
|
+
setup(__props, { emit: __emit }) {
|
|
23
|
+
const cs = index.useCssName("uploads-views");
|
|
24
|
+
const emit = __emit;
|
|
25
|
+
const props = __props;
|
|
26
|
+
const value = vue.computed({
|
|
27
|
+
set(v) {
|
|
28
|
+
if (!v) {
|
|
29
|
+
close();
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
get() {
|
|
33
|
+
return props.show;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const close = () => {
|
|
37
|
+
emit("close");
|
|
38
|
+
};
|
|
39
|
+
const onError = () => {
|
|
40
|
+
console.log("error");
|
|
41
|
+
};
|
|
42
|
+
return (_ctx, _cache) => {
|
|
43
|
+
var _a;
|
|
44
|
+
return props.show ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
45
|
+
key: 0,
|
|
46
|
+
class: vue.normalizeClass(vue.unref(cs).z())
|
|
47
|
+
}, [
|
|
48
|
+
vue.unref(util.getListType)(props.value, props.type, props.accept).startsWith(
|
|
49
|
+
"i"
|
|
50
|
+
) ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.ImageViewer), {
|
|
51
|
+
key: 0,
|
|
52
|
+
"url-list": [(_a = props.value) == null ? void 0 : _a.url],
|
|
53
|
+
"show-progress": "",
|
|
54
|
+
onClose: close
|
|
55
|
+
}, null, 8, ["url-list"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
56
|
+
vue.createVNode(vue.unref(index$2.BoxAdjust), {
|
|
57
|
+
isMax: "",
|
|
58
|
+
modelValue: value.value,
|
|
59
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event)
|
|
60
|
+
}, {
|
|
61
|
+
default: vue.withCtx(() => {
|
|
62
|
+
var _a2;
|
|
63
|
+
return [
|
|
64
|
+
vue.createVNode(vue.unref(index$3.Iframe), {
|
|
65
|
+
onError,
|
|
66
|
+
url: (_a2 = props.value) == null ? void 0 : _a2.url
|
|
67
|
+
}, null, 8, ["url"])
|
|
68
|
+
];
|
|
69
|
+
}),
|
|
70
|
+
_: 1
|
|
71
|
+
}, 8, ["modelValue"])
|
|
72
|
+
]))
|
|
73
|
+
], 2)) : vue.createCommentVNode("", true);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
exports.default = _sfc_main;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { defineComponent, computed, createElementBlock, createCommentVNode, openBlock, normalizeClass, unref, createBlock, createVNode, withCtx } from "vue";
|
|
2
|
+
import { useCssName } from "../../../hooks/cssname/index.js";
|
|
3
|
+
import { BoxAdjust } from "../../box-adjust/index.js";
|
|
4
|
+
import { Iframe } from "../../iframe/index.js";
|
|
5
|
+
import { ImageViewer } from "../../image-viewer/index.js";
|
|
6
|
+
import { getListType } from "./util.js";
|
|
7
|
+
import "../../players/common/util.js";
|
|
8
|
+
const _hoisted_1 = { key: 1 };
|
|
9
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
+
__name: "views",
|
|
11
|
+
props: {
|
|
12
|
+
value: {
|
|
13
|
+
type: Object
|
|
14
|
+
},
|
|
15
|
+
show: Boolean,
|
|
16
|
+
type: String,
|
|
17
|
+
accept: String
|
|
18
|
+
},
|
|
19
|
+
emits: ["close"],
|
|
20
|
+
setup(__props, { emit: __emit }) {
|
|
21
|
+
const cs = useCssName("uploads-views");
|
|
22
|
+
const emit = __emit;
|
|
23
|
+
const props = __props;
|
|
24
|
+
const value = computed({
|
|
25
|
+
set(v) {
|
|
26
|
+
if (!v) {
|
|
27
|
+
close();
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
get() {
|
|
31
|
+
return props.show;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const close = () => {
|
|
35
|
+
emit("close");
|
|
36
|
+
};
|
|
37
|
+
const onError = () => {
|
|
38
|
+
console.log("error");
|
|
39
|
+
};
|
|
40
|
+
return (_ctx, _cache) => {
|
|
41
|
+
var _a;
|
|
42
|
+
return props.show ? (openBlock(), createElementBlock("div", {
|
|
43
|
+
key: 0,
|
|
44
|
+
class: normalizeClass(unref(cs).z())
|
|
45
|
+
}, [
|
|
46
|
+
unref(getListType)(props.value, props.type, props.accept).startsWith(
|
|
47
|
+
"i"
|
|
48
|
+
) ? (openBlock(), createBlock(unref(ImageViewer), {
|
|
49
|
+
key: 0,
|
|
50
|
+
"url-list": [(_a = props.value) == null ? void 0 : _a.url],
|
|
51
|
+
"show-progress": "",
|
|
52
|
+
onClose: close
|
|
53
|
+
}, null, 8, ["url-list"])) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
54
|
+
createVNode(unref(BoxAdjust), {
|
|
55
|
+
isMax: "",
|
|
56
|
+
modelValue: value.value,
|
|
57
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event)
|
|
58
|
+
}, {
|
|
59
|
+
default: withCtx(() => {
|
|
60
|
+
var _a2;
|
|
61
|
+
return [
|
|
62
|
+
createVNode(unref(Iframe), {
|
|
63
|
+
onError,
|
|
64
|
+
url: (_a2 = props.value) == null ? void 0 : _a2.url
|
|
65
|
+
}, null, 8, ["url"])
|
|
66
|
+
];
|
|
67
|
+
}),
|
|
68
|
+
_: 1
|
|
69
|
+
}, 8, ["modelValue"])
|
|
70
|
+
]))
|
|
71
|
+
], 2)) : createCommentVNode("", true);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
export {
|
|
76
|
+
_sfc_main as default
|
|
77
|
+
};
|