@das-fed/ui 7.0.6 → 7.0.7
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/esm-map.json +3 -1
- package/package.json +6 -5
- package/packages/business-components/ai-panel/i18n/index.d.ts +8 -0
- package/packages/business-components/ai-panel/{index-Cp4XD3gm.js → index-8yffh0Id.js} +1380 -1331
- package/packages/business-components/ai-panel/index-8yffh0Id.js.gz +0 -0
- package/packages/business-components/ai-panel/{index-B5zC9zJy.js → index-OwRrV6K8.js} +1 -1
- package/packages/business-components/ai-panel/index-OwRrV6K8.js.gz +0 -0
- package/packages/business-components/ai-panel/index.js +1 -1
- package/packages/business-components/ai-panel/src/dasAI/apis.d.ts +1 -0
- package/packages/business-components/ai-panel/src/dasAI/store/index.d.ts +1 -0
- package/packages/business-components/ai-panel/style.css +1 -1
- package/packages/business-components/ai-panel/style.css.gz +0 -0
- package/packages/business-components/app-container/index.js +35 -33
- package/packages/business-components/app-container/index.js.gz +0 -0
- package/packages/business-components/app-container/src/style-theme.d.ts +2 -0
- package/packages/business-components/app-container/style.css +1 -1
- package/packages/business-components/app-container/style.css.gz +0 -0
- package/packages/business-components/currency-page/index.d.ts +3 -1
- package/packages/business-components/currency-page/index.js +40 -35
- package/packages/business-components/currency-page/index.js.gz +0 -0
- package/packages/business-components/currency-page/src/index.vue.d.ts +3 -1
- package/packages/business-components/currency-page/src/type.d.ts +6 -0
- package/packages/business-components/currency-page/style.css +1 -1
- package/packages/business-components/device-panel/src/components/drag-resize/index.vue.d.ts +1 -1
- package/packages/business-components/urgent-panel/src/components/drag-resize/index.vue.d.ts +1 -1
- package/packages/components/edit-table/index.d.ts +15 -15
- package/packages/components/edit-table/src/index.vue.d.ts +2 -2
- package/packages/components/image-upload/index.d.ts +1 -0
- package/packages/components/image-upload/index.js +767 -114
- package/packages/components/image-upload/index.js.gz +0 -0
- package/packages/components/image-upload/src/Index.vue.d.ts +1 -0
- package/packages/components/image-upload/src/hooks/use-compress-image.d.ts +1 -0
- package/packages/components/image-upload/src/type.d.ts +3 -0
- package/packages/components/image-upload/style.css +1 -1
- package/packages/components/image-upload/style.css.gz +0 -0
- package/packages/components/image-viewer/index.d.ts +1 -0
- package/packages/components/image-viewer/index.js +1086 -434
- package/packages/components/image-viewer/index.js.gz +0 -0
- package/packages/components/image-viewer/src/Index.vue.d.ts +1 -0
- package/packages/components/image-viewer/src/hooks/use-compress-image.d.ts +1 -0
- package/packages/components/image-viewer/src/type.d.ts +3 -0
- package/packages/components/image-viewer/style.css +1 -1
- package/packages/components/image-viewer/style.css.gz +0 -0
- package/packages/components/input/index.d.ts +3 -3
- package/packages/components/input/src/index.vue.d.ts +1 -1
- package/packages/components/menu-aside/index.d.ts +3 -3
- package/packages/components/menu-aside/index.js +236 -211
- package/packages/components/menu-aside/index.js.gz +0 -0
- package/packages/components/menu-aside/src/Index.vue.d.ts +1 -1
- package/packages/components/menu-aside/src/style-theme.d.ts +25 -0
- package/packages/components/menu-aside/src/type.d.ts +1 -1
- package/packages/components/menu-aside/style.css +1 -1
- package/packages/components/menu-aside/style.css.gz +0 -0
- package/packages/components/menu-header/index.d.ts +6 -0
- package/packages/components/menu-header/index.js +54 -50
- package/packages/components/menu-header/index.js.gz +0 -0
- package/packages/components/menu-header/src/Index.vue.d.ts +2 -0
- package/packages/components/menu-header/src/style-theme.d.ts +9 -0
- package/packages/components/menu-header/src/type.d.ts +6 -1
- package/packages/components/menu-header/style.css +1 -1
- package/packages/components/menu-header/style.css.gz +0 -0
- package/packages/components/pagination/index.d.ts +9 -9
- package/packages/components/pagination/src/Pagination.vue.d.ts +1 -1
- package/packages/components/search/index.d.ts +1 -1
- package/packages/components/search/src/Index.vue.d.ts +1 -1
- package/packages/components/select-list/index.d.ts +16 -16
- package/packages/components/select-list/src/Index.vue.d.ts +6 -6
- package/packages/components/tree-table/index.js +291 -263
- package/packages/components/tree-table/index.js.gz +0 -0
- package/packages/components/tree-table/src/hooks/use-five.d.ts +4 -0
- package/packages/components/tree-table/src/hooks/use-four.d.ts +4 -0
- package/packages/components/tree-table/src/type.d.ts +1 -1
- package/packages/components/tree-table/style.css +1 -1
- package/packages/components/tree-table/style.css.gz +0 -0
- package/packages/icons/index.d.ts +2 -0
- package/packages/icons/index.js +2 -0
- package/packages/icons/tucao/index.d.ts +1 -0
- package/packages/icons/tucao/index.js +17 -0
- package/packages/icons/tucao/index.js.gz +0 -0
- package/packages/icons/tucao/index.vue.d.ts +12 -0
- package/packages/icons/tucao-2/index.d.ts +1 -0
- package/packages/icons/tucao-2/index.js +17 -0
- package/packages/icons/tucao-2/index.js.gz +0 -0
- package/packages/icons/tucao-2/index.vue.d.ts +12 -0
- package/packages/business-components/ai-panel/index-B5zC9zJy.js.gz +0 -0
- package/packages/business-components/ai-panel/index-Cp4XD3gm.js.gz +0 -0
|
@@ -1,71 +1,723 @@
|
|
|
1
1
|
import '@das-fed/ui/packages/components/image-upload/style.css';
|
|
2
|
-
import { withInstall as
|
|
3
|
-
import { currentLang as
|
|
4
|
-
import { getVar as
|
|
5
|
-
import { computed as
|
|
6
|
-
import { UploadDragger as
|
|
2
|
+
import { withInstall as Ie } from "@das-fed/utils/with-install/index";
|
|
3
|
+
import { currentLang as ge, i18n as ve, t as G, setI18nRule as Pe } from "@das-fed/web/packages/i18n/index";
|
|
4
|
+
import { getVar as L, setThemeRule as Se } from "@das-fed/web/packages/theme/index";
|
|
5
|
+
import { computed as X, defineComponent as je, createElementBlock as Le, openBlock as _e, createCommentVNode as ye, withDirectives as K, createVNode as O, unref as v, normalizeClass as Ne, withCtx as R, createElementVNode as z, toDisplayString as Y, vShow as q, createTextVNode as We } from "vue";
|
|
6
|
+
import { UploadDragger as He, Upload as Ve } from "ant-design-vue";
|
|
7
7
|
import "ant-design-vue/es/upload/style/css";
|
|
8
|
-
import { DasSpin as
|
|
9
|
-
import { DasButton as
|
|
10
|
-
import { DasIconAddto as
|
|
11
|
-
import { DasIconWarning as
|
|
12
|
-
import { DasMessage as
|
|
13
|
-
import { getFileExtension as
|
|
14
|
-
import { useModelValue as
|
|
8
|
+
import { DasSpin as $e } from "@das-fed/ui/packages/components/spin/index";
|
|
9
|
+
import { DasButton as Ge } from "@das-fed/ui/packages/components/button/index";
|
|
10
|
+
import { DasIconAddto as Xe } from "@das-fed/ui/packages/icons/addto/index";
|
|
11
|
+
import { DasIconWarning as Ke } from "@das-fed/ui/packages/icons/warning/index";
|
|
12
|
+
import { DasMessage as be } from "@das-fed/ui/packages/components/message/index";
|
|
13
|
+
import { getFileExtension as Ye } from "@das-fed/utils/common-tools";
|
|
14
|
+
import { useModelValue as we } from "@das-fed/utils/vue";
|
|
15
15
|
import "@das-fed/ui/packages/global/theme";
|
|
16
|
-
const
|
|
17
|
-
isNaN(Number(
|
|
18
|
-
const
|
|
19
|
-
M:
|
|
20
|
-
K:
|
|
16
|
+
const qe = () => ({ size2B: (e) => {
|
|
17
|
+
isNaN(Number(e)) ? e = e.toString() : e = e + "M";
|
|
18
|
+
const a = Number(e.slice(0, -1)), r = e[e.length - 1].toUpperCase(), i = 1024, o = {
|
|
19
|
+
M: i * i,
|
|
20
|
+
K: i,
|
|
21
21
|
B: 1
|
|
22
22
|
};
|
|
23
|
-
return { finalSize:
|
|
24
|
-
} })
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
23
|
+
return { finalSize: a * o[r], sizeText: e };
|
|
24
|
+
} });
|
|
25
|
+
/*!
|
|
26
|
+
* Compressor.js v1.2.1
|
|
27
|
+
* https://fengyuanchen.github.io/compressorjs
|
|
28
|
+
*
|
|
29
|
+
* Copyright 2018-present Chen Fengyuan
|
|
30
|
+
* Released under the MIT license
|
|
31
|
+
*
|
|
32
|
+
* Date: 2023-02-28T14:09:41.732Z
|
|
33
|
+
*/
|
|
34
|
+
function xe(t, e) {
|
|
35
|
+
var a = Object.keys(t);
|
|
36
|
+
if (Object.getOwnPropertySymbols) {
|
|
37
|
+
var r = Object.getOwnPropertySymbols(t);
|
|
38
|
+
e && (r = r.filter(function(i) {
|
|
39
|
+
return Object.getOwnPropertyDescriptor(t, i).enumerable;
|
|
40
|
+
})), a.push.apply(a, r);
|
|
41
|
+
}
|
|
42
|
+
return a;
|
|
43
|
+
}
|
|
44
|
+
function j(t) {
|
|
45
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
46
|
+
var a = arguments[e] != null ? arguments[e] : {};
|
|
47
|
+
e % 2 ? xe(Object(a), !0).forEach(function(r) {
|
|
48
|
+
Ze(t, r, a[r]);
|
|
49
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(a)) : xe(Object(a)).forEach(function(r) {
|
|
50
|
+
Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(a, r));
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
function Je(t, e) {
|
|
56
|
+
if (!(t instanceof e))
|
|
57
|
+
throw new TypeError("Cannot call a class as a function");
|
|
58
|
+
}
|
|
59
|
+
function Ce(t, e) {
|
|
60
|
+
for (var a = 0; a < e.length; a++) {
|
|
61
|
+
var r = e[a];
|
|
62
|
+
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, De(r.key), r);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function Qe(t, e, a) {
|
|
66
|
+
return e && Ce(t.prototype, e), a && Ce(t, a), Object.defineProperty(t, "prototype", {
|
|
67
|
+
writable: !1
|
|
68
|
+
}), t;
|
|
69
|
+
}
|
|
70
|
+
function Ze(t, e, a) {
|
|
71
|
+
return e = De(e), e in t ? Object.defineProperty(t, e, {
|
|
72
|
+
value: a,
|
|
73
|
+
enumerable: !0,
|
|
74
|
+
configurable: !0,
|
|
75
|
+
writable: !0
|
|
76
|
+
}) : t[e] = a, t;
|
|
77
|
+
}
|
|
78
|
+
function _() {
|
|
79
|
+
return _ = Object.assign ? Object.assign.bind() : function(t) {
|
|
80
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
81
|
+
var a = arguments[e];
|
|
82
|
+
for (var r in a)
|
|
83
|
+
Object.prototype.hasOwnProperty.call(a, r) && (t[r] = a[r]);
|
|
84
|
+
}
|
|
85
|
+
return t;
|
|
86
|
+
}, _.apply(this, arguments);
|
|
87
|
+
}
|
|
88
|
+
function et(t, e) {
|
|
89
|
+
if (typeof t != "object" || t === null) return t;
|
|
90
|
+
var a = t[Symbol.toPrimitive];
|
|
91
|
+
if (a !== void 0) {
|
|
92
|
+
var r = a.call(t, e);
|
|
93
|
+
if (typeof r != "object") return r;
|
|
94
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
95
|
+
}
|
|
96
|
+
return String(t);
|
|
97
|
+
}
|
|
98
|
+
function De(t) {
|
|
99
|
+
var e = et(t, "string");
|
|
100
|
+
return typeof e == "symbol" ? e : String(e);
|
|
101
|
+
}
|
|
102
|
+
var Te = { exports: {} };
|
|
103
|
+
(function(t) {
|
|
104
|
+
typeof window > "u" || function(e) {
|
|
105
|
+
var a = e.HTMLCanvasElement && e.HTMLCanvasElement.prototype, r = e.Blob && function() {
|
|
106
|
+
try {
|
|
107
|
+
return !!new Blob();
|
|
108
|
+
} catch {
|
|
109
|
+
return !1;
|
|
110
|
+
}
|
|
111
|
+
}(), i = r && e.Uint8Array && function() {
|
|
112
|
+
try {
|
|
113
|
+
return new Blob([new Uint8Array(100)]).size === 100;
|
|
114
|
+
} catch {
|
|
115
|
+
return !1;
|
|
116
|
+
}
|
|
117
|
+
}(), o = e.BlobBuilder || e.WebKitBlobBuilder || e.MozBlobBuilder || e.MSBlobBuilder, m = /^data:((.*?)(;charset=.*?)?)(;base64)?,/, n = (r || o) && e.atob && e.ArrayBuffer && e.Uint8Array && function(c) {
|
|
118
|
+
var u, f, s, h, p, l, w, g, y;
|
|
119
|
+
if (u = c.match(m), !u)
|
|
120
|
+
throw new Error("invalid data URI");
|
|
121
|
+
for (f = u[2] ? u[1] : "text/plain" + (u[3] || ";charset=US-ASCII"), s = !!u[4], h = c.slice(u[0].length), s ? p = atob(h) : p = decodeURIComponent(h), l = new ArrayBuffer(p.length), w = new Uint8Array(l), g = 0; g < p.length; g += 1)
|
|
122
|
+
w[g] = p.charCodeAt(g);
|
|
123
|
+
return r ? new Blob([i ? w : l], {
|
|
124
|
+
type: f
|
|
125
|
+
}) : (y = new o(), y.append(l), y.getBlob(f));
|
|
126
|
+
};
|
|
127
|
+
e.HTMLCanvasElement && !a.toBlob && (a.mozGetAsFile ? a.toBlob = function(c, u, f) {
|
|
128
|
+
var s = this;
|
|
129
|
+
setTimeout(function() {
|
|
130
|
+
f && a.toDataURL && n ? c(n(s.toDataURL(u, f))) : c(s.mozGetAsFile("blob", u));
|
|
131
|
+
});
|
|
132
|
+
} : a.toDataURL && n && (a.msToBlob ? a.toBlob = function(c, u, f) {
|
|
133
|
+
var s = this;
|
|
134
|
+
setTimeout(function() {
|
|
135
|
+
(u && u !== "image/png" || f) && a.toDataURL && n ? c(n(s.toDataURL(u, f))) : c(s.msToBlob(u));
|
|
136
|
+
});
|
|
137
|
+
} : a.toBlob = function(c, u, f) {
|
|
138
|
+
var s = this;
|
|
139
|
+
setTimeout(function() {
|
|
140
|
+
c(n(s.toDataURL(u, f)));
|
|
141
|
+
});
|
|
142
|
+
})), t.exports ? t.exports = n : e.dataURLtoBlob = n;
|
|
143
|
+
}(window);
|
|
144
|
+
})(Te);
|
|
145
|
+
var Be = Te.exports, tt = function(e) {
|
|
146
|
+
return typeof Blob > "u" ? !1 : e instanceof Blob || Object.prototype.toString.call(e) === "[object Blob]";
|
|
147
|
+
}, Ae = {
|
|
148
|
+
/**
|
|
149
|
+
* Indicates if output the original image instead of the compressed one
|
|
150
|
+
* when the size of the compressed image is greater than the original one's
|
|
151
|
+
* @type {boolean}
|
|
152
|
+
*/
|
|
153
|
+
strict: !0,
|
|
154
|
+
/**
|
|
155
|
+
* Indicates if read the image's Exif Orientation information,
|
|
156
|
+
* and then rotate or flip the image automatically.
|
|
157
|
+
* @type {boolean}
|
|
158
|
+
*/
|
|
159
|
+
checkOrientation: !0,
|
|
160
|
+
/**
|
|
161
|
+
* Indicates if retain the image's Exif information after compressed.
|
|
162
|
+
* @type {boolean}
|
|
163
|
+
*/
|
|
164
|
+
retainExif: !1,
|
|
165
|
+
/**
|
|
166
|
+
* The max width of the output image.
|
|
167
|
+
* @type {number}
|
|
168
|
+
*/
|
|
169
|
+
maxWidth: 1 / 0,
|
|
170
|
+
/**
|
|
171
|
+
* The max height of the output image.
|
|
172
|
+
* @type {number}
|
|
173
|
+
*/
|
|
174
|
+
maxHeight: 1 / 0,
|
|
175
|
+
/**
|
|
176
|
+
* The min width of the output image.
|
|
177
|
+
* @type {number}
|
|
178
|
+
*/
|
|
179
|
+
minWidth: 0,
|
|
180
|
+
/**
|
|
181
|
+
* The min height of the output image.
|
|
182
|
+
* @type {number}
|
|
183
|
+
*/
|
|
184
|
+
minHeight: 0,
|
|
185
|
+
/**
|
|
186
|
+
* The width of the output image.
|
|
187
|
+
* If not specified, the natural width of the source image will be used.
|
|
188
|
+
* @type {number}
|
|
189
|
+
*/
|
|
190
|
+
width: void 0,
|
|
191
|
+
/**
|
|
192
|
+
* The height of the output image.
|
|
193
|
+
* If not specified, the natural height of the source image will be used.
|
|
194
|
+
* @type {number}
|
|
195
|
+
*/
|
|
196
|
+
height: void 0,
|
|
197
|
+
/**
|
|
198
|
+
* Sets how the size of the image should be resized to the container
|
|
199
|
+
* specified by the `width` and `height` options.
|
|
200
|
+
* @type {string}
|
|
201
|
+
*/
|
|
202
|
+
resize: "none",
|
|
203
|
+
/**
|
|
204
|
+
* The quality of the output image.
|
|
205
|
+
* It must be a number between `0` and `1`,
|
|
206
|
+
* and only available for `image/jpeg` and `image/webp` images.
|
|
207
|
+
* Check out {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob canvas.toBlob}.
|
|
208
|
+
* @type {number}
|
|
209
|
+
*/
|
|
210
|
+
quality: 0.8,
|
|
211
|
+
/**
|
|
212
|
+
* The mime type of the output image.
|
|
213
|
+
* By default, the original mime type of the source image file will be used.
|
|
214
|
+
* @type {string}
|
|
215
|
+
*/
|
|
216
|
+
mimeType: "auto",
|
|
217
|
+
/**
|
|
218
|
+
* Files whose file type is included in this list,
|
|
219
|
+
* and whose file size exceeds the `convertSize` value will be converted to JPEGs.
|
|
220
|
+
* @type {string|Array}
|
|
221
|
+
*/
|
|
222
|
+
convertTypes: ["image/png"],
|
|
223
|
+
/**
|
|
224
|
+
* PNG files over this size (5 MB by default) will be converted to JPEGs.
|
|
225
|
+
* To disable this, just set the value to `Infinity`.
|
|
226
|
+
* @type {number}
|
|
227
|
+
*/
|
|
228
|
+
convertSize: 5e6,
|
|
229
|
+
/**
|
|
230
|
+
* The hook function to execute before draw the image into the canvas for compression.
|
|
231
|
+
* @type {Function}
|
|
232
|
+
* @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.
|
|
233
|
+
* @param {HTMLCanvasElement} canvas - The canvas for compression.
|
|
234
|
+
* @example
|
|
235
|
+
* function (context, canvas) {
|
|
236
|
+
* context.fillStyle = '#fff';
|
|
237
|
+
* }
|
|
238
|
+
*/
|
|
239
|
+
beforeDraw: null,
|
|
240
|
+
/**
|
|
241
|
+
* The hook function to execute after drew the image into the canvas for compression.
|
|
242
|
+
* @type {Function}
|
|
243
|
+
* @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.
|
|
244
|
+
* @param {HTMLCanvasElement} canvas - The canvas for compression.
|
|
245
|
+
* @example
|
|
246
|
+
* function (context, canvas) {
|
|
247
|
+
* context.filter = 'grayscale(100%)';
|
|
248
|
+
* }
|
|
249
|
+
*/
|
|
250
|
+
drew: null,
|
|
251
|
+
/**
|
|
252
|
+
* The hook function to execute when success to compress the image.
|
|
253
|
+
* @type {Function}
|
|
254
|
+
* @param {File} file - The compressed image File object.
|
|
255
|
+
* @example
|
|
256
|
+
* function (file) {
|
|
257
|
+
* console.log(file);
|
|
258
|
+
* }
|
|
259
|
+
*/
|
|
260
|
+
success: null,
|
|
261
|
+
/**
|
|
262
|
+
* The hook function to execute when fail to compress the image.
|
|
263
|
+
* @type {Function}
|
|
264
|
+
* @param {Error} err - An Error object.
|
|
265
|
+
* @example
|
|
266
|
+
* function (err) {
|
|
267
|
+
* console.log(err.message);
|
|
268
|
+
* }
|
|
269
|
+
*/
|
|
270
|
+
error: null
|
|
271
|
+
}, at = typeof window < "u" && typeof window.document < "u", U = at ? window : {}, N = function(e) {
|
|
272
|
+
return e > 0 && e < 1 / 0;
|
|
273
|
+
}, rt = Array.prototype.slice;
|
|
274
|
+
function Z(t) {
|
|
275
|
+
return Array.from ? Array.from(t) : rt.call(t);
|
|
276
|
+
}
|
|
277
|
+
var it = /^image\/.+$/;
|
|
278
|
+
function Q(t) {
|
|
279
|
+
return it.test(t);
|
|
280
|
+
}
|
|
281
|
+
function ot(t) {
|
|
282
|
+
var e = Q(t) ? t.substr(6) : "";
|
|
283
|
+
return e === "jpeg" && (e = "jpg"), ".".concat(e);
|
|
284
|
+
}
|
|
285
|
+
var Oe = String.fromCharCode;
|
|
286
|
+
function nt(t, e, a) {
|
|
287
|
+
var r = "", i;
|
|
288
|
+
for (a += e, i = e; i < a; i += 1)
|
|
289
|
+
r += Oe(t.getUint8(i));
|
|
290
|
+
return r;
|
|
291
|
+
}
|
|
292
|
+
var st = U.btoa;
|
|
293
|
+
function ke(t, e) {
|
|
294
|
+
for (var a = [], r = 8192, i = new Uint8Array(t); i.length > 0; )
|
|
295
|
+
a.push(Oe.apply(null, Z(i.subarray(0, r)))), i = i.subarray(r);
|
|
296
|
+
return "data:".concat(e, ";base64,").concat(st(a.join("")));
|
|
297
|
+
}
|
|
298
|
+
function lt(t) {
|
|
299
|
+
var e = new DataView(t), a;
|
|
300
|
+
try {
|
|
301
|
+
var r, i, o;
|
|
302
|
+
if (e.getUint8(0) === 255 && e.getUint8(1) === 216)
|
|
303
|
+
for (var m = e.byteLength, n = 2; n + 1 < m; ) {
|
|
304
|
+
if (e.getUint8(n) === 255 && e.getUint8(n + 1) === 225) {
|
|
305
|
+
i = n;
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
n += 1;
|
|
309
|
+
}
|
|
310
|
+
if (i) {
|
|
311
|
+
var c = i + 4, u = i + 10;
|
|
312
|
+
if (nt(e, c, 4) === "Exif") {
|
|
313
|
+
var f = e.getUint16(u);
|
|
314
|
+
if (r = f === 18761, (r || f === 19789) && e.getUint16(u + 2, r) === 42) {
|
|
315
|
+
var s = e.getUint32(u + 4, r);
|
|
316
|
+
s >= 8 && (o = u + s);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (o) {
|
|
321
|
+
var h = e.getUint16(o, r), p, l;
|
|
322
|
+
for (l = 0; l < h; l += 1)
|
|
323
|
+
if (p = o + l * 12 + 2, e.getUint16(p, r) === 274) {
|
|
324
|
+
p += 8, a = e.getUint16(p, r), e.setUint16(p, 1, r);
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
} catch {
|
|
329
|
+
a = 1;
|
|
330
|
+
}
|
|
331
|
+
return a;
|
|
332
|
+
}
|
|
333
|
+
function ct(t) {
|
|
334
|
+
var e = 0, a = 1, r = 1;
|
|
335
|
+
switch (t) {
|
|
336
|
+
case 2:
|
|
337
|
+
a = -1;
|
|
338
|
+
break;
|
|
339
|
+
case 3:
|
|
340
|
+
e = -180;
|
|
341
|
+
break;
|
|
342
|
+
case 4:
|
|
343
|
+
r = -1;
|
|
344
|
+
break;
|
|
345
|
+
case 5:
|
|
346
|
+
e = 90, r = -1;
|
|
347
|
+
break;
|
|
348
|
+
case 6:
|
|
349
|
+
e = 90;
|
|
350
|
+
break;
|
|
351
|
+
case 7:
|
|
352
|
+
e = 90, a = -1;
|
|
353
|
+
break;
|
|
354
|
+
case 8:
|
|
355
|
+
e = -90;
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
rotate: e,
|
|
360
|
+
scaleX: a,
|
|
361
|
+
scaleY: r
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
var ut = /\.\d*(?:0|9){12}\d*$/;
|
|
365
|
+
function Ee(t) {
|
|
366
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e11;
|
|
367
|
+
return ut.test(t) ? Math.round(t * e) / e : t;
|
|
368
|
+
}
|
|
369
|
+
function I(t) {
|
|
370
|
+
var e = t.aspectRatio, a = t.height, r = t.width, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "none", o = N(r), m = N(a);
|
|
371
|
+
if (o && m) {
|
|
372
|
+
var n = a * e;
|
|
373
|
+
(i === "contain" || i === "none") && n > r || i === "cover" && n < r ? a = r / e : r = a * e;
|
|
374
|
+
} else o ? a = r / e : m && (r = a * e);
|
|
375
|
+
return {
|
|
376
|
+
width: r,
|
|
377
|
+
height: a
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
function mt(t) {
|
|
381
|
+
for (var e = Z(new Uint8Array(t)), a = e.length, r = [], i = 0; i + 3 < a; ) {
|
|
382
|
+
var o = e[i], m = e[i + 1];
|
|
383
|
+
if (o === 255 && m === 218)
|
|
384
|
+
break;
|
|
385
|
+
if (o === 255 && m === 216)
|
|
386
|
+
i += 2;
|
|
387
|
+
else {
|
|
388
|
+
var n = e[i + 2] * 256 + e[i + 3], c = i + n + 2, u = e.slice(i, c);
|
|
389
|
+
r.push(u), i = c;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return r.reduce(function(f, s) {
|
|
393
|
+
return s[0] === 255 && s[1] === 225 ? f.concat(s) : f;
|
|
394
|
+
}, []);
|
|
395
|
+
}
|
|
396
|
+
function ft(t, e) {
|
|
397
|
+
var a = Z(new Uint8Array(t));
|
|
398
|
+
if (a[2] !== 255 || a[3] !== 224)
|
|
399
|
+
return t;
|
|
400
|
+
var r = a[4] * 256 + a[5], i = [255, 216].concat(e, a.slice(4 + r));
|
|
401
|
+
return new Uint8Array(i);
|
|
402
|
+
}
|
|
403
|
+
var dt = U.ArrayBuffer, J = U.FileReader, D = U.URL || U.webkitURL, pt = /\.\w+$/, ht = U.Compressor, gt = /* @__PURE__ */ function() {
|
|
404
|
+
function t(e, a) {
|
|
405
|
+
Je(this, t), this.file = e, this.exif = [], this.image = new Image(), this.options = j(j({}, Ae), a), this.aborted = !1, this.result = null, this.init();
|
|
406
|
+
}
|
|
407
|
+
return Qe(t, [{
|
|
408
|
+
key: "init",
|
|
409
|
+
value: function() {
|
|
410
|
+
var a = this, r = this.file, i = this.options;
|
|
411
|
+
if (!tt(r)) {
|
|
412
|
+
this.fail(new Error("The first argument must be a File or Blob object."));
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
var o = r.type;
|
|
416
|
+
if (!Q(o)) {
|
|
417
|
+
this.fail(new Error("The first argument must be an image File or Blob object."));
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
if (!D || !J) {
|
|
421
|
+
this.fail(new Error("The current browser does not support image compression."));
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
dt || (i.checkOrientation = !1, i.retainExif = !1);
|
|
425
|
+
var m = o === "image/jpeg", n = m && i.checkOrientation, c = m && i.retainExif;
|
|
426
|
+
if (D && !n && !c)
|
|
427
|
+
this.load({
|
|
428
|
+
url: D.createObjectURL(r)
|
|
429
|
+
});
|
|
430
|
+
else {
|
|
431
|
+
var u = new J();
|
|
432
|
+
this.reader = u, u.onload = function(f) {
|
|
433
|
+
var s = f.target, h = s.result, p = {}, l = 1;
|
|
434
|
+
n && (l = lt(h), l > 1 && _(p, ct(l))), c && (a.exif = mt(h)), n || c ? !D || l > 1 ? p.url = ke(h, o) : p.url = D.createObjectURL(r) : p.url = h, a.load(p);
|
|
435
|
+
}, u.onabort = function() {
|
|
436
|
+
a.fail(new Error("Aborted to read the image with FileReader."));
|
|
437
|
+
}, u.onerror = function() {
|
|
438
|
+
a.fail(new Error("Failed to read the image with FileReader."));
|
|
439
|
+
}, u.onloadend = function() {
|
|
440
|
+
a.reader = null;
|
|
441
|
+
}, n || c ? u.readAsArrayBuffer(r) : u.readAsDataURL(r);
|
|
41
442
|
}
|
|
42
443
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
444
|
+
}, {
|
|
445
|
+
key: "load",
|
|
446
|
+
value: function(a) {
|
|
447
|
+
var r = this, i = this.file, o = this.image;
|
|
448
|
+
o.onload = function() {
|
|
449
|
+
r.draw(j(j({}, a), {}, {
|
|
450
|
+
naturalWidth: o.naturalWidth,
|
|
451
|
+
naturalHeight: o.naturalHeight
|
|
452
|
+
}));
|
|
453
|
+
}, o.onabort = function() {
|
|
454
|
+
r.fail(new Error("Aborted to load the image."));
|
|
455
|
+
}, o.onerror = function() {
|
|
456
|
+
r.fail(new Error("Failed to load the image."));
|
|
457
|
+
}, U.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(U.navigator.userAgent) && (o.crossOrigin = "anonymous"), o.alt = i.name, o.src = a.url;
|
|
458
|
+
}
|
|
459
|
+
}, {
|
|
460
|
+
key: "draw",
|
|
461
|
+
value: function(a) {
|
|
462
|
+
var r = this, i = a.naturalWidth, o = a.naturalHeight, m = a.rotate, n = m === void 0 ? 0 : m, c = a.scaleX, u = c === void 0 ? 1 : c, f = a.scaleY, s = f === void 0 ? 1 : f, h = this.file, p = this.image, l = this.options, w = document.createElement("canvas"), g = w.getContext("2d"), y = Math.abs(n) % 180 === 90, C = (l.resize === "contain" || l.resize === "cover") && N(l.width) && N(l.height), x = Math.max(l.maxWidth, 0) || 1 / 0, B = Math.max(l.maxHeight, 0) || 1 / 0, A = Math.max(l.minWidth, 0) || 0, k = Math.max(l.minHeight, 0) || 0, E = i / o, b = l.width, d = l.height;
|
|
463
|
+
if (y) {
|
|
464
|
+
var P = [B, x];
|
|
465
|
+
x = P[0], B = P[1];
|
|
466
|
+
var S = [k, A];
|
|
467
|
+
A = S[0], k = S[1];
|
|
468
|
+
var ee = [d, b];
|
|
469
|
+
b = ee[0], d = ee[1];
|
|
470
|
+
}
|
|
471
|
+
C && (E = b / d);
|
|
472
|
+
var te = I({
|
|
473
|
+
aspectRatio: E,
|
|
474
|
+
width: x,
|
|
475
|
+
height: B
|
|
476
|
+
}, "contain");
|
|
477
|
+
x = te.width, B = te.height;
|
|
478
|
+
var ae = I({
|
|
479
|
+
aspectRatio: E,
|
|
480
|
+
width: A,
|
|
481
|
+
height: k
|
|
482
|
+
}, "cover");
|
|
483
|
+
if (A = ae.width, k = ae.height, C) {
|
|
484
|
+
var re = I({
|
|
485
|
+
aspectRatio: E,
|
|
486
|
+
width: b,
|
|
487
|
+
height: d
|
|
488
|
+
}, l.resize);
|
|
489
|
+
b = re.width, d = re.height;
|
|
490
|
+
} else {
|
|
491
|
+
var ie = I({
|
|
492
|
+
aspectRatio: E,
|
|
493
|
+
width: b,
|
|
494
|
+
height: d
|
|
495
|
+
}), oe = ie.width;
|
|
496
|
+
b = oe === void 0 ? i : oe;
|
|
497
|
+
var ne = ie.height;
|
|
498
|
+
d = ne === void 0 ? o : ne;
|
|
499
|
+
}
|
|
500
|
+
b = Math.floor(Ee(Math.min(Math.max(b, A), x))), d = Math.floor(Ee(Math.min(Math.max(d, k), B)));
|
|
501
|
+
var Re = -b / 2, Me = -d / 2, Fe = b, ze = d, W = [];
|
|
502
|
+
if (C) {
|
|
503
|
+
var se = 0, le = 0, H = i, V = o, ce = I({
|
|
504
|
+
aspectRatio: E,
|
|
505
|
+
width: i,
|
|
506
|
+
height: o
|
|
507
|
+
}, {
|
|
508
|
+
contain: "cover",
|
|
509
|
+
cover: "contain"
|
|
510
|
+
}[l.resize]);
|
|
511
|
+
H = ce.width, V = ce.height, se = (i - H) / 2, le = (o - V) / 2, W.push(se, le, H, V);
|
|
512
|
+
}
|
|
513
|
+
if (W.push(Re, Me, Fe, ze), y) {
|
|
514
|
+
var ue = [d, b];
|
|
515
|
+
b = ue[0], d = ue[1];
|
|
516
|
+
}
|
|
517
|
+
w.width = b, w.height = d, Q(l.mimeType) || (l.mimeType = h.type);
|
|
518
|
+
var me = "transparent";
|
|
519
|
+
h.size > l.convertSize && l.convertTypes.indexOf(l.mimeType) >= 0 && (l.mimeType = "image/jpeg");
|
|
520
|
+
var fe = l.mimeType === "image/jpeg";
|
|
521
|
+
if (fe && (me = "#fff"), g.fillStyle = me, g.fillRect(0, 0, b, d), l.beforeDraw && l.beforeDraw.call(this, g, w), !this.aborted && (g.save(), g.translate(b / 2, d / 2), g.rotate(n * Math.PI / 180), g.scale(u, s), g.drawImage.apply(g, [p].concat(W)), g.restore(), l.drew && l.drew.call(this, g, w), !this.aborted)) {
|
|
522
|
+
var de = function(M) {
|
|
523
|
+
if (!r.aborted) {
|
|
524
|
+
var pe = function(F) {
|
|
525
|
+
return r.done({
|
|
526
|
+
naturalWidth: i,
|
|
527
|
+
naturalHeight: o,
|
|
528
|
+
result: F
|
|
529
|
+
});
|
|
530
|
+
};
|
|
531
|
+
if (M && fe && l.retainExif && r.exif && r.exif.length > 0) {
|
|
532
|
+
var he = function(F) {
|
|
533
|
+
return pe(Be(ke(ft(F, r.exif), l.mimeType)));
|
|
534
|
+
};
|
|
535
|
+
if (M.arrayBuffer)
|
|
536
|
+
M.arrayBuffer().then(he).catch(function() {
|
|
537
|
+
r.fail(new Error("Failed to read the compressed image with Blob.arrayBuffer()."));
|
|
538
|
+
});
|
|
539
|
+
else {
|
|
540
|
+
var T = new J();
|
|
541
|
+
r.reader = T, T.onload = function($) {
|
|
542
|
+
var F = $.target;
|
|
543
|
+
he(F.result);
|
|
544
|
+
}, T.onabort = function() {
|
|
545
|
+
r.fail(new Error("Aborted to read the compressed image with FileReader."));
|
|
546
|
+
}, T.onerror = function() {
|
|
547
|
+
r.fail(new Error("Failed to read the compressed image with FileReader."));
|
|
548
|
+
}, T.onloadend = function() {
|
|
549
|
+
r.reader = null;
|
|
550
|
+
}, T.readAsArrayBuffer(M);
|
|
551
|
+
}
|
|
552
|
+
} else
|
|
553
|
+
pe(M);
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
w.toBlob ? w.toBlob(de, l.mimeType, l.quality) : de(Be(w.toDataURL(l.mimeType, l.quality)));
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}, {
|
|
560
|
+
key: "done",
|
|
561
|
+
value: function(a) {
|
|
562
|
+
var r = a.naturalWidth, i = a.naturalHeight, o = a.result, m = this.file, n = this.image, c = this.options;
|
|
563
|
+
if (D && n.src.indexOf("blob:") === 0 && D.revokeObjectURL(n.src), o)
|
|
564
|
+
if (c.strict && !c.retainExif && o.size > m.size && c.mimeType === m.type && !(c.width > r || c.height > i || c.minWidth > r || c.minHeight > i || c.maxWidth < r || c.maxHeight < i))
|
|
565
|
+
o = m;
|
|
566
|
+
else {
|
|
567
|
+
var u = /* @__PURE__ */ new Date();
|
|
568
|
+
o.lastModified = u.getTime(), o.lastModifiedDate = u, o.name = m.name, o.name && o.type !== m.type && (o.name = o.name.replace(pt, ot(o.type)));
|
|
569
|
+
}
|
|
570
|
+
else
|
|
571
|
+
o = m;
|
|
572
|
+
this.result = o, c.success && c.success.call(this, o);
|
|
573
|
+
}
|
|
574
|
+
}, {
|
|
575
|
+
key: "fail",
|
|
576
|
+
value: function(a) {
|
|
577
|
+
var r = this.options;
|
|
578
|
+
if (r.error)
|
|
579
|
+
r.error.call(this, a);
|
|
580
|
+
else
|
|
581
|
+
throw a;
|
|
582
|
+
}
|
|
583
|
+
}, {
|
|
584
|
+
key: "abort",
|
|
585
|
+
value: function() {
|
|
586
|
+
this.aborted || (this.aborted = !0, this.reader ? this.reader.abort() : this.image.complete ? this.fail(new Error("The compression process has been aborted.")) : (this.image.onload = null, this.image.onabort()));
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Get the no conflict compressor class.
|
|
590
|
+
* @returns {Compressor} The compressor class.
|
|
591
|
+
*/
|
|
592
|
+
}], [{
|
|
593
|
+
key: "noConflict",
|
|
594
|
+
value: function() {
|
|
595
|
+
return window.Compressor = ht, t;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Change the default options.
|
|
599
|
+
* @param {Object} options - The new default options.
|
|
600
|
+
*/
|
|
601
|
+
}, {
|
|
602
|
+
key: "setDefaults",
|
|
603
|
+
value: function(a) {
|
|
604
|
+
_(Ae, a);
|
|
605
|
+
}
|
|
606
|
+
}]), t;
|
|
607
|
+
}();
|
|
608
|
+
const vt = (t, e) => new Promise((a, r) => {
|
|
609
|
+
if (t.size <= e)
|
|
610
|
+
return t;
|
|
611
|
+
const i = e / t.size, o = Math.max(0.5, Math.min(0.9, 0.8 * i)), m = Math.max(800, Math.min(1920, 1920 * Math.sqrt(i)));
|
|
612
|
+
Ue(t, o, m, m, (n) => {
|
|
613
|
+
n.size <= e ? a(n) : Ue(
|
|
614
|
+
n,
|
|
615
|
+
Math.max(0.4, o - 0.2),
|
|
616
|
+
// 降低质量
|
|
617
|
+
Math.max(640, m * 0.8),
|
|
618
|
+
// 缩小尺寸
|
|
619
|
+
Math.max(640, m * 0.8),
|
|
620
|
+
a,
|
|
621
|
+
r,
|
|
622
|
+
t
|
|
623
|
+
// 传递原始文件用于错误处理
|
|
624
|
+
);
|
|
625
|
+
}, r, t);
|
|
626
|
+
}), Ue = (t, e, a, r, i, o, m) => {
|
|
627
|
+
new gt(t, {
|
|
628
|
+
quality: e,
|
|
629
|
+
maxWidth: a,
|
|
630
|
+
maxHeight: r,
|
|
631
|
+
convertSize: 1 / 0,
|
|
632
|
+
success(n) {
|
|
633
|
+
try {
|
|
634
|
+
const c = new File([n], t.name, {
|
|
635
|
+
type: n.type || t.type,
|
|
636
|
+
lastModified: Date.now()
|
|
637
|
+
});
|
|
638
|
+
i(c);
|
|
639
|
+
} catch (c) {
|
|
640
|
+
o({
|
|
641
|
+
message: "文件转换失败",
|
|
642
|
+
error: c,
|
|
643
|
+
original: m || t
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
},
|
|
647
|
+
error(n) {
|
|
648
|
+
o({
|
|
649
|
+
message: "图片压缩失败",
|
|
650
|
+
error: n,
|
|
651
|
+
original: m || t
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
}, yt = (t, e) => {
|
|
656
|
+
const a = we(t, "status"), { size2B: r } = qe(), i = we(t, "isOverMaxLimitCompressImg"), o = [".mp4", ".avi", ".mkv", ".mov", ".wmv", ".flv", ".mpeg", ".webm"], m = [".mp3", ".wav", ".aac", ".flac", ".ogg", ".alff", ".wma", ".m4a"], n = X(() => {
|
|
657
|
+
var h;
|
|
658
|
+
let s = t.accept ? (h = t.accept) == null ? void 0 : h.split(",") : [];
|
|
659
|
+
return s.includes("image/jpg") && !s.includes("image/jpeg") && s.push("image/jpeg"), s.includes(".jpg") && !s.includes(".jpeg") && s.push(".jpeg"), t.acceptVideo && (s = [...s, ...o]), t.acceptAudio && (s = [...s, ...m]), s.join(",");
|
|
660
|
+
}), c = X(() => a.value === "uploading"), u = X(() => a.value === "error");
|
|
661
|
+
return { isAccept: n, uploadStatus: a, loading: c, errored: u, beforeupload: (s) => {
|
|
662
|
+
var l, w, g;
|
|
663
|
+
if (t.maxSize) {
|
|
664
|
+
const { finalSize: y, sizeText: C } = r(t.maxSize);
|
|
665
|
+
if (s.size > y && !i.value) {
|
|
666
|
+
const x = t.acceptAudio || t.acceptVideo ? "das-ui-import-upload-key4" : "das-ui-import-upload-key3", B = ge.value === "zh-CN" ? "、" : ", ", A = ve(
|
|
667
|
+
x,
|
|
668
|
+
C,
|
|
669
|
+
((g = (w = (l = n.value) == null ? void 0 : l.toUpperCase()) == null ? void 0 : w.replaceAll(".", "")) == null ? void 0 : g.replaceAll(",", B)) ?? ""
|
|
670
|
+
).value, k = t.errorMessage || A;
|
|
671
|
+
return be.warning(k), e("update:status", "normal"), a.value = "normal", !1;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
const h = [
|
|
675
|
+
"image/jpeg",
|
|
676
|
+
"image/png",
|
|
677
|
+
"image/webp",
|
|
678
|
+
"image/gif",
|
|
679
|
+
"image/bmp",
|
|
680
|
+
"image/tiff",
|
|
681
|
+
"image/svg+xml"
|
|
682
|
+
], p = async () => {
|
|
683
|
+
a.value = "uploading";
|
|
684
|
+
let y = s;
|
|
685
|
+
if (t.maxSize) {
|
|
686
|
+
const { finalSize: C } = r(t.maxSize);
|
|
687
|
+
if (s.size > C && i.value && h.includes(s.type))
|
|
688
|
+
try {
|
|
689
|
+
y = await vt(s, C);
|
|
690
|
+
} catch (x) {
|
|
691
|
+
y = (x == null ? void 0 : x.original) || s;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return e("update:status", "uploading"), e("image-upload", y), !1;
|
|
695
|
+
};
|
|
696
|
+
if (t.customCheck) {
|
|
697
|
+
const y = t.customCheck(s);
|
|
698
|
+
if (y instanceof Promise)
|
|
699
|
+
return new Promise(async (C, x) => {
|
|
700
|
+
let B;
|
|
49
701
|
try {
|
|
50
|
-
|
|
702
|
+
B = await y.then();
|
|
51
703
|
} catch {
|
|
52
|
-
|
|
704
|
+
B = !1;
|
|
53
705
|
}
|
|
54
|
-
|
|
706
|
+
B ? p() : x(!1);
|
|
55
707
|
});
|
|
56
|
-
if (!
|
|
57
|
-
return
|
|
58
|
-
} else if (
|
|
59
|
-
const
|
|
60
|
-
let
|
|
61
|
-
if (!
|
|
62
|
-
const
|
|
63
|
-
return
|
|
708
|
+
if (!y)
|
|
709
|
+
return e("update:status", "normal"), a.value = "normal", !1;
|
|
710
|
+
} else if (n.value) {
|
|
711
|
+
const y = n.value.split(",").filter((d) => d.trim().startsWith(".")).map((d) => d.trim()), C = n.value.split(",").filter((d) => !d.trim().startsWith(".")).map((d) => d.trim()), x = Ye(s.name), B = y.includes(x);
|
|
712
|
+
let A = C.includes("image/*") && s.type.split("/")[0].trim() === "image", k = C.includes("video/*") && s.type.split("/")[0].trim() === "video", E = C.includes("audio/*") && s.type.split("/")[0].trim() === "audio", b = C.includes(s.type) || A || k || E;
|
|
713
|
+
if (!B && !b) {
|
|
714
|
+
const d = t.acceptAudio || t.acceptVideo ? "das-ui-import-upload-key2" : "das-ui-import-upload-key1", P = ge.value === "zh-CN" ? "、" : ", ", S = t.errorMessage || ve(d, n.value.toUpperCase().replaceAll(".", "").replaceAll(",", P)).value;
|
|
715
|
+
return be.warning(S), !1;
|
|
64
716
|
}
|
|
65
717
|
}
|
|
66
|
-
return
|
|
718
|
+
return p();
|
|
67
719
|
} };
|
|
68
|
-
},
|
|
720
|
+
}, bt = { class: "das-ui-image-upload" }, wt = { class: "das-ui-image-upload-dragger-context" }, xt = { class: "text" }, Ct = { class: "das-ui-image-upload-error-container" }, Bt = { class: "tips-container" }, At = { class: "text" }, kt = /* @__PURE__ */ je({
|
|
69
721
|
__name: "Index",
|
|
70
722
|
props: {
|
|
71
723
|
maxCount: { default: 1 },
|
|
@@ -78,39 +730,40 @@ const oe = () => ({ size2B: (t) => {
|
|
|
78
730
|
maxSize: {},
|
|
79
731
|
customCheck: {},
|
|
80
732
|
autoContentType: { type: Boolean },
|
|
81
|
-
openFileDialogOnClick: { type: Boolean, default: !0 }
|
|
733
|
+
openFileDialogOnClick: { type: Boolean, default: !0 },
|
|
734
|
+
isOverMaxLimitCompressImg: { type: Boolean, default: !1 }
|
|
82
735
|
},
|
|
83
736
|
emits: ["update:status", "image-upload"],
|
|
84
|
-
setup(
|
|
85
|
-
const
|
|
86
|
-
return (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
class:
|
|
737
|
+
setup(t, { emit: e }) {
|
|
738
|
+
const a = t, r = e, { isAccept: i, uploadStatus: o, loading: m, errored: n, beforeupload: c } = yt(a, r);
|
|
739
|
+
return (u, f) => (_e(), Le("div", bt, [
|
|
740
|
+
ye(" 图片上传组件 "),
|
|
741
|
+
K(O(v($e), {
|
|
742
|
+
class: Ne([{ "loading-border": v(m) }]),
|
|
90
743
|
type: "component",
|
|
91
|
-
spinning:
|
|
744
|
+
spinning: v(m)
|
|
92
745
|
}, {
|
|
93
|
-
default:
|
|
94
|
-
|
|
746
|
+
default: R(() => [
|
|
747
|
+
O(v(He), {
|
|
95
748
|
class: "das-ui-image-upload-dragger",
|
|
96
|
-
accept:
|
|
97
|
-
"max-count":
|
|
98
|
-
"before-upload":
|
|
99
|
-
openFileDialogOnClick:
|
|
749
|
+
accept: v(i),
|
|
750
|
+
"max-count": u.maxCount,
|
|
751
|
+
"before-upload": v(c),
|
|
752
|
+
openFileDialogOnClick: u.openFileDialogOnClick
|
|
100
753
|
}, {
|
|
101
|
-
itemRender:
|
|
102
|
-
default:
|
|
103
|
-
|
|
754
|
+
itemRender: R(({ file: s, actions: h }) => f[0] || (f[0] = [])),
|
|
755
|
+
default: R(() => [
|
|
756
|
+
K(z(
|
|
104
757
|
"div",
|
|
105
|
-
|
|
758
|
+
wt,
|
|
106
759
|
[
|
|
107
|
-
|
|
108
|
-
iconColor:
|
|
760
|
+
O(v(Xe), {
|
|
761
|
+
iconColor: v(L)("--das-ui-color-secondary")
|
|
109
762
|
}, null, 8, ["iconColor"]),
|
|
110
|
-
|
|
763
|
+
z(
|
|
111
764
|
"div",
|
|
112
|
-
|
|
113
|
-
|
|
765
|
+
xt,
|
|
766
|
+
Y(u.message || v(G)("das-image-upload-text")),
|
|
114
767
|
1
|
|
115
768
|
/* TEXT */
|
|
116
769
|
)
|
|
@@ -118,7 +771,7 @@ const oe = () => ({ size2B: (t) => {
|
|
|
118
771
|
512
|
|
119
772
|
/* NEED_PATCH */
|
|
120
773
|
), [
|
|
121
|
-
[
|
|
774
|
+
[q, v(o) === "normal"]
|
|
122
775
|
])
|
|
123
776
|
]),
|
|
124
777
|
_: 1
|
|
@@ -128,41 +781,41 @@ const oe = () => ({ size2B: (t) => {
|
|
|
128
781
|
_: 1
|
|
129
782
|
/* STABLE */
|
|
130
783
|
}, 8, ["class", "spinning"]), [
|
|
131
|
-
[
|
|
784
|
+
[q, !v(n)]
|
|
132
785
|
]),
|
|
133
|
-
|
|
134
|
-
|
|
786
|
+
ye(" 错误状态 "),
|
|
787
|
+
K(z(
|
|
135
788
|
"div",
|
|
136
|
-
|
|
789
|
+
Ct,
|
|
137
790
|
[
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
iconColor:
|
|
791
|
+
z("div", Bt, [
|
|
792
|
+
O(v(Ke), {
|
|
793
|
+
iconColor: v(L)("--das-ui-color-danger"),
|
|
141
794
|
size: "small"
|
|
142
795
|
}, null, 8, ["iconColor"]),
|
|
143
|
-
|
|
796
|
+
z(
|
|
144
797
|
"div",
|
|
145
|
-
|
|
146
|
-
|
|
798
|
+
At,
|
|
799
|
+
Y(v(G)("das-image-upload-fail")),
|
|
147
800
|
1
|
|
148
801
|
/* TEXT */
|
|
149
802
|
)
|
|
150
803
|
]),
|
|
151
|
-
|
|
152
|
-
accept:
|
|
153
|
-
"before-upload":
|
|
154
|
-
"max-count":
|
|
155
|
-
openFileDialogOnClick:
|
|
804
|
+
O(v(Ve), {
|
|
805
|
+
accept: v(i),
|
|
806
|
+
"before-upload": v(c),
|
|
807
|
+
"max-count": u.maxCount,
|
|
808
|
+
openFileDialogOnClick: u.openFileDialogOnClick
|
|
156
809
|
}, {
|
|
157
|
-
itemRender:
|
|
158
|
-
default:
|
|
159
|
-
|
|
810
|
+
itemRender: R(({ file: s, actions: h }) => f[1] || (f[1] = [])),
|
|
811
|
+
default: R(() => [
|
|
812
|
+
O(v(Ge), {
|
|
160
813
|
"btn-type": "primary-text",
|
|
161
814
|
block: ""
|
|
162
815
|
}, {
|
|
163
|
-
default:
|
|
164
|
-
|
|
165
|
-
|
|
816
|
+
default: R(() => [
|
|
817
|
+
We(
|
|
818
|
+
Y(v(G)("das-image-upload-reupload")),
|
|
166
819
|
1
|
|
167
820
|
/* TEXT */
|
|
168
821
|
)
|
|
@@ -178,16 +831,16 @@ const oe = () => ({ size2B: (t) => {
|
|
|
178
831
|
512
|
|
179
832
|
/* NEED_PATCH */
|
|
180
833
|
), [
|
|
181
|
-
[
|
|
834
|
+
[q, v(n)]
|
|
182
835
|
])
|
|
183
836
|
]));
|
|
184
837
|
}
|
|
185
|
-
}),
|
|
186
|
-
const
|
|
187
|
-
for (const [
|
|
188
|
-
|
|
189
|
-
return
|
|
190
|
-
},
|
|
838
|
+
}), Et = (t, e) => {
|
|
839
|
+
const a = t.__vccOpts || t;
|
|
840
|
+
for (const [r, i] of e)
|
|
841
|
+
a[r] = i;
|
|
842
|
+
return a;
|
|
843
|
+
}, Ut = /* @__PURE__ */ Et(kt, [["__scopeId", "data-v-29473013"]]), Dt = {
|
|
191
844
|
"das-ui-import-upload-key1": {
|
|
192
845
|
"zh-CN": "上传的图片格式只能是$0",
|
|
193
846
|
en: "The uploaded picture format can only be $0",
|
|
@@ -211,16 +864,16 @@ const oe = () => ({ size2B: (t) => {
|
|
|
211
864
|
"das-image-upload-text": { "zh-CN": "上传图片", en: "Upload Image", _appCode: "framework" },
|
|
212
865
|
"das-image-upload-reupload": { "zh-CN": "重新上传", en: "Re-upload", _appCode: "framework" },
|
|
213
866
|
"das-image-upload-fail": { "zh-CN": "上传失败", en: "Uploaded Failed", _appCode: "framework" }
|
|
214
|
-
},
|
|
867
|
+
}, Tt = {
|
|
215
868
|
"--das-ui-image-upload-bgcolor": { light: "#FAFAFA" },
|
|
216
869
|
"--das-ui-image-upload-border-color": { light: "#E5E5E5" },
|
|
217
|
-
"--das-ui-image-upload-bgcolor-hover": { light:
|
|
870
|
+
"--das-ui-image-upload-bgcolor-hover": { light: L("--das-ui-color-primary-level1") },
|
|
218
871
|
"--das-ui-image-upload-border-color-hover": { light: "#5582F3" },
|
|
219
|
-
"--das-ui-image-upload-border-color-error": { light:
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
|
|
872
|
+
"--das-ui-image-upload-border-color-error": { light: L("--das-ui-color-danger-level2") }
|
|
873
|
+
}, $t = Ie(Ut);
|
|
874
|
+
Pe(Dt);
|
|
875
|
+
Se(Tt);
|
|
223
876
|
export {
|
|
224
|
-
|
|
225
|
-
|
|
877
|
+
$t as DasImageUpload,
|
|
878
|
+
$t as default
|
|
226
879
|
};
|