@dt-frames/ui 2.0.13 → 2.0.14
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 +93 -2
- package/es/components/curd/index.js +6 -3
- package/es/components/curd/src/components/Curd.d.ts +12 -6
- package/es/components/curd/src/props.d.ts +6 -3
- package/es/components/form/index.js +15 -2
- package/es/components/form/index.less +2 -0
- package/es/components/form/src/components/FormButtons.d.ts +7 -0
- package/es/components/form/src/types/form.type.d.ts +3 -3
- package/es/components/form/src/types/items.type.d.ts +25 -0
- package/es/components/modal/index.js +13 -3
- package/es/components/modal/src/components/ModalFooter.d.ts +6 -0
- package/es/components/modal/src/index.d.ts +6 -0
- package/es/components/source/hooks/useSource.d.ts +2 -0
- package/es/components/source/index.js +4 -1
- package/es/components/source/types/source.type.d.ts +1 -0
- package/es/components/table/index.js +169 -84
- package/es/components/table/index.less +11 -0
- package/es/components/table/src/components/TableAction.d.ts +7 -0
- package/es/components/table/src/index.d.ts +7 -0
- package/es/components/table/src/props.d.ts +3 -0
- package/es/components/table/src/types/table.type.d.ts +1 -0
- package/es/components/upload/index.d.ts +2 -0
- package/es/components/upload/index.js +207 -76
- package/es/components/upload/index.less +31 -6
- package/es/components/upload/src/basicProps.d.ts +3 -5
- package/es/components/upload/src/components/WordView.d.ts +6 -0
- package/es/components/upload/src/hooks/useFile.d.ts +2 -1
- package/es/components/upload/src/index.d.ts +23 -18
- package/es/components/upload/src/utils/upload.d.ts +1 -1
- package/es/packages/ui/src/assets/locales/en.d.ts +103 -0
- package/es/packages/ui/src/assets/locales/index.d.ts +2 -0
- package/es/packages/ui/src/assets/locales/zh.d.ts +104 -0
- package/es/packages/ui/src/components/form/index.d.ts +7 -0
- package/es/packages/ui/src/components/form/src/components/FormButtons.d.ts +105 -0
- package/es/packages/ui/src/components/form/src/components/FormItem.d.ts +159 -0
- package/es/packages/ui/src/components/form/src/components/componentMap.d.ts +4 -0
- package/es/packages/ui/src/components/form/src/components/formIcon.d.ts +1223 -0
- package/es/packages/ui/src/components/form/src/components/formInputUseDialog.d.ts +911 -0
- package/es/packages/ui/src/components/form/src/components/index.d.ts +4 -0
- package/es/packages/ui/src/components/form/src/components/radioButton.d.ts +34 -0
- package/es/packages/ui/src/components/form/src/enums/index.d.ts +7 -0
- package/es/packages/ui/src/components/form/src/hooks/helper.d.ts +14 -0
- package/es/packages/ui/src/components/form/src/hooks/useForm.d.ts +6 -0
- package/es/packages/ui/src/components/form/src/hooks/useFormActions.d.ts +12 -0
- package/es/packages/ui/src/components/form/src/hooks/useFormEvent.d.ts +25 -0
- package/es/packages/ui/src/components/form/src/hooks/useFormValue.d.ts +3 -0
- package/es/packages/ui/src/components/form/src/hooks/useFormValues.d.ts +11 -0
- package/es/packages/ui/src/components/form/src/hooks/useLabelWidth.d.ts +6 -0
- package/es/packages/ui/src/components/form/src/props.d.ts +127 -0
- package/es/packages/ui/src/components/form/src/types/actions.type.d.ts +15 -0
- package/es/packages/ui/src/components/form/src/types/form.type.d.ts +79 -0
- package/es/packages/ui/src/components/form/src/types/items.type.d.ts +409 -0
- package/es/packages/ui/src/components/iframe/index.d.ts +2 -0
- package/es/packages/ui/src/components/modal/index.d.ts +4 -0
- package/es/packages/ui/src/components/modal/src/hooks/useModal.d.ts +5 -0
- package/es/packages/ui/src/components/modal/src/props.d.ts +101 -0
- package/es/packages/ui/src/components/modal/src/types/modal.type.d.ts +17 -0
- package/es/packages/ui/src/components/upload/index.d.ts +4 -0
- package/es/packages/ui/src/components/upload/src/basicProps.d.ts +87 -0
- package/es/packages/ui/src/components/upload/src/components/PdfView.d.ts +9 -0
- package/es/packages/ui/src/components/upload/src/components/WordView.d.ts +6 -0
- package/es/packages/ui/src/components/upload/src/hooks/useFile.d.ts +16 -0
- package/es/packages/ui/src/components/upload/src/index.d.ts +242 -0
- package/es/packages/ui/src/components/upload/src/type/file.d.ts +10 -0
- package/es/packages/ui/src/components/upload/src/utils/upload.d.ts +2 -0
- package/es/packages/ui/src/global.d.ts +7 -0
- package/es/packages/ui/src/theme/index.d.ts +12 -0
- package/es/packages/ui/src/theme/src/components/header/helper/menu-tree.d.ts +4 -0
- package/es/packages/ui/src/theme/src/enums/index.d.ts +1 -0
- package/es/packages/ui/src/theme/src/enums/theme.enum.d.ts +34 -0
- package/es/packages/ui/src/theme/src/hooks/index.d.ts +6 -0
- package/es/packages/ui/src/theme/src/hooks/useDragLine.d.ts +2 -0
- package/es/packages/ui/src/theme/src/hooks/useHeader.d.ts +25 -0
- package/es/packages/ui/src/theme/src/hooks/useMenu.d.ts +29 -0
- package/es/packages/ui/src/theme/src/hooks/useMultifyTab.d.ts +8 -0
- package/es/packages/ui/src/theme/src/hooks/useOpenKeys.d.ts +7 -0
- package/es/packages/ui/src/theme/src/hooks/useTheme.d.ts +9 -0
- package/es/packages/ui/src/theme/src/setting/theme.setting.d.ts +2 -0
- package/es/packages/ui/src/theme/src/stores/index.d.ts +3 -0
- package/es/packages/ui/src/theme/src/stores/routeReuse.store.d.ts +25 -0
- package/es/packages/ui/src/theme/src/stores/theme.store.d.ts +19 -0
- package/es/packages/ui/src/theme/src/types/index.d.ts +3 -0
- package/es/packages/ui/src/theme/src/types/menu.type.d.ts +15 -0
- package/es/packages/ui/src/theme/src/types/theme.type.d.ts +62 -0
- package/es/packages/ui/src/utils/withInstall.d.ts +4 -0
- package/es/theme/index.js +703 -264
- package/es/theme/index.less +162 -11
- package/es/theme/src/components/header/components/lock/Lockscreen.d.ts +54 -0
- package/es/theme/src/components/header/components/lock/Recharge.d.ts +32 -0
- package/es/theme/src/components/header/components/lock/index.d.ts +3 -0
- package/es/theme/src/components/header/components/lock/useBattery.d.ts +11 -0
- package/es/theme/src/components/header/components/logo.d.ts +1 -3
- package/es/theme/src/components/header/components/notify.d.ts +1 -3
- package/es/theme/src/components/header/components/user-info.d.ts +3 -3
- package/es/theme/src/components/header/index.d.ts +805 -809
- package/es/theme/src/components/header/multiple-header.d.ts +914 -918
- package/es/theme/src/components/sider/index.d.ts +1 -3
- package/es/theme/src/components/sider/mix-sider.d.ts +1 -3
- package/es/theme/src/hooks/useHeader.d.ts +1 -0
- package/es/theme/src/index.d.ts +2102 -2059
- package/manualContentPath.js +4 -0
- package/package.json +2 -1
- package/vite.config.ts +1 -0
|
@@ -237,4 +237,15 @@
|
|
|
237
237
|
.ant-table-middle i.dt-table-action-dropdown,
|
|
238
238
|
.ant-table-small i.dt-table-action-dropdown {
|
|
239
239
|
font-size: 18px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.dt-expand-has-collapse {
|
|
243
|
+
.dt-table-action-btn {
|
|
244
|
+
font-size: 13px;
|
|
245
|
+
width: inherit;
|
|
246
|
+
padding: 0 8px;
|
|
247
|
+
margin: 0 !important;
|
|
248
|
+
cursor: pointer;
|
|
249
|
+
color: @primary-color;
|
|
250
|
+
}
|
|
240
251
|
}
|
|
@@ -26,9 +26,13 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
26
26
|
index: {
|
|
27
27
|
type: NumberConstructor;
|
|
28
28
|
};
|
|
29
|
+
authPrefix: {
|
|
30
|
+
type: StringConstructor;
|
|
31
|
+
};
|
|
29
32
|
}, {
|
|
30
33
|
actionBtns: import("vue").Ref<any[]>;
|
|
31
34
|
props: any;
|
|
35
|
+
getAuth: (auth: string) => string | null;
|
|
32
36
|
handleAction: (it: ButtonType) => void;
|
|
33
37
|
attrs: {
|
|
34
38
|
[x: string]: unknown;
|
|
@@ -60,6 +64,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
60
64
|
index: {
|
|
61
65
|
type: NumberConstructor;
|
|
62
66
|
};
|
|
67
|
+
authPrefix: {
|
|
68
|
+
type: StringConstructor;
|
|
69
|
+
};
|
|
63
70
|
}>>, {
|
|
64
71
|
fixed: boolean | "left" | "right";
|
|
65
72
|
btns: ButtonType[];
|
|
@@ -6,6 +6,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
6
6
|
type: BooleanConstructor;
|
|
7
7
|
default: boolean;
|
|
8
8
|
};
|
|
9
|
+
authPrefix: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
};
|
|
9
12
|
clickToSelectRow: {
|
|
10
13
|
type: BooleanConstructor;
|
|
11
14
|
default: boolean;
|
|
@@ -321,6 +324,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
321
324
|
onOpenUpdateDialog: (row: import("@dt-frames/core").Recordable<any>, index: number) => void;
|
|
322
325
|
onDelete: (row: import("@dt-frames/core").Recordable<any>, index: number) => void;
|
|
323
326
|
onDeletes: (params: import("@dt-frames/core").Recordable<any>) => void;
|
|
327
|
+
authPrefix: string;
|
|
324
328
|
minWidth: number;
|
|
325
329
|
maxWidth: number;
|
|
326
330
|
defSort: any;
|
|
@@ -405,6 +409,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
405
409
|
type: BooleanConstructor;
|
|
406
410
|
default: boolean;
|
|
407
411
|
};
|
|
412
|
+
authPrefix: {
|
|
413
|
+
type: StringConstructor;
|
|
414
|
+
};
|
|
408
415
|
clickToSelectRow: {
|
|
409
416
|
type: BooleanConstructor;
|
|
410
417
|
default: boolean;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { Button,
|
|
2
|
-
import "ant-design-vue/es/upload/style";
|
|
1
|
+
import { Button, Upload, Image } from "ant-design-vue/es";
|
|
3
2
|
import "ant-design-vue/es/image/style";
|
|
3
|
+
import "ant-design-vue/es/upload/style";
|
|
4
4
|
import "ant-design-vue/es/button/style";
|
|
5
|
-
import { defineComponent, openBlock, createBlock, unref as unref$1, withCtx, createVNode, createElementBlock,
|
|
5
|
+
import { defineComponent, openBlock, createBlock, unref as unref$1, withCtx, createVNode, createElementVNode, createElementBlock, mergeProps, isRef, createSlots, toDisplayString, Fragment, renderList, normalizeClass, createCommentVNode, renderSlot, normalizeProps, guardReactiveProps } from "vue";
|
|
6
6
|
import { takeRight, omit } from "lodash-es";
|
|
7
|
-
import { useAppStore, useMessage, isFunction, http, HttpContentTypeEnum } from "@dt-frames/core";
|
|
7
|
+
import { useAppStore, useMessage, dispatchResize, isFunction, isString, http, HttpContentTypeEnum } from "@dt-frames/core";
|
|
8
8
|
import { useModal, DtModal, useModalOut } from "../modal";
|
|
9
9
|
import { DtIframe } from "../iframe";
|
|
10
|
+
import { renderAsync } from "docx-preview";
|
|
10
11
|
const basicProps = {
|
|
11
12
|
uploadUrl: {
|
|
12
|
-
type:
|
|
13
|
-
default: null
|
|
13
|
+
type: Object
|
|
14
14
|
},
|
|
15
15
|
downloadUrl: {
|
|
16
|
-
type:
|
|
17
|
-
default: null
|
|
16
|
+
type: Object
|
|
18
17
|
},
|
|
19
18
|
buttonText: {
|
|
20
19
|
type: String,
|
|
@@ -130,22 +129,21 @@ function useFile({
|
|
|
130
129
|
}
|
|
131
130
|
const maxNumber = unref(maxCountRef);
|
|
132
131
|
if (maxNumber && maxNumber !== Infinity) {
|
|
133
|
-
helpTexts.push(`\u6700\u591A\u53EF\
|
|
132
|
+
helpTexts.push(`\u6700\u591A\u53EF\u4E0A\u4F20${maxNumber}\u4E2A\u6587\u4EF6`);
|
|
134
133
|
}
|
|
135
134
|
return helpTexts.join(", ");
|
|
136
135
|
});
|
|
137
|
-
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
136
|
+
const setFile = (file) => {
|
|
137
|
+
return {
|
|
138
|
+
...file,
|
|
139
|
+
name: file.filename ?? file.fileId,
|
|
140
|
+
fileType: file.filename ? takeRight(file.filename.split("."))[0] : null,
|
|
141
|
+
status: "done",
|
|
142
|
+
uid: file.id ?? file.fileId,
|
|
143
|
+
url: `${getAppConf.pages?.downloadUrl}?id=${file.fileId}`
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
const fileList = ref(unref(fileListRef).map((it) => setFile(it)));
|
|
149
147
|
function beforeUpload(file) {
|
|
150
148
|
const { size } = file;
|
|
151
149
|
const maxSize = unref(maxSizeRef);
|
|
@@ -153,26 +151,69 @@ function useFile({
|
|
|
153
151
|
message.error(`\u53EA\u80FD\u4E0A\u4F20\u4E0D\u8D85\u8FC7${maxSize}MB\u7684\u6587\u4EF6!`);
|
|
154
152
|
return;
|
|
155
153
|
}
|
|
154
|
+
const maxNumber = unref(maxCountRef);
|
|
155
|
+
if (maxNumber && maxNumber !== Infinity && unref(fileList).length >= maxNumber) {
|
|
156
|
+
message.error(`\u6700\u591A\u53EF\u4E0A\u4F20${maxNumber}\u4E2A\u6587\u4EF6!`);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
156
159
|
}
|
|
160
|
+
watch(
|
|
161
|
+
() => unref(fileListRef),
|
|
162
|
+
(v) => {
|
|
163
|
+
fileList.value = v.map((it) => setFile(it));
|
|
164
|
+
}
|
|
165
|
+
);
|
|
157
166
|
return {
|
|
158
167
|
getAccept,
|
|
159
168
|
getStringAccept,
|
|
160
169
|
getHelpText,
|
|
161
|
-
|
|
170
|
+
fileList,
|
|
171
|
+
setFile,
|
|
162
172
|
beforeUpload
|
|
163
173
|
};
|
|
164
174
|
}
|
|
165
|
-
const getFileThumb = (
|
|
166
|
-
|
|
175
|
+
const getFileThumb = (fileType) => {
|
|
176
|
+
switch (fileType) {
|
|
177
|
+
case "pptx":
|
|
178
|
+
case "ppt":
|
|
179
|
+
return "/imgs/fu_ppt.gif";
|
|
180
|
+
case "docx":
|
|
181
|
+
case "doc":
|
|
182
|
+
return "/imgs/fu_doc.gif";
|
|
183
|
+
case "pdf":
|
|
184
|
+
return "/imgs/fu_pdf.gif";
|
|
185
|
+
case "jpg":
|
|
186
|
+
case "jpeg":
|
|
187
|
+
case "png":
|
|
188
|
+
case "bmp":
|
|
189
|
+
case "ofd":
|
|
190
|
+
case "gif":
|
|
191
|
+
return "/imgs/fu_bmp.gif";
|
|
192
|
+
case "xls":
|
|
193
|
+
case "xlsx":
|
|
194
|
+
return "/imgs/fu_exl.gif";
|
|
195
|
+
case "csv":
|
|
196
|
+
return "/imgs/fu_txt.gif";
|
|
197
|
+
case "txt":
|
|
198
|
+
return "/imgs/fu_txt.gif";
|
|
199
|
+
case "rar":
|
|
200
|
+
case "zip":
|
|
201
|
+
case "7z":
|
|
202
|
+
case "tar":
|
|
203
|
+
case "gz":
|
|
204
|
+
return "/imgs/fu_rar.gif";
|
|
205
|
+
default:
|
|
206
|
+
return "/imgs/fu_blank.gif";
|
|
207
|
+
}
|
|
167
208
|
};
|
|
168
|
-
const _sfc_main$
|
|
209
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
169
210
|
__name: "PdfView",
|
|
170
211
|
setup(__props) {
|
|
171
212
|
const exeReduce = ref(233);
|
|
172
213
|
const pdfUrlRef = ref();
|
|
173
214
|
const [register] = useModal({
|
|
174
215
|
width: "70%",
|
|
175
|
-
title:
|
|
216
|
+
title: (data) => `\u9644\u4EF6\u9884\u89C8 - ${data.filename}`,
|
|
176
217
|
useWrapper: false,
|
|
177
218
|
wrapClassName: "dt-pdf",
|
|
178
219
|
maskClosable: false,
|
|
@@ -199,26 +240,83 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
199
240
|
};
|
|
200
241
|
}
|
|
201
242
|
});
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
243
|
+
const _export_sfc = (sfc, props) => {
|
|
244
|
+
const target = sfc.__vccOpts || sfc;
|
|
245
|
+
for (const [key, val] of props) {
|
|
246
|
+
target[key] = val;
|
|
247
|
+
}
|
|
248
|
+
return target;
|
|
205
249
|
};
|
|
250
|
+
const PdfView = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/upload/src/components/PdfView.vue"]]);
|
|
251
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
252
|
+
__name: "WordView",
|
|
253
|
+
setup(__props) {
|
|
254
|
+
const ID = `word-view-${Math.ceil(Math.random() * 1e6)}`;
|
|
255
|
+
const [register] = useModal({
|
|
256
|
+
width: "900px",
|
|
257
|
+
title: (data) => `\u9644\u4EF6\u9884\u89C8 - ${data.filename}`,
|
|
258
|
+
useWrapper: false,
|
|
259
|
+
wrapClassName: "dt-word",
|
|
260
|
+
maskClosable: false,
|
|
261
|
+
footer: null
|
|
262
|
+
}, (data) => {
|
|
263
|
+
console.log(data);
|
|
264
|
+
const fileReader = new FileReader();
|
|
265
|
+
fileReader.addEventListener("load", (event) => {
|
|
266
|
+
const arrayBuffer = event.target.result;
|
|
267
|
+
renderAsync(arrayBuffer, document.getElementById(ID), null, {
|
|
268
|
+
className: "docx",
|
|
269
|
+
inWrapper: true,
|
|
270
|
+
ignoreWidth: false,
|
|
271
|
+
ignoreHeight: false,
|
|
272
|
+
ignoreFonts: false,
|
|
273
|
+
breakPages: true,
|
|
274
|
+
ignoreLastRenderedPageBreak: true,
|
|
275
|
+
experimental: false,
|
|
276
|
+
trimXmlDeclaration: true,
|
|
277
|
+
debug: false
|
|
278
|
+
}).then((rsp) => {
|
|
279
|
+
dispatchResize();
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
fileReader.readAsArrayBuffer(data.data);
|
|
283
|
+
});
|
|
284
|
+
return (_ctx, _cache) => {
|
|
285
|
+
return openBlock(), createBlock(unref$1(DtModal), { onRegister: unref$1(register) }, {
|
|
286
|
+
default: withCtx(() => [
|
|
287
|
+
createElementVNode("div", {
|
|
288
|
+
id: ID,
|
|
289
|
+
class: "word-view"
|
|
290
|
+
})
|
|
291
|
+
]),
|
|
292
|
+
_: 1
|
|
293
|
+
}, 8, ["onRegister"]);
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
const DocxView = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/upload/src/components/WordView.vue"]]);
|
|
298
|
+
const _hoisted_1 = { class: "flex items-center" };
|
|
206
299
|
const _hoisted_2 = { class: "pl-3" };
|
|
207
|
-
const _hoisted_3 = {
|
|
208
|
-
const _hoisted_4 = {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
const
|
|
300
|
+
const _hoisted_3 = { class: "flex justify-between border border-solid border-gray-300 p-1 mt-2" };
|
|
301
|
+
const _hoisted_4 = { class: "flex items-center" };
|
|
302
|
+
const _hoisted_5 = ["src"];
|
|
303
|
+
const _hoisted_6 = { class: "flex items-center" };
|
|
304
|
+
const _hoisted_7 = ["onClick"];
|
|
305
|
+
const _hoisted_8 = { key: 0 };
|
|
306
|
+
const _hoisted_9 = /* @__PURE__ */ createElementVNode("i", { class: "i ic:baseline-file-upload" }, null, -1);
|
|
307
|
+
const _hoisted_10 = /* @__PURE__ */ createElementVNode("div", null, "\u6587\u4EF6\u4E0A\u4F20", -1);
|
|
308
|
+
const _hoisted_11 = [
|
|
309
|
+
_hoisted_9,
|
|
310
|
+
_hoisted_10
|
|
311
|
+
];
|
|
216
312
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
217
313
|
__name: "index",
|
|
218
314
|
props: basicProps,
|
|
219
|
-
|
|
315
|
+
emits: ["change"],
|
|
316
|
+
setup(__props, { emit: emits }) {
|
|
220
317
|
const props = __props;
|
|
221
318
|
const [registerPdf, { openModal: openPdfModal }] = useModalOut();
|
|
319
|
+
const [registerDocx, { openModal: openDocxModal }] = useModalOut();
|
|
222
320
|
const { message } = useMessage();
|
|
223
321
|
const {
|
|
224
322
|
defaultFiles: fileListRef,
|
|
@@ -230,7 +328,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
230
328
|
const {
|
|
231
329
|
getStringAccept,
|
|
232
330
|
getHelpText,
|
|
233
|
-
|
|
331
|
+
fileList,
|
|
234
332
|
beforeUpload
|
|
235
333
|
} = useFile({
|
|
236
334
|
fileListRef,
|
|
@@ -254,19 +352,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
254
352
|
class: "mdi:delete-outline",
|
|
255
353
|
show: () => props.showDelete,
|
|
256
354
|
click: (file) => {
|
|
257
|
-
|
|
355
|
+
fileList.value = unref(fileList).filter((f) => f.fileId !== file.fileId);
|
|
258
356
|
}
|
|
259
357
|
}
|
|
260
358
|
];
|
|
261
359
|
const getBind = computed(() => {
|
|
262
360
|
return {
|
|
361
|
+
maxCount: Infinity,
|
|
263
362
|
...omit(unref(props), [
|
|
264
363
|
"api",
|
|
265
364
|
"onChange"
|
|
266
365
|
]),
|
|
267
366
|
class: "dt-upload",
|
|
268
367
|
accept: unref(getStringAccept),
|
|
269
|
-
fileList: getFileList(),
|
|
270
368
|
beforeUpload: props.beforeUpload && isFunction(props.beforeUpload) ? props.beforeUpload : beforeUpload,
|
|
271
369
|
customRequest: props.customRequest ? props.customRequest : uploadFile
|
|
272
370
|
};
|
|
@@ -283,21 +381,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
283
381
|
src: unref(imgSrcRef)
|
|
284
382
|
};
|
|
285
383
|
});
|
|
384
|
+
const handlePreview = async (file) => {
|
|
385
|
+
console.log(file);
|
|
386
|
+
imgSrcRef.value = file.url;
|
|
387
|
+
imgVisable.value = true;
|
|
388
|
+
};
|
|
286
389
|
const uploadFile = async ({ file, onSuccess, onError, onProgress }) => {
|
|
390
|
+
console.log(file);
|
|
287
391
|
const { getAppConf } = useAppStore();
|
|
288
392
|
const { uploadUrl = getAppConf.pages.uploadUrl, downloadUrl = getAppConf.pages.downloadUrl } = props;
|
|
289
|
-
|
|
393
|
+
let _uploadUrl = isString(uploadUrl) ? uploadUrl : uploadUrl.api;
|
|
394
|
+
let _downloadUrl = isString(downloadUrl) ? downloadUrl : downloadUrl.api;
|
|
395
|
+
if (!_uploadUrl) {
|
|
290
396
|
message.error("\u8BF7\u914D\u7F6E\u4E0A\u4F20\u7684\u6587\u4EF6\u8DEF\u5F84");
|
|
291
397
|
return;
|
|
292
398
|
}
|
|
293
|
-
if (!
|
|
399
|
+
if (!_downloadUrl) {
|
|
294
400
|
message.error("\u8BF7\u914D\u7F6E\u4E0B\u8F7D\u7684\u6587\u4EF6\u8DEF\u5F84");
|
|
295
401
|
return;
|
|
296
402
|
}
|
|
297
403
|
try {
|
|
298
404
|
let result = await http.uploadFile(
|
|
299
405
|
{
|
|
300
|
-
url:
|
|
406
|
+
url: _uploadUrl + `?t=${new Date().getTime()}`,
|
|
301
407
|
onUploadProgress({ loaded, total }) {
|
|
302
408
|
onProgress({ percent: Math.ceil(loaded / total * 100) });
|
|
303
409
|
}
|
|
@@ -308,7 +414,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
308
414
|
}
|
|
309
415
|
);
|
|
310
416
|
file.fileId = result?.data?.id;
|
|
311
|
-
file.url = `${
|
|
417
|
+
file.url = `${_downloadUrl}?id=${result?.data?.id}`;
|
|
418
|
+
file.filename = result?.data?.filename;
|
|
419
|
+
file.fileType = takeRight(result?.data?.filename?.split("."))?.[0];
|
|
312
420
|
onSuccess(result);
|
|
313
421
|
} catch (err) {
|
|
314
422
|
onError(err);
|
|
@@ -319,17 +427,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
319
427
|
const { getAppConf } = useAppStore();
|
|
320
428
|
const { downloadUrl = getAppConf.pages.downloadUrl } = props;
|
|
321
429
|
if (["jpg", "jpeg", "png", "bmp", "gif"].includes(file.fileType)) {
|
|
322
|
-
imgSrcRef.value =
|
|
430
|
+
imgSrcRef.value = `${downloadUrl}?id=${file.fileId}`;
|
|
323
431
|
imgVisable.value = true;
|
|
324
432
|
return;
|
|
325
433
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
{ url: "https://www.antdv.com/components/image-cn" }
|
|
329
|
-
);
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
let result = await http.get(downloadUrl, { id: file.id }, {
|
|
434
|
+
let result = await http.get(downloadUrl, { id: file.fileId }, {
|
|
435
|
+
onlyData: false,
|
|
333
436
|
responseType: "blob",
|
|
334
437
|
isTransformResponse: false,
|
|
335
438
|
headers: {
|
|
@@ -338,35 +441,53 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
338
441
|
});
|
|
339
442
|
switch (file.fileType) {
|
|
340
443
|
case "pdf":
|
|
341
|
-
openPdfModal(
|
|
342
|
-
|
|
343
|
-
|
|
444
|
+
openPdfModal({
|
|
445
|
+
filename: file.filename,
|
|
446
|
+
url: URL.createObjectURL(result.data)
|
|
447
|
+
});
|
|
344
448
|
break;
|
|
345
449
|
case "docx":
|
|
450
|
+
openDocxModal({
|
|
451
|
+
filename: file.filename,
|
|
452
|
+
data: result.data
|
|
453
|
+
});
|
|
346
454
|
break;
|
|
347
455
|
}
|
|
348
456
|
} catch (err) {
|
|
349
457
|
console.log(err);
|
|
350
458
|
}
|
|
351
459
|
}
|
|
352
|
-
function download() {
|
|
460
|
+
function download(file) {
|
|
461
|
+
const { getAppConf } = useAppStore();
|
|
462
|
+
const { downloadUrl = getAppConf.pages.downloadUrl } = props;
|
|
463
|
+
http.exportFile(downloadUrl, { id: file.fileId }, file.filename);
|
|
353
464
|
}
|
|
465
|
+
watch(
|
|
466
|
+
() => unref(fileList).length,
|
|
467
|
+
(v) => emits("change", unref(fileList).map((it) => it.fileId)),
|
|
468
|
+
{
|
|
469
|
+
immediate: true
|
|
470
|
+
}
|
|
471
|
+
);
|
|
354
472
|
return (_ctx, _cache) => {
|
|
355
473
|
const _component_AButton = Button;
|
|
356
|
-
const _component_AImage = Image;
|
|
357
474
|
const _component_AUpload = Upload;
|
|
475
|
+
const _component_AImage = Image;
|
|
358
476
|
return openBlock(), createElementBlock("div", null, [
|
|
359
|
-
|
|
477
|
+
unref$1(getBind).listType === "text" ? (openBlock(), createBlock(_component_AUpload, mergeProps({ key: 0 }, unref$1(getBind), {
|
|
478
|
+
fileList: unref$1(fileList),
|
|
479
|
+
"onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => isRef(fileList) ? fileList.value = $event : null)
|
|
480
|
+
}), createSlots({
|
|
360
481
|
itemRender: withCtx(({ file, actions }) => [
|
|
361
|
-
|
|
362
|
-
createElementVNode("div",
|
|
482
|
+
createElementVNode("div", _hoisted_3, [
|
|
483
|
+
createElementVNode("div", _hoisted_4, [
|
|
363
484
|
createElementVNode("img", {
|
|
364
|
-
src: unref$1(getFileThumb)(file.
|
|
485
|
+
src: unref$1(getFileThumb)(file.fileType),
|
|
365
486
|
class: "w-9 h-9 mr-2 p-1"
|
|
366
|
-
}, null, 8,
|
|
367
|
-
createElementVNode("span", null, toDisplayString(file.filename)
|
|
487
|
+
}, null, 8, _hoisted_5),
|
|
488
|
+
createElementVNode("span", null, toDisplayString(file.filename), 1)
|
|
368
489
|
]),
|
|
369
|
-
createElementVNode("div",
|
|
490
|
+
createElementVNode("div", _hoisted_6, [
|
|
370
491
|
(openBlock(), createElementBlock(Fragment, null, renderList(btns, (btn) => {
|
|
371
492
|
return openBlock(), createElementBlock(Fragment, {
|
|
372
493
|
key: btn.class
|
|
@@ -375,16 +496,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
375
496
|
key: 0,
|
|
376
497
|
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
498
|
onClick: ($event) => btn.click(file)
|
|
378
|
-
}, null, 10,
|
|
499
|
+
}, null, 10, _hoisted_7)) : createCommentVNode("v-if", true)
|
|
379
500
|
], 64);
|
|
380
501
|
}), 64))
|
|
381
502
|
])
|
|
382
|
-
])
|
|
503
|
+
])
|
|
383
504
|
]),
|
|
384
505
|
default: withCtx(() => [
|
|
385
|
-
|
|
386
|
-
createTextVNode(" \u8FD9\u662F\u5361\u7247\u56FE\u7247 ")
|
|
387
|
-
], 64)) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
506
|
+
createElementVNode("div", _hoisted_1, [
|
|
388
507
|
createVNode(_component_AButton, null, {
|
|
389
508
|
default: withCtx(() => [
|
|
390
509
|
createElementVNode("i", {
|
|
@@ -395,9 +514,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
395
514
|
_: 1
|
|
396
515
|
}),
|
|
397
516
|
createElementVNode("p", _hoisted_2, toDisplayString(unref$1(getHelpText)), 1)
|
|
398
|
-
])
|
|
399
|
-
|
|
400
|
-
createVNode(
|
|
517
|
+
]),
|
|
518
|
+
createVNode(PdfView, { onRegister: unref$1(registerPdf) }, null, 8, ["onRegister"]),
|
|
519
|
+
createVNode(DocxView, { onRegister: unref$1(registerDocx) }, null, 8, ["onRegister"])
|
|
401
520
|
]),
|
|
402
521
|
_: 2
|
|
403
522
|
}, [
|
|
@@ -409,11 +528,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
409
528
|
])
|
|
410
529
|
};
|
|
411
530
|
})
|
|
412
|
-
]), 1040)
|
|
531
|
+
]), 1040, ["fileList"])) : createCommentVNode("v-if", true),
|
|
532
|
+
unref$1(getBind).listType === "picture-card" ? (openBlock(), createBlock(_component_AUpload, mergeProps({ key: 1 }, unref$1(getBind), {
|
|
533
|
+
fileList: unref$1(fileList),
|
|
534
|
+
"onUpdate:fileList": _cache[1] || (_cache[1] = ($event) => isRef(fileList) ? fileList.value = $event : null),
|
|
535
|
+
onPreview: handlePreview
|
|
536
|
+
}), {
|
|
537
|
+
default: withCtx(() => [
|
|
538
|
+
!_ctx.maxCount || unref$1(fileList).length < _ctx.maxCount ? (openBlock(), createElementBlock("div", _hoisted_8, _hoisted_11)) : createCommentVNode("v-if", true)
|
|
539
|
+
]),
|
|
540
|
+
_: 1
|
|
541
|
+
}, 16, ["fileList"])) : createCommentVNode("v-if", true),
|
|
542
|
+
unref$1(bindImg).src ? (openBlock(), createBlock(_component_AImage, mergeProps({ key: 2 }, unref$1(bindImg), { style: { display: "none" } }), null, 16)) : createCommentVNode("v-if", true)
|
|
413
543
|
]);
|
|
414
544
|
};
|
|
415
545
|
}
|
|
416
546
|
});
|
|
547
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/upload/src/index.vue"]]);
|
|
417
548
|
export {
|
|
418
|
-
|
|
549
|
+
index as DtUpload
|
|
419
550
|
};
|
|
@@ -5,12 +5,6 @@
|
|
|
5
5
|
display: initial;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.dt-upload{
|
|
9
|
-
.ant-upload{
|
|
10
|
-
display: flex;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
8
|
.dt-pdf{
|
|
15
9
|
&.fullscreen-modal{
|
|
16
10
|
min-height: calc(100% + 8px);
|
|
@@ -35,3 +29,34 @@
|
|
|
35
29
|
}
|
|
36
30
|
}
|
|
37
31
|
}
|
|
32
|
+
|
|
33
|
+
.word-view{
|
|
34
|
+
width: 900px;
|
|
35
|
+
height: 500px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dt-image-item{
|
|
39
|
+
.ant-image, .ant-image-img{
|
|
40
|
+
height: 100%;
|
|
41
|
+
width: 100%;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ant-image-mask-info{
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.dt-upload{
|
|
51
|
+
.ant-upload-list-picture-card{
|
|
52
|
+
.ant-upload-list-item, .ant-upload {
|
|
53
|
+
height: 104px;
|
|
54
|
+
width: 104px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ant-upload-list-item-actions{
|
|
59
|
+
display: flex;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { PropType, Ref, ComputedRef } from "vue";
|
|
2
2
|
import { UploadFile } from "./type/file";
|
|
3
3
|
import { UploadRequestOption } from "ant-design-vue/es/vc-upload/interface";
|
|
4
|
-
import { Recordable } from "@dt-frames/core";
|
|
4
|
+
import { ApiType, Recordable } from "@dt-frames/core";
|
|
5
5
|
export declare const basicProps: {
|
|
6
6
|
uploadUrl: {
|
|
7
|
-
type:
|
|
8
|
-
default: any;
|
|
7
|
+
type: PropType<string | ApiType>;
|
|
9
8
|
};
|
|
10
9
|
downloadUrl: {
|
|
11
|
-
type:
|
|
12
|
-
default: any;
|
|
10
|
+
type: PropType<string | ApiType>;
|
|
13
11
|
};
|
|
14
12
|
buttonText: {
|
|
15
13
|
type: StringConstructor;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const _sfc_main: import("vue").DefineComponent<{}, {
|
|
2
|
+
ID: string;
|
|
3
|
+
register: import("../../../modal/src/types/modal.type").RegisterFn;
|
|
4
|
+
readonly DtModal: import("vue").DefineComponent<{}, {}, any, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
5
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
6
|
+
export default _sfc_main;
|
|
@@ -10,6 +10,7 @@ export declare function useFile({ fileListRef, acceptRef, helpTextRef, maxCountR
|
|
|
10
10
|
getAccept: import("vue").ComputedRef<string[]>;
|
|
11
11
|
getStringAccept: import("vue").ComputedRef<string>;
|
|
12
12
|
getHelpText: import("vue").ComputedRef<string>;
|
|
13
|
-
|
|
13
|
+
fileList: Ref<any[]>;
|
|
14
|
+
setFile: (file: any) => any;
|
|
14
15
|
beforeUpload: (file: File) => void;
|
|
15
16
|
};
|