@dt-frames/ui 2.0.16 → 2.0.18
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/drawer/index.d.ts +3 -4
- package/es/components/drawer/index.js +11 -15
- package/es/components/drawer/index.less +6 -0
- package/es/components/drawer/src/index.d.ts +5 -7
- package/es/components/drawer/src/types/index.type.d.ts +3 -1
- package/es/components/form/index.js +33 -7
- package/es/components/form/src/components/FormButtons.d.ts +3056 -4
- package/es/components/form/src/components/FormItem.d.ts +2 -2
- package/es/components/form/src/components/formIcon.d.ts +0 -1209
- package/es/components/form/src/components/formInputUseDialog.d.ts +0 -894
- package/es/components/form/src/props.d.ts +3 -3
- package/es/components/form/src/types/items.type.d.ts +8 -0
- package/es/components/modal/index.js +19 -7
- package/es/components/modal/index.less +1 -9
- package/es/components/source/index.js +15 -7
- package/es/components/table/index.js +210 -201
- package/es/components/table/index.less +29 -0
- package/es/components/table/src/components/editTable/EditTableCell.d.ts +1 -0
- package/es/components/table/src/index.d.ts +0 -10
- package/es/components/table/src/props.d.ts +0 -4
- package/es/components/table/src/types/table.type.d.ts +8 -0
- package/es/components/tree/index.js +46 -44
- package/es/components/tree/index.less +13 -0
- package/es/components/tree/src/basicProps.d.ts +9 -4
- package/es/components/tree/src/components/ContextMenu.d.ts +6 -0
- package/es/components/tree/src/index.d.ts +11 -11
- package/es/components/tree/src/type/menu.d.ts +3 -0
- package/es/components/tree/src/type/tree.d.ts +0 -5
- package/es/components/tree/src/utils/tree.d.ts +3 -1
- package/es/components/upload/index.js +170 -69
- package/es/components/upload/index.less +7 -0
- package/es/components/upload/src/basicProps.d.ts +5 -1
- package/es/components/upload/src/components/WordView.d.ts +1 -0
- package/es/components/upload/src/hooks/useFile.d.ts +7 -6
- package/es/components/upload/src/index.d.ts +17 -0
- package/es/components/upload/src/type/file.d.ts +9 -2
- package/es/components/upload/src/utils/fileSize.d.ts +1 -0
- package/es/theme/index.js +157 -100
- package/es/theme/index.less +14 -0
- package/es/theme/src/components/sider/index.d.ts +1 -1
- package/es/theme/src/components/sider/mix-sider.d.ts +1 -1
- package/es/theme/src/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,12 +2,11 @@ import { Button, Upload, Image } from "ant-design-vue/es";
|
|
|
2
2
|
import "ant-design-vue/es/image/style";
|
|
3
3
|
import "ant-design-vue/es/upload/style";
|
|
4
4
|
import "ant-design-vue/es/button/style";
|
|
5
|
-
import { computed, unref, ref, watch, defineComponent, openBlock, createBlock, withCtx, createVNode, createElementVNode, toRefs, createElementBlock, mergeProps, isRef, createSlots, toDisplayString,
|
|
5
|
+
import { computed, unref, ref, watch, defineComponent, openBlock, createBlock, withCtx, createVNode, createElementVNode, toRefs, createElementBlock, mergeProps, isRef, createSlots, normalizeClass, createTextVNode, toDisplayString, createCommentVNode, normalizeStyle, Fragment, renderList, renderSlot, normalizeProps, guardReactiveProps } from "vue";
|
|
6
6
|
import { takeRight, omit } from "lodash-es";
|
|
7
|
-
import { useAppStore, useMessage,
|
|
7
|
+
import { isString, useAppStore, useMessage, dispatchResize, isFunction, 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";
|
|
11
10
|
const basicProps = {
|
|
12
11
|
uploadUrl: {
|
|
13
12
|
type: Object
|
|
@@ -27,6 +26,10 @@ const basicProps = {
|
|
|
27
26
|
type: Object,
|
|
28
27
|
default: {}
|
|
29
28
|
},
|
|
29
|
+
fieldNames: {
|
|
30
|
+
type: Object,
|
|
31
|
+
default: {}
|
|
32
|
+
},
|
|
30
33
|
fileName: {
|
|
31
34
|
type: String,
|
|
32
35
|
default: "file"
|
|
@@ -78,6 +81,10 @@ const basicProps = {
|
|
|
78
81
|
type: Object,
|
|
79
82
|
default: () => ({})
|
|
80
83
|
},
|
|
84
|
+
emitSnippet: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: false
|
|
87
|
+
},
|
|
81
88
|
showView: {
|
|
82
89
|
type: Boolean,
|
|
83
90
|
default: true
|
|
@@ -91,12 +98,28 @@ const basicProps = {
|
|
|
91
98
|
default: true
|
|
92
99
|
}
|
|
93
100
|
};
|
|
101
|
+
function getFileSize(size) {
|
|
102
|
+
if (!size)
|
|
103
|
+
return "\u672A\u77E5\u5927\u5C0F";
|
|
104
|
+
if (isString(size))
|
|
105
|
+
return size;
|
|
106
|
+
if (size >= 1073741824) {
|
|
107
|
+
return size % 1073741824 === 0 ? size / 1073741824 + "G" : Math.trunc(size / 1073741824) + "G";
|
|
108
|
+
} else if (size >= 1048576) {
|
|
109
|
+
return size % 1048576 === 0 ? size / 1048576 + "MB" : Math.trunc(size / 1048576) + "MB";
|
|
110
|
+
} else if (size >= 1024) {
|
|
111
|
+
return size % 1024 === 0 ? size / 1024 + "KB" : Math.trunc(size / 1024) + "KB";
|
|
112
|
+
} else {
|
|
113
|
+
return size + "B";
|
|
114
|
+
}
|
|
115
|
+
}
|
|
94
116
|
function useFile({
|
|
95
117
|
fileListRef = ref([]),
|
|
96
118
|
acceptRef,
|
|
97
119
|
helpTextRef,
|
|
98
120
|
maxCountRef,
|
|
99
|
-
maxSizeRef
|
|
121
|
+
maxSizeRef,
|
|
122
|
+
fieldNamesRef
|
|
100
123
|
}) {
|
|
101
124
|
const { getAppConf } = useAppStore();
|
|
102
125
|
const { message } = useMessage();
|
|
@@ -135,13 +158,17 @@ function useFile({
|
|
|
135
158
|
});
|
|
136
159
|
const setFile = (file) => {
|
|
137
160
|
let _downloadUrl = getAppConf.pages?.downloadUrl;
|
|
161
|
+
const { fileName, fileType, fileId, filePath, fileSize } = unref(fieldNamesRef);
|
|
162
|
+
const url = file[filePath] || `${getAppConf.http?.baseUrl}${isString(_downloadUrl) ? _downloadUrl : _downloadUrl.api}?id=${file[fileId]}`;
|
|
138
163
|
return {
|
|
139
164
|
...file,
|
|
140
|
-
name: file
|
|
141
|
-
fileType: file
|
|
165
|
+
name: file[fileName],
|
|
166
|
+
fileType: file[fileType] || takeRight(file[fileName].split("."))[0],
|
|
142
167
|
status: "done",
|
|
143
|
-
|
|
144
|
-
|
|
168
|
+
fileSize: getFileSize(file[fileSize]),
|
|
169
|
+
uid: file[fileId],
|
|
170
|
+
url,
|
|
171
|
+
filePath: url
|
|
145
172
|
};
|
|
146
173
|
};
|
|
147
174
|
const fileList = ref(unref(fileListRef).map((it) => setFile(it)));
|
|
@@ -243,10 +270,19 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
243
270
|
};
|
|
244
271
|
}
|
|
245
272
|
});
|
|
273
|
+
const _export_sfc = (sfc, props) => {
|
|
274
|
+
const target = sfc.__vccOpts || sfc;
|
|
275
|
+
for (const [key, val] of props) {
|
|
276
|
+
target[key] = val;
|
|
277
|
+
}
|
|
278
|
+
return target;
|
|
279
|
+
};
|
|
280
|
+
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"]]);
|
|
246
281
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
247
282
|
__name: "WordView",
|
|
248
283
|
setup(__props) {
|
|
249
284
|
const ID = `word-view-${Math.ceil(Math.random() * 1e6)}`;
|
|
285
|
+
const domRef = ref(null);
|
|
250
286
|
const [register] = useModal({
|
|
251
287
|
width: "900px",
|
|
252
288
|
title: (data) => `\u9644\u4EF6\u9884\u89C8 - ${data.fileName}`,
|
|
@@ -256,56 +292,69 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
256
292
|
wrapClassName: "dt-word",
|
|
257
293
|
maskClosable: false,
|
|
258
294
|
footer: null
|
|
259
|
-
}, (data) => {
|
|
295
|
+
}, async (data) => {
|
|
260
296
|
const fileReader = new FileReader();
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
297
|
+
if (typeof window !== "undefined") {
|
|
298
|
+
let { renderAsync } = await import("docx-preview");
|
|
299
|
+
fileReader.addEventListener("load", (event) => {
|
|
300
|
+
const arrayBuffer = event.target.result;
|
|
301
|
+
renderAsync(arrayBuffer, unref(domRef), null, {
|
|
302
|
+
className: "docx",
|
|
303
|
+
inWrapper: true,
|
|
304
|
+
ignoreWidth: false,
|
|
305
|
+
ignoreHeight: false,
|
|
306
|
+
ignoreFonts: false,
|
|
307
|
+
breakPages: true,
|
|
308
|
+
ignoreLastRenderedPageBreak: true,
|
|
309
|
+
experimental: false,
|
|
310
|
+
trimXmlDeclaration: true,
|
|
311
|
+
debug: false
|
|
312
|
+
}).then((rsp) => {
|
|
313
|
+
dispatchResize();
|
|
314
|
+
});
|
|
276
315
|
});
|
|
277
|
-
|
|
278
|
-
|
|
316
|
+
fileReader.readAsArrayBuffer(data.data);
|
|
317
|
+
}
|
|
279
318
|
});
|
|
280
319
|
return (_ctx, _cache) => {
|
|
281
320
|
return openBlock(), createBlock(unref(DtModal), { onRegister: unref(register) }, {
|
|
282
321
|
default: withCtx(() => [
|
|
283
322
|
createElementVNode("div", {
|
|
323
|
+
ref_key: "domRef",
|
|
324
|
+
ref: domRef,
|
|
284
325
|
id: ID,
|
|
285
326
|
class: "word-view"
|
|
286
|
-
})
|
|
327
|
+
}, null, 512)
|
|
287
328
|
]),
|
|
288
329
|
_: 1
|
|
289
330
|
}, 8, ["onRegister"]);
|
|
290
331
|
};
|
|
291
332
|
}
|
|
292
333
|
});
|
|
334
|
+
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"]]);
|
|
293
335
|
const _hoisted_1 = {
|
|
294
336
|
key: 0,
|
|
295
337
|
class: "flex items-center"
|
|
296
338
|
};
|
|
297
339
|
const _hoisted_2 = { class: "pl-3" };
|
|
298
|
-
const _hoisted_3 = { class: "flex
|
|
299
|
-
const _hoisted_4 =
|
|
300
|
-
const _hoisted_5 =
|
|
301
|
-
const _hoisted_6 = { class: "
|
|
302
|
-
const _hoisted_7 =
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
340
|
+
const _hoisted_3 = { class: "flex items-center flex-1" };
|
|
341
|
+
const _hoisted_4 = ["src"];
|
|
342
|
+
const _hoisted_5 = { class: "flex-1 pr-4" };
|
|
343
|
+
const _hoisted_6 = { class: "not-italic text-12 text-gray-400 ml-1" };
|
|
344
|
+
const _hoisted_7 = {
|
|
345
|
+
key: 0,
|
|
346
|
+
class: "ant-progress ant-progress-line ant-progress-default ant-progress-status-normal"
|
|
347
|
+
};
|
|
348
|
+
const _hoisted_8 = { class: "ant-progress-outer" };
|
|
349
|
+
const _hoisted_9 = { class: "ant-progress-inner" };
|
|
350
|
+
const _hoisted_10 = { class: "flex items-center" };
|
|
351
|
+
const _hoisted_11 = ["onClick"];
|
|
352
|
+
const _hoisted_12 = { key: 0 };
|
|
353
|
+
const _hoisted_13 = /* @__PURE__ */ createElementVNode("i", { class: "i ic:baseline-file-upload" }, null, -1);
|
|
354
|
+
const _hoisted_14 = /* @__PURE__ */ createElementVNode("div", null, "\u6587\u4EF6\u4E0A\u4F20", -1);
|
|
355
|
+
const _hoisted_15 = [
|
|
356
|
+
_hoisted_13,
|
|
357
|
+
_hoisted_14
|
|
309
358
|
];
|
|
310
359
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
311
360
|
__name: "index",
|
|
@@ -323,6 +372,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
323
372
|
maxCount: maxCountRef,
|
|
324
373
|
maxSize: maxSizeRef
|
|
325
374
|
} = toRefs(props);
|
|
375
|
+
const fieldNamesRef = computed(() => {
|
|
376
|
+
return {
|
|
377
|
+
...{
|
|
378
|
+
fileId: "id",
|
|
379
|
+
fileName: "fileName",
|
|
380
|
+
filePath: "fileUrl",
|
|
381
|
+
fileSize: "fileSize",
|
|
382
|
+
fileType: "extendName"
|
|
383
|
+
},
|
|
384
|
+
...unref(props.fieldNames)
|
|
385
|
+
};
|
|
386
|
+
});
|
|
326
387
|
const {
|
|
327
388
|
getStringAccept,
|
|
328
389
|
getHelpText,
|
|
@@ -333,7 +394,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
333
394
|
acceptRef,
|
|
334
395
|
helpTextRef,
|
|
335
396
|
maxCountRef,
|
|
336
|
-
maxSizeRef
|
|
397
|
+
maxSizeRef,
|
|
398
|
+
fieldNamesRef
|
|
337
399
|
});
|
|
338
400
|
const btns = [
|
|
339
401
|
{
|
|
@@ -380,7 +442,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
380
442
|
};
|
|
381
443
|
});
|
|
382
444
|
const handlePreview = async (file) => {
|
|
383
|
-
imgSrcRef.value = file.
|
|
445
|
+
imgSrcRef.value = file.filePath;
|
|
384
446
|
imgVisable.value = true;
|
|
385
447
|
};
|
|
386
448
|
const uploadFile = async ({ file, onSuccess, onError, onProgress }) => {
|
|
@@ -409,12 +471,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
409
471
|
[fileName || "file"]: file
|
|
410
472
|
}
|
|
411
473
|
);
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
474
|
+
let field = {}, fieldNames = unref(fieldNamesRef);
|
|
475
|
+
for (let key in fieldNames) {
|
|
476
|
+
let val = fieldNames[key];
|
|
477
|
+
if (key === "filePath") {
|
|
478
|
+
field[key] = result?.data?.[val] ?? `${getAppConf.http?.baseUrl}${_downloadUrl}?id=${result?.data?.fileId}`;
|
|
479
|
+
field["url"] = field["thumbUrl"] = field[key];
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
if (key === "fileType") {
|
|
483
|
+
field[key] = result?.data?.[val] ?? takeRight(file.name?.split("."))?.[0];
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
if (key === "fileSize") {
|
|
487
|
+
field[key] = getFileSize(file.size);
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
if (key === "fileName") {
|
|
491
|
+
field[key] = file.name;
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
field[key] = result?.data?.[val] ?? null;
|
|
495
|
+
}
|
|
496
|
+
Object.assign(file, field);
|
|
418
497
|
onSuccess(result);
|
|
419
498
|
} catch (err) {
|
|
420
499
|
onError(err);
|
|
@@ -427,7 +506,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
427
506
|
let _downloadUrl = isString(downloadUrl) ? downloadUrl : downloadUrl.api;
|
|
428
507
|
let _downloadType = isString(downloadUrl) ? "get" : downloadUrl.type;
|
|
429
508
|
if (["jpg", "jpeg", "png", "bmp", "gif"].includes(file.fileType)) {
|
|
430
|
-
imgSrcRef.value = `${getAppConf.http?.baseUrl}${_downloadUrl}?id=${file.fileId}`;
|
|
509
|
+
imgSrcRef.value = file.filePath ?? `${getAppConf.http?.baseUrl}${_downloadUrl}?id=${file.fileId}`;
|
|
431
510
|
imgVisable.value = true;
|
|
432
511
|
return;
|
|
433
512
|
}
|
|
@@ -465,13 +544,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
465
544
|
watch(
|
|
466
545
|
() => unref(fileList),
|
|
467
546
|
async (v) => {
|
|
468
|
-
let ids =
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
547
|
+
let ids = [];
|
|
548
|
+
unref(fileList).forEach((it) => {
|
|
549
|
+
ids.push(it.fileId);
|
|
550
|
+
});
|
|
551
|
+
if (props.emitSnippet || !props.emitSnippet && !ids.includes(void 0)) {
|
|
552
|
+
emits("change", ids.join(","), unref(fileList));
|
|
553
|
+
}
|
|
475
554
|
}
|
|
476
555
|
);
|
|
477
556
|
return (_ctx, _cache) => {
|
|
@@ -484,15 +563,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
484
563
|
"onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => isRef(fileList) ? fileList.value = $event : null)
|
|
485
564
|
}), createSlots({
|
|
486
565
|
itemRender: withCtx(({ file, actions }) => [
|
|
487
|
-
createElementVNode("div",
|
|
488
|
-
|
|
566
|
+
createElementVNode("div", {
|
|
567
|
+
class: normalizeClass(["flex justify-between border border-solid border-gray-300 p-1 mt-2", file?.status === "error" ? "ant-upload-list-item-error" : ""])
|
|
568
|
+
}, [
|
|
569
|
+
createElementVNode("div", _hoisted_3, [
|
|
489
570
|
createElementVNode("img", {
|
|
490
571
|
src: unref(getFileThumb)(file.fileType),
|
|
491
572
|
class: "w-9 h-9 mr-2 p-1"
|
|
492
|
-
}, null, 8,
|
|
493
|
-
createElementVNode("
|
|
573
|
+
}, null, 8, _hoisted_4),
|
|
574
|
+
createElementVNode("div", _hoisted_5, [
|
|
575
|
+
createElementVNode("span", null, [
|
|
576
|
+
createTextVNode(toDisplayString(file.fileName || file.name) + " ", 1),
|
|
577
|
+
createElementVNode("i", _hoisted_6, "(" + toDisplayString(file.fileSize) + ")", 1)
|
|
578
|
+
]),
|
|
579
|
+
createCommentVNode(" \u8BBE\u7F6E\u8FDB\u5EA6 "),
|
|
580
|
+
file.percent < 100 && file.percent > 0 ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
581
|
+
createElementVNode("div", _hoisted_8, [
|
|
582
|
+
createElementVNode("div", _hoisted_9, [
|
|
583
|
+
createElementVNode("div", {
|
|
584
|
+
class: "ant-progress-bg",
|
|
585
|
+
style: normalizeStyle({
|
|
586
|
+
width: `${file.percent}%`,
|
|
587
|
+
height: "2px"
|
|
588
|
+
})
|
|
589
|
+
}, null, 4)
|
|
590
|
+
])
|
|
591
|
+
])
|
|
592
|
+
])) : createCommentVNode("v-if", true)
|
|
593
|
+
])
|
|
494
594
|
]),
|
|
495
|
-
createElementVNode("div",
|
|
595
|
+
createElementVNode("div", _hoisted_10, [
|
|
496
596
|
(openBlock(), createElementBlock(Fragment, null, renderList(btns, (btn) => {
|
|
497
597
|
return openBlock(), createElementBlock(Fragment, {
|
|
498
598
|
key: btn.class
|
|
@@ -501,11 +601,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
501
601
|
key: 0,
|
|
502
602
|
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]),
|
|
503
603
|
onClick: ($event) => btn.click(file)
|
|
504
|
-
}, null, 10,
|
|
604
|
+
}, null, 10, _hoisted_11)) : createCommentVNode("v-if", true)
|
|
505
605
|
], 64);
|
|
506
606
|
}), 64))
|
|
507
607
|
])
|
|
508
|
-
])
|
|
608
|
+
], 2)
|
|
509
609
|
]),
|
|
510
610
|
default: withCtx(() => [
|
|
511
611
|
!unref(getBind).disabled ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
@@ -519,9 +619,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
519
619
|
_: 1
|
|
520
620
|
}),
|
|
521
621
|
createElementVNode("p", _hoisted_2, toDisplayString(unref(getHelpText)), 1)
|
|
522
|
-
])) : createCommentVNode("", true),
|
|
523
|
-
createVNode(
|
|
524
|
-
createVNode(
|
|
622
|
+
])) : createCommentVNode("v-if", true),
|
|
623
|
+
createVNode(PdfView, { onRegister: unref(registerPdf) }, null, 8, ["onRegister"]),
|
|
624
|
+
createVNode(DocxView, { onRegister: unref(registerDocx) }, null, 8, ["onRegister"])
|
|
525
625
|
]),
|
|
526
626
|
_: 2
|
|
527
627
|
}, [
|
|
@@ -533,22 +633,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
533
633
|
])
|
|
534
634
|
};
|
|
535
635
|
})
|
|
536
|
-
]), 1040, ["fileList"])) : createCommentVNode("", true),
|
|
636
|
+
]), 1040, ["fileList"])) : createCommentVNode("v-if", true),
|
|
537
637
|
unref(getBind).listType === "picture-card" ? (openBlock(), createBlock(_component_AUpload, mergeProps({ key: 1 }, unref(getBind), {
|
|
538
638
|
fileList: unref(fileList),
|
|
539
639
|
"onUpdate:fileList": _cache[1] || (_cache[1] = ($event) => isRef(fileList) ? fileList.value = $event : null),
|
|
540
640
|
onPreview: handlePreview
|
|
541
641
|
}), {
|
|
542
642
|
default: withCtx(() => [
|
|
543
|
-
!unref(getBind).disabled && (!_ctx.maxCount || !unref(fileList).length || unref(fileList).length < _ctx.maxCount) ? (openBlock(), createElementBlock("div",
|
|
643
|
+
!unref(getBind).disabled && (!_ctx.maxCount || !unref(fileList).length || unref(fileList).length < _ctx.maxCount) ? (openBlock(), createElementBlock("div", _hoisted_12, _hoisted_15)) : createCommentVNode("v-if", true)
|
|
544
644
|
]),
|
|
545
645
|
_: 1
|
|
546
|
-
}, 16, ["fileList"])) : createCommentVNode("", true),
|
|
547
|
-
unref(bindImg).src ? (openBlock(), createBlock(_component_AImage, mergeProps({ key: 2 }, unref(bindImg), { style: { display: "none" } }), null, 16)) : createCommentVNode("", true)
|
|
646
|
+
}, 16, ["fileList"])) : createCommentVNode("v-if", true),
|
|
647
|
+
unref(bindImg).src ? (openBlock(), createBlock(_component_AImage, mergeProps({ key: 2 }, unref(bindImg), { style: { display: "none" } }), null, 16)) : createCommentVNode("v-if", true)
|
|
548
648
|
]);
|
|
549
649
|
};
|
|
550
650
|
}
|
|
551
651
|
});
|
|
652
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/upload/src/index.vue"]]);
|
|
552
653
|
export {
|
|
553
|
-
|
|
654
|
+
index as DtUpload
|
|
554
655
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType, Ref, ComputedRef } from "vue";
|
|
2
|
-
import { UploadFile } from "./type/file";
|
|
2
|
+
import { FieldNames, UploadFile } from "./type/file";
|
|
3
3
|
import { UploadRequestOption } from "ant-design-vue/es/vc-upload/interface";
|
|
4
4
|
import { ApiType, Recordable } from "@dt-frames/core";
|
|
5
5
|
export declare const basicProps: {
|
|
@@ -21,6 +21,10 @@ export declare const basicProps: {
|
|
|
21
21
|
type: PropType<object | ((file: UploadFile) => object)>;
|
|
22
22
|
default: {};
|
|
23
23
|
};
|
|
24
|
+
fieldNames: {
|
|
25
|
+
type: PropType<FieldNames>;
|
|
26
|
+
default: {};
|
|
27
|
+
};
|
|
24
28
|
fileName: {
|
|
25
29
|
type: StringConstructor;
|
|
26
30
|
default: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare const _sfc_main: import("vue").DefineComponent<{}, {
|
|
2
2
|
ID: string;
|
|
3
|
+
domRef: any;
|
|
3
4
|
register: import("../../../modal/src/types/modal.type").RegisterFn;
|
|
4
5
|
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
6
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { Ref } from "vue";
|
|
2
|
-
import { UploadFile } from "../type/file";
|
|
3
|
-
export declare function useFile({ fileListRef, acceptRef, helpTextRef, maxCountRef, maxSizeRef, }: {
|
|
1
|
+
import { Ref, ComputedRef } from "vue";
|
|
2
|
+
import { FieldNames, UploadFile } from "../type/file";
|
|
3
|
+
export declare function useFile({ fileListRef, acceptRef, helpTextRef, maxCountRef, maxSizeRef, fieldNamesRef }: {
|
|
4
4
|
fileListRef: Ref<UploadFile[]>;
|
|
5
5
|
acceptRef: Ref<string[]>;
|
|
6
6
|
helpTextRef: Ref<string>;
|
|
7
7
|
maxCountRef: Ref<number>;
|
|
8
8
|
maxSizeRef: Ref<number>;
|
|
9
|
+
fieldNamesRef: ComputedRef<FieldNames>;
|
|
9
10
|
}): {
|
|
10
|
-
getAccept:
|
|
11
|
-
getStringAccept:
|
|
12
|
-
getHelpText:
|
|
11
|
+
getAccept: ComputedRef<string[]>;
|
|
12
|
+
getStringAccept: ComputedRef<string>;
|
|
13
|
+
getHelpText: ComputedRef<string>;
|
|
13
14
|
fileList: Ref<any[]>;
|
|
14
15
|
setFile: (file: any) => any;
|
|
15
16
|
beforeUpload: (file: File) => void;
|
|
@@ -19,6 +19,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
19
19
|
type: import("vue").PropType<object | ((file: UploadFile) => object)>;
|
|
20
20
|
default: {};
|
|
21
21
|
};
|
|
22
|
+
fieldNames: {
|
|
23
|
+
type: import("vue").PropType<import("./type/file").FieldNames>;
|
|
24
|
+
default: {};
|
|
25
|
+
};
|
|
22
26
|
fileName: {
|
|
23
27
|
type: StringConstructor;
|
|
24
28
|
default: string;
|
|
@@ -95,6 +99,13 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
95
99
|
helpTextRef: import("vue").Ref<string>;
|
|
96
100
|
maxCountRef: import("vue").Ref<number>;
|
|
97
101
|
maxSizeRef: import("vue").Ref<number>;
|
|
102
|
+
fieldNamesRef: import("vue").ComputedRef<{
|
|
103
|
+
fileId: string;
|
|
104
|
+
fileName: string;
|
|
105
|
+
filePath: string;
|
|
106
|
+
size: string;
|
|
107
|
+
fileType: string;
|
|
108
|
+
}>;
|
|
98
109
|
getStringAccept: import("vue").ComputedRef<string>;
|
|
99
110
|
getHelpText: import("vue").ComputedRef<string>;
|
|
100
111
|
fileList: import("vue").Ref<any[]>;
|
|
@@ -134,6 +145,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
134
145
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
135
146
|
DocxView: import("vue").DefineComponent<{}, {
|
|
136
147
|
ID: string;
|
|
148
|
+
domRef: any;
|
|
137
149
|
register: import("../../modal/src/types/modal.type").RegisterFn;
|
|
138
150
|
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<{}>>, {}>;
|
|
139
151
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
@@ -156,6 +168,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
156
168
|
type: import("vue").PropType<object | ((file: UploadFile) => object)>;
|
|
157
169
|
default: {};
|
|
158
170
|
};
|
|
171
|
+
fieldNames: {
|
|
172
|
+
type: import("vue").PropType<import("./type/file").FieldNames>;
|
|
173
|
+
default: {};
|
|
174
|
+
};
|
|
159
175
|
fileName: {
|
|
160
176
|
type: StringConstructor;
|
|
161
177
|
default: string;
|
|
@@ -225,6 +241,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
225
241
|
data: object | ((file: UploadFile) => object);
|
|
226
242
|
buttonText: string;
|
|
227
243
|
preIcon: string;
|
|
244
|
+
fieldNames: {};
|
|
228
245
|
fileName: string;
|
|
229
246
|
accept: string[];
|
|
230
247
|
disabled: Boolean | import("vue").Ref<Boolean> | import("vue").ComputedRef<Boolean>;
|
|
@@ -2,9 +2,16 @@ export declare type UploadFile = {
|
|
|
2
2
|
name?: string;
|
|
3
3
|
percent?: number;
|
|
4
4
|
status?: 'error' | 'success' | 'done' | 'uploading' | 'removed';
|
|
5
|
-
thumbUrl?: string;
|
|
6
5
|
uid?: string;
|
|
7
|
-
|
|
6
|
+
fileSize?: string | number;
|
|
7
|
+
filePath?: string;
|
|
8
8
|
fileId?: string;
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
};
|
|
11
|
+
export declare type FieldNames = {
|
|
12
|
+
fileId?: string;
|
|
13
|
+
fileName?: string;
|
|
14
|
+
filePath?: string;
|
|
15
|
+
fileSize?: string;
|
|
16
|
+
fileType?: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getFileSize(size: string | number): string;
|