@kp-ui/lowcode 0.0.1 → 1.0.1
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/AttachmentRender-DrVXpYQp.mjs +783 -0
- package/AttachmentRender-DrVXpYQp.mjs.map +1 -0
- package/install-2qAQyqq8.mjs +93042 -0
- package/install-2qAQyqq8.mjs.map +1 -0
- package/package.json +8 -54
- package/tmgc-form.es.js +10 -92443
- package/tmgc-form.es.js.map +1 -0
- package/tmgc-form.style.css +6647 -7
- package/tmgc-form.umd.js +0 -59
|
@@ -0,0 +1,783 @@
|
|
|
1
|
+
import { createVNode, ref, defineComponent, onMounted, computed, resolveComponent, createElementBlock, createCommentVNode, openBlock, createElementVNode, withCtx, Fragment, renderList, createBlock, unref, toDisplayString } from "vue";
|
|
2
|
+
import { Image, Button } from "ant-design-vue";
|
|
3
|
+
import { I as Icon, u as useFilesystemApi, g as getUserInfo, S as SvgIcon, _ as _export_sfc } from "./install-2qAQyqq8.mjs";
|
|
4
|
+
var DownloadOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "download", "theme": "outlined" };
|
|
5
|
+
function _objectSpread$2(target) {
|
|
6
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7
|
+
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
8
|
+
var ownKeys = Object.keys(source);
|
|
9
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
10
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
11
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
ownKeys.forEach(function(key) {
|
|
15
|
+
_defineProperty$2(target, key, source[key]);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
}
|
|
20
|
+
function _defineProperty$2(obj, key, value) {
|
|
21
|
+
if (key in obj) {
|
|
22
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
23
|
+
} else {
|
|
24
|
+
obj[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
var DownloadOutlined = function DownloadOutlined2(props, context) {
|
|
29
|
+
var p = _objectSpread$2({}, props, context.attrs);
|
|
30
|
+
return createVNode(Icon, _objectSpread$2({}, p, {
|
|
31
|
+
"icon": DownloadOutlined$1
|
|
32
|
+
}), null);
|
|
33
|
+
};
|
|
34
|
+
DownloadOutlined.displayName = "DownloadOutlined";
|
|
35
|
+
DownloadOutlined.inheritAttrs = false;
|
|
36
|
+
var EyeOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" } }] }, "name": "eye", "theme": "outlined" };
|
|
37
|
+
function _objectSpread$1(target) {
|
|
38
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
39
|
+
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
40
|
+
var ownKeys = Object.keys(source);
|
|
41
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
42
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
43
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
ownKeys.forEach(function(key) {
|
|
47
|
+
_defineProperty$1(target, key, source[key]);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return target;
|
|
51
|
+
}
|
|
52
|
+
function _defineProperty$1(obj, key, value) {
|
|
53
|
+
if (key in obj) {
|
|
54
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
55
|
+
} else {
|
|
56
|
+
obj[key] = value;
|
|
57
|
+
}
|
|
58
|
+
return obj;
|
|
59
|
+
}
|
|
60
|
+
var EyeOutlined = function EyeOutlined2(props, context) {
|
|
61
|
+
var p = _objectSpread$1({}, props, context.attrs);
|
|
62
|
+
return createVNode(Icon, _objectSpread$1({}, p, {
|
|
63
|
+
"icon": EyeOutlined$1
|
|
64
|
+
}), null);
|
|
65
|
+
};
|
|
66
|
+
EyeOutlined.displayName = "EyeOutlined";
|
|
67
|
+
EyeOutlined.inheritAttrs = false;
|
|
68
|
+
var FileOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z" } }] }, "name": "file", "theme": "outlined" };
|
|
69
|
+
function _objectSpread(target) {
|
|
70
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
71
|
+
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
72
|
+
var ownKeys = Object.keys(source);
|
|
73
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
74
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
75
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
ownKeys.forEach(function(key) {
|
|
79
|
+
_defineProperty(target, key, source[key]);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return target;
|
|
83
|
+
}
|
|
84
|
+
function _defineProperty(obj, key, value) {
|
|
85
|
+
if (key in obj) {
|
|
86
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
87
|
+
} else {
|
|
88
|
+
obj[key] = value;
|
|
89
|
+
}
|
|
90
|
+
return obj;
|
|
91
|
+
}
|
|
92
|
+
var FileOutlined = function FileOutlined2(props, context) {
|
|
93
|
+
var p = _objectSpread({}, props, context.attrs);
|
|
94
|
+
return createVNode(Icon, _objectSpread({}, p, {
|
|
95
|
+
"icon": FileOutlined$1
|
|
96
|
+
}), null);
|
|
97
|
+
};
|
|
98
|
+
FileOutlined.displayName = "FileOutlined";
|
|
99
|
+
FileOutlined.inheritAttrs = false;
|
|
100
|
+
const token = "%[a-f0-9]{2}";
|
|
101
|
+
const singleMatcher = new RegExp("(" + token + ")|([^%]+?)", "gi");
|
|
102
|
+
const multiMatcher = new RegExp("(" + token + ")+", "gi");
|
|
103
|
+
function decodeComponents(components, split) {
|
|
104
|
+
try {
|
|
105
|
+
return [decodeURIComponent(components.join(""))];
|
|
106
|
+
} catch {
|
|
107
|
+
}
|
|
108
|
+
if (components.length === 1) {
|
|
109
|
+
return components;
|
|
110
|
+
}
|
|
111
|
+
split = split || 1;
|
|
112
|
+
const left = components.slice(0, split);
|
|
113
|
+
const right = components.slice(split);
|
|
114
|
+
return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
|
|
115
|
+
}
|
|
116
|
+
function decode$1(input) {
|
|
117
|
+
try {
|
|
118
|
+
return decodeURIComponent(input);
|
|
119
|
+
} catch {
|
|
120
|
+
let tokens = input.match(singleMatcher) || [];
|
|
121
|
+
for (let i = 1; i < tokens.length; i++) {
|
|
122
|
+
input = decodeComponents(tokens, i).join("");
|
|
123
|
+
tokens = input.match(singleMatcher) || [];
|
|
124
|
+
}
|
|
125
|
+
return input;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function customDecodeURIComponent(input) {
|
|
129
|
+
const replaceMap = {
|
|
130
|
+
"%FE%FF": "��",
|
|
131
|
+
"%FF%FE": "��"
|
|
132
|
+
};
|
|
133
|
+
let match = multiMatcher.exec(input);
|
|
134
|
+
while (match) {
|
|
135
|
+
try {
|
|
136
|
+
replaceMap[match[0]] = decodeURIComponent(match[0]);
|
|
137
|
+
} catch {
|
|
138
|
+
const result = decode$1(match[0]);
|
|
139
|
+
if (result !== match[0]) {
|
|
140
|
+
replaceMap[match[0]] = result;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
match = multiMatcher.exec(input);
|
|
144
|
+
}
|
|
145
|
+
replaceMap["%C2"] = "�";
|
|
146
|
+
const entries = Object.keys(replaceMap);
|
|
147
|
+
for (const key of entries) {
|
|
148
|
+
input = input.replace(new RegExp(key, "g"), replaceMap[key]);
|
|
149
|
+
}
|
|
150
|
+
return input;
|
|
151
|
+
}
|
|
152
|
+
function decodeUriComponent(encodedURI) {
|
|
153
|
+
if (typeof encodedURI !== "string") {
|
|
154
|
+
throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof encodedURI + "`");
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
return decodeURIComponent(encodedURI);
|
|
158
|
+
} catch {
|
|
159
|
+
return customDecodeURIComponent(encodedURI);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function includeKeys(object, predicate) {
|
|
163
|
+
const result = {};
|
|
164
|
+
if (Array.isArray(predicate)) {
|
|
165
|
+
for (const key of predicate) {
|
|
166
|
+
const descriptor = Object.getOwnPropertyDescriptor(object, key);
|
|
167
|
+
if (descriptor == null ? void 0 : descriptor.enumerable) {
|
|
168
|
+
Object.defineProperty(result, key, descriptor);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
for (const key of Reflect.ownKeys(object)) {
|
|
173
|
+
const descriptor = Object.getOwnPropertyDescriptor(object, key);
|
|
174
|
+
if (descriptor.enumerable) {
|
|
175
|
+
const value = object[key];
|
|
176
|
+
if (predicate(key, value, object)) {
|
|
177
|
+
Object.defineProperty(result, key, descriptor);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
function splitOnFirst(string, separator) {
|
|
185
|
+
if (!(typeof string === "string" && typeof separator === "string")) {
|
|
186
|
+
throw new TypeError("Expected the arguments to be of type `string`");
|
|
187
|
+
}
|
|
188
|
+
if (string === "" || separator === "") {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
const separatorIndex = string.indexOf(separator);
|
|
192
|
+
if (separatorIndex === -1) {
|
|
193
|
+
return [];
|
|
194
|
+
}
|
|
195
|
+
return [
|
|
196
|
+
string.slice(0, separatorIndex),
|
|
197
|
+
string.slice(separatorIndex + separator.length)
|
|
198
|
+
];
|
|
199
|
+
}
|
|
200
|
+
const isNullOrUndefined = (value) => value === null || value === void 0;
|
|
201
|
+
const strictUriEncode = (string) => encodeURIComponent(string).replaceAll(/[!'()*]/g, (x) => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
202
|
+
const encodeFragmentIdentifier = Symbol("encodeFragmentIdentifier");
|
|
203
|
+
function encoderForArrayFormat(options) {
|
|
204
|
+
switch (options.arrayFormat) {
|
|
205
|
+
case "index": {
|
|
206
|
+
return (key) => (result, value) => {
|
|
207
|
+
const index = result.length;
|
|
208
|
+
if (value === void 0 || options.skipNull && value === null || options.skipEmptyString && value === "") {
|
|
209
|
+
return result;
|
|
210
|
+
}
|
|
211
|
+
if (value === null) {
|
|
212
|
+
return [
|
|
213
|
+
...result,
|
|
214
|
+
[encode(key, options), "[", index, "]"].join("")
|
|
215
|
+
];
|
|
216
|
+
}
|
|
217
|
+
return [
|
|
218
|
+
...result,
|
|
219
|
+
[encode(key, options), "[", encode(index, options), "]=", encode(value, options)].join("")
|
|
220
|
+
];
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
case "bracket": {
|
|
224
|
+
return (key) => (result, value) => {
|
|
225
|
+
if (value === void 0 || options.skipNull && value === null || options.skipEmptyString && value === "") {
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
if (value === null) {
|
|
229
|
+
return [
|
|
230
|
+
...result,
|
|
231
|
+
[encode(key, options), "[]"].join("")
|
|
232
|
+
];
|
|
233
|
+
}
|
|
234
|
+
return [
|
|
235
|
+
...result,
|
|
236
|
+
[encode(key, options), "[]=", encode(value, options)].join("")
|
|
237
|
+
];
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
case "colon-list-separator": {
|
|
241
|
+
return (key) => (result, value) => {
|
|
242
|
+
if (value === void 0 || options.skipNull && value === null || options.skipEmptyString && value === "") {
|
|
243
|
+
return result;
|
|
244
|
+
}
|
|
245
|
+
if (value === null) {
|
|
246
|
+
return [
|
|
247
|
+
...result,
|
|
248
|
+
[encode(key, options), ":list="].join("")
|
|
249
|
+
];
|
|
250
|
+
}
|
|
251
|
+
return [
|
|
252
|
+
...result,
|
|
253
|
+
[encode(key, options), ":list=", encode(value, options)].join("")
|
|
254
|
+
];
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
case "comma":
|
|
258
|
+
case "separator":
|
|
259
|
+
case "bracket-separator": {
|
|
260
|
+
const keyValueSeparator = options.arrayFormat === "bracket-separator" ? "[]=" : "=";
|
|
261
|
+
return (key) => (result, value) => {
|
|
262
|
+
if (value === void 0 || options.skipNull && value === null || options.skipEmptyString && value === "") {
|
|
263
|
+
return result;
|
|
264
|
+
}
|
|
265
|
+
value = value === null ? "" : value;
|
|
266
|
+
if (result.length === 0) {
|
|
267
|
+
return [[encode(key, options), keyValueSeparator, encode(value, options)].join("")];
|
|
268
|
+
}
|
|
269
|
+
return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
default: {
|
|
273
|
+
return (key) => (result, value) => {
|
|
274
|
+
if (value === void 0 || options.skipNull && value === null || options.skipEmptyString && value === "") {
|
|
275
|
+
return result;
|
|
276
|
+
}
|
|
277
|
+
if (value === null) {
|
|
278
|
+
return [
|
|
279
|
+
...result,
|
|
280
|
+
encode(key, options)
|
|
281
|
+
];
|
|
282
|
+
}
|
|
283
|
+
return [
|
|
284
|
+
...result,
|
|
285
|
+
[encode(key, options), "=", encode(value, options)].join("")
|
|
286
|
+
];
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function parserForArrayFormat(options) {
|
|
292
|
+
let result;
|
|
293
|
+
switch (options.arrayFormat) {
|
|
294
|
+
case "index": {
|
|
295
|
+
return (key, value, accumulator) => {
|
|
296
|
+
result = /\[(\d*)]$/.exec(key);
|
|
297
|
+
key = key.replace(/\[\d*]$/, "");
|
|
298
|
+
if (!result) {
|
|
299
|
+
accumulator[key] = value;
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (accumulator[key] === void 0) {
|
|
303
|
+
accumulator[key] = {};
|
|
304
|
+
}
|
|
305
|
+
accumulator[key][result[1]] = value;
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
case "bracket": {
|
|
309
|
+
return (key, value, accumulator) => {
|
|
310
|
+
result = /(\[])$/.exec(key);
|
|
311
|
+
key = key.replace(/\[]$/, "");
|
|
312
|
+
if (!result) {
|
|
313
|
+
accumulator[key] = value;
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
if (accumulator[key] === void 0) {
|
|
317
|
+
accumulator[key] = [value];
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
accumulator[key] = [...accumulator[key], value];
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
case "colon-list-separator": {
|
|
324
|
+
return (key, value, accumulator) => {
|
|
325
|
+
result = /(:list)$/.exec(key);
|
|
326
|
+
key = key.replace(/:list$/, "");
|
|
327
|
+
if (!result) {
|
|
328
|
+
accumulator[key] = value;
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (accumulator[key] === void 0) {
|
|
332
|
+
accumulator[key] = [value];
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
accumulator[key] = [...accumulator[key], value];
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
case "comma":
|
|
339
|
+
case "separator": {
|
|
340
|
+
return (key, value, accumulator) => {
|
|
341
|
+
const isArray = typeof value === "string" && value.includes(options.arrayFormatSeparator);
|
|
342
|
+
const isEncodedArray = typeof value === "string" && !isArray && decode(value, options).includes(options.arrayFormatSeparator);
|
|
343
|
+
value = isEncodedArray ? decode(value, options) : value;
|
|
344
|
+
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map((item) => decode(item, options)) : value === null ? value : decode(value, options);
|
|
345
|
+
accumulator[key] = newValue;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
case "bracket-separator": {
|
|
349
|
+
return (key, value, accumulator) => {
|
|
350
|
+
const isArray = /(\[])$/.test(key);
|
|
351
|
+
key = key.replace(/\[]$/, "");
|
|
352
|
+
if (!isArray) {
|
|
353
|
+
accumulator[key] = value ? decode(value, options) : value;
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
const arrayValue = value === null ? [] : decode(value, options).split(options.arrayFormatSeparator);
|
|
357
|
+
if (accumulator[key] === void 0) {
|
|
358
|
+
accumulator[key] = arrayValue;
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
accumulator[key] = [...accumulator[key], ...arrayValue];
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
default: {
|
|
365
|
+
return (key, value, accumulator) => {
|
|
366
|
+
if (accumulator[key] === void 0) {
|
|
367
|
+
accumulator[key] = value;
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
accumulator[key] = [...[accumulator[key]].flat(), value];
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function validateArrayFormatSeparator(value) {
|
|
376
|
+
if (typeof value !== "string" || value.length !== 1) {
|
|
377
|
+
throw new TypeError("arrayFormatSeparator must be single character string");
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function encode(value, options) {
|
|
381
|
+
if (options.encode) {
|
|
382
|
+
return options.strict ? strictUriEncode(value) : encodeURIComponent(value);
|
|
383
|
+
}
|
|
384
|
+
return value;
|
|
385
|
+
}
|
|
386
|
+
function decode(value, options) {
|
|
387
|
+
if (options.decode) {
|
|
388
|
+
return decodeUriComponent(value);
|
|
389
|
+
}
|
|
390
|
+
return value;
|
|
391
|
+
}
|
|
392
|
+
function keysSorter(input) {
|
|
393
|
+
if (Array.isArray(input)) {
|
|
394
|
+
return input.sort();
|
|
395
|
+
}
|
|
396
|
+
if (typeof input === "object") {
|
|
397
|
+
return keysSorter(Object.keys(input)).sort((a, b) => Number(a) - Number(b)).map((key) => input[key]);
|
|
398
|
+
}
|
|
399
|
+
return input;
|
|
400
|
+
}
|
|
401
|
+
function removeHash(input) {
|
|
402
|
+
const hashStart = input.indexOf("#");
|
|
403
|
+
if (hashStart !== -1) {
|
|
404
|
+
input = input.slice(0, hashStart);
|
|
405
|
+
}
|
|
406
|
+
return input;
|
|
407
|
+
}
|
|
408
|
+
function getHash(url) {
|
|
409
|
+
let hash = "";
|
|
410
|
+
const hashStart = url.indexOf("#");
|
|
411
|
+
if (hashStart !== -1) {
|
|
412
|
+
hash = url.slice(hashStart);
|
|
413
|
+
}
|
|
414
|
+
return hash;
|
|
415
|
+
}
|
|
416
|
+
function parseValue(value, options, type) {
|
|
417
|
+
if (type === "string" && typeof value === "string") {
|
|
418
|
+
return value;
|
|
419
|
+
}
|
|
420
|
+
if (typeof type === "function" && typeof value === "string") {
|
|
421
|
+
return type(value);
|
|
422
|
+
}
|
|
423
|
+
if (options.parseBooleans && value !== null && (value.toLowerCase() === "true" || value.toLowerCase() === "false")) {
|
|
424
|
+
return value.toLowerCase() === "true";
|
|
425
|
+
}
|
|
426
|
+
if (type === "number" && !Number.isNaN(Number(value)) && (typeof value === "string" && value.trim() !== "")) {
|
|
427
|
+
return Number(value);
|
|
428
|
+
}
|
|
429
|
+
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === "string" && value.trim() !== "")) {
|
|
430
|
+
return Number(value);
|
|
431
|
+
}
|
|
432
|
+
return value;
|
|
433
|
+
}
|
|
434
|
+
function extract(input) {
|
|
435
|
+
input = removeHash(input);
|
|
436
|
+
const queryStart = input.indexOf("?");
|
|
437
|
+
if (queryStart === -1) {
|
|
438
|
+
return "";
|
|
439
|
+
}
|
|
440
|
+
return input.slice(queryStart + 1);
|
|
441
|
+
}
|
|
442
|
+
function parse(query, options) {
|
|
443
|
+
options = {
|
|
444
|
+
decode: true,
|
|
445
|
+
sort: true,
|
|
446
|
+
arrayFormat: "none",
|
|
447
|
+
arrayFormatSeparator: ",",
|
|
448
|
+
parseNumbers: false,
|
|
449
|
+
parseBooleans: false,
|
|
450
|
+
types: /* @__PURE__ */ Object.create(null),
|
|
451
|
+
...options
|
|
452
|
+
};
|
|
453
|
+
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
454
|
+
const formatter = parserForArrayFormat(options);
|
|
455
|
+
const returnValue = /* @__PURE__ */ Object.create(null);
|
|
456
|
+
if (typeof query !== "string") {
|
|
457
|
+
return returnValue;
|
|
458
|
+
}
|
|
459
|
+
query = query.trim().replace(/^[?#&]/, "");
|
|
460
|
+
if (!query) {
|
|
461
|
+
return returnValue;
|
|
462
|
+
}
|
|
463
|
+
for (const parameter of query.split("&")) {
|
|
464
|
+
if (parameter === "") {
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
467
|
+
const parameter_ = options.decode ? parameter.replaceAll("+", " ") : parameter;
|
|
468
|
+
let [key, value] = splitOnFirst(parameter_, "=");
|
|
469
|
+
if (key === void 0) {
|
|
470
|
+
key = parameter_;
|
|
471
|
+
}
|
|
472
|
+
value = value === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(options.arrayFormat) ? value : decode(value, options);
|
|
473
|
+
formatter(decode(key, options), value, returnValue);
|
|
474
|
+
}
|
|
475
|
+
for (const [key, value] of Object.entries(returnValue)) {
|
|
476
|
+
if (typeof value === "object" && value !== null && options.types[key] !== "string") {
|
|
477
|
+
for (const [key2, value2] of Object.entries(value)) {
|
|
478
|
+
const type = options.types[key] ? options.types[key].replace("[]", "") : void 0;
|
|
479
|
+
value[key2] = parseValue(value2, options, type);
|
|
480
|
+
}
|
|
481
|
+
} else if (typeof value === "object" && value !== null && options.types[key] === "string") {
|
|
482
|
+
returnValue[key] = Object.values(value).join(options.arrayFormatSeparator);
|
|
483
|
+
} else {
|
|
484
|
+
returnValue[key] = parseValue(value, options, options.types[key]);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
if (options.sort === false) {
|
|
488
|
+
return returnValue;
|
|
489
|
+
}
|
|
490
|
+
return (options.sort === true ? Object.keys(returnValue).sort() : Object.keys(returnValue).sort(options.sort)).reduce((result, key) => {
|
|
491
|
+
const value = returnValue[key];
|
|
492
|
+
result[key] = Boolean(value) && typeof value === "object" && !Array.isArray(value) ? keysSorter(value) : value;
|
|
493
|
+
return result;
|
|
494
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
495
|
+
}
|
|
496
|
+
function stringify(object, options) {
|
|
497
|
+
if (!object) {
|
|
498
|
+
return "";
|
|
499
|
+
}
|
|
500
|
+
options = {
|
|
501
|
+
encode: true,
|
|
502
|
+
strict: true,
|
|
503
|
+
arrayFormat: "none",
|
|
504
|
+
arrayFormatSeparator: ",",
|
|
505
|
+
...options
|
|
506
|
+
};
|
|
507
|
+
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
508
|
+
const shouldFilter = (key) => options.skipNull && isNullOrUndefined(object[key]) || options.skipEmptyString && object[key] === "";
|
|
509
|
+
const formatter = encoderForArrayFormat(options);
|
|
510
|
+
const objectCopy = {};
|
|
511
|
+
for (const [key, value] of Object.entries(object)) {
|
|
512
|
+
if (!shouldFilter(key)) {
|
|
513
|
+
objectCopy[key] = value;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
const keys = Object.keys(objectCopy);
|
|
517
|
+
if (options.sort !== false) {
|
|
518
|
+
keys.sort(options.sort);
|
|
519
|
+
}
|
|
520
|
+
return keys.map((key) => {
|
|
521
|
+
const value = object[key];
|
|
522
|
+
if (value === void 0) {
|
|
523
|
+
return "";
|
|
524
|
+
}
|
|
525
|
+
if (value === null) {
|
|
526
|
+
return encode(key, options);
|
|
527
|
+
}
|
|
528
|
+
if (Array.isArray(value)) {
|
|
529
|
+
if (value.length === 0 && options.arrayFormat === "bracket-separator") {
|
|
530
|
+
return encode(key, options) + "[]";
|
|
531
|
+
}
|
|
532
|
+
return value.reduce(formatter(key), []).join("&");
|
|
533
|
+
}
|
|
534
|
+
return encode(key, options) + "=" + encode(value, options);
|
|
535
|
+
}).filter((x) => x.length > 0).join("&");
|
|
536
|
+
}
|
|
537
|
+
function parseUrl(url, options) {
|
|
538
|
+
var _a;
|
|
539
|
+
options = {
|
|
540
|
+
decode: true,
|
|
541
|
+
...options
|
|
542
|
+
};
|
|
543
|
+
let [url_, hash] = splitOnFirst(url, "#");
|
|
544
|
+
if (url_ === void 0) {
|
|
545
|
+
url_ = url;
|
|
546
|
+
}
|
|
547
|
+
return {
|
|
548
|
+
url: ((_a = url_ == null ? void 0 : url_.split("?")) == null ? void 0 : _a[0]) ?? "",
|
|
549
|
+
query: parse(extract(url), options),
|
|
550
|
+
...options && options.parseFragmentIdentifier && hash ? { fragmentIdentifier: decode(hash, options) } : {}
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function stringifyUrl(object, options) {
|
|
554
|
+
options = {
|
|
555
|
+
encode: true,
|
|
556
|
+
strict: true,
|
|
557
|
+
[encodeFragmentIdentifier]: true,
|
|
558
|
+
...options
|
|
559
|
+
};
|
|
560
|
+
const url = removeHash(object.url).split("?")[0] || "";
|
|
561
|
+
const queryFromUrl = extract(object.url);
|
|
562
|
+
const query = {
|
|
563
|
+
...parse(queryFromUrl, { sort: false }),
|
|
564
|
+
...object.query
|
|
565
|
+
};
|
|
566
|
+
let queryString2 = stringify(query, options);
|
|
567
|
+
queryString2 && (queryString2 = `?${queryString2}`);
|
|
568
|
+
let hash = getHash(object.url);
|
|
569
|
+
if (typeof object.fragmentIdentifier === "string") {
|
|
570
|
+
const urlObjectForFragmentEncode = new URL(url);
|
|
571
|
+
urlObjectForFragmentEncode.hash = object.fragmentIdentifier;
|
|
572
|
+
hash = options[encodeFragmentIdentifier] ? urlObjectForFragmentEncode.hash : `#${object.fragmentIdentifier}`;
|
|
573
|
+
}
|
|
574
|
+
return `${url}${queryString2}${hash}`;
|
|
575
|
+
}
|
|
576
|
+
function pick(input, filter, options) {
|
|
577
|
+
options = {
|
|
578
|
+
parseFragmentIdentifier: true,
|
|
579
|
+
[encodeFragmentIdentifier]: false,
|
|
580
|
+
...options
|
|
581
|
+
};
|
|
582
|
+
const { url, query, fragmentIdentifier } = parseUrl(input, options);
|
|
583
|
+
return stringifyUrl({
|
|
584
|
+
url,
|
|
585
|
+
query: includeKeys(query, filter),
|
|
586
|
+
fragmentIdentifier
|
|
587
|
+
}, options);
|
|
588
|
+
}
|
|
589
|
+
function exclude(input, filter, options) {
|
|
590
|
+
const exclusionFilter = Array.isArray(filter) ? (key) => !filter.includes(key) : (key, value) => !filter(key, value);
|
|
591
|
+
return pick(input, exclusionFilter, options);
|
|
592
|
+
}
|
|
593
|
+
const queryString = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
594
|
+
__proto__: null,
|
|
595
|
+
exclude,
|
|
596
|
+
extract,
|
|
597
|
+
parse,
|
|
598
|
+
parseUrl,
|
|
599
|
+
pick,
|
|
600
|
+
stringify,
|
|
601
|
+
stringifyUrl
|
|
602
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
603
|
+
const getDoMain = () => {
|
|
604
|
+
return window.location.origin;
|
|
605
|
+
};
|
|
606
|
+
function useFilePreview() {
|
|
607
|
+
const fileUrlCache = ref(/* @__PURE__ */ new Map());
|
|
608
|
+
const filesystemApi = useFilesystemApi();
|
|
609
|
+
const getPreviewFileUrl = async (fileCode) => {
|
|
610
|
+
if (fileUrlCache.value.has(fileCode)) {
|
|
611
|
+
return fileUrlCache.value.get(fileCode);
|
|
612
|
+
}
|
|
613
|
+
const fileUrlObj = await filesystemApi.getPreviewFileUrl({ fileCode });
|
|
614
|
+
fileUrlCache.value.set(fileCode, fileUrlObj.data.value);
|
|
615
|
+
return fileUrlObj.data.value;
|
|
616
|
+
};
|
|
617
|
+
const getPreviewData = async (data) => {
|
|
618
|
+
const res = data.map(async (item) => {
|
|
619
|
+
return {
|
|
620
|
+
...item,
|
|
621
|
+
previewUrl: await getPreviewFileUrl(item.fileCode)
|
|
622
|
+
};
|
|
623
|
+
});
|
|
624
|
+
return Promise.all(res);
|
|
625
|
+
};
|
|
626
|
+
const handlePreview = async (file) => {
|
|
627
|
+
var _a, _b;
|
|
628
|
+
if (![".png", ".jpg", ".jpeg", ".gif"].includes(file.fileType || "")) {
|
|
629
|
+
const localUserInfo = getUserInfo();
|
|
630
|
+
const employeeId = (_a = localUserInfo == null ? void 0 : localUserInfo.loginInfo) == null ? void 0 : _a.employeeId;
|
|
631
|
+
const { tokenId, tenantId } = (_b = localUserInfo == null ? void 0 : localUserInfo.loginInfo) == null ? void 0 : _b.userToken;
|
|
632
|
+
const doMain = getDoMain();
|
|
633
|
+
const obj = {
|
|
634
|
+
tenantId,
|
|
635
|
+
tokenId,
|
|
636
|
+
employeeId,
|
|
637
|
+
fileCode: file.fileCode
|
|
638
|
+
};
|
|
639
|
+
console.log({ doMain });
|
|
640
|
+
window.open(`${doMain}/view-file/preview?${queryString.stringify(obj)}`);
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
const handleDownload = async (file) => {
|
|
644
|
+
try {
|
|
645
|
+
await filesystemApi.downloadFileObject({ fileCode: file.fileCode });
|
|
646
|
+
} catch (error) {
|
|
647
|
+
console.error("下载文件失败:", error);
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
return {
|
|
651
|
+
fileUrlCache,
|
|
652
|
+
handleDownload,
|
|
653
|
+
handlePreview,
|
|
654
|
+
getPreviewData,
|
|
655
|
+
getPreviewFileUrl
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
const FileIcon = /* @__PURE__ */ defineComponent({
|
|
659
|
+
name: "FileIcon",
|
|
660
|
+
props: {
|
|
661
|
+
file: {
|
|
662
|
+
type: Object,
|
|
663
|
+
required: true
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
setup(props) {
|
|
667
|
+
return () => {
|
|
668
|
+
const fieldTypes = props.file.fileType || "";
|
|
669
|
+
try {
|
|
670
|
+
if ([".xls", ".xlsx"].includes(fieldTypes.toLowerCase())) {
|
|
671
|
+
return createVNode(SvgIcon, {
|
|
672
|
+
"icon-class": "excel"
|
|
673
|
+
}, null);
|
|
674
|
+
}
|
|
675
|
+
if ([".doc", ".docx"].includes(fieldTypes.toLowerCase())) {
|
|
676
|
+
return createVNode(SvgIcon, {
|
|
677
|
+
"icon-class": "word"
|
|
678
|
+
}, null);
|
|
679
|
+
}
|
|
680
|
+
if ([".pdf"].includes(fieldTypes.toLowerCase())) {
|
|
681
|
+
return createVNode(SvgIcon, {
|
|
682
|
+
"icon-class": "pdf"
|
|
683
|
+
}, null);
|
|
684
|
+
}
|
|
685
|
+
} catch {
|
|
686
|
+
}
|
|
687
|
+
return createVNode(FileOutlined, null, null);
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
const _hoisted_1 = {
|
|
692
|
+
key: 0,
|
|
693
|
+
class: "attachment-render"
|
|
694
|
+
};
|
|
695
|
+
const _hoisted_2 = { class: "file-list" };
|
|
696
|
+
const _hoisted_3 = { class: "image-preview" };
|
|
697
|
+
const _hoisted_4 = { class: "file-name" };
|
|
698
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
699
|
+
__name: "AttachmentRender",
|
|
700
|
+
props: {
|
|
701
|
+
data: { default: () => [] }
|
|
702
|
+
},
|
|
703
|
+
setup(__props) {
|
|
704
|
+
const props = __props;
|
|
705
|
+
const { getPreviewData, handlePreview, handleDownload } = useFilePreview();
|
|
706
|
+
const attachmentList = ref([]);
|
|
707
|
+
ref(false);
|
|
708
|
+
onMounted(async () => {
|
|
709
|
+
let data = props.data || [];
|
|
710
|
+
if (typeof data === "string") {
|
|
711
|
+
data = JSON.parse(data);
|
|
712
|
+
}
|
|
713
|
+
if ((data == null ? void 0 : data.length) === 0) {
|
|
714
|
+
attachmentList.value = [];
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
attachmentList.value = await getPreviewData(data);
|
|
718
|
+
});
|
|
719
|
+
const isImageFile = (file) => {
|
|
720
|
+
const imageExtensions = [".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp"];
|
|
721
|
+
return imageExtensions.some((ext) => file.fileType.toLowerCase().endsWith(ext));
|
|
722
|
+
};
|
|
723
|
+
const fileList = computed(() => {
|
|
724
|
+
return attachmentList.value.filter((file) => !isImageFile(file));
|
|
725
|
+
});
|
|
726
|
+
const imageList = computed(() => {
|
|
727
|
+
return attachmentList.value.filter((file) => isImageFile(file));
|
|
728
|
+
});
|
|
729
|
+
return (_ctx, _cache) => {
|
|
730
|
+
const _component_a_image_preview_group = resolveComponent("a-image-preview-group");
|
|
731
|
+
return attachmentList.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
732
|
+
createElementVNode("div", _hoisted_2, [
|
|
733
|
+
createElementVNode("div", _hoisted_3, [
|
|
734
|
+
createVNode(_component_a_image_preview_group, null, {
|
|
735
|
+
default: withCtx(() => [
|
|
736
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(imageList.value, (file) => {
|
|
737
|
+
return openBlock(), createBlock(unref(Image), {
|
|
738
|
+
key: file.fileCode,
|
|
739
|
+
src: file.previewUrl,
|
|
740
|
+
class: "preview-image"
|
|
741
|
+
}, null, 8, ["src"]);
|
|
742
|
+
}), 128))
|
|
743
|
+
]),
|
|
744
|
+
_: 1
|
|
745
|
+
})
|
|
746
|
+
]),
|
|
747
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(fileList.value, (file, index) => {
|
|
748
|
+
return openBlock(), createElementBlock("div", {
|
|
749
|
+
key: index,
|
|
750
|
+
class: "file-item"
|
|
751
|
+
}, [
|
|
752
|
+
createVNode(unref(FileIcon), { file }, null, 8, ["file"]),
|
|
753
|
+
createElementVNode("span", _hoisted_4, toDisplayString(file.fileName), 1),
|
|
754
|
+
createVNode(unref(Button), {
|
|
755
|
+
type: "link",
|
|
756
|
+
onClick: () => unref(handleDownload)(file)
|
|
757
|
+
}, {
|
|
758
|
+
icon: withCtx(() => [
|
|
759
|
+
createVNode(unref(DownloadOutlined))
|
|
760
|
+
]),
|
|
761
|
+
_: 2
|
|
762
|
+
}, 1032, ["onClick"]),
|
|
763
|
+
createVNode(unref(Button), {
|
|
764
|
+
type: "link",
|
|
765
|
+
onClick: () => unref(handlePreview)(file)
|
|
766
|
+
}, {
|
|
767
|
+
icon: withCtx(() => [
|
|
768
|
+
createVNode(unref(EyeOutlined))
|
|
769
|
+
]),
|
|
770
|
+
_: 2
|
|
771
|
+
}, 1032, ["onClick"])
|
|
772
|
+
]);
|
|
773
|
+
}), 128))
|
|
774
|
+
])
|
|
775
|
+
])) : createCommentVNode("", true);
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
const AttachmentRender = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c0780063"]]);
|
|
780
|
+
export {
|
|
781
|
+
AttachmentRender as default
|
|
782
|
+
};
|
|
783
|
+
//# sourceMappingURL=AttachmentRender-DrVXpYQp.mjs.map
|