@dt-frames/ui 2.0.11 → 2.0.13
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/es/components/container/index.d.ts +2 -93
- package/es/components/curd/src/components/Curd.d.ts +6 -2
- package/es/components/curd/src/props.d.ts +3 -1
- package/es/components/drawer/index.d.ts +1 -1
- package/es/components/drawer/index.js +4 -4
- package/es/components/drawer/src/index.d.ts +1 -1
- package/es/components/drawer/src/types/index.type.d.ts +1 -1
- package/es/components/form/index.js +32 -13
- package/es/components/form/src/components/FormItem.d.ts +3 -1
- package/es/components/form/src/components/formIcon.d.ts +0 -8
- package/es/components/form/src/props.d.ts +7 -5
- package/es/components/form/src/types/form.type.d.ts +1 -0
- package/es/components/form/src/types/items.type.d.ts +6 -4
- package/es/components/icons/index.d.ts +497 -497
- package/es/components/iframe/index.d.ts +2 -0
- package/es/components/iframe/index.js +72 -0
- package/es/components/iframe/index.less +29 -0
- package/es/components/iframe/src/index.d.ts +38 -0
- package/es/components/modal/index.js +11 -6
- package/es/components/modal/src/index.d.ts +4 -2
- package/es/components/table/index.js +79 -18
- package/es/components/table/src/enums/table.enum.d.ts +5 -0
- package/es/components/table/src/index.d.ts +10 -10
- package/es/components/table/src/props.d.ts +3 -3
- package/es/components/tree/index.js +39 -29
- package/es/components/upload/index.js +414 -11
- package/es/components/upload/index.less +37 -0
- package/es/components/upload/src/basicProps.d.ts +89 -0
- package/es/components/upload/src/components/PdfView.d.ts +9 -0
- package/es/components/upload/src/hooks/useFile.d.ts +15 -0
- package/es/components/upload/src/index.d.ts +236 -2
- package/es/components/upload/src/type/file.d.ts +10 -0
- package/es/components/upload/src/utils/upload.d.ts +2 -0
- package/es/theme/index.js +3 -1
- package/es/theme/index.less +5 -1
- package/es/theme/src/components/content/index.d.ts +2 -0
- package/es/theme/src/components/header/index.d.ts +809 -809
- package/es/theme/src/components/header/multiple-header.d.ts +918 -918
- package/es/theme/src/index.d.ts +2059 -2057
- package/index.d.ts +3 -1
- package/index.js +3 -1
- package/manualContentPath.js +14 -0
- package/package.json +4 -2
- package/vite.config.ts +3 -0
- package/vite.config.ts.timestamp-1678694558071.mjs +0 -59
- package/vite.config.ts.timestamp-1678700851971.mjs +0 -61
|
@@ -196,8 +196,8 @@ function useTree(treeDataRef, getFieldNames) {
|
|
|
196
196
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
197
197
|
if (!childrenField || !keyField)
|
|
198
198
|
return keys;
|
|
199
|
-
for (let
|
|
200
|
-
const node = treeData[
|
|
199
|
+
for (let index2 = 0; index2 < treeData.length; index2++) {
|
|
200
|
+
const node = treeData[index2];
|
|
201
201
|
keys.push(node[keyField]);
|
|
202
202
|
const children = node[childrenField];
|
|
203
203
|
if (children && children.length) {
|
|
@@ -212,8 +212,8 @@ function useTree(treeDataRef, getFieldNames) {
|
|
|
212
212
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
213
213
|
if (!childrenField || !keyField)
|
|
214
214
|
return keys;
|
|
215
|
-
for (let
|
|
216
|
-
const node = treeData[
|
|
215
|
+
for (let index2 = 0; index2 < treeData.length; index2++) {
|
|
216
|
+
const node = treeData[index2];
|
|
217
217
|
node.disabled !== true && node.selectable !== false && keys.push(node[keyField]);
|
|
218
218
|
const children = node[childrenField];
|
|
219
219
|
if (children && children.length) {
|
|
@@ -228,8 +228,8 @@ function useTree(treeDataRef, getFieldNames) {
|
|
|
228
228
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
229
229
|
if (!childrenField || !keyField)
|
|
230
230
|
return keys;
|
|
231
|
-
for (let
|
|
232
|
-
const node = treeData[
|
|
231
|
+
for (let index2 = 0; index2 < treeData.length; index2++) {
|
|
232
|
+
const node = treeData[index2];
|
|
233
233
|
const children = node[childrenField];
|
|
234
234
|
if (nodeKey === node[keyField]) {
|
|
235
235
|
keys.push(node[keyField]);
|
|
@@ -251,11 +251,11 @@ function useTree(treeDataRef, getFieldNames) {
|
|
|
251
251
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
252
252
|
if (!childrenField || !keyField)
|
|
253
253
|
return;
|
|
254
|
-
for (let
|
|
255
|
-
const element = treeData[
|
|
254
|
+
for (let index2 = 0; index2 < treeData.length; index2++) {
|
|
255
|
+
const element = treeData[index2];
|
|
256
256
|
const children = element[childrenField];
|
|
257
257
|
if (element[keyField] === key) {
|
|
258
|
-
treeData[
|
|
258
|
+
treeData[index2] = { ...treeData[index2], ...node };
|
|
259
259
|
break;
|
|
260
260
|
} else if (children && children.length) {
|
|
261
261
|
updateNodeByKey(key, node, element[childrenField]);
|
|
@@ -267,8 +267,8 @@ function useTree(treeDataRef, getFieldNames) {
|
|
|
267
267
|
return [];
|
|
268
268
|
const res = [];
|
|
269
269
|
const data = list || unref(treeDataRef) || [];
|
|
270
|
-
for (let
|
|
271
|
-
const item = data[
|
|
270
|
+
for (let index2 = 0; index2 < data.length; index2++) {
|
|
271
|
+
const item = data[index2];
|
|
272
272
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
273
273
|
const key = keyField ? item[keyField] : "";
|
|
274
274
|
const children = childrenField ? item[childrenField] : [];
|
|
@@ -330,11 +330,11 @@ function useTree(treeDataRef, getFieldNames) {
|
|
|
330
330
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
331
331
|
if (!childrenField || !keyField)
|
|
332
332
|
return;
|
|
333
|
-
for (let
|
|
334
|
-
const element = treeData[
|
|
333
|
+
for (let index2 = 0; index2 < treeData.length; index2++) {
|
|
334
|
+
const element = treeData[index2];
|
|
335
335
|
const children = element[childrenField];
|
|
336
336
|
if (element[keyField] === key) {
|
|
337
|
-
treeData.splice(
|
|
337
|
+
treeData.splice(index2, 1);
|
|
338
338
|
break;
|
|
339
339
|
} else if (children && children.length) {
|
|
340
340
|
deleteNodeByKey(key, element[childrenField]);
|
|
@@ -455,8 +455,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
455
455
|
const _component_AMenu = Menu;
|
|
456
456
|
const _component_ADropdown = Dropdown;
|
|
457
457
|
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
458
|
-
unref(slots).headerTitle ? renderSlot(_ctx.$slots, "headerTitle", { key: 0 }) : createCommentVNode("", true),
|
|
459
|
-
!unref(slots).headerTitle && _ctx.title ? (openBlock(), createElementBlock("h4", _hoisted_2, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
|
|
458
|
+
unref(slots).headerTitle ? renderSlot(_ctx.$slots, "headerTitle", { key: 0 }) : createCommentVNode("v-if", true),
|
|
459
|
+
!unref(slots).headerTitle && _ctx.title ? (openBlock(), createElementBlock("h4", _hoisted_2, toDisplayString(_ctx.title), 1)) : createCommentVNode("v-if", true),
|
|
460
460
|
_ctx.search || _ctx.toolbar ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
461
461
|
_ctx.search ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
462
462
|
createVNode(_component_AInputSearch, {
|
|
@@ -466,7 +466,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
466
466
|
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
|
|
467
467
|
placeholder: unref(t)("FILTER")
|
|
468
468
|
}, null, 8, ["value", "placeholder"])
|
|
469
|
-
])) : createCommentVNode("", true),
|
|
469
|
+
])) : createCommentVNode("v-if", true),
|
|
470
470
|
_ctx.toolbar ? (openBlock(), createBlock(_component_ADropdown, {
|
|
471
471
|
key: 1,
|
|
472
472
|
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
@@ -485,7 +485,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
485
485
|
]),
|
|
486
486
|
_: 2
|
|
487
487
|
}, 1040),
|
|
488
|
-
item.divider ? (openBlock(), createBlock(_component_AMenuDivider, { key: 0 })) : createCommentVNode("", true)
|
|
488
|
+
item.divider ? (openBlock(), createBlock(_component_AMenuDivider, { key: 0 })) : createCommentVNode("v-if", true)
|
|
489
489
|
], 64);
|
|
490
490
|
}), 128))
|
|
491
491
|
]),
|
|
@@ -496,12 +496,20 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
496
496
|
_hoisted_5
|
|
497
497
|
]),
|
|
498
498
|
_: 1
|
|
499
|
-
})) : createCommentVNode("", true)
|
|
500
|
-
])) : createCommentVNode("", true)
|
|
499
|
+
})) : createCommentVNode("v-if", true)
|
|
500
|
+
])) : createCommentVNode("v-if", true)
|
|
501
501
|
]);
|
|
502
502
|
};
|
|
503
503
|
}
|
|
504
504
|
});
|
|
505
|
+
const _export_sfc = (sfc, props) => {
|
|
506
|
+
const target = sfc.__vccOpts || sfc;
|
|
507
|
+
for (const [key, val] of props) {
|
|
508
|
+
target[key] = val;
|
|
509
|
+
}
|
|
510
|
+
return target;
|
|
511
|
+
};
|
|
512
|
+
const TreeHeader = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/tree/src/components/TreeHeader.vue"]]);
|
|
505
513
|
function _isSlot(s) {
|
|
506
514
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
507
515
|
}
|
|
@@ -624,6 +632,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
624
632
|
};
|
|
625
633
|
}
|
|
626
634
|
});
|
|
635
|
+
const contextMenuVue = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/tree/src/components/ContextMenu.vue"]]);
|
|
627
636
|
function useContextMenu() {
|
|
628
637
|
const menuManager = {
|
|
629
638
|
domList: [],
|
|
@@ -647,7 +656,7 @@ function useContextMenu() {
|
|
|
647
656
|
propsData.customEvent = event;
|
|
648
657
|
propsData.axis = { x: event.clientX, y: event.clientY };
|
|
649
658
|
}
|
|
650
|
-
const vm = createVNode(
|
|
659
|
+
const vm = createVNode(contextMenuVue, propsData);
|
|
651
660
|
render(vm, container);
|
|
652
661
|
const handleClick = function() {
|
|
653
662
|
menuManager.resolve("");
|
|
@@ -834,9 +843,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
834
843
|
setExpandedKeys([...state.expandedKeys, key]);
|
|
835
844
|
} else {
|
|
836
845
|
const keys = [...state.expandedKeys];
|
|
837
|
-
const
|
|
838
|
-
if (
|
|
839
|
-
keys.splice(
|
|
846
|
+
const index2 = keys.findIndex((item) => item === key);
|
|
847
|
+
if (index2 !== -1) {
|
|
848
|
+
keys.splice(index2, 1);
|
|
840
849
|
}
|
|
841
850
|
setExpandedKeys(keys);
|
|
842
851
|
}
|
|
@@ -847,7 +856,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
847
856
|
} = props;
|
|
848
857
|
if (!actionList || actionList.length === 0)
|
|
849
858
|
return;
|
|
850
|
-
return actionList.map((item,
|
|
859
|
+
return actionList.map((item, index2) => {
|
|
851
860
|
let nodeShow = true;
|
|
852
861
|
if (isFunction(item.show)) {
|
|
853
862
|
nodeShow = item.show?.(node);
|
|
@@ -857,7 +866,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
857
866
|
if (!nodeShow)
|
|
858
867
|
return null;
|
|
859
868
|
return createVNode("span", {
|
|
860
|
-
"key":
|
|
869
|
+
"key": index2,
|
|
861
870
|
"class": "tree-action"
|
|
862
871
|
}, [item.render(node)]);
|
|
863
872
|
});
|
|
@@ -1046,7 +1055,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1046
1055
|
const _component_ATree = Tree;
|
|
1047
1056
|
const _component_AEmpty = Empty;
|
|
1048
1057
|
const _component_ASpin = Spin;
|
|
1049
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [unref(showTitle) ? (openBlock(), createBlock(
|
|
1058
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [unref(showTitle) ? (openBlock(), createBlock(TreeHeader, {
|
|
1050
1059
|
key: 0,
|
|
1051
1060
|
title: _ctx.title,
|
|
1052
1061
|
toolbar: _ctx.toolbar,
|
|
@@ -1059,7 +1068,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1059
1068
|
}, {
|
|
1060
1069
|
default: withCtx(() => [createTextVNode(toDisplayString(unref(extendSlots)(unref(slots))), 1)]),
|
|
1061
1070
|
_: 1
|
|
1062
|
-
}, 8, ["title", "toolbar", "search", "checkable", "searchText"])) : createCommentVNode("", true), createVNode(_component_ASpin, {
|
|
1071
|
+
}, 8, ["title", "toolbar", "search", "checkable", "searchText"])) : createCommentVNode("v-if", true), createVNode(_component_ASpin, {
|
|
1063
1072
|
spinning: _ctx.loading,
|
|
1064
1073
|
tip: unref(t)("LOADING")
|
|
1065
1074
|
}, {
|
|
@@ -1072,6 +1081,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1072
1081
|
};
|
|
1073
1082
|
}
|
|
1074
1083
|
});
|
|
1084
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/tree/src/index.vue"]]);
|
|
1075
1085
|
export {
|
|
1076
|
-
|
|
1086
|
+
index as DtTree
|
|
1077
1087
|
};
|
|
@@ -1,16 +1,419 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Button, Image, Upload } from "ant-design-vue/es";
|
|
2
|
+
import "ant-design-vue/es/upload/style";
|
|
3
|
+
import "ant-design-vue/es/image/style";
|
|
4
|
+
import "ant-design-vue/es/button/style";
|
|
5
|
+
import { defineComponent, openBlock, createBlock, unref as unref$1, withCtx, createVNode, createElementBlock, normalizeProps, guardReactiveProps, createSlots, createElementVNode, toDisplayString, Fragment, renderList, normalizeClass, createCommentVNode, createTextVNode, mergeProps, renderSlot } from "vue";
|
|
6
|
+
import { takeRight, omit } from "lodash-es";
|
|
7
|
+
import { useAppStore, useMessage, isFunction, http, HttpContentTypeEnum } from "@dt-frames/core";
|
|
8
|
+
import { useModal, DtModal, useModalOut } from "../modal";
|
|
9
|
+
import { DtIframe } from "../iframe";
|
|
10
|
+
const basicProps = {
|
|
11
|
+
uploadUrl: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: null
|
|
14
|
+
},
|
|
15
|
+
downloadUrl: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: null
|
|
18
|
+
},
|
|
19
|
+
buttonText: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "\u6587\u4EF6\u4E0A\u4F20"
|
|
22
|
+
},
|
|
23
|
+
preIcon: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "ic:baseline-file-upload"
|
|
26
|
+
},
|
|
27
|
+
data: {
|
|
28
|
+
type: Object,
|
|
29
|
+
default: {}
|
|
30
|
+
},
|
|
31
|
+
filename: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "filename"
|
|
34
|
+
},
|
|
35
|
+
accept: {
|
|
36
|
+
type: Array,
|
|
37
|
+
default: () => []
|
|
38
|
+
},
|
|
39
|
+
beforeUpload: {
|
|
40
|
+
type: Function
|
|
41
|
+
},
|
|
42
|
+
customRequest: {
|
|
43
|
+
type: Function
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
defaultFiles: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: () => []
|
|
52
|
+
},
|
|
53
|
+
headers: {
|
|
54
|
+
type: Object
|
|
55
|
+
},
|
|
56
|
+
listType: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "text"
|
|
59
|
+
},
|
|
60
|
+
maxCount: {
|
|
61
|
+
type: Number
|
|
62
|
+
},
|
|
63
|
+
maxSize: {
|
|
64
|
+
type: Number,
|
|
65
|
+
default: 2
|
|
66
|
+
},
|
|
67
|
+
helpText: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: ""
|
|
70
|
+
},
|
|
71
|
+
multiple: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
},
|
|
75
|
+
onChange: {
|
|
76
|
+
type: Function
|
|
77
|
+
},
|
|
78
|
+
extraParams: {
|
|
79
|
+
type: Object,
|
|
80
|
+
default: () => ({})
|
|
81
|
+
},
|
|
82
|
+
showView: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: true
|
|
85
|
+
},
|
|
86
|
+
showDownload: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: true
|
|
89
|
+
},
|
|
90
|
+
showDelete: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: true
|
|
6
93
|
}
|
|
7
|
-
return target;
|
|
8
94
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
95
|
+
function useFile({
|
|
96
|
+
fileListRef = ref([]),
|
|
97
|
+
acceptRef,
|
|
98
|
+
helpTextRef,
|
|
99
|
+
maxCountRef,
|
|
100
|
+
maxSizeRef
|
|
101
|
+
}) {
|
|
102
|
+
const { getAppConf } = useAppStore();
|
|
103
|
+
const { message } = useMessage();
|
|
104
|
+
const getAccept = computed(() => {
|
|
105
|
+
const accept = unref(acceptRef);
|
|
106
|
+
return accept && accept.length > 0 ? accept : [];
|
|
107
|
+
});
|
|
108
|
+
const getStringAccept = computed(() => {
|
|
109
|
+
return unref(getAccept).map((item) => {
|
|
110
|
+
if (item.indexOf("/") > 0 || item.startsWith(".")) {
|
|
111
|
+
return item;
|
|
112
|
+
} else {
|
|
113
|
+
return `.${item}`;
|
|
114
|
+
}
|
|
115
|
+
}).join(",");
|
|
116
|
+
});
|
|
117
|
+
const getHelpText = computed(() => {
|
|
118
|
+
const helpText = unref(helpTextRef);
|
|
119
|
+
if (helpText) {
|
|
120
|
+
return helpText;
|
|
121
|
+
}
|
|
122
|
+
const helpTexts = [];
|
|
123
|
+
const accept = unref(acceptRef);
|
|
124
|
+
if (accept.length > 0) {
|
|
125
|
+
helpTexts.push(`\u652F\u6301${accept.join("\u3001").replaceAll(".", "")}\u683C\u5F0F`);
|
|
126
|
+
}
|
|
127
|
+
const maxSize = unref(maxSizeRef);
|
|
128
|
+
if (maxSize) {
|
|
129
|
+
helpTexts.push(`\u4E0D\u8D85\u8FC7${maxSize}M`);
|
|
130
|
+
}
|
|
131
|
+
const maxNumber = unref(maxCountRef);
|
|
132
|
+
if (maxNumber && maxNumber !== Infinity) {
|
|
133
|
+
helpTexts.push(`\u6700\u591A\u53EF\u9009\u62E9${maxNumber}\u5F20\u56FE\u7247`);
|
|
134
|
+
}
|
|
135
|
+
return helpTexts.join(", ");
|
|
136
|
+
});
|
|
137
|
+
function getFileList() {
|
|
138
|
+
return unref(fileListRef).map((it) => {
|
|
139
|
+
return {
|
|
140
|
+
...it,
|
|
141
|
+
name: it.filename ?? it.fileId,
|
|
142
|
+
fileType: it.filename ? takeRight(it.filename.split("."))[0] : null,
|
|
143
|
+
status: "done",
|
|
144
|
+
uid: it.id ?? it.fileId,
|
|
145
|
+
url: `${getAppConf.pages?.downloadUrl}?id=${it.fileId}`
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function beforeUpload(file) {
|
|
150
|
+
const { size } = file;
|
|
151
|
+
const maxSize = unref(maxSizeRef);
|
|
152
|
+
if (maxSize && size / 1024 / 1024 >= maxSize) {
|
|
153
|
+
message.error(`\u53EA\u80FD\u4E0A\u4F20\u4E0D\u8D85\u8FC7${maxSize}MB\u7684\u6587\u4EF6!`);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
getAccept,
|
|
159
|
+
getStringAccept,
|
|
160
|
+
getHelpText,
|
|
161
|
+
getFileList,
|
|
162
|
+
beforeUpload
|
|
163
|
+
};
|
|
12
164
|
}
|
|
13
|
-
const
|
|
165
|
+
const getFileThumb = (filename) => {
|
|
166
|
+
return "/imgs/fu_rar.gif";
|
|
167
|
+
};
|
|
168
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
169
|
+
__name: "PdfView",
|
|
170
|
+
setup(__props) {
|
|
171
|
+
const exeReduce = ref(233);
|
|
172
|
+
const pdfUrlRef = ref();
|
|
173
|
+
const [register] = useModal({
|
|
174
|
+
width: "70%",
|
|
175
|
+
title: "\u9644\u4EF6\u9884\u89C8",
|
|
176
|
+
useWrapper: false,
|
|
177
|
+
wrapClassName: "dt-pdf",
|
|
178
|
+
maskClosable: false,
|
|
179
|
+
footer: null
|
|
180
|
+
}, (data) => {
|
|
181
|
+
pdfUrlRef.value = data.url;
|
|
182
|
+
});
|
|
183
|
+
function toggleFullscreen(isFullscreen) {
|
|
184
|
+
exeReduce.value = isFullscreen ? 55 : 233;
|
|
185
|
+
}
|
|
186
|
+
return (_ctx, _cache) => {
|
|
187
|
+
return openBlock(), createBlock(unref$1(DtModal), {
|
|
188
|
+
onRegister: unref$1(register),
|
|
189
|
+
onToggleFullscreen: toggleFullscreen
|
|
190
|
+
}, {
|
|
191
|
+
default: withCtx(() => [
|
|
192
|
+
createVNode(unref$1(DtIframe), {
|
|
193
|
+
src: unref$1(pdfUrlRef),
|
|
194
|
+
exeReduce: unref$1(exeReduce)
|
|
195
|
+
}, null, 8, ["src", "exeReduce"])
|
|
196
|
+
]),
|
|
197
|
+
_: 1
|
|
198
|
+
}, 8, ["onRegister"]);
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
const _hoisted_1 = {
|
|
203
|
+
key: 1,
|
|
204
|
+
class: "flex items-center"
|
|
205
|
+
};
|
|
206
|
+
const _hoisted_2 = { class: "pl-3" };
|
|
207
|
+
const _hoisted_3 = { key: 0 };
|
|
208
|
+
const _hoisted_4 = {
|
|
209
|
+
key: 1,
|
|
210
|
+
class: "flex justify-between border border-solid border-gray-300 p-1 mt-2"
|
|
211
|
+
};
|
|
212
|
+
const _hoisted_5 = { class: "flex items-center" };
|
|
213
|
+
const _hoisted_6 = ["src"];
|
|
214
|
+
const _hoisted_7 = { class: "flex items-center" };
|
|
215
|
+
const _hoisted_8 = ["onClick"];
|
|
216
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
217
|
+
__name: "index",
|
|
218
|
+
props: basicProps,
|
|
219
|
+
setup(__props) {
|
|
220
|
+
const props = __props;
|
|
221
|
+
const [registerPdf, { openModal: openPdfModal }] = useModalOut();
|
|
222
|
+
const { message } = useMessage();
|
|
223
|
+
const {
|
|
224
|
+
defaultFiles: fileListRef,
|
|
225
|
+
accept: acceptRef,
|
|
226
|
+
helpText: helpTextRef,
|
|
227
|
+
maxCount: maxCountRef,
|
|
228
|
+
maxSize: maxSizeRef
|
|
229
|
+
} = toRefs(props);
|
|
230
|
+
const {
|
|
231
|
+
getStringAccept,
|
|
232
|
+
getHelpText,
|
|
233
|
+
getFileList,
|
|
234
|
+
beforeUpload
|
|
235
|
+
} = useFile({
|
|
236
|
+
fileListRef,
|
|
237
|
+
acceptRef,
|
|
238
|
+
helpTextRef,
|
|
239
|
+
maxCountRef,
|
|
240
|
+
maxSizeRef
|
|
241
|
+
});
|
|
242
|
+
const btns = [
|
|
243
|
+
{
|
|
244
|
+
class: "ic:baseline-remove-red-eye",
|
|
245
|
+
show: (file) => props.showView && ["pdf", "jpg", "jpeg", "png", "bmp", "gif", "docx"].includes(file.fileType),
|
|
246
|
+
click: fileView
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
class: "ic:baseline-file-download",
|
|
250
|
+
show: () => props.showDownload,
|
|
251
|
+
click: download
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
class: "mdi:delete-outline",
|
|
255
|
+
show: () => props.showDelete,
|
|
256
|
+
click: (file) => {
|
|
257
|
+
fileListRef.value = unref(fileListRef).filter((f) => f.fileId !== file.fileId);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
];
|
|
261
|
+
const getBind = computed(() => {
|
|
262
|
+
return {
|
|
263
|
+
...omit(unref(props), [
|
|
264
|
+
"api",
|
|
265
|
+
"onChange"
|
|
266
|
+
]),
|
|
267
|
+
class: "dt-upload",
|
|
268
|
+
accept: unref(getStringAccept),
|
|
269
|
+
fileList: getFileList(),
|
|
270
|
+
beforeUpload: props.beforeUpload && isFunction(props.beforeUpload) ? props.beforeUpload : beforeUpload,
|
|
271
|
+
customRequest: props.customRequest ? props.customRequest : uploadFile
|
|
272
|
+
};
|
|
273
|
+
});
|
|
274
|
+
const imgVisable = ref(false);
|
|
275
|
+
const imgSrcRef = ref();
|
|
276
|
+
const bindImg = computed(() => {
|
|
277
|
+
return {
|
|
278
|
+
preview: {
|
|
279
|
+
width: 200,
|
|
280
|
+
visible: unref(imgVisable),
|
|
281
|
+
onVisibleChange: (v) => imgVisable.value = v
|
|
282
|
+
},
|
|
283
|
+
src: unref(imgSrcRef)
|
|
284
|
+
};
|
|
285
|
+
});
|
|
286
|
+
const uploadFile = async ({ file, onSuccess, onError, onProgress }) => {
|
|
287
|
+
const { getAppConf } = useAppStore();
|
|
288
|
+
const { uploadUrl = getAppConf.pages.uploadUrl, downloadUrl = getAppConf.pages.downloadUrl } = props;
|
|
289
|
+
if (!uploadUrl) {
|
|
290
|
+
message.error("\u8BF7\u914D\u7F6E\u4E0A\u4F20\u7684\u6587\u4EF6\u8DEF\u5F84");
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (!downloadUrl) {
|
|
294
|
+
message.error("\u8BF7\u914D\u7F6E\u4E0B\u8F7D\u7684\u6587\u4EF6\u8DEF\u5F84");
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
try {
|
|
298
|
+
let result = await http.uploadFile(
|
|
299
|
+
{
|
|
300
|
+
url: uploadUrl,
|
|
301
|
+
onUploadProgress({ loaded, total }) {
|
|
302
|
+
onProgress({ percent: Math.ceil(loaded / total * 100) });
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
...props.extraParams,
|
|
307
|
+
file
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
file.fileId = result?.data?.id;
|
|
311
|
+
file.url = `${downloadUrl}?id=${result?.data?.id}`;
|
|
312
|
+
onSuccess(result);
|
|
313
|
+
} catch (err) {
|
|
314
|
+
onError(err);
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
async function fileView(file) {
|
|
318
|
+
try {
|
|
319
|
+
const { getAppConf } = useAppStore();
|
|
320
|
+
const { downloadUrl = getAppConf.pages.downloadUrl } = props;
|
|
321
|
+
if (["jpg", "jpeg", "png", "bmp", "gif"].includes(file.fileType)) {
|
|
322
|
+
imgSrcRef.value = "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png";
|
|
323
|
+
imgVisable.value = true;
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (file.fileType === "pdf") {
|
|
327
|
+
openPdfModal(
|
|
328
|
+
{ url: "https://www.antdv.com/components/image-cn" }
|
|
329
|
+
);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
let result = await http.get(downloadUrl, { id: file.id }, {
|
|
333
|
+
responseType: "blob",
|
|
334
|
+
isTransformResponse: false,
|
|
335
|
+
headers: {
|
|
336
|
+
"Content-Type": HttpContentTypeEnum.FORM_DATA
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
switch (file.fileType) {
|
|
340
|
+
case "pdf":
|
|
341
|
+
openPdfModal(
|
|
342
|
+
{ url: URL.createObjectURL(result) }
|
|
343
|
+
);
|
|
344
|
+
break;
|
|
345
|
+
case "docx":
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
} catch (err) {
|
|
349
|
+
console.log(err);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function download() {
|
|
353
|
+
}
|
|
354
|
+
return (_ctx, _cache) => {
|
|
355
|
+
const _component_AButton = Button;
|
|
356
|
+
const _component_AImage = Image;
|
|
357
|
+
const _component_AUpload = Upload;
|
|
358
|
+
return openBlock(), createElementBlock("div", null, [
|
|
359
|
+
createVNode(_component_AUpload, normalizeProps(guardReactiveProps(unref$1(getBind))), createSlots({
|
|
360
|
+
itemRender: withCtx(({ file, actions }) => [
|
|
361
|
+
unref$1(getBind).listType === "picture-card" ? (openBlock(), createElementBlock("div", _hoisted_3)) : (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
362
|
+
createElementVNode("div", _hoisted_5, [
|
|
363
|
+
createElementVNode("img", {
|
|
364
|
+
src: unref$1(getFileThumb)(file.filename),
|
|
365
|
+
class: "w-9 h-9 mr-2 p-1"
|
|
366
|
+
}, null, 8, _hoisted_6),
|
|
367
|
+
createElementVNode("span", null, toDisplayString(file.filename) + "\u6587\u4EF6\u540D", 1)
|
|
368
|
+
]),
|
|
369
|
+
createElementVNode("div", _hoisted_7, [
|
|
370
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(btns, (btn) => {
|
|
371
|
+
return openBlock(), createElementBlock(Fragment, {
|
|
372
|
+
key: btn.class
|
|
373
|
+
}, [
|
|
374
|
+
btn.show(file) ? (openBlock(), createElementBlock("i", {
|
|
375
|
+
key: 0,
|
|
376
|
+
class: normalizeClass(["i w-7 h-7 !text-base text-center leading-7 text-gray-600 cursor-pointer hover:bg-gray-200 hover:bg-opacity-50 transition-all duration-300", btn.class]),
|
|
377
|
+
onClick: ($event) => btn.click(file)
|
|
378
|
+
}, null, 10, _hoisted_8)) : createCommentVNode("", true)
|
|
379
|
+
], 64);
|
|
380
|
+
}), 64))
|
|
381
|
+
])
|
|
382
|
+
]))
|
|
383
|
+
]),
|
|
384
|
+
default: withCtx(() => [
|
|
385
|
+
unref$1(getBind).listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
386
|
+
createTextVNode(" \u8FD9\u662F\u5361\u7247\u56FE\u7247 ")
|
|
387
|
+
], 64)) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
388
|
+
createVNode(_component_AButton, null, {
|
|
389
|
+
default: withCtx(() => [
|
|
390
|
+
createElementVNode("i", {
|
|
391
|
+
class: normalizeClass(["i mr-1", unref$1(getBind).preIcon])
|
|
392
|
+
}, null, 2),
|
|
393
|
+
createElementVNode("span", null, toDisplayString(unref$1(getBind).buttonText), 1)
|
|
394
|
+
]),
|
|
395
|
+
_: 1
|
|
396
|
+
}),
|
|
397
|
+
createElementVNode("p", _hoisted_2, toDisplayString(unref$1(getHelpText)), 1)
|
|
398
|
+
])),
|
|
399
|
+
unref$1(bindImg).src ? (openBlock(), createBlock(_component_AImage, mergeProps({ key: 2 }, unref$1(bindImg), { style: { display: "none" } }), null, 16)) : createCommentVNode("", true),
|
|
400
|
+
createVNode(_sfc_main$1, { onRegister: unref$1(registerPdf) }, null, 8, ["onRegister"])
|
|
401
|
+
]),
|
|
402
|
+
_: 2
|
|
403
|
+
}, [
|
|
404
|
+
renderList(Object.keys(_ctx.$slots), (item) => {
|
|
405
|
+
return {
|
|
406
|
+
name: item,
|
|
407
|
+
fn: withCtx((data) => [
|
|
408
|
+
renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data || {})))
|
|
409
|
+
])
|
|
410
|
+
};
|
|
411
|
+
})
|
|
412
|
+
]), 1040)
|
|
413
|
+
]);
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
});
|
|
14
417
|
export {
|
|
15
|
-
|
|
418
|
+
_sfc_main as DtUpload
|
|
16
419
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@import '../iframe/index.less';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
.ant-image-preview-img {
|
|
5
|
+
display: initial;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.dt-upload{
|
|
9
|
+
.ant-upload{
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.dt-pdf{
|
|
15
|
+
&.fullscreen-modal{
|
|
16
|
+
min-height: calc(100% + 8px);
|
|
17
|
+
&>.ant-modal{
|
|
18
|
+
width: 100% !important;
|
|
19
|
+
height: 100% !important;
|
|
20
|
+
max-width: 100%;
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
top: 0 !important;
|
|
24
|
+
.ant-modal-content{
|
|
25
|
+
height: 100%;
|
|
26
|
+
|
|
27
|
+
.ant-modal-body{
|
|
28
|
+
height: calc(100% - 55px);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ant-spin-nested-loading, .ant-spin-container{
|
|
32
|
+
height: 100%;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|